mirror of https://github.com/status-im/nimqml.git
feat: expose networkconfigurationmanager and signalConnect
This commit is contained in:
parent
f2140a0bb0
commit
e78363a0f7
|
@ -13,6 +13,7 @@ template debugMsg(typeName: string, procName: string) =
|
|||
include "nimqml/private/dotherside.nim"
|
||||
include "nimqml/private/nimqmltypes.nim"
|
||||
include "nimqml/private/qmetaobject.nim"
|
||||
include "nimqml/private/qnetworkconfigurationmanager.nim"
|
||||
include "nimqml/private/qvariant.nim"
|
||||
include "nimqml/private/qobject.nim"
|
||||
include "nimqml/private/qqmlapplicationengine.nim"
|
||||
|
@ -30,6 +31,7 @@ include "nimqml/private/qresource.nim"
|
|||
include "nimqml/private/qdeclarative.nim"
|
||||
include "nimqml/private/nimqmlmacros.nim"
|
||||
|
||||
|
||||
proc signal_handler*(receiver: pointer, signal: cstring, slot: cstring) =
|
||||
var dosqobj = cast[DosQObject](receiver)
|
||||
if(dosqobj.isNil == false):
|
||||
|
|
|
@ -182,6 +182,7 @@ proc dos_qobject_objectName(qobject: DosQObject): cstring {.cdecl, dynlib: dynLi
|
|||
proc dos_qobject_setObjectName(qobject: DosQObject, name: cstring) {.cdecl, dynlib: dynLibName, importc.}
|
||||
proc dos_qobject_signal_emit(qobject: DosQObject, signalName: cstring, argumentsCount: cint, arguments: ptr DosQVariantArray) {.cdecl, dynlib: dynLibName, importc.}
|
||||
proc dos_qobject_delete(qobject: DosQObject) {.cdecl, dynlib: dynLibName, importc.}
|
||||
proc dos_qobject_signal_connect(sender: DosQObject, signalName: cstring, receiver: DosQObject, slot: cstring, signalType: cint) {.cdecl, dynlib: dynLibName, importc.}
|
||||
|
||||
# QAbstractItemModel
|
||||
proc dos_qabstractitemmodel_qmetaobject(): DosQMetaObject {.cdecl dynlib: dynLibName, importc.}
|
||||
|
@ -202,6 +203,10 @@ proc dos_qurl_create(url: cstring, parsingMode: cint): DosQUrl {.cdecl, dynlib:
|
|||
proc dos_qurl_delete(vptr: DosQUrl) {.cdecl, dynlib: dynLibName, importc.}
|
||||
proc dos_qurl_to_string(vptr: DosQUrl): cstring {.cdecl, dynlib: dynLibName, importc.}
|
||||
|
||||
# QNetworkConfigurationManager
|
||||
proc dos_qncm_create(): DosQObject {.cdecl, dynlib: dynLibName, importc.}
|
||||
proc dos_qncm_delete(vptr: DosQObject) {.cdecl, dynlib: dynLibName, importc.}
|
||||
|
||||
# QQuickView
|
||||
proc dos_qquickview_create(): DosQQuickView {.cdecl, dynlib: dynLibName, importc.}
|
||||
proc dos_qquickview_delete(view: DosQQuickView) {.cdecl, dynlib: dynLibName, importc.}
|
||||
|
|
|
@ -109,6 +109,8 @@ type
|
|||
QUrl* = ref object of RootObj
|
||||
vptr: DosQUrl
|
||||
|
||||
QNetworkConfigurationManager* = ref object of QObject
|
||||
|
||||
QUrlParsingMode*{.pure, size: sizeof(cint).} = enum
|
||||
Tolerant = 0.cint
|
||||
Strict = 1.cint
|
||||
|
|
|
@ -0,0 +1,15 @@
|
|||
proc setup*(self: QNetworkConfigurationManager) =
|
||||
## Setup a new QUrl
|
||||
self.vptr = dos_qncm_create()
|
||||
|
||||
proc delete*(self: QNetworkConfigurationManager) =
|
||||
## Delete a QUrl
|
||||
if self.vptr.isNil:
|
||||
return
|
||||
dos_qncm_delete(self.vptr)
|
||||
self.vptr.resetToNil
|
||||
|
||||
proc newQNetworkConfigurationManager*(): QNetworkConfigurationManager =
|
||||
new(result, delete)
|
||||
result.setup()
|
||||
|
|
@ -71,3 +71,6 @@ proc newQObject*(): QObject =
|
|||
|
||||
proc vptr*(self: QObject): DosQObject =
|
||||
result = self.vptr
|
||||
|
||||
proc signalConnect*(sender: QObject, signal: string, receiver: QObject, slot: string, signalType: int = 0) =
|
||||
dos_qobject_signal_connect(sender.vptr, ("2" & signal).cstring, receiver.vptr, ("1" & slot).cstring, signalType.cint)
|
Loading…
Reference in New Issue