2010-03-22 17:22:33 +01:00
|
|
|
/**************************************************************************
|
|
|
|
|
**
|
|
|
|
|
** This file is part of Qt Creator
|
|
|
|
|
**
|
|
|
|
|
** Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies).
|
|
|
|
|
**
|
|
|
|
|
** Contact: Nokia Corporation (qt-info@nokia.com)
|
|
|
|
|
**
|
|
|
|
|
** Commercial Usage
|
|
|
|
|
**
|
|
|
|
|
** Licensees holding valid Qt Commercial licenses may use this file in
|
|
|
|
|
** accordance with the Qt Commercial License Agreement provided with the
|
|
|
|
|
** Software or, alternatively, in accordance with the terms contained in
|
|
|
|
|
** a written agreement between you and Nokia.
|
|
|
|
|
**
|
|
|
|
|
** GNU Lesser General Public License Usage
|
|
|
|
|
**
|
|
|
|
|
** Alternatively, this file may be used under the terms of the GNU Lesser
|
|
|
|
|
** General Public License version 2.1 as published by the Free Software
|
|
|
|
|
** Foundation and appearing in the file LICENSE.LGPL included in the
|
|
|
|
|
** packaging of this file. Please review the following information to
|
|
|
|
|
** ensure the GNU Lesser General Public License version 2.1 requirements
|
|
|
|
|
** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
|
|
|
|
|
**
|
|
|
|
|
** If you are unsure which license is appropriate for your use, please
|
|
|
|
|
** contact the sales department at http://qt.nokia.com/contact.
|
|
|
|
|
**
|
|
|
|
|
**************************************************************************/
|
|
|
|
|
|
2010-02-09 20:44:40 +01:00
|
|
|
#include "debuggeruiswitcher.h"
|
|
|
|
|
#include "debuggermainwindow.h"
|
2010-03-18 16:04:14 +01:00
|
|
|
#include "debuggeractions.h"
|
|
|
|
|
#include "debuggerconstants.h"
|
2010-08-18 13:54:12 +02:00
|
|
|
#include "debuggerrunner.h"
|
2010-03-18 16:04:14 +01:00
|
|
|
#include "savedaction.h"
|
2010-02-09 20:44:40 +01:00
|
|
|
|
2010-03-18 10:56:25 +01:00
|
|
|
#include <utils/savedaction.h>
|
2010-02-09 20:44:40 +01:00
|
|
|
#include <utils/styledbar.h>
|
2010-04-20 16:46:35 +02:00
|
|
|
#include <utils/qtcassert.h>
|
2010-03-18 10:56:25 +01:00
|
|
|
|
2010-07-22 11:15:15 +02:00
|
|
|
#include <coreplugin/actionmanager/actioncontainer.h>
|
|
|
|
|
#include <coreplugin/actionmanager/actionmanager.h>
|
|
|
|
|
#include <coreplugin/actionmanager/command.h>
|
2010-03-18 10:59:06 +01:00
|
|
|
#include <coreplugin/basemode.h>
|
2010-02-09 20:44:40 +01:00
|
|
|
#include <coreplugin/coreconstants.h>
|
|
|
|
|
#include <coreplugin/editormanager/editormanager.h>
|
|
|
|
|
#include <coreplugin/findplaceholder.h>
|
2010-07-22 11:15:15 +02:00
|
|
|
#include <coreplugin/icore.h>
|
2010-02-09 20:44:40 +01:00
|
|
|
#include <coreplugin/minisplitter.h>
|
2010-07-22 11:15:15 +02:00
|
|
|
#include <coreplugin/modemanager.h>
|
2010-02-09 20:44:40 +01:00
|
|
|
#include <coreplugin/navigationwidget.h>
|
2010-07-22 11:15:15 +02:00
|
|
|
#include <coreplugin/outputpane.h>
|
|
|
|
|
#include <coreplugin/rightpane.h>
|
|
|
|
|
|
2010-02-09 20:44:40 +01:00
|
|
|
#include <projectexplorer/projectexplorerconstants.h>
|
2010-08-18 13:54:12 +02:00
|
|
|
#include <projectexplorer/projectexplorer.h>
|
|
|
|
|
#include <projectexplorer/session.h>
|
|
|
|
|
#include <projectexplorer/project.h>
|
|
|
|
|
#include <projectexplorer/target.h>
|
|
|
|
|
#include <projectexplorer/runconfiguration.h>
|
2010-02-09 20:44:40 +01:00
|
|
|
|
2010-02-26 16:36:02 +01:00
|
|
|
#include <QtGui/QActionGroup>
|
2010-02-09 20:44:40 +01:00
|
|
|
#include <QtGui/QStackedWidget>
|
2010-03-18 10:59:06 +01:00
|
|
|
#include <QtGui/QVBoxLayout>
|
|
|
|
|
#include <QtGui/QMenu>
|
2010-02-09 20:44:40 +01:00
|
|
|
#include <QtGui/QDockWidget>
|
2010-08-18 13:54:12 +02:00
|
|
|
#include <QtGui/QResizeEvent>
|
2010-03-18 10:59:06 +01:00
|
|
|
#include <QtCore/QDebug>
|
|
|
|
|
#include <QtCore/QList>
|
|
|
|
|
#include <QtCore/QMap>
|
|
|
|
|
#include <QtCore/QPair>
|
|
|
|
|
#include <QtCore/QSettings>
|
2010-02-09 20:44:40 +01:00
|
|
|
|
|
|
|
|
namespace Debugger {
|
|
|
|
|
using namespace Debugger::Internal;
|
|
|
|
|
|
2010-08-18 13:54:12 +02:00
|
|
|
|
|
|
|
|
|
|
|
|
|
DockWidgetEventFilter::DockWidgetEventFilter(QObject *parent)
|
|
|
|
|
: QObject(parent)
|
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
bool DockWidgetEventFilter::eventFilter(QObject *obj, QEvent *event)
|
|
|
|
|
{
|
|
|
|
|
if (event->type() == QEvent::Resize || event->type() == QEvent::ZOrderChange) {
|
|
|
|
|
emit widgetResized();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return QObject::eventFilter(obj, event);
|
|
|
|
|
}
|
|
|
|
|
|
2010-03-18 10:59:06 +01:00
|
|
|
// first: language id, second: menu item
|
2010-08-18 13:54:12 +02:00
|
|
|
typedef QPair<DebuggerLanguage, QAction *> ViewsMenuItems;
|
2010-03-18 10:59:06 +01:00
|
|
|
|
2010-04-06 16:42:24 +02:00
|
|
|
struct DebuggerUISwitcherPrivate
|
|
|
|
|
{
|
2010-03-18 10:59:06 +01:00
|
|
|
explicit DebuggerUISwitcherPrivate(DebuggerUISwitcher *q);
|
|
|
|
|
|
2010-04-06 16:42:24 +02:00
|
|
|
QList<ViewsMenuItems> m_viewsMenuItems;
|
|
|
|
|
QList<Internal::DebugToolWindow *> m_dockWidgets;
|
2010-03-18 10:59:06 +01:00
|
|
|
|
2010-08-18 13:54:12 +02:00
|
|
|
QHash<QString, QVariant> m_dockWidgetActiveStateCpp;
|
|
|
|
|
QHash<QString, QVariant> m_dockWidgetActiveStateQmlCpp;
|
|
|
|
|
Internal::DockWidgetEventFilter *m_resizeEventFilter;
|
|
|
|
|
|
|
|
|
|
QMap<DebuggerLanguage, QWidget *> m_toolBars;
|
|
|
|
|
|
|
|
|
|
DebuggerLanguages m_supportedLanguages;
|
|
|
|
|
int m_languageCount;
|
2010-03-18 10:59:06 +01:00
|
|
|
|
|
|
|
|
QStackedWidget *m_toolbarStack;
|
|
|
|
|
Internal::DebuggerMainWindow *m_mainWindow;
|
|
|
|
|
|
2010-08-18 13:54:12 +02:00
|
|
|
QHash<DebuggerLanguage, Core::Context> m_contextsForLanguage;
|
2010-03-19 13:58:26 +01:00
|
|
|
|
2010-03-18 10:59:06 +01:00
|
|
|
QActionGroup *m_languageActionGroup;
|
2010-08-18 13:54:12 +02:00
|
|
|
bool m_inDebugMode;
|
2010-03-18 10:59:06 +01:00
|
|
|
bool m_changingUI;
|
|
|
|
|
|
2010-08-18 13:54:12 +02:00
|
|
|
Core::ActionContainer *m_debuggerLanguageMenu;
|
|
|
|
|
DebuggerLanguages m_previousDebugLanguages;
|
|
|
|
|
DebuggerLanguages m_activeDebugLanguages;
|
|
|
|
|
QAction *m_activateCppAction;
|
|
|
|
|
QAction *m_activateQmlAction;
|
|
|
|
|
bool m_qmlEnabled;
|
|
|
|
|
|
2010-03-18 10:59:06 +01:00
|
|
|
Core::ActionContainer *m_viewsMenu;
|
|
|
|
|
Core::ActionContainer *m_debugMenu;
|
|
|
|
|
|
2010-08-18 13:54:12 +02:00
|
|
|
QMultiHash<DebuggerLanguage, Core::Command *> m_menuCommands;
|
|
|
|
|
|
|
|
|
|
QWeakPointer<ProjectExplorer::Project> m_previousProject;
|
|
|
|
|
QWeakPointer<ProjectExplorer::Target> m_previousTarget;
|
|
|
|
|
|
|
|
|
|
bool m_initialized;
|
2010-03-18 16:55:27 +01:00
|
|
|
|
2010-03-18 10:59:06 +01:00
|
|
|
static DebuggerUISwitcher *m_instance;
|
|
|
|
|
};
|
|
|
|
|
|
2010-08-18 13:54:12 +02:00
|
|
|
DebuggerUISwitcherPrivate::DebuggerUISwitcherPrivate(DebuggerUISwitcher *q)
|
|
|
|
|
: m_resizeEventFilter(new Internal::DockWidgetEventFilter(q))
|
|
|
|
|
, m_supportedLanguages(Lang_None)
|
|
|
|
|
, 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_activateCppAction(0)
|
|
|
|
|
, m_activateQmlAction(0)
|
|
|
|
|
, m_qmlEnabled(false)
|
|
|
|
|
, m_viewsMenu(0)
|
|
|
|
|
, m_debugMenu(0)
|
|
|
|
|
, m_initialized(false)
|
2010-03-18 10:59:06 +01:00
|
|
|
{
|
2010-08-18 13:54:12 +02:00
|
|
|
m_languageActionGroup->setExclusive(false);
|
2010-03-18 10:59:06 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
DebuggerUISwitcher *DebuggerUISwitcherPrivate::m_instance = 0;
|
|
|
|
|
|
|
|
|
|
DebuggerUISwitcher::DebuggerUISwitcher(Core::BaseMode *mode, QObject* parent) :
|
|
|
|
|
QObject(parent), d(new DebuggerUISwitcherPrivate(this))
|
2010-02-09 20:44:40 +01:00
|
|
|
{
|
|
|
|
|
mode->setWidget(createContents(mode));
|
|
|
|
|
|
|
|
|
|
Core::ICore *core = Core::ICore::instance();
|
|
|
|
|
Core::ActionManager *am = core->actionManager();
|
|
|
|
|
|
2010-08-18 13:54:12 +02:00
|
|
|
ProjectExplorer::ProjectExplorerPlugin *pe = ProjectExplorer::ProjectExplorerPlugin::instance();
|
|
|
|
|
connect(pe->session(), SIGNAL(startupProjectChanged(ProjectExplorer::Project*)),
|
|
|
|
|
SLOT(updateUiForProject(ProjectExplorer::Project*)));
|
2010-02-09 20:44:40 +01:00
|
|
|
connect(Core::ModeManager::instance(), SIGNAL(currentModeChanged(Core::IMode*)),
|
|
|
|
|
SLOT(modeChanged(Core::IMode*)));
|
2010-08-18 13:54:12 +02:00
|
|
|
connect(d->m_resizeEventFilter, SIGNAL(widgetResized()), SLOT(updateDockWidgetSettings()));
|
2010-02-09 20:44:40 +01:00
|
|
|
|
2010-03-18 10:59:06 +01:00
|
|
|
d->m_debugMenu = am->actionContainer(ProjectExplorer::Constants::M_DEBUG);
|
2010-03-19 13:58:26 +01:00
|
|
|
|
2010-04-20 16:46:35 +02:00
|
|
|
d->m_viewsMenu = am->actionContainer(QLatin1String(Core::Constants::M_WINDOW_VIEWS));
|
|
|
|
|
QTC_ASSERT(d->m_viewsMenu, return)
|
2010-03-19 13:58:26 +01:00
|
|
|
|
2010-08-18 13:54:12 +02:00
|
|
|
d->m_debuggerLanguageMenu = am->createMenu(Debugger::Constants::M_DEBUG_DEBUGGING_LANGUAGES);
|
2010-02-09 20:44:40 +01:00
|
|
|
|
2010-03-18 10:59:06 +01:00
|
|
|
DebuggerUISwitcherPrivate::m_instance = this;
|
2010-02-09 20:44:40 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
DebuggerUISwitcher::~DebuggerUISwitcher()
|
|
|
|
|
{
|
2010-03-18 10:59:06 +01:00
|
|
|
qDeleteAll(d->m_dockWidgets);
|
|
|
|
|
d->m_dockWidgets.clear();
|
|
|
|
|
DebuggerUISwitcherPrivate::m_instance = 0;
|
|
|
|
|
delete d;
|
2010-02-09 20:44:40 +01:00
|
|
|
}
|
|
|
|
|
|
2010-08-18 13:54:12 +02:00
|
|
|
void DebuggerUISwitcher::updateUiOnFileListChange()
|
2010-07-29 16:58:12 +02:00
|
|
|
{
|
2010-08-18 13:54:12 +02:00
|
|
|
if (d->m_previousProject) {
|
|
|
|
|
updateUiForTarget(d->m_previousProject.data()->activeTarget());
|
|
|
|
|
}
|
2010-07-29 16:58:12 +02:00
|
|
|
}
|
|
|
|
|
|
2010-08-18 13:54:12 +02:00
|
|
|
void DebuggerUISwitcher::updateUiForProject(ProjectExplorer::Project *project)
|
2010-02-09 20:44:40 +01:00
|
|
|
{
|
2010-08-18 13:54:12 +02:00
|
|
|
if (project) {
|
|
|
|
|
if (d->m_previousProject) {
|
|
|
|
|
disconnect(d->m_previousProject.data(), SIGNAL(activeTargetChanged(ProjectExplorer::Target*)),
|
|
|
|
|
this, SLOT(updateUiForTarget(ProjectExplorer::Target*)));
|
|
|
|
|
}
|
|
|
|
|
d->m_previousProject = project;
|
|
|
|
|
connect(project, SIGNAL(fileListChanged()), SLOT(updateUiOnFileListChange()));
|
|
|
|
|
connect(project, SIGNAL(activeTargetChanged(ProjectExplorer::Target*)),
|
|
|
|
|
this, SLOT(updateUiForTarget(ProjectExplorer::Target*)));
|
|
|
|
|
updateUiForTarget(project->activeTarget());
|
|
|
|
|
}
|
2010-02-09 20:44:40 +01:00
|
|
|
}
|
|
|
|
|
|
2010-08-18 13:54:12 +02:00
|
|
|
void DebuggerUISwitcher::updateUiForTarget(ProjectExplorer::Target *target)
|
2010-02-09 20:44:40 +01:00
|
|
|
{
|
2010-08-18 13:54:12 +02:00
|
|
|
if (target) {
|
|
|
|
|
if (d->m_previousTarget) {
|
|
|
|
|
disconnect(target, SIGNAL(activeRunConfigurationChanged(ProjectExplorer::RunConfiguration*)),
|
|
|
|
|
this, SLOT(updateUiForRunConfiguration(ProjectExplorer::RunConfiguration*)));
|
|
|
|
|
}
|
|
|
|
|
d->m_previousTarget = target;
|
|
|
|
|
connect(target, SIGNAL(activeRunConfigurationChanged(ProjectExplorer::RunConfiguration*)),
|
|
|
|
|
this, SLOT(updateUiForRunConfiguration(ProjectExplorer::RunConfiguration*)));
|
|
|
|
|
updateUiForRunConfiguration(target->activeRunConfiguration());
|
2010-03-26 16:43:12 +01:00
|
|
|
}
|
2010-02-09 20:44:40 +01:00
|
|
|
}
|
|
|
|
|
|
2010-08-18 13:54:12 +02:00
|
|
|
// updates default debug language settings per run config.
|
|
|
|
|
void DebuggerUISwitcher::updateUiForRunConfiguration(ProjectExplorer::RunConfiguration *rc)
|
2010-03-18 10:59:06 +01:00
|
|
|
{
|
2010-08-18 13:54:12 +02:00
|
|
|
if (rc) {
|
|
|
|
|
d->m_languageActionGroup->setDisabled(false);
|
|
|
|
|
if (DebuggerRunControl::isQmlProject(rc) && d->m_qmlEnabled) {
|
|
|
|
|
d->m_activateCppAction->setChecked(true);
|
|
|
|
|
d->m_activateQmlAction->setChecked(true);
|
|
|
|
|
} else {
|
|
|
|
|
if (d->m_activateQmlAction) {
|
|
|
|
|
d->m_activateQmlAction->setChecked(false);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
} else {
|
|
|
|
|
if (d->m_activateCppAction)
|
|
|
|
|
d->m_activateCppAction->setChecked(true);
|
|
|
|
|
if (d->m_activateQmlAction)
|
|
|
|
|
d->m_activateQmlAction->setChecked(false);
|
|
|
|
|
d->m_languageActionGroup->setDisabled(true);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
updateActiveLanguages();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void DebuggerUISwitcher::updateActiveLanguages()
|
|
|
|
|
{
|
|
|
|
|
d->m_activeDebugLanguages = Lang_None;
|
|
|
|
|
|
|
|
|
|
if (d->m_activateCppAction->isChecked())
|
|
|
|
|
d->m_activeDebugLanguages = Lang_Cpp;
|
|
|
|
|
|
|
|
|
|
if (d->m_qmlEnabled && d->m_activateQmlAction->isChecked())
|
|
|
|
|
d->m_activeDebugLanguages = d->m_activeDebugLanguages | Lang_Qml;
|
|
|
|
|
|
|
|
|
|
if (d->m_activeDebugLanguages == Lang_None) {
|
|
|
|
|
d->m_activateCppAction->setChecked(true);
|
|
|
|
|
d->m_activeDebugLanguages = Lang_Cpp;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
emit activeLanguagesChanged(d->m_activeDebugLanguages);
|
|
|
|
|
|
|
|
|
|
updateUi();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
DebuggerLanguages DebuggerUISwitcher::supportedLanguages() const
|
|
|
|
|
{
|
|
|
|
|
return d->m_supportedLanguages;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void DebuggerUISwitcher::addMenuAction(Core::Command *command, const DebuggerLanguage &language,
|
|
|
|
|
const QString &group)
|
|
|
|
|
{
|
|
|
|
|
d->m_debugMenu->addAction(command, group);
|
|
|
|
|
d->m_menuCommands.insert(language, command);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
DebuggerLanguages DebuggerUISwitcher::activeDebugLanguages() const
|
|
|
|
|
{
|
|
|
|
|
return d->m_activeDebugLanguages;
|
2010-03-18 10:59:06 +01:00
|
|
|
}
|
2010-06-16 11:08:54 +02:00
|
|
|
|
2010-02-09 20:44:40 +01:00
|
|
|
void DebuggerUISwitcher::modeChanged(Core::IMode *mode)
|
|
|
|
|
{
|
2010-08-18 13:54:12 +02:00
|
|
|
d->m_inDebugMode = (mode->id() == Constants::MODE_DEBUG);
|
|
|
|
|
d->m_mainWindow->setDockActionsVisible(d->m_inDebugMode);
|
2010-02-09 20:44:40 +01:00
|
|
|
hideInactiveWidgets();
|
2010-08-18 13:54:12 +02:00
|
|
|
|
|
|
|
|
if (mode->id() != Constants::MODE_DEBUG)
|
|
|
|
|
return;
|
|
|
|
|
|
|
|
|
|
Core::EditorManager *editorManager = Core::EditorManager::instance();
|
|
|
|
|
if (editorManager->currentEditor()) {
|
|
|
|
|
DebuggerLanguages activeLangs;
|
|
|
|
|
if (DebuggerRunControl::isCurrentProjectCppBased())
|
|
|
|
|
activeLangs |= Lang_Cpp;
|
|
|
|
|
|
|
|
|
|
if (DebuggerRunControl::isCurrentProjectQmlCppBased())
|
|
|
|
|
activeLangs |= Lang_Qml;
|
|
|
|
|
|
|
|
|
|
d->m_activateCppAction->setChecked(activeLangs & Lang_Cpp);
|
|
|
|
|
d->m_activateQmlAction->setChecked(activeLangs & Lang_Qml);
|
|
|
|
|
updateActiveLanguages();
|
|
|
|
|
}
|
2010-02-09 20:44:40 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void DebuggerUISwitcher::hideInactiveWidgets()
|
|
|
|
|
{
|
2010-08-18 13:54:12 +02:00
|
|
|
// Hide dock widgets manually in case they are floating.
|
|
|
|
|
if (!d->m_inDebugMode) {
|
2010-02-09 20:44:40 +01:00
|
|
|
// hide all the debugger windows if mode is different
|
2010-03-18 10:59:06 +01:00
|
|
|
foreach(Internal::DebugToolWindow *window, d->m_dockWidgets) {
|
2010-08-18 13:54:12 +02:00
|
|
|
if (window->m_dockWidget->isFloating())
|
2010-02-09 20:44:40 +01:00
|
|
|
window->m_dockWidget->hide();
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void DebuggerUISwitcher::createViewsMenuItems()
|
|
|
|
|
{
|
|
|
|
|
Core::ICore *core = Core::ICore::instance();
|
|
|
|
|
Core::ActionManager *am = core->actionManager();
|
2010-06-28 14:30:03 +02:00
|
|
|
Core::Context globalcontext(Core::Constants::C_GLOBAL);
|
2010-02-09 20:44:40 +01:00
|
|
|
|
2010-08-18 13:54:12 +02:00
|
|
|
d->m_debugMenu->addMenu(d->m_debuggerLanguageMenu, Core::Constants::G_DEFAULT_THREE);
|
|
|
|
|
d->m_debuggerLanguageMenu->menu()->setTitle(tr("&Debug Languages"));
|
2010-02-26 16:36:02 +01:00
|
|
|
|
2010-04-20 16:46:35 +02:00
|
|
|
// Add menu items
|
2010-08-11 10:46:45 +02:00
|
|
|
Core::Command *cmd = am->registerAction(d->m_mainWindow->menuSeparator1(),
|
|
|
|
|
QLatin1String("Debugger.Views.Separator1"), globalcontext);
|
2010-04-20 16:46:35 +02:00
|
|
|
d->m_viewsMenu->addAction(cmd);
|
2010-08-11 10:46:45 +02:00
|
|
|
cmd = am->registerAction(d->m_mainWindow->toggleLockedAction(),
|
|
|
|
|
QLatin1String("Debugger.Views.ToggleLocked"), globalcontext);
|
2010-04-20 16:46:35 +02:00
|
|
|
d->m_viewsMenu->addAction(cmd);
|
2010-08-11 10:46:45 +02:00
|
|
|
cmd = am->registerAction(d->m_mainWindow->menuSeparator2(),
|
|
|
|
|
QLatin1String("Debugger.Views.Separator2"), globalcontext);
|
2010-04-20 16:46:35 +02:00
|
|
|
d->m_viewsMenu->addAction(cmd);
|
2010-08-11 10:46:45 +02:00
|
|
|
cmd = am->registerAction(d->m_mainWindow->resetLayoutAction(),
|
|
|
|
|
QLatin1String("Debugger.Views.ResetSimple"), globalcontext);
|
2010-04-20 16:46:35 +02:00
|
|
|
d->m_viewsMenu->addAction(cmd);
|
2010-02-09 20:44:40 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
DebuggerUISwitcher *DebuggerUISwitcher::instance()
|
|
|
|
|
{
|
2010-03-18 10:59:06 +01:00
|
|
|
return DebuggerUISwitcherPrivate::m_instance;
|
2010-02-09 20:44:40 +01:00
|
|
|
}
|
|
|
|
|
|
2010-08-18 13:54:12 +02:00
|
|
|
void DebuggerUISwitcher::addLanguage(const DebuggerLanguage &languageId,
|
|
|
|
|
const QString &languageName, const Core::Context &context)
|
2010-02-09 20:44:40 +01:00
|
|
|
{
|
2010-08-18 13:54:12 +02:00
|
|
|
bool activate = (d->m_supportedLanguages == Lang_None);
|
|
|
|
|
d->m_supportedLanguages = d->m_supportedLanguages | languageId;
|
|
|
|
|
d->m_languageCount++;
|
2010-02-26 16:36:02 +01:00
|
|
|
|
2010-08-18 13:54:12 +02:00
|
|
|
d->m_toolBars.insert(languageId, 0);
|
|
|
|
|
d->m_contextsForLanguage.insert(languageId, context);
|
2010-02-26 16:36:02 +01:00
|
|
|
|
2010-08-18 13:54:12 +02:00
|
|
|
Core::ActionManager *am = Core::ICore::instance()->actionManager();
|
2010-06-28 14:30:03 +02:00
|
|
|
|
2010-08-18 13:54:12 +02:00
|
|
|
QAction *debuggableLang = new QAction(languageName, this);
|
|
|
|
|
debuggableLang->setCheckable(true);
|
|
|
|
|
debuggableLang->setText(languageName);
|
|
|
|
|
d->m_languageActionGroup->addAction(debuggableLang);
|
|
|
|
|
Core::Command *activeDebugLanguageCmd = am->registerAction(debuggableLang,
|
|
|
|
|
"Debugger.DebugLanguage." + languageName,
|
2010-06-28 14:30:03 +02:00
|
|
|
Core::Context(Core::Constants::C_GLOBAL));
|
2010-08-18 13:54:12 +02:00
|
|
|
d->m_debuggerLanguageMenu->addAction(activeDebugLanguageCmd);
|
|
|
|
|
|
|
|
|
|
QString shortcutPrefix = tr("Alt+L");
|
|
|
|
|
QString shortcutIndex = QString::number(d->m_languageCount);
|
|
|
|
|
activeDebugLanguageCmd->setDefaultKeySequence(QKeySequence(
|
|
|
|
|
QString("%1,%2").arg(shortcutPrefix).arg(shortcutIndex)));
|
|
|
|
|
|
|
|
|
|
if (languageId == Lang_Qml) {
|
|
|
|
|
d->m_qmlEnabled = true;
|
|
|
|
|
d->m_activateQmlAction = debuggableLang;
|
|
|
|
|
} else if (!d->m_activateCppAction) {
|
|
|
|
|
d->m_activateCppAction = debuggableLang;
|
|
|
|
|
}
|
|
|
|
|
connect(debuggableLang, SIGNAL(triggered()), SLOT(updateActiveLanguages()));
|
2010-04-15 11:59:22 +02:00
|
|
|
|
2010-08-18 13:54:12 +02:00
|
|
|
updateUiForRunConfiguration(0);
|
2010-02-26 16:36:02 +01:00
|
|
|
|
2010-08-18 13:54:12 +02:00
|
|
|
if (activate)
|
|
|
|
|
updateUi();
|
2010-02-09 20:44:40 +01:00
|
|
|
}
|
|
|
|
|
|
2010-08-18 13:54:12 +02:00
|
|
|
void DebuggerUISwitcher::updateUi()
|
2010-02-09 20:44:40 +01:00
|
|
|
{
|
2010-08-18 13:54:12 +02:00
|
|
|
if (d->m_changingUI || !d->m_initialized || !d->m_inDebugMode)
|
2010-02-09 20:44:40 +01:00
|
|
|
return;
|
2010-08-18 13:54:12 +02:00
|
|
|
|
2010-03-18 10:59:06 +01:00
|
|
|
d->m_changingUI = true;
|
2010-02-09 20:44:40 +01:00
|
|
|
|
2010-08-18 13:54:12 +02:00
|
|
|
if (isQmlActive()) {
|
|
|
|
|
activateQmlCppLayout();
|
|
|
|
|
} else {
|
|
|
|
|
activateCppLayout();
|
|
|
|
|
}
|
2010-02-09 20:44:40 +01:00
|
|
|
|
2010-08-18 13:54:12 +02:00
|
|
|
d->m_previousDebugLanguages = d->m_activeDebugLanguages;
|
2010-03-18 16:55:27 +01:00
|
|
|
|
2010-08-18 13:54:12 +02:00
|
|
|
d->m_changingUI = false;
|
|
|
|
|
}
|
2010-03-18 10:56:25 +01:00
|
|
|
|
2010-08-18 13:54:12 +02:00
|
|
|
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));
|
|
|
|
|
|
|
|
|
|
// always use cpp toolbar
|
|
|
|
|
d->m_toolbarStack->setCurrentWidget(d->m_toolBars.value(Lang_Cpp));
|
|
|
|
|
|
|
|
|
|
if (d->m_previousDebugLanguages & Lang_Qml) {
|
|
|
|
|
d->m_dockWidgetActiveStateQmlCpp = d->m_mainWindow->saveSettings();
|
|
|
|
|
core->updateAdditionalContexts(qmlCppContext, Core::Context());
|
|
|
|
|
} else if (d->m_previousDebugLanguages & Lang_Cpp) {
|
|
|
|
|
d->m_dockWidgetActiveStateCpp = d->m_mainWindow->saveSettings();
|
|
|
|
|
core->updateAdditionalContexts(d->m_contextsForLanguage.value(Lang_Cpp), Core::Context());
|
|
|
|
|
}
|
2010-03-19 13:58:26 +01:00
|
|
|
|
2010-08-18 13:54:12 +02:00
|
|
|
d->m_mainWindow->restoreSettings(d->m_dockWidgetActiveStateQmlCpp);
|
|
|
|
|
core->updateAdditionalContexts(Core::Context(), qmlCppContext);
|
|
|
|
|
}
|
2010-03-18 10:56:25 +01:00
|
|
|
|
2010-08-18 13:54:12 +02:00
|
|
|
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));
|
|
|
|
|
|
|
|
|
|
if (d->m_previousDebugLanguages & Lang_Qml) {
|
|
|
|
|
d->m_dockWidgetActiveStateQmlCpp = d->m_mainWindow->saveSettings();
|
|
|
|
|
core->updateAdditionalContexts(qmlCppContext, Core::Context());
|
|
|
|
|
} else if (d->m_previousDebugLanguages & Lang_Cpp) {
|
|
|
|
|
d->m_dockWidgetActiveStateCpp = d->m_mainWindow->saveSettings();
|
|
|
|
|
core->updateAdditionalContexts(d->m_contextsForLanguage.value(Lang_Cpp), Core::Context());
|
2010-02-09 20:44:40 +01:00
|
|
|
}
|
|
|
|
|
|
2010-08-18 13:54:12 +02:00
|
|
|
d->m_mainWindow->restoreSettings(d->m_dockWidgetActiveStateCpp);
|
|
|
|
|
|
|
|
|
|
const Core::Context &cppContext = d->m_contextsForLanguage.value(Lang_Cpp);
|
|
|
|
|
core->updateAdditionalContexts(Core::Context(), cppContext);
|
2010-02-09 20:44:40 +01:00
|
|
|
}
|
|
|
|
|
|
2010-08-18 13:54:12 +02:00
|
|
|
void DebuggerUISwitcher::setToolbar(const DebuggerLanguage &language, QWidget *widget)
|
2010-02-09 20:44:40 +01:00
|
|
|
{
|
2010-08-18 13:54:12 +02:00
|
|
|
Q_ASSERT(d->m_toolBars.contains(language));
|
|
|
|
|
d->m_toolBars[language] = widget;
|
2010-03-18 10:59:06 +01:00
|
|
|
d->m_toolbarStack->addWidget(widget);
|
2010-02-09 20:44:40 +01:00
|
|
|
}
|
|
|
|
|
|
2010-03-18 10:59:06 +01:00
|
|
|
Utils::FancyMainWindow *DebuggerUISwitcher::mainWindow() const
|
2010-02-09 20:44:40 +01:00
|
|
|
{
|
2010-03-18 10:59:06 +01:00
|
|
|
return d->m_mainWindow;
|
2010-02-09 20:44:40 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
QWidget *DebuggerUISwitcher::createMainWindow(Core::BaseMode *mode)
|
|
|
|
|
{
|
2010-03-18 10:59:06 +01:00
|
|
|
d->m_mainWindow = new DebuggerMainWindow(this);
|
|
|
|
|
d->m_mainWindow->setDocumentMode(true);
|
2010-06-29 18:12:22 +02:00
|
|
|
d->m_mainWindow->setDockNestingEnabled(true);
|
2010-04-20 16:46:35 +02:00
|
|
|
connect(d->m_mainWindow, SIGNAL(resetLayout()),
|
|
|
|
|
this, SLOT(resetDebuggerLayout()));
|
2010-08-18 13:54:12 +02:00
|
|
|
connect(d->m_mainWindow->toggleLockedAction(), SIGNAL(triggered()), SLOT(updateDockWidgetSettings()));
|
2010-02-09 20:44:40 +01:00
|
|
|
|
|
|
|
|
QBoxLayout *editorHolderLayout = new QVBoxLayout;
|
|
|
|
|
editorHolderLayout->setMargin(0);
|
|
|
|
|
editorHolderLayout->setSpacing(0);
|
|
|
|
|
|
|
|
|
|
QWidget *editorAndFindWidget = new QWidget;
|
|
|
|
|
editorAndFindWidget->setLayout(editorHolderLayout);
|
|
|
|
|
editorHolderLayout->addWidget(new Core::EditorManagerPlaceHolder(mode));
|
|
|
|
|
editorHolderLayout->addWidget(new Core::FindToolBarPlaceHolder(editorAndFindWidget));
|
|
|
|
|
|
|
|
|
|
Core::MiniSplitter *documentAndRightPane = new Core::MiniSplitter;
|
|
|
|
|
documentAndRightPane->addWidget(editorAndFindWidget);
|
|
|
|
|
documentAndRightPane->addWidget(new Core::RightPanePlaceHolder(mode));
|
|
|
|
|
documentAndRightPane->setStretchFactor(0, 1);
|
|
|
|
|
documentAndRightPane->setStretchFactor(1, 0);
|
|
|
|
|
|
|
|
|
|
Utils::StyledBar *debugToolBar = new Utils::StyledBar;
|
|
|
|
|
debugToolBar->setProperty("topBorder", true);
|
|
|
|
|
QHBoxLayout *debugToolBarLayout = new QHBoxLayout(debugToolBar);
|
|
|
|
|
debugToolBarLayout->setMargin(0);
|
|
|
|
|
debugToolBarLayout->setSpacing(0);
|
2010-03-18 10:59:06 +01:00
|
|
|
debugToolBarLayout->addWidget(d->m_toolbarStack);
|
2010-02-09 20:44:40 +01:00
|
|
|
debugToolBarLayout->addStretch();
|
2010-02-16 16:30:41 +01:00
|
|
|
debugToolBarLayout->addWidget(new Utils::StyledSeparator);
|
2010-02-09 20:44:40 +01:00
|
|
|
|
2010-06-29 18:12:22 +02:00
|
|
|
QDockWidget *dock = new QDockWidget(tr("Debugger Toolbar"));
|
|
|
|
|
dock->setObjectName(QLatin1String("Debugger Toolbar"));
|
|
|
|
|
dock->setWidget(debugToolBar);
|
|
|
|
|
dock->setFeatures(QDockWidget::NoDockWidgetFeatures);
|
|
|
|
|
dock->setAllowedAreas(Qt::BottomDockWidgetArea);
|
|
|
|
|
dock->setTitleBarWidget(new QWidget(dock));
|
|
|
|
|
d->m_mainWindow->addDockWidget(Qt::BottomDockWidgetArea, dock);
|
|
|
|
|
d->m_mainWindow->setToolBarDockWidget(dock);
|
|
|
|
|
|
2010-02-09 20:44:40 +01:00
|
|
|
QWidget *centralWidget = new QWidget;
|
2010-03-18 10:59:06 +01:00
|
|
|
d->m_mainWindow->setCentralWidget(centralWidget);
|
2010-02-09 20:44:40 +01:00
|
|
|
|
|
|
|
|
QVBoxLayout *centralLayout = new QVBoxLayout(centralWidget);
|
|
|
|
|
centralWidget->setLayout(centralLayout);
|
|
|
|
|
centralLayout->setMargin(0);
|
|
|
|
|
centralLayout->setSpacing(0);
|
|
|
|
|
centralLayout->addWidget(documentAndRightPane);
|
|
|
|
|
centralLayout->setStretch(0, 1);
|
|
|
|
|
centralLayout->setStretch(1, 0);
|
|
|
|
|
|
2010-03-18 10:59:06 +01:00
|
|
|
return d->m_mainWindow;
|
2010-02-09 20:44:40 +01:00
|
|
|
}
|
|
|
|
|
|
2010-08-18 13:54:12 +02:00
|
|
|
QDockWidget *DebuggerUISwitcher::breakWindow() const
|
|
|
|
|
{
|
|
|
|
|
return dockWidget(Constants::DW_BREAK);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
QDockWidget *DebuggerUISwitcher::stackWindow() const
|
|
|
|
|
{
|
|
|
|
|
return dockWidget(Constants::DW_STACK);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
QDockWidget *DebuggerUISwitcher::watchWindow() const
|
|
|
|
|
{
|
|
|
|
|
return dockWidget(Constants::DW_WATCHERS);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
QDockWidget *DebuggerUISwitcher::outputWindow() const
|
|
|
|
|
{
|
|
|
|
|
return dockWidget(Constants::DW_OUTPUT);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
QDockWidget *DebuggerUISwitcher::snapshotsWindow() const
|
|
|
|
|
{
|
|
|
|
|
return dockWidget(Constants::DW_SNAPSHOTS);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
QDockWidget *DebuggerUISwitcher::threadsWindow() const
|
|
|
|
|
{
|
|
|
|
|
return dockWidget(Constants::DW_THREADS);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
QDockWidget *DebuggerUISwitcher::qmlInspectorWindow() const
|
|
|
|
|
{
|
|
|
|
|
return dockWidget(Constants::DW_QML_INSPECTOR);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
QDockWidget *DebuggerUISwitcher::dockWidget(const QString &objectName) const
|
|
|
|
|
{
|
|
|
|
|
foreach(const Debugger::Internal::DebugToolWindow *toolWindow, d->m_dockWidgets) {
|
|
|
|
|
if (toolWindow->m_dockWidget->objectName() == objectName)
|
|
|
|
|
return toolWindow->m_dockWidget;
|
|
|
|
|
}
|
|
|
|
|
return 0;
|
|
|
|
|
}
|
2010-02-09 20:44:40 +01:00
|
|
|
|
|
|
|
|
/*!
|
|
|
|
|
Keep track of dock widgets so they can be shown/hidden for different languages
|
|
|
|
|
*/
|
2010-08-18 13:54:12 +02:00
|
|
|
QDockWidget *DebuggerUISwitcher::createDockWidget(const DebuggerLanguage &language,
|
2010-06-16 11:08:54 +02:00
|
|
|
QWidget *widget, Qt::DockWidgetArea area, bool visibleByDefault)
|
2010-02-09 20:44:40 +01:00
|
|
|
{
|
2010-06-16 11:08:54 +02:00
|
|
|
//qDebug() << "CREATE DOCK" << widget->objectName() << langName
|
|
|
|
|
// << d->m_activeLanguage << "VISIBLE BY DEFAULT: " << visibleByDefault;
|
2010-03-18 10:59:06 +01:00
|
|
|
QDockWidget *dockWidget = d->m_mainWindow->addDockForWidget(widget);
|
|
|
|
|
d->m_mainWindow->addDockWidget(area, dockWidget);
|
2010-02-09 20:44:40 +01:00
|
|
|
DebugToolWindow *window = new DebugToolWindow;
|
|
|
|
|
window->m_dockWidget = dockWidget;
|
|
|
|
|
|
|
|
|
|
window->m_visible = visibleByDefault;
|
2010-03-18 10:59:06 +01:00
|
|
|
d->m_dockWidgets.append(window);
|
2010-02-09 20:44:40 +01:00
|
|
|
|
2010-08-18 13:54:12 +02:00
|
|
|
if (!(d->m_activeDebugLanguages & language)) {
|
2010-02-09 20:44:40 +01:00
|
|
|
dockWidget->hide();
|
2010-08-18 13:54:12 +02:00
|
|
|
}
|
2010-02-09 20:44:40 +01:00
|
|
|
|
2010-08-11 10:46:45 +02:00
|
|
|
Core::Context globalContext(Core::Constants::C_GLOBAL);
|
2010-03-19 13:58:26 +01:00
|
|
|
|
2010-02-09 20:44:40 +01:00
|
|
|
Core::ActionManager *am = Core::ICore::instance()->actionManager();
|
2010-08-18 13:54:12 +02:00
|
|
|
QAction *toggleViewAction = dockWidget->toggleViewAction();
|
|
|
|
|
Core::Command *cmd = am->registerAction(toggleViewAction,
|
2010-08-11 10:46:45 +02:00
|
|
|
"Debugger." + dockWidget->objectName(), globalContext);
|
2010-03-19 13:58:26 +01:00
|
|
|
cmd->setAttribute(Core::Command::CA_Hide);
|
2010-03-18 10:59:06 +01:00
|
|
|
d->m_viewsMenu->addAction(cmd);
|
2010-02-09 20:44:40 +01:00
|
|
|
|
2010-08-18 13:54:12 +02:00
|
|
|
d->m_viewsMenuItems.append(qMakePair(language, toggleViewAction));
|
|
|
|
|
|
|
|
|
|
dockWidget->installEventFilter(d->m_resizeEventFilter);
|
|
|
|
|
|
|
|
|
|
connect(dockWidget->toggleViewAction(), SIGNAL(triggered(bool)), SLOT(updateDockWidgetSettings()));
|
|
|
|
|
connect(dockWidget, SIGNAL(topLevelChanged(bool)), SLOT(updateDockWidgetSettings()));
|
|
|
|
|
connect(dockWidget, SIGNAL(dockLocationChanged(Qt::DockWidgetArea)), SLOT(updateDockWidgetSettings()));
|
2010-02-09 20:44:40 +01:00
|
|
|
|
|
|
|
|
return dockWidget;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
QWidget *DebuggerUISwitcher::createContents(Core::BaseMode *mode)
|
|
|
|
|
{
|
|
|
|
|
// right-side window with editor, output etc.
|
|
|
|
|
Core::MiniSplitter *mainWindowSplitter = new Core::MiniSplitter;
|
|
|
|
|
mainWindowSplitter->addWidget(createMainWindow(mode));
|
|
|
|
|
mainWindowSplitter->addWidget(new Core::OutputPanePlaceHolder(mode, mainWindowSplitter));
|
|
|
|
|
mainWindowSplitter->setStretchFactor(0, 10);
|
|
|
|
|
mainWindowSplitter->setStretchFactor(1, 0);
|
|
|
|
|
mainWindowSplitter->setOrientation(Qt::Vertical);
|
|
|
|
|
|
|
|
|
|
// navigation + right-side window
|
|
|
|
|
Core::MiniSplitter *splitter = new Core::MiniSplitter;
|
|
|
|
|
splitter->addWidget(new Core::NavigationWidgetPlaceHolder(mode));
|
|
|
|
|
splitter->addWidget(mainWindowSplitter);
|
|
|
|
|
splitter->setStretchFactor(0, 0);
|
|
|
|
|
splitter->setStretchFactor(1, 1);
|
|
|
|
|
return splitter;
|
|
|
|
|
}
|
|
|
|
|
|
2010-04-28 16:59:03 +02:00
|
|
|
void DebuggerUISwitcher::aboutToShutdown()
|
2010-02-09 20:44:40 +01:00
|
|
|
{
|
|
|
|
|
writeSettings();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void DebuggerUISwitcher::writeSettings() const
|
|
|
|
|
{
|
2010-08-18 13:54:12 +02:00
|
|
|
QSettings *settings = Core::ICore::instance()->settings();
|
|
|
|
|
{
|
|
|
|
|
settings->beginGroup(QLatin1String("DebugMode.CppMode"));
|
|
|
|
|
QHashIterator<QString, QVariant> it(d->m_dockWidgetActiveStateCpp);
|
|
|
|
|
while (it.hasNext()) {
|
|
|
|
|
it.next();
|
|
|
|
|
settings->setValue(it.key(), it.value());
|
2010-02-09 20:44:40 +01:00
|
|
|
}
|
2010-08-18 13:54:12 +02:00
|
|
|
settings->endGroup();
|
|
|
|
|
}
|
|
|
|
|
{
|
|
|
|
|
settings->beginGroup(QLatin1String("DebugMode.CppQmlMode"));
|
|
|
|
|
QHashIterator<QString, QVariant> it(d->m_dockWidgetActiveStateQmlCpp);
|
|
|
|
|
while (it.hasNext()) {
|
|
|
|
|
it.next();
|
|
|
|
|
settings->setValue(it.key(), it.value());
|
|
|
|
|
}
|
|
|
|
|
settings->endGroup();
|
2010-02-09 20:44:40 +01:00
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void DebuggerUISwitcher::readSettings()
|
|
|
|
|
{
|
2010-08-18 13:54:12 +02:00
|
|
|
QSettings *settings = Core::ICore::instance()->settings();
|
|
|
|
|
d->m_dockWidgetActiveStateCpp.clear();
|
|
|
|
|
d->m_dockWidgetActiveStateQmlCpp.clear();
|
|
|
|
|
|
|
|
|
|
settings->beginGroup(QLatin1String("DebugMode.CppMode"));
|
|
|
|
|
foreach (const QString &key, settings->childKeys()) {
|
|
|
|
|
d->m_dockWidgetActiveStateCpp.insert(key, settings->value(key));
|
2010-02-09 20:44:40 +01:00
|
|
|
}
|
2010-08-18 13:54:12 +02:00
|
|
|
settings->endGroup();
|
|
|
|
|
|
|
|
|
|
settings->beginGroup(QLatin1String("DebugMode.CppQmlMode"));
|
|
|
|
|
foreach (const QString &key, settings->childKeys()) {
|
|
|
|
|
d->m_dockWidgetActiveStateQmlCpp.insert(key, settings->value(key));
|
|
|
|
|
}
|
|
|
|
|
settings->endGroup();
|
2010-02-09 20:44:40 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void DebuggerUISwitcher::initialize()
|
|
|
|
|
{
|
|
|
|
|
createViewsMenuItems();
|
|
|
|
|
|
2010-08-18 13:54:12 +02:00
|
|
|
emit dockResetRequested(Lang_None);
|
2010-02-09 20:44:40 +01:00
|
|
|
readSettings();
|
|
|
|
|
|
2010-08-18 13:54:12 +02:00
|
|
|
updateUi();
|
2010-06-29 18:12:22 +02:00
|
|
|
|
2010-02-09 20:44:40 +01:00
|
|
|
hideInactiveWidgets();
|
2010-04-20 16:46:35 +02:00
|
|
|
d->m_mainWindow->setDockActionsVisible(false);
|
2010-08-18 13:54:12 +02:00
|
|
|
d->m_initialized = true;
|
2010-02-09 20:44:40 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void DebuggerUISwitcher::resetDebuggerLayout()
|
|
|
|
|
{
|
2010-08-18 13:54:12 +02:00
|
|
|
emit dockResetRequested(d->m_activeDebugLanguages);
|
|
|
|
|
|
|
|
|
|
if (isQmlActive()) {
|
|
|
|
|
d->m_dockWidgetActiveStateQmlCpp = d->m_mainWindow->saveSettings();
|
|
|
|
|
} else {
|
|
|
|
|
d->m_dockWidgetActiveStateCpp = d->m_mainWindow->saveSettings();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
updateActiveLanguages();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void DebuggerUISwitcher::updateDockWidgetSettings()
|
|
|
|
|
{
|
|
|
|
|
if (!d->m_inDebugMode || d->m_changingUI)
|
|
|
|
|
return;
|
|
|
|
|
|
|
|
|
|
if (isQmlActive()) {
|
|
|
|
|
d->m_dockWidgetActiveStateQmlCpp = d->m_mainWindow->saveSettings();
|
|
|
|
|
} else {
|
|
|
|
|
d->m_dockWidgetActiveStateCpp = d->m_mainWindow->saveSettings();
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
bool DebuggerUISwitcher::isQmlCppActive() const
|
|
|
|
|
{
|
|
|
|
|
return (d->m_activeDebugLanguages & Lang_Cpp) && (d->m_activeDebugLanguages & Lang_Qml);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
bool DebuggerUISwitcher::isQmlActive() const
|
|
|
|
|
{
|
|
|
|
|
return (d->m_activeDebugLanguages & Lang_Qml);
|
2010-03-18 10:59:06 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
QList<Internal::DebugToolWindow* > DebuggerUISwitcher::i_mw_debugToolWindows() const
|
|
|
|
|
{
|
|
|
|
|
return d->m_dockWidgets;
|
2010-02-09 20:44:40 +01:00
|
|
|
}
|
|
|
|
|
|
2010-04-06 16:42:24 +02:00
|
|
|
} // namespace Debugger
|