Skip to content

Commit 88ae36b

Browse files
committed
Merge pull request #4466
ad87bc4 [Qt] Replace status bar unit icon with actual images (Cozz Lovan)
2 parents 1132cdb + ad87bc4 commit 88ae36b

File tree

8 files changed

+21
-3
lines changed

8 files changed

+21
-3
lines changed

src/Makefile.qt.include

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -252,7 +252,10 @@ RES_ICONS = \
252252
qt/res/icons/tx_inout.png \
253253
qt/res/icons/tx_input.png \
254254
qt/res/icons/tx_output.png \
255-
qt/res/icons/tx_mined.png
255+
qt/res/icons/tx_mined.png \
256+
qt/res/icons/unit_btc.png \
257+
qt/res/icons/unit_mbtc.png \
258+
qt/res/icons/unit_ubtc.png
256259

257260
BITCOIN_QT_CPP = \
258261
qt/bitcoinaddressvalidator.cpp \

src/qt/bitcoin.qrc

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,9 @@
3535
<file alias="tx_input">res/icons/tx_input.png</file>
3636
<file alias="tx_output">res/icons/tx_output.png</file>
3737
<file alias="tx_inout">res/icons/tx_inout.png</file>
38+
<file alias="unit_btc">res/icons/unit_btc.png</file>
39+
<file alias="unit_mbtc">res/icons/unit_mbtc.png</file>
40+
<file alias="unit_ubtc">res/icons/unit_ubtc.png</file>
3841
<file alias="lock_closed">res/icons/lock_closed.png</file>
3942
<file alias="lock_open">res/icons/lock_open.png</file>
4043
<file alias="key">res/icons/key.png</file>

src/qt/bitcoingui.cpp

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1009,7 +1009,6 @@ UnitDisplayStatusBarControl::UnitDisplayStatusBarControl():QLabel()
10091009
{
10101010
optionsModel = 0;
10111011
createContextMenu();
1012-
setStyleSheet("font:11pt; color: #333333");
10131012
setToolTip(tr("Unit to show amounts in. Click to select another unit."));
10141013
}
10151014

@@ -1054,7 +1053,7 @@ void UnitDisplayStatusBarControl::setOptionsModel(OptionsModel *optionsModel)
10541053
/** When Display Units are changed on OptionsModel it will refresh the display text of the control on the status bar */
10551054
void UnitDisplayStatusBarControl::updateDisplayUnit(int newUnits)
10561055
{
1057-
setText(BitcoinUnits::name(newUnits));
1056+
setPixmap(QIcon(":/icons/unit_" + BitcoinUnits::id(newUnits)).pixmap(31,STATUSBAR_ICONSIZE));
10581057
}
10591058

10601059
/** Shows context menu with Display Unit options by the mouse coordinates */

src/qt/bitcoinunits.cpp

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,17 @@ bool BitcoinUnits::valid(int unit)
3434
}
3535
}
3636

37+
QString BitcoinUnits::id(int unit)
38+
{
39+
switch(unit)
40+
{
41+
case BTC: return QString("btc");
42+
case mBTC: return QString("mbtc");
43+
case uBTC: return QString("ubtc");
44+
default: return QString("???");
45+
}
46+
}
47+
3748
QString BitcoinUnits::name(int unit)
3849
{
3950
switch(unit)

src/qt/bitcoinunits.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,8 @@ class BitcoinUnits: public QAbstractListModel
3636
static QList<Unit> availableUnits();
3737
//! Is unit ID valid?
3838
static bool valid(int unit);
39+
//! Identifier, e.g. for image names
40+
static QString id(int unit);
3941
//! Short name
4042
static QString name(int unit);
4143
//! Longer description

src/qt/res/icons/unit_btc.png

2.06 KB
Loading

src/qt/res/icons/unit_mbtc.png

2.06 KB
Loading

src/qt/res/icons/unit_ubtc.png

2.06 KB
Loading

0 commit comments

Comments
 (0)