|
47 | 47 | #include <QApplication> |
48 | 48 | #include <QButtonGroup> |
49 | 49 | #include <QComboBox> |
| 50 | +#include <QCursor> |
50 | 51 | #include <QDateTime> |
51 | 52 | #include <QDragEnterEvent> |
52 | 53 | #include <QKeySequence> |
@@ -114,6 +115,11 @@ BitcoinGUI::BitcoinGUI(interfaces::Node& node, const NetworkStyle* networkStyle, |
114 | 115 | connect(walletFrame, &WalletFrame::message, [this](const QString& title, const QString& message, unsigned int style) { |
115 | 116 | this->message(title, message, style); |
116 | 117 | }); |
| 118 | + connect(walletFrame, &WalletFrame::createWalletButtonClicked, [this] { |
| 119 | + auto activity = new CreateWalletActivity(getWalletController(), this); |
| 120 | + connect(activity, &CreateWalletActivity::finished, activity, &QObject::deleteLater); |
| 121 | + activity->create(); |
| 122 | + }); |
117 | 123 | } else |
118 | 124 | #endif // ENABLE_WALLET |
119 | 125 | { |
@@ -211,20 +217,13 @@ BitcoinGUI::BitcoinGUI(interfaces::Node& node, const NetworkStyle* networkStyle, |
211 | 217 | // Subscribe to notifications from core |
212 | 218 | subscribeToCoreSignals(); |
213 | 219 |
|
214 | | - // Jump to peers tab by clicking on connections icon |
215 | | - connect(labelConnectionsIcon, &GUIUtil::ClickableLabel::clicked, this, &BitcoinGUI::showPeers); |
216 | 220 | connect(labelProxyIcon, &GUIUtil::ClickableLabel::clicked, [this] { |
217 | 221 | openOptionsDialogWithTab(OptionsDialog::TAB_NETWORK); |
218 | 222 | }); |
219 | 223 |
|
220 | 224 | modalOverlay = new ModalOverlay(enableWallet, this->centralWidget()); |
221 | 225 | connect(labelBlocksIcon, &GUIUtil::ClickableLabel::clicked, this, &BitcoinGUI::showModalOverlay); |
222 | 226 | connect(progressBar, &GUIUtil::ClickableProgressBar::clicked, this, &BitcoinGUI::showModalOverlay); |
223 | | -#ifdef ENABLE_WALLET |
224 | | - if(enableWallet) { |
225 | | - connect(walletFrame, &WalletFrame::requestedSyncWarningInfo, this, &BitcoinGUI::showModalOverlay); |
226 | | - } |
227 | | -#endif |
228 | 227 |
|
229 | 228 | #ifdef Q_OS_MAC |
230 | 229 | m_app_nap_inhibitor = new CAppNapInhibitor; |
@@ -812,8 +811,11 @@ void BitcoinGUI::setClientModel(ClientModel *_clientModel, interfaces::BlockAndH |
812 | 811 | } |
813 | 812 |
|
814 | 813 | // Keep up to date with client |
815 | | - updateNetworkState(); |
| 814 | + setNetworkActive(m_node.getNetworkActive()); |
816 | 815 | setNumConnections(_clientModel->getNumConnections()); |
| 816 | + connect(labelConnectionsIcon, &GUIUtil::ClickableLabel::clicked, [this] { |
| 817 | + GUIUtil::PopupMenu(m_network_context_menu, QCursor::pos()); |
| 818 | + }); |
817 | 819 | connect(_clientModel, &ClientModel::numConnectionsChanged, this, &BitcoinGUI::setNumConnections); |
818 | 820 | connect(_clientModel, &ClientModel::networkActiveChanged, this, &BitcoinGUI::setNetworkActive); |
819 | 821 |
|
@@ -911,13 +913,28 @@ WalletController* BitcoinGUI::getWalletController() |
911 | 913 | void BitcoinGUI::addWallet(WalletModel* walletModel) |
912 | 914 | { |
913 | 915 | if (!walletFrame) return; |
914 | | - if (!walletFrame->addWallet(walletModel)) return; |
| 916 | + |
| 917 | + WalletView* wallet_view = new WalletView(walletFrame); |
| 918 | + if (!walletFrame->addWallet(walletModel, wallet_view)) return; |
| 919 | + |
915 | 920 | rpcConsole->addWallet(walletModel); |
916 | 921 | if (m_wallet_selector->count() == 0) { |
917 | 922 | setWalletActionsEnabled(true); |
918 | 923 | } else if (m_wallet_selector->count() == 1) { |
919 | 924 | m_wallet_selector_action->setVisible(true); |
920 | 925 | } |
| 926 | + |
| 927 | + connect(wallet_view, &WalletView::outOfSyncWarningClicked, this, &BitcoinGUI::showModalOverlay); |
| 928 | + connect(wallet_view, &WalletView::transactionClicked, this, &BitcoinGUI::gotoHistoryPage); |
| 929 | + connect(wallet_view, &WalletView::coinsSent, this, &BitcoinGUI::gotoHistoryPage); |
| 930 | + connect(wallet_view, &WalletView::message, [this](const QString& title, const QString& message, unsigned int style) { |
| 931 | + this->message(title, message, style); |
| 932 | + }); |
| 933 | + connect(wallet_view, &WalletView::encryptionStatusChanged, this, &BitcoinGUI::updateWalletStatus); |
| 934 | + connect(wallet_view, &WalletView::incomingTransaction, this, &BitcoinGUI::incomingTransaction); |
| 935 | + connect(wallet_view, &WalletView::hdEnabledStatusChanged, this, &BitcoinGUI::updateWalletStatus); |
| 936 | + connect(this, &BitcoinGUI::setPrivacy, wallet_view, &WalletView::setPrivacy); |
| 937 | + wallet_view->setPrivacy(isPrivacyModeActivated()); |
921 | 938 | const QString display_name = walletModel->getDisplayName(); |
922 | 939 | m_wallet_selector->addItem(display_name, QVariant::fromValue(walletModel)); |
923 | 940 | } |
@@ -1270,31 +1287,54 @@ void BitcoinGUI::updateNetworkState() |
1270 | 1287 | nCountPrev = count; |
1271 | 1288 | fNetworkActivePrev = fNetworkActive; |
1272 | 1289 |
|
| 1290 | + QString tooltip; |
1273 | 1291 | if (fNetworkActive) { |
1274 | | - labelConnectionsIcon->setToolTip(tr("%n active connection(s) to Dash network", "", count)); |
| 1292 | + //: A substring of the tooltip. |
| 1293 | + tooltip = tr("%n active connection(s) to Dash network", "", count); |
1275 | 1294 | } else { |
1276 | | - labelConnectionsIcon->setToolTip(tr("Network activity disabled")); |
| 1295 | + tooltip = tr("Network activity disabled"); |
1277 | 1296 | icon = "connect_4"; |
1278 | 1297 | color = GUIUtil::ThemedColor::RED; |
1279 | 1298 | } |
1280 | 1299 |
|
| 1300 | + // Don't word-wrap this (fixed-width) tooltip |
| 1301 | + tooltip = QLatin1String("<nobr>") + tooltip + QLatin1String("<br>") + |
| 1302 | + //: A substring of the tooltip. "More actions" are available via the context menu. |
| 1303 | + tr("Click for more actions.") + QLatin1String("</nobr>"); |
| 1304 | + |
1281 | 1305 | if (fNetworkActive && count == 0) { |
1282 | 1306 | startConnectingAnimation(); |
1283 | 1307 | } |
1284 | 1308 | if (!fNetworkActive || count > 0) { |
1285 | 1309 | stopConnectingAnimation(); |
1286 | 1310 | labelConnectionsIcon->setPixmap(GUIUtil::getIcon(icon, color).pixmap(STATUSBAR_ICONSIZE, STATUSBAR_ICONSIZE)); |
1287 | 1311 | } |
| 1312 | + labelConnectionsIcon->setToolTip(tooltip); |
1288 | 1313 | } |
1289 | 1314 |
|
1290 | 1315 | void BitcoinGUI::setNumConnections(int count) |
1291 | 1316 | { |
1292 | 1317 | updateNetworkState(); |
1293 | 1318 | } |
1294 | 1319 |
|
1295 | | -void BitcoinGUI::setNetworkActive(bool networkActive) |
| 1320 | +void BitcoinGUI::setNetworkActive(bool network_active) |
1296 | 1321 | { |
1297 | 1322 | updateNetworkState(); |
| 1323 | + m_network_context_menu->clear(); |
| 1324 | + m_network_context_menu->addAction( |
| 1325 | + //: A context menu item. The "Peers tab" is an element of the "Node window". |
| 1326 | + tr("Show Peers tab"), |
| 1327 | + [this] { |
| 1328 | + rpcConsole->setTabFocus(RPCConsole::TabTypes::PEERS); |
| 1329 | + showDebugWindow(); |
| 1330 | + }); |
| 1331 | + m_network_context_menu->addAction( |
| 1332 | + network_active ? |
| 1333 | + //: A context menu item. |
| 1334 | + tr("Disable network activity") : |
| 1335 | + //: A context menu item. The network activity was disabled previously. |
| 1336 | + tr("Enable network activity"), |
| 1337 | + [this, new_state = !network_active] { m_node.setNetworkActive(new_state); }); |
1298 | 1338 | } |
1299 | 1339 |
|
1300 | 1340 | void BitcoinGUI::updateHeadersSyncProgressLabel() |
|
0 commit comments