forked from qt-creator/qt-creator
debugger: move some private bits to DebuggerMainWindowPrivate
This commit is contained in:
@@ -68,6 +68,7 @@
|
|||||||
#include <QtGui/QVBoxLayout>
|
#include <QtGui/QVBoxLayout>
|
||||||
|
|
||||||
using namespace Core;
|
using namespace Core;
|
||||||
|
using namespace ProjectExplorer;
|
||||||
|
|
||||||
namespace Debugger {
|
namespace Debugger {
|
||||||
namespace Internal {
|
namespace Internal {
|
||||||
@@ -102,11 +103,30 @@ bool DockWidgetEventFilter::eventFilter(QObject *obj, QEvent *event)
|
|||||||
// first: language id, second: menu item
|
// first: language id, second: menu item
|
||||||
typedef QPair<DebuggerLanguage, QAction *> ViewsMenuItems;
|
typedef QPair<DebuggerLanguage, QAction *> ViewsMenuItems;
|
||||||
|
|
||||||
class DebuggerMainWindowPrivate
|
class DebuggerMainWindowPrivate : public QObject
|
||||||
{
|
{
|
||||||
|
Q_OBJECT
|
||||||
|
|
||||||
public:
|
public:
|
||||||
explicit DebuggerMainWindowPrivate(DebuggerMainWindow *mainWindow);
|
explicit DebuggerMainWindowPrivate(DebuggerMainWindow *mainWindow);
|
||||||
|
|
||||||
|
void activateQmlCppLayout();
|
||||||
|
void activateCppLayout();
|
||||||
|
void hideInactiveWidgets();
|
||||||
|
void createViewsMenuItems();
|
||||||
|
bool isQmlCppActive() const;
|
||||||
|
bool isQmlActive() const;
|
||||||
|
|
||||||
|
public slots:
|
||||||
|
void updateUi();
|
||||||
|
void resetDebuggerLayout();
|
||||||
|
|
||||||
|
void updateUiForProject(ProjectExplorer::Project *project);
|
||||||
|
void updateUiForTarget(ProjectExplorer::Target *target);
|
||||||
|
void updateUiForRunConfiguration(ProjectExplorer::RunConfiguration *rc);
|
||||||
|
void updateUiForCurrentRunConfiguration();
|
||||||
|
void updateUiOnFileListChange();
|
||||||
|
|
||||||
public:
|
public:
|
||||||
DebuggerMainWindow *q;
|
DebuggerMainWindow *q;
|
||||||
QList<ViewsMenuItems> m_viewsMenuItems;
|
QList<ViewsMenuItems> m_viewsMenuItems;
|
||||||
@@ -137,9 +157,9 @@ public:
|
|||||||
|
|
||||||
QMultiHash<DebuggerLanguage, Command *> m_menuCommands;
|
QMultiHash<DebuggerLanguage, Command *> m_menuCommands;
|
||||||
|
|
||||||
QWeakPointer<ProjectExplorer::Project> m_previousProject;
|
QWeakPointer<Project> m_previousProject;
|
||||||
QWeakPointer<ProjectExplorer::Target> m_previousTarget;
|
QWeakPointer<Target> m_previousTarget;
|
||||||
QWeakPointer<ProjectExplorer::RunConfiguration> m_previousRunConfiguration;
|
QWeakPointer<RunConfiguration> m_previousRunConfiguration;
|
||||||
|
|
||||||
bool m_initialized;
|
bool m_initialized;
|
||||||
QSettings *m_settings;
|
QSettings *m_settings;
|
||||||
@@ -163,6 +183,66 @@ DebuggerMainWindowPrivate::DebuggerMainWindowPrivate(DebuggerMainWindow *mw)
|
|||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void DebuggerMainWindowPrivate::updateUiOnFileListChange()
|
||||||
|
{
|
||||||
|
if (m_previousProject)
|
||||||
|
updateUiForTarget(m_previousProject.data()->activeTarget());
|
||||||
|
}
|
||||||
|
|
||||||
|
void DebuggerMainWindowPrivate::updateUiForProject(Project *project)
|
||||||
|
{
|
||||||
|
if (!project)
|
||||||
|
return;
|
||||||
|
if (m_previousProject) {
|
||||||
|
disconnect(m_previousProject.data(),
|
||||||
|
SIGNAL(activeTargetChanged(ProjectExplorer::Target*)),
|
||||||
|
this, SLOT(updateUiForTarget(ProjectExplorer::Target*)));
|
||||||
|
}
|
||||||
|
m_previousProject = project;
|
||||||
|
connect(project, SIGNAL(fileListChanged()),
|
||||||
|
SLOT(updateUiOnFileListChange()));
|
||||||
|
connect(project, SIGNAL(activeTargetChanged(ProjectExplorer::Target*)),
|
||||||
|
SLOT(updateUiForTarget(ProjectExplorer::Target*)));
|
||||||
|
updateUiForTarget(project->activeTarget());
|
||||||
|
}
|
||||||
|
|
||||||
|
void DebuggerMainWindowPrivate::updateUiForTarget(Target *target)
|
||||||
|
{
|
||||||
|
if (!target)
|
||||||
|
return;
|
||||||
|
|
||||||
|
if (m_previousTarget) {
|
||||||
|
disconnect(m_previousTarget.data(),
|
||||||
|
SIGNAL(activeRunConfigurationChanged(ProjectExplorer::RunConfiguration*)),
|
||||||
|
this, SLOT(updateUiForRunConfiguration(ProjectExplorer::RunConfiguration*)));
|
||||||
|
}
|
||||||
|
m_previousTarget = target;
|
||||||
|
connect(target,
|
||||||
|
SIGNAL(activeRunConfigurationChanged(ProjectExplorer::RunConfiguration*)),
|
||||||
|
SLOT(updateUiForRunConfiguration(ProjectExplorer::RunConfiguration*)));
|
||||||
|
updateUiForRunConfiguration(target->activeRunConfiguration());
|
||||||
|
}
|
||||||
|
|
||||||
|
// updates default debug language settings per run config.
|
||||||
|
void DebuggerMainWindowPrivate::updateUiForRunConfiguration(RunConfiguration *rc)
|
||||||
|
{
|
||||||
|
if (!rc)
|
||||||
|
return;
|
||||||
|
if (m_previousRunConfiguration)
|
||||||
|
disconnect(m_previousRunConfiguration.data(), SIGNAL(debuggersChanged()),
|
||||||
|
this, SLOT(updateUiForCurrentRunConfiguration()));
|
||||||
|
m_previousRunConfiguration = rc;
|
||||||
|
connect(m_previousRunConfiguration.data(),
|
||||||
|
SIGNAL(debuggersChanged()),
|
||||||
|
SLOT(updateUiForCurrentRunConfiguration()));
|
||||||
|
updateUiForCurrentRunConfiguration();
|
||||||
|
}
|
||||||
|
|
||||||
|
void DebuggerMainWindowPrivate::updateUiForCurrentRunConfiguration()
|
||||||
|
{
|
||||||
|
q->updateActiveLanguages();
|
||||||
|
}
|
||||||
|
|
||||||
} // namespace Internal
|
} // namespace Internal
|
||||||
|
|
||||||
using namespace Internal;
|
using namespace Internal;
|
||||||
@@ -177,69 +257,6 @@ DebuggerMainWindow::~DebuggerMainWindow()
|
|||||||
delete d;
|
delete d;
|
||||||
}
|
}
|
||||||
|
|
||||||
void DebuggerMainWindow::updateUiOnFileListChange()
|
|
||||||
{
|
|
||||||
if (d->m_previousProject)
|
|
||||||
updateUiForTarget(d->m_previousProject.data()->activeTarget());
|
|
||||||
}
|
|
||||||
|
|
||||||
void DebuggerMainWindow::updateUiForProject(ProjectExplorer::Project *project)
|
|
||||||
{
|
|
||||||
if (!project)
|
|
||||||
return;
|
|
||||||
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*)),
|
|
||||||
SLOT(updateUiForTarget(ProjectExplorer::Target*)));
|
|
||||||
updateUiForTarget(project->activeTarget());
|
|
||||||
}
|
|
||||||
|
|
||||||
void DebuggerMainWindow::updateUiForTarget(ProjectExplorer::Target *target)
|
|
||||||
{
|
|
||||||
if (!target)
|
|
||||||
return;
|
|
||||||
|
|
||||||
if (d->m_previousTarget) {
|
|
||||||
disconnect(d->m_previousTarget.data(),
|
|
||||||
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());
|
|
||||||
}
|
|
||||||
|
|
||||||
// updates default debug language settings per run config.
|
|
||||||
void DebuggerMainWindow::updateUiForRunConfiguration(ProjectExplorer::RunConfiguration *rc)
|
|
||||||
{
|
|
||||||
if (rc) {
|
|
||||||
if (d->m_previousRunConfiguration) {
|
|
||||||
disconnect(d->m_previousRunConfiguration.data(),
|
|
||||||
SIGNAL(debuggersChanged()),
|
|
||||||
this, SLOT(updateUiForCurrentRunConfiguration()));
|
|
||||||
}
|
|
||||||
d->m_previousRunConfiguration = rc;
|
|
||||||
connect(d->m_previousRunConfiguration.data(),
|
|
||||||
SIGNAL(debuggersChanged()),
|
|
||||||
this, SLOT(updateUiForCurrentRunConfiguration()));
|
|
||||||
|
|
||||||
updateUiForCurrentRunConfiguration();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
void DebuggerMainWindow::updateUiForCurrentRunConfiguration()
|
|
||||||
{
|
|
||||||
updateActiveLanguages();
|
|
||||||
}
|
|
||||||
|
|
||||||
void DebuggerMainWindow::updateActiveLanguages()
|
void DebuggerMainWindow::updateActiveLanguages()
|
||||||
{
|
{
|
||||||
DebuggerLanguages newLanguages = AnyLanguage;
|
DebuggerLanguages newLanguages = AnyLanguage;
|
||||||
@@ -256,7 +273,7 @@ void DebuggerMainWindow::updateActiveLanguages()
|
|||||||
emit activeLanguagesChanged(d->m_activeDebugLanguages);
|
emit activeLanguagesChanged(d->m_activeDebugLanguages);
|
||||||
}
|
}
|
||||||
|
|
||||||
updateUi();
|
d->updateUi();
|
||||||
}
|
}
|
||||||
|
|
||||||
DebuggerLanguages DebuggerMainWindow::supportedLanguages() const
|
DebuggerLanguages DebuggerMainWindow::supportedLanguages() const
|
||||||
@@ -280,7 +297,7 @@ void DebuggerMainWindow::onModeChanged(IMode *mode)
|
|||||||
{
|
{
|
||||||
d->m_inDebugMode = (mode->id() == Constants::MODE_DEBUG);
|
d->m_inDebugMode = (mode->id() == Constants::MODE_DEBUG);
|
||||||
setDockActionsVisible(d->m_inDebugMode);
|
setDockActionsVisible(d->m_inDebugMode);
|
||||||
hideInactiveWidgets();
|
d->hideInactiveWidgets();
|
||||||
|
|
||||||
if (mode->id() != Constants::MODE_DEBUG)
|
if (mode->id() != Constants::MODE_DEBUG)
|
||||||
//|| DebuggerPlugin::instance()->hasSnapshots())
|
//|| DebuggerPlugin::instance()->hasSnapshots())
|
||||||
@@ -289,47 +306,47 @@ void DebuggerMainWindow::onModeChanged(IMode *mode)
|
|||||||
updateActiveLanguages();
|
updateActiveLanguages();
|
||||||
}
|
}
|
||||||
|
|
||||||
void DebuggerMainWindow::hideInactiveWidgets()
|
void DebuggerMainWindowPrivate::hideInactiveWidgets()
|
||||||
{
|
{
|
||||||
// Hide all the debugger windows if mode is different.
|
// Hide all the debugger windows if mode is different.
|
||||||
if (d->m_inDebugMode)
|
if (m_inDebugMode)
|
||||||
return;
|
return;
|
||||||
// Hide dock widgets manually in case they are floating.
|
// Hide dock widgets manually in case they are floating.
|
||||||
foreach (QDockWidget *dockWidget, d->m_dockWidgets) {
|
foreach (QDockWidget *dockWidget, m_dockWidgets) {
|
||||||
if (dockWidget->isFloating())
|
if (dockWidget->isFloating())
|
||||||
dockWidget->hide();
|
dockWidget->hide();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void DebuggerMainWindow::createViewsMenuItems()
|
void DebuggerMainWindowPrivate::createViewsMenuItems()
|
||||||
{
|
{
|
||||||
ICore *core = ICore::instance();
|
ICore *core = ICore::instance();
|
||||||
ActionManager *am = core->actionManager();
|
ActionManager *am = core->actionManager();
|
||||||
Context globalcontext(Core::Constants::C_GLOBAL);
|
Context globalcontext(Core::Constants::C_GLOBAL);
|
||||||
|
|
||||||
d->m_openMemoryEditorAction = new QAction(this);
|
m_openMemoryEditorAction = new QAction(this);
|
||||||
d->m_openMemoryEditorAction->setText(tr("Memory..."));
|
m_openMemoryEditorAction->setText(tr("Memory..."));
|
||||||
connect(d->m_openMemoryEditorAction, SIGNAL(triggered()),
|
connect(m_openMemoryEditorAction, SIGNAL(triggered()),
|
||||||
SIGNAL(memoryEditorRequested()));
|
q, SIGNAL(memoryEditorRequested()));
|
||||||
|
|
||||||
// Add menu items
|
// Add menu items
|
||||||
Command *cmd = 0;
|
Command *cmd = 0;
|
||||||
cmd = am->registerAction(d->m_openMemoryEditorAction,
|
cmd = am->registerAction(m_openMemoryEditorAction,
|
||||||
Core::Id("Debugger.Views.OpenMemoryEditor"),
|
Core::Id("Debugger.Views.OpenMemoryEditor"),
|
||||||
Core::Context(Constants::C_DEBUGMODE));
|
Core::Context(Constants::C_DEBUGMODE));
|
||||||
d->m_viewsMenu->addAction(cmd);
|
m_viewsMenu->addAction(cmd);
|
||||||
cmd = am->registerAction(menuSeparator1(),
|
cmd = am->registerAction(q->menuSeparator1(),
|
||||||
Core::Id("Debugger.Views.Separator1"), globalcontext);
|
Core::Id("Debugger.Views.Separator1"), globalcontext);
|
||||||
d->m_viewsMenu->addAction(cmd);
|
m_viewsMenu->addAction(cmd);
|
||||||
cmd = am->registerAction(toggleLockedAction(),
|
cmd = am->registerAction(q->toggleLockedAction(),
|
||||||
Core::Id("Debugger.Views.ToggleLocked"), globalcontext);
|
Core::Id("Debugger.Views.ToggleLocked"), globalcontext);
|
||||||
d->m_viewsMenu->addAction(cmd);
|
m_viewsMenu->addAction(cmd);
|
||||||
cmd = am->registerAction(menuSeparator2(),
|
cmd = am->registerAction(q->menuSeparator2(),
|
||||||
Core::Id("Debugger.Views.Separator2"), globalcontext);
|
Core::Id("Debugger.Views.Separator2"), globalcontext);
|
||||||
d->m_viewsMenu->addAction(cmd);
|
m_viewsMenu->addAction(cmd);
|
||||||
cmd = am->registerAction(resetLayoutAction(),
|
cmd = am->registerAction(q->resetLayoutAction(),
|
||||||
Core::Id("Debugger.Views.ResetSimple"), globalcontext);
|
Core::Id("Debugger.Views.ResetSimple"), globalcontext);
|
||||||
d->m_viewsMenu->addAction(cmd);
|
m_viewsMenu->addAction(cmd);
|
||||||
}
|
}
|
||||||
|
|
||||||
void DebuggerMainWindow::addLanguage(const DebuggerLanguage &languageId, const Context &context)
|
void DebuggerMainWindow::addLanguage(const DebuggerLanguage &languageId, const Context &context)
|
||||||
@@ -341,69 +358,70 @@ void DebuggerMainWindow::addLanguage(const DebuggerLanguage &languageId, const C
|
|||||||
d->m_toolBars.insert(languageId, 0);
|
d->m_toolBars.insert(languageId, 0);
|
||||||
d->m_contextsForLanguage.insert(languageId, context);
|
d->m_contextsForLanguage.insert(languageId, context);
|
||||||
|
|
||||||
updateUiForRunConfiguration(0);
|
d->updateUiForRunConfiguration(0);
|
||||||
|
|
||||||
if (activate)
|
if (activate)
|
||||||
updateUi();
|
d->updateUi();
|
||||||
}
|
}
|
||||||
|
|
||||||
void DebuggerMainWindow::updateUi()
|
void DebuggerMainWindowPrivate::updateUi()
|
||||||
{
|
{
|
||||||
if (d->m_changingUI || !d->m_initialized || !d->m_inDebugMode)
|
if (m_changingUI || !m_initialized || !m_inDebugMode)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
d->m_changingUI = true;
|
m_changingUI = true;
|
||||||
|
|
||||||
if (isQmlActive()) {
|
if (isQmlActive())
|
||||||
activateQmlCppLayout();
|
activateQmlCppLayout();
|
||||||
} else {
|
else
|
||||||
activateCppLayout();
|
activateCppLayout();
|
||||||
|
|
||||||
|
m_previousDebugLanguages = m_activeDebugLanguages;
|
||||||
|
|
||||||
|
m_changingUI = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
d->m_previousDebugLanguages = d->m_activeDebugLanguages;
|
void DebuggerMainWindowPrivate::activateQmlCppLayout()
|
||||||
|
|
||||||
d->m_changingUI = false;
|
|
||||||
}
|
|
||||||
|
|
||||||
void DebuggerMainWindow::activateQmlCppLayout()
|
|
||||||
{
|
{
|
||||||
ICore *core = ICore::instance();
|
ICore *core = ICore::instance();
|
||||||
Context qmlCppContext = d->m_contextsForLanguage.value(QmlLanguage);
|
Context qmlCppContext = m_contextsForLanguage.value(QmlLanguage);
|
||||||
qmlCppContext.add(d->m_contextsForLanguage.value(CppLanguage));
|
qmlCppContext.add(m_contextsForLanguage.value(CppLanguage));
|
||||||
|
|
||||||
// always use cpp toolbar
|
// always use cpp toolbar
|
||||||
d->m_toolbarStack->setCurrentWidget(d->m_toolBars.value(CppLanguage));
|
m_toolbarStack->setCurrentWidget(m_toolBars.value(CppLanguage));
|
||||||
|
|
||||||
if (d->m_previousDebugLanguages & QmlLanguage) {
|
if (m_previousDebugLanguages & QmlLanguage) {
|
||||||
d->m_dockWidgetActiveStateQmlCpp = saveSettings();
|
m_dockWidgetActiveStateQmlCpp = q->saveSettings();
|
||||||
core->updateAdditionalContexts(qmlCppContext, Context());
|
core->updateAdditionalContexts(qmlCppContext, Context());
|
||||||
} else if (d->m_previousDebugLanguages & CppLanguage) {
|
} else if (m_previousDebugLanguages & CppLanguage) {
|
||||||
d->m_dockWidgetActiveStateCpp = saveSettings();
|
m_dockWidgetActiveStateCpp = q->saveSettings();
|
||||||
core->updateAdditionalContexts(d->m_contextsForLanguage.value(CppLanguage), Context());
|
core->updateAdditionalContexts(m_contextsForLanguage.value(CppLanguage),
|
||||||
|
Context());
|
||||||
}
|
}
|
||||||
|
|
||||||
restoreSettings(d->m_dockWidgetActiveStateQmlCpp);
|
q->restoreSettings(m_dockWidgetActiveStateQmlCpp);
|
||||||
core->updateAdditionalContexts(Context(), qmlCppContext);
|
core->updateAdditionalContexts(Context(), qmlCppContext);
|
||||||
}
|
}
|
||||||
|
|
||||||
void DebuggerMainWindow::activateCppLayout()
|
void DebuggerMainWindowPrivate::activateCppLayout()
|
||||||
{
|
{
|
||||||
ICore *core = ICore::instance();
|
ICore *core = ICore::instance();
|
||||||
Context qmlCppContext = d->m_contextsForLanguage.value(QmlLanguage);
|
Context qmlCppContext = m_contextsForLanguage.value(QmlLanguage);
|
||||||
qmlCppContext.add(d->m_contextsForLanguage.value(CppLanguage));
|
qmlCppContext.add(m_contextsForLanguage.value(CppLanguage));
|
||||||
d->m_toolbarStack->setCurrentWidget(d->m_toolBars.value(CppLanguage));
|
m_toolbarStack->setCurrentWidget(m_toolBars.value(CppLanguage));
|
||||||
|
|
||||||
if (d->m_previousDebugLanguages & QmlLanguage) {
|
if (m_previousDebugLanguages & QmlLanguage) {
|
||||||
d->m_dockWidgetActiveStateQmlCpp = saveSettings();
|
m_dockWidgetActiveStateQmlCpp = q->saveSettings();
|
||||||
core->updateAdditionalContexts(qmlCppContext, Context());
|
core->updateAdditionalContexts(qmlCppContext, Context());
|
||||||
} else if (d->m_previousDebugLanguages & CppLanguage) {
|
} else if (m_previousDebugLanguages & CppLanguage) {
|
||||||
d->m_dockWidgetActiveStateCpp = saveSettings();
|
m_dockWidgetActiveStateCpp = q->saveSettings();
|
||||||
core->updateAdditionalContexts(d->m_contextsForLanguage.value(CppLanguage), Context());
|
core->updateAdditionalContexts(m_contextsForLanguage.value(CppLanguage),
|
||||||
|
Context());
|
||||||
}
|
}
|
||||||
|
|
||||||
restoreSettings(d->m_dockWidgetActiveStateCpp);
|
q->restoreSettings(m_dockWidgetActiveStateCpp);
|
||||||
|
|
||||||
const Context &cppContext = d->m_contextsForLanguage.value(CppLanguage);
|
const Context &cppContext = m_contextsForLanguage.value(CppLanguage);
|
||||||
core->updateAdditionalContexts(Context(), cppContext);
|
core->updateAdditionalContexts(Context(), cppContext);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -500,11 +518,9 @@ QWidget *DebuggerMainWindow::createContents(IMode *mode)
|
|||||||
{
|
{
|
||||||
ICore *core = ICore::instance();
|
ICore *core = ICore::instance();
|
||||||
ActionManager *am = core->actionManager();
|
ActionManager *am = core->actionManager();
|
||||||
|
ProjectExplorerPlugin *pe = ProjectExplorerPlugin::instance();
|
||||||
ProjectExplorer::ProjectExplorerPlugin *pe =
|
|
||||||
ProjectExplorer::ProjectExplorerPlugin::instance();
|
|
||||||
connect(pe->session(), SIGNAL(startupProjectChanged(ProjectExplorer::Project*)),
|
connect(pe->session(), SIGNAL(startupProjectChanged(ProjectExplorer::Project*)),
|
||||||
SLOT(updateUiForProject(ProjectExplorer::Project*)));
|
d, SLOT(updateUiForProject(ProjectExplorer::Project*)));
|
||||||
connect(d->m_resizeEventFilter, SIGNAL(widgetResized()),
|
connect(d->m_resizeEventFilter, SIGNAL(widgetResized()),
|
||||||
SLOT(updateDockWidgetSettings()));
|
SLOT(updateDockWidgetSettings()));
|
||||||
|
|
||||||
@@ -516,7 +532,7 @@ QWidget *DebuggerMainWindow::createContents(IMode *mode)
|
|||||||
setDocumentMode(true);
|
setDocumentMode(true);
|
||||||
setDockNestingEnabled(true);
|
setDockNestingEnabled(true);
|
||||||
connect(this, SIGNAL(resetLayout()),
|
connect(this, SIGNAL(resetLayout()),
|
||||||
SLOT(resetDebuggerLayout()));
|
d, SLOT(resetDebuggerLayout()));
|
||||||
connect(toggleLockedAction(), SIGNAL(triggered()),
|
connect(toggleLockedAction(), SIGNAL(triggered()),
|
||||||
SLOT(updateDockWidgetSettings()));
|
SLOT(updateDockWidgetSettings()));
|
||||||
|
|
||||||
@@ -619,11 +635,11 @@ void DebuggerMainWindow::readSettings()
|
|||||||
DebuggerLanguages langs = d->m_activeDebugLanguages;
|
DebuggerLanguages langs = d->m_activeDebugLanguages;
|
||||||
if (d->m_dockWidgetActiveStateCpp.isEmpty()) {
|
if (d->m_dockWidgetActiveStateCpp.isEmpty()) {
|
||||||
d->m_activeDebugLanguages = CppLanguage;
|
d->m_activeDebugLanguages = CppLanguage;
|
||||||
resetDebuggerLayout();
|
d->resetDebuggerLayout();
|
||||||
}
|
}
|
||||||
if (d->m_dockWidgetActiveStateQmlCpp.isEmpty()) {
|
if (d->m_dockWidgetActiveStateQmlCpp.isEmpty()) {
|
||||||
d->m_activeDebugLanguages = QmlLanguage;
|
d->m_activeDebugLanguages = QmlLanguage;
|
||||||
resetDebuggerLayout();
|
d->resetDebuggerLayout();
|
||||||
}
|
}
|
||||||
d->m_activeDebugLanguages = langs;
|
d->m_activeDebugLanguages = langs;
|
||||||
}
|
}
|
||||||
@@ -631,28 +647,28 @@ void DebuggerMainWindow::readSettings()
|
|||||||
void DebuggerMainWindow::initialize(QSettings *settings)
|
void DebuggerMainWindow::initialize(QSettings *settings)
|
||||||
{
|
{
|
||||||
d->m_settings = settings;
|
d->m_settings = settings;
|
||||||
createViewsMenuItems();
|
d->createViewsMenuItems();
|
||||||
|
|
||||||
emit dockResetRequested(AnyLanguage);
|
emit dockResetRequested(AnyLanguage);
|
||||||
readSettings();
|
readSettings();
|
||||||
|
|
||||||
updateUi();
|
d->updateUi();
|
||||||
|
|
||||||
hideInactiveWidgets();
|
d->hideInactiveWidgets();
|
||||||
setDockActionsVisible(false);
|
setDockActionsVisible(false);
|
||||||
d->m_initialized = true;
|
d->m_initialized = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
void DebuggerMainWindow::resetDebuggerLayout()
|
void DebuggerMainWindowPrivate::resetDebuggerLayout()
|
||||||
{
|
{
|
||||||
emit dockResetRequested(d->m_activeDebugLanguages);
|
emit q->dockResetRequested(m_activeDebugLanguages);
|
||||||
|
|
||||||
if (isQmlActive())
|
if (isQmlActive())
|
||||||
d->m_dockWidgetActiveStateQmlCpp = saveSettings();
|
m_dockWidgetActiveStateQmlCpp = q->saveSettings();
|
||||||
else
|
else
|
||||||
d->m_dockWidgetActiveStateCpp = saveSettings();
|
m_dockWidgetActiveStateCpp = q->saveSettings();
|
||||||
|
|
||||||
updateActiveLanguages();
|
q->updateActiveLanguages();
|
||||||
}
|
}
|
||||||
|
|
||||||
void DebuggerMainWindow::updateDockWidgetSettings()
|
void DebuggerMainWindow::updateDockWidgetSettings()
|
||||||
@@ -660,21 +676,21 @@ void DebuggerMainWindow::updateDockWidgetSettings()
|
|||||||
if (!d->m_inDebugMode || d->m_changingUI)
|
if (!d->m_inDebugMode || d->m_changingUI)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if (isQmlActive())
|
if (d->isQmlActive())
|
||||||
d->m_dockWidgetActiveStateQmlCpp = saveSettings();
|
d->m_dockWidgetActiveStateQmlCpp = saveSettings();
|
||||||
else
|
else
|
||||||
d->m_dockWidgetActiveStateCpp = saveSettings();
|
d->m_dockWidgetActiveStateCpp = saveSettings();
|
||||||
}
|
}
|
||||||
|
|
||||||
bool DebuggerMainWindow::isQmlCppActive() const
|
bool DebuggerMainWindowPrivate::isQmlCppActive() const
|
||||||
{
|
{
|
||||||
return (d->m_activeDebugLanguages & CppLanguage)
|
return (m_activeDebugLanguages & CppLanguage)
|
||||||
&& (d->m_activeDebugLanguages & QmlLanguage);
|
&& (m_activeDebugLanguages & QmlLanguage);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool DebuggerMainWindow::isQmlActive() const
|
bool DebuggerMainWindowPrivate::isQmlActive() const
|
||||||
{
|
{
|
||||||
return (d->m_activeDebugLanguages & QmlLanguage);
|
return (m_activeDebugLanguages & QmlLanguage);
|
||||||
}
|
}
|
||||||
|
|
||||||
QMenu *DebuggerMainWindow::createPopupMenu()
|
QMenu *DebuggerMainWindow::createPopupMenu()
|
||||||
|
|||||||
@@ -49,12 +49,6 @@ class Context;
|
|||||||
class IMode;
|
class IMode;
|
||||||
}
|
}
|
||||||
|
|
||||||
namespace ProjectExplorer {
|
|
||||||
class Project;
|
|
||||||
class Target;
|
|
||||||
class RunConfiguration;
|
|
||||||
}
|
|
||||||
|
|
||||||
namespace Debugger {
|
namespace Debugger {
|
||||||
|
|
||||||
namespace Internal {
|
namespace Internal {
|
||||||
@@ -69,28 +63,28 @@ public:
|
|||||||
DebuggerMainWindow();
|
DebuggerMainWindow();
|
||||||
~DebuggerMainWindow();
|
~DebuggerMainWindow();
|
||||||
|
|
||||||
// debuggable languages are registered with this function.
|
// Debuggable languages are registered with this function.
|
||||||
void addLanguage(const DebuggerLanguage &language, const Core::Context &context);
|
void addLanguage(const DebuggerLanguage &language, const Core::Context &context);
|
||||||
|
|
||||||
// debugger toolbars are registered with this function
|
// Debugger toolbars are registered with this function
|
||||||
void setToolbar(const DebuggerLanguage &language, QWidget *widget);
|
void setToolbar(const DebuggerLanguage &language, QWidget *widget);
|
||||||
|
|
||||||
// menu actions are registered with this function
|
// Menu actions are registered with this function
|
||||||
void addMenuAction(Core::Command *command, const DebuggerLanguage &language,
|
void addMenuAction(Core::Command *command, const DebuggerLanguage &language,
|
||||||
const QString &group = QString());
|
const QString &group = QString());
|
||||||
|
|
||||||
// all supported languages
|
// All supported languages
|
||||||
DebuggerLanguages supportedLanguages() const;
|
DebuggerLanguages supportedLanguages() const;
|
||||||
|
|
||||||
// active languages to be debugged.
|
// Active languages to be debugged.
|
||||||
DebuggerLanguages activeDebugLanguages() const;
|
DebuggerLanguages activeDebugLanguages() const;
|
||||||
|
|
||||||
// called when all dependent plugins have loaded
|
// Called when all dependent plugins have loaded
|
||||||
void initialize(QSettings *settings);
|
void initialize(QSettings *settings);
|
||||||
|
|
||||||
void onModeChanged(Core::IMode *mode);
|
void onModeChanged(Core::IMode *mode);
|
||||||
|
|
||||||
// most common debugger windows
|
// Most common debugger windows
|
||||||
QDockWidget *breakWindow() const;
|
QDockWidget *breakWindow() const;
|
||||||
QDockWidget *stackWindow() const;
|
QDockWidget *stackWindow() const;
|
||||||
QDockWidget *watchWindow() const;
|
QDockWidget *watchWindow() const;
|
||||||
@@ -101,7 +95,7 @@ public:
|
|||||||
|
|
||||||
QDockWidget *dockWidget(const QString &objectName) const;
|
QDockWidget *dockWidget(const QString &objectName) const;
|
||||||
|
|
||||||
// dockwidgets are registered to the main window
|
// Dockwidgets are registered to the main window.
|
||||||
QDockWidget *createDockWidget(const DebuggerLanguage &language, QWidget *widget,
|
QDockWidget *createDockWidget(const DebuggerLanguage &language, QWidget *widget,
|
||||||
Qt::DockWidgetArea area = Qt::TopDockWidgetArea);
|
Qt::DockWidgetArea area = Qt::TopDockWidgetArea);
|
||||||
|
|
||||||
@@ -109,22 +103,12 @@ public:
|
|||||||
QMenu *createPopupMenu();
|
QMenu *createPopupMenu();
|
||||||
|
|
||||||
signals:
|
signals:
|
||||||
// emit when user changes active languages from the menu.
|
// Emit when user changes active languages from the menu.
|
||||||
// Both UI and debugger startup are affected.
|
// Both UI and debugger startup are affected.
|
||||||
void activeLanguagesChanged(Debugger::DebuggerLanguages activeLanguages);
|
void activeLanguagesChanged(Debugger::DebuggerLanguages activeLanguages);
|
||||||
void dockResetRequested(Debugger::DebuggerLanguages activeLanguages);
|
void dockResetRequested(Debugger::DebuggerLanguages activeLanguages);
|
||||||
void memoryEditorRequested();
|
void memoryEditorRequested();
|
||||||
|
|
||||||
private slots:
|
|
||||||
void updateUi();
|
|
||||||
void resetDebuggerLayout();
|
|
||||||
|
|
||||||
void updateUiForProject(ProjectExplorer::Project *project);
|
|
||||||
void updateUiForTarget(ProjectExplorer::Target *target);
|
|
||||||
void updateUiForRunConfiguration(ProjectExplorer::RunConfiguration *rc);
|
|
||||||
void updateUiForCurrentRunConfiguration();
|
|
||||||
void updateUiOnFileListChange();
|
|
||||||
|
|
||||||
public slots:
|
public slots:
|
||||||
void updateActiveLanguages();
|
void updateActiveLanguages();
|
||||||
void updateDockWidgetSettings();
|
void updateDockWidgetSettings();
|
||||||
@@ -132,14 +116,7 @@ public slots:
|
|||||||
void writeSettings() const;
|
void writeSettings() const;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
void activateQmlCppLayout();
|
friend class Internal::DebuggerMainWindowPrivate;
|
||||||
void activateCppLayout();
|
|
||||||
|
|
||||||
void hideInactiveWidgets();
|
|
||||||
void createViewsMenuItems();
|
|
||||||
bool isQmlCppActive() const;
|
|
||||||
bool isQmlActive() const;
|
|
||||||
|
|
||||||
Internal::DebuggerMainWindowPrivate *d;
|
Internal::DebuggerMainWindowPrivate *d;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user