From af2af0700c6cfe769bf3730fbec333579b671e4a Mon Sep 17 00:00:00 2001 From: Jonathan Rainville Date: Wed, 21 Oct 2020 10:45:28 -0400 Subject: [PATCH] feat: add basic browser settings and go to them on browser button click --- .../Browser/BrowserSettingsMenu.qml | 4 ++- ui/app/AppLayouts/Profile/LeftTab.qml | 1 + ui/app/AppLayouts/Profile/LeftTab/Menu.qml | 3 ++ .../AppLayouts/Profile/LeftTab/constants.js | 13 +++++--- ui/app/AppLayouts/Profile/ProfileLayout.qml | 3 ++ .../Profile/Sections/AboutContainer.qml | 2 -- .../Profile/Sections/AdvancedContainer.qml | 2 -- .../Profile/Sections/BrowserContainer.qml | 31 +++++++++++++++++++ ui/app/AppMain.qml | 16 ++++++++++ ui/imports/Constants.qml | 7 +++++ ui/nim-status-client.pro | 1 + 11 files changed, 74 insertions(+), 9 deletions(-) create mode 100644 ui/app/AppLayouts/Profile/Sections/BrowserContainer.qml diff --git a/ui/app/AppLayouts/Browser/BrowserSettingsMenu.qml b/ui/app/AppLayouts/Browser/BrowserSettingsMenu.qml index f494de2b07..5155c13535 100644 --- a/ui/app/AppLayouts/Browser/BrowserSettingsMenu.qml +++ b/ui/app/AppLayouts/Browser/BrowserSettingsMenu.qml @@ -5,6 +5,7 @@ import "../../../shared" import "../../../shared/status" import "../../../imports" import "../Chat/ChatColumn/ChatComponents" +import "../Profile/LeftTab/constants.js" as ProfileConstants PopupMenu { property var addNewTab: function () {} @@ -83,7 +84,8 @@ PopupMenu { text: qsTr("Settings") shortcut: "Ctrl+," onTriggered: { - console.log('Open settings in Profile') + appMain.changeAppSection(Constants.profile) + profileLayoutContainer.changeProfileSection(ProfileConstants.BROWSER_SETTINGS) } } } diff --git a/ui/app/AppLayouts/Profile/LeftTab.qml b/ui/app/AppLayouts/Profile/LeftTab.qml index eb68e9f75e..46f4f02bbe 100644 --- a/ui/app/AppLayouts/Profile/LeftTab.qml +++ b/ui/app/AppLayouts/Profile/LeftTab.qml @@ -5,6 +5,7 @@ import "./LeftTab" Item { property alias currentTab: profileMenu.profileCurrentIndex + property alias changeProfileSection: profileMenu.changeProfileSection id: profileInfoContainer diff --git a/ui/app/AppLayouts/Profile/LeftTab/Menu.qml b/ui/app/AppLayouts/Profile/LeftTab/Menu.qml index 7352f24884..faa9727ce2 100644 --- a/ui/app/AppLayouts/Profile/LeftTab/Menu.qml +++ b/ui/app/AppLayouts/Profile/LeftTab/Menu.qml @@ -10,6 +10,9 @@ ScrollView { property int profileCurrentIndex: ProfileConstants.PROFILE readonly property int btnheight: 42 readonly property int w: 340 + property var changeProfileSection: function (sectionId) { + profileCurrentIndex = sectionId + } id: profileMenu diff --git a/ui/app/AppLayouts/Profile/LeftTab/constants.js b/ui/app/AppLayouts/Profile/LeftTab/constants.js index c0dd68335c..d2de8bf959 100644 --- a/ui/app/AppLayouts/Profile/LeftTab/constants.js +++ b/ui/app/AppLayouts/Profile/LeftTab/constants.js @@ -8,9 +8,10 @@ var LANGUAGE = 6 var NOTIFICATIONS = 7 var SYNC_SETTINGS = 8 var DEVICES_SETTINGS = 9 -var ADVANCED = 10 -var NEED_HELP = 11 -var ABOUT = 12 +var BROWSER_SETTINGS = 10 +var ADVANCED = 11 +var NEED_HELP = 12 +var ABOUT = 13 var menuButtons = [{ "id": PROFILE, @@ -52,7 +53,11 @@ var menuButtons = [{ "id": DEVICES_SETTINGS, "text": qsTr("Devices settings"), "filename": "sync.svg" - }, { + }, { + "id": BROWSER_SETTINGS, + "text": qsTr("Browser settings"), + "filename": "../compassActive.svg" + }, { "id": ADVANCED, "text": qsTr("Advanced"), "filename": "advanced.svg" diff --git a/ui/app/AppLayouts/Profile/ProfileLayout.qml b/ui/app/AppLayouts/Profile/ProfileLayout.qml index 460bd37f7a..4298ee1be6 100644 --- a/ui/app/AppLayouts/Profile/ProfileLayout.qml +++ b/ui/app/AppLayouts/Profile/ProfileLayout.qml @@ -7,6 +7,7 @@ import "./Sections" SplitView { property int contentMargin: 120 + property alias changeProfileSection: leftTab.changeProfileSection id: profileView Layout.fillHeight: true @@ -77,6 +78,8 @@ SplitView { DevicesContainer {} + BrowserContainer {} + AdvancedContainer {} HelpContainer {} diff --git a/ui/app/AppLayouts/Profile/Sections/AboutContainer.qml b/ui/app/AppLayouts/Profile/Sections/AboutContainer.qml index 5eefb73456..307f3e2127 100644 --- a/ui/app/AppLayouts/Profile/Sections/AboutContainer.qml +++ b/ui/app/AppLayouts/Profile/Sections/AboutContainer.qml @@ -6,8 +6,6 @@ import "../../../../shared" Item { id: aboutContainer - width: 200 - height: 200 Layout.fillHeight: true Layout.fillWidth: true diff --git a/ui/app/AppLayouts/Profile/Sections/AdvancedContainer.qml b/ui/app/AppLayouts/Profile/Sections/AdvancedContainer.qml index b8d7ca474e..aa361c9749 100644 --- a/ui/app/AppLayouts/Profile/Sections/AdvancedContainer.qml +++ b/ui/app/AppLayouts/Profile/Sections/AdvancedContainer.qml @@ -7,8 +7,6 @@ import "../../../../shared/status" Item { id: advancedContainer - width: 200 - height: 200 Layout.fillHeight: true Layout.fillWidth: true diff --git a/ui/app/AppLayouts/Profile/Sections/BrowserContainer.qml b/ui/app/AppLayouts/Profile/Sections/BrowserContainer.qml new file mode 100644 index 0000000000..24d24a1cfc --- /dev/null +++ b/ui/app/AppLayouts/Profile/Sections/BrowserContainer.qml @@ -0,0 +1,31 @@ +import QtQuick 2.13 +import QtQuick.Controls 2.13 +import QtQuick.Layouts 1.13 +import "../../../../imports" +import "../../../../shared" +import "../../../../shared/status" + +Item { + id: root + Layout.fillHeight: true + Layout.fillWidth: true + + StyledText { + id: titl + text: qsTr("Browser Settings") + anchors.left: parent.left + anchors.leftMargin: 24 + anchors.top: parent.top + anchors.topMargin: 24 + font.weight: Font.Bold + font.pixelSize: 20 + } + + // TODO add browser settings here +} + +/*##^## +Designer { + D{i:0;height:400;width:700} +} +##^##*/ diff --git a/ui/app/AppMain.qml b/ui/app/AppMain.qml index 198d873de8..ed6b544655 100644 --- a/ui/app/AppMain.qml +++ b/ui/app/AppMain.qml @@ -24,6 +24,22 @@ RowLayout { } } + function changeAppSection(section) { + let sectionId = -1 + switch (section) { + case Constants.chat: sectionId = 0; break; + case Constants.wallet: sectionId = 1; break; + case Constants.browser: sectionId = 2; break; + case Constants.profile: sectionId = 3; break; + case Constants.node: sectionId = 4; break; + case Constants.ui: sectionId = 5; break; + } + if (sectionId === -1) { + throw new Exception ("Unknown section name. Check the Constants to know the available ones") + } + tabBar.setCurrentIndex(sectionId) + } + TabBar { id: tabBar width: 78 diff --git a/ui/imports/Constants.qml b/ui/imports/Constants.qml index 9675eac328..fa0aff5a76 100644 --- a/ui/imports/Constants.qml +++ b/ui/imports/Constants.qml @@ -15,6 +15,13 @@ QtObject { readonly property int limitLongChatText: 500 readonly property int limitLongChatTextCompactMode: 1000 + readonly property string chat: "chat" + readonly property string wallet: "wallet" + readonly property string browser: "browser" + readonly property string profile: "profile" + readonly property string node: "node" + readonly property string ui: "ui" + readonly property int notifyAllMessages: 0 readonly property int notifyJustMentions: 1 readonly property int notifyNone: 2 diff --git a/ui/nim-status-client.pro b/ui/nim-status-client.pro index d1efac2dca..d1d7457575 100644 --- a/ui/nim-status-client.pro +++ b/ui/nim-status-client.pro @@ -174,6 +174,7 @@ DISTFILES += \ app/AppLayouts/Chat/data/EmojiReactions.qml \ app/AppLayouts/Profile/Sections/AppearanceContainer.qml \ app/AppLayouts/Profile/Sections/BackupSeedModal.qml \ + app/AppLayouts/Profile/Sections/BrowserContainer.qml \ app/AppLayouts/Profile/Sections/MyProfileContainer.qml \ app/AppLayouts/Profile/Sections/SoundsContainer.qml \ app/AppLayouts/UIComponents/UIComponents.qml \