QGCToolbox.cc 5.23 KB
Newer Older
1 2
 /****************************************************************************
 *
Gus Grubba's avatar
Gus Grubba committed
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.
 *
 ****************************************************************************/
9 10


Don Gagne's avatar
Don Gagne committed
11 12
#include "FactSystem.h"
#include "FirmwarePluginManager.h"
13
#include "AudioOutput.h"
14
#ifndef __mobile__
15
#include "GPSManager.h"
Don Gagne's avatar
Don Gagne committed
16
#endif
17
#include "JoystickManager.h"
Don Gagne's avatar
Don Gagne committed
18 19
#include "LinkManager.h"
#include "MAVLinkProtocol.h"
20
#include "MissionCommandTree.h"
Don Gagne's avatar
Don Gagne committed
21
#include "MultiVehicleManager.h"
dogmaphobic's avatar
dogmaphobic committed
22
#include "QGCImageProvider.h"
Don Gagne's avatar
Don Gagne committed
23
#include "UASMessageHandler.h"
dogmaphobic's avatar
dogmaphobic committed
24
#include "QGCMapEngineManager.h"
Jimmy Johnson's avatar
Jimmy Johnson committed
25
#include "FollowMe.h"
Jimmy Johnson's avatar
Jimmy Johnson committed
26
#include "PositionManager.h"
27
#include "VideoManager.h"
Gus Grubba's avatar
Gus Grubba committed
28
#include "MAVLinkLogManager.h"
29 30
#include "QGCCorePlugin.h"
#include "QGCOptions.h"
31
#include "SettingsManager.h"
32
#include "QGCApplication.h"
33
#include "ADSBVehicleManager.h"
Gus Grubba's avatar
Gus Grubba committed
34 35 36
#if defined(QGC_ENABLE_PAIRING)
#include "PairingManager.h"
#endif
37
#if defined(QGC_AIRMAP_ENABLED)
38
#include "AirMapManager.h"
39 40
#else
#include "AirspaceManager.h"
41
#endif
42 43 44
#if defined(QGC_GST_TAISYNC_ENABLED)
#include "TaisyncManager.h"
#endif
45 46 47
#if defined(QGC_GST_MICROHARD_ENABLED)
#include "MicrohardManager.h"
#endif
48 49 50 51

#if defined(QGC_CUSTOM_BUILD)
#include CUSTOMHEADER
#endif
52 53 54

QGCToolbox::QGCToolbox(QGCApplication* app)
{
55
    // SettingsManager must be first so settings are available to any subsequent tools
56
    _settingsManager        = new SettingsManager           (app, this);
57 58
    //-- Scan and load plugins
    _scanAndLoadPlugins(app);
59 60 61
    _audioOutput            = new AudioOutput               (app, this);
    _factSystem             = new FactSystem                (app, this);
    _firmwarePluginManager  = new FirmwarePluginManager     (app, this);
62
#ifndef __mobile__
63
    _gpsManager             = new GPSManager                (app, this);
Don Gagne's avatar
Don Gagne committed
64
#endif
65 66 67 68 69 70 71 72 73 74 75 76
    _imageProvider          = new QGCImageProvider          (app, this);
    _joystickManager        = new JoystickManager           (app, this);
    _linkManager            = new LinkManager               (app, this);
    _mavlinkProtocol        = new MAVLinkProtocol           (app, this);
    _missionCommandTree     = new MissionCommandTree        (app, this);
    _multiVehicleManager    = new MultiVehicleManager       (app, this);
    _mapEngineManager       = new QGCMapEngineManager       (app, this);
    _uasMessageHandler      = new UASMessageHandler         (app, this);
    _qgcPositionManager     = new QGCPositionManager        (app, this);
    _followMe               = new FollowMe                  (app, this);
    _videoManager           = new VideoManager              (app, this);
    _mavlinkLogManager      = new MAVLinkLogManager         (app, this);
77
    _adsbVehicleManager     = new ADSBVehicleManager        (app, this);
Gus Grubba's avatar
Gus Grubba committed
78 79 80
#if defined(QGC_ENABLE_PAIRING)
    _pairingManager         = new PairingManager            (app, this);
#endif
81 82 83
    //-- Airmap Manager
    //-- This should be "pluggable" so an arbitrary AirSpace manager can be used
    //-- For now, we instantiate the one and only AirMap provider
84
#if defined(QGC_AIRMAP_ENABLED)
85
    _airspaceManager        = new AirMapManager             (app, this);
86
#else
87 88 89 90
    _airspaceManager        = new AirspaceManager           (app, this);
#endif
#if defined(QGC_GST_TAISYNC_ENABLED)
    _taisyncManager         = new TaisyncManager            (app, this);
91
#endif
92 93 94
#if defined(QGC_GST_MICROHARD_ENABLED)
    _microhardManager       = new MicrohardManager          (app, this);
#endif
95
}
96

97 98
void QGCToolbox::setChildToolboxes(void)
{
99 100
    // SettingsManager must be first so settings are available to any subsequent tools
    _settingsManager->setToolbox(this);
101

102
    _corePlugin->setToolbox(this);
Don Gagne's avatar
Don Gagne committed
103 104 105
    _audioOutput->setToolbox(this);
    _factSystem->setToolbox(this);
    _firmwarePluginManager->setToolbox(this);
106
#ifndef __mobile__
107
    _gpsManager->setToolbox(this);
Don Gagne's avatar
Don Gagne committed
108
#endif
Don Gagne's avatar
Don Gagne committed
109 110
    _imageProvider->setToolbox(this);
    _joystickManager->setToolbox(this);
111 112
    _linkManager->setToolbox(this);
    _mavlinkProtocol->setToolbox(this);
113
    _missionCommandTree->setToolbox(this);
Don Gagne's avatar
Don Gagne committed
114
    _multiVehicleManager->setToolbox(this);
dogmaphobic's avatar
dogmaphobic committed
115
    _mapEngineManager->setToolbox(this);
116
    _uasMessageHandler->setToolbox(this);
Jimmy Johnson's avatar
Jimmy Johnson committed
117
    _followMe->setToolbox(this);
Jimmy Johnson's avatar
Jimmy Johnson committed
118
    _qgcPositionManager->setToolbox(this);
119
    _videoManager->setToolbox(this);
Gus Grubba's avatar
Gus Grubba committed
120
    _mavlinkLogManager->setToolbox(this);
121
    _airspaceManager->setToolbox(this);
122
    _adsbVehicleManager->setToolbox(this);
123 124 125
#if defined(QGC_GST_TAISYNC_ENABLED)
    _taisyncManager->setToolbox(this);
#endif
126 127 128
#if defined(QGC_GST_MICROHARD_ENABLED)
    _microhardManager->setToolbox(this);
#endif
Gus Grubba's avatar
Gus Grubba committed
129 130 131
#if defined(QGC_ENABLE_PAIRING)
    _pairingManager->setToolbox(this);
#endif
132 133
}

134 135
void QGCToolbox::_scanAndLoadPlugins(QGCApplication* app)
{
Gus Grubba's avatar
Gus Grubba committed
136
#if defined (QGC_CUSTOM_BUILD)
137
    //-- Create custom plugin (Static)
138
    _corePlugin = (QGCCorePlugin*) new CUSTOMCLASS(app, this);
139 140 141 142 143
    if(_corePlugin) {
        return;
    }
#endif
    //-- No plugins found, use default instance
144
    _corePlugin = new QGCCorePlugin(app, this);
145 146
}

147 148
QGCTool::QGCTool(QGCApplication* app, QGCToolbox* toolbox)
    : QObject(toolbox)
149
    , _app(app)
150
    , _toolbox(nullptr)
151 152 153 154 155 156 157
{
}

void QGCTool::setToolbox(QGCToolbox* toolbox)
{
    _toolbox = toolbox;
}