From 02fe0d3384c60b96e85274e94f4c3b344780a0ca Mon Sep 17 00:00:00 2001 From: LostDragonist Date: Fri, 7 Dec 2018 12:52:20 -0600 Subject: Improve refresh of data when changing profile settings --- src/mainwindow.cpp | 31 ++++++++++++++++++++++++------- 1 file changed, 24 insertions(+), 7 deletions(-) (limited to 'src/mainwindow.cpp') diff --git a/src/mainwindow.cpp b/src/mainwindow.cpp index 3f88f5ad..de015c54 100644 --- a/src/mainwindow.cpp +++ b/src/mainwindow.cpp @@ -1141,8 +1141,15 @@ void MainWindow::on_profileBox_currentIndexChanged(int index) } LocalSavegames *saveGames = m_OrganizerCore.managedGame()->feature(); - if (saveGames != nullptr && saveGames->updateSaveGames(m_OrganizerCore.currentProfile())) { - refreshSaveList(); + if (saveGames != nullptr) { + if (saveGames->prepareProfile(m_OrganizerCore.currentProfile())) + refreshSaveList(); + } + + BSAInvalidation *invalidation = m_OrganizerCore.managedGame()->feature(); + if (invalidation != nullptr) { + if (invalidation->prepareProfile(m_OrganizerCore.currentProfile())) + QTimer::singleShot(5, &m_OrganizerCore, SLOT(profileRefresh())); } } } @@ -1407,12 +1414,17 @@ QDir MainWindow::currentSavesDir() const if (m_OrganizerCore.currentProfile()->localSavesEnabled()) { savesDir.setPath(m_OrganizerCore.currentProfile()->savePath()); } else { + QString iniPath = m_OrganizerCore.currentProfile()->localSettingsEnabled() + ? m_OrganizerCore.currentProfile()->absolutePath() + : m_OrganizerCore.managedGame()->documentsDirectory().absolutePath(); + iniPath += "/" + m_OrganizerCore.managedGame()->iniFiles()[0]; + wchar_t path[MAX_PATH]; ::GetPrivateProfileStringW( L"General", L"SLocalSavePath", L"Saves", path, MAX_PATH, - ToWString(m_OrganizerCore.currentProfile()->absolutePath() + "/" + - m_OrganizerCore.managedGame()->iniFiles()[0]).c_str()); + iniPath.toStdWString().c_str() + ); savesDir.setPath(m_OrganizerCore.managedGame()->documentsDirectory().absoluteFilePath(QString::fromWCharArray(path))); } @@ -2026,11 +2038,16 @@ void MainWindow::on_actionAdd_Profile_triggered() } LocalSavegames *saveGames = m_OrganizerCore.managedGame()->feature(); - if (saveGames != nullptr && saveGames->updateSaveGames(m_OrganizerCore.currentProfile())) { - refreshSaveList(); + if (saveGames != nullptr) { + if (saveGames->prepareProfile(m_OrganizerCore.currentProfile())) + refreshSaveList(); } -// addProfile(); + BSAInvalidation *invalidation = m_OrganizerCore.managedGame()->feature(); + if (invalidation != nullptr) { + if (invalidation->prepareProfile(m_OrganizerCore.currentProfile())) + QTimer::singleShot(5, &m_OrganizerCore, SLOT(profileRefresh())); + } } void MainWindow::on_actionModify_Executables_triggered() -- cgit v1.3.1