2 ******************************************************************************
5 * @author The OpenPilot Team, http://www.openpilot.org Copyright (C) 2010.
6 * Parts by Nokia Corporation (qt-info@nokia.com) Copyright (C) 2009.
7 * @addtogroup GCSPlugins GCS Plugins
9 * @addtogroup CorePlugin Core Plugin
11 * @brief The Core GCS plugin
12 *****************************************************************************/
14 * This program is free software; you can redistribute it and/or modify
15 * it under the terms of the GNU General Public License as published by
16 * the Free Software Foundation; either version 3 of the License, or
17 * (at your option) any later version.
19 * This program is distributed in the hope that it will be useful, but
20 * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
21 * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
24 * You should have received a copy of the GNU General Public License along
25 * with this program; if not, write to the Free Software Foundation, Inc.,
26 * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
32 #include "core_global.h"
34 #include "eventfilteringmainwindow.h"
36 #include <QtCore/QMap>
52 class IConfigurablePlugin
;
56 class ConnectionManager
;
60 class RightPaneWidget
;
61 class SettingsDatabase
;
62 class UniqueIDManager
;
63 class VariableManager
;
65 class ViewManagerInterface
;
66 class UAVGadgetManager
;
67 class UAVGadgetInstanceManager
;
71 class ActionManagerPrivate
;
74 class GeneralSettings
;
75 class ShortcutSettings
;
76 class WorkspaceSettings
;
78 class CORE_EXPORT MainWindow
: public EventFilteringMainWindow
{
85 bool init(QString
*errorMessage
);
86 void extensionsInitialized();
89 IContext
*contextObject(QWidget
*widget
);
90 void addContextObject(IContext
*contex
);
91 void removeContextObject(IContext
*contex
);
93 void readSettings(QSettings
*qs
= 0, bool workspaceDiffOnly
= false);
94 void saveSettings(QSettings
*qs
= 0);
95 void readSettings(IConfigurablePlugin
*plugin
, QSettings
*qs
= 0);
96 void saveSettings(IConfigurablePlugin
*plugin
, QSettings
*qs
= 0);
97 void deleteSettings();
98 void openFiles(const QStringList
&fileNames
);
100 Core::ActionManager
*actionManager() const;
101 Core::UniqueIDManager
*uniqueIDManager() const;
102 Core::MessageManager
*messageManager() const;
103 QList
<UAVGadgetManager
*> uavGadgetManagers() const;
104 UAVGadgetInstanceManager
*uavGadgetInstanceManager() const;
105 Core::ConnectionManager
*connectionManager() const;
106 Core::VariableManager
*variableManager() const;
107 Core::ThreadManager
*threadManager() const;
108 Core::ModeManager
*modeManager() const;
109 Core::MimeDatabase
*mimeDatabase() const;
110 Internal::GeneralSettings
*generalSettings() const;
111 QSettings
*settings(QSettings::Scope scope
) const;
112 inline SettingsDatabase
*settingsDatabase() const
114 return m_settingsDatabase
;
116 IContext
*currentContextObject() const;
117 QStatusBar
*statusBar() const;
118 void addAdditionalContext(int context
);
119 void removeAdditionalContext(int context
);
120 bool hasContext(int context
) const;
122 void updateContext();
124 void setSuppressNavigationWidget(bool suppress
);
127 void windowActivated();
133 void setFullScreen(bool on
);
135 bool showOptionsDialog(const QString
&category
= QString(),
136 const QString
&page
= QString(),
137 QWidget
*parent
= 0);
139 bool showWarningWithOptions(const QString
&title
, const QString
&text
,
140 const QString
&details
= QString(),
141 const QString
&settingsCategory
= QString(),
142 const QString
&settingsId
= QString(),
143 QWidget
*parent
= 0);
146 virtual void changeEvent(QEvent
*e
);
147 virtual void closeEvent(QCloseEvent
*event
);
148 virtual void dragEnterEvent(QDragEnterEvent
*event
);
149 virtual void dropEvent(QDropEvent
*event
);
153 void aboutToShowRecentFiles();
154 void openRecentFile();
155 void setFocusToEditor();
157 void showAboutDialog();
158 void destroyAboutDialog();
160 void updateFocusWidget(QWidget
*old
, QWidget
*now
);
161 void modeChanged(Core::IMode
*mode
);
162 void showUavGadgetMenus(bool show
, bool hasSplitter
);
163 void applyTabBarSettings(QTabWidget::TabPosition pos
, bool movable
);
167 void updateContextObject(IContext
*context
);
168 void registerDefaultContainers();
169 void registerDefaultActions();
170 void createWorkspaces(QSettings
*qs
, bool diffOnly
= false);
171 QString
loadStyleSheet(QString name
);
173 CoreImpl
*m_coreImpl
;
174 UniqueIDManager
*m_uniqueIDManager
;
175 QList
<int> m_globalContext
;
176 QList
<int> m_additionalContexts
;
177 QSettings
*m_settings
;
178 QSettings
*m_globalSettings
;
179 SettingsDatabase
*m_settingsDatabase
;
180 bool m_dontSaveSettings
; // In case of an Error or if we reset the settings, never save them.
181 ActionManagerPrivate
*m_actionManager
;
182 MessageManager
*m_messageManager
;
183 VariableManager
*m_variableManager
;
184 ThreadManager
*m_threadManager
;
185 ModeManager
*m_modeManager
;
186 QList
<UAVGadgetManager
*> m_uavGadgetManagers
;
187 UAVGadgetInstanceManager
*m_uavGadgetInstanceManager
;
188 ConnectionManager
*m_connectionManager
;
189 MimeDatabase
*m_mimeDatabase
;
190 MyTabWidget
*m_modeStack
;
191 Core::BaseView
*m_outputView
;
192 AboutDialog
*m_aboutDialog
;
194 IContext
*m_activeContext
;
196 QMap
<QWidget
*, IContext
*> m_contextWidgets
;
198 GeneralSettings
*m_generalSettings
;
199 ShortcutSettings
*m_shortcutSettings
;
200 WorkspaceSettings
*m_workspaceSettings
;
203 QShortcut
*m_focusToEditor
;
204 QAction
*m_newAction
;
205 QAction
*m_openAction
;
206 QAction
*m_openWithAction
;
207 QAction
*m_saveAllAction
;
208 QAction
*m_exitAction
;
209 QAction
*m_optionsAction
;
210 QAction
*m_toggleFullScreenAction
;
211 // UavGadgetManager actions
212 QAction
*m_showToolbarsAction
;
213 QAction
*m_splitAction
;
214 QAction
*m_splitSideBySideAction
;
215 QAction
*m_removeCurrentSplitAction
;
216 QAction
*m_removeAllSplitsAction
;
217 QAction
*m_gotoOtherSplitAction
;
219 QString m_config_description
;
220 QString m_config_details
;
221 QString m_config_stylesheet
;
223 QAction
*m_minimizeAction
;
224 QAction
*m_zoomAction
;
227 } // namespace Internal
230 #endif // MAINWINDOW_H