forked from qt-creator/qt-creator
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: David Schulz <david.schulz@digia.com>
This commit is contained in:
@@ -1817,21 +1817,28 @@ void WatchHandler::saveWatchers()
|
|||||||
DebuggerCore::setSessionValue("Watchers", watchedExpressions());
|
DebuggerCore::setSessionValue("Watchers", watchedExpressions());
|
||||||
}
|
}
|
||||||
|
|
||||||
void WatchHandler::loadTypeFormats()
|
void WatchHandler::loadFormats()
|
||||||
{
|
{
|
||||||
QVariant value = DebuggerCore::sessionValue("DefaultFormats");
|
QVariant value = DebuggerCore::sessionValue("DefaultFormats");
|
||||||
QMap<QString, QVariant> typeFormats = value.toMap();
|
QMapIterator<QString, QVariant> it(value.toMap());
|
||||||
QMapIterator<QString, QVariant> it(typeFormats);
|
|
||||||
while (it.hasNext()) {
|
while (it.hasNext()) {
|
||||||
it.next();
|
it.next();
|
||||||
if (!it.key().isEmpty())
|
if (!it.key().isEmpty())
|
||||||
theTypeFormats.insert(it.key().toUtf8(), it.value().toInt());
|
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);
|
QHashIterator<QByteArray, int> it(theTypeFormats);
|
||||||
while (it.hasNext()) {
|
while (it.hasNext()) {
|
||||||
it.next();
|
it.next();
|
||||||
@@ -1839,21 +1846,32 @@ void WatchHandler::saveTypeFormats()
|
|||||||
if (format != DecimalFormat) {
|
if (format != DecimalFormat) {
|
||||||
const QByteArray key = it.key().trimmed();
|
const QByteArray key = it.key().trimmed();
|
||||||
if (!key.isEmpty())
|
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()
|
void WatchHandler::saveSessionData()
|
||||||
{
|
{
|
||||||
saveWatchers();
|
saveWatchers();
|
||||||
saveTypeFormats();
|
saveFormats();
|
||||||
}
|
}
|
||||||
|
|
||||||
void WatchHandler::loadSessionData()
|
void WatchHandler::loadSessionData()
|
||||||
{
|
{
|
||||||
loadTypeFormats();
|
loadFormats();
|
||||||
theWatcherNames.clear();
|
theWatcherNames.clear();
|
||||||
m_watcherCounter = 0;
|
m_watcherCounter = 0;
|
||||||
QVariant value = DebuggerCore::sessionValue("Watchers");
|
QVariant value = DebuggerCore::sessionValue("Watchers");
|
||||||
@@ -1927,7 +1945,7 @@ void WatchHandler::setFormat(const QByteArray &type0, int format)
|
|||||||
theTypeFormats.remove(type);
|
theTypeFormats.remove(type);
|
||||||
else
|
else
|
||||||
theTypeFormats[type] = format;
|
theTypeFormats[type] = format;
|
||||||
saveTypeFormats();
|
saveFormats();
|
||||||
m_model->emitDataChanged(1);
|
m_model->emitDataChanged(1);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -141,8 +141,8 @@ private:
|
|||||||
friend class WatchModel;
|
friend class WatchModel;
|
||||||
|
|
||||||
void saveWatchers();
|
void saveWatchers();
|
||||||
static void loadTypeFormats();
|
static void loadFormats();
|
||||||
static void saveTypeFormats();
|
static void saveFormats();
|
||||||
|
|
||||||
void setFormat(const QByteArray &type, int format);
|
void setFormat(const QByteArray &type, int format);
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user