qt/res/icons/editcopy.png \
qt/res/icons/editpaste.png \
qt/res/icons/export.png \
+ qt/res/icons/eye.png \
+ qt/res/icons/eye_minus.png \
+ qt/res/icons/eye_plus.png \
qt/res/icons/filesave.png \
qt/res/icons/history.png \
qt/res/icons/key.png \
<file alias="transaction_3">res/icons/clock3.png</file>
<file alias="transaction_4">res/icons/clock4.png</file>
<file alias="transaction_5">res/icons/clock5.png</file>
+ <file alias="eye">res/icons/eye.png</file>
+ <file alias="eye_minus">res/icons/eye_minus.png</file>
+ <file alias="eye_plus">res/icons/eye_plus.png</file>
<file alias="options">res/icons/configure.png</file>
<file alias="receiving_addresses">res/icons/receive.png</file>
<file alias="editpaste">res/icons/editpaste.png</file>
}
painter->setPen(foreground);
- painter->drawText(addressRect, Qt::AlignLeft|Qt::AlignVCenter, address);
+ QRect boundingRect;
+ painter->drawText(addressRect, Qt::AlignLeft|Qt::AlignVCenter, address, &boundingRect);
+
+ if (index.data(TransactionTableModel::WatchonlyRole).toBool())
+ {
+ QIcon iconWatchonly = qvariant_cast<QIcon>(index.data(TransactionTableModel::WatchonlyDecorationRole));
+ QRect watchonlyRect(boundingRect.right() + 5, mainRect.top()+ypad+halfheight, 16, halfheight);
+ iconWatchonly.paint(painter, watchonlyRect);
+ }
if(amount < 0)
{
dateTo(MAX_DATE),
addrPrefix(),
typeFilter(ALL_TYPES),
+ watchOnlyFilter(WatchOnlyFilter_All),
minAmount(0),
limitRows(-1),
showInactive(true)
int type = index.data(TransactionTableModel::TypeRole).toInt();
QDateTime datetime = index.data(TransactionTableModel::DateRole).toDateTime();
+ bool involvesWatchAddress = index.data(TransactionTableModel::WatchonlyRole).toBool();
QString address = index.data(TransactionTableModel::AddressRole).toString();
QString label = index.data(TransactionTableModel::LabelRole).toString();
qint64 amount = llabs(index.data(TransactionTableModel::AmountRole).toLongLong());
return false;
if(!(TYPE(type) & typeFilter))
return false;
+ if (involvesWatchAddress && watchOnlyFilter == WatchOnlyFilter_No)
+ return false;
+ if (!involvesWatchAddress && watchOnlyFilter == WatchOnlyFilter_Yes)
+ return false;
if(datetime < dateFrom || datetime > dateTo)
return false;
if (!address.contains(addrPrefix, Qt::CaseInsensitive) && !label.contains(addrPrefix, Qt::CaseInsensitive))
invalidateFilter();
}
+void TransactionFilterProxy::setWatchOnlyFilter(WatchOnlyFilter filter)
+{
+ this->watchOnlyFilter = filter;
+ invalidateFilter();
+}
+
void TransactionFilterProxy::setLimit(int limit)
{
this->limitRows = limit;
static quint32 TYPE(int type) { return 1<<type; }
+ enum WatchOnlyFilter
+ {
+ WatchOnlyFilter_All,
+ WatchOnlyFilter_Yes,
+ WatchOnlyFilter_No
+ };
+
void setDateRange(const QDateTime &from, const QDateTime &to);
void setAddressPrefix(const QString &addrPrefix);
/**
*/
void setTypeFilter(quint32 modes);
void setMinAmount(qint64 minimum);
+ void setWatchOnlyFilter(WatchOnlyFilter filter);
/** Set maximum number of rows returned, -1 if unlimited. */
void setLimit(int limit);
QDateTime dateTo;
QString addrPrefix;
quint32 typeFilter;
+ WatchOnlyFilter watchOnlyFilter;
qint64 minAmount;
int limitRows;
bool showInactive;
// Amount column is right-aligned it contains numbers
static int column_alignments[] = {
Qt::AlignLeft|Qt::AlignVCenter, /* status */
+ Qt::AlignLeft|Qt::AlignVCenter, /* watchonly */
Qt::AlignLeft|Qt::AlignVCenter, /* date */
Qt::AlignLeft|Qt::AlignVCenter, /* type */
Qt::AlignLeft|Qt::AlignVCenter, /* address */
walletModel(parent),
priv(new TransactionTablePriv(wallet, this))
{
- columns << QString() << tr("Date") << tr("Type") << tr("Address") << BitcoinUnits::getAmountColumnTitle(walletModel->getOptionsModel()->getDisplayUnit());
+ columns << QString() << QString() << tr("Date") << tr("Type") << tr("Address") << BitcoinUnits::getAmountColumnTitle(walletModel->getOptionsModel()->getDisplayUnit());
priv->refreshWallet();
connect(walletModel->getOptionsModel(), SIGNAL(displayUnitChanged(int)), this, SLOT(updateDisplayUnit()));
QString TransactionTableModel::formatTxToAddress(const TransactionRecord *wtx, bool tooltip) const
{
- // mark transactions involving watch-only addresses:
- QString watchAddress = wtx->involvesWatchAddress ? " (w) " : "";
-
switch(wtx->type)
{
case TransactionRecord::RecvFromOther:
- return QString::fromStdString(wtx->address) + watchAddress;
+ return QString::fromStdString(wtx->address);
case TransactionRecord::RecvWithAddress:
case TransactionRecord::SendToAddress:
case TransactionRecord::Generated:
- return lookupAddress(wtx->address, tooltip) + watchAddress;
+ return lookupAddress(wtx->address, tooltip);
case TransactionRecord::SendToOther:
- return QString::fromStdString(wtx->address) + watchAddress;
+ return QString::fromStdString(wtx->address);
case TransactionRecord::SendToSelf:
default:
- return tr("(n/a)") + watchAddress;
+ return tr("(n/a)");
}
}
return QColor(0,0,0);
}
+QVariant TransactionTableModel::txWatchonlyDecoration(const TransactionRecord *wtx) const
+{
+ if (wtx->involvesWatchAddress)
+ return QIcon(":/icons/eye");
+ else
+ return QVariant();
+}
+
QString TransactionTableModel::formatTooltip(const TransactionRecord *rec) const
{
QString tooltip = formatTxStatus(rec) + QString("\n") + formatTxType(rec);
{
case Status:
return txStatusDecoration(rec);
+ case Watchonly:
+ return txWatchonlyDecoration(rec);
case ToAddress:
return txAddressDecoration(rec);
}
return rec->time;
case Type:
return formatTxType(rec);
+ case Watchonly:
+ return (rec->involvesWatchAddress ? 1 : 0);
case ToAddress:
return formatTxToAddress(rec, true);
case Amount:
return rec->type;
case DateRole:
return QDateTime::fromTime_t(static_cast<uint>(rec->time));
+ case WatchonlyRole:
+ return rec->involvesWatchAddress;
+ case WatchonlyDecorationRole:
+ return txWatchonlyDecoration(rec);
case LongDescriptionRole:
return priv->describe(rec, walletModel->getOptionsModel()->getDisplayUnit());
case AddressRole:
return tr("Date and time that the transaction was received.");
case Type:
return tr("Type of transaction.");
+ case Watchonly:
+ return tr("Whether or not a watch-only address is involved in this transaction.");
case ToAddress:
return tr("Destination address of transaction.");
case Amount:
enum ColumnIndex {
Status = 0,
- Date = 1,
- Type = 2,
- ToAddress = 3,
- Amount = 4
+ Watchonly = 1,
+ Date = 2,
+ Type = 3,
+ ToAddress = 4,
+ Amount = 5
};
/** Roles to get specific information from a transaction row.
TypeRole = Qt::UserRole,
/** Date and time this transaction was created */
DateRole,
+ /** Watch-only boolean */
+ WatchonlyRole,
+ /** Watch-only icon */
+ WatchonlyDecorationRole,
/** Long description (HTML format) */
LongDescriptionRole,
/** Address of transaction */
QString formatTxAmount(const TransactionRecord *wtx, bool showUnconfirmed=true, BitcoinUnits::SeparatorStyle separators=BitcoinUnits::separatorStandard) const;
QString formatTooltip(const TransactionRecord *rec) const;
QVariant txStatusDecoration(const TransactionRecord *wtx) const;
+ QVariant txWatchonlyDecoration(const TransactionRecord *wtx) const;
QVariant txAddressDecoration(const TransactionRecord *wtx) const;
public slots:
hlayout->addSpacing(23);
#endif
+ watchOnlyWidget = new QComboBox(this);
+ watchOnlyWidget->setFixedWidth(24);
+ watchOnlyWidget->addItem("", TransactionFilterProxy::WatchOnlyFilter_All);
+ watchOnlyWidget->addItem(QIcon(":/icons/eye_plus"), "", TransactionFilterProxy::WatchOnlyFilter_Yes);
+ watchOnlyWidget->addItem(QIcon(":/icons/eye_minus"), "", TransactionFilterProxy::WatchOnlyFilter_No);
+ hlayout->addWidget(watchOnlyWidget);
+
dateWidget = new QComboBox(this);
#ifdef Q_OS_MAC
dateWidget->setFixedWidth(121);
connect(dateWidget, SIGNAL(activated(int)), this, SLOT(chooseDate(int)));
connect(typeWidget, SIGNAL(activated(int)), this, SLOT(chooseType(int)));
+ connect(watchOnlyWidget, SIGNAL(activated(int)), this, SLOT(chooseWatchonly(int)));
connect(addressWidget, SIGNAL(textChanged(QString)), this, SLOT(changedPrefix(QString)));
connect(amountWidget, SIGNAL(textChanged(QString)), this, SLOT(changedAmount(QString)));
transactionView->verticalHeader()->hide();
transactionView->setColumnWidth(TransactionTableModel::Status, STATUS_COLUMN_WIDTH);
+ transactionView->setColumnWidth(TransactionTableModel::Watchonly, WATCHONLY_COLUMN_WIDTH);
transactionView->setColumnWidth(TransactionTableModel::Date, DATE_COLUMN_WIDTH);
transactionView->setColumnWidth(TransactionTableModel::Type, TYPE_COLUMN_WIDTH);
transactionView->setColumnWidth(TransactionTableModel::Amount, AMOUNT_MINIMUM_COLUMN_WIDTH);
}
}
}
+
+ // show/hide column Watch-only
+ updateWatchOnlyColumn(model->haveWatchOnly());
+
+ // Watch-only signal
+ connect(model, SIGNAL(notifyWatchonlyChanged(bool)), this, SLOT(updateWatchOnlyColumn(bool)));
}
}
typeWidget->itemData(idx).toInt());
}
+void TransactionView::chooseWatchonly(int idx)
+{
+ if(!transactionProxyModel)
+ return;
+ transactionProxyModel->setWatchOnlyFilter(
+ (TransactionFilterProxy::WatchOnlyFilter)watchOnlyWidget->itemData(idx).toInt());
+}
+
void TransactionView::changedPrefix(const QString &prefix)
{
if(!transactionProxyModel)
// name, column, role
writer.setModel(transactionProxyModel);
writer.addColumn(tr("Confirmed"), 0, TransactionTableModel::ConfirmedRole);
+ if (model && model->haveWatchOnly())
+ writer.addColumn(tr("Watchonly"), TransactionTableModel::Watchonly);
writer.addColumn(tr("Date"), 0, TransactionTableModel::DateRole);
writer.addColumn(tr("Type"), TransactionTableModel::Type, Qt::EditRole);
writer.addColumn(tr("Label"), 0, TransactionTableModel::LabelRole);
}
return QWidget::eventFilter(obj, event);
}
+
+// show/hide column Watch-only
+void TransactionView::updateWatchOnlyColumn(bool fHaveWatchOnly)
+{
+ watchOnlyWidget->setVisible(fHaveWatchOnly);
+ transactionView->setColumnHidden(TransactionTableModel::Watchonly, !fHaveWatchOnly);
+}
enum ColumnWidths {
STATUS_COLUMN_WIDTH = 23,
+ WATCHONLY_COLUMN_WIDTH = 23,
DATE_COLUMN_WIDTH = 120,
TYPE_COLUMN_WIDTH = 120,
AMOUNT_MINIMUM_COLUMN_WIDTH = 120,
QComboBox *dateWidget;
QComboBox *typeWidget;
+ QComboBox *watchOnlyWidget;
QLineEdit *addressWidget;
QLineEdit *amountWidget;
void copyAmount();
void copyTxID();
void openThirdPartyTxUrl(QString url);
+ void updateWatchOnlyColumn(bool fHaveWatchOnly);
signals:
void doubleClicked(const QModelIndex&);
public slots:
void chooseDate(int idx);
void chooseType(int idx);
+ void chooseWatchonly(int idx);
void changedPrefix(const QString &prefix);
void changedAmount(const QString &amount);
void exportClicked();