Commit 27275a07 authored by Daniel Teske's avatar Daniel Teske
Browse files

Move SessionFile::m_values to SessionManager



Change-Id: Iccb40a16d3087f612ad5d570ed42a243fe87dfe5
Reviewed-by: default avatarTobias Hunger <tobias.hunger@nokia.com>
parent 9c611c41
...@@ -87,8 +87,6 @@ public: ...@@ -87,8 +87,6 @@ public:
SessionFile(); SessionFile();
private: private:
QMap<QString, QVariant> m_values;
QFutureInterface<void> future; QFutureInterface<void> future;
friend class ProjectExplorer::SessionManager; friend class ProjectExplorer::SessionManager;
}; };
...@@ -351,6 +349,7 @@ bool SessionManager::createImpl(const QString &fileName) ...@@ -351,6 +349,7 @@ bool SessionManager::createImpl(const QString &fileName)
m_startupProject = 0; m_startupProject = 0;
m_failedProjects.clear(); m_failedProjects.clear();
m_depMap.clear(); m_depMap.clear();
m_values.clear();
const QString &sessionName = sessionNameFromFileName(fileName); const QString &sessionName = sessionNameFromFileName(fileName);
emit aboutToLoadSession(sessionName); emit aboutToLoadSession(sessionName);
m_sessionName = sessionName; m_sessionName = sessionName;
...@@ -397,6 +396,7 @@ bool SessionManager::loadImpl(const QString &fileName) ...@@ -397,6 +396,7 @@ bool SessionManager::loadImpl(const QString &fileName)
m_startupProject = 0; m_startupProject = 0;
m_failedProjects.clear(); m_failedProjects.clear();
m_depMap.clear(); m_depMap.clear();
m_values.clear();
const QString &sessionName = sessionNameFromFileName(fileName); const QString &sessionName = sessionNameFromFileName(fileName);
emit aboutToLoadSession(sessionName); emit aboutToLoadSession(sessionName);
m_sessionName = sessionName; m_sessionName = sessionName;
...@@ -418,7 +418,7 @@ bool SessionManager::loadImpl(const QString &fileName) ...@@ -418,7 +418,7 @@ bool SessionManager::loadImpl(const QString &fileName)
const QStringList &keys = reader.restoreValue(QLatin1String("valueKeys")).toStringList(); const QStringList &keys = reader.restoreValue(QLatin1String("valueKeys")).toStringList();
foreach (const QString &key, keys) { foreach (const QString &key, keys) {
QVariant value = reader.restoreValue(QLatin1String("value-") + key); QVariant value = reader.restoreValue(QLatin1String("value-") + key);
m_file->m_values.insert(key, value); m_values.insert(key, value);
} }
QStringList fileList = QStringList fileList =
...@@ -571,9 +571,9 @@ bool SessionManager::save() ...@@ -571,9 +571,9 @@ bool SessionManager::save()
ICore::editorManager()->saveState().toBase64()); ICore::editorManager()->saveState().toBase64());
QMap<QString, QVariant>::const_iterator it, end; QMap<QString, QVariant>::const_iterator it, end;
end = m_file->m_values.constEnd(); end = m_values.constEnd();
QStringList keys; QStringList keys;
for (it = m_file->m_values.constBegin(); it != end; ++it) { for (it = m_values.constBegin(); it != end; ++it) {
writer.saveValue(QLatin1String("value-") + it.key(), it.value()); writer.saveValue(QLatin1String("value-") + it.key(), it.value());
keys << it.key(); keys << it.key();
} }
...@@ -852,21 +852,16 @@ void SessionManager::removeProjects(QList<Project *> remove) ...@@ -852,21 +852,16 @@ void SessionManager::removeProjects(QList<Project *> remove)
void SessionManager::setValue(const QString &name, const QVariant &value) void SessionManager::setValue(const QString &name, const QVariant &value)
{ {
if (!m_file) if (m_values.value(name) == value)
return;
if (m_file->m_values.value(name) == value)
return; return;
m_file->m_values.insert(name, value); m_values.insert(name, value);
markSessionFileDirty(false); markSessionFileDirty(false);
} }
QVariant SessionManager::value(const QString &name) QVariant SessionManager::value(const QString &name)
{ {
if (!m_file) QMap<QString, QVariant>::const_iterator it = m_values.find(name);
return QVariant(); return (it == m_values.constEnd()) ? QVariant() : *it;
QMap<QString, QVariant>::const_iterator it = m_file->m_values.find(name);
return (it == m_file->m_values.constEnd()) ? QVariant() : *it;
} }
QString SessionManager::activeSession() const QString SessionManager::activeSession() const
......
...@@ -173,6 +173,7 @@ private: ...@@ -173,6 +173,7 @@ private:
QList<Project *> m_projects; QList<Project *> m_projects;
QStringList m_failedProjects; QStringList m_failedProjects;
QMap<QString, QStringList> m_depMap; QMap<QString, QStringList> m_depMap;
QMap<QString, QVariant> m_values;
}; };
} // namespace ProjectExplorer } // namespace ProjectExplorer
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment