diff options
| author | isanae <14251494+isanae@users.noreply.github.com> | 2019-06-09 10:37:08 -0400 |
|---|---|---|
| committer | isanae <14251494+isanae@users.noreply.github.com> | 2019-06-15 14:40:40 -0400 |
| commit | 626045511160b9d44a4ffd29f6dce11f5db6096b (patch) | |
| tree | a961a6687c048b7cea41771a25479fef2dae7cf9 /src/mainwindow.cpp | |
| parent | 57c7b1568518acefcbcc1801954a62fdc94e3b1c (diff) | |
removed old, unused stuff
have mainwindow save all the new settings once the dialog closes
Diffstat (limited to 'src/mainwindow.cpp')
| -rw-r--r-- | src/mainwindow.cpp | 38 |
1 files changed, 35 insertions, 3 deletions
diff --git a/src/mainwindow.cpp b/src/mainwindow.cpp index 267a2971..05417f51 100644 --- a/src/mainwindow.cpp +++ b/src/mainwindow.cpp @@ -2479,24 +2479,56 @@ static HRESULT CreateShortcut(LPCWSTR targetFileName, LPCWSTR arguments, bool MainWindow::modifyExecutablesDialog() { bool result = false; + try { - EditExecutablesDialog dialog(*m_OrganizerCore.executablesList(), + const auto oldExecutables = *m_OrganizerCore.executablesList(); + auto* profile = m_OrganizerCore.currentProfile(); + + EditExecutablesDialog dialog(oldExecutables, *m_OrganizerCore.modList(), - m_OrganizerCore.currentProfile(), + profile, m_OrganizerCore.managedGame(), this); QSettings &settings = m_OrganizerCore.settings().directInterface(); QString key = QString("geometry/%1").arg(dialog.objectName()); + if (settings.contains(key)) { dialog.restoreGeometry(settings.value(key).toByteArray()); } + if (dialog.exec() == QDialog::Accepted) { - m_OrganizerCore.setExecutablesList(dialog.getExecutablesList()); + 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; } + settings.setValue(key, dialog.saveGeometry()); refreshExecutablesList(); + updatePinnedExecutables(); } catch (const std::exception &e) { reportError(e.what()); } |
