diff --git a/src/plugins/debugger/watchhandler.cpp b/src/plugins/debugger/watchhandler.cpp index 84c50ec6d65..d9df0986fbb 100644 --- a/src/plugins/debugger/watchhandler.cpp +++ b/src/plugins/debugger/watchhandler.cpp @@ -1817,21 +1817,28 @@ void WatchHandler::saveWatchers() DebuggerCore::setSessionValue("Watchers", watchedExpressions()); } -void WatchHandler::loadTypeFormats() +void WatchHandler::loadFormats() { QVariant value = DebuggerCore::sessionValue("DefaultFormats"); - QMap typeFormats = value.toMap(); - QMapIterator it(typeFormats); + QMapIterator 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(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 typeFormats; + QMap formats; QHashIterator 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(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); } diff --git a/src/plugins/debugger/watchhandler.h b/src/plugins/debugger/watchhandler.h index 3855b5b85d3..04cba314b34 100644 --- a/src/plugins/debugger/watchhandler.h +++ b/src/plugins/debugger/watchhandler.h @@ -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);