chore(@desktop): Expose QTimer functions

This commit is contained in:
Michal Iskierko 2022-09-27 11:01:14 +02:00 committed by Michał Iskierko
parent 0931c98089
commit c428cf4397
4 changed files with 55 additions and 0 deletions

View File

@ -30,6 +30,7 @@ include "nimqml/private/qabstracttablemodel.nim"
include "nimqml/private/qresource.nim" include "nimqml/private/qresource.nim"
include "nimqml/private/qdeclarative.nim" include "nimqml/private/qdeclarative.nim"
include "nimqml/private/qsettings.nim" include "nimqml/private/qsettings.nim"
include "nimqml/private/qtimer.nim"
include "nimqml/private/nimqmlmacros.nim" include "nimqml/private/nimqmlmacros.nim"
include "nimqml/private/singleinstance.nim" include "nimqml/private/singleinstance.nim"
include "nimqml/private/status/statusevent.nim" include "nimqml/private/status/statusevent.nim"

View File

@ -36,6 +36,7 @@ type
DosStatusOSNotification = DosQObject DosStatusOSNotification = DosQObject
DosQSettings = DosQObject DosQSettings = DosQObject
DosStatusKeychainManager = DosQObject DosStatusKeychainManager = DosQObject
DosQTimer = DosQObject
DosParameterDefinition = object DosParameterDefinition = object
name: cstring name: cstring
@ -371,6 +372,26 @@ proc dos_qsettings_remove(vptr: DosQSettings, key: cstring)
proc dos_qsettings_delete(vptr: DosQSettings) proc dos_qsettings_delete(vptr: DosQSettings)
{.cdecl, dynlib: dynLibName, importc.} {.cdecl, dynlib: dynLibName, importc.}
# QTimer
proc dos_qtimer_create(): DosQTimer
{.cdecl, dynlib: dynLibName, importc.}
proc dos_qtimer_delete(vptr: DosQTimer)
{.cdecl, dynlib: dynLibName, importc.}
proc dos_qtimer_set_interval(vptr: DosQTimer, interval: int)
{.cdecl, dynlib: dynLibName, importc.}
proc dos_qtimer_interval(vptr: DosQTimer): int
{.cdecl, dynlib: dynLibName, importc.}
proc dos_qtimer_start(vptr: DosQTimer)
{.cdecl, dynlib: dynLibName, importc.}
proc dos_qtimer_stop(vptr: DosQTimer)
{.cdecl, dynlib: dynLibName, importc.}
proc dos_qtimer_set_single_shot(vptr: DosQTimer, singleShot: bool)
{.cdecl, dynlib: dynLibName, importc.}
proc dos_qtimer_is_single_shot(vptr: DosQTimer): bool
{.cdecl, dynlib: dynLibName, importc.}
proc dos_qtimer_is_active(vptr: DosQTimer): bool
{.cdecl, dynlib: dynLibName, importc.}
# DosStatusKeychainManager # DosStatusKeychainManager
proc dos_keychainmanager_create(service: cstring, authenticationReason: cstring): proc dos_keychainmanager_create(service: cstring, authenticationReason: cstring):
DosStatusKeychainManager DosStatusKeychainManager

View File

@ -113,6 +113,8 @@ type
QNetworkConfigurationManager* = ref object of QObject QNetworkConfigurationManager* = ref object of QObject
QTimer* = ref object of QObject
QNetworkAccessManagerFactory* = ref object of RootObj ## \ QNetworkAccessManagerFactory* = ref object of RootObj ## \
vptr: DosQQNetworkAccessManagerFactory vptr: DosQQNetworkAccessManagerFactory

View File

@ -0,0 +1,31 @@
proc delete*(self: QTimer) =
dos_qtimer_delete(self.vptr)
self.vptr.resetToNil
proc setup*(self: QTimer) =
self.vptr = dos_qtimer_create()
proc newQTimer*() : QTimer =
new(result, delete)
result.setup()
proc setInterval*(self: QTimer, interval: int) =
dos_qtimer_set_interval(self.vptr, interval)
proc interval*(self: QTimer): int =
return dos_qtimer_interval(self.vptr)
proc start*(self:QTimer) =
dos_qtimer_start(self.vptr)
proc stop*(self:QTimer) =
dos_qtimer_stop(self.vptr)
proc setSingleShot*(self:QTimer, singleShot: bool) =
dos_qtimer_set_single_shot(self.vptr, singleShot)
proc isSingleShot*(self:QTimer): bool =
return dos_qtimer_is_single_shot(self.vptr)
proc isActive*(self:QTimer): bool =
return dos_qtimer_is_active(self.vptr)