Remember user choice on questions

This commit is contained in:
Jan Käberich 2024-01-27 18:04:14 +01:00
parent ec4828d4c4
commit 8a900600f5

View File

@ -74,7 +74,7 @@ bool InformationBox::AskQuestion(QString title, QString question, bool defaultAn
}
} else {
// don't show this question anymore
return defaultAnswer;
return s.value(hashToSettingsKey(hash)).toBool();
}
}
@ -105,8 +105,13 @@ InformationBox::~InformationBox()
{
auto cb = checkBox();
if(cb->isChecked()) {
auto value = true;
auto clicked = clickedButton();
if(clicked && QMessageBox::standardButton(clicked) == StandardButton::No) {
value = false;
}
QSettings s;
s.setValue(hashToSettingsKey(hash), true);
s.setValue(hashToSettingsKey(hash), value);
}
}