QGCToolbox.h 4.41 KB
Newer Older
1 2 3 4 5 6 7 8
/****************************************************************************
 *
 *   (c) 2009-2016 QGROUNDCONTROL PROJECT <http://www.qgroundcontrol.org>
 *
 * QGroundControl is licensed according to the terms in the file
 * COPYING.md in the root of the source code directory.
 *
 ****************************************************************************/
dogmaphobic's avatar
dogmaphobic committed
9

10 11 12 13 14 15

#ifndef QGCToolbox_h
#define QGCToolbox_h

#include <QObject>

Don Gagne's avatar
Don Gagne committed
16 17
class FactSystem;
class FirmwarePluginManager;
18
class AudioOutput;
19
class GPSManager;
Don Gagne's avatar
Don Gagne committed
20
class JoystickManager;
Jimmy Johnson's avatar
Jimmy Johnson committed
21
class FollowMe;
22 23
class LinkManager;
class MAVLinkProtocol;
24
class MissionCommandTree;
25
class MultiVehicleManager;
dogmaphobic's avatar
dogmaphobic committed
26
class QGCMapEngineManager;
Don Gagne's avatar
Don Gagne committed
27
class QGCApplication;
dogmaphobic's avatar
dogmaphobic committed
28
class QGCImageProvider;
Don Gagne's avatar
Don Gagne committed
29
class UASMessageHandler;
Jimmy Johnson's avatar
Jimmy Johnson committed
30
class QGCPositionManager;
31
class VideoManager;
Gus Grubba's avatar
Gus Grubba committed
32
class MAVLinkLogManager;
33
class QGCCorePlugin;
34
class SettingsManager;
35
class AirMapManager;
36 37

/// This is used to manage all of our top level services/tools
38 39
class QGCToolbox : public QObject {
    Q_OBJECT
40 41 42 43

public:
    QGCToolbox(QGCApplication* app);

Don Gagne's avatar
Don Gagne committed
44
    FirmwarePluginManager*      firmwarePluginManager(void)     { return _firmwarePluginManager; }
45
    AudioOutput*                audioOutput(void)               { return _audioOutput; }
Don Gagne's avatar
Don Gagne committed
46
    JoystickManager*            joystickManager(void)           { return _joystickManager; }
dogmaphobic's avatar
dogmaphobic committed
47 48
    LinkManager*                linkManager(void)               { return _linkManager; }
    MAVLinkProtocol*            mavlinkProtocol(void)           { return _mavlinkProtocol; }
49
    MissionCommandTree*         missionCommandTree(void)        { return _missionCommandTree; }
dogmaphobic's avatar
dogmaphobic committed
50
    MultiVehicleManager*        multiVehicleManager(void)       { return _multiVehicleManager; }
dogmaphobic's avatar
dogmaphobic committed
51
    QGCMapEngineManager*        mapEngineManager(void)          { return _mapEngineManager; }
dogmaphobic's avatar
dogmaphobic committed
52
    QGCImageProvider*           imageProvider()                 { return _imageProvider; }
Don Gagne's avatar
Don Gagne committed
53
    UASMessageHandler*          uasMessageHandler(void)         { return _uasMessageHandler; }
Jimmy Johnson's avatar
Jimmy Johnson committed
54
    FollowMe*                   followMe(void)                  { return _followMe; }
Jimmy Johnson's avatar
Jimmy Johnson committed
55
    QGCPositionManager*         qgcPositionManager(void)        { return _qgcPositionManager; }
56
    VideoManager*               videoManager(void)              { return _videoManager; }
Gus Grubba's avatar
Gus Grubba committed
57
    MAVLinkLogManager*          mavlinkLogManager(void)         { return _mavlinkLogManager; }
58
    QGCCorePlugin*              corePlugin(void)                { return _corePlugin; }
59
    SettingsManager*            settingsManager(void)           { return _settingsManager; }
60
    AirMapManager*              airMapManager(void)             { return _airMapManager; }
Gus Grubba's avatar
Gus Grubba committed
61

Don Gagne's avatar
Don Gagne committed
62 63 64
#ifndef __mobile__
    GPSManager*                 gpsManager(void)                { return _gpsManager; }
#endif
65 66

private:
67
    void setChildToolboxes(void);
68 69
    void _scanAndLoadPlugins(QGCApplication *app);

70

71
    AudioOutput*                _audioOutput;
Don Gagne's avatar
Don Gagne committed
72 73
    FactSystem*                 _factSystem;
    FirmwarePluginManager*      _firmwarePluginManager;
Don Gagne's avatar
Don Gagne committed
74
#ifndef __mobile__
75
    GPSManager*                 _gpsManager;
Don Gagne's avatar
Don Gagne committed
76
#endif
Don Gagne's avatar
Don Gagne committed
77
    QGCImageProvider*           _imageProvider;
dogmaphobic's avatar
dogmaphobic committed
78
    JoystickManager*            _joystickManager;
Don Gagne's avatar
Don Gagne committed
79 80
    LinkManager*                _linkManager;
    MAVLinkProtocol*            _mavlinkProtocol;
81
    MissionCommandTree*         _missionCommandTree;
Don Gagne's avatar
Don Gagne committed
82
    MultiVehicleManager*        _multiVehicleManager;
83
    QGCMapEngineManager*        _mapEngineManager;
dogmaphobic's avatar
dogmaphobic committed
84
    UASMessageHandler*          _uasMessageHandler;
Jimmy Johnson's avatar
Jimmy Johnson committed
85
    FollowMe*                   _followMe;
Jimmy Johnson's avatar
Jimmy Johnson committed
86
    QGCPositionManager*         _qgcPositionManager;
87
    VideoManager*               _videoManager;
Gus Grubba's avatar
Gus Grubba committed
88
    MAVLinkLogManager*          _mavlinkLogManager;
89
    QGCCorePlugin*              _corePlugin;
90
    SettingsManager*            _settingsManager;
91
    AirMapManager*              _airMapManager;
92 93

    friend class QGCApplication;
94 95 96 97 98 99 100
};

/// This is the base class for all tools
class QGCTool : public QObject {
    Q_OBJECT

public:
101 102 103 104
    // All tools must be parented to the QGCToolbox and go through a two phase creation. In the constructor the toolbox
    // should only be passed to QGCTool constructor for correct parenting. It should not be referenced or set in the
    // protected member. Then in the second phase of setToolbox calls is where you can reference the toolbox.
    QGCTool(QGCApplication* app, QGCToolbox* toolbox);
105

106
    // If you override this method, you must call the base class.
107 108 109 110 111 112 113 114
    virtual void setToolbox(QGCToolbox* toolbox);

protected:
    QGCApplication* _app;
    QGCToolbox*     _toolbox;
};

#endif