diff --git a/src/app/modules/main/wallet_section/collectibles/controller.nim b/src/app/modules/main/wallet_section/collectibles/collectible/controller.nim similarity index 85% rename from src/app/modules/main/wallet_section/collectibles/controller.nim rename to src/app/modules/main/wallet_section/collectibles/collectible/controller.nim index e26f7333d3..272fd10706 100644 --- a/src/app/modules/main/wallet_section/collectibles/controller.nim +++ b/src/app/modules/main/wallet_section/collectibles/collectible/controller.nim @@ -1,5 +1,5 @@ import ./controller_interface -import ../../../../../app_service/service/collectible/service as collectible_service +import ../../../../../../app_service/service/collectible/service as collectible_service export controller_interface diff --git a/src/app/modules/main/wallet_section/collectibles/controller_interface.nim b/src/app/modules/main/wallet_section/collectibles/collectible/controller_interface.nim similarity index 84% rename from src/app/modules/main/wallet_section/collectibles/controller_interface.nim rename to src/app/modules/main/wallet_section/collectibles/collectible/controller_interface.nim index c88ce57e45..38345a78bf 100644 --- a/src/app/modules/main/wallet_section/collectibles/controller_interface.nim +++ b/src/app/modules/main/wallet_section/collectibles/collectible/controller_interface.nim @@ -1,5 +1,3 @@ -import ../../../../../app_service/service/token/service_interface as token_service - type AccessInterface* {.pure inheritable.} = ref object of RootObj ## Abstract class for any input/interaction with this module. diff --git a/src/app/modules/main/wallet_section/collectibles/collectible/io_interface.nim b/src/app/modules/main/wallet_section/collectibles/collectible/io_interface.nim new file mode 100644 index 0000000000..c7ee22a658 --- /dev/null +++ b/src/app/modules/main/wallet_section/collectibles/collectible/io_interface.nim @@ -0,0 +1,17 @@ +type + AccessInterface* {.pure inheritable.} = ref object of RootObj + ## Abstract class for any input/interaction with this module. + +method delete*(self: AccessInterface) {.base.} = + raise newException(ValueError, "No implementation available") + +method load*(self: AccessInterface) {.base.} = + raise newException(ValueError, "No implementation available") + +method isLoaded*(self: AccessInterface): bool {.base.} = + raise newException(ValueError, "No implementation available") + +type + ## Abstract class (concept) which must be implemented by object/s used in this + ## module. + DelegateInterface* = concept c diff --git a/src/app/modules/main/wallet_section/collectibles/item.nim b/src/app/modules/main/wallet_section/collectibles/collectible/item.nim similarity index 72% rename from src/app/modules/main/wallet_section/collectibles/item.nim rename to src/app/modules/main/wallet_section/collectibles/collectible/item.nim index 4ba78c05ec..90872038d6 100644 --- a/src/app/modules/main/wallet_section/collectibles/item.nim +++ b/src/app/modules/main/wallet_section/collectibles/collectible/item.nim @@ -8,8 +8,8 @@ proc initItem*(name: string): Item = result.name = name proc `$`*(self: Item): string = - result = fmt"""AllTokensItem( - name: {self.name}, + result = fmt"""Collectible( + name: {self.name} ]""" proc getName*(self: Item): string = diff --git a/src/app/modules/main/wallet_section/collectibles/model.nim b/src/app/modules/main/wallet_section/collectibles/collectible/model.nim similarity index 96% rename from src/app/modules/main/wallet_section/collectibles/model.nim rename to src/app/modules/main/wallet_section/collectibles/collectible/model.nim index 3ddfd86fdd..c797e17c99 100644 --- a/src/app/modules/main/wallet_section/collectibles/model.nim +++ b/src/app/modules/main/wallet_section/collectibles/collectible/model.nim @@ -40,7 +40,7 @@ QtObject: method roleNames(self: Model): Table[int, string] = { - ModelRole.Name.int:"name" + ModelRole.Name.int:"name", }.toTable method data(self: Model, index: QModelIndex, role: int): QVariant = diff --git a/src/app/modules/main/wallet_section/collectibles/collectible/module.nim b/src/app/modules/main/wallet_section/collectibles/collectible/module.nim new file mode 100644 index 0000000000..fb3b1ecd15 --- /dev/null +++ b/src/app/modules/main/wallet_section/collectibles/collectible/module.nim @@ -0,0 +1,30 @@ +import sequtils, sugar + +import ./io_interface, ./view, ./controller, ./item +import ../../../../../../app_service/service/collectible/service as collectible_service + +export io_interface + +type + Module* [T: io_interface.DelegateInterface] = ref object of io_interface.AccessInterface + delegate: T + view: View + controller: controller.AccessInterface + moduleLoaded: bool + +proc newModule*[T](delegate: T, collectibleService: collectible_service.ServiceInterface): Module[T] = + result = Module[T]() + result.delegate = delegate + result.view = newView(result) + result.controller = controller.newController[Module[T]](result, collectibleService) + result.moduleLoaded = false + +method delete*[T](self: Module[T]) = + self.view.delete + self.controller.delete + +method load*[T](self: Module[T]) = + self.moduleLoaded = true + +method isLoaded*[T](self: Module[T]): bool = + return self.moduleLoaded diff --git a/src/app/modules/main/wallet_section/collectibles/collectible/view.nim b/src/app/modules/main/wallet_section/collectibles/collectible/view.nim new file mode 100644 index 0000000000..4bffc4aac7 --- /dev/null +++ b/src/app/modules/main/wallet_section/collectibles/collectible/view.nim @@ -0,0 +1,36 @@ +import NimQml + +import ./model +import ./item +import ./io_interface + +QtObject: + type + View* = ref object of QObject + delegate: io_interface.AccessInterface + model: Model + modelVariant: QVariant + + proc delete*(self: View) = + self.model.delete + self.modelVariant.delete + self.QObject.delete + + proc newView*(delegate: io_interface.AccessInterface): View = + new(result, delete) + result.QObject.setup + result.delegate = delegate + result.model = newModel() + result.modelVariant = newQVariant(result.model) + + proc modelChanged*(self: View) {.signal.} + + proc getModel(self: View): QVariant {.slot.} = + return self.modelVariant + + QtProperty[QVariant] model: + read = getModel + notify = modelChanged + + proc setItems*(self: View, items: seq[Item]) = + self.model.setItems(items) \ No newline at end of file diff --git a/src/app/modules/main/wallet_section/collectibles/collectibles/controller.nim b/src/app/modules/main/wallet_section/collectibles/collectibles/controller.nim new file mode 100644 index 0000000000..272fd10706 --- /dev/null +++ b/src/app/modules/main/wallet_section/collectibles/collectibles/controller.nim @@ -0,0 +1,23 @@ +import ./controller_interface +import ../../../../../../app_service/service/collectible/service as collectible_service + +export controller_interface + +type + Controller*[T: controller_interface.DelegateInterface] = ref object of controller_interface.AccessInterface + delegate: T + collectibleService: collectible_service.ServiceInterface + +proc newController*[T]( + delegate: T, + collectibleService: collectible_service.ServiceInterface +): Controller[T] = + result = Controller[T]() + result.delegate = delegate + result.collectibleService = collectibleService + +method delete*[T](self: Controller[T]) = + discard + +method init*[T](self: Controller[T]) = + discard \ No newline at end of file diff --git a/src/app/modules/main/wallet_section/collectibles/collectibles/controller_interface.nim b/src/app/modules/main/wallet_section/collectibles/collectibles/controller_interface.nim new file mode 100644 index 0000000000..38345a78bf --- /dev/null +++ b/src/app/modules/main/wallet_section/collectibles/collectibles/controller_interface.nim @@ -0,0 +1,15 @@ +type + AccessInterface* {.pure inheritable.} = ref object of RootObj + ## Abstract class for any input/interaction with this module. + +method delete*(self: AccessInterface) {.base.} = + raise newException(ValueError, "No implementation available") + +method init*(self: AccessInterface) {.base.} = + raise newException(ValueError, "No implementation available") + +type + ## Abstract class (concept) which must be implemented by object/s used in this + ## module. + DelegateInterface* = concept c + \ No newline at end of file diff --git a/src/app/modules/main/wallet_section/collectibles/collectibles/io_interface.nim b/src/app/modules/main/wallet_section/collectibles/collectibles/io_interface.nim new file mode 100644 index 0000000000..c7ee22a658 --- /dev/null +++ b/src/app/modules/main/wallet_section/collectibles/collectibles/io_interface.nim @@ -0,0 +1,17 @@ +type + AccessInterface* {.pure inheritable.} = ref object of RootObj + ## Abstract class for any input/interaction with this module. + +method delete*(self: AccessInterface) {.base.} = + raise newException(ValueError, "No implementation available") + +method load*(self: AccessInterface) {.base.} = + raise newException(ValueError, "No implementation available") + +method isLoaded*(self: AccessInterface): bool {.base.} = + raise newException(ValueError, "No implementation available") + +type + ## Abstract class (concept) which must be implemented by object/s used in this + ## module. + DelegateInterface* = concept c diff --git a/src/app/modules/main/wallet_section/collectibles/collectibles/item.nim b/src/app/modules/main/wallet_section/collectibles/collectibles/item.nim new file mode 100644 index 0000000000..08e48fe68c --- /dev/null +++ b/src/app/modules/main/wallet_section/collectibles/collectibles/item.nim @@ -0,0 +1,27 @@ +import strformat + +type + Item* = object + id: int + name, imageThumbnailUrl: string + +proc initItem*(id: int, name: string, imageThumbnailUrl: string): Item = + result.id = id + result.name = name + result.imageThumbnailUrl = imageThumbnailUrl + +proc `$`*(self: Item): string = + result = fmt"""Collectibles( + id: {self.id}, + name: {self.name}, + imageThumbnailUrl: {self.imageThumbnailUrl} + ]""" + +proc getId*(self: Item): int = + return self.id + +proc getName*(self: Item): string = + return self.name + +proc getImageThumbnailUrl*(self: Item): string = + return self.imageThumbnailUrl \ No newline at end of file diff --git a/src/app/modules/main/wallet_section/collectibles/collectibles/model.nim b/src/app/modules/main/wallet_section/collectibles/collectibles/model.nim new file mode 100644 index 0000000000..d615bcbaaa --- /dev/null +++ b/src/app/modules/main/wallet_section/collectibles/collectibles/model.nim @@ -0,0 +1,72 @@ +import NimQml, Tables, strutils, strformat + +import ./item + +type + ModelRole {.pure.} = enum + Id = UserRole + 1, + Name + ImageThumbnailUrl + +QtObject: + type + Model* = ref object of QAbstractListModel + items: seq[Item] + + proc delete(self: Model) = + self.items = @[] + self.QAbstractListModel.delete + + proc setup(self: Model) = + self.QAbstractListModel.setup + + proc newModel*(): Model = + new(result, delete) + result.setup + + proc `$`*(self: Model): string = + for i in 0 ..< self.items.len: + result &= fmt"""[{i}]:({$self.items[i]})""" + + proc countChanged(self: Model) {.signal.} + + proc getCount(self: Model): int {.slot.} = + self.items.len + + QtProperty[int] count: + read = getCount + notify = countChanged + + method rowCount(self: Model, index: QModelIndex = nil): int = + return self.items.len + + method roleNames(self: Model): Table[int, string] = + { + ModelRole.Id.int:"id", + ModelRole.Name.int:"name", + ModelRole.ImageThumbnailUrl.int:"imageThumbnailUrl", + }.toTable + + method data(self: Model, index: QModelIndex, role: int): QVariant = + if (not index.isValid): + return + + if (index.row < 0 or index.row >= self.items.len): + return + + let item = self.items[index.row] + let enumRole = role.ModelRole + + case enumRole: + of ModelRole.Id: + result = newQVariant(item.getId()) + of ModelRole.Name: + result = newQVariant(item.getName()) + of ModelRole.ImageThumbnailUrl: + result = newQVariant(item.getImageThumbnailUrl()) + + proc setItems*(self: Model, items: seq[Item]) = + self.beginResetModel() + self.items = items + self.endResetModel() + self.countChanged() \ No newline at end of file diff --git a/src/app/modules/main/wallet_section/collectibles/collectibles/module.nim b/src/app/modules/main/wallet_section/collectibles/collectibles/module.nim new file mode 100644 index 0000000000..fb3b1ecd15 --- /dev/null +++ b/src/app/modules/main/wallet_section/collectibles/collectibles/module.nim @@ -0,0 +1,30 @@ +import sequtils, sugar + +import ./io_interface, ./view, ./controller, ./item +import ../../../../../../app_service/service/collectible/service as collectible_service + +export io_interface + +type + Module* [T: io_interface.DelegateInterface] = ref object of io_interface.AccessInterface + delegate: T + view: View + controller: controller.AccessInterface + moduleLoaded: bool + +proc newModule*[T](delegate: T, collectibleService: collectible_service.ServiceInterface): Module[T] = + result = Module[T]() + result.delegate = delegate + result.view = newView(result) + result.controller = controller.newController[Module[T]](result, collectibleService) + result.moduleLoaded = false + +method delete*[T](self: Module[T]) = + self.view.delete + self.controller.delete + +method load*[T](self: Module[T]) = + self.moduleLoaded = true + +method isLoaded*[T](self: Module[T]): bool = + return self.moduleLoaded diff --git a/src/app/modules/main/wallet_section/collectibles/collectibles/view.nim b/src/app/modules/main/wallet_section/collectibles/collectibles/view.nim new file mode 100644 index 0000000000..4bffc4aac7 --- /dev/null +++ b/src/app/modules/main/wallet_section/collectibles/collectibles/view.nim @@ -0,0 +1,36 @@ +import NimQml + +import ./model +import ./item +import ./io_interface + +QtObject: + type + View* = ref object of QObject + delegate: io_interface.AccessInterface + model: Model + modelVariant: QVariant + + proc delete*(self: View) = + self.model.delete + self.modelVariant.delete + self.QObject.delete + + proc newView*(delegate: io_interface.AccessInterface): View = + new(result, delete) + result.QObject.setup + result.delegate = delegate + result.model = newModel() + result.modelVariant = newQVariant(result.model) + + proc modelChanged*(self: View) {.signal.} + + proc getModel(self: View): QVariant {.slot.} = + return self.modelVariant + + QtProperty[QVariant] model: + read = getModel + notify = modelChanged + + proc setItems*(self: View, items: seq[Item]) = + self.model.setItems(items) \ No newline at end of file diff --git a/src/app/modules/main/wallet_section/collectibles/collections/controller.nim b/src/app/modules/main/wallet_section/collectibles/collections/controller.nim new file mode 100644 index 0000000000..272fd10706 --- /dev/null +++ b/src/app/modules/main/wallet_section/collectibles/collections/controller.nim @@ -0,0 +1,23 @@ +import ./controller_interface +import ../../../../../../app_service/service/collectible/service as collectible_service + +export controller_interface + +type + Controller*[T: controller_interface.DelegateInterface] = ref object of controller_interface.AccessInterface + delegate: T + collectibleService: collectible_service.ServiceInterface + +proc newController*[T]( + delegate: T, + collectibleService: collectible_service.ServiceInterface +): Controller[T] = + result = Controller[T]() + result.delegate = delegate + result.collectibleService = collectibleService + +method delete*[T](self: Controller[T]) = + discard + +method init*[T](self: Controller[T]) = + discard \ No newline at end of file diff --git a/src/app/modules/main/wallet_section/collectibles/collections/controller_interface.nim b/src/app/modules/main/wallet_section/collectibles/collections/controller_interface.nim new file mode 100644 index 0000000000..38345a78bf --- /dev/null +++ b/src/app/modules/main/wallet_section/collectibles/collections/controller_interface.nim @@ -0,0 +1,15 @@ +type + AccessInterface* {.pure inheritable.} = ref object of RootObj + ## Abstract class for any input/interaction with this module. + +method delete*(self: AccessInterface) {.base.} = + raise newException(ValueError, "No implementation available") + +method init*(self: AccessInterface) {.base.} = + raise newException(ValueError, "No implementation available") + +type + ## Abstract class (concept) which must be implemented by object/s used in this + ## module. + DelegateInterface* = concept c + \ No newline at end of file diff --git a/src/app/modules/main/wallet_section/collectibles/collections/io_interface.nim b/src/app/modules/main/wallet_section/collectibles/collections/io_interface.nim new file mode 100644 index 0000000000..c7ee22a658 --- /dev/null +++ b/src/app/modules/main/wallet_section/collectibles/collections/io_interface.nim @@ -0,0 +1,17 @@ +type + AccessInterface* {.pure inheritable.} = ref object of RootObj + ## Abstract class for any input/interaction with this module. + +method delete*(self: AccessInterface) {.base.} = + raise newException(ValueError, "No implementation available") + +method load*(self: AccessInterface) {.base.} = + raise newException(ValueError, "No implementation available") + +method isLoaded*(self: AccessInterface): bool {.base.} = + raise newException(ValueError, "No implementation available") + +type + ## Abstract class (concept) which must be implemented by object/s used in this + ## module. + DelegateInterface* = concept c diff --git a/src/app/modules/main/wallet_section/collectibles/collections/item.nim b/src/app/modules/main/wallet_section/collectibles/collections/item.nim new file mode 100644 index 0000000000..d00d51d9f1 --- /dev/null +++ b/src/app/modules/main/wallet_section/collectibles/collections/item.nim @@ -0,0 +1,35 @@ +import strformat + +type + Item* = object + name: string + slug: string + imageUrl: string + ownedAssetCount: int + +proc initItem*(name, slug, imageUrl: string, ownedAssetCount: int): Item = + result.name = name + result.slug = slug + result.imageUrl = imageUrl + result.ownedAssetCount = ownedAssetCount + +proc `$`*(self: Item): string = + result = fmt"""CollectibleCollection( + name: {self.name}, + slug: {self.slug}, + imageUrl: {self.imageUrl}, + ownedAssetCount: {self.ownedAssetCount} + ]""" + +proc getName*(self: Item): string = + return self.name + +proc getSlug*(self: Item): string = + return self.slug + +proc getImageUrl*(self: Item): string = + return self.imageUrl + +proc getOwnedAssetCount*(self: Item): int = + return self.ownedAssetCount + diff --git a/src/app/modules/main/wallet_section/collectibles/collections/model.nim b/src/app/modules/main/wallet_section/collectibles/collections/model.nim new file mode 100644 index 0000000000..c37e253563 --- /dev/null +++ b/src/app/modules/main/wallet_section/collectibles/collections/model.nim @@ -0,0 +1,76 @@ +import NimQml, Tables, strutils, strformat + +import ./item + +type + ModelRole {.pure.} = enum + Name = UserRole + 1, + Slug + ImageUrl + OwnedAssetCount + +QtObject: + type + Model* = ref object of QAbstractListModel + items: seq[Item] + + proc delete(self: Model) = + self.items = @[] + self.QAbstractListModel.delete + + proc setup(self: Model) = + self.QAbstractListModel.setup + + proc newModel*(): Model = + new(result, delete) + result.setup + + proc `$`*(self: Model): string = + for i in 0 ..< self.items.len: + result &= fmt"""[{i}]:({$self.items[i]})""" + + proc countChanged(self: Model) {.signal.} + + proc getCount(self: Model): int {.slot.} = + self.items.len + + QtProperty[int] count: + read = getCount + notify = countChanged + + method rowCount(self: Model, index: QModelIndex = nil): int = + return self.items.len + + method roleNames(self: Model): Table[int, string] = + { + ModelRole.Name.int:"name", + ModelRole.Slug.int:"slug", + ModelRole.ImageUrl.int:"imageurl", + ModelRole.OwnedAssetCount.int:"ownedAssetCount" + }.toTable + + method data(self: Model, index: QModelIndex, role: int): QVariant = + if (not index.isValid): + return + + if (index.row < 0 or index.row >= self.items.len): + return + + let item = self.items[index.row] + let enumRole = role.ModelRole + + case enumRole: + of ModelRole.Name: + result = newQVariant(item.getName()) + of ModelRole.Slug: + result = newQVariant(item.getSlug()) + of ModelRole.ImageUrl: + result = newQVariant(item.getImageUrl()) + of ModelRole.OwnedAssetCount: + result = newQVariant(item.getOwnedAssetCount()) + + proc setItems*(self: Model, items: seq[Item]) = + self.beginResetModel() + self.items = items + self.endResetModel() + self.countChanged() \ No newline at end of file diff --git a/src/app/modules/main/wallet_section/collectibles/collections/module.nim b/src/app/modules/main/wallet_section/collectibles/collections/module.nim new file mode 100644 index 0000000000..fb3b1ecd15 --- /dev/null +++ b/src/app/modules/main/wallet_section/collectibles/collections/module.nim @@ -0,0 +1,30 @@ +import sequtils, sugar + +import ./io_interface, ./view, ./controller, ./item +import ../../../../../../app_service/service/collectible/service as collectible_service + +export io_interface + +type + Module* [T: io_interface.DelegateInterface] = ref object of io_interface.AccessInterface + delegate: T + view: View + controller: controller.AccessInterface + moduleLoaded: bool + +proc newModule*[T](delegate: T, collectibleService: collectible_service.ServiceInterface): Module[T] = + result = Module[T]() + result.delegate = delegate + result.view = newView(result) + result.controller = controller.newController[Module[T]](result, collectibleService) + result.moduleLoaded = false + +method delete*[T](self: Module[T]) = + self.view.delete + self.controller.delete + +method load*[T](self: Module[T]) = + self.moduleLoaded = true + +method isLoaded*[T](self: Module[T]): bool = + return self.moduleLoaded diff --git a/src/app/modules/main/wallet_section/collectibles/collections/view.nim b/src/app/modules/main/wallet_section/collectibles/collections/view.nim new file mode 100644 index 0000000000..4bffc4aac7 --- /dev/null +++ b/src/app/modules/main/wallet_section/collectibles/collections/view.nim @@ -0,0 +1,36 @@ +import NimQml + +import ./model +import ./item +import ./io_interface + +QtObject: + type + View* = ref object of QObject + delegate: io_interface.AccessInterface + model: Model + modelVariant: QVariant + + proc delete*(self: View) = + self.model.delete + self.modelVariant.delete + self.QObject.delete + + proc newView*(delegate: io_interface.AccessInterface): View = + new(result, delete) + result.QObject.setup + result.delegate = delegate + result.model = newModel() + result.modelVariant = newQVariant(result.model) + + proc modelChanged*(self: View) {.signal.} + + proc getModel(self: View): QVariant {.slot.} = + return self.modelVariant + + QtProperty[QVariant] model: + read = getModel + notify = modelChanged + + proc setItems*(self: View, items: seq[Item]) = + self.model.setItems(items) \ No newline at end of file diff --git a/src/app/modules/main/wallet_section/collectibles/module.nim b/src/app/modules/main/wallet_section/collectibles/module.nim index c3515faede..01c48141d0 100644 --- a/src/app/modules/main/wallet_section/collectibles/module.nim +++ b/src/app/modules/main/wallet_section/collectibles/module.nim @@ -1,15 +1,22 @@ -import ./io_interface, ./view, ./controller +import ./io_interface, ./view import ../../../../../app_service/service/collectible/service as collectible_service +import collectible/module as collectible_module +import collections/module as collections_module +import collectibles/module as collectibles_module + export io_interface type Module* [T: io_interface.DelegateInterface] = ref object of io_interface.AccessInterface delegate: T view: View - controller: controller.AccessInterface moduleLoaded: bool + collectiblesModule: collectibles_module.AccessInterface + collectionsModule: collections_module.AccessInterface + collectibleModule: collectible_module.AccessInterface + proc newModule*[T]( delegate: T, collectibleService: collectible_service.ServiceInterface @@ -17,14 +24,29 @@ proc newModule*[T]( result = Module[T]() result.delegate = delegate result.view = newView(result) - result.controller = controller.newController[Module[T]](result, collectibleService) result.moduleLoaded = false + result.collectiblesModule = collectibles_module.newModule[Module[T]]( + result, collectibleService + ) + result.collectionsModule = collectionsModule.newModule[Module[T]]( + result, collectibleService + ) + result.collectibleModule = collectibleModule.newModule[Module[T]]( + result, collectibleService + ) + method delete*[T](self: Module[T]) = self.view.delete - self.controller.delete + self.collectiblesModule.delete + self.collectionsModule.delete + self.collectibleModule.delete method load*[T](self: Module[T]) = + self.collectiblesModule.load + self.collectionsModule.load + self.collectibleModule.load + self.moduleLoaded = true method isLoaded*[T](self: Module[T]): bool = diff --git a/src/app/modules/main/wallet_section/collectibles/view.nim b/src/app/modules/main/wallet_section/collectibles/view.nim index 519f0900cf..65ca61d15b 100644 --- a/src/app/modules/main/wallet_section/collectibles/view.nim +++ b/src/app/modules/main/wallet_section/collectibles/view.nim @@ -1,32 +1,16 @@ import NimQml -import ./model import ./io_interface QtObject: type View* = ref object of QObject delegate: io_interface.AccessInterface - model: Model - modelVariant: QVariant - + proc delete*(self: View) = - self.model.delete - self.modelVariant.delete self.QObject.delete proc newView*(delegate: io_interface.AccessInterface): View = new(result, delete) result.QObject.setup - result.delegate = delegate - result.model = newModel() - result.modelVariant = newQVariant(result.model) - - proc modelChanged*(self: View) {.signal.} - - proc getModel(self: View): QVariant {.slot.} = - return self.modelVariant - - QtProperty[QVariant] model: - read = getModel - notify = modelChanged \ No newline at end of file + result.delegate = delegate \ No newline at end of file