Skip to content

Commit a5bb944

Browse files
committed
Replace png icons with svg for status bar
Also add beacons status icons and begin implementation of beacon status.
1 parent f9d73b2 commit a5bb944

33 files changed

+1364
-44
lines changed

src/Makefile.qt.include

Lines changed: 18 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -230,7 +230,10 @@ GRIDCOINRESEARCH_QT_CPP = \
230230

231231
RES_ICONS = \
232232
qt/res/icons/add.png \
233-
qt/res/icons/gridcoin.ico \
233+
qt/res/icons/beacon_grey.svg \
234+
qt/res/icons/beacon_red.svg \
235+
qt/res/icons/beacon_yellow.svg \
236+
qt/res/icons/beacon_green.svg \
234237
qt/res/icons/bitcoin_testnet.ico \
235238
qt/res/icons/block.png \
236239
qt/res/icons/chat.png \
@@ -240,46 +243,49 @@ RES_ICONS = \
240243
qt/res/icons/clock4.png \
241244
qt/res/icons/clock5.png \
242245
qt/res/icons/configure.png \
243-
qt/res/icons/connect0_16.png \
244-
qt/res/icons/connect1_16.png \
245-
qt/res/icons/connect2_16.png \
246-
qt/res/icons/connect3_16.png \
247-
qt/res/icons/connect4_16.png \
246+
qt/res/icons/connect0.svg \
247+
qt/res/icons/connect1.svg \
248+
qt/res/icons/connect2.svg \
249+
qt/res/icons/connect3.svg \
250+
qt/res/icons/connect4.svg \
248251
qt/res/icons/debugwindow.png \
249252
qt/res/icons/edit.png \
250253
qt/res/icons/editcopy.png \
251254
qt/res/icons/editpaste.png \
252255
qt/res/icons/ex.png \
253256
qt/res/icons/export.png \
254257
qt/res/icons/filesave.png \
258+
qt/res/icons/gray_scraper.svg \
259+
qt/res/icons/green_scraper.svg \
260+
qt/res/icons/gridcoin.ico \
255261
qt/res/icons/gold_cpumined.gif \
256262
qt/res/icons/key.png \
263+
qt/res/icons/notsynced.svg \
257264
qt/res/icons/overview2.png \
258265
qt/res/icons/qrcode.png \
259266
qt/res/icons/quit.png \
260267
qt/res/icons/remove.png \
261268
qt/res/icons/rsz_chat.png \
262-
qt/res/icons/staking_off.png \
263-
qt/res/icons/staking_on.png \
269+
qt/res/icons/staking_off.svg \
270+
qt/res/icons/staking_on.svg \
264271
qt/res/icons/statistics.png \
265-
qt/res/icons/notsynced.png \
266-
qt/res/icons/synced.png \
267272
qt/res/icons/toolbar.png \
268273
qt/res/icons/transaction0.png \
269274
qt/res/icons/transaction2.png \
270275
qt/res/icons/transaction_conflicted.png \
271276
qt/res/icons/tx2.png \
272277
qt/res/icons/2tx_cpumined.png \
273278
qt/res/icons/tx_minedoie_WOEI3ooIzGHI.png \
274-
qt/res/icons/www.png \
275-
qt/res/icons/wwww.png \
276279
qt/res/icons/tx_inout.svg \
277280
qt/res/icons/tx_input.svg \
278281
qt/res/icons/tx_mined.svg \
279282
qt/res/icons/tx_output.svg \
280283
qt/res/icons/tx_por.svg \
281284
qt/res/icons/tx_mined_ss.svg \
282285
qt/res/icons/tx_por_ss.svg \
286+
qt/res/icons/www.png \
287+
qt/res/icons/wwww.png \
288+
qt/res/icons/x.svg \
283289
qt/res/icons/icons_native/overview.svg \
284290
qt/res/icons/icons_light/overview.svg \
285291
qt/res/icons/icons_dark/overview.svg \

src/qt/bitcoin.qrc

Lines changed: 16 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,6 @@
11
<RCC>
22
<qresource prefix="/icons">
33
<file alias="quit">res/icons/quit.png</file>
4-
<file alias="connect_0">res/icons/connect0_16.png</file>
5-
<file alias="connect_1">res/icons/connect1_16.png</file>
6-
<file alias="connect_2">res/icons/connect2_16.png</file>
7-
<file alias="connect_3">res/icons/connect3_16.png</file>
8-
<file alias="connect_4">res/icons/connect4_16.png</file>
94
<file alias="transaction_0">res/icons/transaction0.png</file>
105
<file alias="transaction_confirmed">res/icons/transaction2.png</file>
116
<file alias="transaction_conflicted">res/icons/transaction_conflicted.png</file>
@@ -20,14 +15,11 @@
2015
<file alias="add">res/icons/add.png</file>
2116
<file alias="edit">res/icons/edit.png</file>
2217
<file alias="export">res/icons/export.png</file>
23-
<file alias="synced">res/icons/synced.png</file>
2418
<file alias="remove">res/icons/remove.png</file>
2519
<file alias="key">res/icons/key.png</file>
2620
<file alias="filesave">res/icons/filesave.png</file>
2721
<file alias="qrcode">res/icons/qrcode.png</file>
2822
<file alias="debugwindow">res/icons/debugwindow.png</file>
29-
<file alias="staking_off">res/icons/staking_off.png</file>
30-
<file alias="staking_on">res/icons/staking_on.png</file>
3123
<file alias="block">res/icons/block.png</file>
3224
<file alias="ex">res/icons/ex.png</file>
3325
<file alias="www">res/icons/www.png</file>
@@ -63,7 +55,22 @@
6355
<file alias="tx_mined_ss">res/icons/tx_mined_ss.svg</file>
6456
<file alias="tx_cpumined">res/icons/tx_por.svg</file>
6557
<file alias="tx_cpumined_ss">res/icons/tx_por_ss.svg</file>
66-
<file alias="notsynced">res/icons/notsynced.png</file>
58+
<file alias="beacon_green">res/icons/beacon_green.svg</file>
59+
<file alias="beacon_grey">res/icons/beacon_grey.svg</file>
60+
<file alias="beacon_red">res/icons/beacon_red.svg</file>
61+
<file alias="beacon_yellow">res/icons/beacon_yellow.svg</file>
62+
<file alias="staking_off">res/icons/staking_off.svg</file>
63+
<file alias="staking_on">res/icons/staking_on.svg</file>
64+
<file alias="gray_scraper">res/icons/gray_scraper.svg</file>
65+
<file alias="green_scraper">res/icons/green_scraper.svg</file>
66+
<file alias="connect_0">res/icons/connect0.svg</file>
67+
<file alias="connect_1">res/icons/connect1.svg</file>
68+
<file alias="connect_2">res/icons/connect2.svg</file>
69+
<file alias="connect_3">res/icons/connect3.svg</file>
70+
<file alias="connect_4">res/icons/connect4.svg</file>
71+
<file alias="notsynced">res/icons/notsynced.svg</file>
72+
<file alias="white_and_red_x">res/icons/x.svg</file>
73+
<file alias="synced">res/icons/green_check.svg</file>
6774
</qresource>
6875
<qresource prefix="/images">
6976
<file alias="splash">res/images/splash3.png</file>

src/qt/bitcoingui.cpp

Lines changed: 39 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -453,12 +453,12 @@ void BitcoinGUI::createToolBars()
453453
// "Tabs" toolbar (vertical, aligned on left side of overview screen).
454454
QToolBar *toolbar = addToolBar("Tabs toolbar");
455455
toolbar->setObjectName("toolbar");
456-
addToolBar(Qt::LeftToolBarArea,toolbar);
456+
addToolBar(Qt::LeftToolBarArea, toolbar);
457457
toolbar->setOrientation(Qt::Vertical);
458-
toolbar->setMovable( false );
458+
toolbar->setMovable(false);
459459
toolbar->setToolButtonStyle(Qt::ToolButtonTextUnderIcon);
460460
toolbar->setContextMenuPolicy(Qt::PreventContextMenu);
461-
toolbar->setIconSize(QSize(50,25));
461+
toolbar->setIconSize(QSize(50, 25));
462462
toolbar->addAction(overviewAction);
463463
toolbar->addAction(sendCoinsAction);
464464
toolbar->addAction(receiveCoinsAction);
@@ -474,10 +474,23 @@ void BitcoinGUI::createToolBars()
474474
toolbar->addAction(unlockWalletAction);
475475
toolbar->addAction(lockWalletAction);
476476

477-
// Status bar notification icons
477+
addToolBarBreak(Qt::LeftToolBarArea);
478+
479+
480+
// Status bar notification icons (Status toolbar)
481+
QToolBar *toolbar2 = addToolBar("Status toolbar");
482+
addToolBar(Qt::LeftToolBarArea, toolbar2);
483+
toolbar2->setOrientation(Qt::Vertical);
484+
//toolbar2->setGeometry(0, 0, STATUSBAR_ICONSIZE, 0);
485+
toolbar2->setMinimumWidth(STATUSBAR_ICONSIZE);
486+
toolbar2->setContentsMargins(0, 0, 0, 0);
487+
toolbar2->setMovable(false);
488+
toolbar2->setObjectName("toolbar2");
489+
478490
QFrame *frameBlocks = new QFrame();
479491

480492
frameBlocks->setContentsMargins(0,0,0,0);
493+
frameBlocks->setMinimumWidth(STATUSBAR_ICONSIZE);
481494

482495
QVBoxLayout *frameBlocksLayout = new QVBoxLayout(frameBlocks);
483496
frameBlocksLayout->setContentsMargins(1,0,1,0);
@@ -487,14 +500,16 @@ void BitcoinGUI::createToolBars()
487500
labelConnectionsIcon = new QLabel();
488501
labelBlocksIcon = new QLabel();
489502
labelScraperIcon = new QLabel();
503+
labelBeaconIcon = new QLabel();
490504

491505
frameBlocksLayout->addWidget(labelEncryptionIcon);
492506
frameBlocksLayout->addWidget(labelStakingIcon);
493507
frameBlocksLayout->addWidget(labelConnectionsIcon);
494508
frameBlocksLayout->addWidget(labelBlocksIcon);
495509
frameBlocksLayout->addWidget(labelScraperIcon);
496-
//12-21-2015 Prevent Lock from falling off the page
510+
frameBlocksLayout->addWidget(labelBeaconIcon);
497511

512+
//12-21-2015 Prevent Lock from falling off the page
498513
frameBlocksLayout->addStretch();
499514

500515
if (GetBoolArg("-staking", true))
@@ -505,22 +520,21 @@ void BitcoinGUI::createToolBars()
505520
updateStakingIcon();
506521
}
507522

508-
frameBlocks->setObjectName("frame");
509-
addToolBarBreak(Qt::LeftToolBarArea);
510-
QToolBar *toolbar2 = addToolBar("Tabs toolbar");
511-
addToolBar(Qt::LeftToolBarArea,toolbar2);
512-
toolbar2->setOrientation(Qt::Vertical);
513-
toolbar2->setMovable( false );
514-
toolbar2->setObjectName("toolbar2");
523+
QTimer *timerBeaconIcon = new QTimer(labelBeaconIcon);
524+
connect(timerBeaconIcon, SIGNAL(timeout()), this, SLOT(updateBeaconIcon()));
525+
timerBeaconIcon->start(30 * 1000);
526+
updateBeaconIcon();
527+
515528
toolbar2->addWidget(frameBlocks);
516529

517530
addToolBarBreak(Qt::TopToolBarArea);
518531

532+
519533
// Top tool bar (clickable Gridcoin and BOINC logos)
520534
QToolBar *toolbar3 = addToolBar("Logo bar");
521-
addToolBar(Qt::TopToolBarArea,toolbar3);
535+
addToolBar(Qt::TopToolBarArea, toolbar3);
522536
toolbar3->setOrientation(Qt::Horizontal);
523-
toolbar3->setMovable( false );
537+
toolbar3->setMovable(false);
524538
toolbar3->setObjectName("toolbar3");
525539
ClickLabel *grcLogoLabel = new ClickLabel();
526540
grcLogoLabel->setObjectName("gridcoinLogoHorizontal");
@@ -1498,13 +1512,13 @@ void BitcoinGUI::updateStakingIcon()
14981512
if (staking)
14991513
{
15001514
QString text = GetEstimatedStakingFrequency(GetEstimatedTimetoStake());
1501-
labelStakingIcon->setPixmap(QIcon(":/icons/staking_on").pixmap(STATUSBAR_ICONSIZE,STATUSBAR_ICONSIZE));
1515+
labelStakingIcon->setPixmap(QIcon(":/icons/staking_on").pixmap(STATUSBAR_ICONSIZE, STATUSBAR_ICONSIZE));
15021516
labelStakingIcon->setToolTip(tr("Staking.<br>Your weight is %1<br>Network weight is %2<br><b>Estimated</b> staking frequency is %3.")
15031517
.arg(nWeight).arg(nNetworkWeight).arg(text));
15041518
}
15051519
else
15061520
{
1507-
labelStakingIcon->setPixmap(QIcon(":/icons/staking_off").pixmap(STATUSBAR_ICONSIZE,STATUSBAR_ICONSIZE));
1521+
labelStakingIcon->setPixmap(QIcon(":/icons/staking_off").pixmap(STATUSBAR_ICONSIZE, STATUSBAR_ICONSIZE));
15081522
//Part of this string wont be translated :(
15091523
labelStakingIcon->setToolTip(tr("Not staking; %1").arg(QString(ReasonNotStaking.c_str())));
15101524
}
@@ -1569,7 +1583,7 @@ void BitcoinGUI::updateScraperIcon(int scraperEventtype, int status)
15691583
}
15701584
else if (scraperEventtype == (int)scrapereventtypes::Sleep && status == CT_NEW)
15711585
{
1572-
labelScraperIcon->setPixmap(QIcon(":/icons/staking_off").pixmap(STATUSBAR_ICONSIZE, STATUSBAR_ICONSIZE));
1586+
labelScraperIcon->setPixmap(QIcon(":/icons/grey_scraper").pixmap(STATUSBAR_ICONSIZE, STATUSBAR_ICONSIZE));
15731587
labelScraperIcon->setToolTip(tr("Scraper: superblock not needed - inactive."));
15741588
}
15751589
else if (scraperEventtype == (int)scrapereventtypes::Stats && (status == CT_NEW || status == CT_UPDATED || status == CT_UPDATING))
@@ -1580,7 +1594,7 @@ void BitcoinGUI::updateScraperIcon(int scraperEventtype, int status)
15801594
else if ((scraperEventtype == (int)scrapereventtypes::Convergence || scraperEventtype == (int)scrapereventtypes::SBContract)
15811595
&& (status == CT_NEW || status == CT_UPDATED) && nConvergenceTime)
15821596
{
1583-
labelScraperIcon->setPixmap(QIcon(":/icons/staking_on").pixmap(STATUSBAR_ICONSIZE, STATUSBAR_ICONSIZE));
1597+
labelScraperIcon->setPixmap(QIcon(":/icons/green_scraper").pixmap(STATUSBAR_ICONSIZE, STATUSBAR_ICONSIZE));
15841598

15851599
if (bDisplayScrapers)
15861600
{
@@ -1606,8 +1620,14 @@ void BitcoinGUI::updateScraperIcon(int scraperEventtype, int status)
16061620
else if ((scraperEventtype == (int)scrapereventtypes::Convergence || scraperEventtype == (int)scrapereventtypes::SBContract)
16071621
&& status == CT_DELETED)
16081622
{
1609-
labelScraperIcon->setPixmap(QIcon(":/icons/quit").pixmap(STATUSBAR_ICONSIZE, STATUSBAR_ICONSIZE));
1623+
labelScraperIcon->setPixmap(QIcon(":/icons/red_and_white_x").pixmap(STATUSBAR_ICONSIZE, STATUSBAR_ICONSIZE));
16101624
labelScraperIcon->setToolTip(tr("Scraper: No convergence able to be achieved. Will retry in a few minutes."));
16111625
}
16121626

16131627
}
1628+
1629+
void BitcoinGUI::updateBeaconIcon()
1630+
{
1631+
labelBeaconIcon->setPixmap(QIcon(":/icons/beacon_green").pixmap(STATUSBAR_ICONSIZE, STATUSBAR_ICONSIZE));
1632+
labelBeaconIcon->setToolTip(tr("Iconsize = %1.").arg(QString(std::to_string(STATUSBAR_ICONSIZE).c_str())));
1633+
}

src/qt/bitcoingui.h

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
#include <QSystemTrayIcon>
66
#include <QMenu>
77
#include <stdint.h>
8+
#include "guiconstants.h"
89

910
class TransactionTableModel;
1011
class ClientModel;
@@ -77,6 +78,7 @@ class BitcoinGUI : public QMainWindow
7778
QLabel *labelConnectionsIcon;
7879
QLabel *labelBlocksIcon;
7980
QLabel *labelScraperIcon;
81+
QLabel *labelBeaconIcon;
8082

8183
QMenuBar *appMenuBar;
8284
QAction *overviewAction;
@@ -121,6 +123,8 @@ class BitcoinGUI : public QMainWindow
121123
// name extension to change icons according to stylesheet
122124
QString sSheet;
123125

126+
int STATUSBAR_ICONSIZE = UNSCALED_STATUSBAR_ICONSIZE * logicalDpiX() / 96;
127+
124128
/** Create the main UI actions. */
125129
void createActions();
126130
/** Create the menu bar and sub-menus. */
@@ -231,6 +235,7 @@ private slots:
231235
void updateWeight();
232236
void updateStakingIcon();
233237
void updateScraperIcon(int scraperEventtype, int status);
238+
void updateBeaconIcon();
234239

235240
QString GetEstimatedStakingFrequency(unsigned int nEstimateTime);
236241

src/qt/guiconstants.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ static const int MODEL_UPDATE_DELAY = 2000;
88
static const int MAX_PASSPHRASE_SIZE = 1024;
99

1010
/* BitcoinGUI -- Size of icons in status bar */
11-
static const int STATUSBAR_ICONSIZE = 16;
11+
static const int UNSCALED_STATUSBAR_ICONSIZE = 16;
1212

1313
/* Invalid field background style */
1414
#define STYLE_INVALID "background:#FF8080"

0 commit comments

Comments
 (0)