Session: Save color as part of the session

This makes it much easier to see which session you are in (if you care
to use color-coding;-).

Change-Id: I96d55aa9a67fc44cb88797458d5a9e99208b957c
Reviewed-by: Tobias Hunger <tobias.hunger@digia.com>
This commit is contained in:
Tobias Hunger
2012-03-12 13:03:26 +01:00
parent f50f1416a1
commit 0334bc93bf

View File

@@ -49,6 +49,7 @@
#include <utils/listutils.h>
#include <utils/qtcassert.h>
#include <utils/stylehelper.h>
#include <QDebug>
#include <QDir>
@@ -316,6 +317,15 @@ bool SessionManager::save()
if (m_startupProject)
data.insert(QLatin1String("StartupProject"), m_startupProject->document()->fileName());
QColor c = Utils::StyleHelper::requestedBaseColor();
if (c.isValid()) {
QString tmp = QString::fromLatin1("#%1%2%3")
.arg(c.red(), 2, 16, QLatin1Char('0'))
.arg(c.green(), 2, 16, QLatin1Char('0'))
.arg(c.blue(), 2, 16, QLatin1Char('0'));
writer.saveValue(QLatin1String("Color"), tmp);
}
QStringList projectFiles;
foreach (Project *pro, m_projects)
projectFiles << pro->document()->fileName();
@@ -861,6 +871,10 @@ bool SessionManager::loadSession(const QString &session)
restoreValues(reader);
emit aboutToLoadSession(session);
QColor c = QColor(reader.restoreValue(QLatin1String("Color")).toString());
if (c.isValid())
Utils::StyleHelper::setBaseColor(c);
QStringList fileList =
reader.restoreValue(QLatin1String("ProjectList")).toStringList();
int openEditorsCount = reader.restoreValue(QLatin1String("OpenEditors")).toInt();