forked from qt-creator/qt-creator
debugger: centralize check for changed display entries
Change-Id: I22c58812990925102aeeb80571bb877fd0a2924b Reviewed-on: http://codereview.qt.nokia.com/3330 Reviewed-by: Qt Sanity Bot <qt_sanity_bot@ovi.com> Reviewed-by: hjk <qthjk@ovi.com>
This commit is contained in:
@@ -383,8 +383,7 @@ QString WatchData::toToolTip() const
|
|||||||
formatToolTipRow(str, tr("Referencing Address"),
|
formatToolTipRow(str, tr("Referencing Address"),
|
||||||
QString::fromAscii(hexReferencingAddress()));
|
QString::fromAscii(hexReferencingAddress()));
|
||||||
if (size)
|
if (size)
|
||||||
formatToolTipRow(str, tr("Size"),
|
formatToolTipRow(str, tr("Size"), QString::number(size));
|
||||||
QString::number(size));
|
|
||||||
formatToolTipRow(str, tr("Internal ID"), iname);
|
formatToolTipRow(str, tr("Internal ID"), iname);
|
||||||
formatToolTipRow(str, tr("Generation"),
|
formatToolTipRow(str, tr("Generation"),
|
||||||
QString::number(generation));
|
QString::number(generation));
|
||||||
@@ -437,6 +436,11 @@ QByteArray WatchData::hexReferencingAddress() const
|
|||||||
return QByteArray();
|
return QByteArray();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool WatchData::hasChanged(const WatchData &old) const
|
||||||
|
{
|
||||||
|
return !value.isEmpty() && value != old.value && value != msgNotInScope();
|
||||||
|
}
|
||||||
|
|
||||||
} // namespace Internal
|
} // namespace Internal
|
||||||
} // namespace Debugger
|
} // namespace Debugger
|
||||||
|
|
||||||
|
@@ -113,6 +113,7 @@ public:
|
|||||||
quint64 coreAddress() const;
|
quint64 coreAddress() const;
|
||||||
QByteArray hexAddress() const;
|
QByteArray hexAddress() const;
|
||||||
QByteArray hexReferencingAddress() const;
|
QByteArray hexReferencingAddress() const;
|
||||||
|
bool hasChanged(const WatchData &old) const;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
quint64 id; // Token for the engine for internal mapping
|
quint64 id; // Token for the engine for internal mapping
|
||||||
|
@@ -71,9 +71,6 @@ enum { debugModel = 0 };
|
|||||||
#define MODEL_DEBUG(s) do { if (debugModel) qDebug() << s; } while (0)
|
#define MODEL_DEBUG(s) do { if (debugModel) qDebug() << s; } while (0)
|
||||||
#define MODEL_DEBUGX(s) qDebug() << s
|
#define MODEL_DEBUGX(s) qDebug() << s
|
||||||
|
|
||||||
static const QString strNotInScope =
|
|
||||||
QCoreApplication::translate("Debugger::Internal::WatchData", "<not in scope>");
|
|
||||||
|
|
||||||
static int watcherCounter = 0;
|
static int watcherCounter = 0;
|
||||||
static int generationCounter = 0;
|
static int generationCounter = 0;
|
||||||
|
|
||||||
@@ -1008,11 +1005,8 @@ void WatchModel::insertData(const WatchData &data)
|
|||||||
if (WatchItem *oldItem = findItem(data.iname, parent)) {
|
if (WatchItem *oldItem = findItem(data.iname, parent)) {
|
||||||
bool hadChildren = oldItem->hasChildren;
|
bool hadChildren = oldItem->hasChildren;
|
||||||
// Overwrite old entry.
|
// Overwrite old entry.
|
||||||
bool changed = !data.value.isEmpty()
|
|
||||||
&& data.value != oldItem->value
|
|
||||||
&& data.value != strNotInScope;
|
|
||||||
oldItem->setData(data);
|
oldItem->setData(data);
|
||||||
oldItem->changed = changed;
|
oldItem->changed = data.hasChanged(*oldItem);
|
||||||
oldItem->generation = generationCounter;
|
oldItem->generation = generationCounter;
|
||||||
QModelIndex idx = watchIndex(oldItem);
|
QModelIndex idx = watchIndex(oldItem);
|
||||||
emit dataChanged(idx, idx.sibling(idx.row(), 2));
|
emit dataChanged(idx, idx.sibling(idx.row(), 2));
|
||||||
@@ -1096,10 +1090,7 @@ void WatchModel::insertBulkData(const QList<WatchData> &list)
|
|||||||
data.generation = generationCounter;
|
data.generation = generationCounter;
|
||||||
newList.insert(oldSortKey, data);
|
newList.insert(oldSortKey, data);
|
||||||
} else {
|
} else {
|
||||||
bool changed = !it->value.isEmpty()
|
it->changed = it->hasChanged(*oldItem);
|
||||||
&& it->value != oldItem->value
|
|
||||||
&& it->value != strNotInScope;
|
|
||||||
it->changed = changed;
|
|
||||||
if (it->generation == -1)
|
if (it->generation == -1)
|
||||||
it->generation = generationCounter;
|
it->generation = generationCounter;
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user