aboutsummaryrefslogtreecommitdiff
path: root/src/qt/bitcoingui.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/qt/bitcoingui.cpp')
-rw-r--r--src/qt/bitcoingui.cpp37
1 files changed, 24 insertions, 13 deletions
diff --git a/src/qt/bitcoingui.cpp b/src/qt/bitcoingui.cpp
index f3866b507b..fd329faf18 100644
--- a/src/qt/bitcoingui.cpp
+++ b/src/qt/bitcoingui.cpp
@@ -30,16 +30,17 @@
#include <qt/macdockiconhandler.h>
#endif
-#include <functional>
#include <chain.h>
#include <chainparams.h>
+#include <common/system.h>
#include <interfaces/handler.h>
#include <interfaces/node.h>
#include <node/interface_ui.h>
-#include <util/system.h>
#include <util/translation.h>
#include <validation.h>
+#include <functional>
+
#include <QAction>
#include <QActionGroup>
#include <QApplication>
@@ -459,6 +460,7 @@ void BitcoinGUI::createActions()
m_wallet_controller->closeAllWallets(this);
});
connect(m_mask_values_action, &QAction::toggled, this, &BitcoinGUI::setPrivacy);
+ connect(m_mask_values_action, &QAction::toggled, this, &BitcoinGUI::enableHistoryAction);
}
#endif // ENABLE_WALLET
@@ -650,6 +652,8 @@ void BitcoinGUI::setClientModel(ClientModel *_clientModel, interfaces::BlockAndH
// initialize the disable state of the tray icon with the current value in the model.
trayIcon->setVisible(optionsModel->getShowTrayIcon());
}
+
+ m_mask_values_action->setChecked(_clientModel->getOptionsModel()->getOption(OptionsModel::OptionID::MaskValues).toBool());
} else {
if(trayIconMenu)
{
@@ -669,6 +673,12 @@ void BitcoinGUI::setClientModel(ClientModel *_clientModel, interfaces::BlockAndH
}
#ifdef ENABLE_WALLET
+void BitcoinGUI::enableHistoryAction(bool privacy)
+{
+ historyAction->setEnabled(!privacy);
+ if (historyAction->isChecked()) gotoOverviewPage();
+}
+
void BitcoinGUI::setWalletController(WalletController* wallet_controller)
{
assert(!m_wallet_controller);
@@ -683,6 +693,10 @@ void BitcoinGUI::setWalletController(WalletController* wallet_controller)
GUIUtil::ExceptionSafeConnect(wallet_controller, &WalletController::walletAdded, this, &BitcoinGUI::addWallet);
connect(wallet_controller, &WalletController::walletRemoved, this, &BitcoinGUI::removeWallet);
+ connect(wallet_controller, &WalletController::destroyed, this, [this] {
+ // wallet_controller gets destroyed manually, but it leaves our member copy dangling
+ m_wallet_controller = nullptr;
+ });
auto activity = new LoadWalletsActivity(m_wallet_controller, this);
activity->load();
@@ -695,7 +709,7 @@ WalletController* BitcoinGUI::getWalletController()
void BitcoinGUI::addWallet(WalletModel* walletModel)
{
- if (!walletFrame) return;
+ if (!walletFrame || !m_wallet_controller) return;
WalletView* wallet_view = new WalletView(walletModel, platformStyle, walletFrame);
if (!walletFrame->addView(wallet_view)) return;
@@ -717,7 +731,9 @@ void BitcoinGUI::addWallet(WalletModel* walletModel)
connect(wallet_view, &WalletView::encryptionStatusChanged, this, &BitcoinGUI::updateWalletStatus);
connect(wallet_view, &WalletView::incomingTransaction, this, &BitcoinGUI::incomingTransaction);
connect(this, &BitcoinGUI::setPrivacy, wallet_view, &WalletView::setPrivacy);
- wallet_view->setPrivacy(isPrivacyModeActivated());
+ const bool privacy = isPrivacyModeActivated();
+ wallet_view->setPrivacy(privacy);
+ enableHistoryAction(privacy);
const QString display_name = walletModel->getDisplayName();
m_wallet_selector->addItem(display_name, QVariant::fromValue(walletModel));
}
@@ -745,7 +761,7 @@ void BitcoinGUI::removeWallet(WalletModel* walletModel)
void BitcoinGUI::setCurrentWallet(WalletModel* wallet_model)
{
- if (!walletFrame) return;
+ if (!walletFrame || !m_wallet_controller) return;
walletFrame->setCurrentWallet(wallet_model);
for (int index = 0; index < m_wallet_selector->count(); ++index) {
if (m_wallet_selector->itemData(index).value<WalletModel*>() == wallet_model) {
@@ -1074,7 +1090,7 @@ void BitcoinGUI::setNumBlocks(int count, const QDateTime& blockDate, double nVer
statusBar()->clearMessage();
// Acquire current block source
- enum BlockSource blockSource = clientModel->getBlockSource();
+ BlockSource blockSource{clientModel->getBlockSource()};
switch (blockSource) {
case BlockSource::NETWORK:
if (synctype == SyncType::HEADER_PRESYNC) {
@@ -1094,9 +1110,6 @@ void BitcoinGUI::setNumBlocks(int count, const QDateTime& blockDate, double nVer
progressBarLabel->setText(tr("Processing blocks on disk…"));
}
break;
- case BlockSource::REINDEX:
- progressBarLabel->setText(tr("Reindexing blocks on disk…"));
- break;
case BlockSource::NONE:
if (synctype != SyncType::BLOCK_SYNC) {
return;
@@ -1544,10 +1557,8 @@ bool BitcoinGUI::isPrivacyModeActivated() const
return m_mask_values_action->isChecked();
}
-UnitDisplayStatusBarControl::UnitDisplayStatusBarControl(const PlatformStyle *platformStyle)
- : optionsModel(nullptr),
- menu(nullptr),
- m_platform_style{platformStyle}
+UnitDisplayStatusBarControl::UnitDisplayStatusBarControl(const PlatformStyle* platformStyle)
+ : m_platform_style{platformStyle}
{
createContextMenu();
setToolTip(tr("Unit to show amounts in. Click to select another unit."));