diff options
| author | isanae <14251494+isanae@users.noreply.github.com> | 2019-06-09 11:38:44 -0400 |
|---|---|---|
| committer | isanae <14251494+isanae@users.noreply.github.com> | 2019-06-15 14:40:40 -0400 |
| commit | e86224ee7ffdb18b7c7d17bc2c5cef2457665103 (patch) | |
| tree | da8642f6d0ce7f82410361cd3aed5a7a511647c7 /src/mainwindow.cpp | |
| parent | d6d05dcae8d2b26aff5917449e38f9886bca65ba (diff) | |
moved commiting changes to EditExecutablesDialog itself instead of doing it from the main window
use a separate enabled state for custom overwrites and forced libraries, this remembers the values even when unchecking the checkbox, as long as the dialog stays opened
pass the whole OrganizerCore to EditExecutablesDialog, simplifies a bunch of things
Diffstat (limited to 'src/mainwindow.cpp')
| -rw-r--r-- | src/mainwindow.cpp | 36 |
1 files changed, 2 insertions, 34 deletions
diff --git a/src/mainwindow.cpp b/src/mainwindow.cpp index 05417f51..15a6eb62 100644 --- a/src/mainwindow.cpp +++ b/src/mainwindow.cpp @@ -2482,13 +2482,8 @@ bool MainWindow::modifyExecutablesDialog() try { const auto oldExecutables = *m_OrganizerCore.executablesList(); - auto* profile = m_OrganizerCore.currentProfile(); - EditExecutablesDialog dialog(oldExecutables, - *m_OrganizerCore.modList(), - profile, - m_OrganizerCore.managedGame(), - this); + EditExecutablesDialog dialog(m_OrganizerCore, this); QSettings &settings = m_OrganizerCore.settings().directInterface(); QString key = QString("geometry/%1").arg(dialog.objectName()); @@ -2497,34 +2492,7 @@ bool MainWindow::modifyExecutablesDialog() dialog.restoreGeometry(settings.value(key).toByteArray()); } - if (dialog.exec() == QDialog::Accepted) { - const auto newExecutables = dialog.getExecutablesList(); - - // remove all the custom overwrites and forced libraries - for (const auto& e : oldExecutables) { - profile->removeSetting("custom_overwrites", e.title()); - profile->removeForcedLibraries(e.title()); - } - - // set the new custom overwrites and forced libraries - for (const auto& e : newExecutables) { - if (auto modName=dialog.getCustomOverwrites().find(e.title())) { - profile->storeSetting("custom_overwrites", e.title(), *modName); - } - - if (auto list=dialog.getForcedLibraries().find(e.title())) { - if (!list->empty()) { - profile->setForcedLibrariesEnabled(e.title(), true); - profile->storeForcedLibraries(e.title(), *list); - } - } - } - - // set the new executables list - m_OrganizerCore.setExecutablesList(newExecutables); - - result = true; - } + result = (dialog.exec() == QDialog::Accepted); settings.setValue(key, dialog.saveGeometry()); refreshExecutablesList(); |
