17 #include <QDoubleValidator>
18 #include <QHBoxLayout>
19 #include <QVBoxLayout>
22 #include <QHeaderView>
23 #include <QMessageBox>
27 #include <QDateTimeEdit>
30 QWidget(parent), model(0), transactionProxyModel(0),
34 setContentsMargins(0,0,0,0);
36 QHBoxLayout *hlayout =
new QHBoxLayout();
37 hlayout->setContentsMargins(0,0,0,0);
39 hlayout->setSpacing(5);
40 hlayout->addSpacing(26);
42 hlayout->setSpacing(0);
43 hlayout->addSpacing(23);
80 #if QT_VERSION >= 0x040700
82 addressWidget->setPlaceholderText(tr(
"Enter address or label to search"));
87 #if QT_VERSION >= 0x040700
96 amountWidget->setValidator(
new QDoubleValidator(0, 1e20, 8,
this));
99 QVBoxLayout *vlayout =
new QVBoxLayout(
this);
100 vlayout->setContentsMargins(0,0,0,0);
101 vlayout->setSpacing(0);
103 QTableView *view =
new QTableView(
this);
104 vlayout->addLayout(hlayout);
106 vlayout->addWidget(view);
107 vlayout->setSpacing(0);
108 int width = view->verticalScrollBar()->sizeHint().width();
111 hlayout->addSpacing(width+2);
113 hlayout->addSpacing(width);
116 view->setVerticalScrollBarPolicy(Qt::ScrollBarAlwaysOn);
117 view->setTabKeyNavigation(
false);
118 view->setContextMenuPolicy(Qt::CustomContextMenu);
123 QAction *copyAddressAction =
new QAction(tr(
"Copy address"),
this);
124 QAction *copyLabelAction =
new QAction(tr(
"Copy label"),
this);
125 QAction *copyAmountAction =
new QAction(tr(
"Copy amount"),
this);
126 QAction *copyTxIDAction =
new QAction(tr(
"Copy transaction ID"),
this);
127 QAction *editLabelAction =
new QAction(tr(
"Edit label"),
this);
128 QAction *showDetailsAction =
new QAction(tr(
"Show transaction details"),
this);
145 connect(view, SIGNAL(customContextMenuRequested(QPoint)),
this, SLOT(
contextualMenu(QPoint)));
147 connect(copyAddressAction, SIGNAL(triggered()),
this, SLOT(
copyAddress()));
148 connect(copyLabelAction, SIGNAL(triggered()),
this, SLOT(
copyLabel()));
149 connect(copyAmountAction, SIGNAL(triggered()),
this, SLOT(
copyAmount()));
150 connect(copyTxIDAction, SIGNAL(triggered()),
this, SLOT(
copyTxID()));
151 connect(editLabelAction, SIGNAL(triggered()),
this, SLOT(
editLabel()));
152 connect(showDetailsAction, SIGNAL(triggered()),
this, SLOT(
showDetails()));
171 transactionView->setSelectionMode(QAbstractItemView::ExtendedSelection);
179 #if QT_VERSION < 0x050000
192 QDate current = QDate::currentDate();
208 QDate startOfWeek = current.addDays(-(current.dayOfWeek()-1));
210 QDateTime(startOfWeek),
216 QDateTime(QDate(current.year(), current.month(), 1)),
221 QDateTime(QDate(current.year(), current.month()-1, 1)),
222 QDateTime(QDate(current.year(), current.month(), 1)));
226 QDateTime(QDate(current.year(), 1, 1)),
255 qint64 amount_parsed = 0;
271 tr(
"Export Transaction Data"), QString(),
272 tr(
"Comma separated file (*.csv)"));
274 if (filename.isNull())
return;
290 QMessageBox::critical(
this, tr(
"Error exporting"), tr(
"Could not write to file %1.").
arg(filename),
291 QMessageBox::Abort, QMessageBox::Abort);
328 QModelIndexList selection =
transactionView->selectionModel()->selectedRows();
329 if(!selection.isEmpty())
335 if(address.isEmpty())
346 QModelIndex modelIdx = addressBook->
index(idx, 0, QModelIndex());
374 QModelIndexList selection =
transactionView->selectionModel()->selectedRows();
375 if(!selection.isEmpty())
388 layout->setContentsMargins(0,0,0,0);
389 layout->addSpacing(23);
390 layout->addWidget(
new QLabel(tr(
"Range:")));
393 dateFrom->setDisplayFormat(
"dd/MM/yy");
396 dateFrom->setDate(QDate::currentDate().addDays(-7));
398 layout->addWidget(
new QLabel(tr(
"to")));
400 dateTo =
new QDateTimeEdit(
this);
401 dateTo->setDisplayFormat(
"dd/MM/yy");
402 dateTo->setCalendarPopup(
true);
403 dateTo->setMinimumWidth(100);
404 dateTo->setDate(QDate::currentDate());
405 layout->addWidget(
dateTo);
406 layout->addStretch();
424 QDateTime(
dateTo->date()).addDays(1));
void changedPrefix(const QString &prefix)
TransactionView(QWidget *parent=0)
void addColumn(const QString &title, int column, int role=Qt::EditRole)
QModelIndex index(int row, int column, const QModelIndex &parent) const
QWidget * createDateRangeWidget()
Dialog showing transaction details.
int lookupAddress(const QString &address) const
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 focusTransaction(const QModelIndex &)
TransactionRecord * index(int idx)
void setTypeFilter(quint32 modes)
QTableView * transactionView
AddressTableModel * getAddressTableModel()
Export a Qt table model to a CSV file.
TransactionTableModel * parent
void setAddressPrefix(const QString &addrPrefix)
static quint32 TYPE(int type)
void setModel(AddressTableModel *model)
static const QDateTime MIN_DATE
Earliest date that can be represented (far in the past)
static const QDateTime MAX_DATE
Last date that can be represented (far in the future)
void setDateRange(const QDateTime &from, const QDateTime &to)
Is transaction confirmed?
void changedAmount(const QString &amount)
void setMinAmount(qint64 minimum)
Date and time this transaction was created.
TransactionTableModel * getTransactionTableModel()
Qt model of the address book in the core.
TransactionFilterProxy * transactionProxyModel
void setModel(const QAbstractItemModel *model)
void setModel(WalletModel *model)
QVariant data(const QModelIndex &index, int role) const
Filter the transaction list according to pre-specified rules.
void setAddress(const QString &address)
Interface to Bitcoin wallet from Qt view code.
static const QString Receive
Specifies receive address.
Dialog for editing an address and associated information.
static bool parse(int unit, const QString &value, qint64 *val_out)
Parse string to coin amount.
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.
bool write()
Perform export of the model to CSV.
void doubleClicked(const QModelIndex &)
Type of address (Send or Receive)
OptionsModel * getOptionsModel()