From dd3f69736a6e25044b8802057ba9982592575cdb Mon Sep 17 00:00:00 2001 From: Luke Dashjr Date: Sat, 27 Dec 2014 19:19:51 +0000 Subject: [PATCH] Use real text rather than image-rendered text for unit selector The width of each unit is measured to set a fixed width for the widget, and the color is set to match the other status widgets. --- src/Makefile.qt.include | 3 --- src/qt/bitcoin.qrc | 3 --- src/qt/bitcoingui.cpp | 12 +++++++++++- src/qt/res/icons/unit_btc.png | Bin 1318 -> 0 bytes src/qt/res/icons/unit_mbtc.png | Bin 1407 -> 0 bytes src/qt/res/icons/unit_ubtc.png | Bin 1369 -> 0 bytes 6 files changed, 11 insertions(+), 7 deletions(-) delete mode 100644 src/qt/res/icons/unit_btc.png delete mode 100644 src/qt/res/icons/unit_mbtc.png delete mode 100644 src/qt/res/icons/unit_ubtc.png diff --git a/src/Makefile.qt.include b/src/Makefile.qt.include index 8b782b2ad..806b4f955 100644 --- a/src/Makefile.qt.include +++ b/src/Makefile.qt.include @@ -256,9 +256,6 @@ RES_ICONS = \ qt/res/icons/tx_input.png \ qt/res/icons/tx_output.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 \ qt/res/icons/verify.png BITCOIN_QT_CPP = \ diff --git a/src/qt/bitcoin.qrc b/src/qt/bitcoin.qrc index b54f2e2ed..bcaf95d91 100644 --- a/src/qt/bitcoin.qrc +++ b/src/qt/bitcoin.qrc @@ -35,9 +35,6 @@ 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 3b8fd985a..2810eae05 100644 --- a/src/qt/bitcoingui.cpp +++ b/src/qt/bitcoingui.cpp @@ -1027,6 +1027,16 @@ UnitDisplayStatusBarControl::UnitDisplayStatusBarControl() : { createContextMenu(); setToolTip(tr("Unit to show amounts in. Click to select another unit.")); + QList units = BitcoinUnits::availableUnits(); + int max_width = 0; + const QFontMetrics fm(font()); + foreach (const BitcoinUnits::Unit unit, units) + { + max_width = qMax(max_width, fm.width(BitcoinUnits::name(unit))); + } + setMinimumSize(max_width, 0); + setAlignment(Qt::AlignRight | Qt::AlignVCenter); + setStyleSheet(QString("QLabel { color : %1 }").arg(SingleColor().name())); } /** So that it responds to button clicks */ @@ -1066,7 +1076,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) { - setPixmap(SingleColorIcon(":/icons/unit_" + BitcoinUnits::id(newUnits)).pixmap(31,STATUSBAR_ICONSIZE)); + setText(BitcoinUnits::name(newUnits)); } /** Shows context menu with Display Unit options by the mouse coordinates */ diff --git a/src/qt/res/icons/unit_btc.png b/src/qt/res/icons/unit_btc.png deleted file mode 100644 index f3246fa99948a136c79e1bc14abceb71d1571f83..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 1318 zcmeAS@N?(olHy`uVBq!ia0vp^4nVBH!3HE3&8=$zQj#UE5hcO-X(i=}MX3yqDfvmM z3ZA)%>8U}fi7AzZCsS=07?_naLn2Bde0{8v^K*7iAWdWaj57fJ{tG z$}cUkRRX#c;)UD-xUqS~&|m@vn0`fKfxe-h0mw@*g}%P{mFDKcRTq~8r6Sym)!^cg z%7Rq=pw#00(xPNw#HA^NtSYc_E=o--$uA1Y&(DE{Vn9ZINq%ugeu09svx0_iVsd64 zh_4CO;OlGUnO9trn3tUD>0+w{G(s;kGsVi#!p+Ij$=t%!#o55n(AC7!(Z$T!+{N73 zz|`E)+{hKC*Cju>G&eP`1g19yq1O_pUQk-dEdbi=l3J8mmYU*Ll%J~r_On$cZnv1> zG!Lpb1-Dzwaq86vIz}H9vq&)w69Oh55EGtmfgE_sPt5}+_ab1r7EhHGWME*N>FMGa zQgQ1|WOr_}fk5wSodG1EhtA!xQUACW zYw49AS*p-bQsSV+#CR)Ayu&-iuLye!`B4sPcSC(RWr zE8#KuBc;Hw{v=0(?Bs^FbGiNzNIHsnbo%M-(*I$0~^|u6W-0~acDTiCVe6F zn)T`(Z0o((IjvYWPw3DS`H$I zft$ET&NU4myQ@6=@4Gz>acA)U#=*G9HD}F^)fNxu$`~`Qla2Yu^568BeWxL#&w*)A b)ebORtD3;ww(5Q(sO0i=^>bP0l+XkK7K6)N diff --git a/src/qt/res/icons/unit_mbtc.png b/src/qt/res/icons/unit_mbtc.png deleted file mode 100644 index 4e82b652748baca3f2ee28c27e41a074217f46a1..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 1407 zcmeAS@N?(olHy`uVBq!ia0vp^4nVBH!3HE3&8=$zQj#UE5hcO-X(i=}MX3yqDfvmM z3ZA)%>8U}fi7AzZCsS=07?_naLn2Bde0{8v^K*7iAWdWaj57fJ{tG z$}cUkRRX#c;)UD-xUqS~&|m@vn0`fKfxe-h0mw@*g}%P{mFDKcRTq~8r6Sym)!^cg z%7Rq=pw#00(xPNw#HA^NtSYc_E=o--$uA1Y&(DE{Vn9ZINq%ugeu09svx0_iVsd64 zh_4CO;OlGUnO9trn3tUD>0+w{G(s;kGsVi#!p+Ij$=t-$#o55n(AC7!(Z$T!+{N73 zz|`E)+{hKC*Cju>G&eP`1g19yq1P0rUQk-dEdbi=l3J8mmYU*Ll%J~r_On$c7PmMW zI+~c7x&h5|a>MQxh~5+|Zh`7G!>Lyv=oo!a%p%1!ObD2KKumbL1#;jiKQ#}S+>3ze zx=HHKMFs}OPo6H0Ar-gYL^k#|8}PJT*FVtj;GV!*$703Q17d0@AK)-JWb9PWBGGtj zQuCjm6Ks4#v;@7yydJUqeiP#)eeSc2Oys?$=5F=_%nukpFjO$uFvv0RA1Gv9f5>c? zlCs{~i}@E~W?hzew!$RnNASg8pMGmC{cp{vu%(2R!Go#F_{QUkKRyhLrWOjmS+S9m zW5LWf;o1_-N$-#3OrO+mxw`AN{(~|mg#^A-J_dp8QnvWkyPIUigm?~bV43TveL-T& zVzaEnZ?vx2d!_Dit&1s;_%R{qr~iWV=1Sl5tY6Ao1*ZkO`zuN|Hc0wL*1IfeF1q=m z+UfjBA?A&K+>TH=ib!uk*PY$|TzRCG37{6PPPe{#~slIFvLQ%#ueOuprj6&jdR zKV{C0uy5x=U-jRdvv#>d`h$-8LWbv)+%0@U8Jm|)VOwb%nYOO-=RN(oy>a^YJZB_XUMbC0xC+yV^W36aBz4U>1*{drIQLA@z?3{AZ;GXgG z+#hE*IlgAz3pcI!u7WiTv+dt=|BX-nr*6pK f!2aMwk$3`w$re4Ih=sRpK}DjctDnm{r-UW|wJ`QB diff --git a/src/qt/res/icons/unit_ubtc.png b/src/qt/res/icons/unit_ubtc.png deleted file mode 100644 index 96b254770dc0232a39d5e110c6924c9d44b4d284..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 1369 zcmeAS@N?(olHy`uVBq!ia0vp^4nVBH!3HE3&8=$zQj#UE5hcO-X(i=}MX3yqDfvmM z3ZA)%>8U}fi7AzZCsS=07?_naLn2Bde0{8v^K*7iAWdWaj57fJ{tG z$}cUkRRX#c;)UD-xUqS~&|m@vn0`fKfxe-h0mw@*g}%P{mFDKcRTq~8r6Sym)!^cg z%7Rq=pw#00(xPNw#HA^NtSYc_E=o--$uA1Y&(DE{Vn9ZINq%ugeu09svx0_iVsd64 zh_4CO;OlGUnO9trn3tUD>0+w{G(s;kGsVi$(9y)q)Xmt`#mUXk(AC7!(Z$T!+{N73 zz|`E)+{hKC*Cju>G&eP`1g19yq1ObbUQk-dEdbi=l3J8mmYU*Ll%J~r_On$cZnqfX zG!Lpb1-Dy_aO%|uIz}H9vq&)w69Oh55EGtmfgE_sPt5}+_ab1rUch{PAp-;B8BZ6- zkcwMxW;Euu81OJWyvlk>@Rr~Ujx`SM3zRo7X&>OYFPPAh-tu4Y5XY5?bHcM)RVDIjS`~QR(W=l?={j|-JlWA7LzZ{lsU(M{U%j-J&mkNn~ zkAG0cG(m$;l##(BdhXG1%lAL6V#<8%`xPQ>e2aPh3x2t5wD;(J^)KCrnPf_s&YC1& z6E^DDVqRr5p={qn7kBSN`Hn}=et*Z4z?{h8vuC^Qs{SW-f?qd%Oxu~brko=(e8FnQ zH#3<(O0xA|`h`c>%Knh{f_XCB z3=0~1Z@v+EGSiiz=&