Debugger UI: Don't switch layout while debugging

Reviewed-by: hjk
This commit is contained in:
Lasse Holmstedt
2010-08-27 16:22:51 +02:00
parent f38942d843
commit afdd933ff3
5 changed files with 31 additions and 17 deletions

View File

@@ -2766,6 +2766,11 @@ bool DebuggerPlugin::isRegisterViewVisible() const
return d->m_registerDock->toggleViewAction()->isChecked(); return d->m_registerDock->toggleViewAction()->isChecked();
} }
bool DebuggerPlugin::hasSnapsnots() const
{
return d->m_snapshotHandler->size();
}
static inline bool canShutDown(DebuggerState s) static inline bool canShutDown(DebuggerState s)
{ {
switch (s) { switch (s) {

View File

@@ -87,6 +87,7 @@ public:
const CPlusPlus::Snapshot &cppCodeModelSnapshot() const; const CPlusPlus::Snapshot &cppCodeModelSnapshot() const;
bool isRegisterViewVisible() const; bool isRegisterViewVisible() const;
bool hasSnapsnots() const;
void openTextEditor(const QString &titlePattern, const QString &contents); void openTextEditor(const QString &titlePattern, const QString &contents);

View File

@@ -151,7 +151,8 @@ static DebuggerStartParameters localStartParameters(RunConfiguration *runConfigu
sp.dumperLibrary = rc->dumperLibrary(); sp.dumperLibrary = rc->dumperLibrary();
sp.dumperLibraryLocations = rc->dumperLibraryLocations(); sp.dumperLibraryLocations = rc->dumperLibraryLocations();
if (DebuggerRunControl::isQmlProject(runConfiguration)) { DebuggerLanguages activeLangs = DebuggerUISwitcher::instance()->activeDebugLanguages();
if (activeLangs & QmlLanguage) {
sp.qmlServerAddress = QLatin1String("127.0.0.1"); sp.qmlServerAddress = QLatin1String("127.0.0.1");
sp.qmlServerPort = rc->environment().value("QML_DEBUG_SERVER_PORT").toUInt(); sp.qmlServerPort = rc->environment().value("QML_DEBUG_SERVER_PORT").toUInt();
if (sp.qmlServerPort == 0) if (sp.qmlServerPort == 0)
@@ -380,7 +381,7 @@ void DebuggerRunControl::createEngine(const DebuggerStartParameters &startParams
if (!engineType) if (!engineType)
engineType = engineForMode(sp.startMode); engineType = engineForMode(sp.startMode);
if (engineType != QmlEngineType && sp.m_isQmlProject && (activeLangs & QmlLanguage)) { if (engineType != QmlEngineType && (activeLangs & QmlLanguage)) {
if (activeLangs & CppLanguage) { if (activeLangs & CppLanguage) {
sp.cppEngineType = engineType; sp.cppEngineType = engineType;
engineType = QmlCppEngineType; engineType = QmlCppEngineType;
@@ -497,14 +498,16 @@ void DebuggerRunControl::start()
return; return;
} }
plugin()->activateDebugMode(); DebuggerUISwitcher::instance()->aboutToStartDebugger();
const QString message = tr("Starting debugger '%1' for tool chain '%2'..."). const QString message = tr("Starting debugger '%1' for tool chain '%2'...").
arg(m_engine->objectName(), toolChainName(sp.toolChainType)); arg(m_engine->objectName(), toolChainName(sp.toolChainType));
plugin()->showMessage(message, StatusBar); plugin()->showMessage(message, StatusBar);
plugin()->showMessage(DebuggerSettings::instance()->dump(), LogDebug); plugin()->showMessage(DebuggerSettings::instance()->dump(), LogDebug);
plugin()->runControlStarted(this); plugin()->runControlStarted(this);
plugin()->activateDebugMode();
engine()->startDebugger(this); engine()->startDebugger(this);
m_running = true; m_running = true;
emit started(); emit started();

View File

@@ -32,6 +32,7 @@
#include "debuggeractions.h" #include "debuggeractions.h"
#include "debuggerconstants.h" #include "debuggerconstants.h"
#include "debuggerrunner.h" #include "debuggerrunner.h"
#include "debuggerplugin.h"
#include "savedaction.h" #include "savedaction.h"
#include <utils/savedaction.h> #include <utils/savedaction.h>
@@ -305,23 +306,20 @@ void DebuggerUISwitcher::modeChanged(Core::IMode *mode)
d->m_mainWindow->setDockActionsVisible(d->m_inDebugMode); d->m_mainWindow->setDockActionsVisible(d->m_inDebugMode);
hideInactiveWidgets(); hideInactiveWidgets();
if (mode->id() != Constants::MODE_DEBUG) if (mode->id() != Constants::MODE_DEBUG || DebuggerPlugin::instance()->hasSnapsnots())
return; return;
Core::EditorManager *editorManager = Core::EditorManager::instance(); DebuggerLanguages activeLangs;
if (editorManager->currentEditor()) { if (isCurrentProjectCppBased())
DebuggerLanguages activeLangs; activeLangs |= CppLanguage;
if (isCurrentProjectCppBased())
activeLangs |= CppLanguage;
if (isCurrentProjectQmlCppBased()) if (isCurrentProjectQmlCppBased())
activeLangs |= QmlLanguage; activeLangs |= QmlLanguage;
if (d->m_activateCppAction) if (d->m_activateCppAction)
d->m_activateCppAction->setChecked(activeLangs & CppLanguage); d->m_activateCppAction->setChecked(activeLangs & CppLanguage);
if (d->m_activateQmlAction) if (d->m_activateQmlAction)
d->m_activateQmlAction->setChecked(activeLangs & QmlLanguage); d->m_activateQmlAction->setChecked(activeLangs & QmlLanguage);
}
updateActiveLanguages(); updateActiveLanguages();
} }
@@ -634,6 +632,12 @@ QWidget *DebuggerUISwitcher::createContents(Core::BaseMode *mode)
return splitter; return splitter;
} }
void DebuggerUISwitcher::aboutToStartDebugger()
{
if (!DebuggerPlugin::instance()->hasSnapsnots())
updateActiveLanguages();
}
void DebuggerUISwitcher::aboutToShutdown() void DebuggerUISwitcher::aboutToShutdown()
{ {
writeSettings(); writeSettings();

View File

@@ -94,6 +94,7 @@ public:
// called when all dependent plugins have loaded // called when all dependent plugins have loaded
void initialize(); void initialize();
void aboutToStartDebugger();
void aboutToShutdown(); void aboutToShutdown();
// most common debugger windows // most common debugger windows