Commit 7afef496 authored by Lasse Holmstedt's avatar Lasse Holmstedt

Qml Debugger: Code style and cleanup

Reviewed-by: hjk
parent 29083530
......@@ -66,17 +66,17 @@ const int QML_DEFAULT_DEBUG_SERVER_PORT = 3768;
const char * const E_QML_DEBUG_SERVER_PORT = "QML_DEBUG_SERVER_PORT";
// dock widget names
const char * const DW_BREAK = "Debugger.Docks.Break";
const char * const DW_MODULES = "Debugger.Docks.Modules";
const char * const DW_REGISTER = "Debugger.Docks.Register";
const char * const DW_OUTPUT = "Debugger.Docks.Output";
const char * const DW_SNAPSHOTS = "Debugger.Docks.Snapshots";
const char * const DW_STACK = "Debugger.Docks.Stack";
const char * const DW_SOURCE_FILES = "Debugger.Docks.SourceFiles";
const char * const DW_THREADS = "Debugger.Docks.Threads";
const char * const DW_WATCHERS = "Debugger.Docks.LocalsAndWatchers";
const char * const DW_QML_INSPECTOR = "Debugger.Docks.QmlInspector";
const char * const DOCKWIDGET_BREAK = "Debugger.Docks.Break";
const char * const DOCKWIDGET_MODULES = "Debugger.Docks.Modules";
const char * const DOCKWIDGET_REGISTER = "Debugger.Docks.Register";
const char * const DOCKWIDGET_OUTPUT = "Debugger.Docks.Output";
const char * const DOCKWIDGET_SNAPSHOTS = "Debugger.Docks.Snapshots";
const char * const DOCKWIDGET_STACK = "Debugger.Docks.Stack";
const char * const DOCKWIDGET_SOURCE_FILES = "Debugger.Docks.SourceFiles";
const char * const DOCKWIDGET_THREADS = "Debugger.Docks.Threads";
const char * const DOCKWIDGET_WATCHERS = "Debugger.Docks.LocalsAndWatchers";
const char * const DOCKWIDGET_QML_INSPECTOR = "Debugger.Docks.QmlInspector";
namespace Internal {
enum { debug = 0 };
......@@ -296,9 +296,9 @@ enum DebuggerEngineType
enum DebuggerLanguage
{
Lang_None = 0x0,
Lang_Cpp = 0x1,
Lang_Qml = 0x2
AnyLanguage = 0x0,
CppLanguage = 0x1,
QmlLanguage = 0x2
};
Q_DECLARE_FLAGS(DebuggerLanguages, DebuggerLanguage)
......
......@@ -106,14 +106,14 @@ using namespace TextEditor;
///////////////////////////////////////////////////////////////////////
DebuggerStartParameters::DebuggerStartParameters()
: attachPID(-1)
, useTerminal(false)
, breakAtMain(false)
, qmlServerAddress("127.0.0.1")
, qmlServerPort(0)
, toolChainType(ToolChain::UNKNOWN)
, startMode(NoStartMode)
, executableUid(0)
: attachPID(-1),
useTerminal(false),
breakAtMain(false),
qmlServerAddress("127.0.0.1"),
qmlServerPort(0),
toolChainType(ToolChain::UNKNOWN),
startMode(NoStartMode),
executableUid(0)
{}
void DebuggerStartParameters::clear()
......
......@@ -80,6 +80,7 @@ public:
QString qmlServerAddress;
quint16 qmlServerPort;
DebuggerEngineType cppEngineType; // for cpp+qml debugging
bool m_isQmlProject;
// for remote debugging
QString remoteChannel;
......
......@@ -64,16 +64,14 @@ QMenu* DebuggerMainWindow::createPopupMenu()
{
QMenu *menu = 0;
const QList<Internal::DebugToolWindow* > dockwidgets = m_uiSwitcher->i_mw_debugToolWindows();
const QList<QDockWidget* > dockwidgets = m_uiSwitcher->i_mw_dockWidgets();
if (!dockwidgets.isEmpty()) {
menu = new QMenu(this);
for (int i = 0; i < dockwidgets.size(); ++i) {
QDockWidget *dockWidget = dockwidgets.at(i)->m_dockWidget;
if (dockWidget->parentWidget() == this) {
foreach (QDockWidget *dockWidget, dockwidgets) {
if (dockWidget->parentWidget() == this)
menu->addAction(dockWidget->toggleViewAction());
}
}
menu->addSeparator();
}
......
......@@ -40,15 +40,6 @@ class DebuggerUISwitcher;
namespace Internal {
class DebugToolWindow
{
public:
DebugToolWindow() : m_dockWidget(0), m_visible(false) {}
QDockWidget *m_dockWidget;
bool m_visible;
};
class DebuggerMainWindow : public Utils::FancyMainWindow
{
Q_OBJECT
......
......@@ -1218,40 +1218,40 @@ bool DebuggerPluginPrivate::initialize(const QStringList &arguments, QString *er
// Cpp/Qml ui setup
m_uiSwitcher = new DebuggerUISwitcher(m_debugMode, this);
ExtensionSystem::PluginManager::instance()->addObject(m_uiSwitcher);
m_uiSwitcher->addLanguage(Lang_Cpp, tr("C++"), cppDebuggercontext);
m_uiSwitcher->addLanguage(CppLanguage, tr("C++"), cppDebuggercontext);
// Dock widgets
m_breakDock = m_uiSwitcher->createDockWidget(Lang_Cpp, m_breakWindow);
m_breakDock->setObjectName(QString(DW_BREAK));
m_modulesDock = m_uiSwitcher->createDockWidget(Lang_Cpp, m_modulesWindow,
Qt::TopDockWidgetArea, false);
m_modulesDock->setObjectName(QString(DW_MODULES));
m_breakDock = m_uiSwitcher->createDockWidget(CppLanguage, m_breakWindow);
m_breakDock->setObjectName(QString(DOCKWIDGET_BREAK));
m_modulesDock = m_uiSwitcher->createDockWidget(CppLanguage, m_modulesWindow,
Qt::TopDockWidgetArea);
m_modulesDock->setObjectName(QString(DOCKWIDGET_MODULES));
connect(m_modulesDock->toggleViewAction(), SIGNAL(toggled(bool)),
SLOT(modulesDockToggled(bool)), Qt::QueuedConnection);
m_registerDock = m_uiSwitcher->createDockWidget(Lang_Cpp, m_registerWindow,
Qt::TopDockWidgetArea, false);
m_registerDock->setObjectName(QString(DW_REGISTER));
m_registerDock = m_uiSwitcher->createDockWidget(CppLanguage, m_registerWindow,
Qt::TopDockWidgetArea);
m_registerDock->setObjectName(QString(DOCKWIDGET_REGISTER));
connect(m_registerDock->toggleViewAction(), SIGNAL(toggled(bool)),
SLOT(registerDockToggled(bool)), Qt::QueuedConnection);
m_outputDock = m_uiSwitcher->createDockWidget(Lang_None, m_outputWindow,
Qt::TopDockWidgetArea, false);
m_outputDock->setObjectName(QString(DW_OUTPUT));
m_snapshotDock = m_uiSwitcher->createDockWidget(Lang_Cpp, m_snapshotWindow);
m_snapshotDock->setObjectName(QString(DW_SNAPSHOTS));
m_outputDock = m_uiSwitcher->createDockWidget(AnyLanguage, m_outputWindow,
Qt::TopDockWidgetArea);
m_outputDock->setObjectName(QString(DOCKWIDGET_OUTPUT));
m_snapshotDock = m_uiSwitcher->createDockWidget(CppLanguage, m_snapshotWindow);
m_snapshotDock->setObjectName(QString(DOCKWIDGET_SNAPSHOTS));
m_stackDock = m_uiSwitcher->createDockWidget(Lang_Cpp, m_stackWindow);
m_stackDock->setObjectName(QString(DW_STACK));
m_stackDock = m_uiSwitcher->createDockWidget(CppLanguage, m_stackWindow);
m_stackDock->setObjectName(QString(DOCKWIDGET_STACK));
m_sourceFilesDock = m_uiSwitcher->createDockWidget(Lang_Cpp,
m_sourceFilesWindow, Qt::TopDockWidgetArea, false);
m_sourceFilesDock->setObjectName(QString(DW_SOURCE_FILES));
m_sourceFilesDock = m_uiSwitcher->createDockWidget(CppLanguage,
m_sourceFilesWindow, Qt::TopDockWidgetArea);
m_sourceFilesDock->setObjectName(QString(DOCKWIDGET_SOURCE_FILES));
connect(m_sourceFilesDock->toggleViewAction(), SIGNAL(toggled(bool)),
SLOT(sourceFilesDockToggled(bool)), Qt::QueuedConnection);
m_threadsDock = m_uiSwitcher->createDockWidget(Lang_Cpp, m_threadsWindow);
m_threadsDock->setObjectName(QString(DW_THREADS));
m_threadsDock = m_uiSwitcher->createDockWidget(CppLanguage, m_threadsWindow);
m_threadsDock->setObjectName(QString(DOCKWIDGET_THREADS));
QSplitter *localsAndWatchers = new Core::MiniSplitter(Qt::Vertical);
localsAndWatchers->setObjectName(QLatin1String("CppDebugLocalsAndWatchers"));
......@@ -1263,8 +1263,8 @@ bool DebuggerPluginPrivate::initialize(const QStringList &arguments, QString *er
localsAndWatchers->setStretchFactor(1, 1);
localsAndWatchers->setStretchFactor(2, 1);
m_watchDock = m_uiSwitcher->createDockWidget(Lang_Cpp, localsAndWatchers);
m_watchDock->setObjectName(QString(DW_WATCHERS));
m_watchDock = m_uiSwitcher->createDockWidget(CppLanguage, localsAndWatchers);
m_watchDock->setObjectName(QString(DOCKWIDGET_WATCHERS));
m_dockWidgets << m_breakDock << m_modulesDock << m_registerDock
<< m_outputDock << m_snapshotDock << m_stackDock
......@@ -1359,7 +1359,7 @@ bool DebuggerPluginPrivate::initialize(const QStringList &arguments, QString *er
cmd = am->registerAction(m_detachAction,
Constants::DETACH, globalcontext);
cmd->setAttribute(Command::CA_Hide);
m_uiSwitcher->addMenuAction(cmd, Lang_None, CC::G_DEFAULT_ONE);
m_uiSwitcher->addMenuAction(cmd, AnyLanguage, CC::G_DEFAULT_ONE);
cmd = am->registerAction(m_actions.stopAction,
Constants::STOP, globalcontext);
......@@ -1367,7 +1367,7 @@ bool DebuggerPluginPrivate::initialize(const QStringList &arguments, QString *er
cmd->setAttribute(Command::CA_UpdateIcon);
//cmd->setDefaultKeySequence(QKeySequence(Constants::STOP_KEY));
cmd->setDefaultText(tr("Stop Debugger"));
m_uiSwitcher->addMenuAction(cmd, Lang_None, CC::G_DEFAULT_ONE);
m_uiSwitcher->addMenuAction(cmd, AnyLanguage, CC::G_DEFAULT_ONE);
cmd = am->registerAction(m_actions.interruptAction,
PE::DEBUG, m_interruptibleContext);
......@@ -1381,77 +1381,77 @@ bool DebuggerPluginPrivate::initialize(const QStringList &arguments, QString *er
cmd->setAttribute(Core::Command::CA_UpdateText);
//cmd->setDefaultKeySequence(QKeySequence(Constants::RESET_KEY));
cmd->setDefaultText(tr("Reset Debugger"));
m_uiSwitcher->addMenuAction(cmd, Lang_None, CC::G_DEFAULT_ONE);
m_uiSwitcher->addMenuAction(cmd, AnyLanguage, CC::G_DEFAULT_ONE);
QAction *sep = new QAction(this);
sep->setSeparator(true);
cmd = am->registerAction(sep, _("Debugger.Sep.Step"), globalcontext);
m_uiSwitcher->addMenuAction(cmd, Lang_Cpp);
m_uiSwitcher->addMenuAction(cmd, CppLanguage);
cmd = am->registerAction(m_actions.nextAction,
Constants::NEXT, cppDebuggercontext);
cmd->setDefaultKeySequence(QKeySequence(Constants::NEXT_KEY));
cmd->setAttribute(Command::CA_Hide);
m_uiSwitcher->addMenuAction(cmd, Lang_Cpp);
m_uiSwitcher->addMenuAction(cmd, CppLanguage);
cmd = am->registerAction(m_actions.stepAction,
Constants::STEP, cppDebuggercontext);
cmd->setDefaultKeySequence(QKeySequence(Constants::STEP_KEY));
cmd->setAttribute(Command::CA_Hide);
m_uiSwitcher->addMenuAction(cmd, Lang_Cpp);
m_uiSwitcher->addMenuAction(cmd, CppLanguage);
cmd = am->registerAction(m_actions.stepOutAction,
Constants::STEPOUT, cppDebuggercontext);
cmd->setDefaultKeySequence(QKeySequence(Constants::STEPOUT_KEY));
cmd->setAttribute(Command::CA_Hide);
m_uiSwitcher->addMenuAction(cmd, Lang_Cpp);
m_uiSwitcher->addMenuAction(cmd, CppLanguage);
cmd = am->registerAction(m_actions.runToLineAction1,
Constants::RUN_TO_LINE1, cppDebuggercontext);
cmd->setDefaultKeySequence(QKeySequence(Constants::RUN_TO_LINE_KEY));
cmd->setAttribute(Command::CA_Hide);
m_uiSwitcher->addMenuAction(cmd, Lang_Cpp);
m_uiSwitcher->addMenuAction(cmd, CppLanguage);
cmd = am->registerAction(m_actions.runToFunctionAction,
Constants::RUN_TO_FUNCTION, cppDebuggercontext);
cmd->setDefaultKeySequence(QKeySequence(Constants::RUN_TO_FUNCTION_KEY));
cmd->setAttribute(Command::CA_Hide);
m_uiSwitcher->addMenuAction(cmd, Lang_Cpp);
m_uiSwitcher->addMenuAction(cmd, CppLanguage);
cmd = am->registerAction(m_actions.jumpToLineAction1,
Constants::JUMP_TO_LINE1, cppDebuggercontext);
cmd->setAttribute(Command::CA_Hide);
m_uiSwitcher->addMenuAction(cmd, Lang_Cpp);
m_uiSwitcher->addMenuAction(cmd, CppLanguage);
cmd = am->registerAction(m_actions.returnFromFunctionAction,
Constants::RETURN_FROM_FUNCTION, cppDebuggercontext);
cmd->setAttribute(Command::CA_Hide);
m_uiSwitcher->addMenuAction(cmd, Lang_Cpp);
m_uiSwitcher->addMenuAction(cmd, CppLanguage);
cmd = am->registerAction(m_actions.reverseDirectionAction,
Constants::REVERSE, cppDebuggercontext);
cmd->setDefaultKeySequence(QKeySequence(Constants::REVERSE_KEY));
cmd->setAttribute(Command::CA_Hide);
m_uiSwitcher->addMenuAction(cmd, Lang_Cpp);
m_uiSwitcher->addMenuAction(cmd, CppLanguage);
sep = new QAction(this);
sep->setSeparator(true);
cmd = am->registerAction(sep, _("Debugger.Sep.Break"), globalcontext);
m_uiSwitcher->addMenuAction(cmd, Lang_Cpp);
m_uiSwitcher->addMenuAction(cmd, CppLanguage);
cmd = am->registerAction(m_actions.snapshotAction,
Constants::SNAPSHOT, cppDebuggercontext);
cmd->setDefaultKeySequence(QKeySequence(Constants::SNAPSHOT_KEY));
cmd->setAttribute(Command::CA_Hide);
m_uiSwitcher->addMenuAction(cmd, Lang_Cpp);
m_uiSwitcher->addMenuAction(cmd, CppLanguage);
cmd = am->registerAction(m_actions.frameDownAction,
Constants::FRAME_DOWN, cppDebuggercontext);
......@@ -1462,13 +1462,13 @@ bool DebuggerPluginPrivate::initialize(const QStringList &arguments, QString *er
cmd = am->registerAction(theDebuggerAction(OperateByInstruction),
Constants::OPERATE_BY_INSTRUCTION, cppDebuggercontext);
cmd->setAttribute(Command::CA_Hide);
m_uiSwitcher->addMenuAction(cmd, Lang_Cpp);
m_uiSwitcher->addMenuAction(cmd, CppLanguage);
cmd = am->registerAction(m_actions.breakAction,
Constants::TOGGLE_BREAK, globalcontext);
cmd->setDefaultKeySequence(QKeySequence(Constants::TOGGLE_BREAK_KEY));
m_uiSwitcher->addMenuAction(cmd, Lang_Cpp);
m_uiSwitcher->addMenuAction(cmd, CppLanguage);
connect(m_actions.breakAction, SIGNAL(triggered()),
this, SLOT(toggleBreakpoint()));
......@@ -1477,14 +1477,14 @@ bool DebuggerPluginPrivate::initialize(const QStringList &arguments, QString *er
sep = new QAction(this);
sep->setSeparator(true);
cmd = am->registerAction(sep, _("Debugger.Sep.Watch"), globalcontext);
m_uiSwitcher->addMenuAction(cmd, Lang_Cpp);
m_uiSwitcher->addMenuAction(cmd, CppLanguage);
cmd = am->registerAction(m_actions.watchAction1,
Constants::ADD_TO_WATCH1, cppeditorcontext);
cmd->action()->setEnabled(true);
//cmd->setDefaultKeySequence(QKeySequence(tr("Ctrl+D,Ctrl+W")));
m_uiSwitcher->addMenuAction(cmd, Lang_Cpp);
m_uiSwitcher->addMenuAction(cmd, CppLanguage);
// Editor context menu
......@@ -1596,7 +1596,7 @@ bool DebuggerPluginPrivate::initialize(const QStringList &arguments, QString *er
hbox->addSpacerItem(new QSpacerItem(4, 0));
hbox->addWidget(m_statusLabel, 10);
m_uiSwitcher->setToolbar(Lang_Cpp, toolbarContainer);
m_uiSwitcher->setToolbar(CppLanguage, toolbarContainer);
connect(m_uiSwitcher, SIGNAL(dockResetRequested(Debugger::DebuggerLanguages)),
this, SLOT(setSimpleDockWidgetArrangement(Debugger::DebuggerLanguages)));
......@@ -1654,7 +1654,7 @@ void DebuggerPluginPrivate::onAction()
void DebuggerPluginPrivate::languagesChanged(const Debugger::DebuggerLanguages &languages)
{
const bool debuggerIsCPP = (languages & Lang_Cpp);
const bool debuggerIsCPP = (languages & CppLanguage);
//qDebug() << "DEBUGGER IS CPP: " << debuggerIsCPP;
m_startExternalAction->setVisible(debuggerIsCPP);
......@@ -2090,8 +2090,8 @@ void DebuggerPluginPrivate::setSimpleDockWidgetArrangement(const Debugger::Debug
dockWidget->hide();
}
if ((activeLanguages.testFlag(Lang_Cpp) && !activeLanguages.testFlag(Lang_Qml))
|| activeLanguages == Lang_None
if ((activeLanguages.testFlag(CppLanguage) && !activeLanguages.testFlag(QmlLanguage))
|| activeLanguages == AnyLanguage
|| !uiSwitcher->qmlInspectorWindow())
{
m_stackDock->show();
......@@ -2369,8 +2369,6 @@ void DebuggerPluginPrivate::activatePreviousMode()
void DebuggerPluginPrivate::activateDebugMode()
{
// ### FIXME m_capabilities is not updated yet when this method is called
// from startDebugger()
const bool canReverse = (m_capabilities & ReverseSteppingCapability)
&& theDebuggerBoolSetting(EnableReverseDebugging);
m_actions.reverseDirectionAction->setChecked(false);
......@@ -2706,7 +2704,7 @@ void DebuggerPlugin::activateDebugMode()
void DebuggerPlugin::createNewDock(QWidget *widget)
{
QDockWidget *dockWidget =
DebuggerUISwitcher::instance()->createDockWidget(Lang_Cpp, widget);
DebuggerUISwitcher::instance()->createDockWidget(CppLanguage, widget);
dockWidget->setWindowTitle(widget->windowTitle());
dockWidget->setObjectName(widget->windowTitle());
dockWidget->setFeatures(QDockWidget::DockWidgetClosable);
......
......@@ -229,8 +229,9 @@ DebuggerRunControl::DebuggerRunControl(RunConfiguration *runConfiguration,
{
connect(this, SIGNAL(finished()), this, SLOT(handleFinished()));
m_isQmlProject = isQmlProject(runConfiguration);
createEngine(sp);
DebuggerStartParameters startParams = sp;
startParams.m_isQmlProject = isQmlProject(runConfiguration);
createEngine(startParams);
}
DebuggerRunControl::~DebuggerRunControl()
......@@ -378,8 +379,8 @@ void DebuggerRunControl::createEngine(const DebuggerStartParameters &startParams
if (!engineType)
engineType = engineForMode(sp.startMode);
if (engineType != QmlEngineType && m_isQmlProject && (activeLangs & Lang_Qml)) {
if (activeLangs & Lang_Cpp) {
if (engineType != QmlEngineType && sp.m_isQmlProject && (activeLangs & QmlLanguage)) {
if (activeLangs & CppLanguage) {
sp.cppEngineType = engineType;
engineType = QmlCppEngineType;
} else {
......@@ -596,31 +597,4 @@ bool DebuggerRunControl::isQmlProject(RunConfiguration *config)
return false;
}
bool DebuggerRunControl::isCurrentProjectQmlCppBased()
{
Project *startupProject = ProjectExplorerPlugin::instance()->startupProject();
if (!startupProject)
return false;
if (!startupProject->activeTarget())
return false;
RunConfiguration *rc = startupProject->activeTarget()->activeRunConfiguration();
return isQmlProject(rc);
}
bool DebuggerRunControl::isCurrentProjectCppBased()
{
Project *startupProject = ProjectExplorerPlugin::instance()->startupProject();
if (!startupProject)
return false;
const QString id = startupProject->id();
return id == _("GenericProjectManager.GenericProject")
|| id == _("CMakeProjectManager.CMakeProject")
|| id == _("Qt4ProjectManager.Qt4Project");
}
} // namespace Debugger
......@@ -118,8 +118,6 @@ public:
QString *settingsPage = 0);
static bool isQmlProject(RunConfiguration *config);
static bool isCurrentProjectQmlCppBased();
static bool isCurrentProjectCppBased();
private slots:
void handleFinished();
......@@ -135,7 +133,6 @@ private:
const QWeakPointer<RunConfiguration> m_myRunConfiguration;
bool m_running;
bool m_started;
bool m_isQmlProject;
DebuggerEngineType m_enabledEngines;
QString m_errorMessage;
QString m_settingsIdHint;
......
......@@ -99,7 +99,7 @@ struct DebuggerUISwitcherPrivate
explicit DebuggerUISwitcherPrivate(DebuggerUISwitcher *q);
QList<ViewsMenuItems> m_viewsMenuItems;
QList<Internal::DebugToolWindow *> m_dockWidgets;
QList<QDockWidget *> m_dockWidgets;
QHash<QString, QVariant> m_dockWidgetActiveStateCpp;
QHash<QString, QVariant> m_dockWidgetActiveStateQmlCpp;
......@@ -141,15 +141,15 @@ struct DebuggerUISwitcherPrivate
DebuggerUISwitcherPrivate::DebuggerUISwitcherPrivate(DebuggerUISwitcher *q)
: m_resizeEventFilter(new Internal::DockWidgetEventFilter(q))
, m_supportedLanguages(Lang_None)
, m_supportedLanguages(AnyLanguage)
, m_languageCount(0)
, m_toolbarStack(new QStackedWidget)
, m_languageActionGroup(new QActionGroup(q))
, m_inDebugMode(false)
, m_changingUI(false)
, m_debuggerLanguageMenu(0)
, m_previousDebugLanguages(Lang_None)
, m_activeDebugLanguages(Lang_None)
, m_previousDebugLanguages(AnyLanguage)
, m_activeDebugLanguages(AnyLanguage)
, m_activateCppAction(0)
, m_activateQmlAction(0)
, m_qmlEnabled(false)
......@@ -189,8 +189,6 @@ DebuggerUISwitcher::DebuggerUISwitcher(Core::BaseMode *mode, QObject* parent) :
DebuggerUISwitcher::~DebuggerUISwitcher()
{
qDeleteAll(d->m_dockWidgets);
d->m_dockWidgets.clear();
DebuggerUISwitcherPrivate::m_instance = 0;
delete d;
}
......@@ -257,17 +255,17 @@ void DebuggerUISwitcher::updateUiForRunConfiguration(ProjectExplorer::RunConfigu
void DebuggerUISwitcher::updateActiveLanguages()
{
d->m_activeDebugLanguages = Lang_None;
d->m_activeDebugLanguages = AnyLanguage;
if (d->m_activateCppAction->isChecked())
d->m_activeDebugLanguages = Lang_Cpp;
d->m_activeDebugLanguages = CppLanguage;
if (d->m_qmlEnabled && d->m_activateQmlAction->isChecked())
d->m_activeDebugLanguages = d->m_activeDebugLanguages | Lang_Qml;
d->m_activeDebugLanguages |= QmlLanguage;
if (d->m_activeDebugLanguages == Lang_None) {
if (d->m_activeDebugLanguages == AnyLanguage) {
d->m_activateCppAction->setChecked(true);
d->m_activeDebugLanguages = Lang_Cpp;
d->m_activeDebugLanguages = CppLanguage;
}
emit activeLanguagesChanged(d->m_activeDebugLanguages);
......@@ -304,14 +302,14 @@ void DebuggerUISwitcher::modeChanged(Core::IMode *mode)
Core::EditorManager *editorManager = Core::EditorManager::instance();
if (editorManager->currentEditor()) {
DebuggerLanguages activeLangs;
if (DebuggerRunControl::isCurrentProjectCppBased())
activeLangs |= Lang_Cpp;
if (isCurrentProjectCppBased())
activeLangs |= CppLanguage;
if (DebuggerRunControl::isCurrentProjectQmlCppBased())
activeLangs |= Lang_Qml;
if (isCurrentProjectQmlCppBased())
activeLangs |= QmlLanguage;
d->m_activateCppAction->setChecked(activeLangs & Lang_Cpp);
d->m_activateQmlAction->setChecked(activeLangs & Lang_Qml);
d->m_activateCppAction->setChecked(activeLangs & CppLanguage);
d->m_activateQmlAction->setChecked(activeLangs & QmlLanguage);
updateActiveLanguages();
}
}
......@@ -321,9 +319,9 @@ void DebuggerUISwitcher::hideInactiveWidgets()
// Hide dock widgets manually in case they are floating.
if (!d->m_inDebugMode) {
// hide all the debugger windows if mode is different
foreach(Internal::DebugToolWindow *window, d->m_dockWidgets) {
if (window->m_dockWidget->isFloating())
window->m_dockWidget->hide();
foreach(QDockWidget *dockWidget, d->m_dockWidgets) {
if (dockWidget->isFloating())
dockWidget->hide();
}
}
}
......@@ -360,7 +358,7 @@ DebuggerUISwitcher *DebuggerUISwitcher::instance()
void DebuggerUISwitcher::addLanguage(const DebuggerLanguage &languageId,
const QString &languageName, const Core::Context &context)
{
bool activate = (d->m_supportedLanguages == Lang_None);
bool activate = (d->m_supportedLanguages == AnyLanguage);
d->m_supportedLanguages = d->m_supportedLanguages | languageId;
d->m_languageCount++;
......@@ -383,7 +381,7 @@ void DebuggerUISwitcher::addLanguage(const DebuggerLanguage &languageId,
activeDebugLanguageCmd->setDefaultKeySequence(QKeySequence(
QString("%1,%2").arg(shortcutPrefix).arg(shortcutIndex)));
if (languageId == Lang_Qml) {
if (languageId == QmlLanguage) {
d->m_qmlEnabled = true;
d->m_activateQmlAction = debuggableLang;
} else if (!d->m_activateCppAction) {
......@@ -418,18 +416,18 @@ void DebuggerUISwitcher::updateUi()
void DebuggerUISwitcher::activateQmlCppLayout()
{
Core::ICore *core = Core::ICore::instance();
Core::Context qmlCppContext = d->m_contextsForLanguage.value(Lang_Qml);
qmlCppContext.add(d->m_contextsForLanguage.value(Lang_Cpp));
Core::Context qmlCppContext = d->m_contextsForLanguage.value(QmlLanguage);
qmlCppContext.add(d->m_contextsForLanguage.value(CppLanguage));
// always use cpp toolbar
d->m_toolbarStack->setCurrentWidget(d->m_toolBars.value(Lang_Cpp));
d->m_toolbarStack->setCurrentWidget(d->m_toolBars.value(CppLanguage));
if (d->m_previousDebugLanguages & Lang_Qml) {
if (d->m_previousDebugLanguages & QmlLanguage) {
d->m_dockWidgetActiveStateQmlCpp = d->m_mainWindow->saveSettings();
core->updateAdditionalContexts(qmlCppContext, Core::Context());
} else if (d->m_previousDebugLanguages & Lang_Cpp) {
} else if (d->m_previousDebugLanguages & CppLanguage) {
d->m_dockWidgetActiveStateCpp = d->m_mainWindow->saveSettings();
core->updateAdditionalContexts(d->m_contextsForLanguage.value(Lang_Cpp), Core::Context());
core->updateAdditionalContexts(d->m_contextsForLanguage.value(CppLanguage), Core::Context());
}
d->m_mainWindow->restoreSettings(d->m_dockWidgetActiveStateQmlCpp);
......@@ -439,21 +437,21 @@ void DebuggerUISwitcher::activateQmlCppLayout()
void DebuggerUISwitcher::activateCppLayout()
{
Core::ICore *core = Core::ICore::instance();
Core::Context qmlCppContext = d->m_contextsForLanguage.value(Lang_Qml);
qmlCppContext.add(d->m_contextsForLanguage.value(Lang_Cpp));
d->m_toolbarStack->setCurrentWidget(d->m_toolBars.value(Lang_Cpp));
Core::Context qmlCppContext = d->m_contextsForLanguage.value(QmlLanguage);
qmlCppContext.add(d->m_contextsForLanguage.value(CppLanguage));
d->m_toolbarStack->setCurrentWidget(d->m_toolBars.value(CppLanguage));