QGCToolbox.cc 3.94 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

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

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

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

}

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