From 183769e7ef586f613d2c429893c2d3c18588c051 Mon Sep 17 00:00:00 2001 From: hjk <qtc-committer@nokia.com> Date: Tue, 17 Jan 2012 18:44:02 +0100 Subject: [PATCH] debugger: grey out Locals&Expressions when not accessible Change-Id: I61489b9a5bf117be154ed6899beb3f8294247c9e Reviewed-by: hjk <qthjk@ovi.com> --- src/plugins/debugger/debuggerengine.cpp | 2 ++ src/plugins/debugger/stackhandler.cpp | 2 +- src/plugins/debugger/watchhandler.cpp | 29 ++++++++++++++++++++++++- src/plugins/debugger/watchhandler.h | 6 +++++ 4 files changed, 37 insertions(+), 2 deletions(-) diff --git a/src/plugins/debugger/debuggerengine.cpp b/src/plugins/debugger/debuggerengine.cpp index c0b5f16a890..1fd69445efe 100644 --- a/src/plugins/debugger/debuggerengine.cpp +++ b/src/plugins/debugger/debuggerengine.cpp @@ -239,6 +239,7 @@ public slots: void scheduleResetLocation() { m_stackHandler.scheduleResetLocation(); + m_watchHandler.scheduleResetLocation(); m_threadsHandler.scheduleResetLocation(); m_disassemblerAgent.scheduleResetLocation(); m_locationTimer.setSingleShot(true); @@ -250,6 +251,7 @@ public slots: m_locationTimer.stop(); m_locationMark.reset(); m_stackHandler.resetLocation(); + m_watchHandler.resetLocation(); m_threadsHandler.resetLocation(); m_disassemblerAgent.resetLocation(); } diff --git a/src/plugins/debugger/stackhandler.cpp b/src/plugins/debugger/stackhandler.cpp index 53ebfe23b25..37eb25d16af 100644 --- a/src/plugins/debugger/stackhandler.cpp +++ b/src/plugins/debugger/stackhandler.cpp @@ -155,7 +155,7 @@ Qt::ItemFlags StackHandler::flags(const QModelIndex &index) const const bool isValid = frame.isUsable() || debuggerCore()->boolSetting(OperateByInstruction); return isValid && m_contentsValid - ? QAbstractTableModel::flags(index) : Qt::ItemFlags(0); + ? QAbstractTableModel::flags(index) : Qt::ItemFlags(); } StackFrame StackHandler::currentFrame() const diff --git a/src/plugins/debugger/watchhandler.cpp b/src/plugins/debugger/watchhandler.cpp index 07b86092041..9fea42c7980 100644 --- a/src/plugins/debugger/watchhandler.cpp +++ b/src/plugins/debugger/watchhandler.cpp @@ -790,7 +790,7 @@ QVariant WatchModel::data(const QModelIndex &idx, int role) const static const QVariant red(QColor(200, 0, 0)); static const QVariant gray(QColor(140, 140, 140)); switch (idx.column()) { - case 1: return !data.valueEnabled ? gray + case 1: return (!data.valueEnabled || !m_handler->m_contentsValid) ? gray : data.changed ? red : QVariant(); } break; @@ -907,6 +907,9 @@ bool WatchModel::setData(const QModelIndex &index, const QVariant &value, int ro Qt::ItemFlags WatchModel::flags(const QModelIndex &idx) const { + if (!m_handler->m_contentsValid) + return Qt::ItemFlags(); + if (!idx.isValid()) return Qt::ItemFlags(); @@ -1253,6 +1256,9 @@ WatchHandler::WatchHandler(DebuggerEngine *engine) m_watchers = new WatchModel(this, WatchersWatch); m_tooltips = new WatchModel(this, TooltipsWatch); + m_contentsValid = false; + m_resetLocationScheduled = false; + connect(debuggerCore()->action(SortStructMembers), SIGNAL(valueChanged(QVariant)), SLOT(reinsertAllData())); connect(debuggerCore()->action(ShowStdNamespace), SIGNAL(valueChanged(QVariant)), @@ -1275,6 +1281,10 @@ void WatchHandler::endCycle() m_locals->endCycle(); m_watchers->endCycle(); m_tooltips->endCycle(); + + m_contentsValid = true; + m_resetLocationScheduled = false; + updateWatchersWindow(); } @@ -1858,5 +1868,22 @@ void WatchHandler::editTypeFormats(bool includeLocals, const QByteArray &iname) setTypeFormats(dlg.typeFormats()); } +void WatchHandler::scheduleResetLocation() +{ + m_contentsValid = false; + m_resetLocationScheduled = true; +} + +void WatchHandler::resetLocation() +{ + if (m_resetLocationScheduled) { + m_resetLocationScheduled = false; + m_return->reset(); + m_locals->reset(); + m_watchers->reset(); + m_tooltips->reset(); + } +} + } // namespace Internal } // namespace Debugger diff --git a/src/plugins/debugger/watchhandler.h b/src/plugins/debugger/watchhandler.h index 7edbf39cde8..2069f95474a 100644 --- a/src/plugins/debugger/watchhandler.h +++ b/src/plugins/debugger/watchhandler.h @@ -202,6 +202,9 @@ public: QString editorContents(); void editTypeFormats(bool includeLocals, const QByteArray &iname); + void scheduleResetLocation(); + void resetLocation(); + private: friend class WatchModel; @@ -234,6 +237,9 @@ private: DebuggerEngine *m_engine; int m_watcherCounter; + + bool m_contentsValid; + bool m_resetLocationScheduled; }; } // namespace Internal -- GitLab