From ad87bc4de10d8ff9934635f2a30078ccf531a124 Mon Sep 17 00:00:00 2001 From: Cozz Lovan Date: Sat, 5 Jul 2014 17:14:43 +0200 Subject: [PATCH] [Qt] Replace status bar unit icon with actual images --- src/Makefile.qt.include | 5 ++++- src/qt/bitcoin.qrc | 3 +++ src/qt/bitcoingui.cpp | 3 +-- src/qt/bitcoinunits.cpp | 11 +++++++++++ src/qt/bitcoinunits.h | 2 ++ src/qt/res/icons/unit_btc.png | Bin 0 -> 2107 bytes src/qt/res/icons/unit_mbtc.png | Bin 0 -> 2107 bytes src/qt/res/icons/unit_ubtc.png | Bin 0 -> 2107 bytes 8 files changed, 21 insertions(+), 3 deletions(-) create mode 100644 src/qt/res/icons/unit_btc.png create mode 100644 src/qt/res/icons/unit_mbtc.png create mode 100644 src/qt/res/icons/unit_ubtc.png diff --git a/src/Makefile.qt.include b/src/Makefile.qt.include index 4563bb3565..29279aff81 100644 --- a/src/Makefile.qt.include +++ b/src/Makefile.qt.include @@ -252,7 +252,10 @@ RES_ICONS = \ qt/res/icons/tx_inout.png \ qt/res/icons/tx_input.png \ qt/res/icons/tx_output.png \ - qt/res/icons/tx_mined.png + qt/res/icons/tx_mined.png \ + qt/res/icons/unit_btc.png \ + qt/res/icons/unit_mbtc.png \ + qt/res/icons/unit_ubtc.png BITCOIN_QT_CPP = \ qt/bitcoinaddressvalidator.cpp \ diff --git a/src/qt/bitcoin.qrc b/src/qt/bitcoin.qrc index f38200c7f7..357c6470d3 100644 --- a/src/qt/bitcoin.qrc +++ b/src/qt/bitcoin.qrc @@ -35,6 +35,9 @@ res/icons/tx_input.png res/icons/tx_output.png res/icons/tx_inout.png + res/icons/unit_btc.png + res/icons/unit_mbtc.png + res/icons/unit_ubtc.png res/icons/lock_closed.png res/icons/lock_open.png res/icons/key.png diff --git a/src/qt/bitcoingui.cpp b/src/qt/bitcoingui.cpp index f2fb8c877e..89cad2ce49 100644 --- a/src/qt/bitcoingui.cpp +++ b/src/qt/bitcoingui.cpp @@ -1014,7 +1014,6 @@ UnitDisplayStatusBarControl::UnitDisplayStatusBarControl():QLabel() { optionsModel = 0; createContextMenu(); - setStyleSheet("font:11pt; color: #333333"); setToolTip(tr("Unit to show amounts in. Click to select another unit.")); } @@ -1059,7 +1058,7 @@ void UnitDisplayStatusBarControl::setOptionsModel(OptionsModel *optionsModel) /** When Display Units are changed on OptionsModel it will refresh the display text of the control on the status bar */ void UnitDisplayStatusBarControl::updateDisplayUnit(int newUnits) { - setText(BitcoinUnits::name(newUnits)); + setPixmap(QIcon(":/icons/unit_" + BitcoinUnits::id(newUnits)).pixmap(31,STATUSBAR_ICONSIZE)); } /** Shows context menu with Display Unit options by the mouse coordinates */ diff --git a/src/qt/bitcoinunits.cpp b/src/qt/bitcoinunits.cpp index 4ba6aba551..bbc9b2e5af 100644 --- a/src/qt/bitcoinunits.cpp +++ b/src/qt/bitcoinunits.cpp @@ -34,6 +34,17 @@ bool BitcoinUnits::valid(int unit) } } +QString BitcoinUnits::id(int unit) +{ + switch(unit) + { + case BTC: return QString("btc"); + case mBTC: return QString("mbtc"); + case uBTC: return QString("ubtc"); + default: return QString("???"); + } +} + QString BitcoinUnits::name(int unit) { switch(unit) diff --git a/src/qt/bitcoinunits.h b/src/qt/bitcoinunits.h index 451b52ee21..da34ed8976 100644 --- a/src/qt/bitcoinunits.h +++ b/src/qt/bitcoinunits.h @@ -36,6 +36,8 @@ public: static QList availableUnits(); //! Is unit ID valid? static bool valid(int unit); + //! Identifier, e.g. for image names + static QString id(int unit); //! Short name static QString name(int unit); //! Longer description diff --git a/src/qt/res/icons/unit_btc.png b/src/qt/res/icons/unit_btc.png new file mode 100644 index 0000000000000000000000000000000000000000..ec3497435c9bd96caa594d5fa007a80efda05a04 GIT binary patch literal 2107 zcmeAS@N?(olHy`uVBq!ia0vp^@<1%W!3HGX{aEq_NUzopr0F#DPf&c&j literal 0 HcmV?d00001 diff --git a/src/qt/res/icons/unit_mbtc.png b/src/qt/res/icons/unit_mbtc.png new file mode 100644 index 0000000000000000000000000000000000000000..32bf2f2ca05a4768fc8e280a1e4620e3daf42538 GIT binary patch literal 2107 zcmeH|Jxc>Y5QaAh`O*Z_YGGk1l2)`*E+&U~hy=k8F!%=)ZN(y;wb=Rrf}MXL2r8B$ z79vU%L=Y4-HYza)@qOd%F)mR_rNvEnGCMPGW_Fiww>;vcW6`##QYvO=tWo$5&>9Zn zyHwtKfD6tHr7czEXJdDJ1)0cPW_&@Z_#p|bcE#J33KeauKiiWCoP?5PXngZ;z`ue2 zcLP;yN%MmB5lFe))cJazk_m7M-oPcufrgBYwMDQP1NS;1ywov02yOs3+6+3uI;fpw z5&j9>0Y1Q%KndIe8)%bF_3#T_6kh6>-Up7TdrJ!QfIG?pKK2;5xbZo>Hfkl$hy_9kzrEDQW{(X3-IO0KinGl()_oWO*K3*UY9D#9~ov2XL$;ofeI*s YY4CT}S8=*GuO0Y$rMz>J*zEB-luA|0dSJXSpSVgDYS6?MpFn&9 z&J(C3YxsnJ0g4T!$-7ocrolD%26vzWA{hr8%fOic&n6*OsbhKwJOX~uR?r1@LCEYz z8B5=6ejA$bcRDhCiXf1Q|9rUtH8Q3z`9R!Hk!7-nrB{%*G|td&l(F=A