diff options
Diffstat (limited to 'src/qt/bitcoingui.cpp')
-rw-r--r-- | src/qt/bitcoingui.cpp | 26 |
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; -} |