| 1 | // SPDX-FileCopyrightText: 2023 UnionTech Software Technology Co., Ltd. |
|---|---|
| 2 | // |
| 3 | // SPDX-License-Identifier: GPL-3.0-or-later |
| 4 | |
| 5 | #ifndef WINDOWKEEPER_H |
| 6 | #define WINDOWKEEPER_H |
| 7 | |
| 8 | #include "base/abstractnav.h" |
| 9 | #include "base/abstractaction.h" |
| 10 | #include "base/abstractmenu.h" |
| 11 | #include "base/abstractmenubar.h" |
| 12 | #include "base/abstractmainwindow.h" |
| 13 | #include "base/abstractcentral.h" |
| 14 | #include "base/abstractwidget.h" |
| 15 | |
| 16 | #include <framework/framework.h> |
| 17 | |
| 18 | #include <QObject> |
| 19 | |
| 20 | class QAction; |
| 21 | class QMainWindow; |
| 22 | class QStatusBar; |
| 23 | class QMenuBar; |
| 24 | class QToolBar; |
| 25 | class QActionGroup; |
| 26 | |
| 27 | class WindowKeeperPrivate; |
| 28 | class WindowKeeper final :public QObject |
| 29 | { |
| 30 | Q_OBJECT |
| 31 | WindowKeeperPrivate *const d; |
| 32 | friend class WindowSwitcher; |
| 33 | |
| 34 | public: |
| 35 | static WindowKeeper *instace(); |
| 36 | explicit WindowKeeper(QObject *parent = nullptr); |
| 37 | virtual ~WindowKeeper(); |
| 38 | QStringList navActionTexts() const; |
| 39 | |
| 40 | public slots: |
| 41 | void addActionNavigation(const QString &id, AbstractAction *action); |
| 42 | void addCentralNavigation(const QString &navName, AbstractCentral *central); |
| 43 | void addMenu(AbstractMenu *menu); |
| 44 | void insertAction(const QString &menuName, const QString &beforActionName, |
| 45 | AbstractAction *action); |
| 46 | void addAction(const QString &menuName, AbstractAction *action); |
| 47 | void removeActions(const QString &menuName); |
| 48 | void addOpenProjectAction(const QString &name, AbstractAction *action); |
| 49 | void initUserWidget(); |
| 50 | void switchWidgetNavigation(const QString &navName); |
| 51 | |
| 52 | private : |
| 53 | void showAboutDlg(); |
| 54 | void showAboutPlugins(); |
| 55 | void layoutWindow(QMainWindow *window); |
| 56 | void createNavEdit(QToolBar *toolbar); |
| 57 | void createNavRecent(QToolBar *toolbar); |
| 58 | void createStatusBar(QMainWindow *window); |
| 59 | void createHelpActions(QMenuBar *menuBar); |
| 60 | void createToolsActions(QMenuBar *menuBar); |
| 61 | void createDebugActions(QMenuBar *menuBar); |
| 62 | void createBuildActions(QMenuBar *menuBar); |
| 63 | void createFileActions(QMenuBar *menuBar); |
| 64 | void createAnalyzeActions(QMenuBar *menuBar); |
| 65 | void setNavActionChecked(const QString &actionName, bool checked); |
| 66 | }; |
| 67 | |
| 68 | #endif // WINDOWKEEPER_H |
| 69 |