feat: hide community stuff by default and add a setting to show it

This commit is contained in:
Jonathan Rainville 2021-01-05 11:36:42 -05:00 committed by Iuri Matias
parent 7b03da2967
commit 4aeeee6d9c
8 changed files with 49 additions and 31 deletions

View File

@ -73,7 +73,7 @@ SplitView {
SplitView.preferredWidth: Style.current.leftTabPrefferedSize
SplitView.minimumWidth: Style.current.leftTabMinimumWidth
SplitView.maximumWidth: Style.current.leftTabMaximumWidth
sourceComponent: chatsModel.activeCommunity.active ? communtiyColumnComponent : contactsColumnComponent
sourceComponent: appSettings.communitiesEnabled && chatsModel.activeCommunity.active ? communtiyColumnComponent : contactsColumnComponent
}
Component {

View File

@ -21,7 +21,7 @@ Rectangle {
if (communityButton.hovered) {
return Style.current.secondaryBackground
}
return Style.current.transparent
return Style.current.background
}
anchors.right: parent.right
anchors.top: applicationWindow.top

View File

@ -24,7 +24,6 @@ Item {
communityId: model.id
name: model.name
description: model.description
// TODO add other properties
searchStr: root.searchStr
}
}
@ -44,27 +43,6 @@ Item {
text: qsTr("No search results in Communities")
}
}
// Connections {
// target: chatsModel.chats
// onDataChanged: {
// // If the current active channel receives messages and changes its position,
// // refresh the currentIndex accordingly
// if(chatsModel.activeChannelIndex !== communityListView.currentIndex){
// communityListView.currentIndex = chatsModel.activeChannelIndex
// }
// }
// }
// Connections {
// target: chatsModel
// onActiveChannelChanged: {
// chatsModel.hideLoadingIndicator()
// communityListView.currentIndex = chatsModel.activeChannelIndex
// SelectedMessage.reset();
// chatColumn.isReply = false;
// }
// }
}

View File

@ -117,18 +117,33 @@ Item {
leftPadding: Style.current.halfPadding
rightPadding: Style.current.halfPadding
ScrollBar.horizontal.policy: ScrollBar.AlwaysOff
contentHeight: communityList.height + channelList.height + 2 * Style.current.padding + emptyViewAndSuggestions.height
contentHeight: communitiesListLoader.height + channelList.height + 2 * Style.current.padding + emptyViewAndSuggestions.height
clip: true
CommunityList {
id: communityList
searchStr: contactsColumn.searchStr.toLowerCase()
Loader {
id: communitiesListLoader
active: appSettings.communitiesEnabled
width: parent.width
height: {
if (item && active) {
return item.height
}
return 0
}
sourceComponent: Component {
CommunityList {
id: communityList
visible: appSettings.communitiesEnabled
searchStr: contactsColumn.searchStr.toLowerCase()
}
}
}
Separator {
id: communitySep
visible: communityList.visible
anchors.top: communityList.bottom
visible: communitiesListLoader.active
anchors.top: visible ? communitiesListLoader.bottom : 0
anchors.topMargin: Style.current.halfPadding
}

View File

@ -46,6 +46,7 @@ StatusRoundButton {
onTriggered: openPopup(publicChatPopupComponent)
}
Action {
enabled: appSettings.communitiesEnabled
text: qsTr("Communities")
icon.source: "../../../img/communities.svg"
icon.width: 20

View File

@ -13,6 +13,7 @@ Rectangle {
id: channelListContent
width: parent.width
height: childrenRect.height
color: Style.current.transparent
Timer {
id: timer

View File

@ -24,12 +24,33 @@ Item {
}
RowLayout {
id: walletTabSettings
id: communitiesTabSettings
anchors.top: title.bottom
anchors.topMargin: 20
anchors.left: parent.left
anchors.leftMargin: 24
StyledText {
text: qsTr("Enable Communities")
}
StatusSwitch {
checked: appSettings.communitiesEnabled
onCheckedChanged: function(value) {
appSettings.communitiesEnabled = this.checked
}
}
StyledText {
text: qsTr("Currently WIP")
}
}
RowLayout {
id: walletTabSettings
anchors.top: communitiesTabSettings.bottom
anchors.topMargin: 20
anchors.left: parent.left
anchors.leftMargin: 24
StyledText {
//% "Wallet Tab"
text: qsTrId("wallet-tab")

View File

@ -93,6 +93,7 @@ ApplicationWindow {
Settings {
id: defaultAppSettings
property bool communitiesEnabled: false
property bool walletEnabled: false
property bool browserEnabled: false
property bool displayChatImages: false
@ -138,6 +139,7 @@ ApplicationWindow {
property var chatSplitView
property var walletSplitView
property var profileSplitView
property bool communitiesEnabled: defaultAppSettings.communitiesEnabled
property bool walletEnabled: defaultAppSettings.walletEnabled
property bool browserEnabled: defaultAppSettings.browserEnabled
property bool displayChatImages: defaultAppSettings.displayChatImages