mirror of
https://github.com/dashpay/dash.git
synced 2024-12-26 20:42:59 +01:00
convert to full tab-based ui
This commit is contained in:
parent
5eaa1b435c
commit
3479849dc4
@ -22,7 +22,7 @@ HEADERS += src/qt/bitcoingui.h \
|
|||||||
src/qt/addresstablemodel.h \
|
src/qt/addresstablemodel.h \
|
||||||
src/qt/optionsdialog.h \
|
src/qt/optionsdialog.h \
|
||||||
src/qt/sendcoinsdialog.h \
|
src/qt/sendcoinsdialog.h \
|
||||||
src/qt/addressbookdialog.h \
|
src/qt/addressbookpage.h \
|
||||||
src/qt/aboutdialog.h \
|
src/qt/aboutdialog.h \
|
||||||
src/qt/editaddressdialog.h \
|
src/qt/editaddressdialog.h \
|
||||||
src/qt/bitcoinaddressvalidator.h \
|
src/qt/bitcoinaddressvalidator.h \
|
||||||
@ -84,7 +84,7 @@ SOURCES += src/qt/bitcoin.cpp src/qt/bitcoingui.cpp \
|
|||||||
src/qt/addresstablemodel.cpp \
|
src/qt/addresstablemodel.cpp \
|
||||||
src/qt/optionsdialog.cpp \
|
src/qt/optionsdialog.cpp \
|
||||||
src/qt/sendcoinsdialog.cpp \
|
src/qt/sendcoinsdialog.cpp \
|
||||||
src/qt/addressbookdialog.cpp \
|
src/qt/addressbookpage.cpp \
|
||||||
src/qt/aboutdialog.cpp \
|
src/qt/aboutdialog.cpp \
|
||||||
src/qt/editaddressdialog.cpp \
|
src/qt/editaddressdialog.cpp \
|
||||||
src/qt/bitcoinaddressvalidator.cpp \
|
src/qt/bitcoinaddressvalidator.cpp \
|
||||||
@ -123,7 +123,7 @@ RESOURCES += \
|
|||||||
|
|
||||||
FORMS += \
|
FORMS += \
|
||||||
src/qt/forms/sendcoinsdialog.ui \
|
src/qt/forms/sendcoinsdialog.ui \
|
||||||
src/qt/forms/addressbookdialog.ui \
|
src/qt/forms/addressbookpage.ui \
|
||||||
src/qt/forms/aboutdialog.ui \
|
src/qt/forms/aboutdialog.ui \
|
||||||
src/qt/forms/editaddressdialog.ui \
|
src/qt/forms/editaddressdialog.ui \
|
||||||
src/qt/forms/transactiondescdialog.ui \
|
src/qt/forms/transactiondescdialog.ui \
|
||||||
|
@ -1,177 +0,0 @@
|
|||||||
#include "addressbookdialog.h"
|
|
||||||
#include "ui_addressbookdialog.h"
|
|
||||||
|
|
||||||
#include "addresstablemodel.h"
|
|
||||||
#include "editaddressdialog.h"
|
|
||||||
|
|
||||||
#include <QSortFilterProxyModel>
|
|
||||||
#include <QClipboard>
|
|
||||||
#include <QDebug>
|
|
||||||
|
|
||||||
AddressBookDialog::AddressBookDialog(Mode mode, QWidget *parent) :
|
|
||||||
QDialog(parent),
|
|
||||||
ui(new Ui::AddressBookDialog),
|
|
||||||
model(0),
|
|
||||||
mode(mode)
|
|
||||||
{
|
|
||||||
ui->setupUi(this);
|
|
||||||
switch(mode)
|
|
||||||
{
|
|
||||||
case ForSending:
|
|
||||||
connect(ui->receiveTableView, SIGNAL(doubleClicked(QModelIndex)), this, SLOT(on_buttonBox_accepted()));
|
|
||||||
connect(ui->sendTableView, SIGNAL(doubleClicked(QModelIndex)), this, SLOT(on_buttonBox_accepted()));
|
|
||||||
ui->sendTableView->setFocus();
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
connect(ui->tabWidget, SIGNAL(currentChanged(int)), this, SLOT(selectionChanged()));
|
|
||||||
}
|
|
||||||
|
|
||||||
AddressBookDialog::~AddressBookDialog()
|
|
||||||
{
|
|
||||||
delete ui;
|
|
||||||
}
|
|
||||||
|
|
||||||
void AddressBookDialog::setModel(AddressTableModel *model)
|
|
||||||
{
|
|
||||||
this->model = model;
|
|
||||||
// Refresh list from core
|
|
||||||
model->updateList();
|
|
||||||
|
|
||||||
// Receive filter
|
|
||||||
QSortFilterProxyModel *receive_model = new QSortFilterProxyModel(this);
|
|
||||||
receive_model->setSourceModel(model);
|
|
||||||
receive_model->setDynamicSortFilter(true);
|
|
||||||
receive_model->setFilterRole(AddressTableModel::TypeRole);
|
|
||||||
receive_model->setFilterFixedString(AddressTableModel::Receive);
|
|
||||||
ui->receiveTableView->setModel(receive_model);
|
|
||||||
ui->receiveTableView->sortByColumn(0, Qt::AscendingOrder);
|
|
||||||
|
|
||||||
// Send filter
|
|
||||||
QSortFilterProxyModel *send_model = new QSortFilterProxyModel(this);
|
|
||||||
send_model->setSourceModel(model);
|
|
||||||
send_model->setDynamicSortFilter(true);
|
|
||||||
send_model->setFilterRole(AddressTableModel::TypeRole);
|
|
||||||
send_model->setFilterFixedString(AddressTableModel::Send);
|
|
||||||
ui->sendTableView->setModel(send_model);
|
|
||||||
ui->sendTableView->sortByColumn(0, Qt::AscendingOrder);
|
|
||||||
|
|
||||||
// Set column widths
|
|
||||||
ui->receiveTableView->horizontalHeader()->resizeSection(
|
|
||||||
AddressTableModel::Address, 320);
|
|
||||||
ui->receiveTableView->horizontalHeader()->setResizeMode(
|
|
||||||
AddressTableModel::Label, QHeaderView::Stretch);
|
|
||||||
ui->sendTableView->horizontalHeader()->resizeSection(
|
|
||||||
AddressTableModel::Address, 320);
|
|
||||||
ui->sendTableView->horizontalHeader()->setResizeMode(
|
|
||||||
AddressTableModel::Label, QHeaderView::Stretch);
|
|
||||||
|
|
||||||
connect(ui->receiveTableView->selectionModel(), SIGNAL(selectionChanged(QItemSelection,QItemSelection)),
|
|
||||||
this, SLOT(selectionChanged()));
|
|
||||||
connect(ui->sendTableView->selectionModel(), SIGNAL(selectionChanged(QItemSelection,QItemSelection)),
|
|
||||||
this, SLOT(selectionChanged()));
|
|
||||||
|
|
||||||
if(mode == ForSending)
|
|
||||||
{
|
|
||||||
// Auto-select first row when in sending mode
|
|
||||||
ui->sendTableView->selectRow(0);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
void AddressBookDialog::setTab(int tab)
|
|
||||||
{
|
|
||||||
ui->tabWidget->setCurrentIndex(tab);
|
|
||||||
selectionChanged();
|
|
||||||
}
|
|
||||||
|
|
||||||
QTableView *AddressBookDialog::getCurrentTable()
|
|
||||||
{
|
|
||||||
switch(ui->tabWidget->currentIndex())
|
|
||||||
{
|
|
||||||
case SendingTab:
|
|
||||||
return ui->sendTableView;
|
|
||||||
case ReceivingTab:
|
|
||||||
return ui->receiveTableView;
|
|
||||||
default:
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
void AddressBookDialog::on_copyToClipboard_clicked()
|
|
||||||
{
|
|
||||||
// Copy currently selected address to clipboard
|
|
||||||
// (or nothing, if nothing selected)
|
|
||||||
QTableView *table = getCurrentTable();
|
|
||||||
QModelIndexList indexes = table->selectionModel()->selectedRows(AddressTableModel::Address);
|
|
||||||
|
|
||||||
foreach (QModelIndex index, indexes)
|
|
||||||
{
|
|
||||||
QVariant address = index.data();
|
|
||||||
QApplication::clipboard()->setText(address.toString());
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
void AddressBookDialog::on_newAddressButton_clicked()
|
|
||||||
{
|
|
||||||
EditAddressDialog dlg(
|
|
||||||
ui->tabWidget->currentIndex() == SendingTab ?
|
|
||||||
EditAddressDialog::NewSendingAddress :
|
|
||||||
EditAddressDialog::NewReceivingAddress);
|
|
||||||
dlg.setModel(model);
|
|
||||||
dlg.exec();
|
|
||||||
}
|
|
||||||
|
|
||||||
void AddressBookDialog::on_deleteButton_clicked()
|
|
||||||
{
|
|
||||||
QTableView *table = getCurrentTable();
|
|
||||||
QModelIndexList indexes = table->selectionModel()->selectedRows();
|
|
||||||
if(!indexes.isEmpty())
|
|
||||||
{
|
|
||||||
table->model()->removeRow(indexes.at(0).row());
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
void AddressBookDialog::on_buttonBox_accepted()
|
|
||||||
{
|
|
||||||
QTableView *table = getCurrentTable();
|
|
||||||
QModelIndexList indexes = table->selectionModel()->selectedRows(AddressTableModel::Address);
|
|
||||||
|
|
||||||
foreach (QModelIndex index, indexes)
|
|
||||||
{
|
|
||||||
QVariant address = table->model()->data(index);
|
|
||||||
returnValue = address.toString();
|
|
||||||
}
|
|
||||||
if(!returnValue.isEmpty())
|
|
||||||
{
|
|
||||||
accept();
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
reject();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
void AddressBookDialog::selectionChanged()
|
|
||||||
{
|
|
||||||
// Set button states based on selected tab and selection
|
|
||||||
QTableView *table = getCurrentTable();
|
|
||||||
|
|
||||||
if(table->selectionModel()->hasSelection())
|
|
||||||
{
|
|
||||||
switch(ui->tabWidget->currentIndex())
|
|
||||||
{
|
|
||||||
case SendingTab:
|
|
||||||
ui->deleteButton->setEnabled(true);
|
|
||||||
break;
|
|
||||||
case ReceivingTab:
|
|
||||||
ui->deleteButton->setEnabled(false);
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
ui->copyToClipboard->setEnabled(true);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
ui->deleteButton->setEnabled(false);
|
|
||||||
ui->copyToClipboard->setEnabled(false);
|
|
||||||
}
|
|
||||||
}
|
|
181
src/qt/addressbookpage.cpp
Normal file
181
src/qt/addressbookpage.cpp
Normal file
@ -0,0 +1,181 @@
|
|||||||
|
#include "addressbookpage.h"
|
||||||
|
#include "ui_addressbookpage.h"
|
||||||
|
|
||||||
|
#include "addresstablemodel.h"
|
||||||
|
#include "editaddressdialog.h"
|
||||||
|
|
||||||
|
#include <QSortFilterProxyModel>
|
||||||
|
#include <QClipboard>
|
||||||
|
#include <QDebug>
|
||||||
|
|
||||||
|
AddressBookPage::AddressBookPage(Mode mode, Tabs tab, QWidget *parent) :
|
||||||
|
QDialog(parent),
|
||||||
|
ui(new Ui::AddressBookPage),
|
||||||
|
model(0),
|
||||||
|
mode(mode),
|
||||||
|
tab(tab)
|
||||||
|
{
|
||||||
|
ui->setupUi(this);
|
||||||
|
switch(mode)
|
||||||
|
{
|
||||||
|
case ForSending:
|
||||||
|
connect(ui->tableView, SIGNAL(doubleClicked(QModelIndex)), this, SLOT(on_buttonBox_accepted()));
|
||||||
|
ui->tableView->setFocus();
|
||||||
|
break;
|
||||||
|
case ForEditing:
|
||||||
|
ui->buttonBox->hide();
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
switch(tab)
|
||||||
|
{
|
||||||
|
case SendingTab:
|
||||||
|
ui->labelExplanation->hide();
|
||||||
|
break;
|
||||||
|
case ReceivingTab:
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
AddressBookPage::~AddressBookPage()
|
||||||
|
{
|
||||||
|
delete ui;
|
||||||
|
}
|
||||||
|
|
||||||
|
void AddressBookPage::setModel(AddressTableModel *model)
|
||||||
|
{
|
||||||
|
this->model = model;
|
||||||
|
// Refresh list from core
|
||||||
|
model->updateList();
|
||||||
|
|
||||||
|
switch(tab)
|
||||||
|
{
|
||||||
|
case ReceivingTab: {
|
||||||
|
// Receive filter
|
||||||
|
QSortFilterProxyModel *receive_model = new QSortFilterProxyModel(this);
|
||||||
|
receive_model->setSourceModel(model);
|
||||||
|
receive_model->setDynamicSortFilter(true);
|
||||||
|
receive_model->setFilterRole(AddressTableModel::TypeRole);
|
||||||
|
receive_model->setFilterFixedString(AddressTableModel::Receive);
|
||||||
|
ui->tableView->setModel(receive_model);
|
||||||
|
ui->tableView->sortByColumn(0, Qt::AscendingOrder);
|
||||||
|
} break;
|
||||||
|
case SendingTab: {
|
||||||
|
// Send filter
|
||||||
|
QSortFilterProxyModel *send_model = new QSortFilterProxyModel(this);
|
||||||
|
send_model->setSourceModel(model);
|
||||||
|
send_model->setDynamicSortFilter(true);
|
||||||
|
send_model->setFilterRole(AddressTableModel::TypeRole);
|
||||||
|
send_model->setFilterFixedString(AddressTableModel::Send);
|
||||||
|
ui->tableView->setModel(send_model);
|
||||||
|
ui->tableView->sortByColumn(0, Qt::AscendingOrder);
|
||||||
|
} break;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Set column widths
|
||||||
|
ui->tableView->horizontalHeader()->resizeSection(
|
||||||
|
AddressTableModel::Address, 320);
|
||||||
|
ui->tableView->horizontalHeader()->setResizeMode(
|
||||||
|
AddressTableModel::Label, QHeaderView::Stretch);
|
||||||
|
|
||||||
|
connect(ui->tableView->selectionModel(), SIGNAL(selectionChanged(QItemSelection,QItemSelection)),
|
||||||
|
this, SLOT(selectionChanged()));
|
||||||
|
|
||||||
|
if(mode == ForSending)
|
||||||
|
{
|
||||||
|
// Auto-select first row when in sending mode
|
||||||
|
ui->tableView->selectRow(0);
|
||||||
|
}
|
||||||
|
selectionChanged();
|
||||||
|
}
|
||||||
|
|
||||||
|
QTableView *AddressBookPage::getCurrentTable()
|
||||||
|
{
|
||||||
|
return ui->tableView;
|
||||||
|
}
|
||||||
|
|
||||||
|
void AddressBookPage::on_copyToClipboard_clicked()
|
||||||
|
{
|
||||||
|
// Copy currently selected address to clipboard
|
||||||
|
// (or nothing, if nothing selected)
|
||||||
|
QTableView *table = getCurrentTable();
|
||||||
|
QModelIndexList indexes = table->selectionModel()->selectedRows(AddressTableModel::Address);
|
||||||
|
|
||||||
|
foreach (QModelIndex index, indexes)
|
||||||
|
{
|
||||||
|
QVariant address = index.data();
|
||||||
|
QApplication::clipboard()->setText(address.toString());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void AddressBookPage::on_newAddressButton_clicked()
|
||||||
|
{
|
||||||
|
EditAddressDialog dlg(
|
||||||
|
tab == SendingTab ?
|
||||||
|
EditAddressDialog::NewSendingAddress :
|
||||||
|
EditAddressDialog::NewReceivingAddress);
|
||||||
|
dlg.setModel(model);
|
||||||
|
dlg.exec();
|
||||||
|
}
|
||||||
|
|
||||||
|
void AddressBookPage::on_deleteButton_clicked()
|
||||||
|
{
|
||||||
|
QTableView *table = getCurrentTable();
|
||||||
|
QModelIndexList indexes = table->selectionModel()->selectedRows();
|
||||||
|
if(!indexes.isEmpty())
|
||||||
|
{
|
||||||
|
table->model()->removeRow(indexes.at(0).row());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void AddressBookPage::on_buttonBox_accepted()
|
||||||
|
{
|
||||||
|
QTableView *table = getCurrentTable();
|
||||||
|
QModelIndexList indexes = table->selectionModel()->selectedRows(AddressTableModel::Address);
|
||||||
|
|
||||||
|
foreach (QModelIndex index, indexes)
|
||||||
|
{
|
||||||
|
QVariant address = table->model()->data(index);
|
||||||
|
returnValue = address.toString();
|
||||||
|
}
|
||||||
|
if(!returnValue.isEmpty())
|
||||||
|
{
|
||||||
|
accept();
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
reject();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void AddressBookPage::selectionChanged()
|
||||||
|
{
|
||||||
|
// Set button states based on selected tab and selection
|
||||||
|
QTableView *table = getCurrentTable();
|
||||||
|
|
||||||
|
if(table->selectionModel()->hasSelection())
|
||||||
|
{
|
||||||
|
switch(tab)
|
||||||
|
{
|
||||||
|
case SendingTab:
|
||||||
|
ui->deleteButton->setEnabled(true);
|
||||||
|
break;
|
||||||
|
case ReceivingTab:
|
||||||
|
ui->deleteButton->setEnabled(false);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
ui->copyToClipboard->setEnabled(true);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
ui->deleteButton->setEnabled(false);
|
||||||
|
ui->copyToClipboard->setEnabled(false);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void AddressBookPage::done(int retval)
|
||||||
|
{
|
||||||
|
// When this is a tab/widget and not a model dialog, ignore "done"
|
||||||
|
if(mode == ForEditing)
|
||||||
|
return;
|
||||||
|
QDialog::done(retval);
|
||||||
|
}
|
@ -1,10 +1,10 @@
|
|||||||
#ifndef ADDRESSBOOKDIALOG_H
|
#ifndef ADDRESSBOOKPAGE_H
|
||||||
#define ADDRESSBOOKDIALOG_H
|
#define ADDRESSBOOKPAGE_H
|
||||||
|
|
||||||
#include <QDialog>
|
#include <QDialog>
|
||||||
|
|
||||||
namespace Ui {
|
namespace Ui {
|
||||||
class AddressBookDialog;
|
class AddressBookPage;
|
||||||
}
|
}
|
||||||
class AddressTableModel;
|
class AddressTableModel;
|
||||||
|
|
||||||
@ -13,7 +13,7 @@ class QTableView;
|
|||||||
class QItemSelection;
|
class QItemSelection;
|
||||||
QT_END_NAMESPACE
|
QT_END_NAMESPACE
|
||||||
|
|
||||||
class AddressBookDialog : public QDialog
|
class AddressBookPage : public QDialog
|
||||||
{
|
{
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
|
|
||||||
@ -28,16 +28,20 @@ public:
|
|||||||
ForEditing // Open address book for editing
|
ForEditing // Open address book for editing
|
||||||
};
|
};
|
||||||
|
|
||||||
explicit AddressBookDialog(Mode mode, QWidget *parent = 0);
|
explicit AddressBookPage(Mode mode, Tabs tab, QWidget *parent = 0);
|
||||||
~AddressBookDialog();
|
~AddressBookPage();
|
||||||
|
|
||||||
void setModel(AddressTableModel *model);
|
void setModel(AddressTableModel *model);
|
||||||
void setTab(int tab);
|
|
||||||
const QString &getReturnValue() const { return returnValue; }
|
const QString &getReturnValue() const { return returnValue; }
|
||||||
|
|
||||||
|
public slots:
|
||||||
|
void done(int retval);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
Ui::AddressBookDialog *ui;
|
Ui::AddressBookPage *ui;
|
||||||
AddressTableModel *model;
|
AddressTableModel *model;
|
||||||
Mode mode;
|
Mode mode;
|
||||||
|
Tabs tab;
|
||||||
QString returnValue;
|
QString returnValue;
|
||||||
|
|
||||||
QTableView *getCurrentTable();
|
QTableView *getCurrentTable();
|
@ -46,6 +46,11 @@ void BitcoinAmountField::setText(const QString &text)
|
|||||||
amount->setText(parts[0]);
|
amount->setText(parts[0]);
|
||||||
decimals->setText(parts[1]);
|
decimals->setText(parts[1]);
|
||||||
}
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
amount->setText(QString());
|
||||||
|
decimals->setText(QString());
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
QString BitcoinAmountField::text() const
|
QString BitcoinAmountField::text() const
|
||||||
|
@ -5,7 +5,7 @@
|
|||||||
*/
|
*/
|
||||||
#include "bitcoingui.h"
|
#include "bitcoingui.h"
|
||||||
#include "transactiontablemodel.h"
|
#include "transactiontablemodel.h"
|
||||||
#include "addressbookdialog.h"
|
#include "addressbookpage.h"
|
||||||
#include "sendcoinsdialog.h"
|
#include "sendcoinsdialog.h"
|
||||||
#include "optionsdialog.h"
|
#include "optionsdialog.h"
|
||||||
#include "aboutdialog.h"
|
#include "aboutdialog.h"
|
||||||
@ -54,26 +54,25 @@ BitcoinGUI::BitcoinGUI(QWidget *parent):
|
|||||||
|
|
||||||
// Menus
|
// Menus
|
||||||
QMenu *file = menuBar()->addMenu("&File");
|
QMenu *file = menuBar()->addMenu("&File");
|
||||||
file->addAction(sendCoins);
|
file->addAction(sendCoinsAction);
|
||||||
file->addAction(receiveCoins);
|
file->addAction(receiveCoinsAction);
|
||||||
file->addSeparator();
|
file->addSeparator();
|
||||||
file->addAction(quit);
|
file->addAction(quitAction);
|
||||||
|
|
||||||
QMenu *settings = menuBar()->addMenu("&Settings");
|
QMenu *settings = menuBar()->addMenu("&Settings");
|
||||||
settings->addAction(options);
|
settings->addAction(optionsAction);
|
||||||
|
|
||||||
QMenu *help = menuBar()->addMenu("&Help");
|
QMenu *help = menuBar()->addMenu("&Help");
|
||||||
help->addAction(about);
|
help->addAction(aboutAction);
|
||||||
|
|
||||||
// Toolbar
|
// Toolbar
|
||||||
QToolBar *toolbar = addToolBar("Main toolbar");
|
QToolBar *toolbar = addToolBar("Main toolbar");
|
||||||
toolbar->setToolButtonStyle(Qt::ToolButtonTextBesideIcon);
|
toolbar->setToolButtonStyle(Qt::ToolButtonTextBesideIcon);
|
||||||
toolbar->addAction(overviewAction);
|
toolbar->addAction(overviewAction);
|
||||||
|
toolbar->addAction(sendCoinsAction);
|
||||||
|
toolbar->addAction(receiveCoinsAction);
|
||||||
toolbar->addAction(historyAction);
|
toolbar->addAction(historyAction);
|
||||||
toolbar->addSeparator();
|
toolbar->addAction(addressBookAction);
|
||||||
toolbar->addAction(sendCoins);
|
|
||||||
toolbar->addAction(receiveCoins);
|
|
||||||
toolbar->addAction(addressbook);
|
|
||||||
|
|
||||||
QToolBar *toolbar2 = addToolBar("Transactions toolbar");
|
QToolBar *toolbar2 = addToolBar("Transactions toolbar");
|
||||||
toolbar2->setToolButtonStyle(Qt::ToolButtonTextBesideIcon);
|
toolbar2->setToolButtonStyle(Qt::ToolButtonTextBesideIcon);
|
||||||
@ -90,9 +89,18 @@ BitcoinGUI::BitcoinGUI(QWidget *parent):
|
|||||||
transactionsPage = new QWidget(this);
|
transactionsPage = new QWidget(this);
|
||||||
transactionsPage->setLayout(vbox);
|
transactionsPage->setLayout(vbox);
|
||||||
|
|
||||||
|
addressBookPage = new AddressBookPage(AddressBookPage::ForEditing, AddressBookPage::SendingTab);
|
||||||
|
|
||||||
|
receiveCoinsPage = new AddressBookPage(AddressBookPage::ForEditing, AddressBookPage::ReceivingTab);
|
||||||
|
|
||||||
|
sendCoinsPage = new SendCoinsDialog(this);
|
||||||
|
|
||||||
centralWidget = new QStackedWidget(this);
|
centralWidget = new QStackedWidget(this);
|
||||||
centralWidget->addWidget(overviewPage);
|
centralWidget->addWidget(overviewPage);
|
||||||
centralWidget->addWidget(transactionsPage);
|
centralWidget->addWidget(transactionsPage);
|
||||||
|
centralWidget->addWidget(addressBookPage);
|
||||||
|
centralWidget->addWidget(receiveCoinsPage);
|
||||||
|
centralWidget->addWidget(sendCoinsPage);
|
||||||
setCentralWidget(centralWidget);
|
setCentralWidget(centralWidget);
|
||||||
|
|
||||||
// Create status bar
|
// Create status bar
|
||||||
@ -122,46 +130,57 @@ BitcoinGUI::BitcoinGUI(QWidget *parent):
|
|||||||
|
|
||||||
createTrayIcon();
|
createTrayIcon();
|
||||||
|
|
||||||
gotoOverviewTab();
|
gotoOverviewPage();
|
||||||
}
|
}
|
||||||
|
|
||||||
void BitcoinGUI::createActions()
|
void BitcoinGUI::createActions()
|
||||||
{
|
{
|
||||||
QActionGroup *tabGroup = new QActionGroup(this);
|
QActionGroup *tabGroup = new QActionGroup(this);
|
||||||
|
|
||||||
overviewAction = new QAction(QIcon(":/icons/overview"), tr("&Overview"), this);
|
overviewAction = new QAction(QIcon(":/icons/overview"), tr("&Overview"), this);
|
||||||
overviewAction->setCheckable(true);
|
overviewAction->setCheckable(true);
|
||||||
tabGroup->addAction(overviewAction);
|
tabGroup->addAction(overviewAction);
|
||||||
|
|
||||||
historyAction = new QAction(QIcon(":/icons/history"), tr("&Transactions"), this);
|
historyAction = new QAction(QIcon(":/icons/history"), tr("&Transactions"), this);
|
||||||
historyAction->setCheckable(true);
|
historyAction->setCheckable(true);
|
||||||
tabGroup->addAction(historyAction);
|
tabGroup->addAction(historyAction);
|
||||||
|
|
||||||
connect(overviewAction, SIGNAL(triggered()), this, SLOT(gotoOverviewTab()));
|
addressBookAction = new QAction(QIcon(":/icons/address-book"), tr("&Address Book"), this);
|
||||||
connect(historyAction, SIGNAL(triggered()), this, SLOT(gotoHistoryTab()));
|
addressBookAction->setToolTip(tr("Edit the list of stored addresses and labels"));
|
||||||
|
addressBookAction->setCheckable(true);
|
||||||
|
tabGroup->addAction(addressBookAction);
|
||||||
|
|
||||||
quit = new QAction(QIcon(":/icons/quit"), tr("&Exit"), this);
|
receiveCoinsAction = new QAction(QIcon(":/icons/receiving_addresses"), tr("&Receive coins"), this);
|
||||||
quit->setToolTip(tr("Quit application"));
|
receiveCoinsAction->setToolTip(tr("Show the list of addresses for receiving payments"));
|
||||||
sendCoins = new QAction(QIcon(":/icons/send"), tr("&Send coins"), this);
|
receiveCoinsAction->setCheckable(true);
|
||||||
sendCoins->setToolTip(tr("Send coins to a bitcoin address"));
|
tabGroup->addAction(receiveCoinsAction);
|
||||||
addressbook = new QAction(QIcon(":/icons/address-book"), tr("&Address Book"), this);
|
|
||||||
addressbook->setToolTip(tr("Edit the list of stored addresses and labels"));
|
sendCoinsAction = new QAction(QIcon(":/icons/send"), tr("&Send coins"), this);
|
||||||
about = new QAction(QIcon(":/icons/bitcoin"), tr("&About"), this);
|
sendCoinsAction->setToolTip(tr("Send coins to a bitcoin address"));
|
||||||
about->setToolTip(tr("Show information about Bitcoin"));
|
sendCoinsAction->setCheckable(true);
|
||||||
receiveCoins = new QAction(QIcon(":/icons/receiving_addresses"), tr("&Receive coins"), this);
|
tabGroup->addAction(sendCoinsAction);
|
||||||
receiveCoins->setToolTip(tr("Show the list of addresses for receiving payments"));
|
|
||||||
options = new QAction(QIcon(":/icons/options"), tr("&Options..."), this);
|
connect(overviewAction, SIGNAL(triggered()), this, SLOT(gotoOverviewPage()));
|
||||||
options->setToolTip(tr("Modify configuration options for bitcoin"));
|
connect(historyAction, SIGNAL(triggered()), this, SLOT(gotoHistoryPage()));
|
||||||
openBitcoin = new QAction(QIcon(":/icons/bitcoin"), tr("Open &Bitcoin"), this);
|
connect(addressBookAction, SIGNAL(triggered()), this, SLOT(gotoAddressBookPage()));
|
||||||
openBitcoin->setToolTip(tr("Show the Bitcoin window"));
|
connect(receiveCoinsAction, SIGNAL(triggered()), this, SLOT(gotoReceiveCoinsPage()));
|
||||||
|
connect(sendCoinsAction, SIGNAL(triggered()), this, SLOT(gotoSendCoinsPage()));
|
||||||
|
|
||||||
|
quitAction = new QAction(QIcon(":/icons/quit"), tr("&Exit"), this);
|
||||||
|
quitAction->setToolTip(tr("Quit application"));
|
||||||
|
aboutAction = new QAction(QIcon(":/icons/bitcoin"), tr("&About"), this);
|
||||||
|
aboutAction->setToolTip(tr("Show information about Bitcoin"));
|
||||||
|
optionsAction = new QAction(QIcon(":/icons/options"), tr("&Options..."), this);
|
||||||
|
optionsAction->setToolTip(tr("Modify configuration options for bitcoin"));
|
||||||
|
openBitcoinAction = new QAction(QIcon(":/icons/bitcoin"), tr("Open &Bitcoin"), this);
|
||||||
|
openBitcoinAction->setToolTip(tr("Show the Bitcoin window"));
|
||||||
exportAction = new QAction(QIcon(":/icons/export"), tr("&Export..."), this);
|
exportAction = new QAction(QIcon(":/icons/export"), tr("&Export..."), this);
|
||||||
exportAction->setToolTip(tr("Export data in current view to a file"));
|
exportAction->setToolTip(tr("Export data in current view to a file"));
|
||||||
|
|
||||||
connect(quit, SIGNAL(triggered()), qApp, SLOT(quit()));
|
connect(quitAction, SIGNAL(triggered()), qApp, SLOT(quit()));
|
||||||
connect(sendCoins, SIGNAL(triggered()), this, SLOT(sendCoinsClicked()));
|
connect(optionsAction, SIGNAL(triggered()), this, SLOT(optionsClicked()));
|
||||||
connect(addressbook, SIGNAL(triggered()), this, SLOT(addressbookClicked()));
|
connect(aboutAction, SIGNAL(triggered()), this, SLOT(aboutClicked()));
|
||||||
connect(receiveCoins, SIGNAL(triggered()), this, SLOT(receiveCoinsClicked()));
|
connect(openBitcoinAction, SIGNAL(triggered()), this, SLOT(show()));
|
||||||
connect(options, SIGNAL(triggered()), this, SLOT(optionsClicked()));
|
|
||||||
connect(about, SIGNAL(triggered()), this, SLOT(aboutClicked()));
|
|
||||||
connect(openBitcoin, SIGNAL(triggered()), this, SLOT(show()));
|
|
||||||
connect(exportAction, SIGNAL(triggered()), this, SLOT(exportClicked()));
|
connect(exportAction, SIGNAL(triggered()), this, SLOT(exportClicked()));
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -209,6 +228,10 @@ void BitcoinGUI::setWalletModel(WalletModel *walletModel)
|
|||||||
// Put transaction list in tabs
|
// Put transaction list in tabs
|
||||||
transactionView->setModel(walletModel->getTransactionTableModel());
|
transactionView->setModel(walletModel->getTransactionTableModel());
|
||||||
|
|
||||||
|
addressBookPage->setModel(walletModel->getAddressTableModel());
|
||||||
|
receiveCoinsPage->setModel(walletModel->getAddressTableModel());
|
||||||
|
sendCoinsPage->setModel(walletModel);
|
||||||
|
|
||||||
// Balloon popup for new transaction
|
// Balloon popup for new transaction
|
||||||
connect(walletModel->getTransactionTableModel(), SIGNAL(rowsInserted(const QModelIndex &, int, int)),
|
connect(walletModel->getTransactionTableModel(), SIGNAL(rowsInserted(const QModelIndex &, int, int)),
|
||||||
this, SLOT(incomingTransaction(const QModelIndex &, int, int)));
|
this, SLOT(incomingTransaction(const QModelIndex &, int, int)));
|
||||||
@ -217,11 +240,11 @@ void BitcoinGUI::setWalletModel(WalletModel *walletModel)
|
|||||||
void BitcoinGUI::createTrayIcon()
|
void BitcoinGUI::createTrayIcon()
|
||||||
{
|
{
|
||||||
QMenu *trayIconMenu = new QMenu(this);
|
QMenu *trayIconMenu = new QMenu(this);
|
||||||
trayIconMenu->addAction(openBitcoin);
|
trayIconMenu->addAction(openBitcoinAction);
|
||||||
trayIconMenu->addAction(sendCoins);
|
trayIconMenu->addAction(sendCoinsAction);
|
||||||
trayIconMenu->addAction(options);
|
trayIconMenu->addAction(optionsAction);
|
||||||
trayIconMenu->addSeparator();
|
trayIconMenu->addSeparator();
|
||||||
trayIconMenu->addAction(quit);
|
trayIconMenu->addAction(quitAction);
|
||||||
|
|
||||||
trayIcon = new QSystemTrayIcon(this);
|
trayIcon = new QSystemTrayIcon(this);
|
||||||
trayIcon->setContextMenu(trayIconMenu);
|
trayIcon->setContextMenu(trayIconMenu);
|
||||||
@ -237,33 +260,10 @@ void BitcoinGUI::trayIconActivated(QSystemTrayIcon::ActivationReason reason)
|
|||||||
if(reason == QSystemTrayIcon::DoubleClick)
|
if(reason == QSystemTrayIcon::DoubleClick)
|
||||||
{
|
{
|
||||||
// Doubleclick on system tray icon triggers "open bitcoin"
|
// Doubleclick on system tray icon triggers "open bitcoin"
|
||||||
openBitcoin->trigger();
|
openBitcoinAction->trigger();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void BitcoinGUI::sendCoinsClicked()
|
|
||||||
{
|
|
||||||
SendCoinsDialog dlg;
|
|
||||||
dlg.setModel(walletModel);
|
|
||||||
dlg.exec();
|
|
||||||
}
|
|
||||||
|
|
||||||
void BitcoinGUI::addressbookClicked()
|
|
||||||
{
|
|
||||||
AddressBookDialog dlg(AddressBookDialog::ForEditing);
|
|
||||||
dlg.setModel(walletModel->getAddressTableModel());
|
|
||||||
dlg.setTab(AddressBookDialog::SendingTab);
|
|
||||||
dlg.exec();
|
|
||||||
}
|
|
||||||
|
|
||||||
void BitcoinGUI::receiveCoinsClicked()
|
|
||||||
{
|
|
||||||
AddressBookDialog dlg(AddressBookDialog::ForEditing);
|
|
||||||
dlg.setModel(walletModel->getAddressTableModel());
|
|
||||||
dlg.setTab(AddressBookDialog::ReceivingTab);
|
|
||||||
dlg.exec();
|
|
||||||
}
|
|
||||||
|
|
||||||
void BitcoinGUI::optionsClicked()
|
void BitcoinGUI::optionsClicked()
|
||||||
{
|
{
|
||||||
OptionsDialog dlg;
|
OptionsDialog dlg;
|
||||||
@ -413,20 +413,41 @@ void BitcoinGUI::incomingTransaction(const QModelIndex & parent, int start, int
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void BitcoinGUI::gotoOverviewTab()
|
void BitcoinGUI::gotoOverviewPage()
|
||||||
{
|
{
|
||||||
overviewAction->setChecked(true);
|
overviewAction->setChecked(true);
|
||||||
centralWidget->setCurrentWidget(overviewPage);
|
centralWidget->setCurrentWidget(overviewPage);
|
||||||
exportAction->setEnabled(false);
|
exportAction->setEnabled(false);
|
||||||
}
|
}
|
||||||
|
|
||||||
void BitcoinGUI::gotoHistoryTab()
|
void BitcoinGUI::gotoHistoryPage()
|
||||||
{
|
{
|
||||||
historyAction->setChecked(true);
|
historyAction->setChecked(true);
|
||||||
centralWidget->setCurrentWidget(transactionsPage);
|
centralWidget->setCurrentWidget(transactionsPage);
|
||||||
exportAction->setEnabled(true);
|
exportAction->setEnabled(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void BitcoinGUI::gotoAddressBookPage()
|
||||||
|
{
|
||||||
|
addressBookAction->setChecked(true);
|
||||||
|
centralWidget->setCurrentWidget(addressBookPage);
|
||||||
|
exportAction->setEnabled(false); // TODO
|
||||||
|
}
|
||||||
|
|
||||||
|
void BitcoinGUI::gotoReceiveCoinsPage()
|
||||||
|
{
|
||||||
|
receiveCoinsAction->setChecked(true);
|
||||||
|
centralWidget->setCurrentWidget(receiveCoinsPage);
|
||||||
|
exportAction->setEnabled(false); // TODO
|
||||||
|
}
|
||||||
|
|
||||||
|
void BitcoinGUI::gotoSendCoinsPage()
|
||||||
|
{
|
||||||
|
sendCoinsAction->setChecked(true);
|
||||||
|
centralWidget->setCurrentWidget(sendCoinsPage);
|
||||||
|
exportAction->setEnabled(false);
|
||||||
|
}
|
||||||
|
|
||||||
void BitcoinGUI::exportClicked()
|
void BitcoinGUI::exportClicked()
|
||||||
{
|
{
|
||||||
// Redirect to the right view, as soon as export for other views
|
// Redirect to the right view, as soon as export for other views
|
||||||
|
@ -9,6 +9,8 @@ class ClientModel;
|
|||||||
class WalletModel;
|
class WalletModel;
|
||||||
class TransactionView;
|
class TransactionView;
|
||||||
class OverviewPage;
|
class OverviewPage;
|
||||||
|
class AddressBookPage;
|
||||||
|
class SendCoinsDialog;
|
||||||
|
|
||||||
QT_BEGIN_NAMESPACE
|
QT_BEGIN_NAMESPACE
|
||||||
class QLabel;
|
class QLabel;
|
||||||
@ -45,8 +47,12 @@ private:
|
|||||||
WalletModel *walletModel;
|
WalletModel *walletModel;
|
||||||
|
|
||||||
QStackedWidget *centralWidget;
|
QStackedWidget *centralWidget;
|
||||||
|
|
||||||
OverviewPage *overviewPage;
|
OverviewPage *overviewPage;
|
||||||
QWidget *transactionsPage;
|
QWidget *transactionsPage;
|
||||||
|
AddressBookPage *addressBookPage;
|
||||||
|
AddressBookPage *receiveCoinsPage;
|
||||||
|
SendCoinsDialog *sendCoinsPage;
|
||||||
|
|
||||||
QLabel *labelConnections;
|
QLabel *labelConnections;
|
||||||
QLabel *labelConnectionsIcon;
|
QLabel *labelConnectionsIcon;
|
||||||
@ -56,13 +62,13 @@ private:
|
|||||||
|
|
||||||
QAction *overviewAction;
|
QAction *overviewAction;
|
||||||
QAction *historyAction;
|
QAction *historyAction;
|
||||||
QAction *quit;
|
QAction *quitAction;
|
||||||
QAction *sendCoins;
|
QAction *sendCoinsAction;
|
||||||
QAction *addressbook;
|
QAction *addressBookAction;
|
||||||
QAction *about;
|
QAction *aboutAction;
|
||||||
QAction *receiveCoins;
|
QAction *receiveCoinsAction;
|
||||||
QAction *options;
|
QAction *optionsAction;
|
||||||
QAction *openBitcoin;
|
QAction *openBitcoinAction;
|
||||||
QAction *exportAction;
|
QAction *exportAction;
|
||||||
|
|
||||||
QSystemTrayIcon *trayIcon;
|
QSystemTrayIcon *trayIcon;
|
||||||
@ -85,18 +91,20 @@ public slots:
|
|||||||
void askFee(qint64 nFeeRequired, bool *payFee);
|
void askFee(qint64 nFeeRequired, bool *payFee);
|
||||||
|
|
||||||
private slots:
|
private slots:
|
||||||
void sendCoinsClicked();
|
// UI pages
|
||||||
void addressbookClicked();
|
void gotoOverviewPage();
|
||||||
|
void gotoHistoryPage();
|
||||||
|
void gotoAddressBookPage();
|
||||||
|
void gotoReceiveCoinsPage();
|
||||||
|
void gotoSendCoinsPage();
|
||||||
|
|
||||||
|
// Misc actions
|
||||||
void optionsClicked();
|
void optionsClicked();
|
||||||
void receiveCoinsClicked();
|
|
||||||
void aboutClicked();
|
void aboutClicked();
|
||||||
void trayIconActivated(QSystemTrayIcon::ActivationReason reason);
|
void trayIconActivated(QSystemTrayIcon::ActivationReason reason);
|
||||||
void transactionDetails(const QModelIndex& idx);
|
void transactionDetails(const QModelIndex& idx);
|
||||||
void incomingTransaction(const QModelIndex & parent, int start, int end);
|
void incomingTransaction(const QModelIndex & parent, int start, int end);
|
||||||
void exportClicked();
|
void exportClicked();
|
||||||
|
|
||||||
void gotoOverviewTab();
|
|
||||||
void gotoHistoryTab();
|
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
<?xml version="1.0" encoding="UTF-8"?>
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
<ui version="4.0">
|
<ui version="4.0">
|
||||||
<class>AddressBookDialog</class>
|
<class>AddressBookPage</class>
|
||||||
<widget class="QDialog" name="AddressBookDialog">
|
<widget class="QWidget" name="AddressBookPage">
|
||||||
<property name="geometry">
|
<property name="geometry">
|
||||||
<rect>
|
<rect>
|
||||||
<x>0</x>
|
<x>0</x>
|
||||||
@ -15,87 +15,38 @@
|
|||||||
</property>
|
</property>
|
||||||
<layout class="QVBoxLayout" name="verticalLayout">
|
<layout class="QVBoxLayout" name="verticalLayout">
|
||||||
<item>
|
<item>
|
||||||
<widget class="QTabWidget" name="tabWidget">
|
<widget class="QLabel" name="labelExplanation">
|
||||||
<property name="currentIndex">
|
<property name="text">
|
||||||
<number>1</number>
|
<string>These are your Bitcoin addresses for receiving payments. You may want to give a different one to each sender so you can keep track of who is paying you.</string>
|
||||||
</property>
|
</property>
|
||||||
<widget class="QWidget" name="sendTab">
|
<property name="textFormat">
|
||||||
<property name="toolTip">
|
<enum>Qt::AutoText</enum>
|
||||||
<string/>
|
</property>
|
||||||
</property>
|
<property name="wordWrap">
|
||||||
<attribute name="title">
|
<bool>true</bool>
|
||||||
<string>Sending</string>
|
</property>
|
||||||
</attribute>
|
</widget>
|
||||||
<layout class="QVBoxLayout" name="verticalLayout_2">
|
</item>
|
||||||
<item>
|
<item>
|
||||||
<widget class="QTableView" name="sendTableView">
|
<widget class="QTableView" name="tableView">
|
||||||
<property name="toolTip">
|
<property name="toolTip">
|
||||||
<string>Double-click to edit address or label</string>
|
<string>Double-click to edit address or label</string>
|
||||||
</property>
|
</property>
|
||||||
<property name="alternatingRowColors">
|
<property name="alternatingRowColors">
|
||||||
<bool>true</bool>
|
<bool>true</bool>
|
||||||
</property>
|
</property>
|
||||||
<property name="selectionMode">
|
<property name="selectionMode">
|
||||||
<enum>QAbstractItemView::SingleSelection</enum>
|
<enum>QAbstractItemView::SingleSelection</enum>
|
||||||
</property>
|
</property>
|
||||||
<property name="selectionBehavior">
|
<property name="selectionBehavior">
|
||||||
<enum>QAbstractItemView::SelectRows</enum>
|
<enum>QAbstractItemView::SelectRows</enum>
|
||||||
</property>
|
</property>
|
||||||
<property name="sortingEnabled">
|
<property name="sortingEnabled">
|
||||||
<bool>true</bool>
|
<bool>true</bool>
|
||||||
</property>
|
</property>
|
||||||
<attribute name="verticalHeaderVisible">
|
<attribute name="verticalHeaderVisible">
|
||||||
<bool>false</bool>
|
<bool>false</bool>
|
||||||
</attribute>
|
</attribute>
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
</layout>
|
|
||||||
</widget>
|
|
||||||
<widget class="QWidget" name="receiveTab">
|
|
||||||
<property name="toolTip">
|
|
||||||
<string/>
|
|
||||||
</property>
|
|
||||||
<attribute name="title">
|
|
||||||
<string>Receiving</string>
|
|
||||||
</attribute>
|
|
||||||
<layout class="QVBoxLayout" name="verticalLayout_3">
|
|
||||||
<item>
|
|
||||||
<widget class="QLabel" name="label">
|
|
||||||
<property name="text">
|
|
||||||
<string>These are your Bitcoin addresses for receiving payments. You may want to give a different one to each sender so you can keep track of who is paying you.</string>
|
|
||||||
</property>
|
|
||||||
<property name="textFormat">
|
|
||||||
<enum>Qt::AutoText</enum>
|
|
||||||
</property>
|
|
||||||
<property name="wordWrap">
|
|
||||||
<bool>true</bool>
|
|
||||||
</property>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
<item>
|
|
||||||
<widget class="QTableView" name="receiveTableView">
|
|
||||||
<property name="toolTip">
|
|
||||||
<string>Double-click to edit address or label</string>
|
|
||||||
</property>
|
|
||||||
<property name="alternatingRowColors">
|
|
||||||
<bool>true</bool>
|
|
||||||
</property>
|
|
||||||
<property name="selectionMode">
|
|
||||||
<enum>QAbstractItemView::SingleSelection</enum>
|
|
||||||
</property>
|
|
||||||
<property name="selectionBehavior">
|
|
||||||
<enum>QAbstractItemView::SelectRows</enum>
|
|
||||||
</property>
|
|
||||||
<property name="sortingEnabled">
|
|
||||||
<bool>true</bool>
|
|
||||||
</property>
|
|
||||||
<attribute name="verticalHeaderVisible">
|
|
||||||
<bool>false</bool>
|
|
||||||
</attribute>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
</layout>
|
|
||||||
</widget>
|
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
<item>
|
<item>
|
BIN
src/qt/res/icons/export.png
Normal file
BIN
src/qt/res/icons/export.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 1.3 KiB |
@ -3,7 +3,7 @@
|
|||||||
#include "walletmodel.h"
|
#include "walletmodel.h"
|
||||||
#include "guiutil.h"
|
#include "guiutil.h"
|
||||||
|
|
||||||
#include "addressbookdialog.h"
|
#include "addressbookpage.h"
|
||||||
#include "optionsmodel.h"
|
#include "optionsmodel.h"
|
||||||
|
|
||||||
#include <QApplication>
|
#include <QApplication>
|
||||||
@ -11,6 +11,7 @@
|
|||||||
#include <QMessageBox>
|
#include <QMessageBox>
|
||||||
#include <QLocale>
|
#include <QLocale>
|
||||||
#include <QDebug>
|
#include <QDebug>
|
||||||
|
#include <QMessageBox>
|
||||||
|
|
||||||
SendCoinsDialog::SendCoinsDialog(QWidget *parent, const QString &address) :
|
SendCoinsDialog::SendCoinsDialog(QWidget *parent, const QString &address) :
|
||||||
QDialog(parent),
|
QDialog(parent),
|
||||||
@ -61,6 +62,16 @@ void SendCoinsDialog::on_sendButton_clicked()
|
|||||||
// Add address to address book under label, if specified
|
// Add address to address book under label, if specified
|
||||||
label = ui->addAsLabel->text();
|
label = ui->addAsLabel->text();
|
||||||
|
|
||||||
|
QMessageBox::StandardButton retval = QMessageBox::question(this, tr("Confirm send coins"),
|
||||||
|
tr("Are you sure you want to send %1 BTC to %2 (%3)?").arg(GUIUtil::formatMoney(payAmountParsed), label, ui->payTo->text()),
|
||||||
|
QMessageBox::Yes|QMessageBox::Cancel,
|
||||||
|
QMessageBox::Cancel);
|
||||||
|
|
||||||
|
if(retval != QMessageBox::Yes)
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
switch(model->sendCoins(ui->payTo->text(), payAmountParsed, label))
|
switch(model->sendCoins(ui->payTo->text(), payAmountParsed, label))
|
||||||
{
|
{
|
||||||
case WalletModel::InvalidAddress:
|
case WalletModel::InvalidAddress:
|
||||||
@ -102,9 +113,8 @@ void SendCoinsDialog::on_pasteButton_clicked()
|
|||||||
|
|
||||||
void SendCoinsDialog::on_addressBookButton_clicked()
|
void SendCoinsDialog::on_addressBookButton_clicked()
|
||||||
{
|
{
|
||||||
AddressBookDialog dlg(AddressBookDialog::ForSending);
|
AddressBookPage dlg(AddressBookPage::ForSending, AddressBookPage::SendingTab);
|
||||||
dlg.setModel(model->getAddressTableModel());
|
dlg.setModel(model->getAddressTableModel());
|
||||||
dlg.setTab(AddressBookDialog::SendingTab);
|
|
||||||
dlg.exec();
|
dlg.exec();
|
||||||
ui->payTo->setText(dlg.getReturnValue());
|
ui->payTo->setText(dlg.getReturnValue());
|
||||||
ui->payAmount->setFocus();
|
ui->payAmount->setFocus();
|
||||||
@ -119,3 +129,21 @@ void SendCoinsDialog::on_payTo_textChanged(const QString &address)
|
|||||||
{
|
{
|
||||||
ui->addAsLabel->setText(model->labelForAddress(address));
|
ui->addAsLabel->setText(model->labelForAddress(address));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void SendCoinsDialog::clear()
|
||||||
|
{
|
||||||
|
ui->payTo->setText(QString());
|
||||||
|
ui->addAsLabel->setText(QString());
|
||||||
|
ui->payAmount->setText(QString());
|
||||||
|
ui->payTo->setFocus();
|
||||||
|
}
|
||||||
|
|
||||||
|
void SendCoinsDialog::reject()
|
||||||
|
{
|
||||||
|
clear();
|
||||||
|
}
|
||||||
|
|
||||||
|
void SendCoinsDialog::accept()
|
||||||
|
{
|
||||||
|
clear();
|
||||||
|
}
|
||||||
|
@ -18,6 +18,11 @@ public:
|
|||||||
|
|
||||||
void setModel(WalletModel *model);
|
void setModel(WalletModel *model);
|
||||||
|
|
||||||
|
public slots:
|
||||||
|
void clear();
|
||||||
|
void reject();
|
||||||
|
void accept();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
Ui::SendCoinsDialog *ui;
|
Ui::SendCoinsDialog *ui;
|
||||||
WalletModel *model;
|
WalletModel *model;
|
||||||
|
Loading…
Reference in New Issue
Block a user