diff --git a/src/plugins/debugger/analyzer/analyzermanager.cpp b/src/plugins/debugger/analyzer/analyzermanager.cpp index 78db052eb3f..15ab6253cd6 100644 --- a/src/plugins/debugger/analyzer/analyzermanager.cpp +++ b/src/plugins/debugger/analyzer/analyzermanager.cpp @@ -646,21 +646,23 @@ void AnalyzerManager::registerToolbar(Id toolbarId, QWidget *widget) d->m_mainWindow->registerToolbar(toolbarId, widget); } -Perspective::Split::Split(Id dockId, Id existing, Perspective::SplitType splitType, bool visibleByDefault, Qt::DockWidgetArea area) - : dockId(dockId), existing(existing), splitType(splitType), visibleByDefault(visibleByDefault), area(area) +Perspective::Operation::Operation(Id dockId, Id existing, Perspective::OperationType operationType, + bool visibleByDefault, Qt::DockWidgetArea area) + : dockId(dockId), existing(existing), operationType(operationType), + visibleByDefault(visibleByDefault), area(area) {} -Perspective::Perspective(std::initializer_list splits) - : m_splits(splits) +Perspective::Perspective(std::initializer_list operations) + : m_operations(operations) { - for (const Split &split : splits) - m_docks.append(split.dockId); + for (const Operation &operation : operations) + m_docks.append(operation.dockId); } -void Perspective::addSplit(const Split &split) +void Perspective::addOperation(const Operation &operation) { - m_docks.append(split.dockId); - m_splits.append(split); + m_docks.append(operation.dockId); + m_operations.append(operation); } void AnalyzerManager::registerPerspective(Id perspectiveId, const Perspective &perspective) diff --git a/src/plugins/debugger/debuggermainwindow.cpp b/src/plugins/debugger/debuggermainwindow.cpp index 7773921122a..dbcfe449ae8 100644 --- a/src/plugins/debugger/debuggermainwindow.cpp +++ b/src/plugins/debugger/debuggermainwindow.cpp @@ -100,16 +100,20 @@ void MainWindowBase::loadPerspectiveHelper(Id perspectiveId, bool fromStoredSett m_currentPerspectiveId = perspectiveId; QTC_ASSERT(m_perspectiveForPerspectiveId.contains(perspectiveId), return); - const auto splits = m_perspectiveForPerspectiveId.value(perspectiveId).splits(); - for (const Perspective::Split &split : splits) { - QDockWidget *dock = m_dockForDockId.value(split.dockId); + const auto operations = m_perspectiveForPerspectiveId.value(perspectiveId).operations(); + for (const Perspective::Operation &operation : operations) { + QDockWidget *dock = m_dockForDockId.value(operation.dockId); QTC_ASSERT(dock, continue); - addDockWidget(split.area, dock); - QDockWidget *existing = m_dockForDockId.value(split.existing); - if (!existing && split.area == Qt::BottomDockWidgetArea) + if (operation.operationType == Perspective::Raise) { + dock->raise(); + continue; + } + addDockWidget(operation.area, dock); + QDockWidget *existing = m_dockForDockId.value(operation.existing); + if (!existing && operation.area == Qt::BottomDockWidgetArea) existing = toolBarDockWidget(); if (existing) { - switch (split.splitType) { + switch (operation.operationType) { case Perspective::AddToTab: tabifyDockWidget(existing, dock); break; @@ -119,9 +123,11 @@ void MainWindowBase::loadPerspectiveHelper(Id perspectiveId, bool fromStoredSett case Perspective::SplitVertical: splitDockWidget(existing, dock, Qt::Vertical); break; + default: + break; } } - if (!split.visibleByDefault) + if (!operation.visibleByDefault) dock->hide(); else dock->show(); diff --git a/src/plugins/debugger/debuggermainwindow.h b/src/plugins/debugger/debuggermainwindow.h index 0791e0600c0..3f12344c84a 100644 --- a/src/plugins/debugger/debuggermainwindow.h +++ b/src/plugins/debugger/debuggermainwindow.h @@ -50,34 +50,34 @@ namespace Analyzer { class ANALYZER_EXPORT Perspective { public: - enum SplitType { SplitVertical, SplitHorizontal, AddToTab }; + enum OperationType { SplitVertical, SplitHorizontal, AddToTab, Raise }; - class ANALYZER_EXPORT Split + class ANALYZER_EXPORT Operation { public: - Split() = default; - Split(Core::Id dockId, Core::Id existing, SplitType splitType, + Operation() = default; + Operation(Core::Id dockId, Core::Id existing, OperationType operationType, bool visibleByDefault = true, Qt::DockWidgetArea area = Qt::BottomDockWidgetArea); Core::Id dockId; Core::Id existing; - SplitType splitType; + OperationType operationType; bool visibleByDefault; Qt::DockWidgetArea area; }; Perspective() = default; - Perspective(std::initializer_list splits); + Perspective(std::initializer_list operations); - void addSplit(const Split &split); + void addOperation(const Operation &operation); - QVector splits() const { return m_splits; } + QVector operations() const { return m_operations; } QVector docks() const { return m_docks; } private: QVector m_docks; - QVector m_splits; + QVector m_operations; }; } // Analyzer diff --git a/src/plugins/qmlprofiler/qmlprofilerviewmanager.cpp b/src/plugins/qmlprofiler/qmlprofilerviewmanager.cpp index 76cbba53fc3..9655734d9d2 100644 --- a/src/plugins/qmlprofiler/qmlprofilerviewmanager.cpp +++ b/src/plugins/qmlprofiler/qmlprofilerviewmanager.cpp @@ -95,8 +95,8 @@ void QmlProfilerViewManager::createViews() new QmlProfilerStateWidget(d->profilerState, d->profilerModelManager, d->traceView); Perspective perspective; - perspective.addSplit({Constants::QmlProfilerTimelineDockId, Core::Id(), - Perspective::SplitVertical}); + perspective.addOperation({Constants::QmlProfilerTimelineDockId, Core::Id(), + Perspective::SplitVertical}); d->eventsViews << new QmlProfilerStatisticsView(0, d->profilerModelManager); if (d->eventsViewFactory) @@ -120,7 +120,7 @@ void QmlProfilerViewManager::createViews() this, [this](){restrictEventsToRange(-1, -1);}); Core::Id dockId = Core::Id::fromString(view->objectName()); AnalyzerManager::registerDockWidget(dockId, view); - perspective.addSplit({dockId, Constants::QmlProfilerTimelineDockId, Perspective::AddToTab}); + perspective.addOperation({dockId, Constants::QmlProfilerTimelineDockId, Perspective::AddToTab}); new QmlProfilerStateWidget(d->profilerState, d->profilerModelManager, view); if (!settings->contains(view->parent()->objectName())) // parent() is QDockWidget.