Commit f5ec093e authored by Kai Koehne's avatar Kai Koehne Committed by hjk

Debugger: Automatically adapt to the languages the running engine supports

We used to get the layout only from the current/last run configuration. However,
this fails for engines started by other means (Debug->Start Debugging submenu).

Change-Id: I87e12457c7cd68a326ac1827298a3542e149199b
Reviewed-by: default avatarhjk <qthjk@ovi.com>
parent b0a20e12
...@@ -134,6 +134,7 @@ public: ...@@ -134,6 +134,7 @@ public:
DebuggerLanguages m_previousDebugLanguages; DebuggerLanguages m_previousDebugLanguages;
DebuggerLanguages m_activeDebugLanguages; DebuggerLanguages m_activeDebugLanguages;
DebuggerLanguages m_engineDebugLanguages;
ActionContainer *m_viewsMenu; ActionContainer *m_viewsMenu;
...@@ -151,6 +152,7 @@ DebuggerMainWindowPrivate::DebuggerMainWindowPrivate(DebuggerMainWindow *mw) ...@@ -151,6 +152,7 @@ DebuggerMainWindowPrivate::DebuggerMainWindowPrivate(DebuggerMainWindow *mw)
, m_changingUI(false) , m_changingUI(false)
, m_previousDebugLanguages(AnyLanguage) , m_previousDebugLanguages(AnyLanguage)
, m_activeDebugLanguages(AnyLanguage) , m_activeDebugLanguages(AnyLanguage)
, m_engineDebugLanguages(AnyLanguage)
, m_viewsMenu(0) , m_viewsMenu(0)
{ {
createViewsMenuItems(); createViewsMenuItems();
...@@ -222,11 +224,15 @@ void DebuggerMainWindowPrivate::updateActiveLanguages() ...@@ -222,11 +224,15 @@ void DebuggerMainWindowPrivate::updateActiveLanguages()
{ {
DebuggerLanguages newLanguages = AnyLanguage; DebuggerLanguages newLanguages = AnyLanguage;
if (m_previousRunConfiguration) { if (m_engineDebugLanguages != AnyLanguage)
if (m_previousRunConfiguration.data()->useCppDebugger()) newLanguages = m_engineDebugLanguages;
newLanguages = CppLanguage; else {
if (m_previousRunConfiguration.data()->useQmlDebugger()) if (m_previousRunConfiguration) {
newLanguages |= QmlLanguage; if (m_previousRunConfiguration.data()->useCppDebugger())
newLanguages |= CppLanguage;
if (m_previousRunConfiguration.data()->useQmlDebugger())
newLanguages |= QmlLanguage;
}
} }
if (newLanguages != m_activeDebugLanguages) { if (newLanguages != m_activeDebugLanguages) {
...@@ -269,6 +275,15 @@ DebuggerLanguages DebuggerMainWindow::activeDebugLanguages() const ...@@ -269,6 +275,15 @@ DebuggerLanguages DebuggerMainWindow::activeDebugLanguages() const
return d->m_activeDebugLanguages; return d->m_activeDebugLanguages;
} }
void DebuggerMainWindow::setEngineDebugLanguages(DebuggerLanguages languages)
{
if (d->m_engineDebugLanguages == languages)
return;
d->m_engineDebugLanguages = languages;
d->updateActiveLanguages();
}
void DebuggerMainWindow::onModeChanged(IMode *mode) void DebuggerMainWindow::onModeChanged(IMode *mode)
{ {
d->m_inDebugMode = (mode && mode->id() == Constants::MODE_DEBUG); d->m_inDebugMode = (mode && mode->id() == Constants::MODE_DEBUG);
......
...@@ -62,6 +62,7 @@ public: ...@@ -62,6 +62,7 @@ public:
// Active languages to be debugged. // Active languages to be debugged.
DebuggerLanguages activeDebugLanguages() const; DebuggerLanguages activeDebugLanguages() const;
void setEngineDebugLanguages(DebuggerLanguages languages);
// Called when all dependent plugins have loaded. // Called when all dependent plugins have loaded.
void initialize(); void initialize();
......
...@@ -1967,6 +1967,8 @@ void DebuggerPluginPrivate::connectEngine(DebuggerEngine *engine) ...@@ -1967,6 +1967,8 @@ void DebuggerPluginPrivate::connectEngine(DebuggerEngine *engine)
//m_threadBox->setModelColumn(ThreadData::ComboNameColumn); //m_threadBox->setModelColumn(ThreadData::ComboNameColumn);
m_watchersWindow->setModel(engine->watchersModel()); m_watchersWindow->setModel(engine->watchersModel());
engine->watchHandler()->rebuildModel(); engine->watchHandler()->rebuildModel();
mainWindow()->setEngineDebugLanguages(engine->languages());
} }
static void changeFontSize(QWidget *widget, qreal size) static void changeFontSize(QWidget *widget, qreal size)
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment