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>
|
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>
|
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
|
|
|
#include <QDebug>
|
2016-02-29 18:15:36 +01:00
|
|
|
#include <QDockWidget>
|
2016-03-02 13:57:37 +01:00
|
|
|
#include <QHBoxLayout>
|
|
|
|
|
#include <QMenu>
|
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>
|
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;
|
|
|
|
|
|
2016-03-02 13:57:37 +01:00
|
|
|
namespace Utils {
|
|
|
|
|
|
|
|
|
|
const char LAST_PERSPECTIVE_KEY[] = "LastPerspective";
|
2018-08-22 11:53:37 +02:00
|
|
|
const char OWNED_BY_PERSPECTIVE[] = "OwnedByPerspective";
|
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:
|
|
|
|
|
QPointer<QWidget> widget;
|
2018-08-22 11:53:37 +02:00
|
|
|
QString anchorDockId;
|
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:
|
|
|
|
|
void showToolBar();
|
|
|
|
|
void hideToolBar();
|
2018-09-04 13:29:15 +02:00
|
|
|
void restoreLayout();
|
|
|
|
|
void saveLayout();
|
|
|
|
|
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;
|
2018-09-04 13:29:15 +02:00
|
|
|
QString m_subPerspectiveType;
|
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;
|
2018-09-04 13:29:15 +02:00
|
|
|
QHash<QString, QVariant> m_nonPersistenSettings;
|
|
|
|
|
Perspective::ShouldPersistChecker m_shouldPersistChecker;
|
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);
|
|
|
|
|
|
2018-09-04 13:29:15 +02:00
|
|
|
void createToolBar();
|
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;
|
2018-11-21 09:01:32 +01:00
|
|
|
void fixupLayoutIfNeeded();
|
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;
|
|
|
|
|
Perspective *m_currentPerspective = nullptr;
|
|
|
|
|
QComboBox *m_perspectiveChooser = nullptr;
|
|
|
|
|
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;
|
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 *m_editorPlaceHolder = nullptr;
|
|
|
|
|
Utils::StatusLabel *m_statusLabel = nullptr;
|
|
|
|
|
QDockWidget *m_toolBarDock = nullptr;
|
|
|
|
|
|
|
|
|
|
QList<Perspective *> m_perspectives;
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
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);
|
2018-09-04 08:14:18 +02:00
|
|
|
m_statusLabel->setIndent(2 * QFontMetrics(q->font()).width(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);
|
2016-03-02 13:57:37 +01:00
|
|
|
connect(m_perspectiveChooser, static_cast<void (QComboBox::*)(int)>(&QComboBox::activated),
|
2018-08-01 17:33:41 +02:00
|
|
|
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
|
|
|
|
|
|
|
|
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);
|
|
|
|
|
m_subPerspectiveSwitcherLayout->setMargin(0);
|
|
|
|
|
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);
|
|
|
|
|
m_innerToolsLayout->setMargin(0);
|
|
|
|
|
m_innerToolsLayout->setSpacing(0);
|
|
|
|
|
|
|
|
|
|
auto hbox = new QHBoxLayout(toolbar);
|
|
|
|
|
hbox->setMargin(0);
|
|
|
|
|
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);
|
|
|
|
|
|
2018-10-25 12:12:07 +02:00
|
|
|
auto dock = new QDockWidget(DebuggerMainWindow::tr("Toolbar"), q);
|
2018-09-04 13:29:15 +02:00
|
|
|
dock->setObjectName(QLatin1String("Toolbar"));
|
|
|
|
|
dock->setFeatures(QDockWidget::NoDockWidgetFeatures);
|
|
|
|
|
dock->setAllowedAreas(Qt::BottomDockWidgetArea);
|
|
|
|
|
dock->setTitleBarWidget(new QWidget(dock)); // hide title bar
|
|
|
|
|
dock->setProperty("managed_dockwidget", QLatin1String("true"));
|
|
|
|
|
toolbar->setParent(dock);
|
|
|
|
|
dock->setWidget(toolbar);
|
|
|
|
|
m_toolBarDock = dock;
|
|
|
|
|
q->addDockWidget(Qt::BottomDockWidgetArea, m_toolBarDock);
|
|
|
|
|
|
|
|
|
|
connect(viewButton, &QAbstractButton::clicked, [this, viewButton] {
|
|
|
|
|
QMenu menu;
|
|
|
|
|
q->addDockActionsToMenu(&menu);
|
|
|
|
|
menu.exec(viewButton->mapToGlobal(QPoint()));
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
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
|
|
|
}
|
|
|
|
|
|
|
|
|
|
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);
|
|
|
|
|
|
|
|
|
|
ActionContainer *viewsMenu = ActionManager::actionContainer(Core::Constants::M_WINDOW_VIEWS);
|
|
|
|
|
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);
|
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;
|
|
|
|
|
}
|
|
|
|
|
|
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
|
|
|
{
|
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
|
|
|
{
|
2018-09-04 13:29:15 +02:00
|
|
|
if (perspective == m_currentPerspective) {
|
|
|
|
|
depopulateCurrentPerspective();
|
|
|
|
|
m_currentPerspective = nullptr;
|
|
|
|
|
}
|
|
|
|
|
|
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);
|
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
|
|
|
}
|
|
|
|
|
|
2016-08-26 13:33:30 +02:00
|
|
|
void DebuggerMainWindow::onModeChanged(Core::Id mode)
|
|
|
|
|
{
|
|
|
|
|
if (mode == Debugger::Constants::MODE_DEBUG) {
|
2018-08-21 12:30:00 +02:00
|
|
|
theMainWindow->setDockActionsVisible(true);
|
2018-08-22 13:08:49 +02:00
|
|
|
Perspective *perspective = theMainWindow->d->m_currentPerspective;
|
|
|
|
|
if (!perspective) {
|
|
|
|
|
const QSettings *settings = ICore::settings();
|
|
|
|
|
const QString lastPerspectiveId = settings->value(QLatin1String(LAST_PERSPECTIVE_KEY)).toString();
|
|
|
|
|
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();
|
|
|
|
|
}
|
|
|
|
|
// There's at least the debugger preset perspective that should be found above.
|
|
|
|
|
QTC_ASSERT(perspective, return);
|
|
|
|
|
perspective->select();
|
2016-08-26 13:33:30 +02:00
|
|
|
} else {
|
2018-09-04 13:29:15 +02:00
|
|
|
if (Perspective *perspective = theMainWindow->d->m_currentPerspective)
|
|
|
|
|
perspective->d->saveLayout();
|
|
|
|
|
|
2018-08-21 12:30:00 +02:00
|
|
|
theMainWindow->setDockActionsVisible(false);
|
2016-08-26 13:33:30 +02:00
|
|
|
|
|
|
|
|
// Hide dock widgets manually in case they are floating.
|
2018-09-26 09:35:47 +02:00
|
|
|
for (QDockWidget *dockWidget : theMainWindow->dockWidgets()) {
|
2016-08-26 13:33:30 +02:00
|
|
|
if (dockWidget->isFloating())
|
|
|
|
|
dockWidget->hide();
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
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);
|
|
|
|
|
}
|
|
|
|
|
|
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
|
|
|
{
|
2018-08-22 10:53:34 +02:00
|
|
|
return Utils::findOr(theMainWindow->d->m_perspectives, nullptr, [&](Perspective *perspective) {
|
|
|
|
|
return perspective->d->m_id == perspectiveId;
|
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 DebuggerMainWindowPrivate::resetCurrentPerspective()
|
2016-02-29 18:15:36 +01:00
|
|
|
{
|
2018-09-04 13:29:15 +02:00
|
|
|
if (m_currentPerspective) {
|
|
|
|
|
m_currentPerspective->d->m_nonPersistenSettings.clear();
|
|
|
|
|
m_currentPerspective->d->hideToolBar();
|
|
|
|
|
}
|
2018-08-22 13:08:49 +02:00
|
|
|
depopulateCurrentPerspective();
|
|
|
|
|
populateCurrentPerspective();
|
2018-11-21 09:01:32 +01:00
|
|
|
if (m_currentPerspective)
|
|
|
|
|
m_currentPerspective->d->saveLayout();
|
2016-03-01 07:51:06 +01:00
|
|
|
}
|
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
|
|
|
int DebuggerMainWindowPrivate::indexInChooser(Perspective *perspective) const
|
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
|
|
|
return perspective ? m_perspectiveChooser->findData(perspective->d->m_id) : -1;
|
2018-08-01 17:33:41 +02:00
|
|
|
}
|
2016-03-02 13:57:37 +01:00
|
|
|
|
2018-11-21 09:01:32 +01:00
|
|
|
void DebuggerMainWindowPrivate::fixupLayoutIfNeeded()
|
|
|
|
|
{
|
|
|
|
|
// Evil workaround for QTCREATORBUG-21455: In some so far unknown situation
|
|
|
|
|
// the saveLayout/restoreLayout process leads to a situation where some docks
|
|
|
|
|
// does not end up below the perspective toolbar even though they were there
|
|
|
|
|
// initially, leading to an awkward dock layout.
|
|
|
|
|
// This here tries to detect the situation (no other dock directly below the
|
|
|
|
|
// toolbar) and "corrects" that by restoring the default layout.
|
|
|
|
|
const QRect toolbarRect = m_toolBarDock->geometry();
|
|
|
|
|
const int targetX = toolbarRect.left();
|
|
|
|
|
const int targetY = toolbarRect.bottom();
|
|
|
|
|
|
|
|
|
|
const QList<QDockWidget *> docks = q->dockWidgets();
|
|
|
|
|
for (QDockWidget *dock : docks) {
|
|
|
|
|
const QRect dockRect = dock->geometry();
|
|
|
|
|
// 10 for some decoration wiggle room. Found something below? Good.
|
|
|
|
|
if (targetX == dockRect.left() && qAbs(targetY - dockRect.top()) < 10)
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
qDebug() << "Scrambled dock layout found. Resetting it.";
|
|
|
|
|
resetCurrentPerspective();
|
|
|
|
|
}
|
|
|
|
|
|
2018-08-22 13:08:49 +02:00
|
|
|
void DebuggerMainWindowPrivate::selectPerspective(Perspective *perspective)
|
2018-08-01 17:33:41 +02:00
|
|
|
{
|
2018-08-22 13:08:49 +02:00
|
|
|
QTC_ASSERT(perspective, return);
|
|
|
|
|
|
2018-09-04 13:29:15 +02:00
|
|
|
if (m_currentPerspective) {
|
|
|
|
|
m_currentPerspective->d->saveLayout();
|
|
|
|
|
m_currentPerspective->d->hideToolBar();
|
|
|
|
|
}
|
|
|
|
|
|
2018-08-22 13:08:49 +02:00
|
|
|
depopulateCurrentPerspective();
|
|
|
|
|
|
|
|
|
|
m_currentPerspective = perspective;
|
|
|
|
|
|
|
|
|
|
perspective->aboutToActivate();
|
|
|
|
|
|
|
|
|
|
populateCurrentPerspective();
|
|
|
|
|
|
2018-11-21 09:01:32 +01:00
|
|
|
if (m_currentPerspective) {
|
2018-09-04 13:29:15 +02:00
|
|
|
m_currentPerspective->d->restoreLayout();
|
2018-11-21 09:01:32 +01:00
|
|
|
fixupLayoutIfNeeded();
|
|
|
|
|
}
|
2018-08-01 17:33:41 +02:00
|
|
|
|
2018-11-27 14:24:14 +01:00
|
|
|
int index = indexInChooser(m_currentPerspective);
|
|
|
|
|
if (index == -1) {
|
|
|
|
|
if (Perspective *parent = Perspective::findPerspective(m_currentPerspective->d->m_parentPerspectiveId))
|
|
|
|
|
index = indexInChooser(parent);
|
|
|
|
|
}
|
|
|
|
|
|
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
|
|
|
|
2018-09-04 13:29:15 +02:00
|
|
|
const int contentWidth = m_perspectiveChooser->fontMetrics().width(perspective->d->m_name);
|
|
|
|
|
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
|
|
|
|
2018-08-22 13:08:49 +02:00
|
|
|
void DebuggerMainWindowPrivate::depopulateCurrentPerspective()
|
2016-03-02 13:57:37 +01:00
|
|
|
{
|
2016-03-01 07:51:06 +01:00
|
|
|
// Clean up old perspective.
|
2018-08-22 13:08:49 +02:00
|
|
|
for (QDockWidget *dock : q->dockWidgets()) {
|
|
|
|
|
if (dock->property(OWNED_BY_PERSPECTIVE).toBool()) {
|
|
|
|
|
// Prevent deletion of plugin-owned widgets.
|
|
|
|
|
if (dock->widget())
|
2018-08-22 11:53:37 +02:00
|
|
|
dock->widget()->setParent(nullptr);
|
2018-08-22 13:08:49 +02:00
|
|
|
ActionManager::unregisterAction(dock->toggleViewAction(),
|
|
|
|
|
Id("Dock.").withSuffix(dock->objectName()));
|
|
|
|
|
delete dock;
|
2016-03-02 13:57:37 +01:00
|
|
|
}
|
2018-08-22 13:08:49 +02:00
|
|
|
}
|
2016-03-02 13:57:37 +01:00
|
|
|
|
2018-08-22 13:08:49 +02:00
|
|
|
if (m_currentPerspective) {
|
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
|
|
|
ICore::removeAdditionalContext(m_currentPerspective->context());
|
2018-08-01 17:33:41 +02:00
|
|
|
QWidget *central = m_currentPerspective->centralWidget();
|
2016-05-12 11:57:29 +02:00
|
|
|
m_centralWidgetStack->removeWidget(central ? central : m_editorPlaceHolder);
|
2018-08-01 17:33:41 +02:00
|
|
|
}
|
2018-08-22 13:08:49 +02:00
|
|
|
}
|
2016-03-01 07:51:06 +01:00
|
|
|
|
2018-08-22 13:08:49 +02:00
|
|
|
void DebuggerMainWindowPrivate::populateCurrentPerspective()
|
|
|
|
|
{
|
|
|
|
|
// Create dock widgets wrapping ther perspective's widgets.
|
2018-08-22 11:53:37 +02:00
|
|
|
QHash<QString, QDockWidget *> dockForDockId;
|
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
|
|
|
for (const DockOperation &op : m_currentPerspective->d->m_dockOperations) {
|
2018-08-24 11:09:49 +02:00
|
|
|
if (op.operationType == Perspective::Raise)
|
|
|
|
|
continue;
|
2018-07-31 16:13:11 +02:00
|
|
|
QTC_ASSERT(op.widget, continue);
|
2018-08-22 11:53:37 +02:00
|
|
|
const QString dockId = op.widget->objectName();
|
2018-08-22 13:08:49 +02:00
|
|
|
QTC_CHECK(!dockId.isEmpty());
|
|
|
|
|
QTC_ASSERT(!dockForDockId.contains(dockId), continue);
|
|
|
|
|
QDockWidget *dock = q->addDockForWidget(op.widget);
|
|
|
|
|
dock->setProperty(OWNED_BY_PERSPECTIVE, true);
|
|
|
|
|
dockForDockId[dockId] = dock;
|
|
|
|
|
q->addDockWidget(op.area, dock);
|
2016-03-02 13:57:37 +01:00
|
|
|
|
2018-08-22 13:08:49 +02:00
|
|
|
QAction *toggleViewAction = dock->toggleViewAction();
|
|
|
|
|
toggleViewAction->setText(dock->windowTitle());
|
2016-03-02 13:57:37 +01:00
|
|
|
|
2018-08-22 13:08:49 +02:00
|
|
|
Command *cmd = ActionManager::registerAction(toggleViewAction,
|
|
|
|
|
Id("Dock.").withSuffix(dock->objectName()),
|
|
|
|
|
m_currentPerspective->context());
|
|
|
|
|
cmd->setAttribute(Command::CA_Hide);
|
|
|
|
|
ActionManager::actionContainer(Core::Constants::M_WINDOW_VIEWS)->addAction(cmd);
|
|
|
|
|
}
|
2016-03-02 13:57:37 +01:00
|
|
|
|
2018-11-21 09:01:32 +01:00
|
|
|
m_currentPerspective->d->showToolBar();
|
|
|
|
|
|
2018-08-22 13:08:49 +02:00
|
|
|
// Pre-arrange dock widgets.
|
|
|
|
|
for (const DockOperation &op : m_currentPerspective->d->m_dockOperations) {
|
|
|
|
|
QTC_ASSERT(op.widget, continue);
|
|
|
|
|
const QString dockId = op.widget->objectName();
|
|
|
|
|
QDockWidget *dock = dockForDockId.value(dockId);
|
|
|
|
|
QTC_ASSERT(dock, continue);
|
2018-07-31 16:13:11 +02:00
|
|
|
if (op.operationType == Perspective::Raise) {
|
2016-03-02 14:39:20 +01:00
|
|
|
dock->raise();
|
|
|
|
|
continue;
|
|
|
|
|
}
|
2018-08-22 11:53:37 +02:00
|
|
|
QDockWidget *anchor = dockForDockId.value(op.anchorDockId);
|
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
|
|
|
if (!anchor && op.area == Qt::BottomDockWidgetArea) {
|
|
|
|
|
anchor = m_toolBarDock;
|
|
|
|
|
}
|
|
|
|
|
|
2016-03-02 13:57:37 +01:00
|
|
|
if (anchor) {
|
2018-07-31 16:13:11 +02:00
|
|
|
switch (op.operationType) {
|
2016-02-29 18:15:36 +01:00
|
|
|
case Perspective::AddToTab:
|
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
|
|
|
q->tabifyDockWidget(anchor, dock);
|
2016-02-29 18:15:36 +01:00
|
|
|
break;
|
|
|
|
|
case Perspective::SplitHorizontal:
|
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
|
|
|
q->splitDockWidget(anchor, dock, Qt::Horizontal);
|
2016-02-29 18:15:36 +01:00
|
|
|
break;
|
|
|
|
|
case Perspective::SplitVertical:
|
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
|
|
|
q->splitDockWidget(anchor, dock, Qt::Vertical);
|
2016-02-29 18:15:36 +01:00
|
|
|
break;
|
2016-03-02 14:39:20 +01:00
|
|
|
default:
|
|
|
|
|
break;
|
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
|
|
|
dock->setVisible(op.visibleByDefault);
|
2016-02-29 18:15:36 +01:00
|
|
|
}
|
|
|
|
|
|
2018-08-01 17:33:41 +02:00
|
|
|
QWidget *central = m_currentPerspective->centralWidget();
|
2016-05-12 11:57:29 +02:00
|
|
|
m_centralWidgetStack->addWidget(central ? central : m_editorPlaceHolder);
|
2018-10-25 12:12:07 +02:00
|
|
|
q->showCentralWidgetAction()->setText(central ? central->windowTitle()
|
|
|
|
|
: DebuggerMainWindow::tr("Editor"));
|
2016-05-12 11:57:29 +02:00
|
|
|
|
2016-03-02 13:57:37 +01:00
|
|
|
m_statusLabel->clear();
|
2018-08-22 13:08:49 +02:00
|
|
|
|
|
|
|
|
ICore::addAdditionalContext(m_currentPerspective->context());
|
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,
|
|
|
|
|
const QString &subPerspectiveType)
|
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
|
|
|
{
|
2018-09-04 13:29:15 +02:00
|
|
|
const bool shouldPersist = parentPerspectiveId.isEmpty();
|
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;
|
2018-09-04 13:29:15 +02:00
|
|
|
d->m_subPerspectiveType = subPerspectiveType;
|
|
|
|
|
d->m_shouldPersistChecker = [shouldPersist] { return shouldPersist; };
|
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);
|
|
|
|
|
d->m_innerToolBarLayout->setMargin(0);
|
|
|
|
|
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
|
|
|
d->saveLayout();
|
|
|
|
|
|
|
|
|
|
delete d->m_innerToolBar;
|
|
|
|
|
d->m_innerToolBar = nullptr;
|
|
|
|
|
|
2018-08-21 12:30:00 +02:00
|
|
|
theMainWindow->d->destroyPerspective(this);
|
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
|
|
|
}
|
|
|
|
|
|
2016-11-21 14:32:03 +01:00
|
|
|
void Perspective::aboutToActivate() const
|
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
|
|
|
if (d->m_aboutToActivateCallback)
|
|
|
|
|
d->m_aboutToActivateCallback();
|
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));
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void Perspective::setShouldPersistChecker(const ShouldPersistChecker &checker)
|
|
|
|
|
{
|
|
|
|
|
d->m_shouldPersistChecker = checker;
|
2016-03-02 13:57:37 +01:00
|
|
|
}
|
|
|
|
|
|
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;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
Perspective *Perspective::currentPerspective()
|
|
|
|
|
{
|
|
|
|
|
return theMainWindow ? theMainWindow->d->m_currentPerspective : nullptr;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
Context Perspective::context() const
|
|
|
|
|
{
|
|
|
|
|
return Context(Id::fromName(d->m_id.toUtf8()));
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void PerspectivePrivate::showToolBar()
|
|
|
|
|
{
|
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
|
|
|
}
|
|
|
|
|
|
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 PerspectivePrivate::hideToolBar()
|
|
|
|
|
{
|
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;
|
|
|
|
|
if (anchorWidget)
|
2018-08-22 11:53:37 +02:00
|
|
|
op.anchorDockId = anchorWidget->objectName();
|
2018-07-31 16:13:11 +02:00
|
|
|
op.operationType = type;
|
|
|
|
|
op.visibleByDefault = visibleByDefault;
|
|
|
|
|
op.area = area;
|
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);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void Perspective::select()
|
|
|
|
|
{
|
2018-12-08 00:01:42 -08:00
|
|
|
Debugger::Internal::EngineManager::activateDebugMode();
|
2018-08-23 12:24:55 +02:00
|
|
|
if (Perspective::currentPerspective() == this)
|
|
|
|
|
return;
|
2018-08-22 13:08:49 +02:00
|
|
|
theMainWindow->d->selectPerspective(this);
|
|
|
|
|
if (Perspective *parent = Perspective::findPerspective(d->m_parentPerspectiveId))
|
|
|
|
|
parent->d->m_lastActiveSubPerspectiveId = d->m_id;
|
|
|
|
|
else
|
|
|
|
|
d->m_lastActiveSubPerspectiveId.clear();
|
2018-09-04 13:29:15 +02:00
|
|
|
|
|
|
|
|
const QString &lastKey = d->m_parentPerspectiveId.isEmpty() ? d->m_id : d->m_parentPerspectiveId;
|
|
|
|
|
ICore::settings()->setValue(QLatin1String(LAST_PERSPECTIVE_KEY), lastKey);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void PerspectivePrivate::restoreLayout()
|
|
|
|
|
{
|
|
|
|
|
if (m_nonPersistenSettings.isEmpty()) {
|
|
|
|
|
//qDebug() << "PERSPECTIVE" << m_id << "RESTORE PERSISTENT FROM " << settingsId();
|
|
|
|
|
QSettings *settings = ICore::settings();
|
|
|
|
|
settings->beginGroup(settingsId());
|
|
|
|
|
theMainWindow->restoreSettings(settings);
|
|
|
|
|
settings->endGroup();
|
|
|
|
|
m_nonPersistenSettings = theMainWindow->saveSettings();
|
|
|
|
|
} else {
|
|
|
|
|
//qDebug() << "PERSPECTIVE" << m_id << "RESTORE FROM LOCAL TEMP";
|
|
|
|
|
theMainWindow->restoreSettings(m_nonPersistenSettings);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void PerspectivePrivate::saveLayout()
|
|
|
|
|
{
|
|
|
|
|
//qDebug() << "PERSPECTIVE" << m_id << "SAVE LOCAL TEMP";
|
|
|
|
|
m_nonPersistenSettings = theMainWindow->saveSettings();
|
|
|
|
|
|
|
|
|
|
if (m_shouldPersistChecker()) {
|
|
|
|
|
//qDebug() << "PERSPECTIVE" << m_id << "SAVE PERSISTENT TO " << settingsId();
|
|
|
|
|
QSettings *settings = ICore::settings();
|
|
|
|
|
settings->beginGroup(settingsId());
|
|
|
|
|
theMainWindow->saveSettings(settings);
|
|
|
|
|
settings->endGroup();
|
|
|
|
|
} else {
|
|
|
|
|
//qDebug() << "PERSPECTIVE" << m_id << "NOT PERSISTENT";
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
QString PerspectivePrivate::settingsId() const
|
|
|
|
|
{
|
|
|
|
|
return m_parentPerspectiveId.isEmpty() ? m_id : (m_parentPerspectiveId + '.' + m_subPerspectiveType);
|
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
|
|
|
}
|
|
|
|
|
|
2016-03-02 13:57:37 +01:00
|
|
|
} // Utils
|