diff options
| author | Tannin <devnull@localhost> | 2015-04-12 15:41:17 +0200 |
|---|---|---|
| committer | Tannin <devnull@localhost> | 2015-04-12 15:41:17 +0200 |
| commit | 55eacfbd80d1f5aca0a598cd379c973650fb2be1 (patch) | |
| tree | c460ae33ea454bc5e8d87e77b9c967004e4225ed /src/mainwindow.cpp | |
| parent | 056acd03cd79700e40a09d901188152ef9a080bb (diff) | |
bugfix: save-dir monitoring is now disabled while editing a profile so that,
in case of local save games the active profile path isn't locked
Diffstat (limited to 'src/mainwindow.cpp')
| -rw-r--r-- | src/mainwindow.cpp | 34 |
1 files changed, 29 insertions, 5 deletions
diff --git a/src/mainwindow.cpp b/src/mainwindow.cpp index 34bc6dc2..286c9013 100644 --- a/src/mainwindow.cpp +++ b/src/mainwindow.cpp @@ -1229,11 +1229,8 @@ void MainWindow::refreshSavesIfOpen() }
}
-
-void MainWindow::refreshSaveList()
+QDir MainWindow::currentSavesDir() const
{
- ui->savegameList->clear();
-
QDir savesDir;
if (m_OrganizerCore.currentProfile()->localSavesEnabled()) {
savesDir.setPath(m_OrganizerCore.currentProfile()->absolutePath() + "/saves");
@@ -1245,13 +1242,35 @@ void MainWindow::refreshSaveList() savesDir.setPath(m_OrganizerCore.managedGame()->documentsDirectory().absoluteFilePath(QString::fromWCharArray(path)));
}
+ return savesDir;
+}
+
+void MainWindow::startMonitorSaves()
+{
+ stopMonitorSaves();
+
+ QDir savesDir = currentSavesDir();
+
+ m_SavesWatcher.addPath(savesDir.absolutePath());
+}
+
+void MainWindow::stopMonitorSaves()
+{
if (m_SavesWatcher.directories().length() > 0) {
m_SavesWatcher.removePaths(m_SavesWatcher.directories());
}
- m_SavesWatcher.addPath(savesDir.absolutePath());
+}
+
+void MainWindow::refreshSaveList()
+{
+ ui->savegameList->clear();
+
+ startMonitorSaves(); // re-starts monitoring
QStringList filters;
filters << QString("*.") + m_OrganizerCore.managedGame()->savegameExtension();
+
+ QDir savesDir = currentSavesDir();
savesDir.setNameFilters(filters);
QFileInfoList files = savesDir.entryInfoList(QDir::Files, QDir::Time);
@@ -1745,7 +1764,11 @@ void MainWindow::on_actionAdd_Profile_triggered() bool repeat = true;
while (repeat) {
ProfilesDialog profilesDialog(m_GamePath, this);
+ // workaround: need to disable monitoring of the saves directory, otherwise the active
+ // profile directory is locked
+ stopMonitorSaves();
profilesDialog.exec();
+ refreshSaveList(); // since the save list may now be outdated we have to refresh it completely
if (refreshProfiles() && !profilesDialog.failed()) {
repeat = false;
}
@@ -4409,6 +4432,7 @@ void MainWindow::on_bossButton_clicked() // if the game specifies load order by file time, our own load order file needs to be removed because it's outdated.
// refreshESPList will then use the file time as the load order.
if (GameInfo::instance().getLoadOrderMechanism() == GameInfo::TYPE_FILETIME) {
+ qDebug("removing loadorder.txt");
QFile::remove(m_OrganizerCore.currentProfile()->getLoadOrderFileName());
}
m_OrganizerCore.refreshESPList();
|
