dRonin  adbada4
dRonin GCS
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Groups Pages
mainwindow.h
Go to the documentation of this file.
1 
14 /*
15  * This program is free software; you can redistribute it and/or modify
16  * it under the terms of the GNU General Public License as published by
17  * the Free Software Foundation; either version 3 of the License, or
18  * (at your option) any later version.
19  *
20  * This program is distributed in the hope that it will be useful, but
21  * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
22  * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
23  * for more details.
24  *
25  * You should have received a copy of the GNU General Public License along
26  * with this program; if not, see <http://www.gnu.org/licenses/>
27  */
28 
29 #ifndef MAINWINDOW_H
30 #define MAINWINDOW_H
31 
32 #include "core_global.h"
33 
35 
36 #include <QtCore/QMap>
37 #include <QSettings>
38 #include <QFile>
39 
40 QT_BEGIN_NAMESPACE
41 class QSettings;
42 class QShortcut;
43 class QToolButton;
44 class MyTabWidget;
45 class QFrame;
46 QT_END_NAMESPACE
47 
48 namespace Core {
49 
50 class ActionManager;
51 class BaseMode;
52 class BaseView;
53 class IConfigurablePlugin;
54 class IContext;
55 class IMode;
56 class IWizard;
57 class ConnectionManager;
58 class BoardManager;
59 class MessageManager;
60 class ModeManager;
61 class UniqueIDManager;
62 class ThreadManager;
63 class ViewManagerInterface;
64 class UAVGadgetManager;
65 class UAVGadgetInstanceManager;
66 class GlobalMessaging;
67 
68 namespace Internal {
69 
71  class CoreImpl;
72  class GeneralSettings;
73  class ShortcutSettings;
74  class WorkspaceSettings;
75  class VersionDialog;
76  class AuthorsDialog;
77 
78  class CORE_EXPORT MainWindow : public EventFilteringMainWindow
79  {
80  Q_OBJECT
81 
82  public:
83  MainWindow();
84  ~MainWindow();
85 
86  bool init(QString *errorMessage);
87  void extensionsInitialized();
88  void shutdown();
89 
90  IContext *contextObject(QWidget *widget);
91  void addContextObject(IContext *contex);
92  void removeContextObject(IContext *contex);
93  void resetContext();
94  void readSettings(QSettings *qs = nullptr, bool workspaceDiffOnly = false);
95  void saveSettings(QSettings *qs = nullptr);
96  void readSettings(IConfigurablePlugin *plugin, QSettings *qs = nullptr);
97  void saveSettings(IConfigurablePlugin *plugin, QSettings *qs = nullptr);
98  void deleteSettings();
99  void openFiles(const QStringList &fileNames);
100 
101  Core::ActionManager *actionManager() const;
102  Core::UniqueIDManager *uniqueIDManager() const;
103  Core::GlobalMessaging *globalMessaging() const;
104  QList<UAVGadgetManager *> uavGadgetManagers() const;
105  UAVGadgetInstanceManager *uavGadgetInstanceManager() const;
106  Core::ConnectionManager *connectionManager() const;
107  Core::BoardManager *boardManager() const;
108  Core::ThreadManager *threadManager() const;
109  Core::ModeManager *modeManager() const;
110  Internal::GeneralSettings *generalSettings() const;
111  QSettings *settings(QSettings::Scope scope) const;
112  IContext *currentContextObject() const;
113  QStatusBar *statusBar() const;
114  void addAdditionalContext(int context);
115  void removeAdditionalContext(int context);
116  bool hasContext(int context) const;
117 
118  void updateContext();
119 
120  void setSuppressNavigationWidget(bool suppress);
121 
122  signals:
123  void windowActivated();
124  void splashMessages(QString);
125  void hideSplash();
126  void showSplash();
127  public slots:
128  void newFile();
129  void openFileWith();
130  void exit();
131  void setFullScreen(bool on);
132 
133  bool showOptionsDialog(const QString &category = QString(), const QString &page = QString(),
134  QWidget *parent = nullptr);
135 
136  protected:
137  virtual void changeEvent(QEvent *e);
138  virtual void closeEvent(QCloseEvent *event);
139  virtual void dragEnterEvent(QDragEnterEvent *event);
140  virtual void dropEvent(QDropEvent *event);
141 
142  private slots:
143  void openFile();
144  void aboutToShowRecentFiles();
145  void openRecentFile();
146  void setFocusToEditor();
147  void saveAll();
148  void aboutGCS();
149  void aboutPlugins();
150  void aboutAuthors();
151  void updateFocusWidget(QWidget *old, QWidget *now);
152  void destroyVersionDialog();
153  void destroyAuthorsDialog();
154  void modeChanged(Core::IMode *mode);
155  void showUavGadgetMenus(bool show, bool hasSplitter);
156  void applyTabBarSettings(QTabWidget::TabPosition pos, bool movable);
157  void showHelp();
158 
159  private:
160  void updateContextObject(IContext *context);
161  void registerDefaultContainers();
162  void registerDefaultActions();
163  void createWorkspaces(QSettings *qs, bool diffOnly = false);
164  void readStyleSheet(QFile *file, QString name, QString *style);
165  void loadStyleSheet();
166 
167  CoreImpl *m_coreImpl;
168  UniqueIDManager *m_uniqueIDManager;
169  QList<int> m_globalContext;
170  QList<int> m_additionalContexts;
171  QSettings *m_settings;
172  QSettings *m_globalSettings;
173  QFrame *m_contentFrame;
174  bool
175  m_dontSaveSettings; // In case of an Error or if we reset the settings, never save them.
176  ActionManagerPrivate *m_actionManager;
177  MessageManager *m_messageManager;
178  GlobalMessaging *m_globalMessaging;
179  ThreadManager *m_threadManager;
180  ModeManager *m_modeManager;
181  QList<UAVGadgetManager *> m_uavGadgetManagers;
182  UAVGadgetInstanceManager *m_uavGadgetInstanceManager;
183  ConnectionManager *m_connectionManager;
184  BoardManager *m_boardManager;
185  MyTabWidget *m_modeStack;
186  Core::BaseView *m_outputView;
187  VersionDialog *m_versionDialog;
188  AuthorsDialog *m_authorsDialog;
189 
190  IContext *m_activeContext;
191 
192  QMap<QWidget *, IContext *> m_contextWidgets;
193 
194  GeneralSettings *m_generalSettings;
195  ShortcutSettings *m_shortcutSettings;
196  WorkspaceSettings *m_workspaceSettings;
197 
198  // actions
199  QShortcut *m_focusToEditor;
200  QAction *m_newAction;
201  QAction *m_openAction;
202  QAction *m_openWithAction;
203  QAction *m_saveAllAction;
204  QAction *m_exitAction;
205  QAction *m_optionsAction;
206  // UavGadgetManager actions
207  QAction *m_showToolbarsAction;
208  QAction *m_splitAction;
209  QAction *m_splitSideBySideAction;
210  QAction *m_removeCurrentSplitAction;
211  QAction *m_removeAllSplitsAction;
212  QAction *m_gotoOtherSplitAction;
213 
214  QString m_config_description;
215  QString m_config_details;
216 #ifdef Q_OS_MAC
217  QAction *m_minimizeAction;
218  QAction *m_zoomAction;
219 #endif
220  QAction *m_toggleFullScreenAction;
221  };
222 
223 } // namespace Internal
224 } // namespace Core
225 
226 #endif // MAINWINDOW_H
Parse log file
The action manager is responsible for registration of menus and menu items and keyboard shortcuts...
Definition: actionmanager.h:47
A base implementation of the mode interface IMode.
Definition: icore.h:39
e
Definition: OPPlots.m:99