[gui] Add proxy icon in statusbar

pull/585/head
Cristian Mircea Messel 7 years ago
parent 13da2899ae
commit 73cd5b25b9

@ -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;

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.2 KiB

@ -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…
Cancel
Save