From 16f5c2fb1a784576cef504f1e1f63650ea6659c4 Mon Sep 17 00:00:00 2001 From: Jonathan Rainville Date: Tue, 29 Dec 2020 10:31:26 -0500 Subject: [PATCH] feat: add showFavoritesBar setting (placeholder for now) --- .../Profile/Sections/BrowserContainer.qml | 34 ++++++---- .../Profile/Sections/PrivacyContainer.qml | 37 +---------- ui/imports/Themes/Theme.qml | 1 + ui/main.qml | 2 + ui/nim-status-client.pro | 1 + ui/shared/status/StatusSettingsLineButton.qml | 66 +++++++++++++++++++ 6 files changed, 93 insertions(+), 48 deletions(-) create mode 100644 ui/shared/status/StatusSettingsLineButton.qml diff --git a/ui/app/AppLayouts/Profile/Sections/BrowserContainer.qml b/ui/app/AppLayouts/Profile/Sections/BrowserContainer.qml index 4fe251c2d0..59c3f80568 100644 --- a/ui/app/AppLayouts/Profile/Sections/BrowserContainer.qml +++ b/ui/app/AppLayouts/Profile/Sections/BrowserContainer.qml @@ -1,5 +1,4 @@ import QtQuick 2.13 -import QtQuick.Controls 2.13 import QtQuick.Layouts 1.13 import "../../../../imports" import "../../../../shared" @@ -10,23 +9,30 @@ Item { Layout.fillHeight: true Layout.fillWidth: true - StyledText { - id: title - 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 - } - Column { + id: containerColumn spacing: Style.current.padding - anchors.top: title.bottom + anchors.top: parent.top anchors.topMargin: Style.current.padding + anchors.right: parent.right + anchors.rightMargin: contentMargin anchors.left: parent.left - anchors.leftMargin: 24 + anchors.leftMargin: contentMargin + anchors.bottom: parent.bottom + + StatusSectionHeadline { + id: labelGeneral + text: qsTr("General") + } + + StatusSettingsLineButton { + text: qsTr("Show favorites bar") + isSwitch: true + switchChecked: appSettings.showFavoritesBar + onClicked: function (checked) { + appSettings.showFavoritesBar = checked + } + } RowLayout { StyledText { diff --git a/ui/app/AppLayouts/Profile/Sections/PrivacyContainer.qml b/ui/app/AppLayouts/Profile/Sections/PrivacyContainer.qml index 86570e6aa6..c595d337c2 100644 --- a/ui/app/AppLayouts/Profile/Sections/PrivacyContainer.qml +++ b/ui/app/AppLayouts/Profile/Sections/PrivacyContainer.qml @@ -86,40 +86,9 @@ Item { Layout.topMargin: Style.current.bigPadding - containerColumn.spacing } - Item { - id: dappPermissions - height: dappPermissionsText.height - width: parent.width - - StyledText { - id: dappPermissionsText - text: qsTr("Set DApp access permissions") - font.pixelSize: 15 - } - - SVGImage { - id: caret2 - anchors.right: parent.right - anchors.rightMargin: 0 - anchors.verticalCenter: dappPermissionsText.verticalCenter - source: "../../../img/caret.svg" - width: 13 - height: 7 - rotation: -90 - } - - ColorOverlay { - anchors.fill: caret2 - source: caret2 - color: Style.current.darkGrey - rotation: -90 - } - - MouseArea { - anchors.fill: parent - onClicked: dappListPopup.createObject(privacyContainer).open() - cursorShape: Qt.PointingHandCursor - } + StatusSettingsLineButton { + text: qsTr("Set DApp access permissions") + onClicked: dappListPopup.createObject(privacyContainer).open() } Separator { diff --git a/ui/imports/Themes/Theme.qml b/ui/imports/Themes/Theme.qml index ca9d683b17..19f75be7da 100644 --- a/ui/imports/Themes/Theme.qml +++ b/ui/imports/Themes/Theme.qml @@ -32,6 +32,7 @@ QtObject { property color background property color border property color textColor + property color secondaryText property color currentUserTextColor property color secondaryBackground property color modalBackground diff --git a/ui/main.qml b/ui/main.qml index 27dc676337..4df7b9f35a 100644 --- a/ui/main.qml +++ b/ui/main.qml @@ -113,6 +113,7 @@ ApplicationWindow { property int fontSize: Constants.fontSizeM // Browser settings + property bool showFavoritesBar: false property bool autoLoadImages: true property bool javaScriptEnabled: true property bool errorPageEnabled: true @@ -150,6 +151,7 @@ ApplicationWindow { property bool hideSignPhraseModal: defaultAppSettings.hideSignPhraseModal // Browser settings + property bool showFavoritesBar: defaultAppSettings.showFavoritesBar property bool autoLoadImages: defaultAppSettings.autoLoadImages property bool javaScriptEnabled: defaultAppSettings.javaScriptEnabled property bool errorPageEnabled: defaultAppSettings.errorPageEnabled diff --git a/ui/nim-status-client.pro b/ui/nim-status-client.pro index 31ef38c6b8..489ab307ae 100644 --- a/ui/nim-status-client.pro +++ b/ui/nim-status-client.pro @@ -406,4 +406,5 @@ DISTFILES += \ shared/qmldir \ shared/status/StatusEmojiSuggestionPopup.qml \ shared/status/StatusInputListPopup.qml \ + shared/status/StatusSettingsLineButton.qml \ sounds/ErrorSound.qml diff --git a/ui/shared/status/StatusSettingsLineButton.qml b/ui/shared/status/StatusSettingsLineButton.qml new file mode 100644 index 0000000000..4ce8d922cf --- /dev/null +++ b/ui/shared/status/StatusSettingsLineButton.qml @@ -0,0 +1,66 @@ +import QtQuick 2.13 +import QtGraphicalEffects 1.12 +import "../../imports" +import ".." + +Item { + property string text + property bool isSwitch: false + property bool switchChecked: false + property string currentValue + signal clicked(bool checked) + + id: root + height: textItem.height + width: parent.width + + StyledText { + id: textItem + text: root.text + font.pixelSize: 15 + } + + StyledText { + id: valueText + visible: !!root.currentValue + text: root.currentValue + font.pixelSize: 15 + color: Style.current.secondaryText + anchors.right: root.isSwitch ? switchItem.left : caret.left + anchors.rightMargin: Style.current.padding + anchors.verticalCenter: textItem.verticalCenter + } + + StatusSwitch { + id: switchItem + visible: root.isSwitch + checked: root.switchChecked + anchors.right: parent.right + anchors.verticalCenter: textItem.verticalCenter + } + + SVGImage { + id: caret + visible: !root.isSwitch + anchors.right: parent.right + anchors.verticalCenter: textItem.verticalCenter + source: "../../app/img/caret.svg" + width: 13 + height: 7 + rotation: -90 + ColorOverlay { + anchors.fill: caret + source: caret + color: Style.current.darkGrey + } + } + + MouseArea { + anchors.fill: parent + onClicked: { + root.clicked(!root.switchChecked) + } + + cursorShape: Qt.PointingHandCursor + } +}