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"),
|
||||
QString::fromAscii(hexReferencingAddress()));
|
||||
if (size)
|
||||
formatToolTipRow(str, tr("Size"),
|
||||
QString::number(size));
|
||||
formatToolTipRow(str, tr("Size"), QString::number(size));
|
||||
formatToolTipRow(str, tr("Internal ID"), iname);
|
||||
formatToolTipRow(str, tr("Generation"),
|
||||
QString::number(generation));
|
||||
@@ -437,6 +436,11 @@ QByteArray WatchData::hexReferencingAddress() const
|
||||
return QByteArray();
|
||||
}
|
||||
|
||||
bool WatchData::hasChanged(const WatchData &old) const
|
||||
{
|
||||
return !value.isEmpty() && value != old.value && value != msgNotInScope();
|
||||
}
|
||||
|
||||
} // namespace Internal
|
||||
} // namespace Debugger
|
||||
|
||||
|
@@ -113,6 +113,7 @@ public:
|
||||
quint64 coreAddress() const;
|
||||
QByteArray hexAddress() const;
|
||||
QByteArray hexReferencingAddress() const;
|
||||
bool hasChanged(const WatchData &old) const;
|
||||
|
||||
public:
|
||||
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_DEBUGX(s) qDebug() << s
|
||||
|
||||
static const QString strNotInScope =
|
||||
QCoreApplication::translate("Debugger::Internal::WatchData", "<not in scope>");
|
||||
|
||||
static int watcherCounter = 0;
|
||||
static int generationCounter = 0;
|
||||
|
||||
@@ -1008,11 +1005,8 @@ void WatchModel::insertData(const WatchData &data)
|
||||
if (WatchItem *oldItem = findItem(data.iname, parent)) {
|
||||
bool hadChildren = oldItem->hasChildren;
|
||||
// Overwrite old entry.
|
||||
bool changed = !data.value.isEmpty()
|
||||
&& data.value != oldItem->value
|
||||
&& data.value != strNotInScope;
|
||||
oldItem->setData(data);
|
||||
oldItem->changed = changed;
|
||||
oldItem->changed = data.hasChanged(*oldItem);
|
||||
oldItem->generation = generationCounter;
|
||||
QModelIndex idx = watchIndex(oldItem);
|
||||
emit dataChanged(idx, idx.sibling(idx.row(), 2));
|
||||
@@ -1096,10 +1090,7 @@ void WatchModel::insertBulkData(const QList<WatchData> &list)
|
||||
data.generation = generationCounter;
|
||||
newList.insert(oldSortKey, data);
|
||||
} else {
|
||||
bool changed = !it->value.isEmpty()
|
||||
&& it->value != oldItem->value
|
||||
&& it->value != strNotInScope;
|
||||
it->changed = changed;
|
||||
it->changed = it->hasChanged(*oldItem);
|
||||
if (it->generation == -1)
|
||||
it->generation = generationCounter;
|
||||
}
|
||||
|
Reference in New Issue
Block a user