forked from domob1812/namecoin-core
-
Notifications
You must be signed in to change notification settings - Fork 147
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
f10bde6 Namecoin: Add name_update Qt GUI (Jeremy Rand) d6aff8e Namecoin / Qt: Fix registerName widget (Jeremy Rand) Pull request description: This PR adds the `name_update` GUI. Top commit has no ACKs. Tree-SHA512: 1ff9509bd305ed10cf065bcef50787c344cf27a0fb0af759f70dcafbcf71d9d49fe231f0b82541a828655d5e05f3b44ab79be78562178fc86214b10c50511b1f
- Loading branch information
Showing
9 changed files
with
515 additions
and
6 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,92 @@ | ||
#include <qt/configurenamedialog.h> | ||
#include <qt/forms/ui_configurenamedialog.h> | ||
|
||
// TODO: How many of these are actually still needed? | ||
#include <names/main.h> | ||
#include <qt/addressbookpage.h> | ||
#include <qt/guiutil.h> | ||
#include <qt/platformstyle.h> | ||
#include <qt/walletmodel.h> | ||
#include <wallet/wallet.h> | ||
|
||
#include <QMessageBox> | ||
#include <QClipboard> | ||
|
||
ConfigureNameDialog::ConfigureNameDialog(const PlatformStyle *platformStyle, | ||
const QString &_name, const QString &data, | ||
QWidget *parent) : | ||
QDialog(parent, Qt::WindowSystemMenuHint | Qt::WindowTitleHint), | ||
ui(new Ui::ConfigureNameDialog), | ||
platformStyle(platformStyle), | ||
name(_name) | ||
{ | ||
ui->setupUi(this); | ||
|
||
if (platformStyle->getUseExtraSpacing()) | ||
ui->transferToLayout->setSpacing(4); | ||
|
||
GUIUtil::setupAddressWidget(ui->transferTo, this); | ||
|
||
ui->labelName->setText(name); | ||
ui->dataEdit->setText(data); | ||
|
||
returnData = data; | ||
|
||
ui->labelSubmitHint->setText(tr("name_update transaction will be issued immediately")); | ||
setWindowTitle(tr("Update Name")); | ||
} | ||
|
||
|
||
ConfigureNameDialog::~ConfigureNameDialog() | ||
{ | ||
delete ui; | ||
} | ||
|
||
void ConfigureNameDialog::accept() | ||
{ | ||
if (!walletModel) | ||
return; | ||
|
||
QString addr = ui->transferTo->text(); | ||
|
||
if (addr != "" && !walletModel->validateAddress(addr)) | ||
{ | ||
ui->transferTo->setValid(false); | ||
return; | ||
} | ||
|
||
returnData = ui->dataEdit->text(); | ||
returnTransferTo = ui->transferTo->text(); | ||
|
||
QDialog::accept(); | ||
} | ||
|
||
void ConfigureNameDialog::setModel(WalletModel *walletModel) | ||
{ | ||
this->walletModel = walletModel; | ||
} | ||
|
||
void ConfigureNameDialog::on_pasteButton_clicked() | ||
{ | ||
// Paste text from clipboard into recipient field | ||
ui->transferTo->setText(QApplication::clipboard()->text()); | ||
} | ||
|
||
void ConfigureNameDialog::on_addressBookButton_clicked() | ||
{ | ||
if (!walletModel) | ||
return; | ||
|
||
AddressBookPage dlg( | ||
// platformStyle | ||
platformStyle, | ||
// mode | ||
AddressBookPage::ForSelection, | ||
// tab | ||
AddressBookPage::SendingTab, | ||
// *parent | ||
this); | ||
dlg.setModel(walletModel->getAddressTableModel()); | ||
if (dlg.exec()) | ||
ui->transferTo->setText(dlg.getReturnValue()); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,53 @@ | ||
#ifndef CONFIGURENAMEDIALOG_H | ||
#define CONFIGURENAMEDIALOG_H | ||
|
||
#include <optional.h> | ||
#include <qt/platformstyle.h> | ||
|
||
#include <QDialog> | ||
|
||
namespace Ui { | ||
class ConfigureNameDialog; | ||
} | ||
|
||
class WalletModel; | ||
|
||
/** Dialog for editing an address and associated information. | ||
*/ | ||
class ConfigureNameDialog : public QDialog | ||
{ | ||
Q_OBJECT | ||
|
||
public: | ||
|
||
explicit ConfigureNameDialog(const PlatformStyle *platformStyle, | ||
const QString &_name, const QString &data, | ||
QWidget *parent = nullptr); | ||
~ConfigureNameDialog(); | ||
|
||
void setModel(WalletModel *walletModel); | ||
const QString &getReturnData() const { return returnData; } | ||
const Optional<QString> getTransferTo() const | ||
{ | ||
if (returnTransferTo == "") | ||
{ | ||
return {}; | ||
} | ||
return returnTransferTo; | ||
} | ||
|
||
public Q_SLOTS: | ||
void accept() override; | ||
void on_addressBookButton_clicked(); | ||
void on_pasteButton_clicked(); | ||
|
||
private: | ||
Ui::ConfigureNameDialog *ui; | ||
const PlatformStyle *platformStyle; | ||
QString returnData; | ||
QString returnTransferTo; | ||
WalletModel *walletModel; | ||
const QString name; | ||
}; | ||
|
||
#endif // CONFIGURENAMEDIALOG_H |
Oops, something went wrong.