Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Reset options, notify user about backup creation #617

Merged
merged 1 commit into from
Jun 28, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions src/qt/bitcoingui.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -999,6 +999,7 @@ void BitcoinGUI::openOptionsDialogWithTab(OptionsDialog::Tab tab)
auto dlg = new OptionsDialog(this, enableWallet);
connect(dlg, &OptionsDialog::quitOnReset, this, &BitcoinGUI::quitRequested);
dlg->setCurrentTab(tab);
dlg->setClientModel(clientModel);
dlg->setModel(clientModel->getOptionsModel());
GUIUtil::ShowModalDialogAsynchronously(dlg);
}
Expand Down
15 changes: 11 additions & 4 deletions src/qt/optionsdialog.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
#include <qt/forms/ui_optionsdialog.h>

#include <qt/bitcoinunits.h>
#include <qt/clientmodel.h>
#include <qt/guiconstants.h>
#include <qt/guiutil.h>
#include <qt/optionsmodel.h>
Expand Down Expand Up @@ -168,6 +169,11 @@ OptionsDialog::~OptionsDialog()
delete ui;
}

void OptionsDialog::setClientModel(ClientModel* client_model)
{
m_client_model = client_model;
}

void OptionsDialog::setModel(OptionsModel *_model)
{
this->model = _model;
Expand Down Expand Up @@ -278,14 +284,15 @@ void OptionsDialog::setOkButtonState(bool fState)

void OptionsDialog::on_resetButton_clicked()
{
if(model)
{
if (model) {
// confirmation dialog
QMessageBox::StandardButton btnRetVal = QMessageBox::question(this, tr("Confirm options reset"),
tr("Client restart required to activate changes.") + "<br><br>" + tr("Client will be shut down. Do you want to proceed?"),
tr("Client restart required to activate changes.") + "<br><br>" +
tr("Current settings will be backed up at \"%1\".").arg(m_client_model->dataDir()) + "<br><br>" +
tr("Client will be shut down. Do you want to proceed?"),
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please add translator comments to these translatable strings. I've written some documentation on crafting translator comments here: https://github.com/bitcoin-core/gui-qml/blob/main/src/qml/doc/translator-comments.md

I can suggest the comments if you'd like

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

re: #617 (comment)

Please add translator comments to these translatable strings. I've written some documentation on crafting translator comments here: https://github.com/bitcoin-core/gui-qml/blob/main/src/qml/doc/translator-comments.md

I can suggest the comments if you'd like

This seems worth following up on. It's not obvious to me what translator comments would be helpful here so maybe suggesting specific comments would be helpful

QMessageBox::Yes | QMessageBox::Cancel, QMessageBox::Cancel);

if(btnRetVal == QMessageBox::Cancel)
if (btnRetVal == QMessageBox::Cancel)
return;

/* reset all options and close GUI */
Expand Down
3 changes: 3 additions & 0 deletions src/qt/optionsdialog.h
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
#include <QDialog>
#include <QValidator>

class ClientModel;
class OptionsModel;
class QValidatedLineEdit;

Expand Down Expand Up @@ -45,6 +46,7 @@ class OptionsDialog : public QDialog
TAB_NETWORK,
};

void setClientModel(ClientModel* client_model);
void setModel(OptionsModel *model);
void setMapper();
void setCurrentTab(OptionsDialog::Tab tab);
Expand Down Expand Up @@ -72,6 +74,7 @@ private Q_SLOTS:

private:
Ui::OptionsDialog *ui;
ClientModel* m_client_model{nullptr};
OptionsModel *model;
QDataWidgetMapper *mapper;
};
Expand Down