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 0000000000..ff6bb1c5c3 Binary files /dev/null and b/src/qt/res/icons/tx_inout.png differ diff --git a/src/qt/res/icons/tx_input.png b/src/qt/res/icons/tx_input.png new file mode 100644 index 0000000000..1673d06ad3 Binary files /dev/null and b/src/qt/res/icons/tx_input.png differ diff --git a/src/qt/res/icons/tx_mined.png b/src/qt/res/icons/tx_mined.png new file mode 100644 index 0000000000..a336868e8a Binary files /dev/null and b/src/qt/res/icons/tx_mined.png differ diff --git a/src/qt/res/icons/tx_output.png b/src/qt/res/icons/tx_output.png new file mode 100644 index 0000000000..0617239e14 Binary files /dev/null and b/src/qt/res/icons/tx_output.png differ 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();