QGCToolbox.cc 3.77 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 31

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

Don Gagne's avatar
Don Gagne committed
72
    _audioOutput->setToolbox(this);
73
    _autopilotPluginManager->setToolbox(this);
Don Gagne's avatar
Don Gagne committed
74 75
    _factSystem->setToolbox(this);
    _firmwarePluginManager->setToolbox(this);
76
    _flightMapSettings->setToolbox(this);
77
#ifndef __mobile__
78
    _gpsManager->setToolbox(this);
Don Gagne's avatar
Don Gagne committed
79
#endif
80
    _homePositionManager->setToolbox(this);
Don Gagne's avatar
Don Gagne committed
81 82
    _imageProvider->setToolbox(this);
    _joystickManager->setToolbox(this);
83 84
    _linkManager->setToolbox(this);
    _mavlinkProtocol->setToolbox(this);
85
    _missionCommandTree->setToolbox(this);
Don Gagne's avatar
Don Gagne committed
86
    _multiVehicleManager->setToolbox(this);
dogmaphobic's avatar
dogmaphobic committed
87
    _mapEngineManager->setToolbox(this);
88
    _uasMessageHandler->setToolbox(this);
Jimmy Johnson's avatar
Jimmy Johnson committed
89
    _followMe->setToolbox(this);
Jimmy Johnson's avatar
Jimmy Johnson committed
90
    _qgcPositionManager->setToolbox(this);
91 92 93 94
}

QGCToolbox::~QGCToolbox()
{
Don Gagne's avatar
Don Gagne committed
95
    delete _audioOutput;
96
    delete _autopilotPluginManager;
Don Gagne's avatar
Don Gagne committed
97 98
    delete _factSystem;
    delete _firmwarePluginManager;
99 100 101
    delete _flightMapSettings;
    delete _homePositionManager;
    delete _joystickManager;
Don Gagne's avatar
Don Gagne committed
102 103
    delete _linkManager;
    delete _mavlinkProtocol;
104
    delete _missionCommandTree;
dogmaphobic's avatar
dogmaphobic committed
105
    delete _mapEngineManager;
Don Gagne's avatar
Don Gagne committed
106
    delete _multiVehicleManager;
107
    delete _uasMessageHandler;
Jimmy Johnson's avatar
Jimmy Johnson committed
108
    delete _followMe;
Jimmy Johnson's avatar
Jimmy Johnson committed
109
    delete _qgcPositionManager;
110 111 112 113 114 115 116 117 118 119 120 121 122 123
}

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

}

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