aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorWladimir J. van der Laan <laanwj@gmail.com>2014-02-14 07:59:07 +0100
committerGavin Andresen <gavinandresen@gmail.com>2014-02-14 13:25:24 -0500
commit9a3d936fc2e98b1e8234bf27e09cf7bc22811bee (patch)
tree6c04425a46f658ed92568c7a2ede61a6754cbd40 /src
parent2b72d46f4232b58835d44aa3abd711df399d4728 (diff)
qt: GUI for conflicted transactions
- Exclamation mark icon for conflicted transactions - Show mouseover status for conflicted transactions as "conflicted" - Don't show inactive transactions on overview page overview
Diffstat (limited to 'src')
-rw-r--r--src/qt/Makefile.am1
-rw-r--r--src/qt/bitcoin.qrc1
-rw-r--r--src/qt/overviewpage.cpp1
-rw-r--r--src/qt/res/icons/transaction_conflicted.pngbin0 -> 474 bytes
-rw-r--r--src/qt/transactionfilterproxy.cpp13
-rw-r--r--src/qt/transactionfilterproxy.h4
-rw-r--r--src/qt/transactionrecord.cpp6
-rw-r--r--src/qt/transactionrecord.h3
-rw-r--r--src/qt/transactiontablemodel.cpp10
-rw-r--r--src/qt/transactiontablemodel.h4
10 files changed, 37 insertions, 6 deletions
diff --git a/src/qt/Makefile.am b/src/qt/Makefile.am
index 7de47291cc..030804db6e 100644
--- a/src/qt/Makefile.am
+++ b/src/qt/Makefile.am
@@ -243,6 +243,7 @@ RES_ICONS = \
res/icons/toolbar_testnet.png \
res/icons/transaction0.png \
res/icons/transaction2.png \
+ res/icons/transaction_conflicted.png \
res/icons/tx_inout.png \
res/icons/tx_input.png \
res/icons/tx_output.png \
diff --git a/src/qt/bitcoin.qrc b/src/qt/bitcoin.qrc
index 746b5a4092..7c3a7756b7 100644
--- a/src/qt/bitcoin.qrc
+++ b/src/qt/bitcoin.qrc
@@ -12,6 +12,7 @@
<file alias="connect_4">res/icons/connect4_16.png</file>
<file alias="transaction_0">res/icons/transaction0.png</file>
<file alias="transaction_confirmed">res/icons/transaction2.png</file>
+ <file alias="transaction_conflicted">res/icons/transaction_conflicted.png</file>
<file alias="transaction_1">res/icons/clock1.png</file>
<file alias="transaction_2">res/icons/clock2.png</file>
<file alias="transaction_3">res/icons/clock3.png</file>
diff --git a/src/qt/overviewpage.cpp b/src/qt/overviewpage.cpp
index 016097c5a0..1a9d1de571 100644
--- a/src/qt/overviewpage.cpp
+++ b/src/qt/overviewpage.cpp
@@ -175,6 +175,7 @@ void OverviewPage::setWalletModel(WalletModel *model)
filter->setLimit(NUM_ITEMS);
filter->setDynamicSortFilter(true);
filter->setSortRole(Qt::EditRole);
+ filter->setShowInactive(false);
filter->sort(TransactionTableModel::Status, Qt::DescendingOrder);
ui->listTransactions->setModel(filter);
diff --git a/src/qt/res/icons/transaction_conflicted.png b/src/qt/res/icons/transaction_conflicted.png
new file mode 100644
index 0000000000..51fff649ab
--- /dev/null
+++ b/src/qt/res/icons/transaction_conflicted.png
Binary files differ
diff --git a/src/qt/transactionfilterproxy.cpp b/src/qt/transactionfilterproxy.cpp
index a14e74a469..f9546fddb5 100644
--- a/src/qt/transactionfilterproxy.cpp
+++ b/src/qt/transactionfilterproxy.cpp
@@ -5,6 +5,7 @@
#include "transactionfilterproxy.h"
#include "transactiontablemodel.h"
+#include "transactionrecord.h"
#include <cstdlib>
@@ -22,7 +23,8 @@ TransactionFilterProxy::TransactionFilterProxy(QObject *parent) :
addrPrefix(),
typeFilter(ALL_TYPES),
minAmount(0),
- limitRows(-1)
+ limitRows(-1),
+ showInactive(true)
{
}
@@ -35,7 +37,10 @@ bool TransactionFilterProxy::filterAcceptsRow(int sourceRow, const QModelIndex &
QString address = index.data(TransactionTableModel::AddressRole).toString();
QString label = index.data(TransactionTableModel::LabelRole).toString();
qint64 amount = llabs(index.data(TransactionTableModel::AmountRole).toLongLong());
+ int status = index.data(TransactionTableModel::StatusRole).toInt();
+ if(!showInactive && status == TransactionStatus::Conflicted)
+ return false;
if(!(TYPE(type) & typeFilter))
return false;
if(datetime < dateFrom || datetime > dateTo)
@@ -78,6 +83,12 @@ void TransactionFilterProxy::setLimit(int limit)
this->limitRows = limit;
}
+void TransactionFilterProxy::setShowInactive(bool showInactive)
+{
+ this->showInactive = showInactive;
+ invalidateFilter();
+}
+
int TransactionFilterProxy::rowCount(const QModelIndex &parent) const
{
if(limitRows != -1)
diff --git a/src/qt/transactionfilterproxy.h b/src/qt/transactionfilterproxy.h
index 6d1644d48d..9919bc3fd6 100644
--- a/src/qt/transactionfilterproxy.h
+++ b/src/qt/transactionfilterproxy.h
@@ -36,6 +36,9 @@ public:
/** Set maximum number of rows returned, -1 if unlimited. */
void setLimit(int limit);
+ /** Set whether to show conflicted transactions. */
+ void setShowInactive(bool showInactive);
+
int rowCount(const QModelIndex &parent = QModelIndex()) const;
protected:
@@ -48,6 +51,7 @@ private:
quint32 typeFilter;
qint64 minAmount;
int limitRows;
+ bool showInactive;
};
#endif // TRANSACTIONFILTERPROXY_H
diff --git a/src/qt/transactionrecord.cpp b/src/qt/transactionrecord.cpp
index b6614fc371..345ecfb196 100644
--- a/src/qt/transactionrecord.cpp
+++ b/src/qt/transactionrecord.cpp
@@ -183,7 +183,11 @@ void TransactionRecord::updateStatus(const CWalletTx &wtx)
}
else
{
- if (GetAdjustedTime() - wtx.nTimeReceived > 2 * 60 && wtx.GetRequestCount() == 0)
+ if (status.depth < 0)
+ {
+ status.status = TransactionStatus::Conflicted;
+ }
+ else if (GetAdjustedTime() - wtx.nTimeReceived > 2 * 60 && wtx.GetRequestCount() == 0)
{
status.status = TransactionStatus::Offline;
}
diff --git a/src/qt/transactionrecord.h b/src/qt/transactionrecord.h
index 8a7c9044e3..d7be0bc438 100644
--- a/src/qt/transactionrecord.h
+++ b/src/qt/transactionrecord.h
@@ -36,7 +36,8 @@ public:
OpenUntilBlock,
Offline,
Unconfirmed,
- HaveConfirmations
+ HaveConfirmations,
+ Conflicted
};
bool confirmed;
diff --git a/src/qt/transactiontablemodel.cpp b/src/qt/transactiontablemodel.cpp
index b29be7e0cb..9386d46272 100644
--- a/src/qt/transactiontablemodel.cpp
+++ b/src/qt/transactiontablemodel.cpp
@@ -312,7 +312,7 @@ QString TransactionTableModel::formatTxStatus(const TransactionRecord *wtx) cons
status = tr("Open until %1").arg(GUIUtil::dateTimeStr(wtx->status.open_for));
break;
case TransactionStatus::Offline:
- status = tr("Offline (%1 confirmations)").arg(wtx->status.depth);
+ status = tr("Offline");
break;
case TransactionStatus::Unconfirmed:
status = tr("Unconfirmed (%1 of %2 confirmations)").arg(wtx->status.depth).arg(TransactionRecord::NumConfirmations);
@@ -320,6 +320,9 @@ QString TransactionTableModel::formatTxStatus(const TransactionRecord *wtx) cons
case TransactionStatus::HaveConfirmations:
status = tr("Confirmed (%1 confirmations)").arg(wtx->status.depth);
break;
+ case TransactionStatus::Conflicted:
+ status = tr("Conflicted");
+ break;
}
}
@@ -471,7 +474,6 @@ QVariant TransactionTableModel::txStatusDecoration(const TransactionRecord *wtx)
case TransactionStatus::OpenUntilBlock:
case TransactionStatus::OpenUntilDate:
return QColor(64,64,255);
- break;
case TransactionStatus::Offline:
return QColor(192,192,192);
case TransactionStatus::Unconfirmed:
@@ -486,6 +488,8 @@ QVariant TransactionTableModel::txStatusDecoration(const TransactionRecord *wtx)
};
case TransactionStatus::HaveConfirmations:
return QIcon(":/icons/transaction_confirmed");
+ case TransactionStatus::Conflicted:
+ return QIcon(":/icons/transaction_conflicted");
}
}
return QColor(0,0,0);
@@ -587,6 +591,8 @@ QVariant TransactionTableModel::data(const QModelIndex &index, int role) const
rec->status.maturity != TransactionStatus::Mature);
case FormattedAmountRole:
return formatTxAmount(rec, false);
+ case StatusRole:
+ return rec->status.status;
}
return QVariant();
}
diff --git a/src/qt/transactiontablemodel.h b/src/qt/transactiontablemodel.h
index c23c606c31..7b9cf09cbe 100644
--- a/src/qt/transactiontablemodel.h
+++ b/src/qt/transactiontablemodel.h
@@ -53,7 +53,9 @@ public:
/** Is transaction confirmed? */
ConfirmedRole,
/** Formatted amount, without brackets when unconfirmed */
- FormattedAmountRole
+ FormattedAmountRole,
+ /** Transaction status (TransactionRecord::Status) */
+ StatusRole
};
int rowCount(const QModelIndex &parent) const;