summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorhjk <qtc-committer@nokia.com>2010-08-30 17:08:29 +0200
committerhjk <qtc-committer@nokia.com>2010-09-01 10:14:05 +0200
commita0d689c50e00e463810fc4b5fb9ca4a16224c164 (patch)
treea49491f2bf61a557b51ff21ffe5b8e58841279d9
parent7e48b8e5be9204b88a753af54bfee6f68c62c0a9 (diff)
downloadqt-creator-a0d689c50e00e463810fc4b5fb9ca4a16224c164.tar.gz
debugger: code cosmetics
-rw-r--r--src/plugins/debugger/debuggerplugin.cpp2
-rw-r--r--src/plugins/debugger/debuggeruiswitcher.cpp61
-rw-r--r--src/plugins/debugger/debuggeruiswitcher.h9
3 files changed, 40 insertions, 32 deletions
diff --git a/src/plugins/debugger/debuggerplugin.cpp b/src/plugins/debugger/debuggerplugin.cpp
index 80148dfff6..36bc30fc08 100644
--- a/src/plugins/debugger/debuggerplugin.cpp
+++ b/src/plugins/debugger/debuggerplugin.cpp
@@ -2363,6 +2363,8 @@ void DebuggerPluginPrivate::onModeChanged(IMode *mode)
// different then the debugger mode. E.g. Welcome and Help mode and
// also on shutdown.
+ m_uiSwitcher->onModeChanged(mode);
+
if (mode != m_debugMode)
return;
diff --git a/src/plugins/debugger/debuggeruiswitcher.cpp b/src/plugins/debugger/debuggeruiswitcher.cpp
index 8a1aa02b08..9e27f92140 100644
--- a/src/plugins/debugger/debuggeruiswitcher.cpp
+++ b/src/plugins/debugger/debuggeruiswitcher.cpp
@@ -171,19 +171,17 @@ DebuggerUISwitcher::DebuggerUISwitcher(Core::BaseMode *mode, QObject* parent) :
Core::ICore *core = Core::ICore::instance();
Core::ActionManager *am = core->actionManager();
- ProjectExplorer::ProjectExplorerPlugin *pe = ProjectExplorer::ProjectExplorerPlugin::instance();
+ ProjectExplorer::ProjectExplorerPlugin *pe =
+ ProjectExplorer::ProjectExplorerPlugin::instance();
connect(pe->session(), SIGNAL(startupProjectChanged(ProjectExplorer::Project*)),
- SLOT(updateUiForProject(ProjectExplorer::Project*)));
- connect(Core::ModeManager::instance(), SIGNAL(currentModeChanged(Core::IMode*)),
- SLOT(modeChanged(Core::IMode*)));
- connect(d->m_resizeEventFilter, SIGNAL(widgetResized()), SLOT(updateDockWidgetSettings()));
+ SLOT(updateUiForProject(ProjectExplorer::Project*)));
+ connect(d->m_resizeEventFilter, SIGNAL(widgetResized()),
+ SLOT(updateDockWidgetSettings()));
d->m_debugMenu = am->actionContainer(ProjectExplorer::Constants::M_DEBUG);
-
d->m_viewsMenu = am->actionContainer(QLatin1String(Core::Constants::M_WINDOW_VIEWS));
QTC_ASSERT(d->m_viewsMenu, return)
-
- d->m_debuggerLanguageMenu = am->createMenu(Debugger::Constants::M_DEBUG_DEBUGGING_LANGUAGES);
+ d->m_debuggerLanguageMenu = am->createMenu(Constants::M_DEBUG_DEBUGGING_LANGUAGES);
DebuggerUISwitcherPrivate::m_instance = this;
}
@@ -209,25 +207,27 @@ void DebuggerUISwitcher::updateUiForProject(ProjectExplorer::Project *project)
this, SLOT(updateUiForTarget(ProjectExplorer::Target*)));
}
d->m_previousProject = project;
- connect(project, SIGNAL(fileListChanged()), SLOT(updateUiOnFileListChange()));
+ connect(project, SIGNAL(fileListChanged()),
+ SLOT(updateUiOnFileListChange()));
connect(project, SIGNAL(activeTargetChanged(ProjectExplorer::Target*)),
- this, SLOT(updateUiForTarget(ProjectExplorer::Target*)));
+ SLOT(updateUiForTarget(ProjectExplorer::Target*)));
updateUiForTarget(project->activeTarget());
}
}
void DebuggerUISwitcher::updateUiForTarget(ProjectExplorer::Target *target)
{
- 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());
+ if (!target)
+ return;
+
+ 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*)),
+ SLOT(updateUiForRunConfiguration(ProjectExplorer::RunConfiguration*)));
+ updateUiForRunConfiguration(target->activeRunConfiguration());
}
static bool isQmlProjectType(ProjectExplorer::RunConfiguration *rc)
@@ -296,8 +296,8 @@ DebuggerLanguages DebuggerUISwitcher::supportedLanguages() const
return d->m_supportedLanguages;
}
-void DebuggerUISwitcher::addMenuAction(Core::Command *command, const DebuggerLanguage &language,
- const QString &group)
+void DebuggerUISwitcher::addMenuAction(Core::Command *command,
+ const DebuggerLanguage &language, const QString &group)
{
d->m_debugMenu->addAction(command, group);
d->m_menuCommands.insert(language, command);
@@ -308,7 +308,7 @@ DebuggerLanguages DebuggerUISwitcher::activeDebugLanguages() const
return d->m_activeDebugLanguages;
}
-void DebuggerUISwitcher::modeChanged(Core::IMode *mode)
+void DebuggerUISwitcher::onModeChanged(Core::IMode *mode)
{
d->m_inDebugMode = (mode->id() == Constants::MODE_DEBUG);
d->m_mainWindow->setDockActionsVisible(d->m_inDebugMode);
@@ -480,8 +480,9 @@ QWidget *DebuggerUISwitcher::createMainWindow(Core::BaseMode *mode)
d->m_mainWindow->setDocumentMode(true);
d->m_mainWindow->setDockNestingEnabled(true);
connect(d->m_mainWindow, SIGNAL(resetLayout()),
- this, SLOT(resetDebuggerLayout()));
- connect(d->m_mainWindow->toggleLockedAction(), SIGNAL(triggered()), SLOT(updateDockWidgetSettings()));
+ SLOT(resetDebuggerLayout()));
+ connect(d->m_mainWindow->toggleLockedAction(), SIGNAL(triggered()),
+ SLOT(updateDockWidgetSettings()));
QBoxLayout *editorHolderLayout = new QVBoxLayout;
editorHolderLayout->setMargin(0);
@@ -586,9 +587,8 @@ QDockWidget *DebuggerUISwitcher::createDockWidget(const DebuggerLanguage &langua
d->m_mainWindow->addDockWidget(area, dockWidget);
d->m_dockWidgets.append(dockWidget);
- if (!(d->m_activeDebugLanguages & language)) {
+ if (!(d->m_activeDebugLanguages & language))
dockWidget->hide();
- }
Core::Context globalContext(Core::Constants::C_GLOBAL);
@@ -603,9 +603,12 @@ QDockWidget *DebuggerUISwitcher::createDockWidget(const DebuggerLanguage &langua
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()));
+ connect(dockWidget->toggleViewAction(), SIGNAL(triggered(bool)),
+ SLOT(updateDockWidgetSettings()));
+ connect(dockWidget, SIGNAL(topLevelChanged(bool)),
+ SLOT(updateDockWidgetSettings()));
+ connect(dockWidget, SIGNAL(dockLocationChanged(Qt::DockWidgetArea)),
+ SLOT(updateDockWidgetSettings()));
return dockWidget;
}
diff --git a/src/plugins/debugger/debuggeruiswitcher.h b/src/plugins/debugger/debuggeruiswitcher.h
index 8a36204c25..49ad57aa65 100644
--- a/src/plugins/debugger/debuggeruiswitcher.h
+++ b/src/plugins/debugger/debuggeruiswitcher.h
@@ -36,8 +36,10 @@
#include <QtCore/QObject>
#include <QtCore/QMultiHash>
-QT_FORWARD_DECLARE_CLASS(QEvent)
-QT_FORWARD_DECLARE_CLASS(QDockWidget)
+QT_BEGIN_NAMESPACE
+class QEvent;
+class QDockWidget;
+QT_END_NAMESPACE
namespace Core {
class ActionContainer;
@@ -68,6 +70,7 @@ namespace Internal {
class DEBUGGER_EXPORT DebuggerUISwitcher : public QObject
{
Q_OBJECT
+
public:
explicit DebuggerUISwitcher(Core::BaseMode *mode, QObject *parent = 0);
virtual ~DebuggerUISwitcher();
@@ -96,6 +99,7 @@ public:
void aboutToStartDebugger();
void aboutToShutdown();
+ void onModeChanged(Core::IMode *mode);
// most common debugger windows
QDockWidget *breakWindow() const;
@@ -122,7 +126,6 @@ signals:
void dockResetRequested(const Debugger::DebuggerLanguages &activeLanguages);
private slots:
- void modeChanged(Core::IMode *mode);
void updateUi();
void resetDebuggerLayout();