Merge pull request #3598
69d03bc
qt: Fix tab order in send and receive tab (Wladimir J. van der Laan)79fb055
[Qt] minor receive tab improvements (Cozz Lovan)
This commit is contained in:
commit
e16ee005ec
7 changed files with 203 additions and 68 deletions
|
@ -116,7 +116,8 @@ bool BitcoinAmountField::eventFilter(QObject *object, QEvent *event)
|
||||||
QWidget *BitcoinAmountField::setupTabChain(QWidget *prev)
|
QWidget *BitcoinAmountField::setupTabChain(QWidget *prev)
|
||||||
{
|
{
|
||||||
QWidget::setTabOrder(prev, amount);
|
QWidget::setTabOrder(prev, amount);
|
||||||
return amount;
|
QWidget::setTabOrder(amount, unit);
|
||||||
|
return unit;
|
||||||
}
|
}
|
||||||
|
|
||||||
qint64 BitcoinAmountField::value(bool *valid_out) const
|
qint64 BitcoinAmountField::value(bool *valid_out) const
|
||||||
|
|
|
@ -10,7 +10,22 @@
|
||||||
<height>364</height>
|
<height>364</height>
|
||||||
</rect>
|
</rect>
|
||||||
</property>
|
</property>
|
||||||
<layout class="QVBoxLayout" name="verticalLayout">
|
<layout class="QVBoxLayout" name="verticalLayout" stretch="0,0,1">
|
||||||
|
<item>
|
||||||
|
<widget class="QFrame" name="frame2">
|
||||||
|
<property name="sizePolicy">
|
||||||
|
<sizepolicy hsizetype="Preferred" vsizetype="Expanding">
|
||||||
|
<horstretch>0</horstretch>
|
||||||
|
<verstretch>0</verstretch>
|
||||||
|
</sizepolicy>
|
||||||
|
</property>
|
||||||
|
<property name="frameShape">
|
||||||
|
<enum>QFrame::StyledPanel</enum>
|
||||||
|
</property>
|
||||||
|
<property name="frameShadow">
|
||||||
|
<enum>QFrame::Sunken</enum>
|
||||||
|
</property>
|
||||||
|
<layout class="QVBoxLayout" name="verticalLayout_3">
|
||||||
<item>
|
<item>
|
||||||
<layout class="QGridLayout" name="gridLayout">
|
<layout class="QGridLayout" name="gridLayout">
|
||||||
<item row="7" column="2">
|
<item row="7" column="2">
|
||||||
|
@ -32,6 +47,9 @@
|
||||||
</item>
|
</item>
|
||||||
<item row="6" column="0">
|
<item row="6" column="0">
|
||||||
<widget class="QLabel" name="label_3">
|
<widget class="QLabel" name="label_3">
|
||||||
|
<property name="toolTip">
|
||||||
|
<string>An optional message to attach to the payment request, which will be displayed when the request is opened. Note: The message will not be sent with the payment over the Bitcoin network.</string>
|
||||||
|
</property>
|
||||||
<property name="text">
|
<property name="text">
|
||||||
<string>&Message:</string>
|
<string>&Message:</string>
|
||||||
</property>
|
</property>
|
||||||
|
@ -46,7 +64,7 @@
|
||||||
<item row="4" column="2">
|
<item row="4" column="2">
|
||||||
<widget class="QLineEdit" name="reqLabel">
|
<widget class="QLineEdit" name="reqLabel">
|
||||||
<property name="toolTip">
|
<property name="toolTip">
|
||||||
<string>An optional label to associate with the new receiving address</string>
|
<string>An optional label to associate with the new receiving address.</string>
|
||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
|
@ -66,6 +84,9 @@
|
||||||
</item>
|
</item>
|
||||||
<item row="4" column="0">
|
<item row="4" column="0">
|
||||||
<widget class="QLabel" name="label_2">
|
<widget class="QLabel" name="label_2">
|
||||||
|
<property name="toolTip">
|
||||||
|
<string>An optional label to associate with the new receiving address.</string>
|
||||||
|
</property>
|
||||||
<property name="text">
|
<property name="text">
|
||||||
<string>&Label:</string>
|
<string>&Label:</string>
|
||||||
</property>
|
</property>
|
||||||
|
@ -79,6 +100,9 @@
|
||||||
</item>
|
</item>
|
||||||
<item row="5" column="0">
|
<item row="5" column="0">
|
||||||
<widget class="QLabel" name="label">
|
<widget class="QLabel" name="label">
|
||||||
|
<property name="toolTip">
|
||||||
|
<string>An optional amount to request. Leave this empty or zero to not request a specific amount.</string>
|
||||||
|
</property>
|
||||||
<property name="text">
|
<property name="text">
|
||||||
<string>&Amount:</string>
|
<string>&Amount:</string>
|
||||||
</property>
|
</property>
|
||||||
|
@ -103,10 +127,25 @@
|
||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
</layout>
|
<item row="8" column="2">
|
||||||
</item>
|
|
||||||
<item>
|
|
||||||
<layout class="QHBoxLayout" name="horizontalLayout">
|
<layout class="QHBoxLayout" name="horizontalLayout">
|
||||||
|
<item>
|
||||||
|
<widget class="QPushButton" name="receiveButton">
|
||||||
|
<property name="minimumSize">
|
||||||
|
<size>
|
||||||
|
<width>150</width>
|
||||||
|
<height>0</height>
|
||||||
|
</size>
|
||||||
|
</property>
|
||||||
|
<property name="text">
|
||||||
|
<string>&Request payment</string>
|
||||||
|
</property>
|
||||||
|
<property name="icon">
|
||||||
|
<iconset resource="../bitcoin.qrc">
|
||||||
|
<normaloff>:/icons/receiving_addresses</normaloff>:/icons/receiving_addresses</iconset>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
<item>
|
<item>
|
||||||
<widget class="QPushButton" name="clearButton">
|
<widget class="QPushButton" name="clearButton">
|
||||||
<property name="sizePolicy">
|
<property name="sizePolicy">
|
||||||
|
@ -146,25 +185,20 @@
|
||||||
</property>
|
</property>
|
||||||
</spacer>
|
</spacer>
|
||||||
</item>
|
</item>
|
||||||
<item>
|
</layout>
|
||||||
<widget class="QPushButton" name="receiveButton">
|
</item>
|
||||||
<property name="minimumSize">
|
<item row="8" column="0">
|
||||||
<size>
|
<widget class="QLabel" name="label_7">
|
||||||
<width>150</width>
|
|
||||||
<height>0</height>
|
|
||||||
</size>
|
|
||||||
</property>
|
|
||||||
<property name="text">
|
<property name="text">
|
||||||
<string>&Request payment</string>
|
<string/>
|
||||||
</property>
|
|
||||||
<property name="icon">
|
|
||||||
<iconset resource="../bitcoin.qrc">
|
|
||||||
<normaloff>:/icons/receiving_addresses</normaloff>:/icons/receiving_addresses</iconset>
|
|
||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
</layout>
|
</layout>
|
||||||
</item>
|
</item>
|
||||||
|
</layout>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
<item>
|
<item>
|
||||||
<spacer name="verticalSpacer_2">
|
<spacer name="verticalSpacer_2">
|
||||||
<property name="orientation">
|
<property name="orientation">
|
||||||
|
@ -173,7 +207,7 @@
|
||||||
<property name="sizeHint" stdset="0">
|
<property name="sizeHint" stdset="0">
|
||||||
<size>
|
<size>
|
||||||
<width>20</width>
|
<width>20</width>
|
||||||
<height>40</height>
|
<height>10</height>
|
||||||
</size>
|
</size>
|
||||||
</property>
|
</property>
|
||||||
</spacer>
|
</spacer>
|
||||||
|
@ -202,12 +236,18 @@
|
||||||
</font>
|
</font>
|
||||||
</property>
|
</property>
|
||||||
<property name="text">
|
<property name="text">
|
||||||
<string>Requested payments</string>
|
<string>Requested payments history</string>
|
||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
<item>
|
<item>
|
||||||
<widget class="QTableView" name="recentRequestsView">
|
<widget class="QTableView" name="recentRequestsView">
|
||||||
|
<property name="contextMenuPolicy">
|
||||||
|
<enum>Qt::CustomContextMenu</enum>
|
||||||
|
</property>
|
||||||
|
<property name="tabKeyNavigation">
|
||||||
|
<bool>false</bool>
|
||||||
|
</property>
|
||||||
<property name="sortingEnabled">
|
<property name="sortingEnabled">
|
||||||
<bool>true</bool>
|
<bool>true</bool>
|
||||||
</property>
|
</property>
|
||||||
|
@ -275,8 +315,8 @@
|
||||||
<tabstop>reqAmount</tabstop>
|
<tabstop>reqAmount</tabstop>
|
||||||
<tabstop>reqMessage</tabstop>
|
<tabstop>reqMessage</tabstop>
|
||||||
<tabstop>reuseAddress</tabstop>
|
<tabstop>reuseAddress</tabstop>
|
||||||
<tabstop>clearButton</tabstop>
|
|
||||||
<tabstop>receiveButton</tabstop>
|
<tabstop>receiveButton</tabstop>
|
||||||
|
<tabstop>clearButton</tabstop>
|
||||||
<tabstop>recentRequestsView</tabstop>
|
<tabstop>recentRequestsView</tabstop>
|
||||||
<tabstop>showRequestButton</tabstop>
|
<tabstop>showRequestButton</tabstop>
|
||||||
<tabstop>removeRequestButton</tabstop>
|
<tabstop>removeRequestButton</tabstop>
|
||||||
|
|
|
@ -657,19 +657,25 @@
|
||||||
<item>
|
<item>
|
||||||
<layout class="QHBoxLayout" name="horizontalLayout">
|
<layout class="QHBoxLayout" name="horizontalLayout">
|
||||||
<item>
|
<item>
|
||||||
<widget class="QPushButton" name="addButton">
|
<widget class="QPushButton" name="sendButton">
|
||||||
|
<property name="minimumSize">
|
||||||
|
<size>
|
||||||
|
<width>150</width>
|
||||||
|
<height>0</height>
|
||||||
|
</size>
|
||||||
|
</property>
|
||||||
<property name="toolTip">
|
<property name="toolTip">
|
||||||
<string>Send to multiple recipients at once</string>
|
<string>Confirm the send action</string>
|
||||||
</property>
|
</property>
|
||||||
<property name="text">
|
<property name="text">
|
||||||
<string>Add &Recipient</string>
|
<string>S&end</string>
|
||||||
</property>
|
</property>
|
||||||
<property name="icon">
|
<property name="icon">
|
||||||
<iconset resource="../bitcoin.qrc">
|
<iconset resource="../bitcoin.qrc">
|
||||||
<normaloff>:/icons/add</normaloff>:/icons/add</iconset>
|
<normaloff>:/icons/send</normaloff>:/icons/send</iconset>
|
||||||
</property>
|
</property>
|
||||||
<property name="autoDefault">
|
<property name="default">
|
||||||
<bool>false</bool>
|
<bool>true</bool>
|
||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
|
@ -699,6 +705,36 @@
|
||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
|
<item>
|
||||||
|
<widget class="QPushButton" name="addButton">
|
||||||
|
<property name="toolTip">
|
||||||
|
<string>Send to multiple recipients at once</string>
|
||||||
|
</property>
|
||||||
|
<property name="text">
|
||||||
|
<string>Add &Recipient</string>
|
||||||
|
</property>
|
||||||
|
<property name="icon">
|
||||||
|
<iconset resource="../bitcoin.qrc">
|
||||||
|
<normaloff>:/icons/add</normaloff>:/icons/add</iconset>
|
||||||
|
</property>
|
||||||
|
<property name="autoDefault">
|
||||||
|
<bool>false</bool>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<spacer name="horizontalSpacer">
|
||||||
|
<property name="orientation">
|
||||||
|
<enum>Qt::Horizontal</enum>
|
||||||
|
</property>
|
||||||
|
<property name="sizeHint" stdset="0">
|
||||||
|
<size>
|
||||||
|
<width>40</width>
|
||||||
|
<height>20</height>
|
||||||
|
</size>
|
||||||
|
</property>
|
||||||
|
</spacer>
|
||||||
|
</item>
|
||||||
<item>
|
<item>
|
||||||
<layout class="QHBoxLayout" name="horizontalLayout_2">
|
<layout class="QHBoxLayout" name="horizontalLayout_2">
|
||||||
<property name="spacing">
|
<property name="spacing">
|
||||||
|
@ -726,42 +762,6 @@
|
||||||
</item>
|
</item>
|
||||||
</layout>
|
</layout>
|
||||||
</item>
|
</item>
|
||||||
<item>
|
|
||||||
<spacer name="horizontalSpacer">
|
|
||||||
<property name="orientation">
|
|
||||||
<enum>Qt::Horizontal</enum>
|
|
||||||
</property>
|
|
||||||
<property name="sizeHint" stdset="0">
|
|
||||||
<size>
|
|
||||||
<width>40</width>
|
|
||||||
<height>20</height>
|
|
||||||
</size>
|
|
||||||
</property>
|
|
||||||
</spacer>
|
|
||||||
</item>
|
|
||||||
<item>
|
|
||||||
<widget class="QPushButton" name="sendButton">
|
|
||||||
<property name="minimumSize">
|
|
||||||
<size>
|
|
||||||
<width>150</width>
|
|
||||||
<height>0</height>
|
|
||||||
</size>
|
|
||||||
</property>
|
|
||||||
<property name="toolTip">
|
|
||||||
<string>Confirm the send action</string>
|
|
||||||
</property>
|
|
||||||
<property name="text">
|
|
||||||
<string>S&end</string>
|
|
||||||
</property>
|
|
||||||
<property name="icon">
|
|
||||||
<iconset resource="../bitcoin.qrc">
|
|
||||||
<normaloff>:/icons/send</normaloff>:/icons/send</iconset>
|
|
||||||
</property>
|
|
||||||
<property name="default">
|
|
||||||
<bool>true</bool>
|
|
||||||
</property>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
</layout>
|
</layout>
|
||||||
</item>
|
</item>
|
||||||
</layout>
|
</layout>
|
||||||
|
|
|
@ -14,6 +14,8 @@
|
||||||
#include "addresstablemodel.h"
|
#include "addresstablemodel.h"
|
||||||
#include "recentrequeststablemodel.h"
|
#include "recentrequeststablemodel.h"
|
||||||
|
|
||||||
|
#include <QAction>
|
||||||
|
#include <QCursor>
|
||||||
#include <QMessageBox>
|
#include <QMessageBox>
|
||||||
#include <QTextDocument>
|
#include <QTextDocument>
|
||||||
#include <QScrollBar>
|
#include <QScrollBar>
|
||||||
|
@ -31,6 +33,24 @@ ReceiveCoinsDialog::ReceiveCoinsDialog(QWidget *parent) :
|
||||||
ui->showRequestButton->setIcon(QIcon());
|
ui->showRequestButton->setIcon(QIcon());
|
||||||
ui->removeRequestButton->setIcon(QIcon());
|
ui->removeRequestButton->setIcon(QIcon());
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
// context menu actions
|
||||||
|
QAction *copyLabelAction = new QAction(tr("Copy label"), this);
|
||||||
|
QAction *copyMessageAction = new QAction(tr("Copy message"), this);
|
||||||
|
QAction *copyAmountAction = new QAction(tr("Copy amount"), this);
|
||||||
|
|
||||||
|
// context menu
|
||||||
|
contextMenu = new QMenu();
|
||||||
|
contextMenu->addAction(copyLabelAction);
|
||||||
|
contextMenu->addAction(copyMessageAction);
|
||||||
|
contextMenu->addAction(copyAmountAction);
|
||||||
|
|
||||||
|
// context menu signals
|
||||||
|
connect(ui->recentRequestsView, SIGNAL(customContextMenuRequested(QPoint)), this, SLOT(showMenu(QPoint)));
|
||||||
|
connect(copyLabelAction, SIGNAL(triggered()), this, SLOT(copyLabel()));
|
||||||
|
connect(copyMessageAction, SIGNAL(triggered()), this, SLOT(copyMessage()));
|
||||||
|
connect(copyAmountAction, SIGNAL(triggered()), this, SLOT(copyAmount()));
|
||||||
|
|
||||||
connect(ui->clearButton, SIGNAL(clicked()), this, SLOT(clear()));
|
connect(ui->clearButton, SIGNAL(clicked()), this, SLOT(clear()));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -164,3 +184,61 @@ void ReceiveCoinsDialog::on_removeRequestButton_clicked()
|
||||||
QModelIndex firstIndex = selection.at(0);
|
QModelIndex firstIndex = selection.at(0);
|
||||||
model->getRecentRequestsTableModel()->removeRows(firstIndex.row(), selection.length(), firstIndex.parent());
|
model->getRecentRequestsTableModel()->removeRows(firstIndex.row(), selection.length(), firstIndex.parent());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void ReceiveCoinsDialog::keyPressEvent(QKeyEvent *event)
|
||||||
|
{
|
||||||
|
if (event->key() == Qt::Key_Return)
|
||||||
|
{
|
||||||
|
// press return -> submit form
|
||||||
|
if (ui->reqLabel->hasFocus() || ui->reqAmount->hasFocus() || ui->reqMessage->hasFocus())
|
||||||
|
{
|
||||||
|
event->ignore();
|
||||||
|
on_receiveButton_clicked();
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
this->QDialog::keyPressEvent(event);
|
||||||
|
}
|
||||||
|
|
||||||
|
// copy column of selected row to clipboard
|
||||||
|
void ReceiveCoinsDialog::copyColumnToClipboard(int column)
|
||||||
|
{
|
||||||
|
if(!model || !model->getRecentRequestsTableModel() || !ui->recentRequestsView->selectionModel())
|
||||||
|
return;
|
||||||
|
QModelIndexList selection = ui->recentRequestsView->selectionModel()->selectedRows();
|
||||||
|
if(selection.empty())
|
||||||
|
return;
|
||||||
|
// correct for selection mode ContiguousSelection
|
||||||
|
QModelIndex firstIndex = selection.at(0);
|
||||||
|
GUIUtil::setClipboard(model->getRecentRequestsTableModel()->data(firstIndex.child(firstIndex.row(), column), Qt::EditRole).toString());
|
||||||
|
}
|
||||||
|
|
||||||
|
// context menu
|
||||||
|
void ReceiveCoinsDialog::showMenu(const QPoint &point)
|
||||||
|
{
|
||||||
|
if(!model || !model->getRecentRequestsTableModel() || !ui->recentRequestsView->selectionModel())
|
||||||
|
return;
|
||||||
|
QModelIndexList selection = ui->recentRequestsView->selectionModel()->selectedRows();
|
||||||
|
if(selection.empty())
|
||||||
|
return;
|
||||||
|
contextMenu->exec(QCursor::pos());
|
||||||
|
}
|
||||||
|
|
||||||
|
// context menu action: copy label
|
||||||
|
void ReceiveCoinsDialog::copyLabel()
|
||||||
|
{
|
||||||
|
copyColumnToClipboard(RecentRequestsTableModel::Label);
|
||||||
|
}
|
||||||
|
|
||||||
|
// context menu action: copy message
|
||||||
|
void ReceiveCoinsDialog::copyMessage()
|
||||||
|
{
|
||||||
|
copyColumnToClipboard(RecentRequestsTableModel::Message);
|
||||||
|
}
|
||||||
|
|
||||||
|
// context menu action: copy amount
|
||||||
|
void ReceiveCoinsDialog::copyAmount()
|
||||||
|
{
|
||||||
|
copyColumnToClipboard(RecentRequestsTableModel::Amount);
|
||||||
|
}
|
||||||
|
|
|
@ -6,6 +6,9 @@
|
||||||
#define RECEIVECOINSDIALOG_H
|
#define RECEIVECOINSDIALOG_H
|
||||||
|
|
||||||
#include <QDialog>
|
#include <QDialog>
|
||||||
|
#include <QKeyEvent>
|
||||||
|
#include <QMenu>
|
||||||
|
#include <QPoint>
|
||||||
#include <QVariant>
|
#include <QVariant>
|
||||||
|
|
||||||
namespace Ui {
|
namespace Ui {
|
||||||
|
@ -34,9 +37,14 @@ public slots:
|
||||||
void reject();
|
void reject();
|
||||||
void accept();
|
void accept();
|
||||||
|
|
||||||
|
protected:
|
||||||
|
virtual void keyPressEvent(QKeyEvent *event);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
Ui::ReceiveCoinsDialog *ui;
|
Ui::ReceiveCoinsDialog *ui;
|
||||||
WalletModel *model;
|
WalletModel *model;
|
||||||
|
QMenu *contextMenu;
|
||||||
|
void copyColumnToClipboard(int column);
|
||||||
|
|
||||||
private slots:
|
private slots:
|
||||||
void on_receiveButton_clicked();
|
void on_receiveButton_clicked();
|
||||||
|
@ -44,6 +52,10 @@ private slots:
|
||||||
void on_removeRequestButton_clicked();
|
void on_removeRequestButton_clicked();
|
||||||
void on_recentRequestsView_doubleClicked(const QModelIndex &index);
|
void on_recentRequestsView_doubleClicked(const QModelIndex &index);
|
||||||
void updateDisplayUnit();
|
void updateDisplayUnit();
|
||||||
|
void showMenu(const QPoint &);
|
||||||
|
void copyLabel();
|
||||||
|
void copyMessage();
|
||||||
|
void copyAmount();
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif // RECEIVECOINSDIALOG_H
|
#endif // RECEIVECOINSDIALOG_H
|
||||||
|
|
|
@ -75,6 +75,9 @@ QVariant RecentRequestsTableModel::data(const QModelIndex &index, int role) cons
|
||||||
return rec->recipient.message;
|
return rec->recipient.message;
|
||||||
}
|
}
|
||||||
case Amount:
|
case Amount:
|
||||||
|
if (rec->recipient.amount == 0 && role == Qt::DisplayRole)
|
||||||
|
return tr("(no amount)");
|
||||||
|
else
|
||||||
return BitcoinUnits::format(walletModel->getOptionsModel()->getDisplayUnit(), rec->recipient.amount);
|
return BitcoinUnits::format(walletModel->getOptionsModel()->getDisplayUnit(), rec->recipient.amount);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -325,9 +325,10 @@ QWidget *SendCoinsDialog::setupTabChain(QWidget *prev)
|
||||||
prev = entry->setupTabChain(prev);
|
prev = entry->setupTabChain(prev);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
QWidget::setTabOrder(prev, ui->addButton);
|
QWidget::setTabOrder(prev, ui->sendButton);
|
||||||
QWidget::setTabOrder(ui->addButton, ui->sendButton);
|
QWidget::setTabOrder(ui->sendButton, ui->clearButton);
|
||||||
return ui->sendButton;
|
QWidget::setTabOrder(ui->clearButton, ui->addButton);
|
||||||
|
return ui->addButton;
|
||||||
}
|
}
|
||||||
|
|
||||||
void SendCoinsDialog::setAddress(const QString &address)
|
void SendCoinsDialog::setAddress(const QString &address)
|
||||||
|
|
Loading…
Reference in a new issue