Commit 05f47cd4 authored by hjk's avatar hjk
Browse files

Debugger: Make also individual formats persistent



I am not fully convinced this is a good idea, but it looks like
the different behaviour of type formats and individual formats
is unexpected.

Task-number: QTCREATORBUG-7412
Change-Id: I5aae39939dfe75b3d9ff6c1025bd3d9c9222695a
Reviewed-by: default avatarDavid Schulz <david.schulz@digia.com>
parent 5beb74fd
......@@ -1817,21 +1817,28 @@ void WatchHandler::saveWatchers()
DebuggerCore::setSessionValue("Watchers", watchedExpressions());
}
void WatchHandler::loadTypeFormats()
void WatchHandler::loadFormats()
{
QVariant value = DebuggerCore::sessionValue("DefaultFormats");
QMap<QString, QVariant> typeFormats = value.toMap();
QMapIterator<QString, QVariant> it(typeFormats);
QMapIterator<QString, QVariant> it(value.toMap());
while (it.hasNext()) {
it.next();
if (!it.key().isEmpty())
theTypeFormats.insert(it.key().toUtf8(), it.value().toInt());
}
value = DebuggerCore::sessionValue("IndividualFormats");
it = QMapIterator<QString, QVariant>(value.toMap());
while (it.hasNext()) {
it.next();
if (!it.key().isEmpty())
theIndividualFormats.insert(it.key().toUtf8(), it.value().toInt());
}
}
void WatchHandler::saveTypeFormats()
void WatchHandler::saveFormats()
{
QMap<QString, QVariant> typeFormats;
QMap<QString, QVariant> formats;
QHashIterator<QByteArray, int> it(theTypeFormats);
while (it.hasNext()) {
it.next();
......@@ -1839,21 +1846,32 @@ void WatchHandler::saveTypeFormats()
if (format != DecimalFormat) {
const QByteArray key = it.key().trimmed();
if (!key.isEmpty())
typeFormats.insert(QLatin1String(key), format);
formats.insert(QString::fromLatin1(key), format);
}
}
DebuggerCore::setSessionValue("DefaultFormats", typeFormats);
DebuggerCore::setSessionValue("DefaultFormats", formats);
formats.clear();
it = QHashIterator<QByteArray, int>(theIndividualFormats);
while (it.hasNext()) {
it.next();
const int format = it.value();
const QByteArray key = it.key().trimmed();
if (!key.isEmpty())
formats.insert(QString::fromLatin1(key), format);
}
DebuggerCore::setSessionValue("IndividualFormats", formats);
}
void WatchHandler::saveSessionData()
{
saveWatchers();
saveTypeFormats();
saveFormats();
}
void WatchHandler::loadSessionData()
{
loadTypeFormats();
loadFormats();
theWatcherNames.clear();
m_watcherCounter = 0;
QVariant value = DebuggerCore::sessionValue("Watchers");
......@@ -1927,7 +1945,7 @@ void WatchHandler::setFormat(const QByteArray &type0, int format)
theTypeFormats.remove(type);
else
theTypeFormats[type] = format;
saveTypeFormats();
saveFormats();
m_model->emitDataChanged(1);
}
......
......@@ -141,8 +141,8 @@ private:
friend class WatchModel;
void saveWatchers();
static void loadTypeFormats();
static void saveTypeFormats();
static void loadFormats();
static void saveFormats();
void setFormat(const QByteArray &type, int format);
......
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