aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorWladimir J. van der Laan <laanwj@gmail.com>2011-06-13 09:05:48 +0200
committerWladimir J. van der Laan <laanwj@gmail.com>2011-06-13 09:05:48 +0200
commit249300aebe682dc1a7398794b14f0d6ebde0aee7 (patch)
tree9f1e1a1489e9f16a2db724aa770131d82b5627ef /src
parent92ab03afc847d46db47dd1bd1fbf03a7e0ef7ced (diff)
Status column reorganization
Diffstat (limited to 'src')
-rw-r--r--src/qt/bitcoingui.cpp2
-rw-r--r--src/qt/transactiontablemodel.cpp40
-rw-r--r--src/qt/transactiontablemodel.h1
3 files changed, 38 insertions, 5 deletions
diff --git a/src/qt/bitcoingui.cpp b/src/qt/bitcoingui.cpp
index c08476cec3..3a24c76ab4 100644
--- a/src/qt/bitcoingui.cpp
+++ b/src/qt/bitcoingui.cpp
@@ -261,7 +261,7 @@ void BitcoinGUI::setTabsModel(QAbstractItemModel *transaction_model)
transaction_table->verticalHeader()->hide();
transaction_table->horizontalHeader()->resizeSection(
- TransactionTableModel::Status, 120);
+ TransactionTableModel::Status, 145);
transaction_table->horizontalHeader()->resizeSection(
TransactionTableModel::Date, 120);
transaction_table->horizontalHeader()->setResizeMode(
diff --git a/src/qt/transactiontablemodel.cpp b/src/qt/transactiontablemodel.cpp
index ddfebff3fe..64d99a5bc1 100644
--- a/src/qt/transactiontablemodel.cpp
+++ b/src/qt/transactiontablemodel.cpp
@@ -274,13 +274,13 @@ QVariant TransactionTableModel::formatTxStatus(const TransactionRecord *wtx) con
status = tr("Open until ") + GUIUtil::DateTimeStr(wtx->status.open_for);
break;
case TransactionStatus::Offline:
- status = tr("%1/offline").arg(wtx->status.depth);
+ status = tr("Offline (%1)").arg(wtx->status.depth);
break;
case TransactionStatus::Unconfirmed:
- status = tr("%1/unconfirmed").arg(wtx->status.depth);
+ status = tr("Unconfirmed (%1)").arg(wtx->status.depth);
break;
case TransactionStatus::HaveConfirmations:
- status = tr("%1 confirmations").arg(wtx->status.depth);
+ status = tr("Confirmed (%1)").arg(wtx->status.depth);
break;
}
@@ -400,13 +400,45 @@ QVariant TransactionTableModel::formatTxCredit(const TransactionRecord *wtx) con
}
}
+QVariant TransactionTableModel::formatTxDecoration(const TransactionRecord *wtx) const
+{
+ switch(wtx->status.status)
+ {
+ case TransactionStatus::OpenUntilBlock:
+ case TransactionStatus::OpenUntilDate:
+ return QColor(64,64,255);
+ break;
+ case TransactionStatus::Offline:
+ return QColor(192,192,192);
+ case TransactionStatus::Unconfirmed:
+ if(wtx->status.depth)
+ {
+ return QColor(255,0,0);
+ }
+ else
+ {
+ return QColor(192,192,192);
+ }
+ case TransactionStatus::HaveConfirmations:
+ return QColor(0,255,0);
+ }
+ return QColor(0,0,0);
+}
+
QVariant TransactionTableModel::data(const QModelIndex &index, int role) const
{
if(!index.isValid())
return QVariant();
TransactionRecord *rec = static_cast<TransactionRecord*>(index.internalPointer());
- if(role == Qt::DisplayRole)
+ if(role == Qt::DecorationRole)
+ {
+ if(index.column() == Status)
+ {
+ return formatTxDecoration(rec);
+ }
+ }
+ else if(role == Qt::DisplayRole)
{
/* Delegate to specific column handlers */
switch(index.column())
diff --git a/src/qt/transactiontablemodel.h b/src/qt/transactiontablemodel.h
index 5974c0e7fe..804f004e38 100644
--- a/src/qt/transactiontablemodel.h
+++ b/src/qt/transactiontablemodel.h
@@ -47,6 +47,7 @@ private:
QVariant formatTxDescription(const TransactionRecord *wtx) const;
QVariant formatTxDebit(const TransactionRecord *wtx) const;
QVariant formatTxCredit(const TransactionRecord *wtx) const;
+ QVariant formatTxDecoration(const TransactionRecord *wtx) const;
private slots:
void update();