Changeset View
Changeset View
Standalone View
Standalone View
src/qt/sendcoinsentry.cpp
Show All 11 Lines | |||||
#include <qt/optionsmodel.h> | #include <qt/optionsmodel.h> | ||||
#include <qt/platformstyle.h> | #include <qt/platformstyle.h> | ||||
#include <qt/walletmodel.h> | #include <qt/walletmodel.h> | ||||
#include <QApplication> | #include <QApplication> | ||||
#include <QClipboard> | #include <QClipboard> | ||||
SendCoinsEntry::SendCoinsEntry(const PlatformStyle *_platformStyle, | SendCoinsEntry::SendCoinsEntry(const PlatformStyle *_platformStyle, | ||||
QWidget *parent) | WalletModel *_model, QWidget *parent) | ||||
: QStackedWidget(parent), ui(new Ui::SendCoinsEntry), model(nullptr), | : QStackedWidget(parent), ui(new Ui::SendCoinsEntry), model(_model), | ||||
platformStyle(_platformStyle) { | platformStyle(_platformStyle) { | ||||
ui->setupUi(this); | ui->setupUi(this); | ||||
ui->addressBookButton->setIcon( | ui->addressBookButton->setIcon( | ||||
platformStyle->SingleColorIcon(":/icons/address-book")); | platformStyle->SingleColorIcon(":/icons/address-book")); | ||||
ui->pasteButton->setIcon( | ui->pasteButton->setIcon( | ||||
platformStyle->SingleColorIcon(":/icons/editpaste")); | platformStyle->SingleColorIcon(":/icons/editpaste")); | ||||
ui->deleteButton->setIcon(platformStyle->SingleColorIcon(":/icons/remove")); | ui->deleteButton->setIcon(platformStyle->SingleColorIcon(":/icons/remove")); | ||||
ui->deleteButton_is->setIcon( | ui->deleteButton_is->setIcon( | ||||
platformStyle->SingleColorIcon(":/icons/remove")); | platformStyle->SingleColorIcon(":/icons/remove")); | ||||
ui->deleteButton_s->setIcon( | ui->deleteButton_s->setIcon( | ||||
platformStyle->SingleColorIcon(":/icons/remove")); | platformStyle->SingleColorIcon(":/icons/remove")); | ||||
ui->messageTextLabel->setToolTip( | |||||
tr("A message that was attached to the %1 URI which will be" | |||||
" stored with the transaction for your reference. Note: " | |||||
"This message will not be sent over the Bitcoin network.") | |||||
.arg(QString::fromStdString( | |||||
model->getChainParams().CashAddrPrefix()))); | |||||
setCurrentWidget(ui->SendCoins); | setCurrentWidget(ui->SendCoins); | ||||
if (platformStyle->getUseExtraSpacing()) { | if (platformStyle->getUseExtraSpacing()) { | ||||
ui->payToLayout->setSpacing(4); | ui->payToLayout->setSpacing(4); | ||||
} | } | ||||
ui->addAsLabel->setPlaceholderText( | ui->addAsLabel->setPlaceholderText( | ||||
tr("Enter a label for this address to add it to your address book")); | tr("Enter a label for this address to add it to your address book")); | ||||
// normal bitcoin address field | // normal bitcoin address field | ||||
GUIUtil::setupAddressWidget(ui->payTo, this); | GUIUtil::setupAddressWidget(ui->payTo, this); | ||||
// just a label for displaying bitcoin address(es) | // just a label for displaying bitcoin address(es) | ||||
ui->payTo_is->setFont(GUIUtil::fixedPitchFont()); | ui->payTo_is->setFont(GUIUtil::fixedPitchFont()); | ||||
// Connect signals | // Connect signals | ||||
connect(ui->payAmount, SIGNAL(valueChanged()), this, | connect(ui->payAmount, SIGNAL(valueChanged()), this, | ||||
SIGNAL(payAmountChanged())); | SIGNAL(payAmountChanged())); | ||||
connect(ui->checkboxSubtractFeeFromAmount, SIGNAL(toggled(bool)), this, | connect(ui->checkboxSubtractFeeFromAmount, SIGNAL(toggled(bool)), this, | ||||
SIGNAL(subtractFeeFromAmountChanged())); | SIGNAL(subtractFeeFromAmountChanged())); | ||||
connect(ui->deleteButton, SIGNAL(clicked()), this, SLOT(deleteClicked())); | connect(ui->deleteButton, SIGNAL(clicked()), this, SLOT(deleteClicked())); | ||||
connect(ui->deleteButton_is, SIGNAL(clicked()), this, | connect(ui->deleteButton_is, SIGNAL(clicked()), this, | ||||
SLOT(deleteClicked())); | SLOT(deleteClicked())); | ||||
connect(ui->deleteButton_s, SIGNAL(clicked()), this, SLOT(deleteClicked())); | connect(ui->deleteButton_s, SIGNAL(clicked()), this, SLOT(deleteClicked())); | ||||
connect(ui->useAvailableBalanceButton, SIGNAL(clicked()), this, | connect(ui->useAvailableBalanceButton, SIGNAL(clicked()), this, | ||||
SLOT(useAvailableBalanceClicked())); | SLOT(useAvailableBalanceClicked())); | ||||
// Set the model properly. | |||||
setModel(model); | |||||
} | } | ||||
SendCoinsEntry::~SendCoinsEntry() { | SendCoinsEntry::~SendCoinsEntry() { | ||||
delete ui; | delete ui; | ||||
} | } | ||||
void SendCoinsEntry::on_pasteButton_clicked() { | void SendCoinsEntry::on_pasteButton_clicked() { | ||||
// Paste text from clipboard into recipient field | // Paste text from clipboard into recipient field | ||||
Show All 15 Lines | |||||
void SendCoinsEntry::on_payTo_textChanged(const QString &address) { | void SendCoinsEntry::on_payTo_textChanged(const QString &address) { | ||||
updateLabel(address); | updateLabel(address); | ||||
} | } | ||||
void SendCoinsEntry::setModel(WalletModel *_model) { | void SendCoinsEntry::setModel(WalletModel *_model) { | ||||
this->model = _model; | this->model = _model; | ||||
if (_model) { | |||||
ui->messageTextLabel->setToolTip( | |||||
tr("A message that was attached to the %1 URI which will be stored " | |||||
"with the transaction for your reference. Note: This message " | |||||
"will not be sent over the Bitcoin network.") | |||||
.arg(QString::fromStdString( | |||||
_model->getChainParams().CashAddrPrefix()))); | |||||
} | |||||
if (_model && _model->getOptionsModel()) { | if (_model && _model->getOptionsModel()) { | ||||
connect(_model->getOptionsModel(), SIGNAL(displayUnitChanged(int)), | connect(_model->getOptionsModel(), SIGNAL(displayUnitChanged(int)), | ||||
this, SLOT(updateDisplayUnit())); | this, SLOT(updateDisplayUnit())); | ||||
} | } | ||||
clear(); | clear(); | ||||
} | } | ||||
▲ Show 20 Lines • Show All 190 Lines • Show Last 20 Lines |