/**************************************************************************** ** ** 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. ** ****************************************************************************/ #ifndef DEBUGGERMAINWINDOW_H #define DEBUGGERMAINWINDOW_H #include "debugger_global.h" #include "analyzer/analyzerbase_global.h" #include #include #include #include #include #include QT_BEGIN_NAMESPACE class QComboBox; class QStackedWidget; QT_END_NAMESPACE namespace Analyzer { class ANALYZER_EXPORT Perspective { public: enum SplitType { SplitVertical, SplitHorizontal, AddToTab }; struct Split { Split() = default; Split(Core::Id e, Core::Id d, SplitType t, bool v, Qt::DockWidgetArea a) : existing(e), dockId(d), splitType(t), visibleByDefault(v), area(a) {} Core::Id existing; Core::Id dockId; SplitType splitType; bool visibleByDefault; Qt::DockWidgetArea area; }; typedef QVector Splits; Perspective(Core::Id id = Core::Id()) : m_id(id) {} Core::Id id() const { return m_id; } void addDock(Core::Id dockId, Core::Id existing, SplitType splitType, bool visibleByDefault = true, Qt::DockWidgetArea area = Qt::BottomDockWidgetArea); Splits splits() const { return m_splits; } QList docks() const { return m_docks; } private: Core::Id m_id; QList m_docks; Splits m_splits; }; } // Analyzer namespace Debugger { namespace Internal { // DebuggerMainWindow dock widget names const char DOCKWIDGET_BREAK[] = "Debugger.Docks.Break"; const char DOCKWIDGET_MODULES[] = "Debugger.Docks.Modules"; const char DOCKWIDGET_REGISTER[] = "Debugger.Docks.Register"; const char DOCKWIDGET_OUTPUT[] = "Debugger.Docks.Output"; const char DOCKWIDGET_SNAPSHOTS[] = "Debugger.Docks.Snapshots"; const char DOCKWIDGET_STACK[] = "Debugger.Docks.Stack"; const char DOCKWIDGET_SOURCE_FILES[] = "Debugger.Docks.SourceFiles"; const char DOCKWIDGET_THREADS[] = "Debugger.Docks.Threads"; const char DOCKWIDGET_WATCHERS[] = "Debugger.Docks.LocalsAndWatchers"; const char DOCKWIDGET_QML_INSPECTOR[] = "Debugger.Docks.QmlInspector"; const char DOCKWIDGET_DEFAULT_AREA[] = "Debugger.Docks.DefaultArea"; class MainWindowBase : public Utils::FancyMainWindow { Q_OBJECT public: MainWindowBase(); ~MainWindowBase() override; QComboBox *toolBox() const { return m_toolBox; } QStackedWidget *controlsStack() const { return m_controlsStackWidget; } QStackedWidget *statusLabelsStack() const { return m_statusLabelsStackWidget; } void addPerspective(const Analyzer::Perspective &perspective); void showStatusMessage(Core::Id perspective, const QString &message, int timeoutMS); const Analyzer::Perspective *findPerspective(Core::Id perspectiveId) const; void restorePerspective(Core::Id perspectiveId, std::function creator, bool fromStoredSettings); void savePerspective(Core::Id perspectiveId); void closePerspective(Core::Id perspectiveId); QString settingsName() const; void setSettingsName(const QString &settingsName); QString lastSettingsName() const; void setLastSettingsName(const QString &lastSettingsName); QDockWidget *createDockWidget(QWidget *widget, Core::Id dockId); private: QString m_settingsName; QString m_lastSettingsName; QComboBox *m_toolBox; QStackedWidget *m_controlsStackWidget; QStackedWidget *m_statusLabelsStackWidget; QHash m_dockForDockId; QList m_perspectives; QHash m_controlsWidgetForPerspective; QHash m_statusLabelForPerspective; QSet m_defaultSettings; // list of dock widgets to prevent memory leak typedef QPointer DockPtr; QList m_dockWidgets; }; } // namespace Internal } // namespace Debugger #endif // DEBUGGERMAINWINDOW_H