2016-02-29 18:15:36 +01:00
|
|
|
/****************************************************************************
|
|
|
|
|
**
|
|
|
|
|
** Copyright (C) 2016 The Qt Company Ltd.
|
|
|
|
|
** Contact: https://www.qt.io/licensing/
|
|
|
|
|
**
|
|
|
|
|
** This file is part of Qt Creator.
|
|
|
|
|
**
|
|
|
|
|
** Commercial License Usage
|
|
|
|
|
** Licensees holding valid commercial Qt licenses may use this file in
|
|
|
|
|
** accordance with the commercial license agreement provided with the
|
|
|
|
|
** Software or, alternatively, in accordance with the terms contained in
|
|
|
|
|
** a written agreement between you and The Qt Company. For licensing terms
|
|
|
|
|
** and conditions see https://www.qt.io/terms-conditions. For further
|
|
|
|
|
** information use the contact form at https://www.qt.io/contact-us.
|
|
|
|
|
**
|
|
|
|
|
** GNU General Public License Usage
|
|
|
|
|
** Alternatively, this file may be used under the terms of the GNU
|
|
|
|
|
** General Public License version 3 as published by the Free Software
|
|
|
|
|
** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT
|
|
|
|
|
** included in the packaging of this file. Please review the following
|
|
|
|
|
** information to ensure the GNU General Public License requirements will
|
|
|
|
|
** be met: https://www.gnu.org/licenses/gpl-3.0.html.
|
|
|
|
|
**
|
|
|
|
|
****************************************************************************/
|
|
|
|
|
|
|
|
|
|
#include "debuggermainwindow.h"
|
2016-03-02 13:57:37 +01:00
|
|
|
#include "debuggerconstants.h"
|
|
|
|
|
#include "debuggerinternalconstants.h"
|
2018-12-08 00:01:42 -08:00
|
|
|
#include "enginemanager.h"
|
2016-02-29 18:15:36 +01:00
|
|
|
|
2016-03-02 13:57:37 +01:00
|
|
|
#include <coreplugin/actionmanager/actioncontainer.h>
|
|
|
|
|
#include <coreplugin/actionmanager/actionmanager.h>
|
|
|
|
|
#include <coreplugin/actionmanager/command.h>
|
|
|
|
|
#include <coreplugin/coreconstants.h>
|
2016-03-10 08:53:49 +01:00
|
|
|
#include <coreplugin/editormanager/editormanager.h>
|
2016-02-29 18:15:36 +01:00
|
|
|
#include <coreplugin/icore.h>
|
2018-03-06 08:35:17 +01:00
|
|
|
#include <coreplugin/modemanager.h>
|
2016-03-10 08:53:49 +01:00
|
|
|
#include <coreplugin/outputpane.h>
|
|
|
|
|
#include <coreplugin/rightpane.h>
|
2016-02-29 18:15:36 +01:00
|
|
|
|
2016-03-02 13:57:37 +01:00
|
|
|
#include <projectexplorer/projectexplorericons.h>
|
|
|
|
|
|
2018-08-01 17:33:41 +02:00
|
|
|
#include <utils/algorithm.h>
|
2016-03-02 13:57:37 +01:00
|
|
|
#include <utils/styledbar.h>
|
2016-02-29 18:15:36 +01:00
|
|
|
#include <utils/qtcassert.h>
|
2016-04-24 22:51:24 +02:00
|
|
|
#include <utils/proxyaction.h>
|
2018-03-06 08:35:17 +01:00
|
|
|
#include <utils/utilsicons.h>
|
2019-02-19 14:56:41 +01:00
|
|
|
#include <utils/stylehelper.h>
|
2016-02-29 18:15:36 +01:00
|
|
|
|
2016-03-02 13:57:37 +01:00
|
|
|
#include <QAction>
|
2016-02-29 18:15:36 +01:00
|
|
|
#include <QComboBox>
|
2019-03-22 07:35:48 +01:00
|
|
|
#include <QContextMenuEvent>
|
2016-02-29 18:15:36 +01:00
|
|
|
#include <QDockWidget>
|
2016-03-02 13:57:37 +01:00
|
|
|
#include <QHBoxLayout>
|
2019-12-09 15:12:55 +01:00
|
|
|
#include <QHeaderView>
|
2019-03-22 07:35:48 +01:00
|
|
|
#include <QLoggingCategory>
|
2016-03-02 13:57:37 +01:00
|
|
|
#include <QMenu>
|
2019-02-19 14:56:41 +01:00
|
|
|
#include <QScrollArea>
|
2016-02-29 18:15:36 +01:00
|
|
|
#include <QStackedWidget>
|
2017-07-11 15:57:45 +02:00
|
|
|
#include <QStandardItemModel>
|
2017-10-26 16:32:48 +02:00
|
|
|
#include <QTimer>
|
2016-03-02 13:57:37 +01:00
|
|
|
#include <QToolButton>
|
2019-12-09 15:12:55 +01:00
|
|
|
#include <QTreeView>
|
2016-02-29 18:15:36 +01:00
|
|
|
|
2016-03-02 13:57:37 +01:00
|
|
|
using namespace Debugger;
|
2016-02-29 18:15:36 +01:00
|
|
|
using namespace Core;
|
|
|
|
|
|
2020-01-15 14:39:23 +01:00
|
|
|
static Q_LOGGING_CATEGORY(perspectivesLog, "qtc.utils.perspectives", QtWarningMsg)
|
2019-03-22 07:35:48 +01:00
|
|
|
|
2016-03-02 13:57:37 +01:00
|
|
|
namespace Utils {
|
|
|
|
|
|
|
|
|
|
const char LAST_PERSPECTIVE_KEY[] = "LastPerspective";
|
2019-03-22 07:35:48 +01:00
|
|
|
const char MAINWINDOW_KEY[] = "Debugger.MainWindow";
|
|
|
|
|
const char AUTOHIDE_TITLEBARS_KEY[] = "AutoHideTitleBars";
|
|
|
|
|
const char SHOW_CENTRALWIDGET_KEY[] = "ShowCentralWidget";
|
2019-12-09 15:12:55 +01:00
|
|
|
const char STATE_KEY[] = "State"; // Up to 4.10
|
|
|
|
|
const char STATE_KEY2[] = "State2"; // From 4.11 on
|
2019-03-22 07:35:48 +01:00
|
|
|
const char CHANGED_DOCK_KEY[] = "ChangedDocks";
|
2016-02-29 18:15:36 +01:00
|
|
|
|
Debugger: Make most views per-engine instead of singletons
This is a step towards properly supporting multiple debugger
sessions side-by-side.
The combined C++-and-QML engine has been removed, instead a
combined setup creates now two individual engines, under a single
DebuggerRunTool but mostly independent with no combined state
machine. This requires a few more clicks in some cases, but
makes it easier to direct e.g. interrupt requests to the
interesting engine.
Care has been taken to not change the UX of the single debugger
session use case if possible. The fat debug button operates
as-before in that case, i.e. switches to Interrupt if the
single active runconfiguration runs in the debugger etc.
Most views are made per-engine, running an engine creates
a new Perspective, which is destroyed when the run control dies.
The snapshot view remains global and becomes primary source
of information on a "current engine" that receives all menu
and otherwise global input.
There is a new global "Breakpoint Preset" view containing
all "static" breakpoint data. When an engine starts up it
"claims" breakpoint it believes it can handle, but operates
on a copy of the static data. The markers of the static
version are suppressed as long as an engine controls a
breakpoint (that inclusive all resolved locations), but are
re-instatet once the engine quits.
The old Breakpoint class that already contained this split
per-instance was split into a new Breakpoint and a
GlobalBreakpoint class, with a per-engine model for Breakpoints,
and a singleton model containing GlobalBreakpoints.
There is a new CppDebuggerEngine intermediate level serving as
base for C++ (or, rather, "compiled") binary debugging, i.e.
{Gdb,Lldb,Cdb}Engine, taking over bits of the current DebuggerEngine
base that are not applicable to non-binary debuggers.
Change-Id: I9994f4c188379b4aee0c4f379edd4759fbb0bd43
Reviewed-by: Christian Stenger <christian.stenger@qt.io>
Reviewed-by: hjk <hjk@qt.io>
2018-07-31 12:30:48 +02:00
|
|
|
static DebuggerMainWindow *theMainWindow = nullptr;
|
|
|
|
|
|
|
|
|
|
class DockOperation
|
|
|
|
|
{
|
|
|
|
|
public:
|
2019-03-22 07:35:48 +01:00
|
|
|
void setupLayout();
|
2019-09-16 15:06:43 +02:00
|
|
|
void ensureDockExists();
|
|
|
|
|
|
2019-03-22 07:35:48 +01:00
|
|
|
QString name() const { QTC_ASSERT(widget, return QString()); return widget->objectName(); }
|
2019-09-16 15:06:43 +02:00
|
|
|
bool changedByUser() const;
|
|
|
|
|
void recordVisibility();
|
2019-03-22 07:35:48 +01:00
|
|
|
|
2020-06-26 13:59:38 +02:00
|
|
|
Utils::Id commandId;
|
Debugger: Make most views per-engine instead of singletons
This is a step towards properly supporting multiple debugger
sessions side-by-side.
The combined C++-and-QML engine has been removed, instead a
combined setup creates now two individual engines, under a single
DebuggerRunTool but mostly independent with no combined state
machine. This requires a few more clicks in some cases, but
makes it easier to direct e.g. interrupt requests to the
interesting engine.
Care has been taken to not change the UX of the single debugger
session use case if possible. The fat debug button operates
as-before in that case, i.e. switches to Interrupt if the
single active runconfiguration runs in the debugger etc.
Most views are made per-engine, running an engine creates
a new Perspective, which is destroyed when the run control dies.
The snapshot view remains global and becomes primary source
of information on a "current engine" that receives all menu
and otherwise global input.
There is a new global "Breakpoint Preset" view containing
all "static" breakpoint data. When an engine starts up it
"claims" breakpoint it believes it can handle, but operates
on a copy of the static data. The markers of the static
version are suppressed as long as an engine controls a
breakpoint (that inclusive all resolved locations), but are
re-instatet once the engine quits.
The old Breakpoint class that already contained this split
per-instance was split into a new Breakpoint and a
GlobalBreakpoint class, with a per-engine model for Breakpoints,
and a singleton model containing GlobalBreakpoints.
There is a new CppDebuggerEngine intermediate level serving as
base for C++ (or, rather, "compiled") binary debugging, i.e.
{Gdb,Lldb,Cdb}Engine, taking over bits of the current DebuggerEngine
base that are not applicable to non-binary debuggers.
Change-Id: I9994f4c188379b4aee0c4f379edd4759fbb0bd43
Reviewed-by: Christian Stenger <christian.stenger@qt.io>
Reviewed-by: hjk <hjk@qt.io>
2018-07-31 12:30:48 +02:00
|
|
|
QPointer<QWidget> widget;
|
2019-03-22 07:35:48 +01:00
|
|
|
QPointer<QDockWidget> dock;
|
|
|
|
|
QPointer<QWidget> anchorWidget;
|
2019-09-16 15:06:43 +02:00
|
|
|
QPointer<Utils::ProxyAction> toggleViewAction;
|
Debugger: Make most views per-engine instead of singletons
This is a step towards properly supporting multiple debugger
sessions side-by-side.
The combined C++-and-QML engine has been removed, instead a
combined setup creates now two individual engines, under a single
DebuggerRunTool but mostly independent with no combined state
machine. This requires a few more clicks in some cases, but
makes it easier to direct e.g. interrupt requests to the
interesting engine.
Care has been taken to not change the UX of the single debugger
session use case if possible. The fat debug button operates
as-before in that case, i.e. switches to Interrupt if the
single active runconfiguration runs in the debugger etc.
Most views are made per-engine, running an engine creates
a new Perspective, which is destroyed when the run control dies.
The snapshot view remains global and becomes primary source
of information on a "current engine" that receives all menu
and otherwise global input.
There is a new global "Breakpoint Preset" view containing
all "static" breakpoint data. When an engine starts up it
"claims" breakpoint it believes it can handle, but operates
on a copy of the static data. The markers of the static
version are suppressed as long as an engine controls a
breakpoint (that inclusive all resolved locations), but are
re-instatet once the engine quits.
The old Breakpoint class that already contained this split
per-instance was split into a new Breakpoint and a
GlobalBreakpoint class, with a per-engine model for Breakpoints,
and a singleton model containing GlobalBreakpoints.
There is a new CppDebuggerEngine intermediate level serving as
base for C++ (or, rather, "compiled") binary debugging, i.e.
{Gdb,Lldb,Cdb}Engine, taking over bits of the current DebuggerEngine
base that are not applicable to non-binary debuggers.
Change-Id: I9994f4c188379b4aee0c4f379edd4759fbb0bd43
Reviewed-by: Christian Stenger <christian.stenger@qt.io>
Reviewed-by: hjk <hjk@qt.io>
2018-07-31 12:30:48 +02:00
|
|
|
Perspective::OperationType operationType = Perspective::Raise;
|
|
|
|
|
bool visibleByDefault = true;
|
|
|
|
|
Qt::DockWidgetArea area = Qt::BottomDockWidgetArea;
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
class PerspectivePrivate
|
|
|
|
|
{
|
|
|
|
|
public:
|
2020-01-23 10:49:07 +01:00
|
|
|
~PerspectivePrivate();
|
|
|
|
|
|
2019-03-22 07:35:48 +01:00
|
|
|
void showInnerToolBar();
|
|
|
|
|
void hideInnerToolBar();
|
2018-09-04 13:29:15 +02:00
|
|
|
void restoreLayout();
|
|
|
|
|
void saveLayout();
|
2019-03-22 07:35:48 +01:00
|
|
|
void resetPerspective();
|
|
|
|
|
void populatePerspective();
|
|
|
|
|
void depopulatePerspective();
|
|
|
|
|
void saveAsLastUsedPerspective();
|
|
|
|
|
Context context() const;
|
|
|
|
|
|
2018-09-04 13:29:15 +02:00
|
|
|
QString settingsId() const;
|
|
|
|
|
QToolButton *setupToolButton(QAction *action);
|
Debugger: Make most views per-engine instead of singletons
This is a step towards properly supporting multiple debugger
sessions side-by-side.
The combined C++-and-QML engine has been removed, instead a
combined setup creates now two individual engines, under a single
DebuggerRunTool but mostly independent with no combined state
machine. This requires a few more clicks in some cases, but
makes it easier to direct e.g. interrupt requests to the
interesting engine.
Care has been taken to not change the UX of the single debugger
session use case if possible. The fat debug button operates
as-before in that case, i.e. switches to Interrupt if the
single active runconfiguration runs in the debugger etc.
Most views are made per-engine, running an engine creates
a new Perspective, which is destroyed when the run control dies.
The snapshot view remains global and becomes primary source
of information on a "current engine" that receives all menu
and otherwise global input.
There is a new global "Breakpoint Preset" view containing
all "static" breakpoint data. When an engine starts up it
"claims" breakpoint it believes it can handle, but operates
on a copy of the static data. The markers of the static
version are suppressed as long as an engine controls a
breakpoint (that inclusive all resolved locations), but are
re-instatet once the engine quits.
The old Breakpoint class that already contained this split
per-instance was split into a new Breakpoint and a
GlobalBreakpoint class, with a per-engine model for Breakpoints,
and a singleton model containing GlobalBreakpoints.
There is a new CppDebuggerEngine intermediate level serving as
base for C++ (or, rather, "compiled") binary debugging, i.e.
{Gdb,Lldb,Cdb}Engine, taking over bits of the current DebuggerEngine
base that are not applicable to non-binary debuggers.
Change-Id: I9994f4c188379b4aee0c4f379edd4759fbb0bd43
Reviewed-by: Christian Stenger <christian.stenger@qt.io>
Reviewed-by: hjk <hjk@qt.io>
2018-07-31 12:30:48 +02:00
|
|
|
|
|
|
|
|
QString m_id;
|
|
|
|
|
QString m_name;
|
2018-08-22 13:08:49 +02:00
|
|
|
QString m_parentPerspectiveId;
|
2019-03-22 07:35:48 +01:00
|
|
|
QString m_settingsId;
|
Debugger: Make most views per-engine instead of singletons
This is a step towards properly supporting multiple debugger
sessions side-by-side.
The combined C++-and-QML engine has been removed, instead a
combined setup creates now two individual engines, under a single
DebuggerRunTool but mostly independent with no combined state
machine. This requires a few more clicks in some cases, but
makes it easier to direct e.g. interrupt requests to the
interesting engine.
Care has been taken to not change the UX of the single debugger
session use case if possible. The fat debug button operates
as-before in that case, i.e. switches to Interrupt if the
single active runconfiguration runs in the debugger etc.
Most views are made per-engine, running an engine creates
a new Perspective, which is destroyed when the run control dies.
The snapshot view remains global and becomes primary source
of information on a "current engine" that receives all menu
and otherwise global input.
There is a new global "Breakpoint Preset" view containing
all "static" breakpoint data. When an engine starts up it
"claims" breakpoint it believes it can handle, but operates
on a copy of the static data. The markers of the static
version are suppressed as long as an engine controls a
breakpoint (that inclusive all resolved locations), but are
re-instatet once the engine quits.
The old Breakpoint class that already contained this split
per-instance was split into a new Breakpoint and a
GlobalBreakpoint class, with a per-engine model for Breakpoints,
and a singleton model containing GlobalBreakpoints.
There is a new CppDebuggerEngine intermediate level serving as
base for C++ (or, rather, "compiled") binary debugging, i.e.
{Gdb,Lldb,Cdb}Engine, taking over bits of the current DebuggerEngine
base that are not applicable to non-binary debuggers.
Change-Id: I9994f4c188379b4aee0c4f379edd4759fbb0bd43
Reviewed-by: Christian Stenger <christian.stenger@qt.io>
Reviewed-by: hjk <hjk@qt.io>
2018-07-31 12:30:48 +02:00
|
|
|
QVector<DockOperation> m_dockOperations;
|
|
|
|
|
QPointer<QWidget> m_centralWidget;
|
|
|
|
|
Perspective::Callback m_aboutToActivateCallback;
|
2018-09-04 13:29:15 +02:00
|
|
|
QPointer<QWidget> m_innerToolBar;
|
|
|
|
|
QHBoxLayout *m_innerToolBarLayout = nullptr;
|
|
|
|
|
QPointer<QWidget> m_switcher;
|
2018-08-22 13:08:49 +02:00
|
|
|
QString m_lastActiveSubPerspectiveId;
|
Debugger: Make most views per-engine instead of singletons
This is a step towards properly supporting multiple debugger
sessions side-by-side.
The combined C++-and-QML engine has been removed, instead a
combined setup creates now two individual engines, under a single
DebuggerRunTool but mostly independent with no combined state
machine. This requires a few more clicks in some cases, but
makes it easier to direct e.g. interrupt requests to the
interesting engine.
Care has been taken to not change the UX of the single debugger
session use case if possible. The fat debug button operates
as-before in that case, i.e. switches to Interrupt if the
single active runconfiguration runs in the debugger etc.
Most views are made per-engine, running an engine creates
a new Perspective, which is destroyed when the run control dies.
The snapshot view remains global and becomes primary source
of information on a "current engine" that receives all menu
and otherwise global input.
There is a new global "Breakpoint Preset" view containing
all "static" breakpoint data. When an engine starts up it
"claims" breakpoint it believes it can handle, but operates
on a copy of the static data. The markers of the static
version are suppressed as long as an engine controls a
breakpoint (that inclusive all resolved locations), but are
re-instatet once the engine quits.
The old Breakpoint class that already contained this split
per-instance was split into a new Breakpoint and a
GlobalBreakpoint class, with a per-engine model for Breakpoints,
and a singleton model containing GlobalBreakpoints.
There is a new CppDebuggerEngine intermediate level serving as
base for C++ (or, rather, "compiled") binary debugging, i.e.
{Gdb,Lldb,Cdb}Engine, taking over bits of the current DebuggerEngine
base that are not applicable to non-binary debuggers.
Change-Id: I9994f4c188379b4aee0c4f379edd4759fbb0bd43
Reviewed-by: Christian Stenger <christian.stenger@qt.io>
Reviewed-by: hjk <hjk@qt.io>
2018-07-31 12:30:48 +02:00
|
|
|
};
|
|
|
|
|
|
|
|
|
|
class DebuggerMainWindowPrivate : public QObject
|
|
|
|
|
{
|
|
|
|
|
public:
|
|
|
|
|
DebuggerMainWindowPrivate(DebuggerMainWindow *parent);
|
2019-10-17 17:58:22 +02:00
|
|
|
~DebuggerMainWindowPrivate();
|
Debugger: Make most views per-engine instead of singletons
This is a step towards properly supporting multiple debugger
sessions side-by-side.
The combined C++-and-QML engine has been removed, instead a
combined setup creates now two individual engines, under a single
DebuggerRunTool but mostly independent with no combined state
machine. This requires a few more clicks in some cases, but
makes it easier to direct e.g. interrupt requests to the
interesting engine.
Care has been taken to not change the UX of the single debugger
session use case if possible. The fat debug button operates
as-before in that case, i.e. switches to Interrupt if the
single active runconfiguration runs in the debugger etc.
Most views are made per-engine, running an engine creates
a new Perspective, which is destroyed when the run control dies.
The snapshot view remains global and becomes primary source
of information on a "current engine" that receives all menu
and otherwise global input.
There is a new global "Breakpoint Preset" view containing
all "static" breakpoint data. When an engine starts up it
"claims" breakpoint it believes it can handle, but operates
on a copy of the static data. The markers of the static
version are suppressed as long as an engine controls a
breakpoint (that inclusive all resolved locations), but are
re-instatet once the engine quits.
The old Breakpoint class that already contained this split
per-instance was split into a new Breakpoint and a
GlobalBreakpoint class, with a per-engine model for Breakpoints,
and a singleton model containing GlobalBreakpoints.
There is a new CppDebuggerEngine intermediate level serving as
base for C++ (or, rather, "compiled") binary debugging, i.e.
{Gdb,Lldb,Cdb}Engine, taking over bits of the current DebuggerEngine
base that are not applicable to non-binary debuggers.
Change-Id: I9994f4c188379b4aee0c4f379edd4759fbb0bd43
Reviewed-by: Christian Stenger <christian.stenger@qt.io>
Reviewed-by: hjk <hjk@qt.io>
2018-07-31 12:30:48 +02:00
|
|
|
|
2018-08-22 13:08:49 +02:00
|
|
|
void selectPerspective(Perspective *perspective);
|
|
|
|
|
void depopulateCurrentPerspective();
|
|
|
|
|
void populateCurrentPerspective();
|
Debugger: Make most views per-engine instead of singletons
This is a step towards properly supporting multiple debugger
sessions side-by-side.
The combined C++-and-QML engine has been removed, instead a
combined setup creates now two individual engines, under a single
DebuggerRunTool but mostly independent with no combined state
machine. This requires a few more clicks in some cases, but
makes it easier to direct e.g. interrupt requests to the
interesting engine.
Care has been taken to not change the UX of the single debugger
session use case if possible. The fat debug button operates
as-before in that case, i.e. switches to Interrupt if the
single active runconfiguration runs in the debugger etc.
Most views are made per-engine, running an engine creates
a new Perspective, which is destroyed when the run control dies.
The snapshot view remains global and becomes primary source
of information on a "current engine" that receives all menu
and otherwise global input.
There is a new global "Breakpoint Preset" view containing
all "static" breakpoint data. When an engine starts up it
"claims" breakpoint it believes it can handle, but operates
on a copy of the static data. The markers of the static
version are suppressed as long as an engine controls a
breakpoint (that inclusive all resolved locations), but are
re-instatet once the engine quits.
The old Breakpoint class that already contained this split
per-instance was split into a new Breakpoint and a
GlobalBreakpoint class, with a per-engine model for Breakpoints,
and a singleton model containing GlobalBreakpoints.
There is a new CppDebuggerEngine intermediate level serving as
base for C++ (or, rather, "compiled") binary debugging, i.e.
{Gdb,Lldb,Cdb}Engine, taking over bits of the current DebuggerEngine
base that are not applicable to non-binary debuggers.
Change-Id: I9994f4c188379b4aee0c4f379edd4759fbb0bd43
Reviewed-by: Christian Stenger <christian.stenger@qt.io>
Reviewed-by: hjk <hjk@qt.io>
2018-07-31 12:30:48 +02:00
|
|
|
void destroyPerspective(Perspective *perspective);
|
|
|
|
|
void registerPerspective(Perspective *perspective);
|
|
|
|
|
void resetCurrentPerspective();
|
|
|
|
|
int indexInChooser(Perspective *perspective) const;
|
2019-02-20 17:35:03 +01:00
|
|
|
void updatePerspectiveChooserWidth();
|
Debugger: Make most views per-engine instead of singletons
This is a step towards properly supporting multiple debugger
sessions side-by-side.
The combined C++-and-QML engine has been removed, instead a
combined setup creates now two individual engines, under a single
DebuggerRunTool but mostly independent with no combined state
machine. This requires a few more clicks in some cases, but
makes it easier to direct e.g. interrupt requests to the
interesting engine.
Care has been taken to not change the UX of the single debugger
session use case if possible. The fat debug button operates
as-before in that case, i.e. switches to Interrupt if the
single active runconfiguration runs in the debugger etc.
Most views are made per-engine, running an engine creates
a new Perspective, which is destroyed when the run control dies.
The snapshot view remains global and becomes primary source
of information on a "current engine" that receives all menu
and otherwise global input.
There is a new global "Breakpoint Preset" view containing
all "static" breakpoint data. When an engine starts up it
"claims" breakpoint it believes it can handle, but operates
on a copy of the static data. The markers of the static
version are suppressed as long as an engine controls a
breakpoint (that inclusive all resolved locations), but are
re-instatet once the engine quits.
The old Breakpoint class that already contained this split
per-instance was split into a new Breakpoint and a
GlobalBreakpoint class, with a per-engine model for Breakpoints,
and a singleton model containing GlobalBreakpoints.
There is a new CppDebuggerEngine intermediate level serving as
base for C++ (or, rather, "compiled") binary debugging, i.e.
{Gdb,Lldb,Cdb}Engine, taking over bits of the current DebuggerEngine
base that are not applicable to non-binary debuggers.
Change-Id: I9994f4c188379b4aee0c4f379edd4759fbb0bd43
Reviewed-by: Christian Stenger <christian.stenger@qt.io>
Reviewed-by: hjk <hjk@qt.io>
2018-07-31 12:30:48 +02:00
|
|
|
|
2019-03-22 07:35:48 +01:00
|
|
|
void cleanDocks();
|
|
|
|
|
void setCentralWidget(QWidget *widget);
|
|
|
|
|
|
|
|
|
|
QDockWidget *dockForWidget(QWidget *widget) const;
|
|
|
|
|
|
|
|
|
|
void setCurrentPerspective(Perspective *perspective)
|
|
|
|
|
{
|
2020-10-28 16:49:41 +01:00
|
|
|
const Core::Context oldContext = m_currentPerspective
|
|
|
|
|
? Context(Id::fromString(m_currentPerspective->id())) : Context();
|
2019-03-22 07:35:48 +01:00
|
|
|
m_currentPerspective = perspective;
|
2020-10-28 16:49:41 +01:00
|
|
|
const Core::Context newContext = m_currentPerspective
|
|
|
|
|
? Context(Id::fromString(m_currentPerspective->id())) : Context();
|
|
|
|
|
ICore::updateAdditionalContexts(oldContext, newContext);
|
2019-03-22 07:35:48 +01:00
|
|
|
}
|
|
|
|
|
|
Debugger: Make most views per-engine instead of singletons
This is a step towards properly supporting multiple debugger
sessions side-by-side.
The combined C++-and-QML engine has been removed, instead a
combined setup creates now two individual engines, under a single
DebuggerRunTool but mostly independent with no combined state
machine. This requires a few more clicks in some cases, but
makes it easier to direct e.g. interrupt requests to the
interesting engine.
Care has been taken to not change the UX of the single debugger
session use case if possible. The fat debug button operates
as-before in that case, i.e. switches to Interrupt if the
single active runconfiguration runs in the debugger etc.
Most views are made per-engine, running an engine creates
a new Perspective, which is destroyed when the run control dies.
The snapshot view remains global and becomes primary source
of information on a "current engine" that receives all menu
and otherwise global input.
There is a new global "Breakpoint Preset" view containing
all "static" breakpoint data. When an engine starts up it
"claims" breakpoint it believes it can handle, but operates
on a copy of the static data. The markers of the static
version are suppressed as long as an engine controls a
breakpoint (that inclusive all resolved locations), but are
re-instatet once the engine quits.
The old Breakpoint class that already contained this split
per-instance was split into a new Breakpoint and a
GlobalBreakpoint class, with a per-engine model for Breakpoints,
and a singleton model containing GlobalBreakpoints.
There is a new CppDebuggerEngine intermediate level serving as
base for C++ (or, rather, "compiled") binary debugging, i.e.
{Gdb,Lldb,Cdb}Engine, taking over bits of the current DebuggerEngine
base that are not applicable to non-binary debuggers.
Change-Id: I9994f4c188379b4aee0c4f379edd4759fbb0bd43
Reviewed-by: Christian Stenger <christian.stenger@qt.io>
Reviewed-by: hjk <hjk@qt.io>
2018-07-31 12:30:48 +02:00
|
|
|
DebuggerMainWindow *q = nullptr;
|
2019-03-22 07:35:48 +01:00
|
|
|
QPointer<Perspective> m_currentPerspective = nullptr;
|
Debugger: Make most views per-engine instead of singletons
This is a step towards properly supporting multiple debugger
sessions side-by-side.
The combined C++-and-QML engine has been removed, instead a
combined setup creates now two individual engines, under a single
DebuggerRunTool but mostly independent with no combined state
machine. This requires a few more clicks in some cases, but
makes it easier to direct e.g. interrupt requests to the
interesting engine.
Care has been taken to not change the UX of the single debugger
session use case if possible. The fat debug button operates
as-before in that case, i.e. switches to Interrupt if the
single active runconfiguration runs in the debugger etc.
Most views are made per-engine, running an engine creates
a new Perspective, which is destroyed when the run control dies.
The snapshot view remains global and becomes primary source
of information on a "current engine" that receives all menu
and otherwise global input.
There is a new global "Breakpoint Preset" view containing
all "static" breakpoint data. When an engine starts up it
"claims" breakpoint it believes it can handle, but operates
on a copy of the static data. The markers of the static
version are suppressed as long as an engine controls a
breakpoint (that inclusive all resolved locations), but are
re-instatet once the engine quits.
The old Breakpoint class that already contained this split
per-instance was split into a new Breakpoint and a
GlobalBreakpoint class, with a per-engine model for Breakpoints,
and a singleton model containing GlobalBreakpoints.
There is a new CppDebuggerEngine intermediate level serving as
base for C++ (or, rather, "compiled") binary debugging, i.e.
{Gdb,Lldb,Cdb}Engine, taking over bits of the current DebuggerEngine
base that are not applicable to non-binary debuggers.
Change-Id: I9994f4c188379b4aee0c4f379edd4759fbb0bd43
Reviewed-by: Christian Stenger <christian.stenger@qt.io>
Reviewed-by: hjk <hjk@qt.io>
2018-07-31 12:30:48 +02:00
|
|
|
QComboBox *m_perspectiveChooser = nullptr;
|
2020-06-16 15:56:47 +02:00
|
|
|
QMenu *m_perspectiveMenu;
|
Debugger: Make most views per-engine instead of singletons
This is a step towards properly supporting multiple debugger
sessions side-by-side.
The combined C++-and-QML engine has been removed, instead a
combined setup creates now two individual engines, under a single
DebuggerRunTool but mostly independent with no combined state
machine. This requires a few more clicks in some cases, but
makes it easier to direct e.g. interrupt requests to the
interesting engine.
Care has been taken to not change the UX of the single debugger
session use case if possible. The fat debug button operates
as-before in that case, i.e. switches to Interrupt if the
single active runconfiguration runs in the debugger etc.
Most views are made per-engine, running an engine creates
a new Perspective, which is destroyed when the run control dies.
The snapshot view remains global and becomes primary source
of information on a "current engine" that receives all menu
and otherwise global input.
There is a new global "Breakpoint Preset" view containing
all "static" breakpoint data. When an engine starts up it
"claims" breakpoint it believes it can handle, but operates
on a copy of the static data. The markers of the static
version are suppressed as long as an engine controls a
breakpoint (that inclusive all resolved locations), but are
re-instatet once the engine quits.
The old Breakpoint class that already contained this split
per-instance was split into a new Breakpoint and a
GlobalBreakpoint class, with a per-engine model for Breakpoints,
and a singleton model containing GlobalBreakpoints.
There is a new CppDebuggerEngine intermediate level serving as
base for C++ (or, rather, "compiled") binary debugging, i.e.
{Gdb,Lldb,Cdb}Engine, taking over bits of the current DebuggerEngine
base that are not applicable to non-binary debuggers.
Change-Id: I9994f4c188379b4aee0c4f379edd4759fbb0bd43
Reviewed-by: Christian Stenger <christian.stenger@qt.io>
Reviewed-by: hjk <hjk@qt.io>
2018-07-31 12:30:48 +02:00
|
|
|
QStackedWidget *m_centralWidgetStack = nullptr;
|
2018-09-11 11:24:19 +02:00
|
|
|
QHBoxLayout *m_subPerspectiveSwitcherLayout = nullptr;
|
2018-09-04 13:29:15 +02:00
|
|
|
QHBoxLayout *m_innerToolsLayout = nullptr;
|
2019-03-22 07:35:48 +01:00
|
|
|
QPointer<QWidget> m_editorPlaceHolder;
|
Debugger: Make most views per-engine instead of singletons
This is a step towards properly supporting multiple debugger
sessions side-by-side.
The combined C++-and-QML engine has been removed, instead a
combined setup creates now two individual engines, under a single
DebuggerRunTool but mostly independent with no combined state
machine. This requires a few more clicks in some cases, but
makes it easier to direct e.g. interrupt requests to the
interesting engine.
Care has been taken to not change the UX of the single debugger
session use case if possible. The fat debug button operates
as-before in that case, i.e. switches to Interrupt if the
single active runconfiguration runs in the debugger etc.
Most views are made per-engine, running an engine creates
a new Perspective, which is destroyed when the run control dies.
The snapshot view remains global and becomes primary source
of information on a "current engine" that receives all menu
and otherwise global input.
There is a new global "Breakpoint Preset" view containing
all "static" breakpoint data. When an engine starts up it
"claims" breakpoint it believes it can handle, but operates
on a copy of the static data. The markers of the static
version are suppressed as long as an engine controls a
breakpoint (that inclusive all resolved locations), but are
re-instatet once the engine quits.
The old Breakpoint class that already contained this split
per-instance was split into a new Breakpoint and a
GlobalBreakpoint class, with a per-engine model for Breakpoints,
and a singleton model containing GlobalBreakpoints.
There is a new CppDebuggerEngine intermediate level serving as
base for C++ (or, rather, "compiled") binary debugging, i.e.
{Gdb,Lldb,Cdb}Engine, taking over bits of the current DebuggerEngine
base that are not applicable to non-binary debuggers.
Change-Id: I9994f4c188379b4aee0c4f379edd4759fbb0bd43
Reviewed-by: Christian Stenger <christian.stenger@qt.io>
Reviewed-by: hjk <hjk@qt.io>
2018-07-31 12:30:48 +02:00
|
|
|
Utils::StatusLabel *m_statusLabel = nullptr;
|
|
|
|
|
QDockWidget *m_toolBarDock = nullptr;
|
2019-09-16 15:06:43 +02:00
|
|
|
bool needRestoreOnModeEnter = false;
|
Debugger: Make most views per-engine instead of singletons
This is a step towards properly supporting multiple debugger
sessions side-by-side.
The combined C++-and-QML engine has been removed, instead a
combined setup creates now two individual engines, under a single
DebuggerRunTool but mostly independent with no combined state
machine. This requires a few more clicks in some cases, but
makes it easier to direct e.g. interrupt requests to the
interesting engine.
Care has been taken to not change the UX of the single debugger
session use case if possible. The fat debug button operates
as-before in that case, i.e. switches to Interrupt if the
single active runconfiguration runs in the debugger etc.
Most views are made per-engine, running an engine creates
a new Perspective, which is destroyed when the run control dies.
The snapshot view remains global and becomes primary source
of information on a "current engine" that receives all menu
and otherwise global input.
There is a new global "Breakpoint Preset" view containing
all "static" breakpoint data. When an engine starts up it
"claims" breakpoint it believes it can handle, but operates
on a copy of the static data. The markers of the static
version are suppressed as long as an engine controls a
breakpoint (that inclusive all resolved locations), but are
re-instatet once the engine quits.
The old Breakpoint class that already contained this split
per-instance was split into a new Breakpoint and a
GlobalBreakpoint class, with a per-engine model for Breakpoints,
and a singleton model containing GlobalBreakpoints.
There is a new CppDebuggerEngine intermediate level serving as
base for C++ (or, rather, "compiled") binary debugging, i.e.
{Gdb,Lldb,Cdb}Engine, taking over bits of the current DebuggerEngine
base that are not applicable to non-binary debuggers.
Change-Id: I9994f4c188379b4aee0c4f379edd4759fbb0bd43
Reviewed-by: Christian Stenger <christian.stenger@qt.io>
Reviewed-by: hjk <hjk@qt.io>
2018-07-31 12:30:48 +02:00
|
|
|
|
2019-03-22 07:35:48 +01:00
|
|
|
QList<QPointer<Perspective>> m_perspectives;
|
2019-09-16 15:06:43 +02:00
|
|
|
QSet<QString> m_persistentChangedDocks; // Dock Ids of docks with non-default visibility.
|
2019-06-03 08:48:33 +02:00
|
|
|
|
2019-12-09 15:12:55 +01:00
|
|
|
QHash<QString, PerspectiveState> m_lastPerspectiveStates; // Perspective::id() -> MainWindow::state()
|
|
|
|
|
QHash<QString, PerspectiveState> m_lastTypePerspectiveStates; // Perspective::settingsId() -> MainWindow::state()
|
Debugger: Make most views per-engine instead of singletons
This is a step towards properly supporting multiple debugger
sessions side-by-side.
The combined C++-and-QML engine has been removed, instead a
combined setup creates now two individual engines, under a single
DebuggerRunTool but mostly independent with no combined state
machine. This requires a few more clicks in some cases, but
makes it easier to direct e.g. interrupt requests to the
interesting engine.
Care has been taken to not change the UX of the single debugger
session use case if possible. The fat debug button operates
as-before in that case, i.e. switches to Interrupt if the
single active runconfiguration runs in the debugger etc.
Most views are made per-engine, running an engine creates
a new Perspective, which is destroyed when the run control dies.
The snapshot view remains global and becomes primary source
of information on a "current engine" that receives all menu
and otherwise global input.
There is a new global "Breakpoint Preset" view containing
all "static" breakpoint data. When an engine starts up it
"claims" breakpoint it believes it can handle, but operates
on a copy of the static data. The markers of the static
version are suppressed as long as an engine controls a
breakpoint (that inclusive all resolved locations), but are
re-instatet once the engine quits.
The old Breakpoint class that already contained this split
per-instance was split into a new Breakpoint and a
GlobalBreakpoint class, with a per-engine model for Breakpoints,
and a singleton model containing GlobalBreakpoints.
There is a new CppDebuggerEngine intermediate level serving as
base for C++ (or, rather, "compiled") binary debugging, i.e.
{Gdb,Lldb,Cdb}Engine, taking over bits of the current DebuggerEngine
base that are not applicable to non-binary debuggers.
Change-Id: I9994f4c188379b4aee0c4f379edd4759fbb0bd43
Reviewed-by: Christian Stenger <christian.stenger@qt.io>
Reviewed-by: hjk <hjk@qt.io>
2018-07-31 12:30:48 +02:00
|
|
|
};
|
|
|
|
|
|
|
|
|
|
DebuggerMainWindowPrivate::DebuggerMainWindowPrivate(DebuggerMainWindow *parent)
|
|
|
|
|
: q(parent)
|
2016-02-29 18:15:36 +01:00
|
|
|
{
|
2016-05-12 11:57:29 +02:00
|
|
|
m_centralWidgetStack = new QStackedWidget;
|
2016-03-02 13:23:30 +01:00
|
|
|
m_statusLabel = new Utils::StatusLabel;
|
Debugger: Make most views per-engine instead of singletons
This is a step towards properly supporting multiple debugger
sessions side-by-side.
The combined C++-and-QML engine has been removed, instead a
combined setup creates now two individual engines, under a single
DebuggerRunTool but mostly independent with no combined state
machine. This requires a few more clicks in some cases, but
makes it easier to direct e.g. interrupt requests to the
interesting engine.
Care has been taken to not change the UX of the single debugger
session use case if possible. The fat debug button operates
as-before in that case, i.e. switches to Interrupt if the
single active runconfiguration runs in the debugger etc.
Most views are made per-engine, running an engine creates
a new Perspective, which is destroyed when the run control dies.
The snapshot view remains global and becomes primary source
of information on a "current engine" that receives all menu
and otherwise global input.
There is a new global "Breakpoint Preset" view containing
all "static" breakpoint data. When an engine starts up it
"claims" breakpoint it believes it can handle, but operates
on a copy of the static data. The markers of the static
version are suppressed as long as an engine controls a
breakpoint (that inclusive all resolved locations), but are
re-instatet once the engine quits.
The old Breakpoint class that already contained this split
per-instance was split into a new Breakpoint and a
GlobalBreakpoint class, with a per-engine model for Breakpoints,
and a singleton model containing GlobalBreakpoints.
There is a new CppDebuggerEngine intermediate level serving as
base for C++ (or, rather, "compiled") binary debugging, i.e.
{Gdb,Lldb,Cdb}Engine, taking over bits of the current DebuggerEngine
base that are not applicable to non-binary debuggers.
Change-Id: I9994f4c188379b4aee0c4f379edd4759fbb0bd43
Reviewed-by: Christian Stenger <christian.stenger@qt.io>
Reviewed-by: hjk <hjk@qt.io>
2018-07-31 12:30:48 +02:00
|
|
|
m_statusLabel->setProperty("panelwidget", true);
|
2019-02-11 10:32:46 +01:00
|
|
|
m_statusLabel->setIndent(2 * QFontMetrics(q->font()).horizontalAdvance(QChar('x')));
|
2016-05-12 11:57:29 +02:00
|
|
|
m_editorPlaceHolder = new EditorManagerPlaceHolder;
|
2016-03-02 13:57:37 +01:00
|
|
|
|
|
|
|
|
m_perspectiveChooser = new QComboBox;
|
2018-09-04 13:29:15 +02:00
|
|
|
m_perspectiveChooser->setObjectName("PerspectiveChooser");
|
Debugger: Make most views per-engine instead of singletons
This is a step towards properly supporting multiple debugger
sessions side-by-side.
The combined C++-and-QML engine has been removed, instead a
combined setup creates now two individual engines, under a single
DebuggerRunTool but mostly independent with no combined state
machine. This requires a few more clicks in some cases, but
makes it easier to direct e.g. interrupt requests to the
interesting engine.
Care has been taken to not change the UX of the single debugger
session use case if possible. The fat debug button operates
as-before in that case, i.e. switches to Interrupt if the
single active runconfiguration runs in the debugger etc.
Most views are made per-engine, running an engine creates
a new Perspective, which is destroyed when the run control dies.
The snapshot view remains global and becomes primary source
of information on a "current engine" that receives all menu
and otherwise global input.
There is a new global "Breakpoint Preset" view containing
all "static" breakpoint data. When an engine starts up it
"claims" breakpoint it believes it can handle, but operates
on a copy of the static data. The markers of the static
version are suppressed as long as an engine controls a
breakpoint (that inclusive all resolved locations), but are
re-instatet once the engine quits.
The old Breakpoint class that already contained this split
per-instance was split into a new Breakpoint and a
GlobalBreakpoint class, with a per-engine model for Breakpoints,
and a singleton model containing GlobalBreakpoints.
There is a new CppDebuggerEngine intermediate level serving as
base for C++ (or, rather, "compiled") binary debugging, i.e.
{Gdb,Lldb,Cdb}Engine, taking over bits of the current DebuggerEngine
base that are not applicable to non-binary debuggers.
Change-Id: I9994f4c188379b4aee0c4f379edd4759fbb0bd43
Reviewed-by: Christian Stenger <christian.stenger@qt.io>
Reviewed-by: hjk <hjk@qt.io>
2018-07-31 12:30:48 +02:00
|
|
|
m_perspectiveChooser->setProperty("panelwidget", true);
|
2018-09-04 13:29:15 +02:00
|
|
|
m_perspectiveChooser->setSizeAdjustPolicy(QComboBox::AdjustToContents);
|
2020-06-16 15:56:47 +02:00
|
|
|
connect(m_perspectiveChooser, QOverload<int>::of(&QComboBox::activated), this, [this](int item) {
|
2018-08-22 13:08:49 +02:00
|
|
|
Perspective *perspective = Perspective::findPerspective(m_perspectiveChooser->itemData(item).toString());
|
|
|
|
|
QTC_ASSERT(perspective, return);
|
|
|
|
|
if (auto subPerspective = Perspective::findPerspective(perspective->d->m_lastActiveSubPerspectiveId))
|
|
|
|
|
subPerspective->select();
|
|
|
|
|
else
|
|
|
|
|
perspective->select();
|
2018-08-01 17:33:41 +02:00
|
|
|
});
|
2018-09-04 13:29:15 +02:00
|
|
|
|
2020-06-16 15:56:47 +02:00
|
|
|
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();
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
});
|
|
|
|
|
|
2018-09-04 13:29:15 +02:00
|
|
|
auto viewButton = new QToolButton;
|
2018-10-25 12:12:07 +02:00
|
|
|
viewButton->setText(DebuggerMainWindow::tr("&Views"));
|
2018-09-04 13:29:15 +02:00
|
|
|
|
|
|
|
|
auto closeButton = new QToolButton();
|
|
|
|
|
closeButton->setIcon(Utils::Icons::CLOSE_SPLIT_BOTTOM.icon());
|
2018-10-25 12:12:07 +02:00
|
|
|
closeButton->setToolTip(DebuggerMainWindow::tr("Leave Debug Mode"));
|
2018-09-04 13:29:15 +02:00
|
|
|
|
|
|
|
|
auto toolbar = new Utils::StyledBar;
|
|
|
|
|
toolbar->setProperty("topBorder", true);
|
|
|
|
|
|
|
|
|
|
// "Engine switcher" style comboboxes
|
2018-09-11 11:24:19 +02:00
|
|
|
auto subPerspectiveSwitcher = new QWidget;
|
|
|
|
|
m_subPerspectiveSwitcherLayout = new QHBoxLayout(subPerspectiveSwitcher);
|
2019-08-29 10:36:01 +02:00
|
|
|
m_subPerspectiveSwitcherLayout->setContentsMargins(0, 0, 0, 0);
|
2018-09-11 11:24:19 +02:00
|
|
|
m_subPerspectiveSwitcherLayout->setSpacing(0);
|
2018-09-04 13:29:15 +02:00
|
|
|
|
|
|
|
|
// All perspective toolbars will get inserted here, but only
|
|
|
|
|
// the current perspective's toolbar is set visible.
|
|
|
|
|
auto innerTools = new QWidget;
|
|
|
|
|
m_innerToolsLayout = new QHBoxLayout(innerTools);
|
2019-08-29 10:36:01 +02:00
|
|
|
m_innerToolsLayout->setContentsMargins(0, 0, 0, 0);
|
2018-09-04 13:29:15 +02:00
|
|
|
m_innerToolsLayout->setSpacing(0);
|
|
|
|
|
|
|
|
|
|
auto hbox = new QHBoxLayout(toolbar);
|
2019-08-29 10:36:01 +02:00
|
|
|
hbox->setContentsMargins(0, 0, 0, 0);
|
2018-09-04 13:29:15 +02:00
|
|
|
hbox->setSpacing(0);
|
|
|
|
|
hbox->addWidget(m_perspectiveChooser);
|
2018-09-11 11:24:19 +02:00
|
|
|
hbox->addWidget(subPerspectiveSwitcher);
|
2018-09-04 13:29:15 +02:00
|
|
|
hbox->addWidget(innerTools);
|
|
|
|
|
hbox->addWidget(m_statusLabel);
|
|
|
|
|
hbox->addStretch(1);
|
|
|
|
|
hbox->addWidget(new Utils::StyledSeparator);
|
|
|
|
|
hbox->addWidget(viewButton);
|
|
|
|
|
hbox->addWidget(closeButton);
|
|
|
|
|
|
2019-02-19 14:56:41 +01:00
|
|
|
auto scrolledToolbar = new QScrollArea;
|
|
|
|
|
scrolledToolbar->setWidget(toolbar);
|
|
|
|
|
scrolledToolbar->setFrameStyle(QFrame::NoFrame);
|
|
|
|
|
scrolledToolbar->setWidgetResizable(true);
|
|
|
|
|
scrolledToolbar->setHorizontalScrollBarPolicy(Qt::ScrollBarAlwaysOff);
|
|
|
|
|
scrolledToolbar->setFixedHeight(StyleHelper::navigationWidgetHeight());
|
|
|
|
|
scrolledToolbar->setVerticalScrollBarPolicy(Qt::ScrollBarAlwaysOff);
|
|
|
|
|
|
2018-10-25 12:12:07 +02:00
|
|
|
auto dock = new QDockWidget(DebuggerMainWindow::tr("Toolbar"), q);
|
2018-10-07 22:38:47 +03:00
|
|
|
dock->setObjectName("Toolbar");
|
2018-09-04 13:29:15 +02:00
|
|
|
dock->setFeatures(QDockWidget::NoDockWidgetFeatures);
|
|
|
|
|
dock->setAllowedAreas(Qt::BottomDockWidgetArea);
|
|
|
|
|
dock->setTitleBarWidget(new QWidget(dock)); // hide title bar
|
2018-10-07 22:38:47 +03:00
|
|
|
dock->setProperty("managed_dockwidget", "true");
|
2019-02-19 14:56:41 +01:00
|
|
|
dock->setWidget(scrolledToolbar);
|
|
|
|
|
|
2018-09-04 13:29:15 +02:00
|
|
|
m_toolBarDock = dock;
|
|
|
|
|
q->addDockWidget(Qt::BottomDockWidgetArea, m_toolBarDock);
|
|
|
|
|
|
2020-04-23 16:47:25 +02:00
|
|
|
connect(viewButton, &QAbstractButton::clicked, this, [viewButton] {
|
2020-03-04 10:44:07 +01:00
|
|
|
ActionContainer *viewsMenu = ActionManager::actionContainer(Core::Constants::M_VIEW_VIEWS);
|
2019-03-22 07:35:48 +01:00
|
|
|
viewsMenu->menu()->exec(viewButton->mapToGlobal(QPoint()));
|
2018-09-04 13:29:15 +02:00
|
|
|
});
|
|
|
|
|
|
|
|
|
|
connect(closeButton, &QAbstractButton::clicked, [] {
|
|
|
|
|
ModeManager::activateMode(Core::Constants::MODE_EDIT);
|
|
|
|
|
});
|
Debugger: Make most views per-engine instead of singletons
This is a step towards properly supporting multiple debugger
sessions side-by-side.
The combined C++-and-QML engine has been removed, instead a
combined setup creates now two individual engines, under a single
DebuggerRunTool but mostly independent with no combined state
machine. This requires a few more clicks in some cases, but
makes it easier to direct e.g. interrupt requests to the
interesting engine.
Care has been taken to not change the UX of the single debugger
session use case if possible. The fat debug button operates
as-before in that case, i.e. switches to Interrupt if the
single active runconfiguration runs in the debugger etc.
Most views are made per-engine, running an engine creates
a new Perspective, which is destroyed when the run control dies.
The snapshot view remains global and becomes primary source
of information on a "current engine" that receives all menu
and otherwise global input.
There is a new global "Breakpoint Preset" view containing
all "static" breakpoint data. When an engine starts up it
"claims" breakpoint it believes it can handle, but operates
on a copy of the static data. The markers of the static
version are suppressed as long as an engine controls a
breakpoint (that inclusive all resolved locations), but are
re-instatet once the engine quits.
The old Breakpoint class that already contained this split
per-instance was split into a new Breakpoint and a
GlobalBreakpoint class, with a per-engine model for Breakpoints,
and a singleton model containing GlobalBreakpoints.
There is a new CppDebuggerEngine intermediate level serving as
base for C++ (or, rather, "compiled") binary debugging, i.e.
{Gdb,Lldb,Cdb}Engine, taking over bits of the current DebuggerEngine
base that are not applicable to non-binary debuggers.
Change-Id: I9994f4c188379b4aee0c4f379edd4759fbb0bd43
Reviewed-by: Christian Stenger <christian.stenger@qt.io>
Reviewed-by: hjk <hjk@qt.io>
2018-07-31 12:30:48 +02:00
|
|
|
}
|
|
|
|
|
|
2019-10-17 17:58:22 +02:00
|
|
|
DebuggerMainWindowPrivate::~DebuggerMainWindowPrivate()
|
|
|
|
|
{
|
|
|
|
|
delete m_editorPlaceHolder;
|
2020-06-16 15:56:47 +02:00
|
|
|
delete m_perspectiveMenu;
|
2019-10-17 17:58:22 +02:00
|
|
|
}
|
|
|
|
|
|
Debugger: Make most views per-engine instead of singletons
This is a step towards properly supporting multiple debugger
sessions side-by-side.
The combined C++-and-QML engine has been removed, instead a
combined setup creates now two individual engines, under a single
DebuggerRunTool but mostly independent with no combined state
machine. This requires a few more clicks in some cases, but
makes it easier to direct e.g. interrupt requests to the
interesting engine.
Care has been taken to not change the UX of the single debugger
session use case if possible. The fat debug button operates
as-before in that case, i.e. switches to Interrupt if the
single active runconfiguration runs in the debugger etc.
Most views are made per-engine, running an engine creates
a new Perspective, which is destroyed when the run control dies.
The snapshot view remains global and becomes primary source
of information on a "current engine" that receives all menu
and otherwise global input.
There is a new global "Breakpoint Preset" view containing
all "static" breakpoint data. When an engine starts up it
"claims" breakpoint it believes it can handle, but operates
on a copy of the static data. The markers of the static
version are suppressed as long as an engine controls a
breakpoint (that inclusive all resolved locations), but are
re-instatet once the engine quits.
The old Breakpoint class that already contained this split
per-instance was split into a new Breakpoint and a
GlobalBreakpoint class, with a per-engine model for Breakpoints,
and a singleton model containing GlobalBreakpoints.
There is a new CppDebuggerEngine intermediate level serving as
base for C++ (or, rather, "compiled") binary debugging, i.e.
{Gdb,Lldb,Cdb}Engine, taking over bits of the current DebuggerEngine
base that are not applicable to non-binary debuggers.
Change-Id: I9994f4c188379b4aee0c4f379edd4759fbb0bd43
Reviewed-by: Christian Stenger <christian.stenger@qt.io>
Reviewed-by: hjk <hjk@qt.io>
2018-07-31 12:30:48 +02:00
|
|
|
DebuggerMainWindow::DebuggerMainWindow()
|
|
|
|
|
: d(new DebuggerMainWindowPrivate(this))
|
|
|
|
|
{
|
2016-02-29 18:15:36 +01:00
|
|
|
setDockNestingEnabled(true);
|
|
|
|
|
setDockActionsVisible(false);
|
|
|
|
|
setDocumentMode(true);
|
2016-03-01 07:51:06 +01:00
|
|
|
|
|
|
|
|
connect(this, &FancyMainWindow::resetLayout,
|
Debugger: Make most views per-engine instead of singletons
This is a step towards properly supporting multiple debugger
sessions side-by-side.
The combined C++-and-QML engine has been removed, instead a
combined setup creates now two individual engines, under a single
DebuggerRunTool but mostly independent with no combined state
machine. This requires a few more clicks in some cases, but
makes it easier to direct e.g. interrupt requests to the
interesting engine.
Care has been taken to not change the UX of the single debugger
session use case if possible. The fat debug button operates
as-before in that case, i.e. switches to Interrupt if the
single active runconfiguration runs in the debugger etc.
Most views are made per-engine, running an engine creates
a new Perspective, which is destroyed when the run control dies.
The snapshot view remains global and becomes primary source
of information on a "current engine" that receives all menu
and otherwise global input.
There is a new global "Breakpoint Preset" view containing
all "static" breakpoint data. When an engine starts up it
"claims" breakpoint it believes it can handle, but operates
on a copy of the static data. The markers of the static
version are suppressed as long as an engine controls a
breakpoint (that inclusive all resolved locations), but are
re-instatet once the engine quits.
The old Breakpoint class that already contained this split
per-instance was split into a new Breakpoint and a
GlobalBreakpoint class, with a per-engine model for Breakpoints,
and a singleton model containing GlobalBreakpoints.
There is a new CppDebuggerEngine intermediate level serving as
base for C++ (or, rather, "compiled") binary debugging, i.e.
{Gdb,Lldb,Cdb}Engine, taking over bits of the current DebuggerEngine
base that are not applicable to non-binary debuggers.
Change-Id: I9994f4c188379b4aee0c4f379edd4759fbb0bd43
Reviewed-by: Christian Stenger <christian.stenger@qt.io>
Reviewed-by: hjk <hjk@qt.io>
2018-07-31 12:30:48 +02:00
|
|
|
d, &DebuggerMainWindowPrivate::resetCurrentPerspective);
|
|
|
|
|
|
|
|
|
|
Context debugcontext(Debugger::Constants::C_DEBUGMODE);
|
|
|
|
|
|
2020-03-04 10:44:07 +01:00
|
|
|
ActionContainer *viewsMenu = ActionManager::actionContainer(Core::Constants::M_VIEW_VIEWS);
|
Debugger: Make most views per-engine instead of singletons
This is a step towards properly supporting multiple debugger
sessions side-by-side.
The combined C++-and-QML engine has been removed, instead a
combined setup creates now two individual engines, under a single
DebuggerRunTool but mostly independent with no combined state
machine. This requires a few more clicks in some cases, but
makes it easier to direct e.g. interrupt requests to the
interesting engine.
Care has been taken to not change the UX of the single debugger
session use case if possible. The fat debug button operates
as-before in that case, i.e. switches to Interrupt if the
single active runconfiguration runs in the debugger etc.
Most views are made per-engine, running an engine creates
a new Perspective, which is destroyed when the run control dies.
The snapshot view remains global and becomes primary source
of information on a "current engine" that receives all menu
and otherwise global input.
There is a new global "Breakpoint Preset" view containing
all "static" breakpoint data. When an engine starts up it
"claims" breakpoint it believes it can handle, but operates
on a copy of the static data. The markers of the static
version are suppressed as long as an engine controls a
breakpoint (that inclusive all resolved locations), but are
re-instatet once the engine quits.
The old Breakpoint class that already contained this split
per-instance was split into a new Breakpoint and a
GlobalBreakpoint class, with a per-engine model for Breakpoints,
and a singleton model containing GlobalBreakpoints.
There is a new CppDebuggerEngine intermediate level serving as
base for C++ (or, rather, "compiled") binary debugging, i.e.
{Gdb,Lldb,Cdb}Engine, taking over bits of the current DebuggerEngine
base that are not applicable to non-binary debuggers.
Change-Id: I9994f4c188379b4aee0c4f379edd4759fbb0bd43
Reviewed-by: Christian Stenger <christian.stenger@qt.io>
Reviewed-by: hjk <hjk@qt.io>
2018-07-31 12:30:48 +02:00
|
|
|
Command *cmd = ActionManager::registerAction(showCentralWidgetAction(),
|
|
|
|
|
"Debugger.Views.ShowCentralWidget", debugcontext);
|
|
|
|
|
cmd->setAttribute(Command::CA_Hide);
|
|
|
|
|
cmd->setAttribute(Command::CA_UpdateText);
|
|
|
|
|
viewsMenu->addAction(cmd, Core::Constants::G_DEFAULT_THREE);
|
|
|
|
|
cmd = ActionManager::registerAction(menuSeparator1(),
|
|
|
|
|
"Debugger.Views.Separator1", debugcontext);
|
|
|
|
|
cmd->setAttribute(Command::CA_Hide);
|
|
|
|
|
viewsMenu->addAction(cmd, Core::Constants::G_DEFAULT_THREE);
|
|
|
|
|
cmd = ActionManager::registerAction(autoHideTitleBarsAction(),
|
|
|
|
|
"Debugger.Views.AutoHideTitleBars", debugcontext);
|
|
|
|
|
cmd->setAttribute(Command::CA_Hide);
|
|
|
|
|
viewsMenu->addAction(cmd, Core::Constants::G_DEFAULT_THREE);
|
|
|
|
|
cmd = ActionManager::registerAction(menuSeparator2(),
|
|
|
|
|
"Debugger.Views.Separator2", debugcontext);
|
|
|
|
|
cmd->setAttribute(Command::CA_Hide);
|
|
|
|
|
viewsMenu->addAction(cmd, Core::Constants::G_DEFAULT_THREE);
|
|
|
|
|
cmd = ActionManager::registerAction(resetLayoutAction(),
|
|
|
|
|
"Debugger.Views.ResetSimple", debugcontext);
|
|
|
|
|
cmd->setAttribute(Command::CA_Hide);
|
|
|
|
|
viewsMenu->addAction(cmd, Core::Constants::G_DEFAULT_THREE);
|
2019-03-22 07:35:48 +01:00
|
|
|
|
2020-03-24 14:40:54 +01:00
|
|
|
// HACK: See QTCREATORBUG-23755. This ensures the showCentralWidget()
|
|
|
|
|
// call in restorePersistentSettings() below has something to operate on,
|
|
|
|
|
// and a plain QWidget is what we'll use anyway as central widget.
|
|
|
|
|
setCentralWidget(new QWidget);
|
|
|
|
|
|
2019-09-16 15:06:43 +02:00
|
|
|
restorePersistentSettings();
|
2016-02-29 18:15:36 +01:00
|
|
|
}
|
|
|
|
|
|
2016-03-02 13:57:37 +01:00
|
|
|
DebuggerMainWindow::~DebuggerMainWindow()
|
Debugger: Make most views per-engine instead of singletons
This is a step towards properly supporting multiple debugger
sessions side-by-side.
The combined C++-and-QML engine has been removed, instead a
combined setup creates now two individual engines, under a single
DebuggerRunTool but mostly independent with no combined state
machine. This requires a few more clicks in some cases, but
makes it easier to direct e.g. interrupt requests to the
interesting engine.
Care has been taken to not change the UX of the single debugger
session use case if possible. The fat debug button operates
as-before in that case, i.e. switches to Interrupt if the
single active runconfiguration runs in the debugger etc.
Most views are made per-engine, running an engine creates
a new Perspective, which is destroyed when the run control dies.
The snapshot view remains global and becomes primary source
of information on a "current engine" that receives all menu
and otherwise global input.
There is a new global "Breakpoint Preset" view containing
all "static" breakpoint data. When an engine starts up it
"claims" breakpoint it believes it can handle, but operates
on a copy of the static data. The markers of the static
version are suppressed as long as an engine controls a
breakpoint (that inclusive all resolved locations), but are
re-instatet once the engine quits.
The old Breakpoint class that already contained this split
per-instance was split into a new Breakpoint and a
GlobalBreakpoint class, with a per-engine model for Breakpoints,
and a singleton model containing GlobalBreakpoints.
There is a new CppDebuggerEngine intermediate level serving as
base for C++ (or, rather, "compiled") binary debugging, i.e.
{Gdb,Lldb,Cdb}Engine, taking over bits of the current DebuggerEngine
base that are not applicable to non-binary debuggers.
Change-Id: I9994f4c188379b4aee0c4f379edd4759fbb0bd43
Reviewed-by: Christian Stenger <christian.stenger@qt.io>
Reviewed-by: hjk <hjk@qt.io>
2018-07-31 12:30:48 +02:00
|
|
|
{
|
|
|
|
|
delete d;
|
|
|
|
|
}
|
|
|
|
|
|
2019-03-22 07:35:48 +01:00
|
|
|
void DebuggerMainWindow::contextMenuEvent(QContextMenuEvent *ev)
|
|
|
|
|
{
|
2020-03-04 10:44:07 +01:00
|
|
|
ActionContainer *viewsMenu = ActionManager::actionContainer(Core::Constants::M_VIEW_VIEWS);
|
2019-03-22 07:35:48 +01:00
|
|
|
viewsMenu->menu()->exec(ev->globalPos());
|
|
|
|
|
}
|
|
|
|
|
|
2018-08-21 12:30:00 +02:00
|
|
|
void DebuggerMainWindow::ensureMainWindowExists()
|
2016-02-29 18:15:36 +01:00
|
|
|
{
|
2018-08-21 12:30:00 +02:00
|
|
|
if (!theMainWindow)
|
|
|
|
|
theMainWindow = new DebuggerMainWindow;
|
2016-02-29 18:15:36 +01:00
|
|
|
}
|
|
|
|
|
|
2018-08-21 12:30:00 +02:00
|
|
|
void DebuggerMainWindow::doShutdown()
|
Debugger: Make most views per-engine instead of singletons
This is a step towards properly supporting multiple debugger
sessions side-by-side.
The combined C++-and-QML engine has been removed, instead a
combined setup creates now two individual engines, under a single
DebuggerRunTool but mostly independent with no combined state
machine. This requires a few more clicks in some cases, but
makes it easier to direct e.g. interrupt requests to the
interesting engine.
Care has been taken to not change the UX of the single debugger
session use case if possible. The fat debug button operates
as-before in that case, i.e. switches to Interrupt if the
single active runconfiguration runs in the debugger etc.
Most views are made per-engine, running an engine creates
a new Perspective, which is destroyed when the run control dies.
The snapshot view remains global and becomes primary source
of information on a "current engine" that receives all menu
and otherwise global input.
There is a new global "Breakpoint Preset" view containing
all "static" breakpoint data. When an engine starts up it
"claims" breakpoint it believes it can handle, but operates
on a copy of the static data. The markers of the static
version are suppressed as long as an engine controls a
breakpoint (that inclusive all resolved locations), but are
re-instatet once the engine quits.
The old Breakpoint class that already contained this split
per-instance was split into a new Breakpoint and a
GlobalBreakpoint class, with a per-engine model for Breakpoints,
and a singleton model containing GlobalBreakpoints.
There is a new CppDebuggerEngine intermediate level serving as
base for C++ (or, rather, "compiled") binary debugging, i.e.
{Gdb,Lldb,Cdb}Engine, taking over bits of the current DebuggerEngine
base that are not applicable to non-binary debuggers.
Change-Id: I9994f4c188379b4aee0c4f379edd4759fbb0bd43
Reviewed-by: Christian Stenger <christian.stenger@qt.io>
Reviewed-by: hjk <hjk@qt.io>
2018-07-31 12:30:48 +02:00
|
|
|
{
|
2019-03-22 07:35:48 +01:00
|
|
|
QTC_ASSERT(theMainWindow, return);
|
|
|
|
|
|
2019-09-16 15:06:43 +02:00
|
|
|
theMainWindow->savePersistentSettings();
|
|
|
|
|
|
2018-08-21 12:30:00 +02:00
|
|
|
delete theMainWindow;
|
|
|
|
|
theMainWindow = nullptr;
|
Debugger: Make most views per-engine instead of singletons
This is a step towards properly supporting multiple debugger
sessions side-by-side.
The combined C++-and-QML engine has been removed, instead a
combined setup creates now two individual engines, under a single
DebuggerRunTool but mostly independent with no combined state
machine. This requires a few more clicks in some cases, but
makes it easier to direct e.g. interrupt requests to the
interesting engine.
Care has been taken to not change the UX of the single debugger
session use case if possible. The fat debug button operates
as-before in that case, i.e. switches to Interrupt if the
single active runconfiguration runs in the debugger etc.
Most views are made per-engine, running an engine creates
a new Perspective, which is destroyed when the run control dies.
The snapshot view remains global and becomes primary source
of information on a "current engine" that receives all menu
and otherwise global input.
There is a new global "Breakpoint Preset" view containing
all "static" breakpoint data. When an engine starts up it
"claims" breakpoint it believes it can handle, but operates
on a copy of the static data. The markers of the static
version are suppressed as long as an engine controls a
breakpoint (that inclusive all resolved locations), but are
re-instatet once the engine quits.
The old Breakpoint class that already contained this split
per-instance was split into a new Breakpoint and a
GlobalBreakpoint class, with a per-engine model for Breakpoints,
and a singleton model containing GlobalBreakpoints.
There is a new CppDebuggerEngine intermediate level serving as
base for C++ (or, rather, "compiled") binary debugging, i.e.
{Gdb,Lldb,Cdb}Engine, taking over bits of the current DebuggerEngine
base that are not applicable to non-binary debuggers.
Change-Id: I9994f4c188379b4aee0c4f379edd4759fbb0bd43
Reviewed-by: Christian Stenger <christian.stenger@qt.io>
Reviewed-by: hjk <hjk@qt.io>
2018-07-31 12:30:48 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void DebuggerMainWindowPrivate::registerPerspective(Perspective *perspective)
|
2016-03-01 07:51:06 +01:00
|
|
|
{
|
2018-08-22 13:08:49 +02:00
|
|
|
QString parentPerspective = perspective->d->m_parentPerspectiveId;
|
|
|
|
|
// Add only "main" perspectives to the chooser.
|
2018-09-04 13:29:15 +02:00
|
|
|
if (parentPerspective.isEmpty())
|
|
|
|
|
m_perspectiveChooser->addItem(perspective->d->m_name, perspective->d->m_id);
|
|
|
|
|
m_perspectives.append(perspective);
|
2016-03-01 07:51:06 +01:00
|
|
|
}
|
|
|
|
|
|
Debugger: Make most views per-engine instead of singletons
This is a step towards properly supporting multiple debugger
sessions side-by-side.
The combined C++-and-QML engine has been removed, instead a
combined setup creates now two individual engines, under a single
DebuggerRunTool but mostly independent with no combined state
machine. This requires a few more clicks in some cases, but
makes it easier to direct e.g. interrupt requests to the
interesting engine.
Care has been taken to not change the UX of the single debugger
session use case if possible. The fat debug button operates
as-before in that case, i.e. switches to Interrupt if the
single active runconfiguration runs in the debugger etc.
Most views are made per-engine, running an engine creates
a new Perspective, which is destroyed when the run control dies.
The snapshot view remains global and becomes primary source
of information on a "current engine" that receives all menu
and otherwise global input.
There is a new global "Breakpoint Preset" view containing
all "static" breakpoint data. When an engine starts up it
"claims" breakpoint it believes it can handle, but operates
on a copy of the static data. The markers of the static
version are suppressed as long as an engine controls a
breakpoint (that inclusive all resolved locations), but are
re-instatet once the engine quits.
The old Breakpoint class that already contained this split
per-instance was split into a new Breakpoint and a
GlobalBreakpoint class, with a per-engine model for Breakpoints,
and a singleton model containing GlobalBreakpoints.
There is a new CppDebuggerEngine intermediate level serving as
base for C++ (or, rather, "compiled") binary debugging, i.e.
{Gdb,Lldb,Cdb}Engine, taking over bits of the current DebuggerEngine
base that are not applicable to non-binary debuggers.
Change-Id: I9994f4c188379b4aee0c4f379edd4759fbb0bd43
Reviewed-by: Christian Stenger <christian.stenger@qt.io>
Reviewed-by: hjk <hjk@qt.io>
2018-07-31 12:30:48 +02:00
|
|
|
void DebuggerMainWindowPrivate::destroyPerspective(Perspective *perspective)
|
2018-07-24 14:28:31 +02:00
|
|
|
{
|
2019-03-22 07:35:48 +01:00
|
|
|
qCDebug(perspectivesLog) << "ABOUT TO DESTROY PERSPECTIVE" << perspective->id();
|
|
|
|
|
|
|
|
|
|
const bool wasCurrent = perspective == m_currentPerspective;
|
|
|
|
|
if (wasCurrent) {
|
|
|
|
|
qCDebug(perspectivesLog) << "RAMPING IT DOWN FIRST AS IT WAS CURRENT" << perspective->id();
|
|
|
|
|
perspective->rampDownAsCurrent();
|
2018-09-04 13:29:15 +02:00
|
|
|
}
|
|
|
|
|
|
2018-08-01 17:33:41 +02:00
|
|
|
m_perspectives.removeAll(perspective);
|
Debugger: Make most views per-engine instead of singletons
This is a step towards properly supporting multiple debugger
sessions side-by-side.
The combined C++-and-QML engine has been removed, instead a
combined setup creates now two individual engines, under a single
DebuggerRunTool but mostly independent with no combined state
machine. This requires a few more clicks in some cases, but
makes it easier to direct e.g. interrupt requests to the
interesting engine.
Care has been taken to not change the UX of the single debugger
session use case if possible. The fat debug button operates
as-before in that case, i.e. switches to Interrupt if the
single active runconfiguration runs in the debugger etc.
Most views are made per-engine, running an engine creates
a new Perspective, which is destroyed when the run control dies.
The snapshot view remains global and becomes primary source
of information on a "current engine" that receives all menu
and otherwise global input.
There is a new global "Breakpoint Preset" view containing
all "static" breakpoint data. When an engine starts up it
"claims" breakpoint it believes it can handle, but operates
on a copy of the static data. The markers of the static
version are suppressed as long as an engine controls a
breakpoint (that inclusive all resolved locations), but are
re-instatet once the engine quits.
The old Breakpoint class that already contained this split
per-instance was split into a new Breakpoint and a
GlobalBreakpoint class, with a per-engine model for Breakpoints,
and a singleton model containing GlobalBreakpoints.
There is a new CppDebuggerEngine intermediate level serving as
base for C++ (or, rather, "compiled") binary debugging, i.e.
{Gdb,Lldb,Cdb}Engine, taking over bits of the current DebuggerEngine
base that are not applicable to non-binary debuggers.
Change-Id: I9994f4c188379b4aee0c4f379edd4759fbb0bd43
Reviewed-by: Christian Stenger <christian.stenger@qt.io>
Reviewed-by: hjk <hjk@qt.io>
2018-07-31 12:30:48 +02:00
|
|
|
|
2018-07-24 14:28:31 +02:00
|
|
|
// Dynamic perspectives are currently not visible in the chooser.
|
|
|
|
|
// This might change in the future, make sure we notice.
|
2018-08-01 17:33:41 +02:00
|
|
|
const int idx = indexInChooser(perspective);
|
2018-08-21 12:30:00 +02:00
|
|
|
if (idx != -1)
|
|
|
|
|
m_perspectiveChooser->removeItem(idx);
|
2019-03-22 07:35:48 +01:00
|
|
|
|
|
|
|
|
for (DockOperation &op : perspective->d->m_dockOperations) {
|
|
|
|
|
if (op.commandId.isValid())
|
2019-09-16 15:06:43 +02:00
|
|
|
ActionManager::unregisterAction(op.toggleViewAction, op.commandId);
|
2019-03-22 07:35:48 +01:00
|
|
|
if (op.dock) {
|
|
|
|
|
theMainWindow->removeDockWidget(op.dock);
|
|
|
|
|
op.widget->setParent(nullptr); // Prevent deletion
|
|
|
|
|
op.dock->setParent(nullptr);
|
|
|
|
|
delete op.dock;
|
|
|
|
|
op.dock = nullptr;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (wasCurrent) {
|
|
|
|
|
if (Perspective *parent = Perspective::findPerspective(perspective->d->m_parentPerspectiveId)) {
|
|
|
|
|
qCDebug(perspectivesLog) << "RAMPING UP PARENT PERSPECTIVE" << parent->id();
|
|
|
|
|
parent->rampUpAsCurrent();
|
|
|
|
|
} else {
|
|
|
|
|
qCDebug(perspectivesLog) << "RAMPED DOWN WAS ACTION, BUT NO PARENT AVAILABLE. TAKE FIRST BEST";
|
|
|
|
|
if (QTC_GUARD(!m_perspectives.isEmpty()))
|
|
|
|
|
m_perspectives.first()->rampUpAsCurrent();
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
qCDebug(perspectivesLog) << "DESTROYED PERSPECTIVE" << perspective->id();
|
2018-07-24 14:28:31 +02:00
|
|
|
}
|
|
|
|
|
|
2016-03-02 13:57:37 +01:00
|
|
|
void DebuggerMainWindow::showStatusMessage(const QString &message, int timeoutMS)
|
2016-02-29 18:15:36 +01:00
|
|
|
{
|
2018-08-21 12:30:00 +02:00
|
|
|
if (theMainWindow)
|
|
|
|
|
theMainWindow->d->m_statusLabel->showStatusMessage(message, timeoutMS);
|
2018-08-01 17:33:41 +02:00
|
|
|
}
|
|
|
|
|
|
2019-03-14 12:21:47 +01:00
|
|
|
void DebuggerMainWindow::enterDebugMode()
|
2016-08-26 13:33:30 +02:00
|
|
|
{
|
2019-03-14 12:21:47 +01:00
|
|
|
theMainWindow->setDockActionsVisible(true);
|
2019-03-22 07:35:48 +01:00
|
|
|
QTC_CHECK(theMainWindow->d->m_currentPerspective == nullptr);
|
2019-09-16 15:06:43 +02:00
|
|
|
if (theMainWindow->d->needRestoreOnModeEnter)
|
|
|
|
|
theMainWindow->restorePersistentSettings();
|
2019-03-22 07:35:48 +01:00
|
|
|
|
|
|
|
|
QSettings *settings = ICore::settings();
|
|
|
|
|
const QString lastPerspectiveId = settings->value(LAST_PERSPECTIVE_KEY).toString();
|
|
|
|
|
Perspective *perspective = Perspective::findPerspective(lastPerspectiveId);
|
|
|
|
|
// If we don't find a perspective with the stored name, pick any.
|
|
|
|
|
// This can happen e.g. when a plugin was disabled that provided
|
|
|
|
|
// the stored perspective, or when the save file was modified externally.
|
|
|
|
|
if (!perspective && !theMainWindow->d->m_perspectives.isEmpty())
|
|
|
|
|
perspective = theMainWindow->d->m_perspectives.first();
|
|
|
|
|
|
2019-03-14 12:21:47 +01:00
|
|
|
// There's at least the debugger preset perspective that should be found above.
|
|
|
|
|
QTC_ASSERT(perspective, return);
|
2019-03-22 07:35:48 +01:00
|
|
|
|
|
|
|
|
if (auto sub = Perspective::findPerspective(perspective->d->m_lastActiveSubPerspectiveId)) {
|
|
|
|
|
qCDebug(perspectivesLog) << "SWITCHING TO SUBPERSPECTIVE" << sub->d->m_id;
|
|
|
|
|
perspective = sub;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
perspective->rampUpAsCurrent();
|
2019-03-14 12:21:47 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void DebuggerMainWindow::leaveDebugMode()
|
|
|
|
|
{
|
2019-09-16 15:06:43 +02:00
|
|
|
theMainWindow->d->needRestoreOnModeEnter = true;
|
2019-03-22 07:35:48 +01:00
|
|
|
theMainWindow->savePersistentSettings();
|
|
|
|
|
|
|
|
|
|
if (theMainWindow->d->m_currentPerspective)
|
|
|
|
|
theMainWindow->d->m_currentPerspective->rampDownAsCurrent();
|
|
|
|
|
QTC_CHECK(theMainWindow->d->m_currentPerspective == nullptr);
|
2019-03-14 12:21:47 +01:00
|
|
|
|
|
|
|
|
theMainWindow->setDockActionsVisible(false);
|
|
|
|
|
|
|
|
|
|
// Hide dock widgets manually in case they are floating.
|
|
|
|
|
for (QDockWidget *dockWidget : theMainWindow->dockWidgets()) {
|
|
|
|
|
if (dockWidget->isFloating())
|
2019-03-22 07:35:48 +01:00
|
|
|
dockWidget->setVisible(false);
|
2016-08-26 13:33:30 +02:00
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2019-03-22 07:35:48 +01:00
|
|
|
void DebuggerMainWindow::restorePersistentSettings()
|
|
|
|
|
{
|
2019-09-16 15:06:43 +02:00
|
|
|
qCDebug(perspectivesLog) << "RESTORE ALL PERSPECTIVES";
|
2019-03-22 07:35:48 +01:00
|
|
|
QSettings *settings = ICore::settings();
|
|
|
|
|
settings->beginGroup(MAINWINDOW_KEY);
|
2019-06-03 08:48:33 +02:00
|
|
|
|
2019-12-09 15:12:55 +01:00
|
|
|
// state2 is current, state is kept for upgradeing from <=4.10
|
|
|
|
|
const QHash<QString, QVariant> states2 = settings->value(STATE_KEY2).toHash();
|
2019-06-03 08:48:33 +02:00
|
|
|
const QHash<QString, QVariant> states = settings->value(STATE_KEY).toHash();
|
2019-09-16 15:06:43 +02:00
|
|
|
d->m_lastTypePerspectiveStates.clear();
|
2019-12-09 15:12:55 +01:00
|
|
|
QSet<QString> keys = Utils::toSet(states2.keys());
|
|
|
|
|
keys.unite(Utils::toSet(states.keys()));
|
|
|
|
|
for (const QString &type : keys) {
|
|
|
|
|
PerspectiveState state = states2.value(type).value<PerspectiveState>();
|
|
|
|
|
if (state.mainWindowState.isEmpty())
|
|
|
|
|
state.mainWindowState = states.value(type).toByteArray();
|
|
|
|
|
QTC_ASSERT(!state.mainWindowState.isEmpty(), continue);
|
2019-09-16 15:06:43 +02:00
|
|
|
d->m_lastTypePerspectiveStates.insert(type, state);
|
|
|
|
|
}
|
2019-03-22 07:35:48 +01:00
|
|
|
|
2019-09-16 15:06:43 +02:00
|
|
|
setAutoHideTitleBars(settings->value(AUTOHIDE_TITLEBARS_KEY, true).toBool());
|
|
|
|
|
showCentralWidget(settings->value(SHOW_CENTRALWIDGET_KEY, true).toBool());
|
|
|
|
|
d->m_persistentChangedDocks = Utils::toSet(settings->value(CHANGED_DOCK_KEY).toStringList());
|
|
|
|
|
settings->endGroup();
|
2019-03-22 07:35:48 +01:00
|
|
|
|
2019-09-16 15:06:43 +02:00
|
|
|
qCDebug(perspectivesLog) << "LOADED CHANGED DOCKS:" << d->m_persistentChangedDocks;
|
2019-03-22 07:35:48 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
Perspective *DebuggerMainWindow::currentPerspective()
|
|
|
|
|
{
|
|
|
|
|
return theMainWindow->d->m_currentPerspective;
|
|
|
|
|
}
|
|
|
|
|
|
2019-09-16 15:06:43 +02:00
|
|
|
void DebuggerMainWindow::savePersistentSettings() const
|
2019-03-22 07:35:48 +01:00
|
|
|
{
|
|
|
|
|
// The current one might have active, non saved changes.
|
2019-09-16 15:06:43 +02:00
|
|
|
if (Perspective *perspective = d->m_currentPerspective)
|
2019-03-22 07:35:48 +01:00
|
|
|
perspective->d->saveLayout();
|
|
|
|
|
|
2019-06-03 08:48:33 +02:00
|
|
|
QVariantHash states;
|
2019-09-16 15:06:43 +02:00
|
|
|
qCDebug(perspectivesLog) << "PERSPECTIVE TYPES: " << d->m_lastTypePerspectiveStates.keys();
|
2020-12-08 15:41:46 +01:00
|
|
|
for (auto it = d->m_lastTypePerspectiveStates.cbegin();
|
|
|
|
|
it != d->m_lastTypePerspectiveStates.cend(); ++it) {
|
|
|
|
|
const QString &type = it.key();
|
|
|
|
|
const PerspectiveState &state = it.value();
|
2019-12-09 15:12:55 +01:00
|
|
|
qCDebug(perspectivesLog) << "PERSPECTIVE TYPE " << type
|
|
|
|
|
<< " HAS STATE: " << !state.mainWindowState.isEmpty();
|
|
|
|
|
QTC_ASSERT(!state.mainWindowState.isEmpty(), continue);
|
|
|
|
|
states.insert(type, QVariant::fromValue(state));
|
2019-09-16 15:06:43 +02:00
|
|
|
}
|
2019-06-03 08:48:33 +02:00
|
|
|
|
2019-03-22 07:35:48 +01:00
|
|
|
QSettings *settings = ICore::settings();
|
|
|
|
|
settings->beginGroup(MAINWINDOW_KEY);
|
2019-09-16 15:06:43 +02:00
|
|
|
settings->setValue(CHANGED_DOCK_KEY, QStringList(Utils::toList(d->m_persistentChangedDocks)));
|
2019-12-09 15:12:55 +01:00
|
|
|
settings->setValue(STATE_KEY2, states);
|
2019-09-16 15:06:43 +02:00
|
|
|
settings->setValue(AUTOHIDE_TITLEBARS_KEY, autoHideTitleBars());
|
|
|
|
|
settings->setValue(SHOW_CENTRALWIDGET_KEY, isCentralWidgetShown());
|
2019-03-22 07:35:48 +01:00
|
|
|
settings->endGroup();
|
2019-09-16 15:06:43 +02:00
|
|
|
|
|
|
|
|
qCDebug(perspectivesLog) << "SAVED CHANGED DOCKS:" << d->m_persistentChangedDocks;
|
2019-03-22 07:35:48 +01:00
|
|
|
}
|
|
|
|
|
|
Debugger: Make most views per-engine instead of singletons
This is a step towards properly supporting multiple debugger
sessions side-by-side.
The combined C++-and-QML engine has been removed, instead a
combined setup creates now two individual engines, under a single
DebuggerRunTool but mostly independent with no combined state
machine. This requires a few more clicks in some cases, but
makes it easier to direct e.g. interrupt requests to the
interesting engine.
Care has been taken to not change the UX of the single debugger
session use case if possible. The fat debug button operates
as-before in that case, i.e. switches to Interrupt if the
single active runconfiguration runs in the debugger etc.
Most views are made per-engine, running an engine creates
a new Perspective, which is destroyed when the run control dies.
The snapshot view remains global and becomes primary source
of information on a "current engine" that receives all menu
and otherwise global input.
There is a new global "Breakpoint Preset" view containing
all "static" breakpoint data. When an engine starts up it
"claims" breakpoint it believes it can handle, but operates
on a copy of the static data. The markers of the static
version are suppressed as long as an engine controls a
breakpoint (that inclusive all resolved locations), but are
re-instatet once the engine quits.
The old Breakpoint class that already contained this split
per-instance was split into a new Breakpoint and a
GlobalBreakpoint class, with a per-engine model for Breakpoints,
and a singleton model containing GlobalBreakpoints.
There is a new CppDebuggerEngine intermediate level serving as
base for C++ (or, rather, "compiled") binary debugging, i.e.
{Gdb,Lldb,Cdb}Engine, taking over bits of the current DebuggerEngine
base that are not applicable to non-binary debuggers.
Change-Id: I9994f4c188379b4aee0c4f379edd4759fbb0bd43
Reviewed-by: Christian Stenger <christian.stenger@qt.io>
Reviewed-by: hjk <hjk@qt.io>
2018-07-31 12:30:48 +02:00
|
|
|
QWidget *DebuggerMainWindow::centralWidgetStack()
|
|
|
|
|
{
|
2018-08-21 12:30:00 +02:00
|
|
|
return theMainWindow ? theMainWindow->d->m_centralWidgetStack : nullptr;
|
|
|
|
|
}
|
|
|
|
|
|
2018-09-19 08:16:20 +02:00
|
|
|
void DebuggerMainWindow::addSubPerspectiveSwitcher(QWidget *widget)
|
2018-09-11 11:24:19 +02:00
|
|
|
{
|
|
|
|
|
widget->setVisible(false);
|
|
|
|
|
widget->setProperty("panelwidget", true);
|
|
|
|
|
d->m_subPerspectiveSwitcherLayout->addWidget(widget);
|
|
|
|
|
}
|
|
|
|
|
|
2020-06-16 15:56:47 +02:00
|
|
|
QMenu *DebuggerMainWindow::perspectiveMenu()
|
|
|
|
|
{
|
|
|
|
|
return theMainWindow ? theMainWindow->d->m_perspectiveMenu : nullptr;
|
|
|
|
|
}
|
|
|
|
|
|
2018-08-21 12:30:00 +02:00
|
|
|
DebuggerMainWindow *DebuggerMainWindow::instance()
|
|
|
|
|
{
|
|
|
|
|
return theMainWindow;
|
Debugger: Make most views per-engine instead of singletons
This is a step towards properly supporting multiple debugger
sessions side-by-side.
The combined C++-and-QML engine has been removed, instead a
combined setup creates now two individual engines, under a single
DebuggerRunTool but mostly independent with no combined state
machine. This requires a few more clicks in some cases, but
makes it easier to direct e.g. interrupt requests to the
interesting engine.
Care has been taken to not change the UX of the single debugger
session use case if possible. The fat debug button operates
as-before in that case, i.e. switches to Interrupt if the
single active runconfiguration runs in the debugger etc.
Most views are made per-engine, running an engine creates
a new Perspective, which is destroyed when the run control dies.
The snapshot view remains global and becomes primary source
of information on a "current engine" that receives all menu
and otherwise global input.
There is a new global "Breakpoint Preset" view containing
all "static" breakpoint data. When an engine starts up it
"claims" breakpoint it believes it can handle, but operates
on a copy of the static data. The markers of the static
version are suppressed as long as an engine controls a
breakpoint (that inclusive all resolved locations), but are
re-instatet once the engine quits.
The old Breakpoint class that already contained this split
per-instance was split into a new Breakpoint and a
GlobalBreakpoint class, with a per-engine model for Breakpoints,
and a singleton model containing GlobalBreakpoints.
There is a new CppDebuggerEngine intermediate level serving as
base for C++ (or, rather, "compiled") binary debugging, i.e.
{Gdb,Lldb,Cdb}Engine, taking over bits of the current DebuggerEngine
base that are not applicable to non-binary debuggers.
Change-Id: I9994f4c188379b4aee0c4f379edd4759fbb0bd43
Reviewed-by: Christian Stenger <christian.stenger@qt.io>
Reviewed-by: hjk <hjk@qt.io>
2018-07-31 12:30:48 +02:00
|
|
|
}
|
|
|
|
|
|
2018-08-22 10:53:34 +02:00
|
|
|
Perspective *Perspective::findPerspective(const QString &perspectiveId)
|
2018-08-01 17:33:41 +02:00
|
|
|
{
|
2019-03-22 07:35:48 +01:00
|
|
|
QTC_ASSERT(theMainWindow, return nullptr);
|
|
|
|
|
return Utils::findOr(theMainWindow->d->m_perspectives, nullptr,
|
|
|
|
|
[perspectiveId](Perspective *perspective) {
|
|
|
|
|
return perspective && perspective->d->m_id == perspectiveId;
|
2018-08-01 17:33:41 +02:00
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
|
2019-03-22 07:35:48 +01:00
|
|
|
bool Perspective::isCurrent() const
|
2016-02-29 18:15:36 +01:00
|
|
|
{
|
2019-03-22 07:35:48 +01:00
|
|
|
return theMainWindow->d->m_currentPerspective == this;
|
2016-03-01 07:51:06 +01:00
|
|
|
}
|
2016-02-29 18:15:36 +01:00
|
|
|
|
2019-03-22 07:35:48 +01:00
|
|
|
QDockWidget *DebuggerMainWindowPrivate::dockForWidget(QWidget *widget) const
|
2016-03-01 07:51:06 +01:00
|
|
|
{
|
2019-03-22 07:35:48 +01:00
|
|
|
QTC_ASSERT(widget, return nullptr);
|
|
|
|
|
|
|
|
|
|
for (QDockWidget *dock : q->dockWidgets()) {
|
|
|
|
|
if (dock->widget() == widget)
|
|
|
|
|
return dock;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return nullptr;
|
2018-08-01 17:33:41 +02:00
|
|
|
}
|
2016-03-02 13:57:37 +01:00
|
|
|
|
2019-03-22 07:35:48 +01:00
|
|
|
void DebuggerMainWindowPrivate::resetCurrentPerspective()
|
2018-11-21 09:01:32 +01:00
|
|
|
{
|
2019-03-22 07:35:48 +01:00
|
|
|
QTC_ASSERT(m_currentPerspective, return);
|
|
|
|
|
cleanDocks();
|
|
|
|
|
setCentralWidget(m_currentPerspective->d->m_centralWidget);
|
2021-02-09 11:21:38 +01:00
|
|
|
q->showCentralWidget(true);
|
|
|
|
|
m_currentPerspective->d->resetPerspective();
|
2019-03-22 07:35:48 +01:00
|
|
|
}
|
2018-11-21 09:01:32 +01:00
|
|
|
|
2019-03-22 07:35:48 +01:00
|
|
|
void DebuggerMainWindowPrivate::setCentralWidget(QWidget *widget)
|
|
|
|
|
{
|
|
|
|
|
if (widget) {
|
|
|
|
|
m_centralWidgetStack->addWidget(widget);
|
|
|
|
|
q->showCentralWidgetAction()->setText(widget->windowTitle());
|
|
|
|
|
} else {
|
|
|
|
|
m_centralWidgetStack->addWidget(m_editorPlaceHolder);
|
|
|
|
|
q->showCentralWidgetAction()->setText(DebuggerMainWindow::tr("Editor"));
|
2019-01-24 15:04:47 +01:00
|
|
|
}
|
2018-11-21 09:01:32 +01:00
|
|
|
}
|
|
|
|
|
|
2019-03-22 07:35:48 +01:00
|
|
|
void PerspectivePrivate::resetPerspective()
|
2018-08-01 17:33:41 +02:00
|
|
|
{
|
2019-03-22 07:35:48 +01:00
|
|
|
showInnerToolBar();
|
2018-08-22 13:08:49 +02:00
|
|
|
|
2019-03-22 07:35:48 +01:00
|
|
|
for (DockOperation &op : m_dockOperations) {
|
2019-09-16 15:06:43 +02:00
|
|
|
if (!op.dock) {
|
|
|
|
|
qCDebug(perspectivesLog) << "RESET UNUSED " << op.name();
|
|
|
|
|
} else if (op.operationType == Perspective::Raise) {
|
2019-03-22 07:35:48 +01:00
|
|
|
QTC_ASSERT(op.dock, qCDebug(perspectivesLog) << op.name(); continue);
|
|
|
|
|
op.dock->raise();
|
|
|
|
|
} else {
|
|
|
|
|
op.setupLayout();
|
|
|
|
|
op.dock->setVisible(op.visibleByDefault);
|
2019-09-25 14:57:15 +02:00
|
|
|
theMainWindow->d->m_persistentChangedDocks.remove(op.name());
|
2019-03-22 07:35:48 +01:00
|
|
|
qCDebug(perspectivesLog) << "SETTING " << op.name()
|
|
|
|
|
<< " TO ACTIVE: " << op.visibleByDefault;
|
|
|
|
|
}
|
2018-09-04 13:29:15 +02:00
|
|
|
}
|
2019-03-22 07:35:48 +01:00
|
|
|
}
|
2018-09-04 13:29:15 +02:00
|
|
|
|
2019-03-22 07:35:48 +01:00
|
|
|
void DockOperation::setupLayout()
|
|
|
|
|
{
|
|
|
|
|
QTC_ASSERT(widget, return);
|
|
|
|
|
QTC_ASSERT(operationType != Perspective::Raise, return);
|
|
|
|
|
QTC_ASSERT(dock, return);
|
2018-08-22 13:08:49 +02:00
|
|
|
|
2019-03-22 07:35:48 +01:00
|
|
|
QDockWidget *anchor = nullptr;
|
|
|
|
|
if (anchorWidget)
|
|
|
|
|
anchor = theMainWindow->d->dockForWidget(anchorWidget);
|
|
|
|
|
else if (area == Qt::BottomDockWidgetArea)
|
|
|
|
|
anchor = theMainWindow->d->m_toolBarDock;
|
|
|
|
|
|
|
|
|
|
if (anchor) {
|
|
|
|
|
switch (operationType) {
|
|
|
|
|
case Perspective::AddToTab:
|
|
|
|
|
theMainWindow->tabifyDockWidget(anchor, dock);
|
|
|
|
|
break;
|
|
|
|
|
case Perspective::SplitHorizontal:
|
|
|
|
|
theMainWindow->splitDockWidget(anchor, dock, Qt::Horizontal);
|
|
|
|
|
break;
|
|
|
|
|
case Perspective::SplitVertical:
|
|
|
|
|
theMainWindow->splitDockWidget(anchor, dock, Qt::Vertical);
|
|
|
|
|
break;
|
|
|
|
|
default:
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
} else {
|
|
|
|
|
theMainWindow->addDockWidget(area, dock);
|
2018-11-21 09:01:32 +01:00
|
|
|
}
|
2019-03-22 07:35:48 +01:00
|
|
|
}
|
2018-08-01 17:33:41 +02:00
|
|
|
|
2019-09-16 15:06:43 +02:00
|
|
|
void DockOperation::ensureDockExists()
|
|
|
|
|
{
|
|
|
|
|
if (dock)
|
|
|
|
|
return;
|
|
|
|
|
|
|
|
|
|
dock = theMainWindow->addDockForWidget(widget);
|
|
|
|
|
|
|
|
|
|
if (theMainWindow->restoreDockWidget(dock)) {
|
|
|
|
|
qCDebug(perspectivesLog) << "RESTORED SUCCESSFULLY" << commandId;
|
|
|
|
|
} else {
|
|
|
|
|
qCDebug(perspectivesLog) << "COULD NOT RESTORE" << commandId;
|
|
|
|
|
setupLayout();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
toggleViewAction->setAction(dock->toggleViewAction());
|
|
|
|
|
|
|
|
|
|
QObject::connect(dock->toggleViewAction(), &QAction::triggered,
|
|
|
|
|
dock->toggleViewAction(), [this] { recordVisibility(); });
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
bool DockOperation::changedByUser() const
|
|
|
|
|
{
|
|
|
|
|
return theMainWindow->d->m_persistentChangedDocks.contains(name());
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void DockOperation::recordVisibility()
|
|
|
|
|
{
|
|
|
|
|
if (operationType != Perspective::Raise) {
|
|
|
|
|
if (toggleViewAction->isChecked() == visibleByDefault)
|
|
|
|
|
theMainWindow->d->m_persistentChangedDocks.remove(name());
|
|
|
|
|
else
|
|
|
|
|
theMainWindow->d->m_persistentChangedDocks.insert(name());
|
|
|
|
|
}
|
|
|
|
|
qCDebug(perspectivesLog) << "RECORDING DOCK VISIBILITY " << name()
|
|
|
|
|
<< toggleViewAction->isChecked()
|
|
|
|
|
<< theMainWindow->d->m_persistentChangedDocks;
|
|
|
|
|
}
|
|
|
|
|
|
2019-03-22 07:35:48 +01:00
|
|
|
int DebuggerMainWindowPrivate::indexInChooser(Perspective *perspective) const
|
|
|
|
|
{
|
|
|
|
|
return perspective ? m_perspectiveChooser->findData(perspective->d->m_id) : -1;
|
2019-02-20 17:35:03 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void DebuggerMainWindowPrivate::updatePerspectiveChooserWidth()
|
|
|
|
|
{
|
|
|
|
|
Perspective *perspective = m_currentPerspective;
|
2018-11-27 14:24:14 +01:00
|
|
|
int index = indexInChooser(m_currentPerspective);
|
|
|
|
|
if (index == -1) {
|
2019-02-20 17:35:03 +01:00
|
|
|
perspective = Perspective::findPerspective(m_currentPerspective->d->m_parentPerspectiveId);
|
|
|
|
|
if (perspective)
|
|
|
|
|
index = indexInChooser(perspective);
|
2018-11-27 14:24:14 +01:00
|
|
|
}
|
|
|
|
|
|
2018-09-04 13:29:15 +02:00
|
|
|
if (index != -1) {
|
2016-03-02 13:57:37 +01:00
|
|
|
m_perspectiveChooser->setCurrentIndex(index);
|
Debugger: Make most views per-engine instead of singletons
This is a step towards properly supporting multiple debugger
sessions side-by-side.
The combined C++-and-QML engine has been removed, instead a
combined setup creates now two individual engines, under a single
DebuggerRunTool but mostly independent with no combined state
machine. This requires a few more clicks in some cases, but
makes it easier to direct e.g. interrupt requests to the
interesting engine.
Care has been taken to not change the UX of the single debugger
session use case if possible. The fat debug button operates
as-before in that case, i.e. switches to Interrupt if the
single active runconfiguration runs in the debugger etc.
Most views are made per-engine, running an engine creates
a new Perspective, which is destroyed when the run control dies.
The snapshot view remains global and becomes primary source
of information on a "current engine" that receives all menu
and otherwise global input.
There is a new global "Breakpoint Preset" view containing
all "static" breakpoint data. When an engine starts up it
"claims" breakpoint it believes it can handle, but operates
on a copy of the static data. The markers of the static
version are suppressed as long as an engine controls a
breakpoint (that inclusive all resolved locations), but are
re-instatet once the engine quits.
The old Breakpoint class that already contained this split
per-instance was split into a new Breakpoint and a
GlobalBreakpoint class, with a per-engine model for Breakpoints,
and a singleton model containing GlobalBreakpoints.
There is a new CppDebuggerEngine intermediate level serving as
base for C++ (or, rather, "compiled") binary debugging, i.e.
{Gdb,Lldb,Cdb}Engine, taking over bits of the current DebuggerEngine
base that are not applicable to non-binary debuggers.
Change-Id: I9994f4c188379b4aee0c4f379edd4759fbb0bd43
Reviewed-by: Christian Stenger <christian.stenger@qt.io>
Reviewed-by: hjk <hjk@qt.io>
2018-07-31 12:30:48 +02:00
|
|
|
|
2019-02-11 10:32:46 +01:00
|
|
|
const int contentWidth =
|
|
|
|
|
m_perspectiveChooser->fontMetrics().horizontalAdvance(perspective->d->m_name);
|
2018-09-04 13:29:15 +02:00
|
|
|
QStyleOptionComboBox option;
|
|
|
|
|
option.initFrom(m_perspectiveChooser);
|
|
|
|
|
const QSize sz(contentWidth, 1);
|
|
|
|
|
const int width = m_perspectiveChooser->style()->sizeFromContents(
|
|
|
|
|
QStyle::CT_ComboBox, &option, sz).width();
|
|
|
|
|
m_perspectiveChooser->setFixedWidth(width);
|
|
|
|
|
}
|
2016-03-24 13:59:05 +01:00
|
|
|
}
|
2016-03-10 08:53:49 +01:00
|
|
|
|
2019-03-22 07:35:48 +01:00
|
|
|
void DebuggerMainWindowPrivate::cleanDocks()
|
2016-03-02 13:57:37 +01:00
|
|
|
{
|
2019-03-22 07:35:48 +01:00
|
|
|
m_statusLabel->clear();
|
|
|
|
|
|
2018-08-22 13:08:49 +02:00
|
|
|
for (QDockWidget *dock : q->dockWidgets()) {
|
2019-03-22 07:35:48 +01:00
|
|
|
if (dock != m_toolBarDock)
|
|
|
|
|
dock->setVisible(false);
|
2018-08-22 13:08:49 +02:00
|
|
|
}
|
2019-03-22 07:35:48 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void PerspectivePrivate::depopulatePerspective()
|
|
|
|
|
{
|
|
|
|
|
ICore::removeAdditionalContext(context());
|
|
|
|
|
theMainWindow->d->m_centralWidgetStack
|
|
|
|
|
->removeWidget(m_centralWidget ? m_centralWidget : theMainWindow->d->m_editorPlaceHolder);
|
2016-03-02 13:57:37 +01:00
|
|
|
|
2019-03-22 07:35:48 +01:00
|
|
|
theMainWindow->d->m_statusLabel->clear();
|
|
|
|
|
|
2019-09-16 15:06:43 +02:00
|
|
|
qCDebug(perspectivesLog) << "DEPOPULATE PERSPECTIVE" << m_id;
|
2019-03-22 07:35:48 +01:00
|
|
|
for (QDockWidget *dock : theMainWindow->dockWidgets()) {
|
|
|
|
|
if (dock != theMainWindow->d->m_toolBarDock)
|
|
|
|
|
dock->setVisible(false);
|
2018-08-01 17:33:41 +02:00
|
|
|
}
|
2019-03-22 07:35:48 +01:00
|
|
|
|
|
|
|
|
hideInnerToolBar();
|
2018-08-22 13:08:49 +02:00
|
|
|
}
|
2016-03-01 07:51:06 +01:00
|
|
|
|
2019-03-22 07:35:48 +01:00
|
|
|
void PerspectivePrivate::saveAsLastUsedPerspective()
|
|
|
|
|
{
|
|
|
|
|
if (Perspective *parent = Perspective::findPerspective(m_parentPerspectiveId))
|
|
|
|
|
parent->d->m_lastActiveSubPerspectiveId = m_id;
|
|
|
|
|
else
|
|
|
|
|
m_lastActiveSubPerspectiveId.clear();
|
2016-03-02 13:57:37 +01:00
|
|
|
|
2019-03-22 07:35:48 +01:00
|
|
|
const QString &lastKey = m_parentPerspectiveId.isEmpty() ? m_id : m_parentPerspectiveId;
|
2019-09-16 15:06:43 +02:00
|
|
|
qCDebug(perspectivesLog) << "SAVE AS LAST USED PERSPECTIVE" << lastKey;
|
2019-03-22 07:35:48 +01:00
|
|
|
ICore::settings()->setValue(LAST_PERSPECTIVE_KEY, lastKey);
|
|
|
|
|
}
|
2018-11-21 09:01:32 +01:00
|
|
|
|
2019-03-22 07:35:48 +01:00
|
|
|
void PerspectivePrivate::populatePerspective()
|
|
|
|
|
{
|
|
|
|
|
showInnerToolBar();
|
Debugger: Make most views per-engine instead of singletons
This is a step towards properly supporting multiple debugger
sessions side-by-side.
The combined C++-and-QML engine has been removed, instead a
combined setup creates now two individual engines, under a single
DebuggerRunTool but mostly independent with no combined state
machine. This requires a few more clicks in some cases, but
makes it easier to direct e.g. interrupt requests to the
interesting engine.
Care has been taken to not change the UX of the single debugger
session use case if possible. The fat debug button operates
as-before in that case, i.e. switches to Interrupt if the
single active runconfiguration runs in the debugger etc.
Most views are made per-engine, running an engine creates
a new Perspective, which is destroyed when the run control dies.
The snapshot view remains global and becomes primary source
of information on a "current engine" that receives all menu
and otherwise global input.
There is a new global "Breakpoint Preset" view containing
all "static" breakpoint data. When an engine starts up it
"claims" breakpoint it believes it can handle, but operates
on a copy of the static data. The markers of the static
version are suppressed as long as an engine controls a
breakpoint (that inclusive all resolved locations), but are
re-instatet once the engine quits.
The old Breakpoint class that already contained this split
per-instance was split into a new Breakpoint and a
GlobalBreakpoint class, with a per-engine model for Breakpoints,
and a singleton model containing GlobalBreakpoints.
There is a new CppDebuggerEngine intermediate level serving as
base for C++ (or, rather, "compiled") binary debugging, i.e.
{Gdb,Lldb,Cdb}Engine, taking over bits of the current DebuggerEngine
base that are not applicable to non-binary debuggers.
Change-Id: I9994f4c188379b4aee0c4f379edd4759fbb0bd43
Reviewed-by: Christian Stenger <christian.stenger@qt.io>
Reviewed-by: hjk <hjk@qt.io>
2018-07-31 12:30:48 +02:00
|
|
|
|
2019-03-22 07:35:48 +01:00
|
|
|
if (m_centralWidget) {
|
|
|
|
|
theMainWindow->d->m_centralWidgetStack->addWidget(m_centralWidget);
|
|
|
|
|
theMainWindow->showCentralWidgetAction()->setText(m_centralWidget->windowTitle());
|
|
|
|
|
} else {
|
|
|
|
|
theMainWindow->d->m_centralWidgetStack->addWidget(theMainWindow->d->m_editorPlaceHolder);
|
|
|
|
|
theMainWindow->showCentralWidgetAction()->setText(DebuggerMainWindow::tr("Editor"));
|
2016-02-29 18:15:36 +01:00
|
|
|
}
|
|
|
|
|
|
2019-03-22 07:35:48 +01:00
|
|
|
ICore::addAdditionalContext(context());
|
2018-08-22 13:08:49 +02:00
|
|
|
|
2019-03-22 07:35:48 +01:00
|
|
|
restoreLayout();
|
2016-02-29 18:15:36 +01:00
|
|
|
}
|
|
|
|
|
|
2018-08-13 09:34:47 +02:00
|
|
|
// Perspective
|
|
|
|
|
|
2018-09-04 13:29:15 +02:00
|
|
|
Perspective::Perspective(const QString &id, const QString &name,
|
|
|
|
|
const QString &parentPerspectiveId,
|
2019-03-22 07:35:48 +01:00
|
|
|
const QString &settingsId)
|
Debugger: Make most views per-engine instead of singletons
This is a step towards properly supporting multiple debugger
sessions side-by-side.
The combined C++-and-QML engine has been removed, instead a
combined setup creates now two individual engines, under a single
DebuggerRunTool but mostly independent with no combined state
machine. This requires a few more clicks in some cases, but
makes it easier to direct e.g. interrupt requests to the
interesting engine.
Care has been taken to not change the UX of the single debugger
session use case if possible. The fat debug button operates
as-before in that case, i.e. switches to Interrupt if the
single active runconfiguration runs in the debugger etc.
Most views are made per-engine, running an engine creates
a new Perspective, which is destroyed when the run control dies.
The snapshot view remains global and becomes primary source
of information on a "current engine" that receives all menu
and otherwise global input.
There is a new global "Breakpoint Preset" view containing
all "static" breakpoint data. When an engine starts up it
"claims" breakpoint it believes it can handle, but operates
on a copy of the static data. The markers of the static
version are suppressed as long as an engine controls a
breakpoint (that inclusive all resolved locations), but are
re-instatet once the engine quits.
The old Breakpoint class that already contained this split
per-instance was split into a new Breakpoint and a
GlobalBreakpoint class, with a per-engine model for Breakpoints,
and a singleton model containing GlobalBreakpoints.
There is a new CppDebuggerEngine intermediate level serving as
base for C++ (or, rather, "compiled") binary debugging, i.e.
{Gdb,Lldb,Cdb}Engine, taking over bits of the current DebuggerEngine
base that are not applicable to non-binary debuggers.
Change-Id: I9994f4c188379b4aee0c4f379edd4759fbb0bd43
Reviewed-by: Christian Stenger <christian.stenger@qt.io>
Reviewed-by: hjk <hjk@qt.io>
2018-07-31 12:30:48 +02:00
|
|
|
: d(new PerspectivePrivate)
|
2018-08-13 09:34:47 +02:00
|
|
|
{
|
Debugger: Make most views per-engine instead of singletons
This is a step towards properly supporting multiple debugger
sessions side-by-side.
The combined C++-and-QML engine has been removed, instead a
combined setup creates now two individual engines, under a single
DebuggerRunTool but mostly independent with no combined state
machine. This requires a few more clicks in some cases, but
makes it easier to direct e.g. interrupt requests to the
interesting engine.
Care has been taken to not change the UX of the single debugger
session use case if possible. The fat debug button operates
as-before in that case, i.e. switches to Interrupt if the
single active runconfiguration runs in the debugger etc.
Most views are made per-engine, running an engine creates
a new Perspective, which is destroyed when the run control dies.
The snapshot view remains global and becomes primary source
of information on a "current engine" that receives all menu
and otherwise global input.
There is a new global "Breakpoint Preset" view containing
all "static" breakpoint data. When an engine starts up it
"claims" breakpoint it believes it can handle, but operates
on a copy of the static data. The markers of the static
version are suppressed as long as an engine controls a
breakpoint (that inclusive all resolved locations), but are
re-instatet once the engine quits.
The old Breakpoint class that already contained this split
per-instance was split into a new Breakpoint and a
GlobalBreakpoint class, with a per-engine model for Breakpoints,
and a singleton model containing GlobalBreakpoints.
There is a new CppDebuggerEngine intermediate level serving as
base for C++ (or, rather, "compiled") binary debugging, i.e.
{Gdb,Lldb,Cdb}Engine, taking over bits of the current DebuggerEngine
base that are not applicable to non-binary debuggers.
Change-Id: I9994f4c188379b4aee0c4f379edd4759fbb0bd43
Reviewed-by: Christian Stenger <christian.stenger@qt.io>
Reviewed-by: hjk <hjk@qt.io>
2018-07-31 12:30:48 +02:00
|
|
|
d->m_id = id;
|
|
|
|
|
d->m_name = name;
|
2018-08-22 13:08:49 +02:00
|
|
|
d->m_parentPerspectiveId = parentPerspectiveId;
|
2019-03-22 07:35:48 +01:00
|
|
|
d->m_settingsId = settingsId;
|
2018-08-21 12:30:00 +02:00
|
|
|
|
|
|
|
|
DebuggerMainWindow::ensureMainWindowExists();
|
|
|
|
|
theMainWindow->d->registerPerspective(this);
|
2018-09-04 13:29:15 +02:00
|
|
|
|
|
|
|
|
d->m_innerToolBar = new QWidget;
|
|
|
|
|
d->m_innerToolBar->setVisible(false);
|
|
|
|
|
theMainWindow->d->m_innerToolsLayout->addWidget(d->m_innerToolBar);
|
|
|
|
|
|
|
|
|
|
d->m_innerToolBarLayout = new QHBoxLayout(d->m_innerToolBar);
|
2019-08-29 10:36:01 +02:00
|
|
|
d->m_innerToolBarLayout->setContentsMargins(0, 0, 0, 0);
|
2018-09-04 13:29:15 +02:00
|
|
|
d->m_innerToolBarLayout->setSpacing(0);
|
2018-08-13 09:34:47 +02:00
|
|
|
}
|
|
|
|
|
|
2016-05-12 11:57:29 +02:00
|
|
|
Perspective::~Perspective()
|
|
|
|
|
{
|
2018-08-22 13:08:49 +02:00
|
|
|
if (theMainWindow) {
|
2018-09-04 13:29:15 +02:00
|
|
|
delete d->m_innerToolBar;
|
|
|
|
|
d->m_innerToolBar = nullptr;
|
2018-08-22 13:08:49 +02:00
|
|
|
}
|
Debugger: Make most views per-engine instead of singletons
This is a step towards properly supporting multiple debugger
sessions side-by-side.
The combined C++-and-QML engine has been removed, instead a
combined setup creates now two individual engines, under a single
DebuggerRunTool but mostly independent with no combined state
machine. This requires a few more clicks in some cases, but
makes it easier to direct e.g. interrupt requests to the
interesting engine.
Care has been taken to not change the UX of the single debugger
session use case if possible. The fat debug button operates
as-before in that case, i.e. switches to Interrupt if the
single active runconfiguration runs in the debugger etc.
Most views are made per-engine, running an engine creates
a new Perspective, which is destroyed when the run control dies.
The snapshot view remains global and becomes primary source
of information on a "current engine" that receives all menu
and otherwise global input.
There is a new global "Breakpoint Preset" view containing
all "static" breakpoint data. When an engine starts up it
"claims" breakpoint it believes it can handle, but operates
on a copy of the static data. The markers of the static
version are suppressed as long as an engine controls a
breakpoint (that inclusive all resolved locations), but are
re-instatet once the engine quits.
The old Breakpoint class that already contained this split
per-instance was split into a new Breakpoint and a
GlobalBreakpoint class, with a per-engine model for Breakpoints,
and a singleton model containing GlobalBreakpoints.
There is a new CppDebuggerEngine intermediate level serving as
base for C++ (or, rather, "compiled") binary debugging, i.e.
{Gdb,Lldb,Cdb}Engine, taking over bits of the current DebuggerEngine
base that are not applicable to non-binary debuggers.
Change-Id: I9994f4c188379b4aee0c4f379edd4759fbb0bd43
Reviewed-by: Christian Stenger <christian.stenger@qt.io>
Reviewed-by: hjk <hjk@qt.io>
2018-07-31 12:30:48 +02:00
|
|
|
delete d;
|
2018-07-31 12:30:48 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void Perspective::setCentralWidget(QWidget *centralWidget)
|
|
|
|
|
{
|
Debugger: Make most views per-engine instead of singletons
This is a step towards properly supporting multiple debugger
sessions side-by-side.
The combined C++-and-QML engine has been removed, instead a
combined setup creates now two individual engines, under a single
DebuggerRunTool but mostly independent with no combined state
machine. This requires a few more clicks in some cases, but
makes it easier to direct e.g. interrupt requests to the
interesting engine.
Care has been taken to not change the UX of the single debugger
session use case if possible. The fat debug button operates
as-before in that case, i.e. switches to Interrupt if the
single active runconfiguration runs in the debugger etc.
Most views are made per-engine, running an engine creates
a new Perspective, which is destroyed when the run control dies.
The snapshot view remains global and becomes primary source
of information on a "current engine" that receives all menu
and otherwise global input.
There is a new global "Breakpoint Preset" view containing
all "static" breakpoint data. When an engine starts up it
"claims" breakpoint it believes it can handle, but operates
on a copy of the static data. The markers of the static
version are suppressed as long as an engine controls a
breakpoint (that inclusive all resolved locations), but are
re-instatet once the engine quits.
The old Breakpoint class that already contained this split
per-instance was split into a new Breakpoint and a
GlobalBreakpoint class, with a per-engine model for Breakpoints,
and a singleton model containing GlobalBreakpoints.
There is a new CppDebuggerEngine intermediate level serving as
base for C++ (or, rather, "compiled") binary debugging, i.e.
{Gdb,Lldb,Cdb}Engine, taking over bits of the current DebuggerEngine
base that are not applicable to non-binary debuggers.
Change-Id: I9994f4c188379b4aee0c4f379edd4759fbb0bd43
Reviewed-by: Christian Stenger <christian.stenger@qt.io>
Reviewed-by: hjk <hjk@qt.io>
2018-07-31 12:30:48 +02:00
|
|
|
QTC_ASSERT(d->m_centralWidget == nullptr, return);
|
|
|
|
|
d->m_centralWidget = centralWidget;
|
2016-05-12 11:57:29 +02:00
|
|
|
}
|
|
|
|
|
|
Debugger: Make most views per-engine instead of singletons
This is a step towards properly supporting multiple debugger
sessions side-by-side.
The combined C++-and-QML engine has been removed, instead a
combined setup creates now two individual engines, under a single
DebuggerRunTool but mostly independent with no combined state
machine. This requires a few more clicks in some cases, but
makes it easier to direct e.g. interrupt requests to the
interesting engine.
Care has been taken to not change the UX of the single debugger
session use case if possible. The fat debug button operates
as-before in that case, i.e. switches to Interrupt if the
single active runconfiguration runs in the debugger etc.
Most views are made per-engine, running an engine creates
a new Perspective, which is destroyed when the run control dies.
The snapshot view remains global and becomes primary source
of information on a "current engine" that receives all menu
and otherwise global input.
There is a new global "Breakpoint Preset" view containing
all "static" breakpoint data. When an engine starts up it
"claims" breakpoint it believes it can handle, but operates
on a copy of the static data. The markers of the static
version are suppressed as long as an engine controls a
breakpoint (that inclusive all resolved locations), but are
re-instatet once the engine quits.
The old Breakpoint class that already contained this split
per-instance was split into a new Breakpoint and a
GlobalBreakpoint class, with a per-engine model for Breakpoints,
and a singleton model containing GlobalBreakpoints.
There is a new CppDebuggerEngine intermediate level serving as
base for C++ (or, rather, "compiled") binary debugging, i.e.
{Gdb,Lldb,Cdb}Engine, taking over bits of the current DebuggerEngine
base that are not applicable to non-binary debuggers.
Change-Id: I9994f4c188379b4aee0c4f379edd4759fbb0bd43
Reviewed-by: Christian Stenger <christian.stenger@qt.io>
Reviewed-by: hjk <hjk@qt.io>
2018-07-31 12:30:48 +02:00
|
|
|
QString Perspective::id() const
|
|
|
|
|
{
|
|
|
|
|
return d->m_id;
|
2016-02-29 18:15:36 +01:00
|
|
|
}
|
|
|
|
|
|
2018-09-20 09:38:38 +02:00
|
|
|
QString Perspective::name() const
|
|
|
|
|
{
|
|
|
|
|
return d->m_name;
|
|
|
|
|
}
|
|
|
|
|
|
2016-11-21 13:57:11 +01:00
|
|
|
void Perspective::setAboutToActivateCallback(const Perspective::Callback &cb)
|
|
|
|
|
{
|
Debugger: Make most views per-engine instead of singletons
This is a step towards properly supporting multiple debugger
sessions side-by-side.
The combined C++-and-QML engine has been removed, instead a
combined setup creates now two individual engines, under a single
DebuggerRunTool but mostly independent with no combined state
machine. This requires a few more clicks in some cases, but
makes it easier to direct e.g. interrupt requests to the
interesting engine.
Care has been taken to not change the UX of the single debugger
session use case if possible. The fat debug button operates
as-before in that case, i.e. switches to Interrupt if the
single active runconfiguration runs in the debugger etc.
Most views are made per-engine, running an engine creates
a new Perspective, which is destroyed when the run control dies.
The snapshot view remains global and becomes primary source
of information on a "current engine" that receives all menu
and otherwise global input.
There is a new global "Breakpoint Preset" view containing
all "static" breakpoint data. When an engine starts up it
"claims" breakpoint it believes it can handle, but operates
on a copy of the static data. The markers of the static
version are suppressed as long as an engine controls a
breakpoint (that inclusive all resolved locations), but are
re-instatet once the engine quits.
The old Breakpoint class that already contained this split
per-instance was split into a new Breakpoint and a
GlobalBreakpoint class, with a per-engine model for Breakpoints,
and a singleton model containing GlobalBreakpoints.
There is a new CppDebuggerEngine intermediate level serving as
base for C++ (or, rather, "compiled") binary debugging, i.e.
{Gdb,Lldb,Cdb}Engine, taking over bits of the current DebuggerEngine
base that are not applicable to non-binary debuggers.
Change-Id: I9994f4c188379b4aee0c4f379edd4759fbb0bd43
Reviewed-by: Christian Stenger <christian.stenger@qt.io>
Reviewed-by: hjk <hjk@qt.io>
2018-07-31 12:30:48 +02:00
|
|
|
d->m_aboutToActivateCallback = cb;
|
2016-11-21 13:57:11 +01:00
|
|
|
}
|
|
|
|
|
|
Debugger: Make most views per-engine instead of singletons
This is a step towards properly supporting multiple debugger
sessions side-by-side.
The combined C++-and-QML engine has been removed, instead a
combined setup creates now two individual engines, under a single
DebuggerRunTool but mostly independent with no combined state
machine. This requires a few more clicks in some cases, but
makes it easier to direct e.g. interrupt requests to the
interesting engine.
Care has been taken to not change the UX of the single debugger
session use case if possible. The fat debug button operates
as-before in that case, i.e. switches to Interrupt if the
single active runconfiguration runs in the debugger etc.
Most views are made per-engine, running an engine creates
a new Perspective, which is destroyed when the run control dies.
The snapshot view remains global and becomes primary source
of information on a "current engine" that receives all menu
and otherwise global input.
There is a new global "Breakpoint Preset" view containing
all "static" breakpoint data. When an engine starts up it
"claims" breakpoint it believes it can handle, but operates
on a copy of the static data. The markers of the static
version are suppressed as long as an engine controls a
breakpoint (that inclusive all resolved locations), but are
re-instatet once the engine quits.
The old Breakpoint class that already contained this split
per-instance was split into a new Breakpoint and a
GlobalBreakpoint class, with a per-engine model for Breakpoints,
and a singleton model containing GlobalBreakpoints.
There is a new CppDebuggerEngine intermediate level serving as
base for C++ (or, rather, "compiled") binary debugging, i.e.
{Gdb,Lldb,Cdb}Engine, taking over bits of the current DebuggerEngine
base that are not applicable to non-binary debuggers.
Change-Id: I9994f4c188379b4aee0c4f379edd4759fbb0bd43
Reviewed-by: Christian Stenger <christian.stenger@qt.io>
Reviewed-by: hjk <hjk@qt.io>
2018-07-31 12:30:48 +02:00
|
|
|
void Perspective::setEnabled(bool enabled)
|
2018-07-24 14:28:31 +02:00
|
|
|
{
|
2018-08-21 12:30:00 +02:00
|
|
|
QTC_ASSERT(theMainWindow, return);
|
Debugger: Make most views per-engine instead of singletons
This is a step towards properly supporting multiple debugger
sessions side-by-side.
The combined C++-and-QML engine has been removed, instead a
combined setup creates now two individual engines, under a single
DebuggerRunTool but mostly independent with no combined state
machine. This requires a few more clicks in some cases, but
makes it easier to direct e.g. interrupt requests to the
interesting engine.
Care has been taken to not change the UX of the single debugger
session use case if possible. The fat debug button operates
as-before in that case, i.e. switches to Interrupt if the
single active runconfiguration runs in the debugger etc.
Most views are made per-engine, running an engine creates
a new Perspective, which is destroyed when the run control dies.
The snapshot view remains global and becomes primary source
of information on a "current engine" that receives all menu
and otherwise global input.
There is a new global "Breakpoint Preset" view containing
all "static" breakpoint data. When an engine starts up it
"claims" breakpoint it believes it can handle, but operates
on a copy of the static data. The markers of the static
version are suppressed as long as an engine controls a
breakpoint (that inclusive all resolved locations), but are
re-instatet once the engine quits.
The old Breakpoint class that already contained this split
per-instance was split into a new Breakpoint and a
GlobalBreakpoint class, with a per-engine model for Breakpoints,
and a singleton model containing GlobalBreakpoints.
There is a new CppDebuggerEngine intermediate level serving as
base for C++ (or, rather, "compiled") binary debugging, i.e.
{Gdb,Lldb,Cdb}Engine, taking over bits of the current DebuggerEngine
base that are not applicable to non-binary debuggers.
Change-Id: I9994f4c188379b4aee0c4f379edd4759fbb0bd43
Reviewed-by: Christian Stenger <christian.stenger@qt.io>
Reviewed-by: hjk <hjk@qt.io>
2018-07-31 12:30:48 +02:00
|
|
|
const int index = theMainWindow->d->indexInChooser(this);
|
|
|
|
|
QTC_ASSERT(index != -1, return);
|
|
|
|
|
auto model = qobject_cast<QStandardItemModel*>(theMainWindow->d->m_perspectiveChooser->model());
|
|
|
|
|
QTC_ASSERT(model, return);
|
|
|
|
|
QStandardItem *item = model->item(index, 0);
|
|
|
|
|
item->setFlags(enabled ? item->flags() | Qt::ItemIsEnabled : item->flags() & ~Qt::ItemIsEnabled );
|
2018-07-24 14:28:31 +02:00
|
|
|
}
|
|
|
|
|
|
2018-09-04 13:29:15 +02:00
|
|
|
QToolButton *PerspectivePrivate::setupToolButton(QAction *action)
|
|
|
|
|
{
|
2018-10-04 09:58:41 +02:00
|
|
|
QTC_ASSERT(action, return nullptr);
|
2018-09-04 13:29:15 +02:00
|
|
|
auto toolButton = new QToolButton(m_innerToolBar);
|
|
|
|
|
toolButton->setProperty("panelwidget", true);
|
|
|
|
|
toolButton->setDefaultAction(action);
|
|
|
|
|
m_innerToolBarLayout->addWidget(toolButton);
|
|
|
|
|
return toolButton;
|
|
|
|
|
}
|
|
|
|
|
|
Debugger: Make most views per-engine instead of singletons
This is a step towards properly supporting multiple debugger
sessions side-by-side.
The combined C++-and-QML engine has been removed, instead a
combined setup creates now two individual engines, under a single
DebuggerRunTool but mostly independent with no combined state
machine. This requires a few more clicks in some cases, but
makes it easier to direct e.g. interrupt requests to the
interesting engine.
Care has been taken to not change the UX of the single debugger
session use case if possible. The fat debug button operates
as-before in that case, i.e. switches to Interrupt if the
single active runconfiguration runs in the debugger etc.
Most views are made per-engine, running an engine creates
a new Perspective, which is destroyed when the run control dies.
The snapshot view remains global and becomes primary source
of information on a "current engine" that receives all menu
and otherwise global input.
There is a new global "Breakpoint Preset" view containing
all "static" breakpoint data. When an engine starts up it
"claims" breakpoint it believes it can handle, but operates
on a copy of the static data. The markers of the static
version are suppressed as long as an engine controls a
breakpoint (that inclusive all resolved locations), but are
re-instatet once the engine quits.
The old Breakpoint class that already contained this split
per-instance was split into a new Breakpoint and a
GlobalBreakpoint class, with a per-engine model for Breakpoints,
and a singleton model containing GlobalBreakpoints.
There is a new CppDebuggerEngine intermediate level serving as
base for C++ (or, rather, "compiled") binary debugging, i.e.
{Gdb,Lldb,Cdb}Engine, taking over bits of the current DebuggerEngine
base that are not applicable to non-binary debuggers.
Change-Id: I9994f4c188379b4aee0c4f379edd4759fbb0bd43
Reviewed-by: Christian Stenger <christian.stenger@qt.io>
Reviewed-by: hjk <hjk@qt.io>
2018-07-31 12:30:48 +02:00
|
|
|
void Perspective::addToolBarAction(QAction *action)
|
2016-03-02 13:57:37 +01:00
|
|
|
{
|
2018-10-04 09:58:41 +02:00
|
|
|
QTC_ASSERT(action, return);
|
2018-09-04 13:29:15 +02:00
|
|
|
d->setupToolButton(action);
|
Debugger: Make most views per-engine instead of singletons
This is a step towards properly supporting multiple debugger
sessions side-by-side.
The combined C++-and-QML engine has been removed, instead a
combined setup creates now two individual engines, under a single
DebuggerRunTool but mostly independent with no combined state
machine. This requires a few more clicks in some cases, but
makes it easier to direct e.g. interrupt requests to the
interesting engine.
Care has been taken to not change the UX of the single debugger
session use case if possible. The fat debug button operates
as-before in that case, i.e. switches to Interrupt if the
single active runconfiguration runs in the debugger etc.
Most views are made per-engine, running an engine creates
a new Perspective, which is destroyed when the run control dies.
The snapshot view remains global and becomes primary source
of information on a "current engine" that receives all menu
and otherwise global input.
There is a new global "Breakpoint Preset" view containing
all "static" breakpoint data. When an engine starts up it
"claims" breakpoint it believes it can handle, but operates
on a copy of the static data. The markers of the static
version are suppressed as long as an engine controls a
breakpoint (that inclusive all resolved locations), but are
re-instatet once the engine quits.
The old Breakpoint class that already contained this split
per-instance was split into a new Breakpoint and a
GlobalBreakpoint class, with a per-engine model for Breakpoints,
and a singleton model containing GlobalBreakpoints.
There is a new CppDebuggerEngine intermediate level serving as
base for C++ (or, rather, "compiled") binary debugging, i.e.
{Gdb,Lldb,Cdb}Engine, taking over bits of the current DebuggerEngine
base that are not applicable to non-binary debuggers.
Change-Id: I9994f4c188379b4aee0c4f379edd4759fbb0bd43
Reviewed-by: Christian Stenger <christian.stenger@qt.io>
Reviewed-by: hjk <hjk@qt.io>
2018-07-31 12:30:48 +02:00
|
|
|
}
|
2018-08-01 17:33:41 +02:00
|
|
|
|
Debugger: Make most views per-engine instead of singletons
This is a step towards properly supporting multiple debugger
sessions side-by-side.
The combined C++-and-QML engine has been removed, instead a
combined setup creates now two individual engines, under a single
DebuggerRunTool but mostly independent with no combined state
machine. This requires a few more clicks in some cases, but
makes it easier to direct e.g. interrupt requests to the
interesting engine.
Care has been taken to not change the UX of the single debugger
session use case if possible. The fat debug button operates
as-before in that case, i.e. switches to Interrupt if the
single active runconfiguration runs in the debugger etc.
Most views are made per-engine, running an engine creates
a new Perspective, which is destroyed when the run control dies.
The snapshot view remains global and becomes primary source
of information on a "current engine" that receives all menu
and otherwise global input.
There is a new global "Breakpoint Preset" view containing
all "static" breakpoint data. When an engine starts up it
"claims" breakpoint it believes it can handle, but operates
on a copy of the static data. The markers of the static
version are suppressed as long as an engine controls a
breakpoint (that inclusive all resolved locations), but are
re-instatet once the engine quits.
The old Breakpoint class that already contained this split
per-instance was split into a new Breakpoint and a
GlobalBreakpoint class, with a per-engine model for Breakpoints,
and a singleton model containing GlobalBreakpoints.
There is a new CppDebuggerEngine intermediate level serving as
base for C++ (or, rather, "compiled") binary debugging, i.e.
{Gdb,Lldb,Cdb}Engine, taking over bits of the current DebuggerEngine
base that are not applicable to non-binary debuggers.
Change-Id: I9994f4c188379b4aee0c4f379edd4759fbb0bd43
Reviewed-by: Christian Stenger <christian.stenger@qt.io>
Reviewed-by: hjk <hjk@qt.io>
2018-07-31 12:30:48 +02:00
|
|
|
void Perspective::addToolBarAction(OptionalAction *action)
|
|
|
|
|
{
|
2018-10-04 09:58:41 +02:00
|
|
|
QTC_ASSERT(action, return);
|
2018-09-04 13:29:15 +02:00
|
|
|
action->m_toolButton = d->setupToolButton(action);
|
2018-08-01 17:33:41 +02:00
|
|
|
}
|
|
|
|
|
|
Debugger: Make most views per-engine instead of singletons
This is a step towards properly supporting multiple debugger
sessions side-by-side.
The combined C++-and-QML engine has been removed, instead a
combined setup creates now two individual engines, under a single
DebuggerRunTool but mostly independent with no combined state
machine. This requires a few more clicks in some cases, but
makes it easier to direct e.g. interrupt requests to the
interesting engine.
Care has been taken to not change the UX of the single debugger
session use case if possible. The fat debug button operates
as-before in that case, i.e. switches to Interrupt if the
single active runconfiguration runs in the debugger etc.
Most views are made per-engine, running an engine creates
a new Perspective, which is destroyed when the run control dies.
The snapshot view remains global and becomes primary source
of information on a "current engine" that receives all menu
and otherwise global input.
There is a new global "Breakpoint Preset" view containing
all "static" breakpoint data. When an engine starts up it
"claims" breakpoint it believes it can handle, but operates
on a copy of the static data. The markers of the static
version are suppressed as long as an engine controls a
breakpoint (that inclusive all resolved locations), but are
re-instatet once the engine quits.
The old Breakpoint class that already contained this split
per-instance was split into a new Breakpoint and a
GlobalBreakpoint class, with a per-engine model for Breakpoints,
and a singleton model containing GlobalBreakpoints.
There is a new CppDebuggerEngine intermediate level serving as
base for C++ (or, rather, "compiled") binary debugging, i.e.
{Gdb,Lldb,Cdb}Engine, taking over bits of the current DebuggerEngine
base that are not applicable to non-binary debuggers.
Change-Id: I9994f4c188379b4aee0c4f379edd4759fbb0bd43
Reviewed-by: Christian Stenger <christian.stenger@qt.io>
Reviewed-by: hjk <hjk@qt.io>
2018-07-31 12:30:48 +02:00
|
|
|
void Perspective::addToolBarWidget(QWidget *widget)
|
2018-08-01 17:33:41 +02:00
|
|
|
{
|
2018-10-04 09:58:41 +02:00
|
|
|
QTC_ASSERT(widget, return);
|
2018-08-10 14:31:55 +02:00
|
|
|
// QStyle::polish is called before it is added to the toolbar, explicitly make it a panel widget
|
2018-09-04 13:29:15 +02:00
|
|
|
widget->setProperty("panelwidget", true);
|
|
|
|
|
widget->setParent(d->m_innerToolBar);
|
|
|
|
|
d->m_innerToolBarLayout->addWidget(widget);
|
|
|
|
|
}
|
|
|
|
|
|
2018-09-11 11:24:19 +02:00
|
|
|
void Perspective::useSubPerspectiveSwitcher(QWidget *widget)
|
2018-09-04 13:29:15 +02:00
|
|
|
{
|
|
|
|
|
d->m_switcher = widget;
|
2016-03-02 13:57:37 +01:00
|
|
|
}
|
|
|
|
|
|
2018-08-01 17:33:41 +02:00
|
|
|
void Perspective::addToolbarSeparator()
|
2016-03-02 13:57:37 +01:00
|
|
|
{
|
2018-09-04 13:29:15 +02:00
|
|
|
d->m_innerToolBarLayout->addWidget(new StyledSeparator(d->m_innerToolBar));
|
|
|
|
|
}
|
|
|
|
|
|
2020-10-28 16:49:41 +01:00
|
|
|
void Perspective::registerNextPrevShortcuts(QAction *next, QAction *prev)
|
|
|
|
|
{
|
|
|
|
|
static const char nextId[] = "Analyzer.nextitem";
|
|
|
|
|
static const char prevId[] = "Analyzer.previtem";
|
|
|
|
|
|
2020-11-09 12:37:09 +01:00
|
|
|
next->setText(DebuggerMainWindow::tr("Next Item"));
|
2020-10-28 16:49:41 +01:00
|
|
|
Command * const nextCmd = ActionManager::registerAction(next, nextId,
|
|
|
|
|
Context(Id::fromString(id())));
|
|
|
|
|
nextCmd->augmentActionWithShortcutToolTip(next);
|
2020-11-09 12:37:09 +01:00
|
|
|
prev->setText(DebuggerMainWindow::tr("Previous Item"));
|
2020-10-28 16:49:41 +01:00
|
|
|
Command * const prevCmd = ActionManager::registerAction(prev, prevId,
|
|
|
|
|
Context(Id::fromString(id())));
|
|
|
|
|
prevCmd->augmentActionWithShortcutToolTip(prev);
|
|
|
|
|
}
|
|
|
|
|
|
2018-08-01 17:33:41 +02:00
|
|
|
QWidget *Perspective::centralWidget() const
|
2016-03-02 13:57:37 +01:00
|
|
|
{
|
Debugger: Make most views per-engine instead of singletons
This is a step towards properly supporting multiple debugger
sessions side-by-side.
The combined C++-and-QML engine has been removed, instead a
combined setup creates now two individual engines, under a single
DebuggerRunTool but mostly independent with no combined state
machine. This requires a few more clicks in some cases, but
makes it easier to direct e.g. interrupt requests to the
interesting engine.
Care has been taken to not change the UX of the single debugger
session use case if possible. The fat debug button operates
as-before in that case, i.e. switches to Interrupt if the
single active runconfiguration runs in the debugger etc.
Most views are made per-engine, running an engine creates
a new Perspective, which is destroyed when the run control dies.
The snapshot view remains global and becomes primary source
of information on a "current engine" that receives all menu
and otherwise global input.
There is a new global "Breakpoint Preset" view containing
all "static" breakpoint data. When an engine starts up it
"claims" breakpoint it believes it can handle, but operates
on a copy of the static data. The markers of the static
version are suppressed as long as an engine controls a
breakpoint (that inclusive all resolved locations), but are
re-instatet once the engine quits.
The old Breakpoint class that already contained this split
per-instance was split into a new Breakpoint and a
GlobalBreakpoint class, with a per-engine model for Breakpoints,
and a singleton model containing GlobalBreakpoints.
There is a new CppDebuggerEngine intermediate level serving as
base for C++ (or, rather, "compiled") binary debugging, i.e.
{Gdb,Lldb,Cdb}Engine, taking over bits of the current DebuggerEngine
base that are not applicable to non-binary debuggers.
Change-Id: I9994f4c188379b4aee0c4f379edd4759fbb0bd43
Reviewed-by: Christian Stenger <christian.stenger@qt.io>
Reviewed-by: hjk <hjk@qt.io>
2018-07-31 12:30:48 +02:00
|
|
|
return d->m_centralWidget;
|
|
|
|
|
}
|
|
|
|
|
|
2019-03-22 07:35:48 +01:00
|
|
|
Context PerspectivePrivate::context() const
|
Debugger: Make most views per-engine instead of singletons
This is a step towards properly supporting multiple debugger
sessions side-by-side.
The combined C++-and-QML engine has been removed, instead a
combined setup creates now two individual engines, under a single
DebuggerRunTool but mostly independent with no combined state
machine. This requires a few more clicks in some cases, but
makes it easier to direct e.g. interrupt requests to the
interesting engine.
Care has been taken to not change the UX of the single debugger
session use case if possible. The fat debug button operates
as-before in that case, i.e. switches to Interrupt if the
single active runconfiguration runs in the debugger etc.
Most views are made per-engine, running an engine creates
a new Perspective, which is destroyed when the run control dies.
The snapshot view remains global and becomes primary source
of information on a "current engine" that receives all menu
and otherwise global input.
There is a new global "Breakpoint Preset" view containing
all "static" breakpoint data. When an engine starts up it
"claims" breakpoint it believes it can handle, but operates
on a copy of the static data. The markers of the static
version are suppressed as long as an engine controls a
breakpoint (that inclusive all resolved locations), but are
re-instatet once the engine quits.
The old Breakpoint class that already contained this split
per-instance was split into a new Breakpoint and a
GlobalBreakpoint class, with a per-engine model for Breakpoints,
and a singleton model containing GlobalBreakpoints.
There is a new CppDebuggerEngine intermediate level serving as
base for C++ (or, rather, "compiled") binary debugging, i.e.
{Gdb,Lldb,Cdb}Engine, taking over bits of the current DebuggerEngine
base that are not applicable to non-binary debuggers.
Change-Id: I9994f4c188379b4aee0c4f379edd4759fbb0bd43
Reviewed-by: Christian Stenger <christian.stenger@qt.io>
Reviewed-by: hjk <hjk@qt.io>
2018-07-31 12:30:48 +02:00
|
|
|
{
|
2019-03-22 07:35:48 +01:00
|
|
|
return Context(Id::fromName(m_id.toUtf8()));
|
Debugger: Make most views per-engine instead of singletons
This is a step towards properly supporting multiple debugger
sessions side-by-side.
The combined C++-and-QML engine has been removed, instead a
combined setup creates now two individual engines, under a single
DebuggerRunTool but mostly independent with no combined state
machine. This requires a few more clicks in some cases, but
makes it easier to direct e.g. interrupt requests to the
interesting engine.
Care has been taken to not change the UX of the single debugger
session use case if possible. The fat debug button operates
as-before in that case, i.e. switches to Interrupt if the
single active runconfiguration runs in the debugger etc.
Most views are made per-engine, running an engine creates
a new Perspective, which is destroyed when the run control dies.
The snapshot view remains global and becomes primary source
of information on a "current engine" that receives all menu
and otherwise global input.
There is a new global "Breakpoint Preset" view containing
all "static" breakpoint data. When an engine starts up it
"claims" breakpoint it believes it can handle, but operates
on a copy of the static data. The markers of the static
version are suppressed as long as an engine controls a
breakpoint (that inclusive all resolved locations), but are
re-instatet once the engine quits.
The old Breakpoint class that already contained this split
per-instance was split into a new Breakpoint and a
GlobalBreakpoint class, with a per-engine model for Breakpoints,
and a singleton model containing GlobalBreakpoints.
There is a new CppDebuggerEngine intermediate level serving as
base for C++ (or, rather, "compiled") binary debugging, i.e.
{Gdb,Lldb,Cdb}Engine, taking over bits of the current DebuggerEngine
base that are not applicable to non-binary debuggers.
Change-Id: I9994f4c188379b4aee0c4f379edd4759fbb0bd43
Reviewed-by: Christian Stenger <christian.stenger@qt.io>
Reviewed-by: hjk <hjk@qt.io>
2018-07-31 12:30:48 +02:00
|
|
|
}
|
|
|
|
|
|
2020-01-23 10:49:07 +01:00
|
|
|
PerspectivePrivate::~PerspectivePrivate()
|
|
|
|
|
{
|
|
|
|
|
for (const DockOperation &op : qAsConst(m_dockOperations))
|
|
|
|
|
delete op.widget;
|
|
|
|
|
}
|
|
|
|
|
|
2019-03-22 07:35:48 +01:00
|
|
|
void PerspectivePrivate::showInnerToolBar()
|
Debugger: Make most views per-engine instead of singletons
This is a step towards properly supporting multiple debugger
sessions side-by-side.
The combined C++-and-QML engine has been removed, instead a
combined setup creates now two individual engines, under a single
DebuggerRunTool but mostly independent with no combined state
machine. This requires a few more clicks in some cases, but
makes it easier to direct e.g. interrupt requests to the
interesting engine.
Care has been taken to not change the UX of the single debugger
session use case if possible. The fat debug button operates
as-before in that case, i.e. switches to Interrupt if the
single active runconfiguration runs in the debugger etc.
Most views are made per-engine, running an engine creates
a new Perspective, which is destroyed when the run control dies.
The snapshot view remains global and becomes primary source
of information on a "current engine" that receives all menu
and otherwise global input.
There is a new global "Breakpoint Preset" view containing
all "static" breakpoint data. When an engine starts up it
"claims" breakpoint it believes it can handle, but operates
on a copy of the static data. The markers of the static
version are suppressed as long as an engine controls a
breakpoint (that inclusive all resolved locations), but are
re-instatet once the engine quits.
The old Breakpoint class that already contained this split
per-instance was split into a new Breakpoint and a
GlobalBreakpoint class, with a per-engine model for Breakpoints,
and a singleton model containing GlobalBreakpoints.
There is a new CppDebuggerEngine intermediate level serving as
base for C++ (or, rather, "compiled") binary debugging, i.e.
{Gdb,Lldb,Cdb}Engine, taking over bits of the current DebuggerEngine
base that are not applicable to non-binary debuggers.
Change-Id: I9994f4c188379b4aee0c4f379edd4759fbb0bd43
Reviewed-by: Christian Stenger <christian.stenger@qt.io>
Reviewed-by: hjk <hjk@qt.io>
2018-07-31 12:30:48 +02:00
|
|
|
{
|
2018-09-04 13:29:15 +02:00
|
|
|
m_innerToolBar->setVisible(true);
|
|
|
|
|
if (m_switcher)
|
|
|
|
|
m_switcher->setVisible(true);
|
2016-03-02 13:57:37 +01:00
|
|
|
}
|
|
|
|
|
|
2019-03-22 07:35:48 +01:00
|
|
|
void PerspectivePrivate::hideInnerToolBar()
|
Debugger: Make most views per-engine instead of singletons
This is a step towards properly supporting multiple debugger
sessions side-by-side.
The combined C++-and-QML engine has been removed, instead a
combined setup creates now two individual engines, under a single
DebuggerRunTool but mostly independent with no combined state
machine. This requires a few more clicks in some cases, but
makes it easier to direct e.g. interrupt requests to the
interesting engine.
Care has been taken to not change the UX of the single debugger
session use case if possible. The fat debug button operates
as-before in that case, i.e. switches to Interrupt if the
single active runconfiguration runs in the debugger etc.
Most views are made per-engine, running an engine creates
a new Perspective, which is destroyed when the run control dies.
The snapshot view remains global and becomes primary source
of information on a "current engine" that receives all menu
and otherwise global input.
There is a new global "Breakpoint Preset" view containing
all "static" breakpoint data. When an engine starts up it
"claims" breakpoint it believes it can handle, but operates
on a copy of the static data. The markers of the static
version are suppressed as long as an engine controls a
breakpoint (that inclusive all resolved locations), but are
re-instatet once the engine quits.
The old Breakpoint class that already contained this split
per-instance was split into a new Breakpoint and a
GlobalBreakpoint class, with a per-engine model for Breakpoints,
and a singleton model containing GlobalBreakpoints.
There is a new CppDebuggerEngine intermediate level serving as
base for C++ (or, rather, "compiled") binary debugging, i.e.
{Gdb,Lldb,Cdb}Engine, taking over bits of the current DebuggerEngine
base that are not applicable to non-binary debuggers.
Change-Id: I9994f4c188379b4aee0c4f379edd4759fbb0bd43
Reviewed-by: Christian Stenger <christian.stenger@qt.io>
Reviewed-by: hjk <hjk@qt.io>
2018-07-31 12:30:48 +02:00
|
|
|
{
|
2018-09-04 13:29:15 +02:00
|
|
|
QTC_ASSERT(m_innerToolBar, return);
|
|
|
|
|
m_innerToolBar->setVisible(false);
|
|
|
|
|
if (m_switcher)
|
|
|
|
|
m_switcher->setVisible(false);
|
Debugger: Make most views per-engine instead of singletons
This is a step towards properly supporting multiple debugger
sessions side-by-side.
The combined C++-and-QML engine has been removed, instead a
combined setup creates now two individual engines, under a single
DebuggerRunTool but mostly independent with no combined state
machine. This requires a few more clicks in some cases, but
makes it easier to direct e.g. interrupt requests to the
interesting engine.
Care has been taken to not change the UX of the single debugger
session use case if possible. The fat debug button operates
as-before in that case, i.e. switches to Interrupt if the
single active runconfiguration runs in the debugger etc.
Most views are made per-engine, running an engine creates
a new Perspective, which is destroyed when the run control dies.
The snapshot view remains global and becomes primary source
of information on a "current engine" that receives all menu
and otherwise global input.
There is a new global "Breakpoint Preset" view containing
all "static" breakpoint data. When an engine starts up it
"claims" breakpoint it believes it can handle, but operates
on a copy of the static data. The markers of the static
version are suppressed as long as an engine controls a
breakpoint (that inclusive all resolved locations), but are
re-instatet once the engine quits.
The old Breakpoint class that already contained this split
per-instance was split into a new Breakpoint and a
GlobalBreakpoint class, with a per-engine model for Breakpoints,
and a singleton model containing GlobalBreakpoints.
There is a new CppDebuggerEngine intermediate level serving as
base for C++ (or, rather, "compiled") binary debugging, i.e.
{Gdb,Lldb,Cdb}Engine, taking over bits of the current DebuggerEngine
base that are not applicable to non-binary debuggers.
Change-Id: I9994f4c188379b4aee0c4f379edd4759fbb0bd43
Reviewed-by: Christian Stenger <christian.stenger@qt.io>
Reviewed-by: hjk <hjk@qt.io>
2018-07-31 12:30:48 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void Perspective::addWindow(QWidget *widget,
|
|
|
|
|
Perspective::OperationType type,
|
|
|
|
|
QWidget *anchorWidget,
|
|
|
|
|
bool visibleByDefault,
|
|
|
|
|
Qt::DockWidgetArea area)
|
|
|
|
|
{
|
2018-10-04 09:58:41 +02:00
|
|
|
QTC_ASSERT(widget, return);
|
Debugger: Make most views per-engine instead of singletons
This is a step towards properly supporting multiple debugger
sessions side-by-side.
The combined C++-and-QML engine has been removed, instead a
combined setup creates now two individual engines, under a single
DebuggerRunTool but mostly independent with no combined state
machine. This requires a few more clicks in some cases, but
makes it easier to direct e.g. interrupt requests to the
interesting engine.
Care has been taken to not change the UX of the single debugger
session use case if possible. The fat debug button operates
as-before in that case, i.e. switches to Interrupt if the
single active runconfiguration runs in the debugger etc.
Most views are made per-engine, running an engine creates
a new Perspective, which is destroyed when the run control dies.
The snapshot view remains global and becomes primary source
of information on a "current engine" that receives all menu
and otherwise global input.
There is a new global "Breakpoint Preset" view containing
all "static" breakpoint data. When an engine starts up it
"claims" breakpoint it believes it can handle, but operates
on a copy of the static data. The markers of the static
version are suppressed as long as an engine controls a
breakpoint (that inclusive all resolved locations), but are
re-instatet once the engine quits.
The old Breakpoint class that already contained this split
per-instance was split into a new Breakpoint and a
GlobalBreakpoint class, with a per-engine model for Breakpoints,
and a singleton model containing GlobalBreakpoints.
There is a new CppDebuggerEngine intermediate level serving as
base for C++ (or, rather, "compiled") binary debugging, i.e.
{Gdb,Lldb,Cdb}Engine, taking over bits of the current DebuggerEngine
base that are not applicable to non-binary debuggers.
Change-Id: I9994f4c188379b4aee0c4f379edd4759fbb0bd43
Reviewed-by: Christian Stenger <christian.stenger@qt.io>
Reviewed-by: hjk <hjk@qt.io>
2018-07-31 12:30:48 +02:00
|
|
|
DockOperation op;
|
2018-07-31 16:13:11 +02:00
|
|
|
op.widget = widget;
|
|
|
|
|
op.operationType = type;
|
2019-03-22 07:35:48 +01:00
|
|
|
op.anchorWidget = anchorWidget;
|
2018-07-31 16:13:11 +02:00
|
|
|
op.visibleByDefault = visibleByDefault;
|
|
|
|
|
op.area = area;
|
2019-03-22 07:35:48 +01:00
|
|
|
|
|
|
|
|
if (op.operationType != Perspective::Raise) {
|
|
|
|
|
qCDebug(perspectivesLog) << "CREATING DOCK " << op.name()
|
|
|
|
|
<< "DEFAULT: " << op.visibleByDefault;
|
|
|
|
|
op.commandId = Id("Dock.").withSuffix(op.name());
|
|
|
|
|
|
2019-09-16 15:06:43 +02:00
|
|
|
op.toggleViewAction = new ProxyAction(this);
|
|
|
|
|
op.toggleViewAction->setText(widget->windowTitle());
|
2019-03-22 07:35:48 +01:00
|
|
|
|
2019-09-16 15:06:43 +02:00
|
|
|
Command *cmd = ActionManager::registerAction(op.toggleViewAction, op.commandId, d->context());
|
2019-03-22 07:35:48 +01:00
|
|
|
cmd->setAttribute(Command::CA_Hide);
|
2020-03-04 10:44:07 +01:00
|
|
|
ActionManager::actionContainer(Core::Constants::M_VIEW_VIEWS)->addAction(cmd);
|
2019-03-22 07:35:48 +01:00
|
|
|
}
|
|
|
|
|
|
Debugger: Make most views per-engine instead of singletons
This is a step towards properly supporting multiple debugger
sessions side-by-side.
The combined C++-and-QML engine has been removed, instead a
combined setup creates now two individual engines, under a single
DebuggerRunTool but mostly independent with no combined state
machine. This requires a few more clicks in some cases, but
makes it easier to direct e.g. interrupt requests to the
interesting engine.
Care has been taken to not change the UX of the single debugger
session use case if possible. The fat debug button operates
as-before in that case, i.e. switches to Interrupt if the
single active runconfiguration runs in the debugger etc.
Most views are made per-engine, running an engine creates
a new Perspective, which is destroyed when the run control dies.
The snapshot view remains global and becomes primary source
of information on a "current engine" that receives all menu
and otherwise global input.
There is a new global "Breakpoint Preset" view containing
all "static" breakpoint data. When an engine starts up it
"claims" breakpoint it believes it can handle, but operates
on a copy of the static data. The markers of the static
version are suppressed as long as an engine controls a
breakpoint (that inclusive all resolved locations), but are
re-instatet once the engine quits.
The old Breakpoint class that already contained this split
per-instance was split into a new Breakpoint and a
GlobalBreakpoint class, with a per-engine model for Breakpoints,
and a singleton model containing GlobalBreakpoints.
There is a new CppDebuggerEngine intermediate level serving as
base for C++ (or, rather, "compiled") binary debugging, i.e.
{Gdb,Lldb,Cdb}Engine, taking over bits of the current DebuggerEngine
base that are not applicable to non-binary debuggers.
Change-Id: I9994f4c188379b4aee0c4f379edd4759fbb0bd43
Reviewed-by: Christian Stenger <christian.stenger@qt.io>
Reviewed-by: hjk <hjk@qt.io>
2018-07-31 12:30:48 +02:00
|
|
|
d->m_dockOperations.append(op);
|
|
|
|
|
}
|
|
|
|
|
|
2019-03-22 07:35:48 +01:00
|
|
|
void Perspective::destroy()
|
|
|
|
|
{
|
|
|
|
|
theMainWindow->d->destroyPerspective(this);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void Perspective::rampDownAsCurrent()
|
|
|
|
|
{
|
|
|
|
|
QTC_ASSERT(this == theMainWindow->d->m_currentPerspective, return);
|
|
|
|
|
d->saveLayout();
|
|
|
|
|
d->depopulatePerspective();
|
|
|
|
|
theMainWindow->d->setCurrentPerspective(nullptr);
|
|
|
|
|
|
|
|
|
|
Debugger::Internal::EngineManager::updatePerspectives();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void Perspective::rampUpAsCurrent()
|
|
|
|
|
{
|
|
|
|
|
if (d->m_aboutToActivateCallback)
|
|
|
|
|
d->m_aboutToActivateCallback();
|
|
|
|
|
|
|
|
|
|
QTC_ASSERT(theMainWindow->d->m_currentPerspective == nullptr, return);
|
|
|
|
|
theMainWindow->d->setCurrentPerspective(this);
|
|
|
|
|
QTC_ASSERT(theMainWindow->d->m_currentPerspective == this, return);
|
|
|
|
|
|
2021-02-09 12:25:19 +01:00
|
|
|
theMainWindow->showCentralWidget(true);
|
|
|
|
|
|
2019-03-22 07:35:48 +01:00
|
|
|
d->populatePerspective();
|
|
|
|
|
|
|
|
|
|
theMainWindow->d->updatePerspectiveChooserWidth();
|
|
|
|
|
|
|
|
|
|
d->saveAsLastUsedPerspective();
|
|
|
|
|
|
|
|
|
|
Debugger::Internal::EngineManager::updatePerspectives();
|
|
|
|
|
}
|
|
|
|
|
|
Debugger: Make most views per-engine instead of singletons
This is a step towards properly supporting multiple debugger
sessions side-by-side.
The combined C++-and-QML engine has been removed, instead a
combined setup creates now two individual engines, under a single
DebuggerRunTool but mostly independent with no combined state
machine. This requires a few more clicks in some cases, but
makes it easier to direct e.g. interrupt requests to the
interesting engine.
Care has been taken to not change the UX of the single debugger
session use case if possible. The fat debug button operates
as-before in that case, i.e. switches to Interrupt if the
single active runconfiguration runs in the debugger etc.
Most views are made per-engine, running an engine creates
a new Perspective, which is destroyed when the run control dies.
The snapshot view remains global and becomes primary source
of information on a "current engine" that receives all menu
and otherwise global input.
There is a new global "Breakpoint Preset" view containing
all "static" breakpoint data. When an engine starts up it
"claims" breakpoint it believes it can handle, but operates
on a copy of the static data. The markers of the static
version are suppressed as long as an engine controls a
breakpoint (that inclusive all resolved locations), but are
re-instatet once the engine quits.
The old Breakpoint class that already contained this split
per-instance was split into a new Breakpoint and a
GlobalBreakpoint class, with a per-engine model for Breakpoints,
and a singleton model containing GlobalBreakpoints.
There is a new CppDebuggerEngine intermediate level serving as
base for C++ (or, rather, "compiled") binary debugging, i.e.
{Gdb,Lldb,Cdb}Engine, taking over bits of the current DebuggerEngine
base that are not applicable to non-binary debuggers.
Change-Id: I9994f4c188379b4aee0c4f379edd4759fbb0bd43
Reviewed-by: Christian Stenger <christian.stenger@qt.io>
Reviewed-by: hjk <hjk@qt.io>
2018-07-31 12:30:48 +02:00
|
|
|
void Perspective::select()
|
|
|
|
|
{
|
2018-12-08 00:01:42 -08:00
|
|
|
Debugger::Internal::EngineManager::activateDebugMode();
|
2019-03-22 07:35:48 +01:00
|
|
|
|
|
|
|
|
if (theMainWindow->d->m_currentPerspective == this)
|
2018-08-23 12:24:55 +02:00
|
|
|
return;
|
2018-09-04 13:29:15 +02:00
|
|
|
|
2019-03-22 07:35:48 +01:00
|
|
|
if (theMainWindow->d->m_currentPerspective)
|
|
|
|
|
theMainWindow->d->m_currentPerspective->rampDownAsCurrent();
|
|
|
|
|
QTC_CHECK(theMainWindow->d->m_currentPerspective == nullptr);
|
|
|
|
|
|
|
|
|
|
rampUpAsCurrent();
|
2018-09-04 13:29:15 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void PerspectivePrivate::restoreLayout()
|
|
|
|
|
{
|
2019-09-16 15:06:43 +02:00
|
|
|
qCDebug(perspectivesLog) << "RESTORE LAYOUT FOR " << m_id << settingsId();
|
2019-12-09 15:12:55 +01:00
|
|
|
PerspectiveState state = theMainWindow->d->m_lastPerspectiveStates.value(m_id);
|
|
|
|
|
if (state.mainWindowState.isEmpty()) {
|
2019-09-16 15:06:43 +02:00
|
|
|
qCDebug(perspectivesLog) << "PERSPECTIVE STATE NOT AVAILABLE BY FULL ID.";
|
|
|
|
|
state = theMainWindow->d->m_lastTypePerspectiveStates.value(settingsId());
|
2019-12-09 15:12:55 +01:00
|
|
|
if (state.mainWindowState.isEmpty()) {
|
2019-09-16 15:06:43 +02:00
|
|
|
qCDebug(perspectivesLog) << "PERSPECTIVE STATE NOT AVAILABLE BY PERSPECTIVE TYPE";
|
|
|
|
|
} else {
|
|
|
|
|
qCDebug(perspectivesLog) << "PERSPECTIVE STATE AVAILABLE BY PERSPECTIVE TYPE.";
|
|
|
|
|
}
|
|
|
|
|
} else {
|
|
|
|
|
qCDebug(perspectivesLog) << "PERSPECTIVE STATE AVAILABLE BY FULL ID.";
|
|
|
|
|
}
|
|
|
|
|
|
2019-09-26 11:32:20 +02:00
|
|
|
// The order is important here: While QMainWindow can restore layouts with
|
|
|
|
|
// not-existing docks (some placeholders are used internally), later
|
|
|
|
|
// replacements with restoreDockWidget(dock) trigger a re-layout, resulting
|
|
|
|
|
// in different sizes. So make sure all docks exist first before restoring state.
|
2019-09-16 15:06:43 +02:00
|
|
|
|
2019-03-22 07:35:48 +01:00
|
|
|
qCDebug(perspectivesLog) << "PERSPECTIVE" << m_id << "RESTORING LAYOUT FROM " << settingsId();
|
|
|
|
|
for (DockOperation &op : m_dockOperations) {
|
|
|
|
|
if (op.operationType != Perspective::Raise) {
|
2019-09-16 15:06:43 +02:00
|
|
|
op.ensureDockExists();
|
2019-03-22 07:35:48 +01:00
|
|
|
QTC_ASSERT(op.dock, continue);
|
2019-09-16 15:06:43 +02:00
|
|
|
const bool active = op.visibleByDefault ^ op.changedByUser();
|
2019-03-22 07:35:48 +01:00
|
|
|
op.dock->setVisible(active);
|
|
|
|
|
qCDebug(perspectivesLog) << "RESTORE DOCK " << op.name() << "ACTIVE: " << active
|
|
|
|
|
<< (active == op.visibleByDefault ? "DEFAULT USER" : "*** NON-DEFAULT USER");
|
|
|
|
|
}
|
2018-09-04 13:29:15 +02:00
|
|
|
}
|
2019-09-26 11:32:20 +02:00
|
|
|
|
2019-12-09 15:12:55 +01:00
|
|
|
if (state.mainWindowState.isEmpty()) {
|
2019-09-26 11:32:20 +02:00
|
|
|
qCDebug(perspectivesLog) << "PERSPECTIVE " << m_id << "RESTORE NOT POSSIBLE, NO STORED STATE";
|
|
|
|
|
} else {
|
2019-12-09 15:12:55 +01:00
|
|
|
bool result = theMainWindow->restoreState(state.mainWindowState);
|
2019-09-26 11:32:20 +02:00
|
|
|
qCDebug(perspectivesLog) << "PERSPECTIVE " << m_id << "RESTORED, SUCCESS: " << result;
|
|
|
|
|
}
|
2019-12-09 15:12:55 +01:00
|
|
|
|
|
|
|
|
for (DockOperation &op : m_dockOperations) {
|
|
|
|
|
if (op.operationType != Perspective::Raise) {
|
|
|
|
|
QTC_ASSERT(op.dock, continue);
|
|
|
|
|
for (QTreeView *tv : op.dock->findChildren<QTreeView *>()) {
|
|
|
|
|
if (tv->property(PerspectiveState::savesHeaderKey()).toBool()) {
|
|
|
|
|
const QByteArray s = state.headerViewStates.value(op.name()).toByteArray();
|
|
|
|
|
if (!s.isEmpty())
|
|
|
|
|
tv->header()->restoreState(s);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
2018-09-04 13:29:15 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void PerspectivePrivate::saveLayout()
|
|
|
|
|
{
|
2019-03-22 07:35:48 +01:00
|
|
|
qCDebug(perspectivesLog) << "PERSPECTIVE" << m_id << "SAVE LAYOUT TO " << settingsId();
|
2019-12-09 15:12:55 +01:00
|
|
|
PerspectiveState state;
|
|
|
|
|
state.mainWindowState = theMainWindow->saveState();
|
|
|
|
|
for (DockOperation &op : m_dockOperations) {
|
2019-12-11 17:24:43 +01:00
|
|
|
if (op.operationType != Perspective::Raise) {
|
|
|
|
|
QTC_ASSERT(op.dock, continue);
|
|
|
|
|
for (QTreeView *tv : op.dock->findChildren<QTreeView *>()) {
|
|
|
|
|
if (tv->property(PerspectiveState::savesHeaderKey()).toBool()) {
|
|
|
|
|
if (QHeaderView *hv = tv->header())
|
|
|
|
|
state.headerViewStates.insert(op.name(), hv->saveState());
|
|
|
|
|
}
|
2019-12-09 15:12:55 +01:00
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
theMainWindow->d->m_lastPerspectiveStates.insert(m_id, state);
|
|
|
|
|
theMainWindow->d->m_lastTypePerspectiveStates.insert(settingsId(), state);
|
2018-09-04 13:29:15 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
QString PerspectivePrivate::settingsId() const
|
|
|
|
|
{
|
2019-03-22 07:35:48 +01:00
|
|
|
return m_settingsId.isEmpty() ? m_id : m_settingsId;
|
Debugger: Make most views per-engine instead of singletons
This is a step towards properly supporting multiple debugger
sessions side-by-side.
The combined C++-and-QML engine has been removed, instead a
combined setup creates now two individual engines, under a single
DebuggerRunTool but mostly independent with no combined state
machine. This requires a few more clicks in some cases, but
makes it easier to direct e.g. interrupt requests to the
interesting engine.
Care has been taken to not change the UX of the single debugger
session use case if possible. The fat debug button operates
as-before in that case, i.e. switches to Interrupt if the
single active runconfiguration runs in the debugger etc.
Most views are made per-engine, running an engine creates
a new Perspective, which is destroyed when the run control dies.
The snapshot view remains global and becomes primary source
of information on a "current engine" that receives all menu
and otherwise global input.
There is a new global "Breakpoint Preset" view containing
all "static" breakpoint data. When an engine starts up it
"claims" breakpoint it believes it can handle, but operates
on a copy of the static data. The markers of the static
version are suppressed as long as an engine controls a
breakpoint (that inclusive all resolved locations), but are
re-instatet once the engine quits.
The old Breakpoint class that already contained this split
per-instance was split into a new Breakpoint and a
GlobalBreakpoint class, with a per-engine model for Breakpoints,
and a singleton model containing GlobalBreakpoints.
There is a new CppDebuggerEngine intermediate level serving as
base for C++ (or, rather, "compiled") binary debugging, i.e.
{Gdb,Lldb,Cdb}Engine, taking over bits of the current DebuggerEngine
base that are not applicable to non-binary debuggers.
Change-Id: I9994f4c188379b4aee0c4f379edd4759fbb0bd43
Reviewed-by: Christian Stenger <christian.stenger@qt.io>
Reviewed-by: hjk <hjk@qt.io>
2018-07-31 12:30:48 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// ToolbarAction
|
|
|
|
|
|
|
|
|
|
OptionalAction::OptionalAction(const QString &text)
|
|
|
|
|
: QAction(text)
|
|
|
|
|
{
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
OptionalAction::~OptionalAction()
|
|
|
|
|
{
|
|
|
|
|
delete m_toolButton;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void OptionalAction::setVisible(bool on)
|
|
|
|
|
{
|
|
|
|
|
QAction::setVisible(on);
|
|
|
|
|
if (m_toolButton)
|
|
|
|
|
m_toolButton->setVisible(on);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void OptionalAction::setToolButtonStyle(Qt::ToolButtonStyle style)
|
|
|
|
|
{
|
2018-09-04 13:29:15 +02:00
|
|
|
QTC_ASSERT(m_toolButton, return);
|
|
|
|
|
m_toolButton->setToolButtonStyle(style);
|
2018-07-24 11:50:08 +02:00
|
|
|
}
|
|
|
|
|
|
2019-12-09 15:12:55 +01:00
|
|
|
const char *PerspectiveState::savesHeaderKey()
|
|
|
|
|
{
|
|
|
|
|
return "SavesHeader";
|
|
|
|
|
}
|
|
|
|
|
|
2016-03-02 13:57:37 +01:00
|
|
|
} // Utils
|