From aff42fec75733f1c60ff3dd7c5e763c72619b2dd Mon Sep 17 00:00:00 2001 From: hjk <qtc-committer@nokia.com> Date: Thu, 1 Oct 2009 18:01:23 +0200 Subject: [PATCH] debugger: re-enable "data drill down on mouse hover" --- src/plugins/debugger/commonoptionspage.ui | 7 +++++ src/plugins/debugger/debuggermanager.cpp | 9 +------ src/plugins/debugger/debuggerplugin.cpp | 3 ++- src/plugins/debugger/debuggertooltip.cpp | 1 + src/plugins/debugger/gdb/gdbengine.cpp | 13 +++++----- src/plugins/debugger/watchhandler.cpp | 31 ++++++++++++----------- src/plugins/debugger/watchhandler.h | 13 ++++------ 7 files changed, 38 insertions(+), 39 deletions(-) diff --git a/src/plugins/debugger/commonoptionspage.ui b/src/plugins/debugger/commonoptionspage.ui index 04176b57dc3..4148ad84c06 100644 --- a/src/plugins/debugger/commonoptionspage.ui +++ b/src/plugins/debugger/commonoptionspage.ui @@ -41,6 +41,13 @@ </property> </widget> </item> + <item> + <widget class="QCheckBox" name="checkBoxUseToolTipsInMainEditor"> + <property name="text"> + <string>Use tooltips in main editor while debugging</string> + </property> + </widget> + </item> <item> <widget class="QCheckBox" name="checkBoxSkipKnownFrames"> <property name="toolTip"> diff --git a/src/plugins/debugger/debuggermanager.cpp b/src/plugins/debugger/debuggermanager.cpp index ddec9091f7c..f635bcf71e6 100644 --- a/src/plugins/debugger/debuggermanager.cpp +++ b/src/plugins/debugger/debuggermanager.cpp @@ -442,27 +442,20 @@ void DebuggerManager::init() registerView->setModel(d->m_registerHandler->model()); // Locals - d->m_watchHandler = new WatchHandler; + d->m_watchHandler = new WatchHandler(this); QTreeView *localsView = qobject_cast<QTreeView *>(d->m_localsWindow); localsView->setModel(d->m_watchHandler->model(LocalsWatch)); // Watchers QTreeView *watchersView = qobject_cast<QTreeView *>(d->m_watchersWindow); watchersView->setModel(d->m_watchHandler->model(WatchersWatch)); - connect(d->m_watchHandler, SIGNAL(sessionValueRequested(QString,QVariant*)), - this, SIGNAL(sessionValueRequested(QString,QVariant*))); - connect(d->m_watchHandler, SIGNAL(setSessionValueRequested(QString,QVariant)), - this, SIGNAL(setSessionValueRequested(QString,QVariant))); connect(theDebuggerAction(AssignValue), SIGNAL(triggered()), this, SLOT(assignValueInDebugger()), Qt::QueuedConnection); // Tooltip //QTreeView *tooltipView = qobject_cast<QTreeView *>(d->m_tooltipWindow); //tooltipView->setModel(d->m_watchHandler->model(TooltipsWatch)); - //qRegisterMetaType<WatchData>("WatchData"); qRegisterMetaType<WatchData>("WatchData"); - connect(d->m_watchHandler, SIGNAL(watchDataUpdateNeeded(Debugger::Internal::WatchData)), - this, SLOT(updateWatchData(Debugger::Internal::WatchData))); d->m_actions.continueAction = new QAction(tr("Continue"), this); d->m_actions.continueAction->setIcon(QIcon(":/debugger/images/debugger_continue_small.png")); diff --git a/src/plugins/debugger/debuggerplugin.cpp b/src/plugins/debugger/debuggerplugin.cpp index 9ec44d8970e..38202e0899e 100644 --- a/src/plugins/debugger/debuggerplugin.cpp +++ b/src/plugins/debugger/debuggerplugin.cpp @@ -293,7 +293,8 @@ QWidget *CommonOptionsPage::createPage(QWidget *parent) m_ui.checkBoxUseMessageBoxForSignals); m_group.insert(theDebuggerAction(SkipKnownFrames), m_ui.checkBoxSkipKnownFrames); - m_group.insert(theDebuggerAction(UseToolTipsInMainEditor), 0); + m_group.insert(theDebuggerAction(UseToolTipsInMainEditor), + m_ui.checkBoxUseToolTipsInMainEditor); m_group.insert(theDebuggerAction(UseToolTipsInLocalsView), 0); m_group.insert(theDebuggerAction(UseToolTipsInBreakpointsView), 0); m_group.insert(theDebuggerAction(UseAddressInBreakpointsView), 0); diff --git a/src/plugins/debugger/debuggertooltip.cpp b/src/plugins/debugger/debuggertooltip.cpp index 2dd960b59d6..c26ba6a7271 100644 --- a/src/plugins/debugger/debuggertooltip.cpp +++ b/src/plugins/debugger/debuggertooltip.cpp @@ -137,6 +137,7 @@ Q_SLOT void ToolTipWidget::computeSize() setMinimumSize(m_size); setMaximumSize(m_size); } + void ToolTipWidget::done() { qApp->removeEventFilter(this); diff --git a/src/plugins/debugger/gdb/gdbengine.cpp b/src/plugins/debugger/gdb/gdbengine.cpp index 0a66a9385ba..6aa664c6811 100644 --- a/src/plugins/debugger/gdb/gdbengine.cpp +++ b/src/plugins/debugger/gdb/gdbengine.cpp @@ -737,12 +737,10 @@ void GdbEngine::postCommandHelper(const GdbCommand &cmd) if (cmd.flags & RebuildModel) { ++m_pendingRequests; PENDING_DEBUG(" CALLBACK" << cmd.callbackName - << "INCREMENTS PENDING TO:" << m_pendingRequests << cmd.command - << m_gdbAdapter->state()); + << "INCREMENTS PENDING TO:" << m_pendingRequests << cmd.command); } else { PENDING_DEBUG(" UNKNOWN CALLBACK" << cmd.callbackName - << "LEAVES PENDING AT:" << m_pendingRequests << cmd.command - << m_gdbAdapter->state()); + << "LEAVES PENDING AT:" << m_pendingRequests << cmd.command); } if (cmd.flags & NeedsStop) { @@ -2512,7 +2510,6 @@ bool GdbEngine::showToolTip() WatchHandler *handler = manager()->watchHandler(); WatchModel *model = handler->model(TooltipsWatch); QString iname = tooltipINameForExpression(m_toolTipExpression); - model->setActiveData(iname); WatchItem *item = model->findItem(iname, model->rootItem()); if (!item) { hideDebuggerToolTip(); @@ -2745,7 +2742,7 @@ void GdbEngine::runDebuggingHelper(const WatchData &data0, bool dumpChildren) } WatchData data = data0; - // Avoid endless loops created by faulty dumpers + // Avoid endless loops created by faulty dumpers. QString processedName = QString(_("%1-%2").arg(dumpChildren).arg(data.iname)); if (m_processedNames.contains(processedName)) { emit gdbInputAvailable(LogStatus, @@ -2971,6 +2968,7 @@ void GdbEngine::updateWatchData(const WatchData &data) // Bump requests to avoid model rebuilding during the nested // updateWatchModel runs. ++m_pendingRequests; + PENDING_DEBUG("UPDATE WATCH BUMPS PENDING UP TO " << m_pendingRequests); #if 1 QMetaObject::invokeMethod(this, "updateWatchDataHelper", Qt::QueuedConnection, Q_ARG(WatchData, data)); @@ -2992,6 +2990,7 @@ void GdbEngine::updateWatchDataHelper(const WatchData &data) updateSubItem(data); //PENDING_DEBUG("INTERNAL TRIGGERING UPDATE WATCH MODEL"); --m_pendingRequests; + PENDING_DEBUG("UPDATE WATCH DONE BUMPS PENDING DOWN TO " << m_pendingRequests); if (m_pendingRequests <= 0) rebuildModel(); } @@ -3512,7 +3511,7 @@ void GdbEngine::setLocals(const QList<GdbMi> &locals) void GdbEngine::insertData(const WatchData &data0) { - //qDebug() << "INSERT DATA" << data0.toString(); + PENDING_DEBUG("INSERT DATA" << data0.toString()); WatchData data = data0; if (data.value.startsWith(__("mi_cmd_var_create:"))) { qDebug() << "BOGUS VALUE:" << data.toString(); diff --git a/src/plugins/debugger/watchhandler.cpp b/src/plugins/debugger/watchhandler.cpp index cc1c09cff63..04e3bee8f73 100644 --- a/src/plugins/debugger/watchhandler.cpp +++ b/src/plugins/debugger/watchhandler.cpp @@ -30,6 +30,7 @@ #include "watchhandler.h" #include "watchutils.h" #include "debuggeractions.h" +#include "debuggermanager.h" #if USE_MODEL_TEST #include "modeltest.h" @@ -589,8 +590,10 @@ void WatchModel::fetchMore(const QModelIndex &index) if (WatchItem *item = watchItem(index)) { item->fetchTriggered = true; WatchData data = *item; - data.setChildrenNeeded(); - emit m_handler->watchDataUpdateNeeded(data); + if (item->children.isEmpty()) { + data.setChildrenNeeded(); + m_handler->m_manager->updateWatchData(data); + } } } @@ -903,7 +906,7 @@ void WatchModel::insertData(const WatchData &data) void WatchModel::insertBulkData(const QList<WatchData> &list) { -#if 1 +#if 0 for (int i = 0; i != list.size(); ++i) insertData(list.at(i)); return; @@ -1037,8 +1040,9 @@ QDebug operator<<(QDebug d, const WatchModel &m) // /////////////////////////////////////////////////////////////////////// -WatchHandler::WatchHandler() +WatchHandler::WatchHandler(DebuggerManager *manager) { + m_manager = manager; m_expandPointers = true; m_inChange = false; @@ -1089,7 +1093,7 @@ void WatchHandler::insertData(const WatchData &data) MODEL_DEBUG("INSERTDATA: " << data.toString()); QTC_ASSERT(data.isValid(), return); if (data.isSomethingNeeded()) { - emit watchDataUpdateNeeded(data); + m_manager->updateWatchData(data); } else { WatchModel *model = modelForIName(data.iname); QTC_ASSERT(model, return); @@ -1097,10 +1101,10 @@ void WatchHandler::insertData(const WatchData &data) } } -// bulk-insertion +// Bulk-insertion void WatchHandler::insertBulkData(const QList<WatchData> &list) { -#if 0 +#if 1 foreach (const WatchItem &data, list) insertData(data); return; @@ -1123,7 +1127,7 @@ void WatchHandler::insertBulkData(const QList<WatchData> &list) foreach (const WatchData &data, list) { if (data.isSomethingNeeded()) - emit watchDataUpdateNeeded(data); + m_manager->updateWatchData(data); } } @@ -1160,7 +1164,6 @@ void WatchHandler::watchExpression(const QString &exp) data.iname = watcherName(exp); insertData(data); saveWatchers(); - //emit watchModelUpdateRequested(); } void WatchHandler::setDisplayedIName(const QString &iname, bool on) @@ -1273,8 +1276,7 @@ void WatchHandler::updateWatchers() void WatchHandler::loadWatchers() { - QVariant value; - sessionValueRequested("Watchers", &value); + QVariant value = m_manager->sessionValue("Watchers"); foreach (const QString &exp, value.toStringList()) m_watcherNames[exp] = watcherCounter++; @@ -1294,13 +1296,12 @@ void WatchHandler::saveWatchers() if (!watcherName.isEmpty() && watcherName != watcherEditPlaceHolder()) watcherNames.push_back(watcherName); } - setSessionValueRequested("Watchers", QVariant(watcherNames)); + m_manager->setSessionValue("Watchers", QVariant(watcherNames)); } void WatchHandler::loadTypeFormats() { - QVariant value; - sessionValueRequested("DefaultFormats", &value); + QVariant value = m_manager->sessionValue("DefaultFormats"); QMap<QString, QVariant> typeFormats = value.toMap(); QMapIterator<QString, QVariant> it(typeFormats); while (it.hasNext()) { @@ -1320,7 +1321,7 @@ void WatchHandler::saveTypeFormats() if (!key.isEmpty()) typeFormats.insert(key, it.value()); } - setSessionValueRequested("DefaultFormats", QVariant(typeFormats)); + m_manager->setSessionValue("DefaultFormats", QVariant(typeFormats)); } void WatchHandler::saveSessionData() diff --git a/src/plugins/debugger/watchhandler.h b/src/plugins/debugger/watchhandler.h index 285f004d8f0..eb2797f3e0e 100644 --- a/src/plugins/debugger/watchhandler.h +++ b/src/plugins/debugger/watchhandler.h @@ -44,6 +44,9 @@ class QDebug; QT_END_NAMESPACE namespace Debugger { + +class DebuggerManager; + namespace Internal { class WatchItem; @@ -203,7 +206,6 @@ private: void removeOutdatedHelper(WatchItem *item); WatchItem *rootItem() const; void removeItem(WatchItem *item); - void setActiveData(const QString &data) { m_activeData = data; } void emitDataChanged(int column, const QModelIndex &parentIndex = QModelIndex()); @@ -221,7 +223,6 @@ private: WatchHandler *m_handler; WatchType m_type; WatchItem *m_root; - QString m_activeData; }; class WatchHandler : public QObject @@ -229,7 +230,7 @@ class WatchHandler : public QObject Q_OBJECT public: - WatchHandler(); + explicit WatchHandler(DebuggerManager *manager); WatchModel *model(WatchType type) const; WatchModel *modelForIName(const QString &data) const; @@ -261,11 +262,6 @@ public: static QString watcherEditPlaceHolder(); -signals: - void watchDataUpdateNeeded(const Debugger::Internal::WatchData &data); - void sessionValueRequested(const QString &name, QVariant *value); - void setSessionValueRequested(const QString &name, const QVariant &value); - private: friend class WatchModel; @@ -294,6 +290,7 @@ private: WatchModel *m_locals; WatchModel *m_watchers; WatchModel *m_tooltips; + DebuggerManager *m_manager; }; } // namespace Internal -- GitLab