parent
c805219463
commit
fa1f396a86
|
@ -26,6 +26,9 @@ method setCuratedCommunities*(self: AccessInterface, curatedCommunities: seq[Com
|
||||||
method getCommunityItem*(self: AccessInterface, community: CommunityDto): SectionItem {.base.} =
|
method getCommunityItem*(self: AccessInterface, community: CommunityDto): SectionItem {.base.} =
|
||||||
raise newException(ValueError, "No implementation available")
|
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.} =
|
method spectateCommunity*(self: AccessInterface, communityId: string): string {.base.} =
|
||||||
raise newException(ValueError, "No implementation available")
|
raise newException(ValueError, "No implementation available")
|
||||||
|
|
||||||
|
|
|
@ -176,6 +176,13 @@ method communityAdded*(self: Module, community: CommunityDto) =
|
||||||
method spectateCommunity*(self: Module, communityId: string): string =
|
method spectateCommunity*(self: Module, communityId: string): string =
|
||||||
self.controller.spectateCommunity(communityId)
|
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) =
|
method communityEdited*(self: Module, community: CommunityDto) =
|
||||||
self.view.model().editItem(self.getCommunityItem(community))
|
self.view.model().editItem(self.getCommunityItem(community))
|
||||||
self.view.communityChanged(community.id)
|
self.view.communityChanged(community.id)
|
||||||
|
|
|
@ -315,7 +315,10 @@ QtObject:
|
||||||
read = getDiscordImportCommunityName
|
read = getDiscordImportCommunityName
|
||||||
notify = discordImportCommunityNameChanged
|
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)
|
discard self.delegate.spectateCommunity(communityId)
|
||||||
|
|
||||||
proc createCommunity*(self: View, name: string,
|
proc createCommunity*(self: View, name: string,
|
||||||
|
|
|
@ -168,6 +168,9 @@ method storePassword*(self: AccessInterface, password: string) {.base.} =
|
||||||
method setActiveSection*(self: AccessInterface, item: SectionItem) {.base.} =
|
method setActiveSection*(self: AccessInterface, item: SectionItem) {.base.} =
|
||||||
raise newException(ValueError, "No implementation available")
|
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) =
|
method onChatLeft*(self: AccessInterface, chatId: string) =
|
||||||
raise newException(ValueError, "No implementation available")
|
raise newException(ValueError, "No implementation available")
|
||||||
|
|
||||||
|
|
|
@ -578,6 +578,10 @@ method setActiveSection*[T](self: Module[T], item: SectionItem) =
|
||||||
return
|
return
|
||||||
self.controller.setActiveSection(item.id)
|
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) =
|
proc notifySubModulesAboutChange[T](self: Module[T], sectionId: string) =
|
||||||
for cModule in self.channelGroupModules.values:
|
for cModule in self.channelGroupModules.values:
|
||||||
cModule.onActiveSectionChange(sectionId)
|
cModule.onActiveSectionChange(sectionId)
|
||||||
|
|
|
@ -150,8 +150,7 @@ QtObject:
|
||||||
self.delegate.setActiveSection(item)
|
self.delegate.setActiveSection(item)
|
||||||
|
|
||||||
proc setActiveSectionById*(self: View, sectionId: string) {.slot.} =
|
proc setActiveSectionById*(self: View, sectionId: string) {.slot.} =
|
||||||
let item = self.model.getItemById(sectionId)
|
self.delegate.setActiveSectionById(sectionId)
|
||||||
self.delegate.setActiveSection(item)
|
|
||||||
|
|
||||||
proc setActiveSectionBySectionType*(self: View, sectionType: int) {.slot.} =
|
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
|
## 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() {
|
function navigateToCommunity() {
|
||||||
logs.logEvent("CommunitiesStore::setActiveCommunity", ["communityId"], arguments)
|
logs.logEvent("CommunitiesStore::navigateToCommunity", ["communityId"], arguments)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -52,10 +52,6 @@ StatusSectionLayout {
|
||||||
readonly property int preventShadowClipMargin: 40
|
readonly property int preventShadowClipMargin: 40
|
||||||
|
|
||||||
readonly property bool searchMode: searcher.text.length > 0
|
readonly property bool searchMode: searcher.text.length > 0
|
||||||
|
|
||||||
function navigateToCommunity(communityId) {
|
|
||||||
root.communitiesStore.setActiveCommunity(communityId)
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
SortFilterProxyModel {
|
SortFilterProxyModel {
|
||||||
|
@ -178,7 +174,7 @@ StatusSectionLayout {
|
||||||
model: filteredCommunitiesModel
|
model: filteredCommunitiesModel
|
||||||
searchLayout: d.searchMode
|
searchLayout: d.searchMode
|
||||||
|
|
||||||
onCardClicked: d.navigateToCommunity(communityId)
|
onCardClicked: root.communitiesStore.navigateToCommunity(communityId)
|
||||||
}
|
}
|
||||||
|
|
||||||
StatusBaseText {
|
StatusBaseText {
|
||||||
|
|
|
@ -88,6 +88,10 @@ QtObject {
|
||||||
mainModule.setActiveSectionById(communityId);
|
mainModule.setActiveSectionById(communityId);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function navigateToCommunity(communityId) {
|
||||||
|
root.communitiesModuleInst.navigateToCommunity(communityId)
|
||||||
|
}
|
||||||
|
|
||||||
function setFileListItems(filePaths) {
|
function setFileListItems(filePaths) {
|
||||||
root.communitiesModuleInst.setFileListItems(filePaths)
|
root.communitiesModuleInst.setFileListItems(filePaths)
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue