1// SPDX-FileCopyrightText: 2023 UnionTech Software Technology Co., Ltd.
2//
3// SPDX-License-Identifier: GPL-3.0-or-later
4
5#ifndef NAVEDITMAINWINDOW_H
6#define NAVEDITMAINWINDOW_H
7
8#include <QMainWindow>
9#include <QMutex>
10
11class QGridLayout;
12class QTabWidget;
13class AbstractCentral;
14class AbstractWidget;
15class AbstractConsole;
16class QDockWidget;
17class AutoHideDockWidget;
18class ToolBarManager;
19
20class NavEditMainWindow : public QMainWindow
21{
22 Q_OBJECT
23 AutoHideDockWidget *qDockWidgetWorkspace{nullptr};
24 AutoHideDockWidget *qDockWidgetContext{nullptr};
25 AutoHideDockWidget *qDockWidgetWatch{nullptr};
26 AutoHideDockWidget *qDockWidgetFindToolBar{nullptr};
27 AutoHideDockWidget *qDockWidgetValgrindBar{nullptr};
28 AutoHideDockWidget *qDockWidgetTools{nullptr};
29 QWidget *qWidgetEdit{nullptr};
30 QWidget *qWidgetWatch{nullptr};
31 QTabWidget *qTabWidgetContext{nullptr};
32 QTabWidget *qTabWidgetWorkspace{nullptr};
33 QTabWidget *qTabWidgetTools{nullptr};
34 ToolBarManager *mainToolBar{nullptr};
35 QList<QString> contextList;
36 QMutex mutex;
37public:
38 static NavEditMainWindow *instance();
39 explicit NavEditMainWindow(QWidget *parent = nullptr, Qt::WindowFlags flags = Qt::WindowFlags());
40 virtual ~NavEditMainWindow();
41 QStringList contextWidgetTitles() const;
42 void addWidgetWorkspace(const QString &title, AbstractWidget *treeWidget);
43 // return old edit widget
44 QWidget *setWidgetEdit(AbstractCentral *editWidget);
45 // return old watch widget
46 QWidget *setWidgetWatch(AbstractWidget *watchWidget);
47 void addContextWidget(const QString &title, AbstractWidget *contextWidget, const QString &group);
48 // the page widget itself is not deleted.
49 void removeContextWidget(AbstractWidget *contextWidget);
50 bool switchWidgetWorkspace(const QString &title);
51 bool switchWidgetContext(const QString &title);
52 bool switchWidgetTools(const QString &title);
53 void addFindToolBar(AbstractWidget *findToolbar);
54 void showFindToolBar();
55 void addValgrindBar(AbstractWidget *valgrindbar);
56 void showValgrindBar();
57 bool addToolBarActionItem(const QString &id, QAction *action, const QString &group);
58 bool addToolBarWidgetItem(const QString &id, AbstractWidget *widget, const QString &group);
59 void removeToolBarItem(const QString &id);
60 void setToolBarItemDisable(const QString &id, bool disable);
61
62private:
63 void adjustWorkspaceItemOrder();
64};
65
66#endif // NAVEDITMAINWINDOW_H
67