mirror of https://github.com/status-im/nimqml.git
QGuiApplication to not mess with QCoreApplication and QApplication
This commit is contained in:
parent
b5ed94dfb4
commit
c60406b288
|
@ -19,9 +19,7 @@ include "nimqml/private/qnetworkconfigurationmanager.nim"
|
||||||
include "nimqml/private/qvariant.nim"
|
include "nimqml/private/qvariant.nim"
|
||||||
include "nimqml/private/qobject.nim"
|
include "nimqml/private/qobject.nim"
|
||||||
include "nimqml/private/qqmlapplicationengine.nim"
|
include "nimqml/private/qqmlapplicationengine.nim"
|
||||||
include "nimqml/private/qcoreapplication.nim"
|
|
||||||
include "nimqml/private/qguiapplication.nim"
|
include "nimqml/private/qguiapplication.nim"
|
||||||
include "nimqml/private/qapplication.nim"
|
|
||||||
include "nimqml/private/qurl.nim"
|
include "nimqml/private/qurl.nim"
|
||||||
include "nimqml/private/qquickview.nim"
|
include "nimqml/private/qquickview.nim"
|
||||||
include "nimqml/private/qhashintbytearray.nim"
|
include "nimqml/private/qhashintbytearray.nim"
|
||||||
|
|
|
@ -127,29 +127,20 @@ proc isNil(x: DosQModelIndex): bool = x.pointer.isNil
|
||||||
# CharArray
|
# CharArray
|
||||||
proc dos_chararray_delete(str: cstring) {.cdecl, dynlib: dynLibName, importc.}
|
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
|
# 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_create() {.cdecl, dynlib: dynLibName, importc.}
|
||||||
proc dos_qguiapplication_exec() {.cdecl, dynlib: dynLibName, importc.}
|
proc dos_qguiapplication_exec() {.cdecl, dynlib: dynLibName, importc.}
|
||||||
proc dos_qguiapplication_quit() {.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_icon(filename: cstring) {.cdecl, dynlib: dynLibName, importc.}
|
||||||
proc dos_qguiapplication_delete() {.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_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
|
# QQmlContext
|
||||||
proc dos_qqmlcontext_setcontextproperty(context: DosQQmlContext, propertyName: cstring, propertyValue: DosQVariant) {.cdecl, dynlib: dynLibName, importc.}
|
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_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_context(engine: DosQQmlApplicationEngine): DosQQmlContext {.cdecl, dynlib: dynLibName, importc.}
|
||||||
proc dos_qqmlapplicationengine_delete(engine: DosQQmlApplicationEngine) {.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
|
# QVariant
|
||||||
proc dos_qvariant_create(): DosQVariant {.cdecl, dynlib: dynLibName, importc.}
|
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.}
|
{.cdecl, dynlib: dynLibName, importc.}
|
||||||
|
|
||||||
proc dos_from_local_file(filePath: cstring): cstring
|
proc dos_from_local_file(filePath: cstring): cstring
|
||||||
{.cdecl, dynlib: dynLibName, importc.}
|
{.cdecl, dynlib: dynLibName, importc.}
|
||||||
|
|
|
@ -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)
|
|
|
@ -31,3 +31,23 @@ proc exec*(self: QGuiApplication) =
|
||||||
proc quit*(self: QGuiApplication) =
|
proc quit*(self: QGuiApplication) =
|
||||||
## Quit the Qt event loop
|
## Quit the Qt event loop
|
||||||
dos_qguiapplication_quit()
|
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)
|
||||||
|
|
|
@ -30,7 +30,7 @@ proc setRootContextProperty*(self: QQmlApplicationEngine, name: string, value: Q
|
||||||
dos_qqmlcontext_setcontextproperty(context, name.cstring, value.vptr)
|
dos_qqmlcontext_setcontextproperty(context, name.cstring, value.vptr)
|
||||||
|
|
||||||
proc setTranslationPackage*(self: QQmlApplicationEngine, packagePath: string, shouldRetranslate: bool = true) =
|
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) =
|
proc delete*(self: QQmlApplicationEngine) =
|
||||||
## Delete the given QQmlApplicationEngine
|
## Delete the given QQmlApplicationEngine
|
||||||
|
|
Loading…
Reference in New Issue