Debugger: Let perspectives specify their central widget

The default 0 value will be interpreted as 'use the editor stack'.

Also, drop the idea of value semantics for Perspective objects
to get a simpler approach to the destruction of owned widgets
(tools docks + central widget)

Change-Id: Ic6470411ee5d387c43447f95b5a12c81c6658ff8
Reviewed-by: Eike Ziller <eike.ziller@qt.io>
This commit is contained in:
hjk
2016-05-12 11:57:29 +02:00
parent 602d899e0f
commit df8e3b5925
8 changed files with 68 additions and 49 deletions

View File

@@ -1756,7 +1756,7 @@ bool DebuggerPluginPrivate::initialize(const QStringList &arguments,
// Debug mode setup
m_mode = new DebugMode;
m_modeWindow = createModeWindow(Constants::MODE_DEBUG, m_mainWindow, 0);
m_modeWindow = createModeWindow(Constants::MODE_DEBUG, m_mainWindow);
m_mode->setWidget(m_modeWindow);
m_plugin->addAutoReleasedObject(new DebugModeContext(m_mainWindow));
@@ -1835,7 +1835,7 @@ bool DebuggerPluginPrivate::initialize(const QStringList &arguments,
// qmlToolbar.addAction(qmlSelectDummyAction, Icons::SELECT_TOOLBAR.icon());
// qmlToolbar.addWidget(new StyledSeparator);
Perspective basePerspective({}, {
auto createBasePerspective = [this] { return new Perspective({}, {
{ DOCKWIDGET_STACK, m_stackWindow, {}, Perspective::SplitVertical },
{ DOCKWIDGET_BREAK, m_breakWindow, DOCKWIDGET_STACK, Perspective::SplitHorizontal },
{ DOCKWIDGET_THREADS, m_threadsWindow, DOCKWIDGET_BREAK, Perspective::AddToTab, false },
@@ -1846,19 +1846,19 @@ bool DebuggerPluginPrivate::initialize(const QStringList &arguments,
Qt::RightDockWidgetArea },
{ DOCKWIDGET_OUTPUT, m_logWindow, {}, Perspective::AddToTab, false, Qt::TopDockWidgetArea },
{ DOCKWIDGET_BREAK, 0, {}, Perspective::Raise }
});
}); };
Perspective cppPerspective = basePerspective;
cppPerspective.setName(tr("Debugger"));
cppPerspective.addOperation({ DOCKWIDGET_REGISTER, m_registerWindow, DOCKWIDGET_SNAPSHOTS,
Perspective *cppPerspective = createBasePerspective();
cppPerspective->setName(tr("Debugger"));
cppPerspective->addOperation({ DOCKWIDGET_REGISTER, m_registerWindow, DOCKWIDGET_SNAPSHOTS,
Perspective::AddToTab, false });
Debugger::registerToolbar(CppPerspectiveId, toolbar);
Debugger::registerPerspective(CppPerspectiveId, cppPerspective);
// Perspective qmlPerspective = basePerspective;
// qmlPerspective.setName(tr("QML Debugger"));
// qmlPerspective.addOperation({ DOCKWIDGET_REGISTER, DOCKWIDGET_SNAPSHOTS,
// Perspective *qmlPerspective = createBasePerspective();
// qmlPerspective->setName(tr("QML Debugger"));
// qmlPerspective->addOperation({ DOCKWIDGET_REGISTER, DOCKWIDGET_SNAPSHOTS,
// Perspective::AddToTab, false });
//
// Debugger::registerToolbar(QmlPerspectiveId, toolbarContainer);
@@ -3582,7 +3582,7 @@ QAction *createStopAction()
return action;
}
void registerPerspective(const QByteArray &perspectiveId, const Perspective &perspective)
void registerPerspective(const QByteArray &perspectiveId, const Perspective *perspective)
{
dd->m_mainWindow->registerPerspective(perspectiveId, perspective);
}