Debugger: Reduce scope of explicit use of perspective windows

Maybe these can be created lazily later.

Change-Id: I1ebcbd99b2149e96197bbff7f7c877f609e126ad
Reviewed-by: Christian Stenger <christian.stenger@qt.io>
This commit is contained in:
hjk
2019-09-17 16:16:30 +02:00
parent 49584ec337
commit e51059c515

View File

@@ -751,13 +751,6 @@ public:
QAction m_breakAction{tr("Toggle Breakpoint")}; QAction m_breakAction{tr("Toggle Breakpoint")};
BreakpointManager m_breakpointManager; BreakpointManager m_breakpointManager;
QPointer<BaseTreeView> m_breakpointManagerView;
QPointer<QWidget> m_breakpointManagerWindow;
QPointer<BaseTreeView> m_engineManagerView;
QPointer<QWidget> m_engineManagerWindow;
QPointer<GlobalLogWindow> m_globalLogWindow;
QString m_lastPermanentStatusMessage; QString m_lastPermanentStatusMessage;
DebuggerPlugin *m_plugin = nullptr; DebuggerPlugin *m_plugin = nullptr;
@@ -1050,34 +1043,51 @@ bool DebuggerPluginPrivate::initialize(const QStringList &arguments,
vbox->insertWidget(0, label); vbox->insertWidget(0, label);
}; };
m_breakpointManagerView = new BaseTreeView; const auto addFontSizeAdaptation = [](QWidget *widget) {
m_breakpointManagerView->setActivationMode(Utils::DoubleClickActivation); QObject::connect(TextEditorSettings::instance(), &TextEditorSettings::fontSettingsChanged,
m_breakpointManagerView->setIconSize(QSize(10, 10)); [widget](const FontSettings &settings) {
m_breakpointManagerView->setWindowIcon(Icons::BREAKPOINTS.icon()); if (!boolSetting(FontSizeFollowsEditor))
m_breakpointManagerView->setSelectionMode(QAbstractItemView::ExtendedSelection); return;
m_breakpointManagerView->setSettings(settings, "Debugger.BreakWindow"); qreal size = settings.fontZoom() * settings.fontSize() / 100.;
m_breakpointManagerView->setRootIsDecorated(true); QFont font = widget->font();
m_breakpointManagerView->setModel(BreakpointManager::model()); font.setPointSizeF(size);
m_breakpointManagerView->setSpanColumn(BreakpointFunctionColumn); widget->setFont(font);
m_breakpointManagerWindow = addSearch(m_breakpointManagerView); });
m_breakpointManagerWindow->setWindowTitle(tr("Breakpoint Preset")); };
m_breakpointManagerWindow->setObjectName("Debugger.Docks.BreakpointManager");
addLabel(m_breakpointManagerWindow, m_breakpointManagerWindow->windowTitle()); auto breakpointManagerView = new BaseTreeView;
breakpointManagerView->setActivationMode(Utils::DoubleClickActivation);
breakpointManagerView->setIconSize(QSize(10, 10));
breakpointManagerView->setWindowIcon(Icons::BREAKPOINTS.icon());
breakpointManagerView->setSelectionMode(QAbstractItemView::ExtendedSelection);
breakpointManagerView->setSettings(settings, "Debugger.BreakWindow");
breakpointManagerView->setRootIsDecorated(true);
breakpointManagerView->setModel(BreakpointManager::model());
breakpointManagerView->setSpanColumn(BreakpointFunctionColumn);
auto breakpointManagerWindow = addSearch(breakpointManagerView);
breakpointManagerWindow->setWindowTitle(tr("Breakpoint Preset"));
breakpointManagerWindow->setObjectName("Debugger.Docks.BreakpointManager");
addLabel(breakpointManagerWindow, breakpointManagerWindow->windowTitle());
addFontSizeAdaptation(breakpointManagerWindow);
// Snapshot // Snapshot
m_engineManagerView = new BaseTreeView; auto engineManagerView = new BaseTreeView;
m_engineManagerView->setWindowTitle(tr("Running Debuggers")); engineManagerView->setWindowTitle(tr("Running Debuggers"));
m_engineManagerView->setSettings(settings, "Debugger.SnapshotView"); engineManagerView->setSettings(settings, "Debugger.SnapshotView");
m_engineManagerView->setIconSize(QSize(10, 10)); engineManagerView->setIconSize(QSize(10, 10));
m_engineManagerView->setModel(m_engineManager.model()); engineManagerView->setModel(m_engineManager.model());
m_engineManagerWindow = addSearch(m_engineManagerView);
m_engineManagerWindow->setWindowTitle(tr("Debugger Perspectives")); auto engineManagerWindow = addSearch(engineManagerView);
m_engineManagerWindow->setObjectName("Debugger.Docks.Snapshots"); engineManagerWindow->setWindowTitle(tr("Debugger Perspectives"));
addLabel(m_engineManagerWindow, m_engineManagerWindow->windowTitle()); engineManagerWindow->setObjectName("Debugger.Docks.Snapshots");
addLabel(engineManagerWindow, engineManagerWindow->windowTitle());
addFontSizeAdaptation(engineManagerWindow);
// Logging // Logging
m_globalLogWindow = new GlobalLogWindow; auto globalLogWindow = new GlobalLogWindow;
addFontSizeAdaptation(globalLogWindow);
ActionContainer *debugMenu = ActionManager::actionContainer(PE::M_DEBUG); ActionContainer *debugMenu = ActionManager::actionContainer(PE::M_DEBUG);
@@ -1402,20 +1412,6 @@ bool DebuggerPluginPrivate::initialize(const QStringList &arguments,
connect(ICore::instance(), &ICore::saveSettingsRequested, connect(ICore::instance(), &ICore::saveSettingsRequested,
this, &DebuggerPluginPrivate::writeSettings); this, &DebuggerPluginPrivate::writeSettings);
// TextEditor
connect(TextEditorSettings::instance(), &TextEditorSettings::fontSettingsChanged,
[this](const FontSettings &settings) {
if (!boolSetting(FontSizeFollowsEditor))
return;
qreal size = settings.fontZoom() * settings.fontSize() / 100.;
QFont font = m_breakpointManagerWindow->font();
font.setPointSizeF(size);
m_breakpointManagerWindow->setFont(font);
m_globalLogWindow->setFont(font);
m_engineManagerWindow->setFont(font);
});
// ProjectExplorer // ProjectExplorer
connect(ProjectExplorerPlugin::instance(), &ProjectExplorerPlugin::updateRunActions, connect(ProjectExplorerPlugin::instance(), &ProjectExplorerPlugin::updateRunActions,
this, &DebuggerPluginPrivate::updatePresetState); this, &DebuggerPluginPrivate::updatePresetState);
@@ -1433,9 +1429,9 @@ bool DebuggerPluginPrivate::initialize(const QStringList &arguments,
m_perspective.useSubPerspectiveSwitcher(EngineManager::engineChooser()); m_perspective.useSubPerspectiveSwitcher(EngineManager::engineChooser());
m_perspective.addToolBarAction(&m_startAction); m_perspective.addToolBarAction(&m_startAction);
m_perspective.addWindow(m_engineManagerWindow, Perspective::SplitVertical, nullptr); m_perspective.addWindow(engineManagerWindow, Perspective::SplitVertical, nullptr);
m_perspective.addWindow(m_breakpointManagerWindow, Perspective::SplitHorizontal, m_engineManagerWindow); m_perspective.addWindow(breakpointManagerWindow, Perspective::SplitHorizontal, engineManagerWindow);
m_perspective.addWindow(m_globalLogWindow, Perspective::AddToTab, nullptr, false, Qt::TopDockWidgetArea); m_perspective.addWindow(globalLogWindow, Perspective::AddToTab, nullptr, false, Qt::TopDockWidgetArea);
setInitialState(); setInitialState();