QGCToolbox.cc 3.57 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 30
#include "HomePositionManager.h"
#include "JoystickManager.h"
Don Gagne's avatar
Don Gagne committed
31 32 33 34
#include "LinkManager.h"
#include "MAVLinkProtocol.h"
#include "MissionCommands.h"
#include "MultiVehicleManager.h"
dogmaphobic's avatar
dogmaphobic committed
35
#include "QGCImageProvider.h"
Don Gagne's avatar
Don Gagne committed
36
#include "UASMessageHandler.h"
37 38

QGCToolbox::QGCToolbox(QGCApplication* app)
Don Gagne's avatar
Don Gagne committed
39
    : _audioOutput(NULL)
40
    , _autopilotPluginManager(NULL)
Don Gagne's avatar
Don Gagne committed
41 42
    , _factSystem(NULL)
    , _firmwarePluginManager(NULL)
43 44
    , _flightMapSettings(NULL)
    , _homePositionManager(NULL)
Don Gagne's avatar
Don Gagne committed
45
    , _imageProvider(NULL)
46
    , _joystickManager(NULL)
Don Gagne's avatar
Don Gagne committed
47 48 49 50
    , _linkManager(NULL)
    , _mavlinkProtocol(NULL)
    , _missionCommands(NULL)
    , _multiVehicleManager(NULL)
51 52
    , _uasMessageHandler(NULL)
{
Don Gagne's avatar
Don Gagne committed
53
    _audioOutput =              new GAudioOutput(app);
54
    _autopilotPluginManager =   new AutoPilotPluginManager(app);
Don Gagne's avatar
Don Gagne committed
55 56
    _factSystem =               new FactSystem(app);
    _firmwarePluginManager =    new FirmwarePluginManager(app);
57 58
    _flightMapSettings =        new FlightMapSettings(app);
    _homePositionManager =      new HomePositionManager(app);
Don Gagne's avatar
Don Gagne committed
59 60
    _imageProvider =            new QGCImageProvider(app);
    _joystickManager =          new JoystickManager(app);
61 62
    _linkManager =              new LinkManager(app);
    _mavlinkProtocol =          new MAVLinkProtocol(app);
Don Gagne's avatar
Don Gagne committed
63 64
    _missionCommands =          new MissionCommands(app);
    _multiVehicleManager =      new MultiVehicleManager(app);
65 66
    _uasMessageHandler =        new UASMessageHandler(app);

Don Gagne's avatar
Don Gagne committed
67
    _audioOutput->setToolbox(this);
68
    _autopilotPluginManager->setToolbox(this);
Don Gagne's avatar
Don Gagne committed
69 70
    _factSystem->setToolbox(this);
    _firmwarePluginManager->setToolbox(this);
71 72
    _flightMapSettings->setToolbox(this);
    _homePositionManager->setToolbox(this);
Don Gagne's avatar
Don Gagne committed
73 74
    _imageProvider->setToolbox(this);
    _joystickManager->setToolbox(this);
75 76
    _linkManager->setToolbox(this);
    _mavlinkProtocol->setToolbox(this);
Don Gagne's avatar
Don Gagne committed
77 78
    _missionCommands->setToolbox(this);
    _multiVehicleManager->setToolbox(this);
79 80 81 82 83
    _uasMessageHandler->setToolbox(this);
}

QGCToolbox::~QGCToolbox()
{
Don Gagne's avatar
Don Gagne committed
84
    delete _audioOutput;
85
    delete _autopilotPluginManager;
Don Gagne's avatar
Don Gagne committed
86 87
    delete _factSystem;
    delete _firmwarePluginManager;
88 89 90
    delete _flightMapSettings;
    delete _homePositionManager;
    delete _joystickManager;
Don Gagne's avatar
Don Gagne committed
91 92 93 94
    delete _linkManager;
    delete _mavlinkProtocol;
    delete _missionCommands;
    delete _multiVehicleManager;
95 96 97 98 99 100 101 102 103 104 105 106 107 108 109
    delete _uasMessageHandler;
}

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

}

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