Stop the autosaving session timer on closing Creator

Change-Id: I3b9c791d95d7815a711f72cec08f405fb1cdac7c
Reviewed-by: Eike Ziller <eike.ziller@nokia.com>
This commit is contained in:
Daniel Teske
2012-04-30 16:31:28 +02:00
parent 359b0a092b
commit f059018a8e
5 changed files with 16 additions and 9 deletions

View File

@@ -227,6 +227,13 @@ MainWindow::MainWindow() :
statusBar()->setProperty("p_styled", true);
setAcceptDrops(true);
m_autoSaveSessionTimer = new QTimer(this);
m_autoSaveSessionTimer->setSingleShot(true);
m_autoSaveSessionTimer->setInterval(10000);
m_autoSaveSessionTimer->start();
connect(m_autoSaveSessionTimer, SIGNAL(timeout()),
m_coreImpl, SIGNAL(saveSettingsRequested()));
}
void MainWindow::setSidebarVisible(bool visible)
@@ -372,6 +379,7 @@ void MainWindow::extensionsInitialized()
void MainWindow::closeEvent(QCloseEvent *event)
{
m_autoSaveSessionTimer->stop();
emit m_coreImpl->saveSettingsRequested();
// Save opened files

View File

@@ -232,6 +232,7 @@ private:
QColor m_overrideColor;
QStringList m_filesToOpenDelayed;
QTimer *m_autoSaveSessionTimer;
};
} // namespace Internal

View File

@@ -242,6 +242,7 @@ struct ProjectExplorerPluginPrivate {
Core::IMode *m_projectsMode;
TaskHub *m_taskHub;
bool m_shuttingDown;
};
ProjectExplorerPluginPrivate::ProjectExplorerPluginPrivate() :
@@ -249,7 +250,8 @@ ProjectExplorerPluginPrivate::ProjectExplorerPluginPrivate() :
m_currentNode(0),
m_delayedRunConfiguration(0),
m_runMode(NoRunMode),
m_projectsMode(0)
m_projectsMode(0),
m_shuttingDown(false)
{
}
@@ -1155,6 +1157,7 @@ ExtensionSystem::IPlugin::ShutdownFlag ProjectExplorerPlugin::aboutToShutdown()
d->m_proWindow->aboutToShutdown(); // disconnect from session
d->m_session->closeAllProjects();
d->m_projectsMode = 0;
d->m_shuttingDown = true;
// Attempt to synchronously shutdown all run controls.
// If that fails, fall back to asynchronous shutdown (Debugger run controls
// might shutdown asynchronously).
@@ -1226,6 +1229,9 @@ void ProjectExplorerPlugin::savePersistentSettings()
if (debug)
qDebug()<<"ProjectExplorerPlugin::savePersistentSettings()";
if (d->m_shuttingDown)
return;
foreach (Project *pro, d->m_session->projects())
pro->saveSettings();

View File

@@ -108,12 +108,6 @@ SessionManager::SessionManager(QObject *parent)
this, SLOT(markSessionFileDirty()));
connect(em, SIGNAL(editorsClosed(QList<Core::IEditor*>)),
this, SLOT(markSessionFileDirty()));
m_autoSaveSessionTimer = new QTimer(this);
m_autoSaveSessionTimer->setSingleShot(true);
m_autoSaveSessionTimer->setInterval(10000);
connect(m_autoSaveSessionTimer, SIGNAL(timeout()),
ICore::instance(), SIGNAL(saveSettingsRequested()));
}
SessionManager::~SessionManager()
@@ -899,7 +893,6 @@ void SessionManager::reportProjectLoadingProgress()
void SessionManager::markSessionFileDirty(bool makeDefaultVirginDirty)
{
m_autoSaveSessionTimer->start();
if (makeDefaultVirginDirty)
m_virginSession = false;
}

View File

@@ -167,7 +167,6 @@ private:
mutable QStringList m_sessions;
mutable QHash<Project *, QStringList> m_projectFileCache;
QTimer *m_autoSaveSessionTimer;
Project *m_startupProject;
QList<Project *> m_projects;