Scanframe Modular Application 0.1.0
Loading...
Searching...
No Matches
MainWindow.h
Go to the documentation of this file.
1#pragma once
2
3#include <QMainWindow>
6
7class QShortcut;
8class QAction;
9class QMenu;
10class QSettings;
11class QMdiArea;
12class QMdiSubWindow;
13
14namespace sf
15{
16
17class Application;
18
19class MainWindow final : public QMainWindow
20{
21 Q_OBJECT
22
23 public:
24 explicit MainWindow(QSettings* settings, Application* application);
25
26 ~MainWindow() override;
27
28 MultiDocInterface* openFile(const QString& filename);
29
30 inline QMdiArea* getMdiArea() const;
31
32 void storeSettings(bool save);
33
34 protected:
35 void dragEnterEvent(QDragEnterEvent* event) override;
36
37 void dropEvent(QDropEvent* event) override;
38
39 void closeEvent(QCloseEvent* event) override;
40
41 private Q_SLOTS:
42
43 void newFile();
44
45 void open();
46
47 void save();
48
49 void saveAs();
50
51 void updateRecentFileActions();
52
53 void openRecentFile();
54
55 void cut();
56
57 void copy();
58
59 void paste();
60
61 void undo();
62
63 void redo();
64
65 void about();
66
67 void configModules();
68
69 void updateMenus();
70
71 void updateWindowMenu();
72
73 void createAppModuleMenus();
74
75 sf::MultiDocInterface* createMdiChild(const QString& filename = QString());
76
77 void switchLayoutDirection();
78
79 void mdiSubActivated(QMdiSubWindow*);
80
81 private:
82 enum
83 {
84 MaxRecentFiles = 10
85 };
86
87 void createActions();
88
89 void createStatusBar();
90
91 void createDockWindows();
92
93 MultiDocInterface* loadFile(const QString& filename);
94
95 void prependToRecentFiles(const QString& filename);
96
97 void setRecentFilesVisible(bool visible);
98
99 [[nodiscard]] MultiDocInterface* activeMdiChild() const;
100
101 [[nodiscard]] QMdiSubWindow* findMdiChild(const QString& filename) const;
102
103 void settingsPropertySheet();
104
105 void storeState(bool save);
106
107 void storeRecentFiles(bool save);
108
109 Application* _application;
110
111 QSettings* _settings;
112
113 QMdiArea* _mdiArea{};
114 QMenu* _menuProject{};
115 QMenu* _menuSettings{};
116 QMenu* _menuView{};
117 QMenu* _menuTools{};
118 QMenu* _menuWindow{};
119
120 QAction* _actionNew{};
121 QAction* _actionOpen{};
122 QAction* _actionSave{};
123 QAction* _actionSaveAs{};
124 QAction* _actionRecentFile[MaxRecentFiles]{};
125 QAction* _actionRecentFileSeparator{};
126 QAction* _actionRecentFileSubMenu{};
127 QAction* _actionCut{};
128 QAction* _actionCopy{};
129 QAction* _actionPaste{};
130 QAction* _actionUndo{};
131 QAction* _actionRedo{};
132 QAction* _actionCloseWindow{};
133 QAction* _actionCloseWindows{};
134 QAction* _actionTileWindows{};
135 QAction* _actionCascadeWindows{};
136 QAction* _actionNextWindow{};
137 QAction* _actionPreviousWindow{};
138 QAction* _actionWindowMenuSeparator{};
139 QAction* _actionModuleConfig{};
140 QAction* _actionSettings{};
141 QAction* _actionDevelop{};
142
143 QStringList _recentFiles;
144
146
147 void createAppModuleToolBars();
148};
149
150inline QMdiArea* MainWindow::getMdiArea() const
151{
152 return _mdiArea;
153}
154
155}// namespace sf
QList< QDockWidget * > DockWidgetList
Type definition for containing dock widgets.
Definition AppModuleInterface.h:155
Definition Application.h:13
Definition MainWindow.h:20
void storeSettings(bool save)
void dropEvent(QDropEvent *event) override
void closeEvent(QCloseEvent *event) override
QMdiArea * getMdiArea() const
Definition MainWindow.h:150
MultiDocInterface * openFile(const QString &filename)
MainWindow(QSettings *settings, Application *application)
~MainWindow() override
void dragEnterEvent(QDragEnterEvent *event) override
Interface for MDI document widgets handling files.
Definition MultiDocInterface.h:41
Definition Application.h:10