From 9cde8c3df03025e2e00ef5c27e0caff6de438bc5 Mon Sep 17 00:00:00 2001 From: rating89us <45968869+rating89us@users.noreply.github.com> Date: Wed, 7 Oct 2020 00:41:40 +0200 Subject: [PATCH] LeftPanel: add hide balance icon in card --- LeftPanel.qml | 35 ++++++++++++++++++++++++++++--- pages/settings/SettingsLayout.qml | 1 + 2 files changed, 33 insertions(+), 3 deletions(-) diff --git a/LeftPanel.qml b/LeftPanel.qml index 83dbce1f..cd565035 100644 --- a/LeftPanel.qml +++ b/LeftPanel.qml @@ -268,7 +268,9 @@ Rectangle { value: MoneroComponents.Style.orange } text: { - if (persistentSettings.fiatPriceEnabled && persistentSettings.fiatPriceToggle) { + if (persistentSettings.hideBalance) { + return qsTr("HIDDEN") + translationManager.emptyString + } else if (persistentSettings.fiatPriceEnabled && persistentSettings.fiatPriceToggle) { return balanceFiatString.split('.')[0] + "." } else { return balanceString.split('.')[0] + "." @@ -277,7 +279,9 @@ Rectangle { font.pixelSize: { var defaultSize = 29; var digits = (balancePart1.text.length - 1) - if (digits > 2 && !(persistentSettings.fiatPriceEnabled && persistentSettings.fiatPriceToggle)) { + if (persistentSettings.hideBalance) { + return 26 + } else if (digits > 2 && !(persistentSettings.fiatPriceEnabled && persistentSettings.fiatPriceToggle)) { return defaultSize - 1.1 * digits } else { return defaultSize @@ -303,9 +307,13 @@ Rectangle { anchors.baseline: currencyLabel.baseline color: balancePart1.color text: { - if (persistentSettings.fiatPriceEnabled && persistentSettings.fiatPriceToggle) { + if (persistentSettings.hideBalance) { + balancePart2.visible = false; + } else if (persistentSettings.fiatPriceEnabled && persistentSettings.fiatPriceToggle) { + balancePart2.visible = true; return balanceFiatString.split('.')[1] } else { + balancePart2.visible = true; return balanceString.split('.')[1] } } @@ -319,6 +327,27 @@ Rectangle { } } + MoneroComponents.TextPlain { + id: hideBalance + themeTransition: false + anchors.left: parent.left + anchors.leftMargin: persistentSettings.hideBalance ? 230 : 231 + anchors.baseline: currencyLabel.baseline + color: MoneroComponents.Style.blackTheme ? "white" : "black" + text: persistentSettings.hideBalance ? FontAwesome.eyeSlash : FontAwesome.eye + font.pixelSize: 16 + MouseArea { + id: hideBalanceMouseArea + hoverEnabled: true + anchors.fill: parent + cursorShape: Qt.PointingHandCursor + onClicked: { + persistentSettings.hideBalance = !persistentSettings.hideBalance + appWindow.updateBalance(); + } + } + } + Item { //separator anchors.left: parent.left anchors.right: parent.right diff --git a/pages/settings/SettingsLayout.qml b/pages/settings/SettingsLayout.qml index 9db3874f..bbb70c24 100644 --- a/pages/settings/SettingsLayout.qml +++ b/pages/settings/SettingsLayout.qml @@ -69,6 +69,7 @@ Rectangle { MoneroComponents.CheckBox { id: hideBalanceCheckBox checked: persistentSettings.hideBalance + toggleOnClick: false onClicked: { persistentSettings.hideBalance = !persistentSettings.hideBalance appWindow.updateBalance();