GUI: remove now unneeded 'm_balances' field from overviewpage

This commit is contained in:
furszy committed 2022-08-12 13:06:10 -03:00
1 parent 050e8b1391
commit 4584d300a4
2 files changed
+7 -10

No files matched your search

+7 -9
View File
@@ -148,8 +148,6 @@ OverviewPage::OverviewPage(const PlatformStyle *platformStyle, QWidget *parent)
{ {
ui->setupUi(this); ui->setupUi(this);
m_balances.balance = -1;
// use a SingleColorIcon for the "out of sync warning" icon // use a SingleColorIcon for the "out of sync warning" icon
QIcon icon = m_platform_style->SingleColorIcon(QStringLiteral(":/icons/warning")); QIcon icon = m_platform_style->SingleColorIcon(QStringLiteral(":/icons/warning"));
ui->labelTransactionsStatus->setIcon(icon); ui->labelTransactionsStatus->setIcon(icon);
@@ -178,8 +176,9 @@ void OverviewPage::handleTransactionClicked(const QModelIndex &index)
void OverviewPage::setPrivacy(bool privacy) void OverviewPage::setPrivacy(bool privacy)
{ {
m_privacy = privacy; m_privacy = privacy;
if (m_balances.balance != -1) { const auto& balances = walletModel->getCachedBalance();
setBalance(m_balances); if (balances.balance != -1) {
setBalance(balances);
} }
ui->listTransactions->setVisible(!m_privacy); ui->listTransactions->setVisible(!m_privacy);
@@ -198,7 +197,6 @@ OverviewPage::~OverviewPage()
void OverviewPage::setBalance(const interfaces::WalletBalances& balances) void OverviewPage::setBalance(const interfaces::WalletBalances& balances)
{ {
BitcoinUnit unit = walletModel->getOptionsModel()->getDisplayUnit(); BitcoinUnit unit = walletModel->getOptionsModel()->getDisplayUnit();
m_balances = balances;
if (walletModel->wallet().isLegacy()) { if (walletModel->wallet().isLegacy()) {
if (walletModel->wallet().privateKeysDisabled()) { if (walletModel->wallet().privateKeysDisabled()) {
ui->labelBalance->setText(BitcoinUnits::formatWithPrivacy(unit, balances.watch_only_balance, BitcoinUnits::SeparatorStyle::ALWAYS, m_privacy)); ui->labelBalance->setText(BitcoinUnits::formatWithPrivacy(unit, balances.watch_only_balance, BitcoinUnits::SeparatorStyle::ALWAYS, m_privacy));
@@ -306,10 +304,10 @@ void OverviewPage::changeEvent(QEvent* e)
void OverviewPage::updateDisplayUnit() void OverviewPage::updateDisplayUnit()
{ {
if(walletModel && walletModel->getOptionsModel()) if (walletModel && walletModel->getOptionsModel()) {
{ const auto& balances = walletModel->getCachedBalance();
if (m_balances.balance != -1) { if (balances.balance != -1) {
setBalance(m_balances); setBalance(balances);
} }
// Update txdelegate->unit with the current unit // Update txdelegate->unit with the current unit
-1
View File
@@ -52,7 +52,6 @@ private:
Ui::OverviewPage *ui; Ui::OverviewPage *ui;
ClientModel *clientModel; ClientModel *clientModel;
WalletModel *walletModel; WalletModel *walletModel;
interfaces::WalletBalances m_balances;
bool m_privacy{false}; bool m_privacy{false};
const PlatformStyle* m_platform_style; const PlatformStyle* m_platform_style;