diff --git a/src/nimqml.nim b/src/nimqml.nim index 52eb06d..a9042b7 100644 --- a/src/nimqml.nim +++ b/src/nimqml.nim @@ -19,9 +19,7 @@ include "nimqml/private/qnetworkconfigurationmanager.nim" include "nimqml/private/qvariant.nim" include "nimqml/private/qobject.nim" include "nimqml/private/qqmlapplicationengine.nim" -include "nimqml/private/qcoreapplication.nim" include "nimqml/private/qguiapplication.nim" -include "nimqml/private/qapplication.nim" include "nimqml/private/qurl.nim" include "nimqml/private/qquickview.nim" include "nimqml/private/qhashintbytearray.nim" diff --git a/src/nimqml/private/dotherside.nim b/src/nimqml/private/dotherside.nim index 099d1cb..61ec934 100644 --- a/src/nimqml/private/dotherside.nim +++ b/src/nimqml/private/dotherside.nim @@ -127,29 +127,20 @@ proc isNil(x: DosQModelIndex): bool = x.pointer.isNil # CharArray proc dos_chararray_delete(str: cstring) {.cdecl, dynlib: dynLibName, importc.} -# QCoreApplication -proc dos_qcoreapplication_application_dir_path(): cstring {.cdecl, dynlib: dynLibName, importc.} -proc dos_qapplication_enable_hdpi(uiScaleFilePath: cstring) {.cdecl, dynlib: dynLibName, importc.} -proc dos_qapplication_initialize_opengl() {.cdecl, dynlib: dynLibName, importc.} - -# QApplication -proc dos_qapplication_create() {.cdecl, dynlib: dynLibName, importc.} -proc dos_qapplication_exec() {.cdecl, dynlib: dynLibName, importc.} -proc dos_qapplication_quit() {.cdecl, dynlib: dynLibName, importc.} -proc dos_qapplication_icon(filename: cstring) {.cdecl, dynlib: dynLibName, importc.} -proc dos_qapplication_delete() {.cdecl, dynlib: dynLibName, importc.} -proc dos_qapplication_clipboard_setText(content: cstring) {.cdecl, dynlib: dynLibName, importc.} -proc dos_qapplication_installEventFilter(engine: DosStatusEvent) {.cdecl, dynlib: dynLibName, importc.} -proc dos_qapplication_clipboard_setImage(content: cstring) {.cdecl, dynlib: dynLibName, importc.} -proc dos_qapplication_download_image(imageSource: cstring, filePath: cstring) {.cdecl, dynlib: dynLibName, importc.} - # QGuiApplication +proc dos_qguiapplication_application_dir_path(): cstring {.cdecl, dynlib: dynLibName, importc.} +proc dos_qguiapplication_enable_hdpi(uiScaleFilePath: cstring) {.cdecl, dynlib: dynLibName, importc.} +proc dos_qguiapplication_initialize_opengl() {.cdecl, dynlib: dynLibName, importc.} proc dos_qguiapplication_create() {.cdecl, dynlib: dynLibName, importc.} proc dos_qguiapplication_exec() {.cdecl, dynlib: dynLibName, importc.} proc dos_qguiapplication_quit() {.cdecl, dynlib: dynLibName, importc.} proc dos_qguiapplication_icon(filename: cstring) {.cdecl, dynlib: dynLibName, importc.} proc dos_qguiapplication_delete() {.cdecl, dynlib: dynLibName, importc.} + +proc dos_qguiapplication_clipboard_setText(content: cstring) {.cdecl, dynlib: dynLibName, importc.} proc dos_qguiapplication_installEventFilter(engine: DosStatusEvent) {.cdecl, dynlib: dynLibName, importc.} +proc dos_qguiapplication_clipboard_setImage(content: cstring) {.cdecl, dynlib: dynLibName, importc.} +proc dos_qguiapplication_download_image(imageSource: cstring, filePath: cstring) {.cdecl, dynlib: dynLibName, importc.} # QQmlContext proc dos_qqmlcontext_setcontextproperty(context: DosQQmlContext, propertyName: cstring, propertyValue: DosQVariant) {.cdecl, dynlib: dynLibName, importc.} @@ -164,7 +155,7 @@ proc dos_qqmlapplicationengine_load_data(engine: DosQQmlApplicationEngine, data: proc dos_qqmlapplicationengine_add_import_path(engine: DosQQmlApplicationEngine, path: cstring) {.cdecl, dynlib: dynLibName, importc.} proc dos_qqmlapplicationengine_context(engine: DosQQmlApplicationEngine): DosQQmlContext {.cdecl, dynlib: dynLibName, importc.} proc dos_qqmlapplicationengine_delete(engine: DosQQmlApplicationEngine) {.cdecl, dynlib: dynLibName, importc.} -proc dos_qapplication_load_translation(engine: DosQQmlApplicationEngine, content: cstring, shouldRetranslate: bool) {.cdecl, dynlib: dynLibName, importc.} +proc dos_qguiapplication_load_translation(engine: DosQQmlApplicationEngine, content: cstring, shouldRetranslate: bool) {.cdecl, dynlib: dynLibName, importc.} # QVariant proc dos_qvariant_create(): DosQVariant {.cdecl, dynlib: dynLibName, importc.} @@ -391,4 +382,4 @@ proc dos_to_local_file(fileUrl: cstring): cstring {.cdecl, dynlib: dynLibName, importc.} proc dos_from_local_file(filePath: cstring): cstring - {.cdecl, dynlib: dynLibName, importc.} \ No newline at end of file + {.cdecl, dynlib: dynLibName, importc.} diff --git a/src/nimqml/private/qcoreapplication.nim b/src/nimqml/private/qcoreapplication.nim deleted file mode 100644 index ca1ca6f..0000000 --- a/src/nimqml/private/qcoreapplication.nim +++ /dev/null @@ -1,10 +0,0 @@ -proc enableHDPI*(uiScaleFilePath: string) = - dos_qapplication_enable_hdpi(uiScaleFilePath) - -proc initializeOpenGL*() = - dos_qapplication_initialize_opengl() - -proc applicationDirPath*(app: QCoreApplication): string = - let str = dos_qcoreapplication_application_dir_path() - result = $str - dos_chararray_delete(str) diff --git a/src/nimqml/private/qguiapplication.nim b/src/nimqml/private/qguiapplication.nim index b395f8c..a60ebc6 100644 --- a/src/nimqml/private/qguiapplication.nim +++ b/src/nimqml/private/qguiapplication.nim @@ -31,3 +31,23 @@ proc exec*(self: QGuiApplication) = proc quit*(self: QGuiApplication) = ## Quit the Qt event loop dos_qguiapplication_quit() + +proc setClipboardText*(text: string = "") = + dos_qguiapplication_clipboard_setText(text.cstring) + +proc setClipboardImage*(text: string = "") = + dos_qguiapplication_clipboard_setImage(text.cstring) + +proc downloadImage*(imageSource: string = "", filePath = "") = + dos_qguiapplication_download_image(imageSource.cstring, filePath.cstring) + +proc enableHDPI*(uiScaleFilePath: string) = + dos_qguiapplication_enable_hdpi(uiScaleFilePath) + +proc initializeOpenGL*() = + dos_qguiapplication_initialize_opengl() + +proc applicationDirPath*(app: QGuiApplication): string = + let str = dos_qguiapplication_application_dir_path() + result = $str + dos_chararray_delete(str) diff --git a/src/nimqml/private/qqmlapplicationengine.nim b/src/nimqml/private/qqmlapplicationengine.nim index d8206c1..14f398e 100644 --- a/src/nimqml/private/qqmlapplicationengine.nim +++ b/src/nimqml/private/qqmlapplicationengine.nim @@ -30,7 +30,7 @@ proc setRootContextProperty*(self: QQmlApplicationEngine, name: string, value: Q dos_qqmlcontext_setcontextproperty(context, name.cstring, value.vptr) proc setTranslationPackage*(self: QQmlApplicationEngine, packagePath: string, shouldRetranslate: bool = true) = - dos_qapplication_load_translation(self.vptr, packagePath.cstring, shouldRetranslate) + dos_qguiapplication_load_translation(self.vptr, packagePath.cstring, shouldRetranslate) proc delete*(self: QQmlApplicationEngine) = ## Delete the given QQmlApplicationEngine