1 /*
2 	Copyright 2006-2019 The QElectroTech Team
3 	This file is part of QElectroTech.
4 
5 	QElectroTech is free software: you can redistribute it and/or modify
6 	it under the terms of the GNU General Public License as published by
7 	the Free Software Foundation, either version 2 of the License, or
8 	(at your option) any later version.
9 
10 	QElectroTech is distributed in the hope that it will be useful,
11 	but WITHOUT ANY WARRANTY; without even the implied warranty of
12 	MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
13 	GNU General Public License for more details.
14 
15 	You should have received a copy of the GNU General Public License
16 	along with QElectroTech.  If not, see <http://www.gnu.org/licenses/>.
17 */
18 #ifndef QET_MAIN_WINDOW_H
19 #define QET_MAIN_WINDOW_H
20 #include <QMainWindow>
21 #include <QHash>
22 /**
23 	This is the base class for the main top-level windows within
24 	QElectroTech.
25 */
26 class QETMainWindow : public QMainWindow {
27 	Q_OBJECT
28 
29 	// constructor, destructor
30 	public:
31 	QETMainWindow(QWidget * = nullptr, Qt::WindowFlags = nullptr);
32 	~QETMainWindow() override;
33 
34 	// methods
35 	protected:
36 	void initCommonActions();
37 	void initCommonMenus();
38 	void insertMenu(QMenu *, QMenu *, bool = true);
39 	QAction *actionForMenu(QMenu *);
40 
41 	protected:
42 	bool event(QEvent *) override;
43 	void dragEnterEvent(QDragEnterEvent *e) override;
44 	void dropEvent(QDropEvent *e) override;
45 	virtual void firstActivation(QEvent *);
46 
47 	// slots
48 	public slots:
49 	void toggleFullScreen();
50 	void updateFullScreenAction();
51 	void checkToolbarsmenu();
52 
53 	// attributes
54 	protected:
55 	QAction *configure_action_;              ///< Launch the QElectroTech configuration dialog
56 	QAction *fullscreen_action_;             ///< Toggle full screen
57 	QAction *whatsthis_action_;              ///< Toggle "What's this" mode
58 	QAction *about_qet_;                     ///< Launch the "About QElectroTech" dialog
59 	QAction *manual_online_;                 ///< Launch browser on QElectroTech online manual
60 	QAction *youtube_;                       ///< Launch browser on QElectroTech Youtube channel
61 	QAction *upgrade_;                       ///< Launch browser on QElectroTech Windows Nightly builds
62 	QAction *upgrade_M;                      ///< Launch browser on QElectroTech MAC_OS_X builds
63 	QAction *donate_;                        ///< Launch browser to donate link
64 	QAction *about_qt_;                      ///< launch the "About Qt" dialog
65 	QMenu *settings_menu_;                   ///< Settings menu
66 	QMenu *help_menu_;                       ///< Help menu
67 	QMenu *display_toolbars_;                ///< Show/hide toolbars/docks
68 	QHash<QMenu *, QAction *> menu_actions_; ///< Store actions retrieved when inserting menus
69 	bool first_activation_;                  ///< Used to detect whether the window is activated for the first time
70 };
71 #endif
72