mirror of https://github.com/status-im/nimqml.git
Expose network access manager functions
This commit is contained in:
parent
aa6a4196db
commit
543ec079c4
|
@ -16,6 +16,7 @@ type
|
||||||
NimQAbstractTableModel = pointer
|
NimQAbstractTableModel = pointer
|
||||||
DosQMetaObject = distinct pointer
|
DosQMetaObject = distinct pointer
|
||||||
DosQObject = distinct pointer
|
DosQObject = distinct pointer
|
||||||
|
DosQQNetworkAccessManagerFactory = distinct pointer
|
||||||
DosQObjectWrapper = distinct pointer
|
DosQObjectWrapper = distinct pointer
|
||||||
DosQVariant = distinct pointer
|
DosQVariant = distinct pointer
|
||||||
DosQQmlContext = distinct pointer
|
DosQQmlContext = distinct pointer
|
||||||
|
@ -145,6 +146,7 @@ proc dos_qqmlcontext_setcontextproperty(context: DosQQmlContext, propertyName: c
|
||||||
|
|
||||||
# QQmlApplicationEngine
|
# QQmlApplicationEngine
|
||||||
proc dos_qqmlapplicationengine_create(): DosQQmlApplicationEngine {.cdecl, dynlib: dynLibName, importc.}
|
proc dos_qqmlapplicationengine_create(): DosQQmlApplicationEngine {.cdecl, dynlib: dynLibName, importc.}
|
||||||
|
proc dos_qqmlapplicationengine_setNetworkAccessManagerFactory(engine: DosQQmlApplicationEngine, factory: DosQQNetworkAccessManagerFactory) {.cdecl, dynlib: dynLibName, importc.}
|
||||||
proc dos_qqmlapplicationengine_load(engine: DosQQmlApplicationEngine, filename: cstring) {.cdecl, dynlib: dynLibName, importc.}
|
proc dos_qqmlapplicationengine_load(engine: DosQQmlApplicationEngine, filename: cstring) {.cdecl, dynlib: dynLibName, importc.}
|
||||||
proc dos_qqmlapplicationengine_load_url(engine: DosQQmlApplicationEngine, url: DosQUrl) {.cdecl, dynlib: dynLibName, importc.}
|
proc dos_qqmlapplicationengine_load_url(engine: DosQQmlApplicationEngine, url: DosQUrl) {.cdecl, dynlib: dynLibName, importc.}
|
||||||
proc dos_qqmlapplicationengine_load_data(engine: DosQQmlApplicationEngine, data: cstring) {.cdecl, dynlib: dynLibName, importc.}
|
proc dos_qqmlapplicationengine_load_data(engine: DosQQmlApplicationEngine, data: cstring) {.cdecl, dynlib: dynLibName, importc.}
|
||||||
|
@ -209,6 +211,8 @@ proc dos_qurl_to_string(vptr: DosQUrl): cstring {.cdecl, dynlib: dynLibName, imp
|
||||||
proc dos_qncm_create(): DosQObject {.cdecl, dynlib: dynLibName, importc.}
|
proc dos_qncm_create(): DosQObject {.cdecl, dynlib: dynLibName, importc.}
|
||||||
proc dos_qncm_delete(vptr: DosQObject) {.cdecl, dynlib: dynLibName, importc.}
|
proc dos_qncm_delete(vptr: DosQObject) {.cdecl, dynlib: dynLibName, importc.}
|
||||||
|
|
||||||
|
proc dos_qqmlnetworkaccessmanagerfactory_create(tmpPath: cstring): DosQQNetworkAccessManagerFactory {.cdecl, dynlib: dynLibName, importc.}
|
||||||
|
|
||||||
# QQuickView
|
# QQuickView
|
||||||
proc dos_qquickview_create(): DosQQuickView {.cdecl, dynlib: dynLibName, importc.}
|
proc dos_qquickview_create(): DosQQuickView {.cdecl, dynlib: dynLibName, importc.}
|
||||||
proc dos_qquickview_delete(view: DosQQuickView) {.cdecl, dynlib: dynLibName, importc.}
|
proc dos_qquickview_delete(view: DosQQuickView) {.cdecl, dynlib: dynLibName, importc.}
|
||||||
|
|
|
@ -110,6 +110,9 @@ type
|
||||||
vptr: DosQUrl
|
vptr: DosQUrl
|
||||||
|
|
||||||
QNetworkConfigurationManager* = ref object of QObject
|
QNetworkConfigurationManager* = ref object of QObject
|
||||||
|
|
||||||
|
QNetworkAccessManagerFactory* = ref object of RootObj ## \
|
||||||
|
vptr: DosQQNetworkAccessManagerFactory
|
||||||
|
|
||||||
QUrlParsingMode*{.pure, size: sizeof(cint).} = enum
|
QUrlParsingMode*{.pure, size: sizeof(cint).} = enum
|
||||||
Tolerant = 0.cint
|
Tolerant = 0.cint
|
||||||
|
|
|
@ -13,3 +13,16 @@ proc newQNetworkConfigurationManager*(): QNetworkConfigurationManager =
|
||||||
new(result, delete)
|
new(result, delete)
|
||||||
result.setup()
|
result.setup()
|
||||||
|
|
||||||
|
|
||||||
|
proc setup*(self: QNetworkAccessManagerFactory, tmpPath: string) =
|
||||||
|
self.vptr = dos_qqmlnetworkaccessmanagerfactory_create(tmpPath.cstring)
|
||||||
|
|
||||||
|
proc delete*(self: QNetworkAccessManagerFactory) =
|
||||||
|
if self.vptr.isNil:
|
||||||
|
return
|
||||||
|
self.vptr.resetToNil
|
||||||
|
|
||||||
|
proc newQNetworkAccessManagerFactory*(tmpPath: string): QNetworkAccessManagerFactory =
|
||||||
|
new(result, delete)
|
||||||
|
result.setup(tmpPath)
|
||||||
|
|
||||||
|
|
|
@ -14,6 +14,9 @@ proc load*(self: QQmlApplicationEngine, url: QUrl) =
|
||||||
## Load the given Qml file
|
## Load the given Qml file
|
||||||
dos_qqmlapplicationengine_load_url(self.vptr, url.vptr)
|
dos_qqmlapplicationengine_load_url(self.vptr, url.vptr)
|
||||||
|
|
||||||
|
proc setNetworkAccessManagerFactory*(self: QQmlApplicationEngine, factory: QNetworkAccessManagerFactory) =
|
||||||
|
dos_qqmlapplicationengine_setNetworkAccessManagerFactory(self.vptr, factory.vptr)
|
||||||
|
|
||||||
proc addImportPath*(self: QQmlApplicationEngine, path: string) =
|
proc addImportPath*(self: QQmlApplicationEngine, path: string) =
|
||||||
## Add an import path
|
## Add an import path
|
||||||
dos_qqmlapplicationengine_add_import_path(self.vptr, path.cstring)
|
dos_qqmlapplicationengine_add_import_path(self.vptr, path.cstring)
|
||||||
|
|
Loading…
Reference in New Issue