Skip to content
Snippets Groups Projects
Commit 83a7e1d4 authored by Wuttke, Joachim's avatar Wuttke, Joachim
Browse files

ProjManager uses autosave_enabled from AppConfig

parent c8639126
No related branches found
No related tags found
1 merge request!2452cleanup autosave, style sheet & palette; split save some files; dissolve GUI/Support
......@@ -192,8 +192,9 @@ void ActionManager::onAboutToShowSettingsMenu()
action->setToolTip("Project will be saved periodically in project's autosave directory.\n"
"When opening project, recover option will be suggested, if possible.");
action->setCheckable(true);
checkBox->setChecked(m_project_manager->isAutosaveEnabled());
connect(checkBox, &QCheckBox::toggled, m_project_manager, &ProjectManager::setAutosaveEnabled);
checkBox->setChecked(gApp->autosave_enabled);
connect(checkBox, &QCheckBox::toggled,
[] { gApp->autosave_enabled = !gApp->autosave_enabled; });
m_settings_menu->addAction(action);
}
......
......@@ -38,6 +38,7 @@ const QString S_LASTUSEDIMPORTDIR = "LastUsedImportDir";
ProjectManager::ProjectManager(QObject* parent)
: QObject(parent)
, m_autosaver(std::make_unique<AutosaveController>())
{
}
......@@ -108,19 +109,6 @@ bool ProjectManager::saveOnQuit()
return true;
}
bool ProjectManager::isAutosaveEnabled() const
{
return static_cast<bool>(m_autosave);
}
void ProjectManager::setAutosaveEnabled(bool value)
{
if (value)
m_autosave = std::make_unique<AutosaveController>();
else
m_autosave.reset();
}
//! Clears list of recent projects.
void ProjectManager::clearRecentProjects()
......@@ -206,8 +194,8 @@ void ProjectManager::createNewProject()
{
gDoc->clear();
if (m_autosave)
m_autosave->setDocument(gDoc.get());
if (gApp->autosave_enabled)
m_autosaver->setDocument(gDoc.get());
}
//! Load project data from file name. If autosave info exists, opens dialog for project restore.
......
......@@ -36,14 +36,11 @@ public:
QStringList recentProjects();
bool isAutosaveEnabled() const;
signals:
void documentOpenedOrClosed(bool opened);
void recentListModified();
public slots:
void setAutosaveEnabled(bool value);
void clearRecentProjects();
void newProject();
bool saveProject(QString projectPullPath = "");
......@@ -63,7 +60,7 @@ private:
QString m_working_directory;
QStringList m_recent_projects;
std::unique_ptr<AutosaveController> m_autosave;
std::unique_ptr<AutosaveController> m_autosaver;
};
#endif // BORNAGAIN_GUI_VIEW_MAIN_PROJECTMANAGER_H
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment