25 #include <QDateTimeEdit> 26 #include <QDesktopServices> 27 #include <QDoubleValidator> 28 #include <QHBoxLayout> 29 #include <QHeaderView> 35 #include <QSignalMapper> 39 #include <QVBoxLayout> 42 QWidget(parent), model(0), transactionProxyModel(0),
43 transactionView(0), abandonAction(0), bumpFeeAction(0), columnResizingFixer(0)
46 setContentsMargins(0,0,0,0);
48 QHBoxLayout *hlayout =
new QHBoxLayout();
49 hlayout->setContentsMargins(6,6,6,6);
50 hlayout->setSpacing(10);
89 #if QT_VERSION >= 0x040700 90 addressWidget->setPlaceholderText(tr(
"Enter address or label to search"));
95 #if QT_VERSION >= 0x040700 99 amountWidget->setValidator(
new QDoubleValidator(0, 1e20, 8,
this));
103 static const int input_filter_delay = 200;
105 QTimer* amount_typing_delay =
new QTimer(
this);
106 amount_typing_delay->setSingleShot(
true);
107 amount_typing_delay->setInterval(input_filter_delay);
109 QTimer* prefix_typing_delay =
new QTimer(
this);
110 prefix_typing_delay->setSingleShot(
true);
111 prefix_typing_delay->setInterval(input_filter_delay);
113 QVBoxLayout *vlayout =
new QVBoxLayout(
this);
114 vlayout->setContentsMargins(0,0,0,0);
115 vlayout->setSpacing(0);
117 QTableView *view =
new QTableView(
this);
118 vlayout->addLayout(hlayout);
120 vlayout->addWidget(view);
121 vlayout->setSpacing(0);
122 int width = view->verticalScrollBar()->sizeHint().width();
125 hlayout->addSpacing(width+2);
127 hlayout->addSpacing(width);
130 view->setVerticalScrollBarPolicy(Qt::ScrollBarAlwaysOn);
131 view->setTabKeyNavigation(
false);
132 view->setContextMenuPolicy(Qt::CustomContextMenu);
134 view->installEventFilter(
this);
140 abandonAction =
new QAction(tr(
"Abandon transaction"),
this);
141 bumpFeeAction =
new QAction(tr(
"Increase transaction fee"),
this);
143 QAction *copyAddressAction =
new QAction(tr(
"Copy address"),
this);
144 QAction *copyLabelAction =
new QAction(tr(
"Copy label"),
this);
145 QAction *copyAmountAction =
new QAction(tr(
"Copy amount"),
this);
146 QAction *copyTxIDAction =
new QAction(tr(
"Copy transaction ID"),
this);
147 QAction *copyTxHexAction =
new QAction(tr(
"Copy raw transaction"),
this);
148 QAction *
copyTxPlainText =
new QAction(tr(
"Copy full transaction details"),
this);
149 QAction *editLabelAction =
new QAction(tr(
"Edit label"),
this);
150 QAction *showDetailsAction =
new QAction(tr(
"Show transaction details"),
this);
174 connect(
amountWidget, SIGNAL(textChanged(QString)), amount_typing_delay, SLOT(start()));
175 connect(amount_typing_delay, SIGNAL(timeout()),
this, SLOT(
changedAmount()));
176 connect(
addressWidget, SIGNAL(textChanged(QString)), prefix_typing_delay, SLOT(start()));
177 connect(prefix_typing_delay, SIGNAL(timeout()),
this, SLOT(
changedPrefix()));
180 connect(view, SIGNAL(customContextMenuRequested(QPoint)),
this, SLOT(
contextualMenu(QPoint)));
184 connect(copyAddressAction, SIGNAL(triggered()),
this, SLOT(
copyAddress()));
185 connect(copyLabelAction, SIGNAL(triggered()),
this, SLOT(
copyLabel()));
186 connect(copyAmountAction, SIGNAL(triggered()),
this, SLOT(
copyAmount()));
187 connect(copyTxIDAction, SIGNAL(triggered()),
this, SLOT(
copyTxID()));
188 connect(copyTxHexAction, SIGNAL(triggered()),
this, SLOT(
copyTxHex()));
189 connect(copyTxPlainText, SIGNAL(triggered()),
this, SLOT(
copyTxPlainText()));
190 connect(editLabelAction, SIGNAL(triggered()),
this, SLOT(
editLabel()));
191 connect(showDetailsAction, SIGNAL(triggered()),
this, SLOT(
showDetails()));
196 this->
model = _model;
211 transactionView->setSelectionMode(QAbstractItemView::ExtendedSelection);
228 for (
int i = 0; i < listUrls.size(); ++i)
230 QString host = QUrl(listUrls[i].trimmed(), QUrl::StrictMode).host();
233 QAction *thirdPartyTxUrlAction =
new QAction(host,
this);
255 QDate current = QDate::currentDate();
271 QDate startOfWeek = current.addDays(-(current.dayOfWeek()-1));
273 QDateTime(startOfWeek),
279 QDateTime(QDate(current.year(), current.month(), 1)),
284 QDateTime(QDate(current.year(), current.month(), 1).addMonths(-1)),
285 QDateTime(QDate(current.year(), current.month(), 1)));
289 QDateTime(QDate(current.year(), 1, 1)),
344 tr(
"Export Transaction History"), QString(),
345 tr(
"Comma separated file (*.csv)"),
nullptr);
347 if (filename.isNull())
364 if(!writer.
write()) {
365 Q_EMIT
message(tr(
"Exporting Failed"), tr(
"There was an error trying to save the transaction history to %1.").arg(filename),
369 Q_EMIT
message(tr(
"Exporting Successful"), tr(
"The transaction history was successfully saved to %1.").arg(filename),
377 QModelIndexList selection =
transactionView->selectionModel()->selectedRows(0);
378 if (selection.empty())
397 QModelIndexList selection =
transactionView->selectionModel()->selectedRows(0);
402 hash.
SetHex(hashQStr.toStdString());
415 QModelIndexList selection =
transactionView->selectionModel()->selectedRows(0);
420 hash.
SetHex(hashQStr.toStdString());
463 QModelIndexList selection =
transactionView->selectionModel()->selectedRows();
464 if(!selection.isEmpty())
470 if(address.isEmpty())
481 QModelIndex modelIdx = addressBook->
index(idx, 0, QModelIndex());
509 QModelIndexList selection =
transactionView->selectionModel()->selectedRows();
510 if(!selection.isEmpty())
513 dlg->setAttribute(Qt::WA_DeleteOnClose);
522 QModelIndexList selection =
transactionView->selectionModel()->selectedRows(0);
523 if(!selection.isEmpty())
533 layout->setContentsMargins(0,0,0,0);
534 layout->addSpacing(23);
535 layout->addWidget(
new QLabel(tr(
"Range:")));
538 dateFrom->setDisplayFormat(
"dd/MM/yy");
541 dateFrom->setDate(QDate::currentDate().addDays(-7));
543 layout->addWidget(
new QLabel(tr(
"to")));
545 dateTo =
new QDateTimeEdit(
this);
546 dateTo->setDisplayFormat(
"dd/MM/yy");
547 dateTo->setCalendarPopup(
true);
548 dateTo->setMinimumWidth(100);
549 dateTo->setDate(QDate::currentDate());
550 layout->addWidget(
dateTo);
551 layout->addStretch();
569 QDateTime(
dateTo->date()).addDays(1));
586 QWidget::resizeEvent(event);
593 if (event->type() == QEvent::KeyPress)
595 QKeyEvent *ke =
static_cast<QKeyEvent *
>(event);
596 if (ke->key() == Qt::Key_C && ke->modifiers().testFlag(Qt::ControlModifier))
602 return QWidget::eventFilter(obj, event);
void stretchColumnWidth(int column)
TransactionView(const PlatformStyle *platformStyle, QWidget *parent=0)
bool eventFilter(QObject *obj, QEvent *event)
void addColumn(const QString &title, int column, int role=Qt::EditRole)
QModelIndex index(int row, int column, const QModelIndex &parent) const
void openThirdPartyTxUrl(QString url)
bool abandonTransaction(uint256 hash) const
QWidget * createDateRangeWidget()
Dialog showing transaction details.
int lookupAddress(const QString &address) const
bool bumpFee(uint256 hash)
void updateTransaction(const QString &hash, int status, bool showTransaction)
void focusTransaction(const QModelIndex &)
TransactionRecord * index(int idx)
void setTypeFilter(quint32 modes)
static bool parse(int unit, const QString &value, CAmount *val_out)
Parse string to coin amount.
QTableView * transactionView
AddressTableModel * getAddressTableModel()
Export a Qt table model to a CSV file.
Transaction data, hex-encoded.
TransactionTableModel * parent
bool transactionCanBeAbandoned(uint256 hash) const
void chooseWatchonly(int idx)
void setAddressPrefix(const QString &addrPrefix)
static quint32 TYPE(int type)
int64_t CAmount
Amount in lius (Can be negative)
void setModel(AddressTableModel *model)
static const QDateTime MIN_DATE
Earliest date that can be represented (far in the past)
virtual void resizeEvent(QResizeEvent *event)
static const QDateTime MAX_DATE
Last date that can be represented (far in the future)
Whole transaction as plain text.
QSignalMapper * mapperThirdPartyTxUrls
void setDateRange(const QDateTime &from, const QDateTime &to)
void message(const QString &title, const QString &message, unsigned int style)
Fired when a message should be reported to the user.
Is transaction confirmed?
Makes a QTableView last column feel as if it was being resized from its left border.
Date and time this transaction was created.
void updateWatchOnlyColumn(bool fHaveWatchOnly)
TransactionTableModel * getTransactionTableModel()
bool transactionCanBeBumped(uint256 hash) const
void setWatchOnlyFilter(WatchOnlyFilter filter)
Qt model of the address book in the core.
void setMinAmount(const CAmount &minimum)
TransactionFilterProxy * transactionProxyModel
QComboBox * watchOnlyWidget
static QString getAmountColumnTitle(int unit)
Gets title for amount column including current display unit if optionsModel reference available */...
void setModel(const QAbstractItemModel *model)
void setModel(WalletModel *model)
PlatformStyle::TableColorType type
Filter the transaction list according to pre-specified rules.
void setAddress(const QString &address)
Interface to Fabcoin wallet from Qt view code.
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 ...
static const QString Receive
Specifies receive address.
Dialog for editing an address and associated information.
bool haveWatchOnly() const
Label of address related to transaction.
static const quint32 ALL_TYPES
Type filter bit field (all types)
QLineEdit * addressWidget
void contextualMenu(const QPoint &)
struct evm_uint160be address(struct evm_env *env)
Formatted amount, without brackets when unconfirmed.
void copyEntryData(QAbstractItemView *view, int column, int role)
Copy a field of the currently selected entry of a view to the clipboard.
GUIUtil::TableViewLastColumnResizingFixer * columnResizingFixer
void SetHex(const char *psz)
bool write()
Perform export of the model to CSV.
void doubleClicked(const QModelIndex &)
Type of address (Send or Receive)
OptionsModel * getOptionsModel()
Predefined combinations for certain default usage cases.
QString getThirdPartyTxUrls()