Fixed auto-switching issues with QML inspector and c++ debugger

Reviewed-by: hjk
This commit is contained in:
Lasse Holmstedt
2010-04-13 15:15:02 +02:00
parent e959967f11
commit af3f10dfdd
4 changed files with 25 additions and 18 deletions

View File

@@ -1340,6 +1340,16 @@ void DebuggerPlugin::readSettings()
DebuggerSettings::instance()->readSettings(s);
}
static bool isCurrentProjectCppBased()
{
ProjectExplorer::ProjectExplorerPlugin *projectExplorer = ProjectExplorer::ProjectExplorerPlugin::instance();
Project *startupProject = projectExplorer->startupProject();
const QStringList cppProjectIds = QStringList() << QLatin1String("GenericProjectManager.GenericProject")
<< QLatin1String("CMakeProjectManager.CMakeProject")
<< QLatin1String("Qt4ProjectManager.Qt4Project");
return (startupProject && cppProjectIds.contains(startupProject->id()));
}
void DebuggerPlugin::onModeChanged(IMode *mode)
{
// FIXME: This one gets always called, even if switching between modes
@@ -1353,12 +1363,14 @@ void DebuggerPlugin::onModeChanged(IMode *mode)
if (editorManager->currentEditor()) {
editorManager->currentEditor()->widget()->setFocus();
if (editorManager->currentEditor()->id() == CppEditor::Constants::C_CPPEDITOR)
if (isCurrentProjectCppBased())
m_uiSwitcher->setActiveLanguage(LANG_CPP);
}
}
void DebuggerPlugin::showSettingsDialog()
{
Core::ICore::instance()->showOptionsDialog(