mirror of
https://github.com/bitcoin/bitcoin.git
synced 2024-11-20 10:38:42 +01:00
Merge #11491: [gui] Add proxy icon in statusbar
73cd5b25b
[gui] Add proxy icon in statusbar (Cristian Mircea Messel)
Pull request description:
Relates to #7734
![image](https://user-images.githubusercontent.com/226170/33406640-8ea700c6-d576-11e7-9d69-fde9a696c219.png)
Please ignore the wrong alpha in the screenshot, I couldn't get the screenshot alpha right :(
I plan to extend this feature in future PRs to include:
- custom Tor icon
- clickable icon which opens network settings
Old proposals, dropped in favor of current
![image](https://user-images.githubusercontent.com/226170/32688635-979ef690-c6dd-11e7-8869-49da7e0f0a11.png)
![proxy_preview](https://user-images.githubusercontent.com/226170/31521305-99c43f22-afb1-11e7-9daf-d1ed6347daa8.png)
![image](https://user-images.githubusercontent.com/226170/31680585-72706098-b37d-11e7-88ad-028c4c723f42.png)
Tree-SHA512: e5f18c20c0be292256a3e78c91cdf390a3b6084346a192a8170460f706f5b6cd198ba5b0035798a85a442fe7f262cf1c2350064670085ff8f473f880ab5ba589
This commit is contained in:
commit
40c34a0a29
@ -76,8 +76,8 @@ Comment:
|
||||
|
||||
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
|
||||
@ -93,6 +93,11 @@ Copyright: Bitboy, Jonas Schnelli
|
||||
License: public-domain
|
||||
Comment: Site: https://bitcointalk.org/?topic=1756.0
|
||||
|
||||
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
|
||||
|
@ -278,6 +278,7 @@ RES_ICONS = \
|
||||
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 \
|
||||
|
@ -53,6 +53,7 @@
|
||||
<file alias="hd_enabled">res/icons/hd_enabled.png</file>
|
||||
<file alias="hd_disabled">res/icons/hd_disabled.png</file>
|
||||
<file alias="network_disabled">res/icons/network_disabled.png</file>
|
||||
<file alias="proxy">res/icons/proxy.png</file>
|
||||
</qresource>
|
||||
<qresource prefix="/movies">
|
||||
<file alias="spinner-000">res/movies/spinner-000.png</file>
|
||||
|
@ -83,6 +83,7 @@ BitcoinGUI::BitcoinGUI(interfaces::Node& node, const PlatformStyle *_platformSty
|
||||
unitDisplayControl(0),
|
||||
labelWalletEncryptionIcon(0),
|
||||
labelWalletHDStatusIcon(0),
|
||||
labelProxyIcon(0),
|
||||
connectionsControl(0),
|
||||
labelBlocksIcon(0),
|
||||
progressBarLabel(0),
|
||||
@ -201,6 +202,7 @@ BitcoinGUI::BitcoinGUI(interfaces::Node& node, const PlatformStyle *_platformSty
|
||||
unitDisplayControl = new UnitDisplayStatusBarControl(platformStyle);
|
||||
labelWalletEncryptionIcon = new QLabel();
|
||||
labelWalletHDStatusIcon = new QLabel();
|
||||
labelProxyIcon = new QLabel();
|
||||
connectionsControl = new GUIUtil::ClickableLabel();
|
||||
labelBlocksIcon = new GUIUtil::ClickableLabel();
|
||||
if(enableWallet)
|
||||
@ -211,6 +213,7 @@ BitcoinGUI::BitcoinGUI(interfaces::Node& node, const PlatformStyle *_platformSty
|
||||
frameBlocksLayout->addWidget(labelWalletEncryptionIcon);
|
||||
frameBlocksLayout->addWidget(labelWalletHDStatusIcon);
|
||||
}
|
||||
frameBlocksLayout->addWidget(labelProxyIcon);
|
||||
frameBlocksLayout->addStretch();
|
||||
frameBlocksLayout->addWidget(connectionsControl);
|
||||
frameBlocksLayout->addStretch();
|
||||
@ -503,6 +506,9 @@ void BitcoinGUI::setClientModel(ClientModel *_clientModel)
|
||||
connect(_clientModel, SIGNAL(showProgress(QString,int)), this, SLOT(showProgress(QString,int)));
|
||||
|
||||
rpcConsole->setClientModel(_clientModel);
|
||||
|
||||
updateProxyIcon();
|
||||
|
||||
#ifdef ENABLE_WALLET
|
||||
if(walletFrame)
|
||||
{
|
||||
@ -1125,6 +1131,24 @@ void BitcoinGUI::updateWalletStatus()
|
||||
}
|
||||
#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 <b>enabled</b>: %1").arg(ip_port_q));
|
||||
} else {
|
||||
labelProxyIcon->show();
|
||||
}
|
||||
} else {
|
||||
labelProxyIcon->hide();
|
||||
}
|
||||
}
|
||||
|
||||
void BitcoinGUI::showNormalIfMinimized(bool fToggleHidden)
|
||||
{
|
||||
if(!clientModel)
|
||||
|
@ -92,6 +92,7 @@ private:
|
||||
UnitDisplayStatusBarControl *unitDisplayControl;
|
||||
QLabel *labelWalletEncryptionIcon;
|
||||
QLabel *labelWalletHDStatusIcon;
|
||||
QLabel *labelProxyIcon;
|
||||
QLabel *connectionsControl;
|
||||
QLabel *labelBlocksIcon;
|
||||
QLabel *progressBarLabel;
|
||||
@ -209,6 +210,10 @@ public Q_SLOTS:
|
||||
void incomingTransaction(const QString& date, int unit, const CAmount& amount, const QString& type, const QString& address, 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 */
|
||||
|
@ -17,6 +17,7 @@
|
||||
#include <interfaces/node.h>
|
||||
#include <validation.h>
|
||||
#include <net.h>
|
||||
#include <netbase.h>
|
||||
#include <txmempool.h>
|
||||
#include <ui_interface.h>
|
||||
#include <util.h>
|
||||
@ -268,3 +269,13 @@ void ClientModel::unsubscribeFromCoreSignals()
|
||||
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;
|
||||
}
|
||||
|
@ -70,6 +70,8 @@ public:
|
||||
QString formatClientStartupTime() const;
|
||||
QString dataDir() const;
|
||||
|
||||
bool getProxyInfo(std::string& ip_port) const;
|
||||
|
||||
// caches for the best header
|
||||
mutable std::atomic<int> cachedBestHeaderHeight;
|
||||
mutable std::atomic<int64_t> cachedBestHeaderTime;
|
||||
|
BIN
src/qt/res/icons/proxy.png
Normal file
BIN
src/qt/res/icons/proxy.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 1.2 KiB |
70
src/qt/res/src/proxy.svg
Normal file
70
src/qt/res/src/proxy.svg
Normal file
@ -0,0 +1,70 @@
|
||||
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
|
||||
<!-- Created with Inkscape (http://www.inkscape.org/) -->
|
||||
|
||||
<svg
|
||||
xmlns:dc="http://purl.org/dc/elements/1.1/"
|
||||
xmlns:cc="http://creativecommons.org/ns#"
|
||||
xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
|
||||
xmlns:svg="http://www.w3.org/2000/svg"
|
||||
xmlns="http://www.w3.org/2000/svg"
|
||||
xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
|
||||
xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
|
||||
width="128px"
|
||||
height="128px"
|
||||
id="svg2991"
|
||||
version="1.1"
|
||||
inkscape:version="0.48.4 r9939"
|
||||
sodipodi:docname="proxy.svg"
|
||||
inkscape:export-xdpi="90"
|
||||
inkscape:export-ydpi="90">
|
||||
<defs
|
||||
id="defs2993" />
|
||||
<sodipodi:namedview
|
||||
id="base"
|
||||
pagecolor="#ffffff"
|
||||
bordercolor="#666666"
|
||||
borderopacity="1.0"
|
||||
inkscape:pageopacity="0.0"
|
||||
inkscape:pageshadow="2"
|
||||
inkscape:zoom="3.8890872"
|
||||
inkscape:cx="4.0410731"
|
||||
inkscape:cy="31.916897"
|
||||
inkscape:current-layer="layer1"
|
||||
showgrid="true"
|
||||
inkscape:document-units="px"
|
||||
inkscape:grid-bbox="true"
|
||||
inkscape:window-width="1920"
|
||||
inkscape:window-height="1056"
|
||||
inkscape:window-x="0"
|
||||
inkscape:window-y="24"
|
||||
inkscape:window-maximized="1" />
|
||||
<metadata
|
||||
id="metadata2996">
|
||||
<rdf:RDF>
|
||||
<cc:Work
|
||||
rdf:about="">
|
||||
<dc:format>image/svg+xml</dc:format>
|
||||
<dc:type
|
||||
rdf:resource="http://purl.org/dc/dcmitype/StillImage" />
|
||||
<dc:title></dc:title>
|
||||
</cc:Work>
|
||||
</rdf:RDF>
|
||||
</metadata>
|
||||
<g
|
||||
id="layer1"
|
||||
inkscape:label="Layer 1"
|
||||
inkscape:groupmode="layer">
|
||||
<text
|
||||
xml:space="preserve"
|
||||
style="font-size:40px;font-style:normal;font-weight:normal;line-height:125%;letter-spacing:0px;word-spacing:0px;fill:#000000;fill-opacity:1;stroke:none;font-family:Sans"
|
||||
x="26.981934"
|
||||
y="110.45972"
|
||||
id="text2999"
|
||||
sodipodi:linespacing="125%"><tspan
|
||||
sodipodi:role="line"
|
||||
id="tspan3001"
|
||||
x="26.981934"
|
||||
y="110.45972"
|
||||
style="font-size:111px">P</tspan></text>
|
||||
</g>
|
||||
</svg>
|
After Width: | Height: | Size: 2.1 KiB |
Loading…
Reference in New Issue
Block a user