QGCToolbox.cc 4.33 KB
Newer Older
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23
 /*=====================================================================

 QGroundControl Open Source Ground Control Station

 (c) 2009 - 2015 QGROUNDCONTROL PROJECT <http://www.qgroundcontrol.org>

 This file is part of the QGROUNDCONTROL project

 QGROUNDCONTROL is free software: you can redistribute it and/or modify
 it under the terms of the GNU General Public License as published by
 the Free Software Foundation, either version 3 of the License, or
 (at your option) any later version.

 QGROUNDCONTROL is distributed in the hope that it will be useful,
 but WITHOUT ANY WARRANTY; without even the implied warranty of
 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 GNU General Public License for more details.

 You should have received a copy of the GNU General Public License
 along with QGROUNDCONTROL. If not, see <http://www.gnu.org/licenses/>.

 ======================================================================*/

Don Gagne's avatar
Don Gagne committed
24 25 26
#include "AutoPilotPluginManager.h"
#include "FactSystem.h"
#include "FirmwarePluginManager.h"
27
#include "FlightMapSettings.h"
Don Gagne's avatar
Don Gagne committed
28
#include "GAudioOutput.h"
29
#ifndef __mobile__
30
#include "GPSManager.h"
Don Gagne's avatar
Don Gagne committed
31
#endif
32 33
#include "HomePositionManager.h"
#include "JoystickManager.h"
Don Gagne's avatar
Don Gagne committed
34 35 36 37
#include "LinkManager.h"
#include "MAVLinkProtocol.h"
#include "MissionCommands.h"
#include "MultiVehicleManager.h"
dogmaphobic's avatar
dogmaphobic committed
38
#include "QGCImageProvider.h"
Don Gagne's avatar
Don Gagne committed
39
#include "UASMessageHandler.h"
dogmaphobic's avatar
dogmaphobic committed
40
#include "QGCMapEngineManager.h"
Jimmy Johnson's avatar
Jimmy Johnson committed
41
#include "FollowMe.h"
Jimmy Johnson's avatar
Jimmy Johnson committed
42
#include "PositionManager.h"
43 44

QGCToolbox::QGCToolbox(QGCApplication* app)
Don Gagne's avatar
Don Gagne committed
45
    : _audioOutput(NULL)
46
    , _autopilotPluginManager(NULL)
Don Gagne's avatar
Don Gagne committed
47 48
    , _factSystem(NULL)
    , _firmwarePluginManager(NULL)
49
    , _flightMapSettings(NULL)
Don Gagne's avatar
Don Gagne committed
50
#ifndef __mobile__
Don Gagne's avatar
Don Gagne committed
51 52
    , _gpsManager(NULL)
#endif
53
    , _homePositionManager(NULL)
Don Gagne's avatar
Don Gagne committed
54
    , _imageProvider(NULL)
55
    , _joystickManager(NULL)
Don Gagne's avatar
Don Gagne committed
56 57 58 59
    , _linkManager(NULL)
    , _mavlinkProtocol(NULL)
    , _missionCommands(NULL)
    , _multiVehicleManager(NULL)
dogmaphobic's avatar
dogmaphobic committed
60
    , _mapEngineManager(NULL)
61
    , _uasMessageHandler(NULL)
Jimmy Johnson's avatar
Jimmy Johnson committed
62
    , _followMe(NULL)
Jimmy Johnson's avatar
Jimmy Johnson committed
63
    , _qgcPositionManager(NULL)
64
{
Don Gagne's avatar
Don Gagne committed
65
    _audioOutput =              new GAudioOutput(app);
66
    _autopilotPluginManager =   new AutoPilotPluginManager(app);
Don Gagne's avatar
Don Gagne committed
67 68
    _factSystem =               new FactSystem(app);
    _firmwarePluginManager =    new FirmwarePluginManager(app);
69
    _flightMapSettings =        new FlightMapSettings(app);
70
#ifndef __mobile__
71
    _gpsManager =               new GPSManager(app);
Don Gagne's avatar
Don Gagne committed
72
#endif
73
    _homePositionManager =      new HomePositionManager(app);
Don Gagne's avatar
Don Gagne committed
74 75
    _imageProvider =            new QGCImageProvider(app);
    _joystickManager =          new JoystickManager(app);
76 77
    _linkManager =              new LinkManager(app);
    _mavlinkProtocol =          new MAVLinkProtocol(app);
Don Gagne's avatar
Don Gagne committed
78 79
    _missionCommands =          new MissionCommands(app);
    _multiVehicleManager =      new MultiVehicleManager(app);
Jimmy Johnson's avatar
Jimmy Johnson committed
80
    _mapEngineManager =         new QGCMapEngineManager(app);
81
    _uasMessageHandler =        new UASMessageHandler(app);
Jimmy Johnson's avatar
Jimmy Johnson committed
82
    _qgcPositionManager =       new QGCPositionManager(app);
Jimmy Johnson's avatar
Jimmy Johnson committed
83
    _followMe =                 new FollowMe(app);
84

Don Gagne's avatar
Don Gagne committed
85
    _audioOutput->setToolbox(this);
86
    _autopilotPluginManager->setToolbox(this);
Don Gagne's avatar
Don Gagne committed
87 88
    _factSystem->setToolbox(this);
    _firmwarePluginManager->setToolbox(this);
89
    _flightMapSettings->setToolbox(this);
90
#ifndef __mobile__
91
    _gpsManager->setToolbox(this);
Don Gagne's avatar
Don Gagne committed
92
#endif
93
    _homePositionManager->setToolbox(this);
Don Gagne's avatar
Don Gagne committed
94 95
    _imageProvider->setToolbox(this);
    _joystickManager->setToolbox(this);
96 97
    _linkManager->setToolbox(this);
    _mavlinkProtocol->setToolbox(this);
Don Gagne's avatar
Don Gagne committed
98 99
    _missionCommands->setToolbox(this);
    _multiVehicleManager->setToolbox(this);
dogmaphobic's avatar
dogmaphobic committed
100
    _mapEngineManager->setToolbox(this);
101
    _uasMessageHandler->setToolbox(this);
Jimmy Johnson's avatar
Jimmy Johnson committed
102
    _followMe->setToolbox(this);
Jimmy Johnson's avatar
Jimmy Johnson committed
103
    _qgcPositionManager->setToolbox(this);
104 105 106 107
}

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

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

}

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