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
20class QAction;
21class QMainWindow;
22class QStatusBar;
23class QMenuBar;
24class QToolBar;
25class QActionGroup;
26
27class WindowKeeperPrivate;
28class WindowKeeper final :public QObject
29{
30 Q_OBJECT
31 WindowKeeperPrivate *const d;
32 friend class WindowSwitcher;
33
34public:
35 static WindowKeeper *instace();
36 explicit WindowKeeper(QObject *parent = nullptr);
37 virtual ~WindowKeeper();
38 QStringList navActionTexts() const;
39
40public 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
52private :
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