aboutsummaryrefslogtreecommitdiffstats
path: root/src/plugins/debugger/debuggermainwindow.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/plugins/debugger/debuggermainwindow.cpp')
-rw-r--r--src/plugins/debugger/debuggermainwindow.cpp36
1 files changed, 28 insertions, 8 deletions
diff --git a/src/plugins/debugger/debuggermainwindow.cpp b/src/plugins/debugger/debuggermainwindow.cpp
index 1c404a22b2..fd9d0e52f5 100644
--- a/src/plugins/debugger/debuggermainwindow.cpp
+++ b/src/plugins/debugger/debuggermainwindow.cpp
@@ -89,7 +89,7 @@ public:
bool changedByUser() const;
void recordVisibility();
- Core::Id commandId;
+ Utils::Id commandId;
QPointer<QWidget> widget;
QPointer<QDockWidget> dock;
QPointer<QWidget> anchorWidget;
@@ -158,6 +158,7 @@ public:
DebuggerMainWindow *q = nullptr;
QPointer<Perspective> m_currentPerspective = nullptr;
QComboBox *m_perspectiveChooser = nullptr;
+ QMenu *m_perspectiveMenu;
QStackedWidget *m_centralWidgetStack = nullptr;
QHBoxLayout *m_subPerspectiveSwitcherLayout = nullptr;
QHBoxLayout *m_innerToolsLayout = nullptr;
@@ -186,8 +187,7 @@ DebuggerMainWindowPrivate::DebuggerMainWindowPrivate(DebuggerMainWindow *parent)
m_perspectiveChooser->setObjectName("PerspectiveChooser");
m_perspectiveChooser->setProperty("panelwidget", true);
m_perspectiveChooser->setSizeAdjustPolicy(QComboBox::AdjustToContents);
- connect(m_perspectiveChooser, QOverload<int>::of(&QComboBox::activated),
- this, [this](int item) {
+ connect(m_perspectiveChooser, QOverload<int>::of(&QComboBox::activated), this, [this](int item) {
Perspective *perspective = Perspective::findPerspective(m_perspectiveChooser->itemData(item).toString());
QTC_ASSERT(perspective, return);
if (auto subPerspective = Perspective::findPerspective(perspective->d->m_lastActiveSubPerspectiveId))
@@ -196,6 +196,20 @@ DebuggerMainWindowPrivate::DebuggerMainWindowPrivate(DebuggerMainWindow *parent)
perspective->select();
});
+ m_perspectiveMenu = new QMenu;
+ connect(m_perspectiveMenu, &QMenu::aboutToShow, this, [this] {
+ m_perspectiveMenu->clear();
+ for (Perspective *perspective : qAsConst(m_perspectives)) {
+ m_perspectiveMenu->addAction(perspective->d->m_name, perspective, [perspective] {
+ if (auto subPerspective = Perspective::findPerspective(
+ perspective->d->m_lastActiveSubPerspectiveId))
+ subPerspective->select();
+ else
+ perspective->select();
+ });
+ }
+ });
+
auto viewButton = new QToolButton;
viewButton->setText(DebuggerMainWindow::tr("&Views"));
@@ -250,8 +264,8 @@ DebuggerMainWindowPrivate::DebuggerMainWindowPrivate(DebuggerMainWindow *parent)
m_toolBarDock = dock;
q->addDockWidget(Qt::BottomDockWidgetArea, m_toolBarDock);
- connect(viewButton, &QAbstractButton::clicked, this, [this, viewButton] {
- ActionContainer *viewsMenu = ActionManager::actionContainer(Core::Constants::M_WINDOW_VIEWS);
+ connect(viewButton, &QAbstractButton::clicked, this, [viewButton] {
+ ActionContainer *viewsMenu = ActionManager::actionContainer(Core::Constants::M_VIEW_VIEWS);
viewsMenu->menu()->exec(viewButton->mapToGlobal(QPoint()));
});
@@ -263,6 +277,7 @@ DebuggerMainWindowPrivate::DebuggerMainWindowPrivate(DebuggerMainWindow *parent)
DebuggerMainWindowPrivate::~DebuggerMainWindowPrivate()
{
delete m_editorPlaceHolder;
+ delete m_perspectiveMenu;
}
DebuggerMainWindow::DebuggerMainWindow()
@@ -277,7 +292,7 @@ DebuggerMainWindow::DebuggerMainWindow()
Context debugcontext(Debugger::Constants::C_DEBUGMODE);
- ActionContainer *viewsMenu = ActionManager::actionContainer(Core::Constants::M_WINDOW_VIEWS);
+ ActionContainer *viewsMenu = ActionManager::actionContainer(Core::Constants::M_VIEW_VIEWS);
Command *cmd = ActionManager::registerAction(showCentralWidgetAction(),
"Debugger.Views.ShowCentralWidget", debugcontext);
cmd->setAttribute(Command::CA_Hide);
@@ -315,7 +330,7 @@ DebuggerMainWindow::~DebuggerMainWindow()
void DebuggerMainWindow::contextMenuEvent(QContextMenuEvent *ev)
{
- ActionContainer *viewsMenu = ActionManager::actionContainer(Core::Constants::M_WINDOW_VIEWS);
+ ActionContainer *viewsMenu = ActionManager::actionContainer(Core::Constants::M_VIEW_VIEWS);
viewsMenu->menu()->exec(ev->globalPos());
}
@@ -511,6 +526,11 @@ void DebuggerMainWindow::addSubPerspectiveSwitcher(QWidget *widget)
d->m_subPerspectiveSwitcherLayout->addWidget(widget);
}
+QMenu *DebuggerMainWindow::perspectiveMenu()
+{
+ return theMainWindow ? theMainWindow->d->m_perspectiveMenu : nullptr;
+}
+
DebuggerMainWindow *DebuggerMainWindow::instance()
{
return theMainWindow;
@@ -896,7 +916,7 @@ void Perspective::addWindow(QWidget *widget,
Command *cmd = ActionManager::registerAction(op.toggleViewAction, op.commandId, d->context());
cmd->setAttribute(Command::CA_Hide);
- ActionManager::actionContainer(Core::Constants::M_WINDOW_VIEWS)->addAction(cmd);
+ ActionManager::actionContainer(Core::Constants::M_VIEW_VIEWS)->addAction(cmd);
}
d->m_dockOperations.append(op);