aboutsummaryrefslogtreecommitdiffstats
path: root/src/plugins
diff options
context:
space:
mode:
authorhjk <[email protected]>2010-06-23 14:11:52 +0200
committerhjk <[email protected]>2010-06-23 14:12:14 +0200
commited2862acce3f22bd1d7c83203eb445696426d438 (patch)
tree8c1f065dc244d490d6c8702bb544246875590e25 /src/plugins
parente7088e9c42ff5901773e7dafe39bae9cab7b71b6 (diff)
debugger: remove special mechanism to update watcher and return window
Diffstat (limited to 'src/plugins')
-rw-r--r--src/plugins/debugger/debuggerengine.cpp25
-rw-r--r--src/plugins/debugger/debuggerengine.h1
-rw-r--r--src/plugins/debugger/debuggerplugin.cpp19
-rw-r--r--src/plugins/debugger/debuggerplugin.h4
-rw-r--r--src/plugins/debugger/watchhandler.cpp9
5 files changed, 26 insertions, 32 deletions
diff --git a/src/plugins/debugger/debuggerengine.cpp b/src/plugins/debugger/debuggerengine.cpp
index 51929a406f4..aed2dd474b0 100644
--- a/src/plugins/debugger/debuggerengine.cpp
+++ b/src/plugins/debugger/debuggerengine.cpp
@@ -696,9 +696,10 @@ void DebuggerEngine::addToWatchWindow()
int line, column;
exp = cppExpressionAt(textEditor, tc.position(), &line, &column);
}
-
- if (!exp.isEmpty())
- watchHandler()->watchExpression(exp);
+ if (exp.isEmpty())
+ return;
+ watchHandler()->watchExpression(exp);
+ plugin()->updateState(this);
}
// Called from RunControl.
@@ -860,24 +861,18 @@ void DebuggerEngine::setState(DebuggerState state, bool forced)
//qDebug() << "STATUS CHANGE: FROM " << stateName(d->m_state)
// << " TO " << stateName(state);
+ DebuggerState oldState = d->m_state;
+ d->m_state = state;
+
QString msg = _("State changed from %1(%2) to %3(%4).")
- .arg(stateName(d->m_state)).arg(d->m_state).arg(stateName(state)).arg(state);
- //if (!((d->m_state == -1 && state == 0) || (d->m_state == 0 && state == 0)))
- // qDebug() << msg;
- if (!forced && !isAllowedTransition(d->m_state, state))
+ .arg(stateName(oldState)).arg(oldState).arg(stateName(state)).arg(state);
+ if (!forced && !isAllowedTransition(oldState, state))
qDebug() << "UNEXPECTED STATE TRANSITION: " << msg;
showMessage(msg, LogDebug);
-
- //resetLocation();
- if (state == d->m_state)
- return;
-
- d->m_state = state;
-
plugin()->updateState(this);
- if (d->m_state == DebuggerNotReady)
+ if (state != oldState && state == DebuggerNotReady)
d->m_runControl->debuggingFinished();
}
diff --git a/src/plugins/debugger/debuggerengine.h b/src/plugins/debugger/debuggerengine.h
index ad717273636..63c3691391c 100644
--- a/src/plugins/debugger/debuggerengine.h
+++ b/src/plugins/debugger/debuggerengine.h
@@ -253,6 +253,7 @@ public slots:
void quitDebugger() { exitDebugger(); }
protected:
+ friend class WatchHandler;
void setState(DebuggerState state, bool forced = false);
private:
diff --git a/src/plugins/debugger/debuggerplugin.cpp b/src/plugins/debugger/debuggerplugin.cpp
index dcdb33c6059..7ee5e70f3d2 100644
--- a/src/plugins/debugger/debuggerplugin.cpp
+++ b/src/plugins/debugger/debuggerplugin.cpp
@@ -52,7 +52,7 @@
#include "watchwindow.h"
#include "watchutils.h"
-#include "breakhandler.h"
+#include "breakhandler.h"
#include "stackhandler.h"
#include "watchhandler.h"
@@ -2072,7 +2072,15 @@ void DebuggerPluginPrivate::setSimpleDockWidgetArrangement(const QString &active
void DebuggerPluginPrivate::updateState(DebuggerEngine *engine)
{
+ m_watchersWindow->setVisible(
+ m_watchersWindow->model()->rowCount(QModelIndex()) > 0);
+ m_returnWindow->setVisible(
+ m_returnWindow->model()->rowCount(QModelIndex()) > 0);
+
QTC_ASSERT(engine, return);
+ if (m_state == engine->state())
+ return;
+
m_state = engine->state();
bool actionsEnabled = DebuggerEngine::debuggerActionsEnabled(m_state);
@@ -2171,9 +2179,6 @@ void DebuggerPluginPrivate::updateState(DebuggerEngine *engine)
theDebuggerAction(ExpandStack)->setEnabled(actionsEnabled);
theDebuggerAction(ExecuteCommand)->setEnabled(m_state == InferiorStopped);
- m_watchersWindow->setVisible(false);
- m_returnWindow->setVisible(false);
-
const bool notbusy = m_state == InferiorStopped
|| m_state == DebuggerNotReady
|| m_state == InferiorUnrunnable;
@@ -2565,12 +2570,6 @@ void DebuggerPlugin::extensionsInitialized()
//d->m_uiSwitcher->initialize();
}
-void DebuggerPlugin::updateWatchersWindow(bool showWatchers, bool showReturn)
-{
- d->m_watchersWindow->setVisible(showWatchers);
- d->m_returnWindow->setVisible(showReturn);
-}
-
QWidget *DebuggerPlugin::mainWindow() const
{
return d->m_uiSwitcher->mainWindow();
diff --git a/src/plugins/debugger/debuggerplugin.h b/src/plugins/debugger/debuggerplugin.h
index 61e87d7ebbe..552f5184b0a 100644
--- a/src/plugins/debugger/debuggerplugin.h
+++ b/src/plugins/debugger/debuggerplugin.h
@@ -101,12 +101,12 @@ public:
// This contains per-session data like breakpoints and watched
// expression. It serves as a template for new engine instantiations.
Internal::DebuggerEngine *sessionTemplate();
+ void updateState(Internal::DebuggerEngine *engine);
public slots:
void exitDebugger(); // FIXME: remove
void clearCppCodeModelSnapshot();
void ensureLogVisible();
- void updateWatchersWindow(bool showWatchers, bool showReturn);
// void runTest(const QString &fileName);
void showMessage(const QString &msg, int channel, int timeout = -1);
@@ -123,8 +123,6 @@ private:
void extensionsInitialized();
void remoteCommand(const QStringList &options, const QStringList &arguments);
- void updateState(Internal::DebuggerEngine *engine);
-
QWidget *mainWindow() const;
private:
diff --git a/src/plugins/debugger/watchhandler.cpp b/src/plugins/debugger/watchhandler.cpp
index 63a5a578353..2118ddd9ea4 100644
--- a/src/plugins/debugger/watchhandler.cpp
+++ b/src/plugins/debugger/watchhandler.cpp
@@ -1226,6 +1226,7 @@ void WatchHandler::watchExpression(const QString &exp)
m_engine->updateWatchData(data);
updateWatchersWindow();
saveWatchers();
+ emitAllChanged();
}
static void swapEndian(char *d, int nchar)
@@ -1340,13 +1341,14 @@ void WatchHandler::removeWatchExpression(const QString &exp0)
break;
}
}
+ updateWatchersWindow();
+ emitAllChanged();
}
void WatchHandler::updateWatchersWindow()
{
- const bool showWatchers = m_watchers->rowCount(QModelIndex()) > 0;
- const bool showReturn = m_return->rowCount(QModelIndex()) > 0;
- plugin()->updateWatchersWindow(showWatchers, showReturn);
+ // Force show/hide of watchers and return view.
+ plugin()->updateState(m_engine);
}
void WatchHandler::updateWatchers()
@@ -1370,7 +1372,6 @@ void WatchHandler::loadWatchers()
m_watcherNames[exp.toLatin1()] = watcherCounter++;
//qDebug() << "LOAD WATCHERS: " << m_watchers;
- //reinitializeWatchersHelper();
}
QStringList WatchHandler::watchedExpressions() const