From 05bcf7089e0da090db0b09a35b25f7a87c8ca1dd Mon Sep 17 00:00:00 2001 From: "Wladimir J. van der Laan" Date: Sun, 31 Jul 2011 17:05:34 +0200 Subject: [PATCH] address icons --- doc/assets-attribution.txt | 3 +- src/qt/bitcoin.qrc | 4 + src/qt/res/icons/tx_inout.png | Bin 0 -> 631 bytes src/qt/res/icons/tx_input.png | Bin 0 -> 594 bytes src/qt/res/icons/tx_mined.png | Bin 0 -> 754 bytes src/qt/res/icons/tx_output.png | Bin 0 -> 593 bytes src/qt/res/{icons => src}/bitcoin.svg | 0 src/qt/res/{icons => src}/clock1.svg | 0 src/qt/res/{icons => src}/clock2.svg | 0 src/qt/res/{icons => src}/clock3.svg | 0 src/qt/res/{icons => src}/clock4.svg | 0 src/qt/res/{icons => src}/clock5.svg | 0 src/qt/res/{icons => src}/clock_green.svg | 0 src/qt/res/src/inout.svg | 122 +++++++++++++++++++++ src/qt/res/{icons => src}/questionmark.svg | 0 src/qt/transactiontablemodel.cpp | 69 ++++++------ src/qt/transactiontablemodel.h | 5 +- 17 files changed, 169 insertions(+), 34 deletions(-) create mode 100644 src/qt/res/icons/tx_inout.png create mode 100644 src/qt/res/icons/tx_input.png create mode 100644 src/qt/res/icons/tx_mined.png create mode 100644 src/qt/res/icons/tx_output.png rename src/qt/res/{icons => src}/bitcoin.svg (100%) rename src/qt/res/{icons => src}/clock1.svg (100%) rename src/qt/res/{icons => src}/clock2.svg (100%) rename src/qt/res/{icons => src}/clock3.svg (100%) rename src/qt/res/{icons => src}/clock4.svg (100%) rename src/qt/res/{icons => src}/clock5.svg (100%) rename src/qt/res/{icons => src}/clock_green.svg (100%) create mode 100644 src/qt/res/src/inout.svg rename src/qt/res/{icons => src}/questionmark.svg (100%) diff --git a/doc/assets-attribution.txt b/doc/assets-attribution.txt index c03233790e..0a719f1715 100644 --- a/doc/assets-attribution.txt +++ b/doc/assets-attribution.txt @@ -1,4 +1,5 @@ -Icon: src/qt/res/icons/clock*.png +Icon: src/qt/res/icons/clock*.png, src/qt/res/icons/tx*.png, + src/qt/res/src/*.svg Designer: Wladimir van der Laan License: Creative Commons Attribution diff --git a/src/qt/bitcoin.qrc b/src/qt/bitcoin.qrc index 5199a8ea31..8d4bab5462 100644 --- a/src/qt/bitcoin.qrc +++ b/src/qt/bitcoin.qrc @@ -30,6 +30,10 @@ res/icons/export.png res/icons/synced.png res/icons/remove.png + res/icons/tx_mined.png + res/icons/tx_input.png + res/icons/tx_output.png + res/icons/tx_inout.png res/images/about.png diff --git a/src/qt/res/icons/tx_inout.png b/src/qt/res/icons/tx_inout.png new file mode 100644 index 0000000000000000000000000000000000000000..ff6bb1c5c3ed6049f5cbde02b95d53e7e4739a2f GIT binary patch literal 631 zcmV--0*L*IP)2 zCW_i=T*0MQ5TkDTiD`VW#99mn}3=_-H|nM`J0 z(rmlkeo68n$?LUR?bdjJ1LNb-#)>+w>kiWC^e#z_u!3tOZ`5kFI{-k>^DYCp7vcs0 zo|AkQ1i`m(j0+@>0@wlIOSjwITdh`uC{fH9^Ck#_H2_lpk^rnE8}=IY9MS!8Fc5BH zqtTd-$Kz)uodb{}IVWiwfR6y)NqP)msZc1q#_uHQZ_HM!mH3Bk6LZpY{t29v_VYB- RoqqrT002ovPDHLkV1oR%3Jd@M literal 0 HcmV?d00001 diff --git a/src/qt/res/icons/tx_input.png b/src/qt/res/icons/tx_input.png new file mode 100644 index 0000000000000000000000000000000000000000..1673d06ad33a333b0a7c6652a30c4e420e933dc2 GIT binary patch literal 594 zcmV-Y01T`nbwjKg&X^f zu#xEC58Ra$F6e;90!q4+*s^>Ql1mFAB!l9DjuaFDCq$$|$fSsU_b9lFE(f9UNTZ$I zH}m$*td^26kD0lu0i>hA^SrYpYXH_HtxC#}+?F&Z`OdcO4FG@1r6lxvy>*gx04M)* z*)GZF)oS(W5rS^FyJCzP$Ib-cGk`HkOVWiHwm+Rtm+STV!C?!=n5$uYV2rty$z(p3 z%jKU@LbKVto6qMjl6(SSF_lW?0DL(lAbBl(iLaGPeOm;vx-v)K}Wok&46z;h8nyWRFl-g6vhPtpTPPN`J7Bx%LA?PtjrB7*aA zKz|0~xURcvS=Jdzoe(;f;Iij=-vE3d`927O2}!G1EM6hm40C=UVQFK`W)KAX02Tq{ z0N9djk^q2c4efQ3fRfPZbWUZn+1rxt09YfrD(M7(?*O(Wy#cUZtJOXw2_WfT&VIkY ga13_DIq!G=4ZoY?i>Xjr?*IS*07*qoM6N<$f(sV~tN;K2 literal 0 HcmV?d00001 diff --git a/src/qt/res/icons/tx_mined.png b/src/qt/res/icons/tx_mined.png new file mode 100644 index 0000000000000000000000000000000000000000..a336868e8a89b553996f84ad63fba5aba551db06 GIT binary patch literal 754 zcmVoPDU@-W+qod+9=#H$FZdPbQPc%gV~$04y&r2jcPg-DEPE7LoUZgM)4V0CKt9*@cCL zeThV3PbQNg6bhw`F`of~!Qf4;HK|mpd}?ZHn^NkwwKlW{kWQyF6B84xuC7v1Q9*5O zZCBw<6{XY> z;H8LIpm~0NekqYi_(X)7nwn45)zv#RfXCx0)mkf`&nNZu^{2Gf=K-IHJO(uoEBO>ZTrStHmX?-DYps87 zZf>-ys_H~rTidMK=pR^X%S2=Z*q@hHfs>I)B)Wc9uNV6J`^$l6dGjLh6es~6IgZo5 zDPUk=pwjJjkBP`$AR{8j!r|~?rPN4%_P*mdXEp@HVzDZ>+x-IA4G7TQ+S>Z0si`Ro zM1a?T0{X1A7uEn`u~;~h$-EMgoq7FYab9E0FQwEW;3I!lf6H2X=`SFg&7K3c11P1s zB9X|Q^;wNEKb2AkfiD0e(q*mPQiyOJ7zKKaF;~}{iy$eN%XI*l0gf7Dz9Axr2#(|U kMMM?)&1!gfxU_Kp4ZR*Ocy4Rr_firTIcA}30GUJyf?$PY89+hOhNKfD4<(IBzP8rB18}TeNPn*e+QFeZ6X(pt(l4a4xP=XtZlV2m+au|6}#Tyq>}#adgi z)?RmAHy?&!p5(naW_dIk-KZpZrPQmOQ+SSsKY+0n|m=_G*f01hO*1kfs%%O8%-CuyE=Fc>)h f@Es8@`kns(Nci4D#R}x@00000NkvXXu0mjfcvt^1 literal 0 HcmV?d00001 diff --git a/src/qt/res/icons/bitcoin.svg b/src/qt/res/src/bitcoin.svg similarity index 100% rename from src/qt/res/icons/bitcoin.svg rename to src/qt/res/src/bitcoin.svg diff --git a/src/qt/res/icons/clock1.svg b/src/qt/res/src/clock1.svg similarity index 100% rename from src/qt/res/icons/clock1.svg rename to src/qt/res/src/clock1.svg diff --git a/src/qt/res/icons/clock2.svg b/src/qt/res/src/clock2.svg similarity index 100% rename from src/qt/res/icons/clock2.svg rename to src/qt/res/src/clock2.svg diff --git a/src/qt/res/icons/clock3.svg b/src/qt/res/src/clock3.svg similarity index 100% rename from src/qt/res/icons/clock3.svg rename to src/qt/res/src/clock3.svg diff --git a/src/qt/res/icons/clock4.svg b/src/qt/res/src/clock4.svg similarity index 100% rename from src/qt/res/icons/clock4.svg rename to src/qt/res/src/clock4.svg diff --git a/src/qt/res/icons/clock5.svg b/src/qt/res/src/clock5.svg similarity index 100% rename from src/qt/res/icons/clock5.svg rename to src/qt/res/src/clock5.svg diff --git a/src/qt/res/icons/clock_green.svg b/src/qt/res/src/clock_green.svg similarity index 100% rename from src/qt/res/icons/clock_green.svg rename to src/qt/res/src/clock_green.svg diff --git a/src/qt/res/src/inout.svg b/src/qt/res/src/inout.svg new file mode 100644 index 0000000000..bfab8ef6ab --- /dev/null +++ b/src/qt/res/src/inout.svg @@ -0,0 +1,122 @@ + + + + + + + + image/svg+xml + + + + + + + + + + + + + + + + + diff --git a/src/qt/res/icons/questionmark.svg b/src/qt/res/src/questionmark.svg similarity index 100% rename from src/qt/res/icons/questionmark.svg rename to src/qt/res/src/questionmark.svg diff --git a/src/qt/transactiontablemodel.cpp b/src/qt/transactiontablemodel.cpp index 27e85cebc5..58ec2c7ace 100644 --- a/src/qt/transactiontablemodel.cpp +++ b/src/qt/transactiontablemodel.cpp @@ -340,58 +340,62 @@ QString TransactionTableModel::lookupAddress(const std::string &address, bool to return description; } -QVariant TransactionTableModel::formatTxType(const TransactionRecord *wtx) const +QString TransactionTableModel::formatTxType(const TransactionRecord *wtx) const { - QString description; - switch(wtx->type) { case TransactionRecord::RecvWithAddress: - description = tr("Received with"); - break; + return tr("Received with"); case TransactionRecord::RecvFromIP: - description = tr("Received from IP"); - break; + return tr("Received from IP"); case TransactionRecord::SendToAddress: - description = tr("Sent to"); - break; + return tr("Sent to"); case TransactionRecord::SendToIP: - description = tr("Sent to IP"); - break; + return tr("Sent to IP"); case TransactionRecord::SendToSelf: - description = tr("Payment to yourself"); - break; + return tr("Payment to yourself"); case TransactionRecord::Generated: - description = tr("Mined"); - break; + return tr("Mined"); + default: + return QString(); } - return QVariant(description); } -QVariant TransactionTableModel::formatTxToAddress(const TransactionRecord *wtx, bool tooltip) const +QVariant TransactionTableModel::txAddressDecoration(const TransactionRecord *wtx) const { - QString description; + switch(wtx->type) + { + case TransactionRecord::Generated: + return QIcon(":/icons/tx_mined"); + case TransactionRecord::RecvWithAddress: + case TransactionRecord::RecvFromIP: + return QIcon(":/icons/tx_input"); + case TransactionRecord::SendToAddress: + case TransactionRecord::SendToIP: + return QIcon(":/icons/tx_output"); + default: + return QIcon(":/icons/tx_inout"); + } + return QVariant(); +} +QString TransactionTableModel::formatTxToAddress(const TransactionRecord *wtx, bool tooltip) const +{ switch(wtx->type) { case TransactionRecord::RecvFromIP: - description = QString::fromStdString(wtx->address); - break; + return QString::fromStdString(wtx->address); case TransactionRecord::RecvWithAddress: case TransactionRecord::SendToAddress: - description = lookupAddress(wtx->address, tooltip); - break; + return lookupAddress(wtx->address, tooltip); case TransactionRecord::SendToIP: - description = QString::fromStdString(wtx->address); - break; + return QString::fromStdString(wtx->address); case TransactionRecord::SendToSelf: - description = QString(); - break; + return QString(); case TransactionRecord::Generated: - description = QString(); - break; + default: + return QString(); } - return QVariant(description); } QVariant TransactionTableModel::addressColor(const TransactionRecord *wtx) const @@ -478,9 +482,12 @@ QVariant TransactionTableModel::data(const QModelIndex &index, int role) const if(role == Qt::DecorationRole) { - if(index.column() == Status) + switch(index.column()) { + case Status: return formatTxDecoration(rec); + case ToAddress: + return txAddressDecoration(rec); } } else if(role == Qt::DisplayRole) @@ -522,7 +529,7 @@ QVariant TransactionTableModel::data(const QModelIndex &index, int role) const case Status: return formatTxStatus(rec); case ToAddress: - return formatTxToAddress(rec, true); + return formatTxType(rec) + QString(" ") + formatTxToAddress(rec, true); } } else if (role == Qt::TextAlignmentRole) diff --git a/src/qt/transactiontablemodel.h b/src/qt/transactiontablemodel.h index 3322ff4af1..71b0644110 100644 --- a/src/qt/transactiontablemodel.h +++ b/src/qt/transactiontablemodel.h @@ -63,10 +63,11 @@ private: QVariant addressColor(const TransactionRecord *wtx) const; QVariant formatTxStatus(const TransactionRecord *wtx) const; QVariant formatTxDate(const TransactionRecord *wtx) const; - QVariant formatTxType(const TransactionRecord *wtx) const; - QVariant formatTxToAddress(const TransactionRecord *wtx, bool tooltip) const; + QString formatTxType(const TransactionRecord *wtx) const; + QString formatTxToAddress(const TransactionRecord *wtx, bool tooltip) const; QVariant formatTxAmount(const TransactionRecord *wtx, bool showUnconfirmed=true) const; QVariant formatTxDecoration(const TransactionRecord *wtx) const; + QVariant txAddressDecoration(const TransactionRecord *wtx) const; private slots: void update();