Skip to content

Commit

Permalink
[GUI] set focus when showing dialogs
Browse files Browse the repository at this point in the history
Squashing commits:
- [GUI] set focus in AskPassphraseDialog when mode is Mode::Encrypt
- [GUI] set focus on edt addr label dialog
- [GUI] set focus on request dialog (payment request / staking
- [GUI] set focus on settings - sign/verify message
- [GUI] set focus on settings - console
- [GUI] set focus on masternode wizard dialog (name / ip)
Github-Pull: #1183
Rebased-From: 01522b6
  • Loading branch information
random-zebra authored and Fuzzbawls committed Dec 14, 2019
1 parent 5f0d3e6 commit a7205ad
Show file tree
Hide file tree
Showing 11 changed files with 36 additions and 2 deletions.
3 changes: 2 additions & 1 deletion src/qt/askpassphrasedialog.cpp
Expand Up @@ -156,7 +156,8 @@ AskPassphraseDialog::~AskPassphraseDialog()

void AskPassphraseDialog::showEvent(QShowEvent *event)
{
if (ui->passEdit1) ui->passEdit1->setFocus();
if (mode == Mode::Encrypt && ui->passEdit2) ui->passEdit2->setFocus();
else if (ui->passEdit1) ui->passEdit1->setFocus();
}

void AskPassphraseDialog::accept()
Expand Down
5 changes: 5 additions & 0 deletions src/qt/pivx/addnewcontactdialog.cpp
Expand Up @@ -56,6 +56,11 @@ void AddNewContactDialog::setData(QString address, QString label){
if (!label.isEmpty()) ui->lineEditName->setText(label);
}

void AddNewContactDialog::showEvent(QShowEvent *event)
{
if (ui->lineEditName) ui->lineEditName->setFocus();
}

void AddNewContactDialog::ok() {
this->res = true;
accept();
Expand Down
1 change: 1 addition & 0 deletions src/qt/pivx/addnewcontactdialog.h
Expand Up @@ -21,6 +21,7 @@ class AddNewContactDialog : public QDialog

void setTexts(QString title, const char* message = nullptr);
void setData(QString address, QString label);
void showEvent(QShowEvent *event) override;
QString getLabel();

bool res = false;
Expand Down
10 changes: 9 additions & 1 deletion src/qt/pivx/masternodewizarddialog.cpp
Expand Up @@ -90,6 +90,11 @@ MasterNodeWizardDialog::MasterNodeWizardDialog(WalletModel *model, QWidget *pare
connect(ui->btnBack, SIGNAL(clicked()), this, SLOT(onBackClicked()));
}

void MasterNodeWizardDialog::showEvent(QShowEvent *event)
{
if (ui->btnNext) ui->btnNext->setFocus();
}

void MasterNodeWizardDialog::onNextClicked(){
switch(pos){
case 0:{
Expand All @@ -99,8 +104,8 @@ void MasterNodeWizardDialog::onNextClicked(){
ui->pushName1->setChecked(true);
icConfirm1->setVisible(true);
ui->pushNumber3->setChecked(true);

ui->btnBack->setVisible(true);
ui->lineEditName->setFocus();
break;
}
case 1:{
Expand All @@ -119,6 +124,7 @@ void MasterNodeWizardDialog::onNextClicked(){
icConfirm3->setVisible(true);
ui->pushNumber4->setChecked(true);
ui->btnBack->setVisible(true);
ui->lineEditIpAddress->setFocus();
break;
}
case 2:{
Expand Down Expand Up @@ -328,6 +334,7 @@ void MasterNodeWizardDialog::onBackClicked(){
switch(pos){
case 0:{
ui->stackedWidget->setCurrentIndex(0);
ui->btnNext->setFocus();
ui->pushNumber1->setChecked(true);
ui->pushNumber4->setChecked(false);
ui->pushNumber3->setChecked(false);
Expand All @@ -340,6 +347,7 @@ void MasterNodeWizardDialog::onBackClicked(){
}
case 1:{
ui->stackedWidget->setCurrentIndex(1);
ui->lineEditName->setFocus();
ui->pushNumber4->setChecked(false);
ui->pushNumber3->setChecked(true);
ui->pushName4->setChecked(false);
Expand Down
1 change: 1 addition & 0 deletions src/qt/pivx/masternodewizarddialog.h
Expand Up @@ -24,6 +24,7 @@ class MasterNodeWizardDialog : public QDialog
public:
explicit MasterNodeWizardDialog(WalletModel *walletMode, QWidget *parent = nullptr);
~MasterNodeWizardDialog();
void showEvent(QShowEvent *event) override;

QString returnStr = "";
bool isOk = false;
Expand Down
5 changes: 5 additions & 0 deletions src/qt/pivx/requestdialog.cpp
Expand Up @@ -170,6 +170,11 @@ void RequestDialog::onCopyUriClicked(){
}
}

void RequestDialog::showEvent(QShowEvent *event)
{
if (ui->lineEditAmount) ui->lineEditAmount->setFocus();
}

void RequestDialog::updateQr(QString str){
QString uri = GUIUtil::formatBitcoinURI(*info);
ui->labelQrImg->setText("");
Expand Down
1 change: 1 addition & 0 deletions src/qt/pivx/requestdialog.h
Expand Up @@ -27,6 +27,7 @@ class RequestDialog : public QDialog

void setWalletModel(WalletModel *model);
void setPaymentRequest(bool isPaymentRequest);
void showEvent(QShowEvent *event) override;
int res = -1;

private slots:
Expand Down
5 changes: 5 additions & 0 deletions src/qt/pivx/settings/settingsconsolewidget.cpp
Expand Up @@ -369,6 +369,11 @@ void SettingsConsoleWidget::loadClientModel() {
}
}

void SettingsConsoleWidget::showEvent(QShowEvent *event)
{
if (ui->lineEdit) ui->lineEdit->setFocus();
}

static QString categoryClass(int category)
{
switch (category) {
Expand Down
1 change: 1 addition & 0 deletions src/qt/pivx/settings/settingsconsolewidget.h
Expand Up @@ -32,6 +32,7 @@ class SettingsConsoleWidget : public PWidget
~SettingsConsoleWidget();

void loadClientModel() override;
void showEvent(QShowEvent *event) override;

enum MessageClass {
MC_ERROR,
Expand Down
5 changes: 5 additions & 0 deletions src/qt/pivx/settings/settingssignmessagewidgets.cpp
Expand Up @@ -97,6 +97,11 @@ SettingsSignMessageWidgets::~SettingsSignMessageWidgets(){
delete ui;
}

void SettingsSignMessageWidgets::showEvent(QShowEvent *event)
{
if (ui->addressIn_SM) ui->addressIn_SM->setFocus();
}

void SettingsSignMessageWidgets::onModeSelected(bool isSign){
this->isSign = isSign;
updateMode();
Expand Down
1 change: 1 addition & 0 deletions src/qt/pivx/settings/settingssignmessagewidgets.h
Expand Up @@ -22,6 +22,7 @@ class SettingsSignMessageWidgets : public PWidget
~SettingsSignMessageWidgets();

void setAddress_SM(const QString& address);
void showEvent(QShowEvent *event) override;
protected:
void resizeEvent(QResizeEvent *event) override;
public slots:
Expand Down

0 comments on commit a7205ad

Please sign in to comment.