forked from qt-creator/qt-creator
Debugger: Move some debugger specific bits out of debuggermainwindow.*
A step towards making the perspective handling independent of the debugger plugin. Change-Id: Ic07f4b34d44c48f16a494ba7f470e0a34d3d56a3 Reviewed-by: David Schulz <david.schulz@qt.io>
This commit is contained in:
@@ -32,10 +32,8 @@
|
|||||||
#include <coreplugin/actionmanager/command.h>
|
#include <coreplugin/actionmanager/command.h>
|
||||||
#include <coreplugin/coreconstants.h>
|
#include <coreplugin/coreconstants.h>
|
||||||
#include <coreplugin/editormanager/editormanager.h>
|
#include <coreplugin/editormanager/editormanager.h>
|
||||||
#include <coreplugin/findplaceholder.h>
|
|
||||||
#include <coreplugin/icore.h>
|
#include <coreplugin/icore.h>
|
||||||
#include <coreplugin/modemanager.h>
|
#include <coreplugin/modemanager.h>
|
||||||
#include <coreplugin/navigationwidget.h>
|
|
||||||
#include <coreplugin/outputpane.h>
|
#include <coreplugin/outputpane.h>
|
||||||
#include <coreplugin/rightpane.h>
|
#include <coreplugin/rightpane.h>
|
||||||
|
|
||||||
@@ -400,58 +398,6 @@ void DebuggerMainWindowPrivate::selectPerspective(Perspective *perspective)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
QWidget *createModeWindow(const Core::Id &mode, QWidget *switcher)
|
|
||||||
{
|
|
||||||
theMainWindow->setSubPerspectiveSwitcher(switcher);
|
|
||||||
|
|
||||||
auto editorHolderLayout = new QVBoxLayout;
|
|
||||||
editorHolderLayout->setMargin(0);
|
|
||||||
editorHolderLayout->setSpacing(0);
|
|
||||||
|
|
||||||
auto editorAndFindWidget = new QWidget;
|
|
||||||
editorAndFindWidget->setLayout(editorHolderLayout);
|
|
||||||
editorHolderLayout->addWidget(theMainWindow->centralWidgetStack());
|
|
||||||
editorHolderLayout->addWidget(new FindToolBarPlaceHolder(editorAndFindWidget));
|
|
||||||
|
|
||||||
auto documentAndRightPane = new MiniSplitter;
|
|
||||||
documentAndRightPane->addWidget(editorAndFindWidget);
|
|
||||||
documentAndRightPane->addWidget(new RightPanePlaceHolder(mode));
|
|
||||||
documentAndRightPane->setStretchFactor(0, 1);
|
|
||||||
documentAndRightPane->setStretchFactor(1, 0);
|
|
||||||
|
|
||||||
auto centralEditorWidget = new QWidget;
|
|
||||||
auto centralLayout = new QVBoxLayout(centralEditorWidget);
|
|
||||||
centralEditorWidget->setLayout(centralLayout);
|
|
||||||
centralLayout->setMargin(0);
|
|
||||||
centralLayout->setSpacing(0);
|
|
||||||
centralLayout->addWidget(documentAndRightPane);
|
|
||||||
centralLayout->setStretch(0, 1);
|
|
||||||
centralLayout->setStretch(1, 0);
|
|
||||||
|
|
||||||
// Right-side window with editor, output etc.
|
|
||||||
auto mainWindowSplitter = new MiniSplitter;
|
|
||||||
mainWindowSplitter->addWidget(theMainWindow);
|
|
||||||
mainWindowSplitter->addWidget(new OutputPanePlaceHolder(mode, mainWindowSplitter));
|
|
||||||
auto outputPane = new OutputPanePlaceHolder(mode, mainWindowSplitter);
|
|
||||||
outputPane->setObjectName(QLatin1String("DebuggerOutputPanePlaceHolder"));
|
|
||||||
mainWindowSplitter->addWidget(outputPane);
|
|
||||||
mainWindowSplitter->setStretchFactor(0, 10);
|
|
||||||
mainWindowSplitter->setStretchFactor(1, 0);
|
|
||||||
mainWindowSplitter->setOrientation(Qt::Vertical);
|
|
||||||
|
|
||||||
// Navigation and right-side window.
|
|
||||||
auto splitter = new MiniSplitter;
|
|
||||||
splitter->setFocusProxy(theMainWindow->centralWidgetStack());
|
|
||||||
splitter->addWidget(new NavigationWidgetPlaceHolder(mode, Side::Left));
|
|
||||||
splitter->addWidget(mainWindowSplitter);
|
|
||||||
splitter->setStretchFactor(0, 0);
|
|
||||||
splitter->setStretchFactor(1, 1);
|
|
||||||
splitter->setObjectName(QLatin1String("DebugModeWidget"));
|
|
||||||
theMainWindow->setCentralWidget(centralEditorWidget);
|
|
||||||
|
|
||||||
return splitter;
|
|
||||||
}
|
|
||||||
|
|
||||||
void DebuggerMainWindowPrivate::depopulateCurrentPerspective()
|
void DebuggerMainWindowPrivate::depopulateCurrentPerspective()
|
||||||
{
|
{
|
||||||
// Clean up old perspective.
|
// Clean up old perspective.
|
||||||
|
|||||||
@@ -140,6 +140,4 @@ private:
|
|||||||
class DebuggerMainWindowPrivate *d = nullptr;
|
class DebuggerMainWindowPrivate *d = nullptr;
|
||||||
};
|
};
|
||||||
|
|
||||||
DEBUGGER_EXPORT QWidget *createModeWindow(const Core::Id &mode, QWidget *);
|
|
||||||
|
|
||||||
} // Utils
|
} // Utils
|
||||||
|
|||||||
@@ -72,6 +72,7 @@
|
|||||||
#include <coreplugin/editormanager/documentmodel.h>
|
#include <coreplugin/editormanager/documentmodel.h>
|
||||||
#include <coreplugin/editormanager/editormanager.h>
|
#include <coreplugin/editormanager/editormanager.h>
|
||||||
#include <coreplugin/find/itemviewfind.h>
|
#include <coreplugin/find/itemviewfind.h>
|
||||||
|
#include <coreplugin/findplaceholder.h>
|
||||||
#include <coreplugin/icore.h>
|
#include <coreplugin/icore.h>
|
||||||
#include <coreplugin/imode.h>
|
#include <coreplugin/imode.h>
|
||||||
#include <coreplugin/messagebox.h>
|
#include <coreplugin/messagebox.h>
|
||||||
@@ -472,7 +473,60 @@ public:
|
|||||||
Icons::MODE_DEBUGGER_FLAT, Icons::MODE_DEBUGGER_FLAT_ACTIVE));
|
Icons::MODE_DEBUGGER_FLAT, Icons::MODE_DEBUGGER_FLAT_ACTIVE));
|
||||||
setPriority(85);
|
setPriority(85);
|
||||||
setId(MODE_DEBUG);
|
setId(MODE_DEBUG);
|
||||||
|
|
||||||
|
DebuggerMainWindow *mainWindow = DebuggerMainWindow::instance();
|
||||||
|
|
||||||
|
auto editorHolderLayout = new QVBoxLayout;
|
||||||
|
editorHolderLayout->setMargin(0);
|
||||||
|
editorHolderLayout->setSpacing(0);
|
||||||
|
|
||||||
|
auto editorAndFindWidget = new QWidget;
|
||||||
|
editorAndFindWidget->setLayout(editorHolderLayout);
|
||||||
|
editorHolderLayout->addWidget(mainWindow->centralWidgetStack());
|
||||||
|
editorHolderLayout->addWidget(new FindToolBarPlaceHolder(editorAndFindWidget));
|
||||||
|
|
||||||
|
auto documentAndRightPane = new MiniSplitter;
|
||||||
|
documentAndRightPane->addWidget(editorAndFindWidget);
|
||||||
|
documentAndRightPane->addWidget(new RightPanePlaceHolder(MODE_DEBUG));
|
||||||
|
documentAndRightPane->setStretchFactor(0, 1);
|
||||||
|
documentAndRightPane->setStretchFactor(1, 0);
|
||||||
|
|
||||||
|
auto centralEditorWidget = new QWidget;
|
||||||
|
auto centralLayout = new QVBoxLayout(centralEditorWidget);
|
||||||
|
centralEditorWidget->setLayout(centralLayout);
|
||||||
|
centralLayout->setMargin(0);
|
||||||
|
centralLayout->setSpacing(0);
|
||||||
|
centralLayout->addWidget(documentAndRightPane);
|
||||||
|
centralLayout->setStretch(0, 1);
|
||||||
|
centralLayout->setStretch(1, 0);
|
||||||
|
|
||||||
|
// Right-side window with editor, output etc.
|
||||||
|
auto mainWindowSplitter = new MiniSplitter;
|
||||||
|
mainWindowSplitter->addWidget(mainWindow);
|
||||||
|
mainWindowSplitter->addWidget(new OutputPanePlaceHolder(MODE_DEBUG, mainWindowSplitter));
|
||||||
|
auto outputPane = new OutputPanePlaceHolder(MODE_DEBUG, mainWindowSplitter);
|
||||||
|
outputPane->setObjectName(QLatin1String("DebuggerOutputPanePlaceHolder"));
|
||||||
|
mainWindowSplitter->addWidget(outputPane);
|
||||||
|
mainWindowSplitter->setStretchFactor(0, 10);
|
||||||
|
mainWindowSplitter->setStretchFactor(1, 0);
|
||||||
|
mainWindowSplitter->setOrientation(Qt::Vertical);
|
||||||
|
|
||||||
|
// Navigation and right-side window.
|
||||||
|
auto splitter = new MiniSplitter;
|
||||||
|
splitter->setFocusProxy(mainWindow->centralWidgetStack());
|
||||||
|
splitter->addWidget(new NavigationWidgetPlaceHolder(MODE_DEBUG, Side::Left));
|
||||||
|
splitter->addWidget(mainWindowSplitter);
|
||||||
|
splitter->setStretchFactor(0, 0);
|
||||||
|
splitter->setStretchFactor(1, 1);
|
||||||
|
splitter->setObjectName(QLatin1String("DebugModeWidget"));
|
||||||
|
|
||||||
|
mainWindow->setCentralWidget(centralEditorWidget);
|
||||||
|
mainWindow->setSubPerspectiveSwitcher(EngineManager::engineChooser());
|
||||||
|
|
||||||
|
setWidget(splitter);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
~DebugMode() { delete widget(); }
|
||||||
};
|
};
|
||||||
|
|
||||||
///////////////////////////////////////////////////////////////////////
|
///////////////////////////////////////////////////////////////////////
|
||||||
@@ -686,7 +740,6 @@ public:
|
|||||||
void updatePresetState();
|
void updatePresetState();
|
||||||
|
|
||||||
public:
|
public:
|
||||||
QPointer<QWidget> m_modeWindow;
|
|
||||||
QPointer<DebugMode> m_mode;
|
QPointer<DebugMode> m_mode;
|
||||||
|
|
||||||
ActionContainer *m_menu = nullptr;
|
ActionContainer *m_menu = nullptr;
|
||||||
@@ -1296,11 +1349,9 @@ bool DebuggerPluginPrivate::initialize(const QStringList &arguments,
|
|||||||
|
|
||||||
// Debug mode setup
|
// Debug mode setup
|
||||||
m_mode = new DebugMode;
|
m_mode = new DebugMode;
|
||||||
m_modeWindow = createModeWindow(Constants::MODE_DEBUG, EngineManager::engineChooser());
|
|
||||||
m_mode->setWidget(m_modeWindow);
|
|
||||||
|
|
||||||
m_debugModeContext.setContext(Context(CC::C_EDITORMANAGER));
|
m_debugModeContext.setContext(Context(CC::C_EDITORMANAGER));
|
||||||
m_debugModeContext.setWidget(m_modeWindow);
|
m_debugModeContext.setWidget(m_mode->widget());
|
||||||
ICore::addContextObject(&m_debugModeContext);
|
ICore::addContextObject(&m_debugModeContext);
|
||||||
|
|
||||||
//
|
//
|
||||||
@@ -2243,9 +2294,6 @@ void DebuggerPluginPrivate::doShutdown()
|
|||||||
|
|
||||||
m_shutdownTimer.stop();
|
m_shutdownTimer.stop();
|
||||||
|
|
||||||
delete m_modeWindow;
|
|
||||||
m_modeWindow = nullptr;
|
|
||||||
|
|
||||||
delete m_mode;
|
delete m_mode;
|
||||||
m_mode = nullptr;
|
m_mode = nullptr;
|
||||||
emit m_plugin->asynchronousShutdownFinished();
|
emit m_plugin->asynchronousShutdownFinished();
|
||||||
|
|||||||
Reference in New Issue
Block a user