LeftPanel: add hide balance icon in card

This commit is contained in:
rating89us 2020-10-07 00:41:40 +02:00 committed by rating89us
parent afc2e846fd
commit 9cde8c3df0
2 changed files with 33 additions and 3 deletions

View file

@ -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

View file

@ -69,6 +69,7 @@ Rectangle {
MoneroComponents.CheckBox {
id: hideBalanceCheckBox
checked: persistentSettings.hideBalance
toggleOnClick: false
onClicked: {
persistentSettings.hideBalance = !persistentSettings.hideBalance
appWindow.updateBalance();