2010-03-10 23:36:47 +01:00
|
|
|
/**
|
|
|
|
******************************************************************************
|
|
|
|
*
|
|
|
|
* @file mainwindow.h
|
|
|
|
* @author The OpenPilot Team, http://www.openpilot.org Copyright (C) 2010.
|
|
|
|
* Parts by Nokia Corporation (qt-info@nokia.com) Copyright (C) 2009.
|
|
|
|
* @brief
|
|
|
|
* @see The GNU Public License (GPL) Version 3
|
2010-03-11 21:39:34 +01:00
|
|
|
* @defgroup coreplugin
|
2010-03-10 23:36:47 +01:00
|
|
|
* @{
|
|
|
|
*
|
|
|
|
*****************************************************************************/
|
|
|
|
/*
|
|
|
|
* This program is free software; you can redistribute it and/or modify
|
|
|
|
* it under the terms of the GNU General Public License as published by
|
|
|
|
* the Free Software Foundation; either version 3 of the License, or
|
|
|
|
* (at your option) any later version.
|
|
|
|
*
|
|
|
|
* This program is distributed in the hope that it will be useful, but
|
|
|
|
* WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
|
|
|
|
* or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
|
|
|
* for more details.
|
|
|
|
*
|
|
|
|
* You should have received a copy of the GNU General Public License along
|
|
|
|
* with this program; if not, write to the Free Software Foundation, Inc.,
|
|
|
|
* 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
|
|
|
*/
|
2010-02-01 15:10:06 +01:00
|
|
|
|
|
|
|
#ifndef MAINWINDOW_H
|
|
|
|
#define MAINWINDOW_H
|
|
|
|
|
|
|
|
#include "core_global.h"
|
|
|
|
|
|
|
|
#include "eventfilteringmainwindow.h"
|
|
|
|
|
|
|
|
#include <QtCore/QMap>
|
|
|
|
|
|
|
|
QT_BEGIN_NAMESPACE
|
|
|
|
class QSettings;
|
|
|
|
class QShortcut;
|
|
|
|
class QToolButton;
|
|
|
|
QT_END_NAMESPACE
|
|
|
|
|
|
|
|
namespace Core {
|
|
|
|
|
|
|
|
class ActionManager;
|
|
|
|
class BaseMode;
|
|
|
|
class BaseView;
|
|
|
|
class IContext;
|
2010-03-21 14:44:00 +01:00
|
|
|
class IMode;
|
2010-02-01 15:10:06 +01:00
|
|
|
class IWizard;
|
2010-03-21 14:44:00 +01:00
|
|
|
class ConnectionManager;
|
2010-02-01 15:10:06 +01:00
|
|
|
class MessageManager;
|
|
|
|
class MimeDatabase;
|
|
|
|
class ModeManager;
|
|
|
|
class RightPaneWidget;
|
|
|
|
class SettingsDatabase;
|
|
|
|
class UniqueIDManager;
|
|
|
|
class VariableManager;
|
|
|
|
class ViewManagerInterface;
|
2010-03-16 08:48:35 +01:00
|
|
|
class UAVGadgetManager;
|
2010-03-24 20:48:24 +01:00
|
|
|
class UAVGadgetInstanceManager;
|
|
|
|
|
2010-02-01 15:10:06 +01:00
|
|
|
|
|
|
|
namespace Internal {
|
|
|
|
|
|
|
|
class ActionManagerPrivate;
|
|
|
|
class CoreImpl;
|
|
|
|
class FancyTabWidget;
|
|
|
|
class GeneralSettings;
|
|
|
|
class ShortcutSettings;
|
2010-05-30 20:57:33 +02:00
|
|
|
class WorkspaceSettings;
|
2010-02-01 15:10:06 +01:00
|
|
|
class ViewManager;
|
|
|
|
class VersionDialog;
|
2010-03-24 20:48:24 +01:00
|
|
|
class UAVGadgetMode;
|
2010-02-01 15:10:06 +01:00
|
|
|
|
|
|
|
class CORE_EXPORT MainWindow : public EventFilteringMainWindow
|
|
|
|
{
|
|
|
|
Q_OBJECT
|
|
|
|
|
|
|
|
public:
|
|
|
|
MainWindow();
|
|
|
|
~MainWindow();
|
|
|
|
|
|
|
|
bool init(QString *errorMessage);
|
|
|
|
void extensionsInitialized();
|
|
|
|
void shutdown();
|
|
|
|
|
|
|
|
IContext *contextObject(QWidget *widget);
|
|
|
|
void addContextObject(IContext *contex);
|
|
|
|
void removeContextObject(IContext *contex);
|
|
|
|
void resetContext();
|
|
|
|
|
|
|
|
void openFiles(const QStringList &fileNames);
|
|
|
|
|
|
|
|
Core::ActionManager *actionManager() const;
|
|
|
|
Core::UniqueIDManager *uniqueIDManager() const;
|
|
|
|
Core::MessageManager *messageManager() const;
|
2010-03-24 20:48:24 +01:00
|
|
|
QList<UAVGadgetManager*> uavGadgetManagers() const;
|
|
|
|
UAVGadgetInstanceManager *uavGadgetInstanceManager() const;
|
2010-03-21 14:44:00 +01:00
|
|
|
Core::ConnectionManager *connectionManager() const;
|
2010-02-01 15:10:06 +01:00
|
|
|
Core::VariableManager *variableManager() const;
|
|
|
|
Core::ModeManager *modeManager() const;
|
|
|
|
Core::MimeDatabase *mimeDatabase() const;
|
|
|
|
|
|
|
|
inline QSettings *settings() const { return m_settings; }
|
|
|
|
inline SettingsDatabase *settingsDatabase() const { return m_settingsDatabase; }
|
|
|
|
IContext * currentContextObject() const;
|
|
|
|
QStatusBar *statusBar() const;
|
|
|
|
void addAdditionalContext(int context);
|
|
|
|
void removeAdditionalContext(int context);
|
|
|
|
bool hasContext(int context) const;
|
|
|
|
|
|
|
|
void updateContext();
|
|
|
|
|
|
|
|
void setSuppressNavigationWidget(bool suppress);
|
|
|
|
|
|
|
|
signals:
|
|
|
|
void windowActivated();
|
|
|
|
|
|
|
|
public slots:
|
|
|
|
void newFile();
|
|
|
|
void openFileWith();
|
|
|
|
void exit();
|
|
|
|
void setFullScreen(bool on);
|
|
|
|
|
|
|
|
bool showOptionsDialog(const QString &category = QString(),
|
|
|
|
const QString &page = QString(),
|
|
|
|
QWidget *parent = 0);
|
|
|
|
|
|
|
|
bool showWarningWithOptions(const QString &title, const QString &text,
|
|
|
|
const QString &details = QString(),
|
|
|
|
const QString &settingsCategory = QString(),
|
|
|
|
const QString &settingsId = QString(),
|
|
|
|
QWidget *parent = 0);
|
|
|
|
|
|
|
|
protected:
|
|
|
|
virtual void changeEvent(QEvent *e);
|
|
|
|
virtual void closeEvent(QCloseEvent *event);
|
|
|
|
virtual void dragEnterEvent(QDragEnterEvent *event);
|
|
|
|
virtual void dropEvent(QDropEvent *event);
|
|
|
|
|
|
|
|
private slots:
|
|
|
|
void openFile();
|
|
|
|
void aboutToShowRecentFiles();
|
|
|
|
void openRecentFile();
|
|
|
|
void setFocusToEditor();
|
|
|
|
void saveAll();
|
2010-02-28 11:29:40 +01:00
|
|
|
void aboutOpenPilogGCS();
|
2010-02-01 15:10:06 +01:00
|
|
|
void aboutPlugins();
|
|
|
|
void updateFocusWidget(QWidget *old, QWidget *now);
|
|
|
|
void destroyVersionDialog();
|
|
|
|
void modeChanged(Core::IMode *mode);
|
|
|
|
|
|
|
|
private:
|
2010-03-24 20:48:24 +01:00
|
|
|
void addUAVGadgetManager(Core::UAVGadgetManager *manager);
|
2010-02-01 15:10:06 +01:00
|
|
|
void updateContextObject(IContext *context);
|
|
|
|
void registerDefaultContainers();
|
|
|
|
void registerDefaultActions();
|
|
|
|
|
2010-05-30 20:57:33 +02:00
|
|
|
void createWorkspaces();
|
2010-02-01 15:10:06 +01:00
|
|
|
void readSettings();
|
|
|
|
void writeSettings();
|
|
|
|
|
|
|
|
CoreImpl *m_coreImpl;
|
|
|
|
UniqueIDManager *m_uniqueIDManager;
|
|
|
|
QList<int> m_globalContext;
|
|
|
|
QList<int> m_additionalContexts;
|
|
|
|
QSettings *m_settings;
|
|
|
|
SettingsDatabase *m_settingsDatabase;
|
|
|
|
ActionManagerPrivate *m_actionManager;
|
|
|
|
MessageManager *m_messageManager;
|
|
|
|
VariableManager *m_variableManager;
|
2010-03-17 10:00:29 +01:00
|
|
|
ViewManager *m_viewManager;
|
2010-02-01 15:10:06 +01:00
|
|
|
ModeManager *m_modeManager;
|
2010-03-21 17:50:00 +01:00
|
|
|
QList<UAVGadgetManager*> m_uavGadgetManagers;
|
2010-03-24 20:48:24 +01:00
|
|
|
QList<UAVGadgetMode*> m_uavGadgetModes;
|
|
|
|
UAVGadgetInstanceManager *m_uavGadgetInstanceManager;
|
2010-03-21 14:44:00 +01:00
|
|
|
ConnectionManager *m_connectionManager;
|
2010-02-01 15:10:06 +01:00
|
|
|
MimeDatabase *m_mimeDatabase;
|
|
|
|
FancyTabWidget *m_modeStack;
|
2010-03-17 09:06:18 +01:00
|
|
|
// RightPaneWidget *m_rightPaneWidget;
|
2010-02-01 15:10:06 +01:00
|
|
|
Core::BaseView *m_outputView;
|
|
|
|
VersionDialog *m_versionDialog;
|
|
|
|
|
|
|
|
IContext * m_activeContext;
|
|
|
|
|
|
|
|
QMap<QWidget *, IContext *> m_contextWidgets;
|
|
|
|
|
|
|
|
GeneralSettings *m_generalSettings;
|
|
|
|
ShortcutSettings *m_shortcutSettings;
|
2010-05-30 20:57:33 +02:00
|
|
|
WorkspaceSettings *m_workspaceSettings;
|
2010-02-01 15:10:06 +01:00
|
|
|
|
|
|
|
// actions
|
|
|
|
QShortcut *m_focusToEditor;
|
|
|
|
QAction *m_newAction;
|
|
|
|
QAction *m_openAction;
|
|
|
|
QAction *m_openWithAction;
|
|
|
|
QAction *m_saveAllAction;
|
|
|
|
QAction *m_exitAction;
|
|
|
|
QAction *m_optionsAction;
|
|
|
|
QAction *m_toggleFullScreenAction;
|
|
|
|
#ifdef Q_WS_MAC
|
|
|
|
QAction *m_minimizeAction;
|
|
|
|
QAction *m_zoomAction;
|
|
|
|
#endif
|
|
|
|
|
|
|
|
};
|
|
|
|
|
|
|
|
} // namespace Internal
|
|
|
|
} // namespace Core
|
|
|
|
|
|
|
|
#endif // MAINWINDOW_H
|