parent
c805219463
commit
fa1f396a86
|
@ -26,6 +26,9 @@ method setCuratedCommunities*(self: AccessInterface, curatedCommunities: seq[Com
|
|||
method getCommunityItem*(self: AccessInterface, community: CommunityDto): SectionItem {.base.} =
|
||||
raise newException(ValueError, "No implementation available")
|
||||
|
||||
method navigateToCommunity*(self: AccessInterface, communityId: string) {.base.} =
|
||||
raise newException(ValueError, "No implementation available")
|
||||
|
||||
method spectateCommunity*(self: AccessInterface, communityId: string): string {.base.} =
|
||||
raise newException(ValueError, "No implementation available")
|
||||
|
||||
|
|
|
@ -176,6 +176,13 @@ method communityAdded*(self: Module, community: CommunityDto) =
|
|||
method spectateCommunity*(self: Module, communityId: string): string =
|
||||
self.controller.spectateCommunity(communityId)
|
||||
|
||||
method navigateToCommunity*(self: Module, communityId: string) =
|
||||
let community = self.view.model().getItemById(communityId)
|
||||
if community.isEmpty() or not (community.spectated() or community.joined()):
|
||||
discard self.controller.spectateCommunity(communityId)
|
||||
else:
|
||||
self.delegate.setActiveSectionById(communityId)
|
||||
|
||||
method communityEdited*(self: Module, community: CommunityDto) =
|
||||
self.view.model().editItem(self.getCommunityItem(community))
|
||||
self.view.communityChanged(community.id)
|
||||
|
|
|
@ -76,7 +76,7 @@ QtObject:
|
|||
result.discordChannelsModel = newDiscordChannelsModel()
|
||||
result.discordChannelsModelVariant = newQVariant(result.discordChannelsModel)
|
||||
result.discordOldestMessageTimestamp = 0
|
||||
result.discordDataExtractionInProgress = false
|
||||
result.discordDataExtractionInProgress = false
|
||||
result.discordImportWarningsCount = 0
|
||||
result.discordImportErrorsCount = 0
|
||||
result.discordImportProgress = 0
|
||||
|
@ -315,7 +315,10 @@ QtObject:
|
|||
read = getDiscordImportCommunityName
|
||||
notify = discordImportCommunityNameChanged
|
||||
|
||||
proc spectateCommunity*(self: View, communityId: string, ensName: string) {.slot.} =
|
||||
proc navigateToCommunity*(self: View, communityId: string) {.slot.} =
|
||||
self.delegate.navigateToCommunity(communityId)
|
||||
|
||||
proc spectateCommunity*(self: View, communityId: string) {.slot.} =
|
||||
discard self.delegate.spectateCommunity(communityId)
|
||||
|
||||
proc createCommunity*(self: View, name: string,
|
||||
|
|
|
@ -168,6 +168,9 @@ method storePassword*(self: AccessInterface, password: string) {.base.} =
|
|||
method setActiveSection*(self: AccessInterface, item: SectionItem) {.base.} =
|
||||
raise newException(ValueError, "No implementation available")
|
||||
|
||||
method setActiveSectionById*(self: AccessInterface, id: string) {.base.} =
|
||||
raise newException(ValueError, "No implementation available")
|
||||
|
||||
method onChatLeft*(self: AccessInterface, chatId: string) =
|
||||
raise newException(ValueError, "No implementation available")
|
||||
|
||||
|
|
|
@ -578,6 +578,10 @@ method setActiveSection*[T](self: Module[T], item: SectionItem) =
|
|||
return
|
||||
self.controller.setActiveSection(item.id)
|
||||
|
||||
method setActiveSectionById*[T](self: Module[T], id: string) =
|
||||
let item = self.view.model().getItemById(id)
|
||||
self.setActiveSection(item)
|
||||
|
||||
proc notifySubModulesAboutChange[T](self: Module[T], sectionId: string) =
|
||||
for cModule in self.channelGroupModules.values:
|
||||
cModule.onActiveSectionChange(sectionId)
|
||||
|
|
|
@ -150,8 +150,7 @@ QtObject:
|
|||
self.delegate.setActiveSection(item)
|
||||
|
||||
proc setActiveSectionById*(self: View, sectionId: string) {.slot.} =
|
||||
let item = self.model.getItemById(sectionId)
|
||||
self.delegate.setActiveSection(item)
|
||||
self.delegate.setActiveSectionById(sectionId)
|
||||
|
||||
proc setActiveSectionBySectionType*(self: View, sectionType: int) {.slot.} =
|
||||
## This will try to set a section with passed sectionType to active one, in case of communities the first community
|
||||
|
|
|
@ -40,8 +40,8 @@ SplitView {
|
|||
}
|
||||
}
|
||||
|
||||
function setActiveCommunity() {
|
||||
logs.logEvent("CommunitiesStore::setActiveCommunity", ["communityId"], arguments)
|
||||
function navigateToCommunity() {
|
||||
logs.logEvent("CommunitiesStore::navigateToCommunity", ["communityId"], arguments)
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -52,10 +52,6 @@ StatusSectionLayout {
|
|||
readonly property int preventShadowClipMargin: 40
|
||||
|
||||
readonly property bool searchMode: searcher.text.length > 0
|
||||
|
||||
function navigateToCommunity(communityId) {
|
||||
root.communitiesStore.setActiveCommunity(communityId)
|
||||
}
|
||||
}
|
||||
|
||||
SortFilterProxyModel {
|
||||
|
@ -178,7 +174,7 @@ StatusSectionLayout {
|
|||
model: filteredCommunitiesModel
|
||||
searchLayout: d.searchMode
|
||||
|
||||
onCardClicked: d.navigateToCommunity(communityId)
|
||||
onCardClicked: root.communitiesStore.navigateToCommunity(communityId)
|
||||
}
|
||||
|
||||
StatusBaseText {
|
||||
|
|
|
@ -88,6 +88,10 @@ QtObject {
|
|||
mainModule.setActiveSectionById(communityId);
|
||||
}
|
||||
|
||||
function navigateToCommunity(communityId) {
|
||||
root.communitiesModuleInst.navigateToCommunity(communityId)
|
||||
}
|
||||
|
||||
function setFileListItems(filePaths) {
|
||||
root.communitiesModuleInst.setFileListItems(filePaths)
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue