15 #include <QDateTimeEdit> 16 #include <QDoubleValidator> 17 #include <QHBoxLayout> 18 #include <QHeaderView> 25 #include <QVBoxLayout> 26 #include <QRegularExpressionValidator> 28 #define paternTokenAmount "^[0-9]{1,59}\\.{1,1}[0-9]{0,18}" 35 columnResizingFixer(0)
38 setContentsMargins(0,0,0,0);
40 QHBoxLayout *hlayout =
new QHBoxLayout();
41 hlayout->setContentsMargins(6,6,6,6);
42 hlayout->setSpacing(10);
67 #if QT_VERSION >= 0x040700 68 addressWidget->setPlaceholderText(tr(
"Enter address to search"));
79 #if QT_VERSION >= 0x040700 84 QRegularExpression regEx;
86 QRegularExpressionValidator *validator =
new QRegularExpressionValidator(
amountWidget);
87 validator->setRegularExpression(regEx);
91 QVBoxLayout *vlayout =
new QVBoxLayout(
this);
92 vlayout->setContentsMargins(0,0,0,0);
93 vlayout->setSpacing(0);
95 QTableView *view =
new QTableView(
this);
96 vlayout->addLayout(hlayout);
98 vlayout->addWidget(view);
99 vlayout->setSpacing(0);
100 int width = view->verticalScrollBar()->sizeHint().width();
103 hlayout->addSpacing(width+2);
105 hlayout->addSpacing(width);
108 view->setVerticalScrollBarPolicy(Qt::ScrollBarAlwaysOn);
109 view->setTabKeyNavigation(
false);
110 view->setContextMenuPolicy(Qt::CustomContextMenu);
112 view->installEventFilter(
this);
116 QAction *copyAddressAction =
new QAction(tr(
"Copy address"),
this);
117 QAction *copyAmountAction =
new QAction(tr(
"Copy amount"),
this);
118 QAction *copyTxIDAction =
new QAction(tr(
"Copy transaction ID"),
this);
119 QAction *
copyTxPlainText =
new QAction(tr(
"Copy full transaction details"),
this);
120 QAction *showDetailsAction =
new QAction(tr(
"Show transaction details"),
this);
135 connect(view, SIGNAL(customContextMenuRequested(QPoint)),
this, SLOT(
contextualMenu(QPoint)));
137 connect(copyAddressAction, SIGNAL(triggered()),
this, SLOT(
copyAddress()));
138 connect(copyAmountAction, SIGNAL(triggered()),
this, SLOT(
copyAmount()));
139 connect(copyTxIDAction, SIGNAL(triggered()),
this, SLOT(
copyTxID()));
140 connect(copyTxPlainText, SIGNAL(triggered()),
this, SLOT(
copyTxPlainText()));
141 connect(showDetailsAction, SIGNAL(triggered()),
this, SLOT(
showDetails()));
147 this->
model = _model;
156 tokenProxyModel->setDynamicSortFilter(
true);
157 tokenProxyModel->setSortCaseSensitivity(Qt::CaseInsensitive);
158 tokenProxyModel->setFilterCaseSensitivity(Qt::CaseInsensitive);
160 tokenProxyModel->setSortRole(Qt::EditRole);
162 tokenView->setHorizontalScrollBarPolicy(Qt::ScrollBarAlwaysOff);
164 tokenView->setAlternatingRowColors(
true);
165 tokenView->setSelectionBehavior(QAbstractItemView::SelectRows);
166 tokenView->setSelectionMode(QAbstractItemView::ExtendedSelection);
187 layout->setContentsMargins(0,0,0,0);
188 layout->addSpacing(23);
189 layout->addWidget(
new QLabel(tr(
"Range:")));
192 dateFrom->setDisplayFormat(
"dd/MM/yy");
195 dateFrom->setDate(QDate::currentDate().addDays(-7));
197 layout->addWidget(
new QLabel(tr(
"to")));
199 dateTo =
new QDateTimeEdit(
this);
200 dateTo->setDisplayFormat(
"dd/MM/yy");
201 dateTo->setCalendarPopup(
true);
202 dateTo->setMinimumWidth(100);
203 dateTo->setDate(QDate::currentDate());
204 layout->addWidget(
dateTo);
205 layout->addStretch();
222 for(
int i = 0; i < tim->
rowCount(); i++)
250 for(
int i = 0; i < tim->
rowCount(); i++)
253 if(name == checkName)
260 if(nameCount == 1 && nameIndex != -1)
267 QWidget::resizeEvent(event);
273 if (event->type() == QEvent::KeyPress)
275 QKeyEvent *ke =
static_cast<QKeyEvent *
>(event);
276 if (ke->key() == Qt::Key_C && ke->modifiers().testFlag(Qt::ControlModifier))
282 return QWidget::eventFilter(obj, event);
288 QModelIndexList selection =
tokenView->selectionModel()->selectedRows(0);
289 if (selection.empty())
304 QDateTime(
dateTo->date()).addDays(1));
311 QModelIndexList selection =
tokenView->selectionModel()->selectedRows();
312 if(!selection.isEmpty())
315 dlg->setAttribute(Qt::WA_DeleteOnClose);
344 QDate current = QDate::currentDate();
360 QDate startOfWeek = current.addDays(-(current.dayOfWeek()-1));
362 QDateTime(startOfWeek),
368 QDateTime(QDate(current.year(), current.month(), 1)),
373 QDateTime(QDate(current.year(), current.month(), 1).addMonths(-1)),
374 QDateTime(QDate(current.year(), current.month(), 1)));
378 QDateTime(QDate(current.year(), 1, 1)),
415 int256_t amount_parsed = 0;
void stretchColumnWidth(int column)
QLineEdit * addressWidget
void setModel(WalletModel *model)
QWidget * createDateRangeWidget()
static quint32 TYPE(int type)
void setTypeFilter(quint32 modes)
int rowCount(const QModelIndex &parent=QModelIndex()) const
void changedAmount(const QString &amount)
void setName(const QString _name)
void contextualMenu(const QPoint &)
void setDateRange(const QDateTime &from, const QDateTime &to)
void setAddressPrefix(const QString &addrPrefix)
std::string toString(string32 const &_s)
Make normal string from fixed-length string.
QVariant data(const QModelIndex &index, int role=Qt::DisplayRole) const
TokenTransactionTableModel * getTokenTransactionTableModel()
static const QDateTime MIN_DATE
Earliest date that can be represented (far in the past)
Dialog showing token details.
Net amount of transaction.
QModelIndex index(int row, int column, const QModelIndex &parent=QModelIndex()) const
static const QDateTime MAX_DATE
Last date that can be represented (far in the future)
static const quint32 ALL_TYPES
Type filter bit field (all types)
TokenTransactionRecord * index(int idx)
TokenTransactionView(const PlatformStyle *platformStyle, QWidget *parent=0)
TokenItemModel * getTokenItemModel()
Makes a QTableView last column feel as if it was being resized from its left border.
GUIUtil::TableViewLastColumnResizingFixer * columnResizingFixer
void setMinAmount(const int256_t &minimum)
TokenTransactionTableModel * parent
bool eventFilter(QObject *obj, QEvent *event)
void addToNameWidget(const QModelIndex &parent, int start, int)
virtual void resizeEvent(QResizeEvent *event)
Whole transaction as plain text.
#define paternTokenAmount
Interface to Fabcoin wallet from Qt view code.
static bool parseToken(int decimal_units, const QString &value, int256_t *val_out)
Parse string to token amount.
void removeFromNameWidget(const QModelIndex &parent, int start, int)
void copyEntryData(QAbstractItemView *view, int column, int role)
Copy a field of the currently selected entry of a view to the clipboard.
void changedPrefix(const QString &prefix)
TokenFilterProxy * tokenProxyModel