Browse Source

Merge pull request #4466

ad87bc4 [Qt] Replace status bar unit icon with actual images (Cozz Lovan)
0.10
Wladimir J. van der Laan 11 years ago
parent
commit
88ae36bc06
No known key found for this signature in database
GPG Key ID: 74810B012346C9A6
  1. 5
      src/Makefile.qt.include
  2. 3
      src/qt/bitcoin.qrc
  3. 3
      src/qt/bitcoingui.cpp
  4. 11
      src/qt/bitcoinunits.cpp
  5. 2
      src/qt/bitcoinunits.h
  6. BIN
      src/qt/res/icons/unit_btc.png
  7. BIN
      src/qt/res/icons/unit_mbtc.png
  8. BIN
      src/qt/res/icons/unit_ubtc.png

5
src/Makefile.qt.include

@ -252,7 +252,10 @@ RES_ICONS = \
qt/res/icons/tx_inout.png \ qt/res/icons/tx_inout.png \
qt/res/icons/tx_input.png \ qt/res/icons/tx_input.png \
qt/res/icons/tx_output.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 = \ BITCOIN_QT_CPP = \
qt/bitcoinaddressvalidator.cpp \ qt/bitcoinaddressvalidator.cpp \

3
src/qt/bitcoin.qrc

@ -35,6 +35,9 @@
<file alias="tx_input">res/icons/tx_input.png</file> <file alias="tx_input">res/icons/tx_input.png</file>
<file alias="tx_output">res/icons/tx_output.png</file> <file alias="tx_output">res/icons/tx_output.png</file>
<file alias="tx_inout">res/icons/tx_inout.png</file> <file alias="tx_inout">res/icons/tx_inout.png</file>
<file alias="unit_btc">res/icons/unit_btc.png</file>
<file alias="unit_mbtc">res/icons/unit_mbtc.png</file>
<file alias="unit_ubtc">res/icons/unit_ubtc.png</file>
<file alias="lock_closed">res/icons/lock_closed.png</file> <file alias="lock_closed">res/icons/lock_closed.png</file>
<file alias="lock_open">res/icons/lock_open.png</file> <file alias="lock_open">res/icons/lock_open.png</file>
<file alias="key">res/icons/key.png</file> <file alias="key">res/icons/key.png</file>

3
src/qt/bitcoingui.cpp

@ -1009,7 +1009,6 @@ UnitDisplayStatusBarControl::UnitDisplayStatusBarControl():QLabel()
{ {
optionsModel = 0; optionsModel = 0;
createContextMenu(); createContextMenu();
setStyleSheet("font:11pt; color: #333333");
setToolTip(tr("Unit to show amounts in. Click to select another unit.")); setToolTip(tr("Unit to show amounts in. Click to select another unit."));
} }
@ -1054,7 +1053,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 */ /** 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) 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 */ /** Shows context menu with Display Unit options by the mouse coordinates */

11
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) QString BitcoinUnits::name(int unit)
{ {
switch(unit) switch(unit)

2
src/qt/bitcoinunits.h

@ -36,6 +36,8 @@ public:
static QList<Unit> availableUnits(); static QList<Unit> availableUnits();
//! Is unit ID valid? //! Is unit ID valid?
static bool valid(int unit); static bool valid(int unit);
//! Identifier, e.g. for image names
static QString id(int unit);
//! Short name //! Short name
static QString name(int unit); static QString name(int unit);
//! Longer description //! Longer description

BIN
src/qt/res/icons/unit_btc.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.1 KiB

BIN
src/qt/res/icons/unit_mbtc.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.1 KiB

BIN
src/qt/res/icons/unit_ubtc.png

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.1 KiB

Loading…
Cancel
Save