QGCToolbox.cc 3.98 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.
 *
 ****************************************************************************/
9 10


Don Gagne's avatar
Don Gagne committed
11 12 13
#include "AutoPilotPluginManager.h"
#include "FactSystem.h"
#include "FirmwarePluginManager.h"
14
#include "FlightMapSettings.h"
Don Gagne's avatar
Don Gagne committed
15
#include "GAudioOutput.h"
16
#ifndef __mobile__
17
#include "GPSManager.h"
Don Gagne's avatar
Don Gagne committed
18
#endif
19 20
#include "HomePositionManager.h"
#include "JoystickManager.h"
Don Gagne's avatar
Don Gagne committed
21 22
#include "LinkManager.h"
#include "MAVLinkProtocol.h"
23
#include "MissionCommandTree.h"
Don Gagne's avatar
Don Gagne committed
24
#include "MultiVehicleManager.h"
dogmaphobic's avatar
dogmaphobic committed
25
#include "QGCImageProvider.h"
Don Gagne's avatar
Don Gagne committed
26
#include "UASMessageHandler.h"
dogmaphobic's avatar
dogmaphobic committed
27
#include "QGCMapEngineManager.h"
Jimmy Johnson's avatar
Jimmy Johnson committed
28
#include "FollowMe.h"
Jimmy Johnson's avatar
Jimmy Johnson committed
29
#include "PositionManager.h"
30
#include "VideoManager.h"
31 32

QGCToolbox::QGCToolbox(QGCApplication* app)
Don Gagne's avatar
Don Gagne committed
33
    : _audioOutput(NULL)
34
    , _autopilotPluginManager(NULL)
Don Gagne's avatar
Don Gagne committed
35 36
    , _factSystem(NULL)
    , _firmwarePluginManager(NULL)
37
    , _flightMapSettings(NULL)
Don Gagne's avatar
Don Gagne committed
38
#ifndef __mobile__
Don Gagne's avatar
Don Gagne committed
39 40
    , _gpsManager(NULL)
#endif
41
    , _homePositionManager(NULL)
Don Gagne's avatar
Don Gagne committed
42
    , _imageProvider(NULL)
43
    , _joystickManager(NULL)
Don Gagne's avatar
Don Gagne committed
44 45
    , _linkManager(NULL)
    , _mavlinkProtocol(NULL)
46
    , _missionCommandTree(NULL)
Don Gagne's avatar
Don Gagne committed
47
    , _multiVehicleManager(NULL)
dogmaphobic's avatar
dogmaphobic committed
48
    , _mapEngineManager(NULL)
49
    , _uasMessageHandler(NULL)
Jimmy Johnson's avatar
Jimmy Johnson committed
50
    , _followMe(NULL)
Jimmy Johnson's avatar
Jimmy Johnson committed
51
    , _qgcPositionManager(NULL)
52
    , _videoManager(NULL)
53
{
Don Gagne's avatar
Don Gagne committed
54
    _audioOutput =              new GAudioOutput(app);
55
    _autopilotPluginManager =   new AutoPilotPluginManager(app);
Don Gagne's avatar
Don Gagne committed
56 57
    _factSystem =               new FactSystem(app);
    _firmwarePluginManager =    new FirmwarePluginManager(app);
58
    _flightMapSettings =        new FlightMapSettings(app);
59
#ifndef __mobile__
60
    _gpsManager =               new GPSManager(app);
Don Gagne's avatar
Don Gagne committed
61
#endif
62
    _homePositionManager =      new HomePositionManager(app);
Don Gagne's avatar
Don Gagne committed
63 64
    _imageProvider =            new QGCImageProvider(app);
    _joystickManager =          new JoystickManager(app);
65 66
    _linkManager =              new LinkManager(app);
    _mavlinkProtocol =          new MAVLinkProtocol(app);
67
    _missionCommandTree =       new MissionCommandTree(app);
Don Gagne's avatar
Don Gagne committed
68
    _multiVehicleManager =      new MultiVehicleManager(app);
Jimmy Johnson's avatar
Jimmy Johnson committed
69
    _mapEngineManager =         new QGCMapEngineManager(app);
70
    _uasMessageHandler =        new UASMessageHandler(app);
Jimmy Johnson's avatar
Jimmy Johnson committed
71
    _qgcPositionManager =       new QGCPositionManager(app);
Jimmy Johnson's avatar
Jimmy Johnson committed
72
    _followMe =                 new FollowMe(app);
73
    _videoManager =             new VideoManager(app);
74
}
75

76 77
void QGCToolbox::setChildToolboxes(void)
{
Don Gagne's avatar
Don Gagne committed
78
    _audioOutput->setToolbox(this);
79
    _autopilotPluginManager->setToolbox(this);
Don Gagne's avatar
Don Gagne committed
80 81
    _factSystem->setToolbox(this);
    _firmwarePluginManager->setToolbox(this);
82
    _flightMapSettings->setToolbox(this);
83
#ifndef __mobile__
84
    _gpsManager->setToolbox(this);
Don Gagne's avatar
Don Gagne committed
85
#endif
86
    _homePositionManager->setToolbox(this);
Don Gagne's avatar
Don Gagne committed
87 88
    _imageProvider->setToolbox(this);
    _joystickManager->setToolbox(this);
89 90
    _linkManager->setToolbox(this);
    _mavlinkProtocol->setToolbox(this);
91
    _missionCommandTree->setToolbox(this);
Don Gagne's avatar
Don Gagne committed
92
    _multiVehicleManager->setToolbox(this);
dogmaphobic's avatar
dogmaphobic committed
93
    _mapEngineManager->setToolbox(this);
94
    _uasMessageHandler->setToolbox(this);
Jimmy Johnson's avatar
Jimmy Johnson committed
95
    _followMe->setToolbox(this);
Jimmy Johnson's avatar
Jimmy Johnson committed
96
    _qgcPositionManager->setToolbox(this);
97
    _videoManager->setToolbox(this);
98 99 100 101
}

QGCToolbox::~QGCToolbox()
{
102
    delete _videoManager;
Don Gagne's avatar
Don Gagne committed
103
    delete _audioOutput;
104
    delete _autopilotPluginManager;
Don Gagne's avatar
Don Gagne committed
105 106
    delete _factSystem;
    delete _firmwarePluginManager;
107 108 109
    delete _flightMapSettings;
    delete _homePositionManager;
    delete _joystickManager;
Don Gagne's avatar
Don Gagne committed
110 111
    delete _linkManager;
    delete _mavlinkProtocol;
112
    delete _missionCommandTree;
dogmaphobic's avatar
dogmaphobic committed
113
    delete _mapEngineManager;
Don Gagne's avatar
Don Gagne committed
114
    delete _multiVehicleManager;
115
    delete _uasMessageHandler;
Jimmy Johnson's avatar
Jimmy Johnson committed
116
    delete _followMe;
Jimmy Johnson's avatar
Jimmy Johnson committed
117
    delete _qgcPositionManager;
118 119 120 121 122 123 124 125 126 127 128 129 130 131
}

QGCTool::QGCTool(QGCApplication* app)
    : QObject((QObject*)app)
    , _app(app)
    , _toolbox(NULL)
{

}

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