20 #include "validation.h" 27 #include <QDateTimeEdit> 28 #include <QDesktopServices> 29 #include <QDoubleValidator> 30 #include <QHBoxLayout> 31 #include <QHeaderView> 37 #include <QSignalMapper> 41 #include <QVBoxLayout> 42 #include <QGraphicsDropShadowEffect> 45 QWidget(parent), model(0), transactionProxyModel(0),
46 transactionView(0), abandonAction(0), bumpFeeAction(0), columnResizingFixer(0)
49 setContentsMargins(0,0,0,0);
51 QHBoxLayout *hlayout =
new QHBoxLayout();
52 hlayout->setContentsMargins(0,0,0,0);
55 hlayout->setSpacing(5);
56 hlayout->addSpacing(26);
58 hlayout->setSpacing(0);
59 hlayout->addSpacing(23);
103 #if QT_VERSION >= 0x040700 104 addressWidget->setPlaceholderText(tr(
"Enter address or label to search"));
109 #if QT_VERSION >= 0x040700 117 amountWidget->setValidator(
new QDoubleValidator(0, 1e20, 8,
this));
121 #if QT_VERSION >= 0x040700 129 static const int input_filter_delay = 200;
131 QTimer* amount_typing_delay =
new QTimer(
this);
132 amount_typing_delay->setSingleShot(
true);
133 amount_typing_delay->setInterval(input_filter_delay);
135 QTimer* prefix_typing_delay =
new QTimer(
this);
136 prefix_typing_delay->setSingleShot(
true);
137 prefix_typing_delay->setInterval(input_filter_delay);
139 QTimer *asset_typing_delay;
140 asset_typing_delay =
new QTimer(
this);
141 asset_typing_delay->setSingleShot(
true);
142 asset_typing_delay->setInterval(input_filter_delay);
144 QVBoxLayout *vlayout =
new QVBoxLayout(
this);
145 vlayout->setContentsMargins(0,0,0,0);
146 vlayout->setSpacing(0);
148 QTableView *view =
new QTableView(
this);
149 vlayout->addLayout(hlayout);
151 vlayout->addWidget(view);
152 vlayout->setSpacing(0);
153 int width = view->verticalScrollBar()->sizeHint().width();
156 hlayout->addSpacing(width+2);
158 hlayout->addSpacing(width);
161 view->setVerticalScrollBarPolicy(Qt::ScrollBarAlwaysOn);
162 view->setTabKeyNavigation(
false);
163 view->setContextMenuPolicy(Qt::CustomContextMenu);
165 view->installEventFilter(
this);
166 view->setStyleSheet(
".QTableView { border: none;}");
173 abandonAction =
new QAction(tr(
"Abandon transaction"),
this);
176 QAction *copyAddressAction =
new QAction(tr(
"Copy address"),
this);
177 QAction *copyLabelAction =
new QAction(tr(
"Copy label"),
this);
178 QAction *copyAmountAction =
new QAction(tr(
"Copy amount"),
this);
179 QAction *copyTxIDAction =
new QAction(tr(
"Copy transaction ID"),
this);
180 QAction *copyTxHexAction =
new QAction(tr(
"Copy raw transaction"),
this);
181 QAction *
copyTxPlainText =
new QAction(tr(
"Copy full transaction details"),
this);
182 QAction *editLabelAction =
new QAction(tr(
"Edit label"),
this);
183 QAction *showDetailsAction =
new QAction(tr(
"Show transaction details"),
this);
207 connect(
amountWidget, SIGNAL(textChanged(QString)), amount_typing_delay, SLOT(start()));
208 connect(amount_typing_delay, SIGNAL(timeout()),
this, SLOT(
changedAmount()));
209 connect(
assetNameWidget, SIGNAL(textChanged(QString)), asset_typing_delay, SLOT(start()));
210 connect(asset_typing_delay, SIGNAL(timeout()),
this, SLOT(
changedAssetName()));
211 connect(
addressWidget, SIGNAL(textChanged(QString)), prefix_typing_delay, SLOT(start()));
212 connect(prefix_typing_delay, SIGNAL(timeout()),
this, SLOT(
changedPrefix()));
215 connect(view, SIGNAL(customContextMenuRequested(QPoint)),
this, SLOT(
contextualMenu(QPoint)));
219 connect(copyAddressAction, SIGNAL(triggered()),
this, SLOT(
copyAddress()));
220 connect(copyLabelAction, SIGNAL(triggered()),
this, SLOT(
copyLabel()));
221 connect(copyAmountAction, SIGNAL(triggered()),
this, SLOT(
copyAmount()));
222 connect(copyTxIDAction, SIGNAL(triggered()),
this, SLOT(
copyTxID()));
223 connect(copyTxHexAction, SIGNAL(triggered()),
this, SLOT(
copyTxHex()));
224 connect(copyTxPlainText, SIGNAL(triggered()),
this, SLOT(
copyTxPlainText()));
225 connect(editLabelAction, SIGNAL(triggered()),
this, SLOT(
editLabel()));
226 connect(showDetailsAction, SIGNAL(triggered()),
this, SLOT(
showDetails()));
244 this->
model = _model;
259 transactionView->setSelectionMode(QAbstractItemView::ExtendedSelection);
277 for (
int i = 0; i < listUrls.size(); ++i)
279 QString host = QUrl(listUrls[i].trimmed(), QUrl::StrictMode).host();
282 QAction *thirdPartyTxUrlAction =
new QAction(host,
this);
304 QDate current = QDate::currentDate();
320 QDate startOfWeek = current.addDays(-(current.dayOfWeek()-1));
322 QDateTime(startOfWeek),
328 QDateTime(QDate(current.year(), current.month(), 1)),
333 QDateTime(QDate(current.year(), current.month(), 1).addMonths(-1)),
334 QDateTime(QDate(current.year(), current.month(), 1)));
338 QDateTime(QDate(current.year(), 1, 1)),
400 tr(
"Export Transaction History"), QString(),
401 tr(
"Comma separated file (*.csv)"),
nullptr);
403 if (filename.isNull())
423 if(!writer.
write()) {
424 Q_EMIT
message(tr(
"Exporting Failed"), tr(
"There was an error trying to save the transaction history to %1.").arg(filename),
428 Q_EMIT
message(tr(
"Exporting Successful"), tr(
"The transaction history was successfully saved to %1.").arg(filename),
443 QAction *copyAssetNameAction =
new QAction(tr(
"Copy asset name"),
this);
445 connect(copyAssetNameAction, SIGNAL(triggered()),
this, SLOT(
copyAssetName()));
459 QModelIndexList selection =
transactionView->selectionModel()->selectedRows(0);
460 if (selection.empty())
479 QModelIndexList selection =
transactionView->selectionModel()->selectedRows(0);
484 hash.
SetHex(hashQStr.toStdString());
497 QModelIndexList selection =
transactionView->selectionModel()->selectedRows(0);
502 hash.
SetHex(hashQStr.toStdString());
550 QModelIndexList selection =
transactionView->selectionModel()->selectedRows();
551 if(!selection.isEmpty())
557 if(address.isEmpty())
568 QModelIndex modelIdx = addressBook->
index(idx, 0, QModelIndex());
596 QModelIndexList selection =
transactionView->selectionModel()->selectedRows();
597 if(!selection.isEmpty())
600 dlg->setAttribute(Qt::WA_DeleteOnClose);
609 QModelIndexList selection =
transactionView->selectionModel()->selectedRows(0);
610 if(!selection.isEmpty())
620 layout->setContentsMargins(0,0,0,0);
621 layout->addSpacing(23);
622 layout->addWidget(
new QLabel(tr(
"Range:")));
625 dateFrom->setDisplayFormat(
"dd/MM/yy");
628 dateFrom->setDate(QDate::currentDate().addDays(-7));
630 layout->addWidget(
new QLabel(tr(
"to")));
632 dateTo =
new QDateTimeEdit(
this);
633 dateTo->setDisplayFormat(
"dd/MM/yy");
634 dateTo->setCalendarPopup(
true);
635 dateTo->setMinimumWidth(100);
636 dateTo->setDate(QDate::currentDate());
637 layout->addWidget(
dateTo);
638 layout->addStretch();
656 QDateTime(
dateTo->date()).addDays(1));
673 QWidget::resizeEvent(event);
680 if (event->type() == QEvent::KeyPress)
682 QKeyEvent *ke =
static_cast<QKeyEvent *
>(event);
683 if (ke->key() == Qt::Key_C && ke->modifiers().testFlag(Qt::ControlModifier))
689 return QWidget::eventFilter(obj, event);
bool abandonTransaction(uint256 hash) const
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)
void openThirdPartyTxUrl(QString url)
QWidget * createDateRangeWidget()
QModelIndex index(int row, int column, const QModelIndex &parent) const
int lookupAddress(const QString &address) const
Dialog showing transaction details.
bool bumpFee(uint256 hash)
void updateTransaction(const QString &hash, int status, bool showTransaction)
void focusTransaction(const QModelIndex &)
QLineEdit * assetNameWidget
TransactionRecord * index(int idx)
void setTypeFilter(quint32 modes)
bool transactionCanBeAbandoned(uint256 hash) const
QTableView * transactionView
static QString getAmountColumnTitle(int unit)
Gets title for amount column including current display unit if optionsModel reference available */...
AddressTableModel * getAddressTableModel()
Export a Qt table model to a CSV file.
Transaction data, hex-encoded.
TransactionTableModel * parent
bool haveWatchOnly() const
static bool parse(int unit, const QString &value, CAmount *val_out)
Parse string to coin amount.
void chooseWatchonly(int idx)
int getDisplayUnit() const
void setAddressPrefix(const QString &addrPrefix)
static quint32 TYPE(int type)
int64_t CAmount
Amount in corbies (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)
bool AreAssetsDeployed()
RVN START.
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()
void setWatchOnlyFilter(WatchOnlyFilter filter)
Qt model of the address book in the core.
void setMinAmount(const CAmount &minimum)
TransactionFilterProxy * transactionProxyModel
QString getThirdPartyTxUrls() const
QComboBox * watchOnlyWidget
void setModel(const QAbstractItemModel *model)
void setModel(WalletModel *model)
void setAssetNamePrefix(const QString &assetNamePrefix)
Filter the transaction list according to pre-specified rules.
void setAddress(const QString &address)
Interface to Raven 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.
QVariant data(const QModelIndex &index, int role) const
Label of address related to transaction.
static const quint32 ALL_TYPES
Type filter bit field (all types)
QLineEdit * addressWidget
void contextualMenu(const QPoint &)
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.