1
0
mirror of git://projects.qi-hardware.com/gmenu2x.git synced 2024-11-26 03:06:15 +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:
Maarten ter Huurne 2014-08-16 17:11:18 +02:00
parent faf2495727
commit e2382e11fd
3 changed files with 9 additions and 12 deletions

View File

@ -737,7 +737,7 @@ void GMenu2X::showSettings() {
tr["Set button repetitions per second"], tr["Set button repetitions per second"],
&confInt["buttonRepeatRate"], 0, 20))); &confInt["buttonRepeatRate"], 0, 20)));
if (sd.exec() && sd.edited()) { if (sd.exec()) {
#ifdef ENABLE_CPUFREQ #ifdef ENABLE_CPUFREQ
if (curMenuClock != confInt["menuClock"]) setClock(confInt["menuClock"]); if (curMenuClock != confInt["menuClock"]) setClock(confInt["menuClock"]);
#endif #endif
@ -795,7 +795,7 @@ void GMenu2X::skinMenu() {
tr["Color of the selection of the message box"], tr["Color of the selection of the message box"],
&skinConfColors[COLOR_MESSAGE_BOX_SELECTION]))); &skinConfColors[COLOR_MESSAGE_BOX_SELECTION])));
if (sd.exec() && sd.edited()) { if (sd.exec()) {
if (curSkin != confStr["skin"]) { if (curSkin != confStr["skin"]) {
setSkin(confStr["skin"]); setSkin(confStr["skin"]);
writeConfig(); writeConfig();
@ -979,7 +979,7 @@ void GMenu2X::editLink() {
&linkApp->consoleApp))); &linkApp->consoleApp)));
} }
if (sd.exec() && sd.edited()) { if (sd.exec()) {
linkApp->setTitle(linkTitle); linkApp->setTitle(linkTitle);
linkApp->setDescription(linkDescription); linkApp->setDescription(linkDescription);
linkApp->setIcon(linkIcon); linkApp->setIcon(linkIcon);

View File

@ -141,12 +141,6 @@ bool SettingsDialog::exec() {
} }
} }
return true; return any_of(settings.begin(), settings.end(),
} [](unique_ptr<MenuSetting>& setting){ return setting->edited(); });
bool SettingsDialog::edited() {
for (uint i=0; i < settings.size(); i++) {
if (settings[i]->edited()) return true;
}
return false;
} }

View File

@ -48,7 +48,10 @@ public:
settings.push_back(std::move(setting)); settings.push_back(std::move(setting));
} }
bool edited(); /**
* Shows the dialog in a modal way.
* @return true iff any settings were changed.
*/
bool exec(); bool exec();
}; };