mirror of
git://projects.qi-hardware.com/gmenu2x.git
synced 2024-11-22 13:05:20 +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"],
|
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);
|
||||||
|
@ -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;
|
|
||||||
}
|
}
|
||||||
|
@ -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();
|
||||||
};
|
};
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user