From e86224ee7ffdb18b7c7d17bc2c5cef2457665103 Mon Sep 17 00:00:00 2001 From: isanae <14251494+isanae@users.noreply.github.com> Date: Sun, 9 Jun 2019 11:38:44 -0400 Subject: 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 --- src/mainwindow.cpp | 36 ++---------------------------------- 1 file changed, 2 insertions(+), 34 deletions(-) (limited to 'src/mainwindow.cpp') 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(); -- cgit v1.3.1