mirror of
https://github.com/status-im/dotherside.git
synced 2025-02-19 08:06:37 +00:00
34 lines
913 B
Nim
34 lines
913 B
Nim
import NimQml, NimQmlMacros, ContactList
|
|
|
|
QtObject:
|
|
type ApplicationLogic* = ref object of QObject
|
|
contactList: ContactList
|
|
app: QApplication
|
|
|
|
proc delete*(self: ApplicationLogic) =
|
|
let qobject = self.QObject
|
|
qobject.delete
|
|
self.contactList.delete
|
|
|
|
proc newApplicationLogic*(app: QApplication): ApplicationLogic =
|
|
new(result)
|
|
result.contactList = newContactList()
|
|
result.app = app
|
|
result.create()
|
|
|
|
method getContactList(self: ApplicationLogic): QVariant {.slot.} =
|
|
return newQVariant(self.contactList)
|
|
|
|
method onLoadTriggered(self: ApplicationLogic) {.slot.} =
|
|
echo "Load Triggered"
|
|
self.contactList.add("John", "Doo")
|
|
|
|
method onSaveTriggered(self: ApplicationLogic) {.slot.} =
|
|
echo "Save Triggered"
|
|
|
|
method onExitTriggered(self: ApplicationLogic) {.slot.} =
|
|
self.app.quit
|
|
|
|
QtProperty[QVariant] contactList:
|
|
read = getContactList
|