23 #include <QDateTimeEdit>
24 #include <QDesktopServices>
25 #include <QDoubleValidator>
26 #include <QHBoxLayout>
27 #include <QHeaderView>
33 #include <QSignalMapper>
36 #include <QVBoxLayout>
39 QWidget(parent), model(0), transactionProxyModel(0),
40 transactionView(0), abandonAction(0), columnResizingFixer(0)
43 setContentsMargins(0,0,0,0);
45 QHBoxLayout *hlayout =
new QHBoxLayout();
46 hlayout->setContentsMargins(0,0,0,0);
49 hlayout->setSpacing(5);
50 hlayout->addSpacing(26);
52 hlayout->setSpacing(0);
53 hlayout->addSpacing(23);
97 #if QT_VERSION >= 0x040700
98 addressWidget->setPlaceholderText(tr(
"Enter address or label to search"));
103 #if QT_VERSION >= 0x040700
111 amountWidget->setValidator(
new QDoubleValidator(0, 1e20, 8,
this));
114 QVBoxLayout *vlayout =
new QVBoxLayout(
this);
115 vlayout->setContentsMargins(0,0,0,0);
116 vlayout->setSpacing(0);
118 QTableView *view =
new QTableView(
this);
119 vlayout->addLayout(hlayout);
121 vlayout->addWidget(view);
122 vlayout->setSpacing(0);
123 int width = view->verticalScrollBar()->sizeHint().width();
126 hlayout->addSpacing(width+2);
128 hlayout->addSpacing(width);
131 view->setVerticalScrollBarPolicy(Qt::ScrollBarAlwaysOn);
132 view->setTabKeyNavigation(
false);
133 view->setContextMenuPolicy(Qt::CustomContextMenu);
135 view->installEventFilter(
this);
140 abandonAction =
new QAction(tr(
"Abandon transaction"),
this);
141 QAction *copyAddressAction =
new QAction(tr(
"Copy address"),
this);
142 QAction *copyLabelAction =
new QAction(tr(
"Copy label"),
this);
143 QAction *copyAmountAction =
new QAction(tr(
"Copy amount"),
this);
144 QAction *copyTxIDAction =
new QAction(tr(
"Copy transaction ID"),
this);
145 QAction *copyTxHexAction =
new QAction(tr(
"Copy raw transaction"),
this);
146 QAction *
copyTxPlainText =
new QAction(tr(
"Copy full transaction details"),
this);
147 QAction *editLabelAction =
new QAction(tr(
"Edit label"),
this);
148 QAction *showDetailsAction =
new QAction(tr(
"Show transaction details"),
this);
174 connect(view, SIGNAL(customContextMenuRequested(QPoint)),
this, SLOT(
contextualMenu(QPoint)));
177 connect(copyAddressAction, SIGNAL(triggered()),
this, SLOT(
copyAddress()));
178 connect(copyLabelAction, SIGNAL(triggered()),
this, SLOT(
copyLabel()));
179 connect(copyAmountAction, SIGNAL(triggered()),
this, SLOT(
copyAmount()));
180 connect(copyTxIDAction, SIGNAL(triggered()),
this, SLOT(
copyTxID()));
181 connect(copyTxHexAction, SIGNAL(triggered()),
this, SLOT(
copyTxHex()));
183 connect(editLabelAction, SIGNAL(triggered()),
this, SLOT(
editLabel()));
184 connect(showDetailsAction, SIGNAL(triggered()),
this, SLOT(
showDetails()));
189 this->
model = _model;
204 transactionView->setSelectionMode(QAbstractItemView::ExtendedSelection);
221 for (
int i = 0; i < listUrls.size(); ++i)
223 QUrl
url = QUrl(listUrls[i].trimmed(), QUrl::StrictMode);
224 QString host =
url.host();
225 if (!host.isEmpty() &&
url.scheme() ==
"https")
227 QAction *thirdPartyTxUrlAction =
new QAction(host,
this);
249 QDate current = QDate::currentDate();
265 QDate startOfWeek = current.addDays(-(current.dayOfWeek()-1));
267 QDateTime(startOfWeek),
273 QDateTime(QDate(current.year(), current.month(), 1)),
278 QDateTime(QDate(current.year(), current.month(), 1).addMonths(-1)),
279 QDateTime(QDate(current.year(), current.month(), 1)));
283 QDateTime(QDate(current.year(), 1, 1)),
335 tr(
"Export Transaction History"), QString(),
336 tr(
"Comma separated file (*.csv)"), NULL);
338 if (filename.isNull())
355 if(!writer.
write()) {
356 Q_EMIT
message(tr(
"Exporting Failed"), tr(
"There was an error trying to save the transaction history to %1.").arg(filename),
360 Q_EMIT
message(tr(
"Exporting Successful"), tr(
"The transaction history was successfully saved to %1.").arg(filename),
368 QModelIndexList selection =
transactionView->selectionModel()->selectedRows(0);
369 if (selection.empty())
387 QModelIndexList selection =
transactionView->selectionModel()->selectedRows(0);
392 hash.
SetHex(hashQStr.toStdString());
435 QModelIndexList selection =
transactionView->selectionModel()->selectedRows();
436 if(!selection.isEmpty())
442 if(address.isEmpty())
453 QModelIndex modelIdx = addressBook->
index(idx, 0, QModelIndex());
481 QModelIndexList selection =
transactionView->selectionModel()->selectedRows();
482 if(!selection.isEmpty())
485 dlg->setAttribute(Qt::WA_DeleteOnClose);
494 QModelIndexList selection =
transactionView->selectionModel()->selectedRows(0);
495 if(!selection.isEmpty())
505 layout->setContentsMargins(0,0,0,0);
506 layout->addSpacing(23);
507 layout->addWidget(
new QLabel(tr(
"Range:")));
510 dateFrom->setDisplayFormat(
"dd/MM/yy");
513 dateFrom->setDate(QDate::currentDate().addDays(-7));
515 layout->addWidget(
new QLabel(tr(
"to")));
517 dateTo =
new QDateTimeEdit(
this);
518 dateTo->setDisplayFormat(
"dd/MM/yy");
519 dateTo->setCalendarPopup(
true);
520 dateTo->setMinimumWidth(100);
521 dateTo->setDate(QDate::currentDate());
522 layout->addWidget(
dateTo);
523 layout->addStretch();
541 QDateTime(
dateTo->date()).addDays(1));
558 QWidget::resizeEvent(event);
565 if (event->type() == QEvent::KeyPress)
567 QKeyEvent *ke =
static_cast<QKeyEvent *
>(event);
568 if (ke->key() == Qt::Key_C && ke->modifiers().testFlag(Qt::ControlModifier))
574 return QWidget::eventFilter(obj, event);
int64_t CAmount
Amount in satoshis (Can be negative)
Qt model of the address book in the core.
@ TypeRole
Type of address (Send or Receive)
int lookupAddress(const QString &address) const
QModelIndex index(int row, int column, const QModelIndex &parent) const
QVariant data(const QModelIndex &index, int role) const
static const QString Receive
Specifies receive address.
static bool parse(int unit, const QString &value, CAmount *val_out)
Parse string to coin amount.
static QString getAmountColumnTitle(int unit)
Gets title for amount column including current display unit if optionsModel reference available */.
@ MSG_INFORMATION
Predefined combinations for certain default usage cases.
Export a Qt table model to a CSV file.
bool write()
Perform export of the model to CSV.
void setModel(const QAbstractItemModel *model)
void addColumn(const QString &title, int column, int role=Qt::EditRole)
Dialog for editing an address and associated information.
void setModel(AddressTableModel *model)
void setAddress(const QString &address)
Makes a QTableView last column feel as if it was being resized from its left border.
void stretchColumnWidth(int column)
QString getThirdPartyTxUrls()
Dialog showing transaction details.
Filter the transaction list according to pre-specified rules.
void setMinAmount(const CAmount &minimum)
static const QDateTime MAX_DATE
Last date that can be represented (far in the future)
void setWatchOnlyFilter(WatchOnlyFilter filter)
static const quint32 ALL_TYPES
Type filter bit field (all types)
static quint32 TYPE(int type)
static const QDateTime MIN_DATE
Earliest date that can be represented (far in the past)
void setAddressPrefix(const QString &addrPrefix)
void setDateRange(const QDateTime &from, const QDateTime &to)
void setTypeFilter(quint32 modes)
@ TxPlainTextRole
Whole transaction as plain text.
@ LabelRole
Label of address related to transaction.
@ DateRole
Date and time this transaction was created.
@ TxHashRole
Transaction hash.
@ TxHexRole
Transaction data, hex-encoded.
@ TxIDRole
Unique identifier.
@ AddressRole
Address of transaction.
@ ConfirmedRole
Is transaction confirmed?
@ FormattedAmountRole
Formatted amount, without brackets when unconfirmed.
void updateTransaction(const QString &hash, int status, bool showTransaction)
void changedAmount(const QString &amount)
bool eventFilter(QObject *obj, QEvent *event)
void chooseWatchonly(int idx)
@ AMOUNT_MINIMUM_COLUMN_WIDTH
QLineEdit * addressWidget
QWidget * createDateRangeWidget()
QSignalMapper * mapperThirdPartyTxUrls
void setModel(WalletModel *model)
GUIUtil::TableViewLastColumnResizingFixer * columnResizingFixer
void updateWatchOnlyColumn(bool fHaveWatchOnly)
void message(const QString &title, const QString &message, unsigned int style)
Fired when a message should be reported to the user.
TransactionView(const PlatformStyle *platformStyle, QWidget *parent=0)
virtual void resizeEvent(QResizeEvent *event)
QComboBox * watchOnlyWidget
TransactionFilterProxy * transactionProxyModel
QTableView * transactionView
void focusTransaction(const QModelIndex &)
void contextualMenu(const QPoint &)
void changedPrefix(const QString &prefix)
void openThirdPartyTxUrl(QString url)
void doubleClicked(const QModelIndex &)
Interface to Bitcoin wallet from Qt view code.
bool transactionCanBeAbandoned(uint256 hash) const
AddressTableModel * getAddressTableModel()
OptionsModel * getOptionsModel()
bool abandonTransaction(uint256 hash) const
bool haveWatchOnly() const
TransactionTableModel * getTransactionTableModel()
void SetHex(const char *psz)
QString getSaveFileName(QWidget *parent, const QString &caption, const QString &dir, const QString &filter, QString *selectedSuffixOut)
Get save filename, mimics QFileDialog::getSaveFileName, except that it appends a default suffix when ...
void copyEntryData(QAbstractItemView *view, int column, int role)
Copy a field of the currently selected entry of a view to the clipboard.