mirror of
git://projects.qi-hardware.com/gmenu2x.git
synced 2024-11-22 12:57:31 +02:00
Made SettingsDialog::exec() return whether a setting was changed
Previously, exec() always returned true and a separate edited() method would indicate whether any settings were changed.
This commit is contained in:
parent
faf2495727
commit
e2382e11fd
@ -737,7 +737,7 @@ void GMenu2X::showSettings() {
|
||||
tr["Set button repetitions per second"],
|
||||
&confInt["buttonRepeatRate"], 0, 20)));
|
||||
|
||||
if (sd.exec() && sd.edited()) {
|
||||
if (sd.exec()) {
|
||||
#ifdef ENABLE_CPUFREQ
|
||||
if (curMenuClock != confInt["menuClock"]) setClock(confInt["menuClock"]);
|
||||
#endif
|
||||
@ -795,7 +795,7 @@ void GMenu2X::skinMenu() {
|
||||
tr["Color of the selection of the message box"],
|
||||
&skinConfColors[COLOR_MESSAGE_BOX_SELECTION])));
|
||||
|
||||
if (sd.exec() && sd.edited()) {
|
||||
if (sd.exec()) {
|
||||
if (curSkin != confStr["skin"]) {
|
||||
setSkin(confStr["skin"]);
|
||||
writeConfig();
|
||||
@ -979,7 +979,7 @@ void GMenu2X::editLink() {
|
||||
&linkApp->consoleApp)));
|
||||
}
|
||||
|
||||
if (sd.exec() && sd.edited()) {
|
||||
if (sd.exec()) {
|
||||
linkApp->setTitle(linkTitle);
|
||||
linkApp->setDescription(linkDescription);
|
||||
linkApp->setIcon(linkIcon);
|
||||
|
@ -141,12 +141,6 @@ bool SettingsDialog::exec() {
|
||||
}
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
bool SettingsDialog::edited() {
|
||||
for (uint i=0; i < settings.size(); i++) {
|
||||
if (settings[i]->edited()) return true;
|
||||
}
|
||||
return false;
|
||||
return any_of(settings.begin(), settings.end(),
|
||||
[](unique_ptr<MenuSetting>& setting){ return setting->edited(); });
|
||||
}
|
||||
|
@ -48,7 +48,10 @@ public:
|
||||
settings.push_back(std::move(setting));
|
||||
}
|
||||
|
||||
bool edited();
|
||||
/**
|
||||
* Shows the dialog in a modal way.
|
||||
* @return true iff any settings were changed.
|
||||
*/
|
||||
bool exec();
|
||||
};
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user