Move SessionFile::future to SessionManager

Instead of reseting the variable at new SessionFile, I did it at the
right place, that is after reportingFinished().

Change-Id: Ia5b58734a646840ff645dad07dd87a2bffcef02b
Reviewed-by: Tobias Hunger <tobias.hunger@nokia.com>
This commit is contained in:
Daniel Teske
2012-02-06 17:26:31 +01:00
parent 9c57b1000f
commit c200a9262f
2 changed files with 8 additions and 6 deletions

View File

@@ -87,7 +87,6 @@ public:
SessionFile(); SessionFile();
private: private:
QFutureInterface<void> future;
friend class ProjectExplorer::SessionManager; friend class ProjectExplorer::SessionManager;
}; };
@@ -412,7 +411,7 @@ bool SessionManager::loadImpl(const QString &fileName)
return false; return false;
} }
ICore::progressManager()->addTask(m_file->future.future(), tr("Session"), ICore::progressManager()->addTask(m_future.future(), tr("Session"),
QLatin1String("ProjectExplorer.SessionFile.Load")); QLatin1String("ProjectExplorer.SessionFile.Load"));
const QStringList &keys = reader.restoreValue(QLatin1String("valueKeys")).toStringList(); const QStringList &keys = reader.restoreValue(QLatin1String("valueKeys")).toStringList();
@@ -425,8 +424,8 @@ bool SessionManager::loadImpl(const QString &fileName)
reader.restoreValue(QLatin1String("ProjectList")).toStringList(); reader.restoreValue(QLatin1String("ProjectList")).toStringList();
int openEditorsCount = reader.restoreValue(QLatin1String("OpenEditors")).toInt(); int openEditorsCount = reader.restoreValue(QLatin1String("OpenEditors")).toInt();
m_file->future.setProgressRange(0, fileList.count() + openEditorsCount + 2); m_future.setProgressRange(0, fileList.count() + openEditorsCount + 2);
m_file->future.setProgressValue(1); m_future.setProgressValue(1);
// indirectly adds projects to session // indirectly adds projects to session
// Keep projects that failed to load in the session! // Keep projects that failed to load in the session!
@@ -482,7 +481,8 @@ bool SessionManager::loadImpl(const QString &fileName)
this, SLOT(sessionLoadingProgress())); this, SLOT(sessionLoadingProgress()));
} }
m_file->future.reportFinished(); m_future.reportFinished();
m_future = QFutureInterface<void>();
// m_file->load() sets the m_file->startupProject // m_file->load() sets the m_file->startupProject
// but doesn't emit this signal, so we do it here // but doesn't emit this signal, so we do it here
@@ -996,7 +996,7 @@ void SessionManager::markSessionFileDirty(bool makeDefaultVirginDirty)
void SessionManager::sessionLoadingProgress() void SessionManager::sessionLoadingProgress()
{ {
m_file->future.setProgressValue(m_file->future.progressValue() + 1); m_future.setProgressValue(m_future.progressValue() + 1);
QCoreApplication::processEvents(QEventLoop::ExcludeUserInputEvents); QCoreApplication::processEvents(QEventLoop::ExcludeUserInputEvents);
} }

View File

@@ -39,6 +39,7 @@
#include <QtCore/QString> #include <QtCore/QString>
#include <QtCore/QStringList> #include <QtCore/QStringList>
#include <QtCore/QMap> #include <QtCore/QMap>
#include <QtCore/QFutureInterface>
QT_BEGIN_NAMESPACE QT_BEGIN_NAMESPACE
class QAbstractItemModel; class QAbstractItemModel;
@@ -174,6 +175,7 @@ private:
QStringList m_failedProjects; QStringList m_failedProjects;
QMap<QString, QStringList> m_depMap; QMap<QString, QStringList> m_depMap;
QMap<QString, QVariant> m_values; QMap<QString, QVariant> m_values;
QFutureInterface<void> future;
}; };
} // namespace ProjectExplorer } // namespace ProjectExplorer