Settings: add hide balance feature

master
tobtoht 4 years ago
parent 4f9e4ac93d
commit 62ad0d9527

@ -660,10 +660,18 @@ void MainWindow::onWalletOpened() {
void MainWindow::onBalanceUpdated(double balance, double unlocked, const QString &balance_str, const QString &unlocked_str) {
qDebug() << Q_FUNC_INFO;
bool hide = config()->get(Config::hideBalance).toBool();
auto label_str = QString("Balance: %1 XMR").arg(unlocked_str);
if(balance > unlocked)
label_str += QString(" (+%1 XMR unconfirmed)").arg(QString::number(balance - unlocked, 'f'));
if (hide) {
label_str = "Balance: HIDDEN";
}
m_statusLabelBalance->setText(label_str);
m_balanceWidget->setHidden(hide);
}
void MainWindow::onSynchronized() {

@ -22,6 +22,11 @@ Settings::Settings(QWidget *parent) :
connect(ui->btnCopyToClipboard, &QPushButton::clicked, this, &Settings::copyToClipboard);
connect(ui->checkBox_checkForAppUpdates, &QCheckBox::clicked, this, &Settings::checkboxExternalLinkWarn);
connect(ui->checkBox_externalLink, &QCheckBox::clicked, this, &Settings::checkboxExternalLinkWarn);
connect(ui->checkBox_hideBalance, &QCheckBox::toggled, [this](bool toggled){
config()->set(Config::hideBalance, toggled);
m_ctx->updateBalance();
});
connect(ui->closeButton, &QDialogButtonBox::accepted, this, &Settings::close);
// nodes
@ -32,6 +37,7 @@ Settings::Settings(QWidget *parent) :
// setup checkboxes
ui->checkBox_externalLink->setChecked(config()->get(Config::warnOnExternalLink).toBool());
ui->checkBox_checkForAppUpdates->setChecked(config()->get(Config::checkForAppUpdates).toBool());
ui->checkBox_hideBalance->setChecked(config()->get(Config::hideBalance).toBool());
// setup comboboxes
auto settingsHomeWidget = config()->get(Config::homeWidget).toString();

@ -7,7 +7,7 @@
<x>0</x>
<y>0</y>
<width>1019</width>
<height>358</height>
<height>396</height>
</rect>
</property>
<property name="windowTitle">
@ -196,6 +196,13 @@
</property>
</widget>
</item>
<item row="6" column="0">
<widget class="QCheckBox" name="checkBox_hideBalance">
<property name="text">
<string>Hide balance</string>
</property>
</widget>
</item>
</layout>
</widget>
<widget class="QWidget" name="tab_node">

@ -47,6 +47,7 @@ static const QHash<Config::ConfigKey, ConfigDirective> configStrings = {
{Config::geometry, {QS("geometry"), {}}},
{Config::windowState, {QS("windowState"), {}}},
{Config::firstRun,{QS("firstRun"), false}},
{Config::hideBalance, {QS("hideBalance"), false}}
};

@ -44,7 +44,8 @@ public:
showTabXMRig,
geometry,
windowState,
firstRun
firstRun,
hideBalance
};
~Config() override;

Loading…
Cancel
Save