refactor(chat): rename `ActiveSection` to `SectionDetails`
This commit is contained in:
parent
869c3937df
commit
9a7699b52f
|
@ -3,7 +3,7 @@ import NimQml, json, strutils, json_serialization, sequtils
|
||||||
import ./io_interface
|
import ./io_interface
|
||||||
import ../../shared_models/section_model
|
import ../../shared_models/section_model
|
||||||
import ../../shared_models/section_item
|
import ../../shared_models/section_item
|
||||||
import ../../shared_models/active_section
|
import ../../shared_models/section_details
|
||||||
import ./models/curated_community_model
|
import ./models/curated_community_model
|
||||||
import ./models/curated_community_item
|
import ./models/curated_community_item
|
||||||
import ./models/discord_file_list_model
|
import ./models/discord_file_list_model
|
||||||
|
@ -22,7 +22,7 @@ QtObject:
|
||||||
delegate: io_interface.AccessInterface
|
delegate: io_interface.AccessInterface
|
||||||
model: SectionModel
|
model: SectionModel
|
||||||
modelVariant: QVariant
|
modelVariant: QVariant
|
||||||
observedItem: ActiveSection
|
observedItem: SectionDetails
|
||||||
curatedCommunitiesModel: CuratedCommunityModel
|
curatedCommunitiesModel: CuratedCommunityModel
|
||||||
curatedCommunitiesModelVariant: QVariant
|
curatedCommunitiesModelVariant: QVariant
|
||||||
curatedCommunitiesLoading: bool
|
curatedCommunitiesLoading: bool
|
||||||
|
|
|
@ -3,7 +3,7 @@ import NimQml, tables, json, sugar, sequtils, strformat, marshal, times, chronic
|
||||||
import io_interface, view, controller, chat_search_item, chat_search_model
|
import io_interface, view, controller, chat_search_item, chat_search_model
|
||||||
import ephemeral_notification_item, ephemeral_notification_model
|
import ephemeral_notification_item, ephemeral_notification_model
|
||||||
import ./communities/models/[pending_request_item, pending_request_model]
|
import ./communities/models/[pending_request_item, pending_request_model]
|
||||||
import ../shared_models/[user_item, member_item, member_model, section_item, section_model, active_section]
|
import ../shared_models/[user_item, member_item, member_model, section_item, section_model, section_details]
|
||||||
import ../shared_modules/keycard_popup/module as keycard_shared_module
|
import ../shared_modules/keycard_popup/module as keycard_shared_module
|
||||||
import ../../global/app_sections_config as conf
|
import ../../global/app_sections_config as conf
|
||||||
import ../../global/app_signals
|
import ../../global/app_signals
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
import NimQml, strutils
|
import NimQml, strutils
|
||||||
import ../shared_models/section_model
|
import ../shared_models/section_model
|
||||||
import ../shared_models/section_item
|
import ../shared_models/section_item
|
||||||
import ../shared_models/active_section
|
import ../shared_models/section_details
|
||||||
import io_interface
|
import io_interface
|
||||||
import chat_search_model
|
import chat_search_model
|
||||||
import ephemeral_notification_model
|
import ephemeral_notification_model
|
||||||
|
@ -16,7 +16,7 @@ QtObject:
|
||||||
modelVariant: QVariant
|
modelVariant: QVariant
|
||||||
sectionsLoaded: bool
|
sectionsLoaded: bool
|
||||||
chatsLoadingFailed: bool
|
chatsLoadingFailed: bool
|
||||||
activeSection: ActiveSection
|
activeSection: SectionDetails
|
||||||
activeSectionVariant: QVariant
|
activeSectionVariant: QVariant
|
||||||
chatSearchModel: chat_search_model.Model
|
chatSearchModel: chat_search_model.Model
|
||||||
chatSearchModelVariant: QVariant
|
chatSearchModelVariant: QVariant
|
||||||
|
@ -126,7 +126,7 @@ QtObject:
|
||||||
proc emitMailserverNotWorking*(self: View) =
|
proc emitMailserverNotWorking*(self: View) =
|
||||||
self.mailserverNotWorking()
|
self.mailserverNotWorking()
|
||||||
|
|
||||||
proc activeSection*(self: View): ActiveSection =
|
proc activeSection*(self: View): SectionDetails =
|
||||||
return self.activeSection
|
return self.activeSection
|
||||||
|
|
||||||
proc getActiveSection(self: View): QVariant {.slot.} =
|
proc getActiveSection(self: View): QVariant {.slot.} =
|
||||||
|
|
|
@ -5,27 +5,27 @@ import ../../../app_service/service/contacts/dto/contacts
|
||||||
import ../../../app_service/common/types
|
import ../../../app_service/common/types
|
||||||
|
|
||||||
QtObject:
|
QtObject:
|
||||||
type ActiveSection* = ref object of QObject
|
type SectionDetails* = ref object of QObject
|
||||||
item: SectionItem
|
item: SectionItem
|
||||||
|
|
||||||
proc setup(self: ActiveSection) =
|
proc setup(self: SectionDetails) =
|
||||||
self.QObject.setup
|
self.QObject.setup
|
||||||
|
|
||||||
proc delete*(self: ActiveSection) =
|
proc delete*(self: SectionDetails) =
|
||||||
self.QObject.delete
|
self.QObject.delete
|
||||||
|
|
||||||
proc newActiveSection*(): ActiveSection =
|
proc newActiveSection*(): SectionDetails =
|
||||||
new(result, delete)
|
new(result, delete)
|
||||||
result.setup
|
result.setup
|
||||||
|
|
||||||
proc membersChanged*(self: ActiveSection) {.signal.}
|
proc membersChanged*(self: SectionDetails) {.signal.}
|
||||||
proc bannedMembersChanged*(self: ActiveSection) {.signal.}
|
proc bannedMembersChanged*(self: SectionDetails) {.signal.}
|
||||||
proc pendingRequestsToJoinChanged*(self: ActiveSection) {.signal.}
|
proc pendingRequestsToJoinChanged*(self: SectionDetails) {.signal.}
|
||||||
proc pendingMemberRequestsChanged*(self: ActiveSection) {.signal.}
|
proc pendingMemberRequestsChanged*(self: SectionDetails) {.signal.}
|
||||||
proc declinedMemberRequestsChanged*(self: ActiveSection) {.signal.}
|
proc declinedMemberRequestsChanged*(self: SectionDetails) {.signal.}
|
||||||
proc communityTokensChanged*(self: ActiveSection) {.signal.}
|
proc communityTokensChanged*(self: SectionDetails) {.signal.}
|
||||||
|
|
||||||
proc setActiveSectionData*(self: ActiveSection, item: SectionItem) =
|
proc setActiveSectionData*(self: SectionDetails, item: SectionItem) =
|
||||||
self.item = item
|
self.item = item
|
||||||
self.membersChanged()
|
self.membersChanged()
|
||||||
self.bannedMembersChanged()
|
self.bannedMembersChanged()
|
||||||
|
@ -34,151 +34,151 @@ QtObject:
|
||||||
self.pendingRequestsToJoinChanged()
|
self.pendingRequestsToJoinChanged()
|
||||||
self.communityTokensChanged()
|
self.communityTokensChanged()
|
||||||
|
|
||||||
proc getId*(self: ActiveSection): string {.slot.} =
|
proc getId*(self: SectionDetails): string {.slot.} =
|
||||||
return self.item.id
|
return self.item.id
|
||||||
|
|
||||||
QtProperty[string] id:
|
QtProperty[string] id:
|
||||||
read = getId
|
read = getId
|
||||||
|
|
||||||
proc getSectionType(self: ActiveSection): int {.slot.} =
|
proc getSectionType(self: SectionDetails): int {.slot.} =
|
||||||
return self.item.sectionType.int
|
return self.item.sectionType.int
|
||||||
|
|
||||||
QtProperty[int] sectionType:
|
QtProperty[int] sectionType:
|
||||||
read = getSectionType
|
read = getSectionType
|
||||||
|
|
||||||
proc getName(self: ActiveSection): string {.slot.} =
|
proc getName(self: SectionDetails): string {.slot.} =
|
||||||
return self.item.name
|
return self.item.name
|
||||||
|
|
||||||
QtProperty[string] name:
|
QtProperty[string] name:
|
||||||
read = getName
|
read = getName
|
||||||
|
|
||||||
proc getAmISectionAdmin(self: ActiveSection): bool {.slot.} =
|
proc getAmISectionAdmin(self: SectionDetails): bool {.slot.} =
|
||||||
return self.item.amISectionAdmin
|
return self.item.amISectionAdmin
|
||||||
|
|
||||||
QtProperty[bool] amISectionAdmin:
|
QtProperty[bool] amISectionAdmin:
|
||||||
read = getAmISectionAdmin
|
read = getAmISectionAdmin
|
||||||
|
|
||||||
proc description(self: ActiveSection): string {.slot.} =
|
proc description(self: SectionDetails): string {.slot.} =
|
||||||
return self.item.description
|
return self.item.description
|
||||||
|
|
||||||
QtProperty[string] description:
|
QtProperty[string] description:
|
||||||
read = description
|
read = description
|
||||||
|
|
||||||
proc introMessage(self: ActiveSection): string {.slot.} =
|
proc introMessage(self: SectionDetails): string {.slot.} =
|
||||||
return self.item.introMessage
|
return self.item.introMessage
|
||||||
|
|
||||||
QtProperty[string] introMessage:
|
QtProperty[string] introMessage:
|
||||||
read = introMessage
|
read = introMessage
|
||||||
|
|
||||||
proc outroMessage(self: ActiveSection): string {.slot.} =
|
proc outroMessage(self: SectionDetails): string {.slot.} =
|
||||||
return self.item.outroMessage
|
return self.item.outroMessage
|
||||||
|
|
||||||
QtProperty[string] outroMessage:
|
QtProperty[string] outroMessage:
|
||||||
read = outroMessage
|
read = outroMessage
|
||||||
|
|
||||||
proc getImage(self: ActiveSection): string {.slot.} =
|
proc getImage(self: SectionDetails): string {.slot.} =
|
||||||
return self.item.image
|
return self.item.image
|
||||||
|
|
||||||
QtProperty[string] image:
|
QtProperty[string] image:
|
||||||
read = getImage
|
read = getImage
|
||||||
|
|
||||||
proc getBannerImageData(self: ActiveSection): string {.slot.} =
|
proc getBannerImageData(self: SectionDetails): string {.slot.} =
|
||||||
return self.item.bannerImageData
|
return self.item.bannerImageData
|
||||||
|
|
||||||
QtProperty[string] bannerImageData:
|
QtProperty[string] bannerImageData:
|
||||||
read = getBannerImageData
|
read = getBannerImageData
|
||||||
|
|
||||||
proc getIcon(self: ActiveSection): string {.slot.} =
|
proc getIcon(self: SectionDetails): string {.slot.} =
|
||||||
return self.item.icon
|
return self.item.icon
|
||||||
|
|
||||||
QtProperty[string] icon:
|
QtProperty[string] icon:
|
||||||
read = getIcon
|
read = getIcon
|
||||||
|
|
||||||
proc getColor(self: ActiveSection): string {.slot.} =
|
proc getColor(self: SectionDetails): string {.slot.} =
|
||||||
return self.item.color
|
return self.item.color
|
||||||
|
|
||||||
QtProperty[string] color:
|
QtProperty[string] color:
|
||||||
read = getColor
|
read = getColor
|
||||||
|
|
||||||
proc getTags(self: ActiveSection): string {.slot.} =
|
proc getTags(self: SectionDetails): string {.slot.} =
|
||||||
return self.item.tags
|
return self.item.tags
|
||||||
|
|
||||||
QtProperty[string] tags:
|
QtProperty[string] tags:
|
||||||
read = getTags
|
read = getTags
|
||||||
|
|
||||||
proc getHasNotification(self: ActiveSection): bool {.slot.} =
|
proc getHasNotification(self: SectionDetails): bool {.slot.} =
|
||||||
return self.item.hasNotification
|
return self.item.hasNotification
|
||||||
|
|
||||||
QtProperty[bool] hasNotification:
|
QtProperty[bool] hasNotification:
|
||||||
read = getHasNotification
|
read = getHasNotification
|
||||||
|
|
||||||
proc getNotificationCount(self: ActiveSection): int {.slot.} =
|
proc getNotificationCount(self: SectionDetails): int {.slot.} =
|
||||||
return self.item.notificationsCount
|
return self.item.notificationsCount
|
||||||
|
|
||||||
QtProperty[int] notificationCount:
|
QtProperty[int] notificationCount:
|
||||||
read = getNotificationCount
|
read = getNotificationCount
|
||||||
|
|
||||||
proc canJoin(self: ActiveSection): bool {.slot.} =
|
proc canJoin(self: SectionDetails): bool {.slot.} =
|
||||||
return self.item.canJoin
|
return self.item.canJoin
|
||||||
|
|
||||||
QtProperty[bool] canJoin:
|
QtProperty[bool] canJoin:
|
||||||
read = canJoin
|
read = canJoin
|
||||||
|
|
||||||
proc canRequestAccess(self: ActiveSection): bool {.slot.} =
|
proc canRequestAccess(self: SectionDetails): bool {.slot.} =
|
||||||
return self.item.canRequestAccess
|
return self.item.canRequestAccess
|
||||||
|
|
||||||
QtProperty[bool] canRequestAccess:
|
QtProperty[bool] canRequestAccess:
|
||||||
read = canRequestAccess
|
read = canRequestAccess
|
||||||
|
|
||||||
proc canManageUsers(self: ActiveSection): bool {.slot.} =
|
proc canManageUsers(self: SectionDetails): bool {.slot.} =
|
||||||
return self.item.canManageUsers
|
return self.item.canManageUsers
|
||||||
|
|
||||||
QtProperty[bool] canManageUsers:
|
QtProperty[bool] canManageUsers:
|
||||||
read = canManageUsers
|
read = canManageUsers
|
||||||
|
|
||||||
proc getJoined(self: ActiveSection): bool {.slot.} =
|
proc getJoined(self: SectionDetails): bool {.slot.} =
|
||||||
return self.item.joined
|
return self.item.joined
|
||||||
|
|
||||||
QtProperty[bool] joined:
|
QtProperty[bool] joined:
|
||||||
read = getJoined
|
read = getJoined
|
||||||
|
|
||||||
proc getIsMember(self: ActiveSection): bool {.slot.} =
|
proc getIsMember(self: SectionDetails): bool {.slot.} =
|
||||||
return self.item.isMember
|
return self.item.isMember
|
||||||
|
|
||||||
QtProperty[bool] isMember:
|
QtProperty[bool] isMember:
|
||||||
read = getIsMember
|
read = getIsMember
|
||||||
|
|
||||||
proc access(self: ActiveSection): int {.slot.} =
|
proc access(self: SectionDetails): int {.slot.} =
|
||||||
return self.item.access
|
return self.item.access
|
||||||
|
|
||||||
QtProperty[int] access:
|
QtProperty[int] access:
|
||||||
read = access
|
read = access
|
||||||
|
|
||||||
proc ensOnly(self: ActiveSection): bool {.slot.} =
|
proc ensOnly(self: SectionDetails): bool {.slot.} =
|
||||||
return self.item.ensOnly
|
return self.item.ensOnly
|
||||||
|
|
||||||
QtProperty[bool] ensOnly:
|
QtProperty[bool] ensOnly:
|
||||||
read = ensOnly
|
read = ensOnly
|
||||||
|
|
||||||
proc historyArchiveSupportEnabled(self: ActiveSection): bool {.slot.} =
|
proc historyArchiveSupportEnabled(self: SectionDetails): bool {.slot.} =
|
||||||
return self.item.historyArchiveSupportEnabled
|
return self.item.historyArchiveSupportEnabled
|
||||||
|
|
||||||
QtProperty[bool] historyArchiveSupportEnabled:
|
QtProperty[bool] historyArchiveSupportEnabled:
|
||||||
read = historyArchiveSupportEnabled
|
read = historyArchiveSupportEnabled
|
||||||
|
|
||||||
proc pinMessageAllMembersEnabled(self: ActiveSection): bool {.slot.} =
|
proc pinMessageAllMembersEnabled(self: SectionDetails): bool {.slot.} =
|
||||||
return self.item.pinMessageAllMembersEnabled
|
return self.item.pinMessageAllMembersEnabled
|
||||||
|
|
||||||
QtProperty[bool] pinMessageAllMembersEnabled:
|
QtProperty[bool] pinMessageAllMembersEnabled:
|
||||||
read = pinMessageAllMembersEnabled
|
read = pinMessageAllMembersEnabled
|
||||||
|
|
||||||
proc encrypted(self: ActiveSection): bool {.slot.} =
|
proc encrypted(self: SectionDetails): bool {.slot.} =
|
||||||
return self.item.encrypted
|
return self.item.encrypted
|
||||||
|
|
||||||
QtProperty[bool] encrypted:
|
QtProperty[bool] encrypted:
|
||||||
read = encrypted
|
read = encrypted
|
||||||
|
|
||||||
proc members(self: ActiveSection): QVariant {.slot.} =
|
proc members(self: SectionDetails): QVariant {.slot.} =
|
||||||
if (self.item.id == ""):
|
if (self.item.id == ""):
|
||||||
# FIXME (Jo) I don't know why but the Item is sometimes empty and doing anything here crashes the app
|
# FIXME (Jo) I don't know why but the Item is sometimes empty and doing anything here crashes the app
|
||||||
return newQVariant("")
|
return newQVariant("")
|
||||||
|
@ -189,7 +189,7 @@ QtObject:
|
||||||
notify = membersChanged
|
notify = membersChanged
|
||||||
|
|
||||||
|
|
||||||
proc bannedMembers(self: ActiveSection): QVariant {.slot.} =
|
proc bannedMembers(self: SectionDetails): QVariant {.slot.} =
|
||||||
if (self.item.id == ""):
|
if (self.item.id == ""):
|
||||||
# FIXME (Jo) I don't know why but the Item is sometimes empty and doing anything here crashes the app
|
# FIXME (Jo) I don't know why but the Item is sometimes empty and doing anything here crashes the app
|
||||||
return newQVariant("")
|
return newQVariant("")
|
||||||
|
@ -199,7 +199,7 @@ QtObject:
|
||||||
read = bannedMembers
|
read = bannedMembers
|
||||||
notify = bannedMembersChanged
|
notify = bannedMembersChanged
|
||||||
|
|
||||||
proc communityTokens(self: ActiveSection): QVariant {.slot.} =
|
proc communityTokens(self: SectionDetails): QVariant {.slot.} =
|
||||||
if (self.item.id == ""):
|
if (self.item.id == ""):
|
||||||
# FIXME (Jo) I don't know why but the Item is sometimes empty and doing anything here crashes the app
|
# FIXME (Jo) I don't know why but the Item is sometimes empty and doing anything here crashes the app
|
||||||
return newQVariant("")
|
return newQVariant("")
|
||||||
|
@ -209,14 +209,14 @@ QtObject:
|
||||||
read = communityTokens
|
read = communityTokens
|
||||||
notify = communityTokensChanged
|
notify = communityTokensChanged
|
||||||
|
|
||||||
proc amIBanned(self: ActiveSection): bool {.slot.} =
|
proc amIBanned(self: SectionDetails): bool {.slot.} =
|
||||||
return self.item.amIBanned
|
return self.item.amIBanned
|
||||||
|
|
||||||
QtProperty[bool] amIBanned:
|
QtProperty[bool] amIBanned:
|
||||||
read = amIBanned
|
read = amIBanned
|
||||||
notify = bannedMembersChanged
|
notify = bannedMembersChanged
|
||||||
|
|
||||||
proc pendingMemberRequests(self: ActiveSection): QVariant {.slot.} =
|
proc pendingMemberRequests(self: SectionDetails): QVariant {.slot.} =
|
||||||
if (self.item.id == ""):
|
if (self.item.id == ""):
|
||||||
# FIXME (Jo) I don't know why but the Item is sometimes empty and doing anything here crashes the app
|
# FIXME (Jo) I don't know why but the Item is sometimes empty and doing anything here crashes the app
|
||||||
return newQVariant("")
|
return newQVariant("")
|
||||||
|
@ -227,7 +227,7 @@ QtObject:
|
||||||
notify = pendingMemberRequestsChanged
|
notify = pendingMemberRequestsChanged
|
||||||
|
|
||||||
|
|
||||||
proc declinedMemberRequests(self: ActiveSection): QVariant {.slot.} =
|
proc declinedMemberRequests(self: SectionDetails): QVariant {.slot.} =
|
||||||
if (self.item.id == ""):
|
if (self.item.id == ""):
|
||||||
# FIXME (Jo) I don't know why but the Item is sometimes empty and doing anything here crashes the app
|
# FIXME (Jo) I don't know why but the Item is sometimes empty and doing anything here crashes the app
|
||||||
return newQVariant("")
|
return newQVariant("")
|
||||||
|
@ -237,15 +237,15 @@ QtObject:
|
||||||
read = declinedMemberRequests
|
read = declinedMemberRequests
|
||||||
notify = declinedMemberRequestsChanged
|
notify = declinedMemberRequestsChanged
|
||||||
|
|
||||||
proc hasMember(self: ActiveSection, pubkey: string): bool {.slot.} =
|
proc hasMember(self: SectionDetails, pubkey: string): bool {.slot.} =
|
||||||
return self.item.hasMember(pubkey)
|
return self.item.hasMember(pubkey)
|
||||||
|
|
||||||
proc setOnlineStatusForMember*(self: ActiveSection, pubKey: string,
|
proc setOnlineStatusForMember*(self: SectionDetails, pubKey: string,
|
||||||
onlineStatus: OnlineStatus) =
|
onlineStatus: OnlineStatus) =
|
||||||
self.item.setOnlineStatusForMember(pubKey, onlineStatus)
|
self.item.setOnlineStatusForMember(pubKey, onlineStatus)
|
||||||
|
|
||||||
proc updateMember*(
|
proc updateMember*(
|
||||||
self: ActiveSection,
|
self: SectionDetails,
|
||||||
pubkey: string,
|
pubkey: string,
|
||||||
name: string,
|
name: string,
|
||||||
ensName: string,
|
ensName: string,
|
||||||
|
@ -258,7 +258,7 @@ QtObject:
|
||||||
self.item.updateMember(pubkey, name, ensName, localNickname, alias, image, isContact,
|
self.item.updateMember(pubkey, name, ensName, localNickname, alias, image, isContact,
|
||||||
isVerified, isUntrustworthy)
|
isVerified, isUntrustworthy)
|
||||||
|
|
||||||
proc pendingRequestsToJoin(self: ActiveSection): QVariant {.slot.} =
|
proc pendingRequestsToJoin(self: SectionDetails): QVariant {.slot.} =
|
||||||
if (self.item.id == ""):
|
if (self.item.id == ""):
|
||||||
# FIXME (Jo) I don't know why but the Item is sometimes empty and doing anything here crashes the app
|
# FIXME (Jo) I don't know why but the Item is sometimes empty and doing anything here crashes the app
|
||||||
return newQVariant("")
|
return newQVariant("")
|
Loading…
Reference in New Issue