diff --git a/contrib/debian/copyright b/contrib/debian/copyright --- a/contrib/debian/copyright +++ b/contrib/debian/copyright @@ -79,8 +79,8 @@ Files: src/qt/res/icons/clock*.png src/qt/res/icons/eye_*.png - src/qt/res/icons/verify.png src/qt/res/icons/tx_in*.png + src/qt/res/icons/verify.png src/qt/res/src/clock_*.svg src/qt/res/src/tx_*.svg src/qt/res/src/verify.svg @@ -99,6 +99,12 @@ License: public-domain Copyright: bitcoincash.org, bitcoinabc.org +Files: src/qt/res/icons/proxy.png + src/qt/res/src/proxy.svg +Copyright: Cristian Mircea Messel +Licese: public-domain + + License: Expat Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the diff --git a/src/Makefile.qt.include b/src/Makefile.qt.include --- a/src/Makefile.qt.include +++ b/src/Makefile.qt.include @@ -275,6 +275,7 @@ qt/res/icons/network_disabled.png \ qt/res/icons/open.png \ qt/res/icons/overview.png \ + qt/res/icons/proxy.png \ qt/res/icons/quit.png \ qt/res/icons/receive.png \ qt/res/icons/remove.png \ diff --git a/src/qt/bitcoin.qrc b/src/qt/bitcoin.qrc --- a/src/qt/bitcoin.qrc +++ b/src/qt/bitcoin.qrc @@ -53,6 +53,7 @@ res/icons/hd_enabled.png res/icons/hd_disabled.png res/icons/network_disabled.png + res/icons/proxy.png res/movies/spinner-000.png diff --git a/src/qt/bitcoingui.h b/src/qt/bitcoingui.h --- a/src/qt/bitcoingui.h +++ b/src/qt/bitcoingui.h @@ -100,6 +100,7 @@ UnitDisplayStatusBarControl *unitDisplayControl = nullptr; QLabel *labelWalletEncryptionIcon = nullptr; QLabel *labelWalletHDStatusIcon = nullptr; + QLabel *labelProxyIcon = nullptr; QLabel *connectionsControl = nullptr; QLabel *labelBlocksIcon = nullptr; QLabel *progressBarLabel = nullptr; @@ -228,6 +229,10 @@ const QString &label, const QString &walletName); #endif // ENABLE_WALLET +private: + /** Set the proxy-enabled icon as shown in the UI. */ + void updateProxyIcon(); + private Q_SLOTS: #ifdef ENABLE_WALLET /** Switch to overview (home) page */ diff --git a/src/qt/bitcoingui.cpp b/src/qt/bitcoingui.cpp --- a/src/qt/bitcoingui.cpp +++ b/src/qt/bitcoingui.cpp @@ -148,6 +148,7 @@ unitDisplayControl = new UnitDisplayStatusBarControl(platformStyle); labelWalletEncryptionIcon = new QLabel(); labelWalletHDStatusIcon = new QLabel(); + labelProxyIcon = new QLabel(); connectionsControl = new GUIUtil::ClickableLabel(); labelBlocksIcon = new GUIUtil::ClickableLabel(); if (enableWallet) { @@ -157,6 +158,7 @@ frameBlocksLayout->addWidget(labelWalletEncryptionIcon); frameBlocksLayout->addWidget(labelWalletHDStatusIcon); } + frameBlocksLayout->addWidget(labelProxyIcon); frameBlocksLayout->addStretch(); frameBlocksLayout->addWidget(connectionsControl); frameBlocksLayout->addStretch(); @@ -553,6 +555,9 @@ SLOT(showProgress(QString, int))); rpcConsole->setClientModel(_clientModel); + + updateProxyIcon(); + #ifdef ENABLE_WALLET if (walletFrame) { walletFrame->setClientModel(_clientModel); @@ -1198,6 +1203,26 @@ } #endif // ENABLE_WALLET +void BitcoinGUI::updateProxyIcon() { + std::string ip_port; + bool proxy_enabled = clientModel->getProxyInfo(ip_port); + + if (proxy_enabled) { + if (labelProxyIcon->pixmap() == 0) { + QString ip_port_q = QString::fromStdString(ip_port); + labelProxyIcon->setPixmap( + platformStyle->SingleColorIcon(":/icons/proxy") + .pixmap(STATUSBAR_ICONSIZE, STATUSBAR_ICONSIZE)); + labelProxyIcon->setToolTip( + tr("Proxy is enabled: %1").arg(ip_port_q)); + } else { + labelProxyIcon->show(); + } + } else { + labelProxyIcon->hide(); + } +} + void BitcoinGUI::showNormalIfMinimized(bool fToggleHidden) { if (!clientModel) { return; diff --git a/src/qt/clientmodel.h b/src/qt/clientmodel.h --- a/src/qt/clientmodel.h +++ b/src/qt/clientmodel.h @@ -66,6 +66,8 @@ QString dataDir() const; QString blocksDir() const; + bool getProxyInfo(std::string &ip_port) const; + // caches for the best header mutable std::atomic cachedBestHeaderHeight; mutable std::atomic cachedBestHeaderTime; diff --git a/src/qt/clientmodel.cpp b/src/qt/clientmodel.cpp --- a/src/qt/clientmodel.cpp +++ b/src/qt/clientmodel.cpp @@ -12,6 +12,7 @@ #include #include #include +#include #include #include #include @@ -264,3 +265,13 @@ m_handler_notify_block_tip->disconnect(); m_handler_notify_header_tip->disconnect(); } + +bool ClientModel::getProxyInfo(std::string &ip_port) const { + proxyType ipv4, ipv6; + if (m_node.getProxy((Network)1, ipv4) && + m_node.getProxy((Network)2, ipv6)) { + ip_port = ipv4.proxy.ToStringIPPort(); + return true; + } + return false; +} diff --git a/src/qt/res/icons/proxy.png b/src/qt/res/icons/proxy.png new file mode 100644 index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 GIT binary patch literal 0 Hc$@ + + + + + + + + + image/svg+xml + + + + + + + P + +