QGCToolbox.h 5.73 KB
Newer Older
1 2
/****************************************************************************
 *
3
 * (c) 2009-2020 QGROUNDCONTROL PROJECT <http://www.qgroundcontrol.org>
4 5 6 7 8
 *
 * 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 AirspaceManager;
36 37 38 39
class ADSBVehicleManager;
#if defined(QGC_ENABLE_PAIRING)
class PairingManager;
#endif
40 41 42
#if defined(QGC_GST_TAISYNC_ENABLED)
class TaisyncManager;
#endif
43 44 45
#if defined(QGC_GST_MICROHARD_ENABLED)
class MicrohardManager;
#endif
46 47

/// This is used to manage all of our top level services/tools
48 49
class QGCToolbox : public QObject {
    Q_OBJECT
50 51 52 53

public:
    QGCToolbox(QGCApplication* app);

54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70
    FirmwarePluginManager*      firmwarePluginManager   () { return _firmwarePluginManager; }
    AudioOutput*                audioOutput             () { return _audioOutput; }
    JoystickManager*            joystickManager         () { return _joystickManager; }
    LinkManager*                linkManager             () { return _linkManager; }
    MAVLinkProtocol*            mavlinkProtocol         () { return _mavlinkProtocol; }
    MissionCommandTree*         missionCommandTree      () { return _missionCommandTree; }
    MultiVehicleManager*        multiVehicleManager     () { return _multiVehicleManager; }
    QGCMapEngineManager*        mapEngineManager        () { return _mapEngineManager; }
    QGCImageProvider*           imageProvider           () { return _imageProvider; }
    UASMessageHandler*          uasMessageHandler       () { return _uasMessageHandler; }
    FollowMe*                   followMe                () { return _followMe; }
    QGCPositionManager*         qgcPositionManager      () { return _qgcPositionManager; }
    VideoManager*               videoManager            () { return _videoManager; }
    MAVLinkLogManager*          mavlinkLogManager       () { return _mavlinkLogManager; }
    QGCCorePlugin*              corePlugin              () { return _corePlugin; }
    SettingsManager*            settingsManager         () { return _settingsManager; }
    AirspaceManager*            airspaceManager         () { return _airspaceManager; }
71 72 73 74
    ADSBVehicleManager*         adsbVehicleManager      () { return _adsbVehicleManager; }
#if defined(QGC_ENABLE_PAIRING)
    PairingManager*             pairingManager          () { return _pairingManager; }
#endif
Don Gagne's avatar
Don Gagne committed
75
#ifndef __mobile__
76 77 78 79
    GPSManager*                 gpsManager              () { return _gpsManager; }
#endif
#if defined(QGC_GST_TAISYNC_ENABLED)
    TaisyncManager*             taisyncManager          () { return _taisyncManager; }
Don Gagne's avatar
Don Gagne committed
80
#endif
81 82 83
#if defined(QGC_GST_MICROHARD_ENABLED)
    MicrohardManager*           microhardManager        () { return _microhardManager; }
#endif
84 85

private:
86
    void setChildToolboxes(void);
87 88
    void _scanAndLoadPlugins(QGCApplication *app);

89

90 91 92
    AudioOutput*                _audioOutput            = nullptr;
    FactSystem*                 _factSystem             = nullptr;
    FirmwarePluginManager*      _firmwarePluginManager  = nullptr;
Don Gagne's avatar
Don Gagne committed
93
#ifndef __mobile__
94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110
    GPSManager*                 _gpsManager             = nullptr;
#endif
    QGCImageProvider*           _imageProvider          = nullptr;
    JoystickManager*            _joystickManager        = nullptr;
    LinkManager*                _linkManager            = nullptr;
    MAVLinkProtocol*            _mavlinkProtocol        = nullptr;
    MissionCommandTree*         _missionCommandTree     = nullptr;
    MultiVehicleManager*        _multiVehicleManager    = nullptr;
    QGCMapEngineManager*        _mapEngineManager       = nullptr;
    UASMessageHandler*          _uasMessageHandler      = nullptr;
    FollowMe*                   _followMe               = nullptr;
    QGCPositionManager*         _qgcPositionManager     = nullptr;
    VideoManager*               _videoManager           = nullptr;
    MAVLinkLogManager*          _mavlinkLogManager      = nullptr;
    QGCCorePlugin*              _corePlugin             = nullptr;
    SettingsManager*            _settingsManager        = nullptr;
    AirspaceManager*            _airspaceManager        = nullptr;
111 112 113 114
    ADSBVehicleManager*         _adsbVehicleManager     = nullptr;
#if defined(QGC_ENABLE_PAIRING)
    PairingManager*             _pairingManager         = nullptr;
#endif
115 116
#if defined(QGC_GST_TAISYNC_ENABLED)
    TaisyncManager*             _taisyncManager         = nullptr;
117 118 119
#endif
#if defined(QGC_GST_MICROHARD_ENABLED)
    MicrohardManager*           _microhardManager       = nullptr;
Don Gagne's avatar
Don Gagne committed
120
#endif
121
    friend class QGCApplication;
122 123 124 125 126 127 128
};

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

public:
129 130 131 132
    // 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);
133

134
    // If you override this method, you must call the base class.
135 136 137 138 139 140 141 142
    virtual void setToolbox(QGCToolbox* toolbox);

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

#endif