feat: expose networkconfigurationmanager and signalConnect

This commit is contained in:
Richard Ramos 2020-07-14 20:12:03 -04:00
parent f2140a0bb0
commit e78363a0f7
No known key found for this signature in database
GPG Key ID: 80D4B01265FDFE8F
5 changed files with 28 additions and 1 deletions

View File

@ -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):

View File

@ -30,7 +30,7 @@ type
DosQAbstractItemModel = distinct pointer
DosQAbstractTableModel = distinct pointer
DosQAbstractListModel = distinct pointer
DosParameterDefinition = object
name: cstring
metaType: cint
@ -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.}

View File

@ -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

View File

@ -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()

View File

@ -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)