aboutsummaryrefslogtreecommitdiff
path: root/src/qt/bitcoingui.cpp
diff options
context:
space:
mode:
authorWladimir J. van der Laan <laanwj@gmail.com>2016-11-24 14:26:20 +0100
committerWladimir J. van der Laan <laanwj@gmail.com>2016-11-24 14:35:03 +0100
commit827d9a3be8209587c532f061753e99730b9be4c4 (patch)
tree95ef51b6773b4d9f2ef8b2ff999188bd96632a9c /src/qt/bitcoingui.cpp
parentbc121b0eb19713ec72002b5be03ba5ac35903a17 (diff)
qt: Replace NetworkToggleStatusBarControl with generic ClickableLabel
Generalize the clickable label functionality. We will use this to add similar functionality to the sync icon.
Diffstat (limited to 'src/qt/bitcoingui.cpp')
-rw-r--r--src/qt/bitcoingui.cpp26
1 files changed, 10 insertions, 16 deletions
diff --git a/src/qt/bitcoingui.cpp b/src/qt/bitcoingui.cpp
index 6112a1d256..0f046f30e9 100644
--- a/src/qt/bitcoingui.cpp
+++ b/src/qt/bitcoingui.cpp
@@ -199,7 +199,7 @@ BitcoinGUI::BitcoinGUI(const PlatformStyle *_platformStyle, const NetworkStyle *
unitDisplayControl = new UnitDisplayStatusBarControl(platformStyle);
labelWalletEncryptionIcon = new QLabel();
labelWalletHDStatusIcon = new QLabel();
- connectionsControl = new NetworkToggleStatusBarControl();
+ connectionsControl = new GUIUtil::ClickableLabel();
labelBlocksIcon = new QLabel();
if(enableWallet)
{
@@ -244,6 +244,8 @@ BitcoinGUI::BitcoinGUI(const PlatformStyle *_platformStyle, const NetworkStyle *
// Subscribe to notifications from core
subscribeToCoreSignals();
+ connect(connectionsControl, SIGNAL(clicked(QPoint)), this, SLOT(toggleNetworkActive()));
+
modalOverlay = new ModalOverlay(this->centralWidget());
#ifdef ENABLE_WALLET
if(enableWallet)
@@ -490,7 +492,6 @@ void BitcoinGUI::setClientModel(ClientModel *_clientModel)
}
#endif // ENABLE_WALLET
unitDisplayControl->setOptionsModel(_clientModel->getOptionsModel());
- connectionsControl->setClientModel(_clientModel);
OptionsModel* optionsModel = _clientModel->getOptionsModel();
if(optionsModel)
@@ -517,7 +518,6 @@ void BitcoinGUI::setClientModel(ClientModel *_clientModel)
walletFrame->setClientModel(nullptr);
#endif // ENABLE_WALLET
unitDisplayControl->setOptionsModel(nullptr);
- connectionsControl->setClientModel(nullptr);
}
}
@@ -1171,6 +1171,13 @@ void BitcoinGUI::unsubscribeFromCoreSignals()
uiInterface.ThreadSafeQuestion.disconnect(boost::bind(ThreadSafeMessageBox, this, _1, _3, _4));
}
+void BitcoinGUI::toggleNetworkActive()
+{
+ if (clientModel) {
+ clientModel->setNetworkActive(!clientModel->getNetworkActive());
+ }
+}
+
UnitDisplayStatusBarControl::UnitDisplayStatusBarControl(const PlatformStyle *platformStyle) :
optionsModel(0),
menu(0)
@@ -1244,16 +1251,3 @@ void UnitDisplayStatusBarControl::onMenuSelection(QAction* action)
optionsModel->setDisplayUnit(action->data());
}
}
-
-void NetworkToggleStatusBarControl::mousePressEvent(QMouseEvent *event)
-{
- if (clientModel) {
- clientModel->setNetworkActive(!clientModel->getNetworkActive());
- }
-}
-
-/** Lets the control know about the Client Model */
-void NetworkToggleStatusBarControl::setClientModel(ClientModel *_clientModel)
-{
- this->clientModel = _clientModel;
-}