QGCToolbox.h 4.22 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 18 19
class FactSystem;
class FirmwarePluginManager;
class FlightMapSettings;
class GAudioOutput;
20
class GPSManager;
Don Gagne's avatar
Don Gagne committed
21
class JoystickManager;
Jimmy Johnson's avatar
Jimmy Johnson committed
22
class FollowMe;
23 24
class LinkManager;
class MAVLinkProtocol;
25
class MissionCommandTree;
26
class MultiVehicleManager;
dogmaphobic's avatar
dogmaphobic committed
27
class QGCMapEngineManager;
Don Gagne's avatar
Don Gagne committed
28
class QGCApplication;
dogmaphobic's avatar
dogmaphobic committed
29
class QGCImageProvider;
Don Gagne's avatar
Don Gagne committed
30
class UASMessageHandler;
Jimmy Johnson's avatar
Jimmy Johnson committed
31
class QGCPositionManager;
32
class VideoManager;
Gus Grubba's avatar
Gus Grubba committed
33
class MAVLinkLogManager;
34
class QGCCorePlugin;
35
class SettingsManager;
36 37 38 39 40 41 42 43

/// This is used to manage all of our top level services/tools
class QGCToolbox {

public:
    QGCToolbox(QGCApplication* app);
    ~QGCToolbox();

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

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

    friend class QGCApplication;
94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113
};

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

public:
    // All tools are parented to QGCAppliation and go through a two phase creation. First all tools are newed,
    // and then setToolbox is called on all tools. The prevents creating an circular dependencies at constructor
    // time.
    QGCTool(QGCApplication* app);

    virtual void setToolbox(QGCToolbox* toolbox);

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

#endif