refactor: add fake category type
This commit is contained in:
parent
0065f5cae5
commit
24fa56e3b8
|
@ -18,6 +18,7 @@ type
|
||||||
Active
|
Active
|
||||||
Position
|
Position
|
||||||
SubItems
|
SubItems
|
||||||
|
IsCategory
|
||||||
|
|
||||||
QtObject:
|
QtObject:
|
||||||
type
|
type
|
||||||
|
@ -77,6 +78,7 @@ QtObject:
|
||||||
ModelRole.Active.int:"active",
|
ModelRole.Active.int:"active",
|
||||||
ModelRole.Position.int:"position",
|
ModelRole.Position.int:"position",
|
||||||
ModelRole.SubItems.int:"subItems",
|
ModelRole.SubItems.int:"subItems",
|
||||||
|
ModelRole.IsCategory.int:"isCategory"
|
||||||
}.toTable
|
}.toTable
|
||||||
|
|
||||||
method data(self: Model, index: QModelIndex, role: int): QVariant =
|
method data(self: Model, index: QModelIndex, role: int): QVariant =
|
||||||
|
@ -118,6 +120,8 @@ QtObject:
|
||||||
result = newQVariant(item.position)
|
result = newQVariant(item.position)
|
||||||
of ModelRole.SubItems:
|
of ModelRole.SubItems:
|
||||||
result = newQVariant(item.subItems)
|
result = newQVariant(item.subItems)
|
||||||
|
of ModelRole.IsCategory:
|
||||||
|
result = newQVariant(item.`type` == ChatType.Category.int)
|
||||||
|
|
||||||
proc appendItem*(self: Model, item: Item) =
|
proc appendItem*(self: Model, item: Item) =
|
||||||
let parentModelIndex = newQModelIndex()
|
let parentModelIndex = newQModelIndex()
|
||||||
|
|
|
@ -186,7 +186,7 @@ proc buildCommunityUI(self: Module, events: EventEmitter,
|
||||||
selectedItemId = cat.id
|
selectedItemId = cat.id
|
||||||
selectedSubItemId = channelItem.id
|
selectedSubItemId = channelItem.id
|
||||||
|
|
||||||
var categoryItem = initItem(cat.id, cat.name, "", false, "", "", ChatType.Unknown.int, false,
|
var categoryItem = initItem(cat.id, cat.name, "", false, "", "", ChatType.Category.int, false,
|
||||||
hasNotificationPerCategory, notificationsCountPerCategory, false, false, cat.position)
|
hasNotificationPerCategory, notificationsCountPerCategory, false, false, cat.position)
|
||||||
categoryItem.prependSubItems(categoryChannels)
|
categoryItem.prependSubItems(categoryChannels)
|
||||||
self.view.chatsModel().appendItem(categoryItem)
|
self.view.chatsModel().appendItem(categoryItem)
|
||||||
|
|
|
@ -12,6 +12,7 @@ type ChatType* {.pure.}= enum
|
||||||
Profile = 4,
|
Profile = 4,
|
||||||
Timeline = 5
|
Timeline = 5
|
||||||
CommunityChat = 6
|
CommunityChat = 6
|
||||||
|
Category = 9999
|
||||||
|
|
||||||
type ChatMember* = object
|
type ChatMember* = object
|
||||||
id*: string
|
id*: string
|
||||||
|
|
|
@ -53,6 +53,7 @@ QtObject {
|
||||||
readonly property int profile: 4
|
readonly property int profile: 4
|
||||||
readonly property int timeline: 5
|
readonly property int timeline: 5
|
||||||
readonly property int communityChat: 6
|
readonly property int communityChat: 6
|
||||||
|
readonly property int category: 9999
|
||||||
}
|
}
|
||||||
|
|
||||||
readonly property QtObject messageContentType: QtObject {
|
readonly property QtObject messageContentType: QtObject {
|
||||||
|
|
Loading…
Reference in New Issue