core: save recent projects list on change rather than on exit

This commit is contained in:
itsmattkc
2022-10-23 10:01:17 -07:00
parent 70b4292627
commit b71a976175
2 changed files with 17 additions and 9 deletions
+15 -9
View File
@@ -198,15 +198,6 @@ void Core::Stop()
// Save Config
Config::Save();
// Save recently opened projects
{
QFile recent_projects_file(GetRecentProjectsFilePath());
if (recent_projects_file.open(QFile::WriteOnly | QFile::Text)) {
recent_projects_file.write(recent_projects_.join('\n').toUtf8());
recent_projects_file.close();
}
}
ProjectSerializer::Destroy();
ConformManager::DestroyInstance();
@@ -292,6 +283,7 @@ void Core::SetSelectedTransitionObject(const QString &obj)
void Core::ClearOpenRecentList()
{
recent_projects_.clear();
SaveRecentProjectsList();
emit OpenRecentListChanged();
}
@@ -960,6 +952,16 @@ bool Core::RevertProjectInternal(Project *p, bool by_opening_existing)
return false;
}
void Core::SaveRecentProjectsList()
{
// Save recently opened projects
QFile recent_projects_file(GetRecentProjectsFilePath());
if (recent_projects_file.open(QFile::WriteOnly | QFile::Text)) {
recent_projects_file.write(recent_projects_.join('\n').toUtf8());
recent_projects_file.close();
}
}
void Core::SaveAutorecovery()
{
if (OLIVE_CONFIG("AutorecoveryEnabled").toBool()) {
@@ -1372,6 +1374,8 @@ void Core::PushRecentlyOpenedProject(const QString& s)
}
}
SaveRecentProjectsList();
emit OpenRecentListChanged();
}
@@ -1523,6 +1527,8 @@ void Core::OpenProjectFromRecentList(int index)
QMessageBox::Yes | QMessageBox::No) == QMessageBox::Yes) {
recent_projects_.removeAt(index);
SaveRecentProjectsList();
emit OpenRecentListChanged();
}
}