Commit 62acc335 authored by Don Gagne's avatar Don Gagne

Add mission item categories

- New mission command editor dialog
- New MissionCommands toolbox object to get command info
- Added APM mission item set
parent 41a81a78
......@@ -247,6 +247,7 @@ HEADERS += \
src/Joystick/JoystickManager.h \
src/LogCompressor.h \
src/MG.h \
src/MissionManager/MissionCommands.h \
src/MissionManager/MissionController.h \
src/MissionManager/MissionItem.h \
src/MissionManager/MissionManager.h \
......@@ -363,6 +364,7 @@ SOURCES += \
src/Joystick/JoystickManager.cc \
src/LogCompressor.cc \
src/main.cc \
src/MissionManager/MissionCommands.cc \
src/MissionManager/MissionController.cc \
src/MissionManager/MissionItem.cc \
src/MissionManager/MissionManager.cc \
......
......@@ -38,6 +38,7 @@
<file alias="QGroundControl/Controls/MainToolBarIndicators.qml">src/ui/toolbar/MainToolBarIndicators.qml</file>
<file alias="QGroundControl/Controls/MissionItemEditor.qml">src/QmlControls/MissionItemEditor.qml</file>
<file alias="QGroundControl/Controls/MissionItemIndexLabel.qml">src/QmlControls/MissionItemIndexLabel.qml</file>
<file alias="QGroundControl/Controls/MissionCommandDialog.qml">src/QmlControls/MissionCommandDialog.qml</file>
<file alias="QGroundControl/Controls/ModeSwitchDisplay.qml">src/QmlControls/ModeSwitchDisplay.qml</file>
<file alias="QGroundControl/Controls/ParameterEditor.qml">src/QmlControls/ParameterEditor.qml</file>
<file alias="QGroundControl/Controls/ParameterEditorDialog.qml">src/QmlControls/ParameterEditorDialog.qml</file>
......
......@@ -403,6 +403,7 @@ QGCView {
width: parent.width
readOnly: object.sequenceNumber == 0
visible: !readOnly || object.homePositionValid
qgcView: _root
onClicked: setCurrentItem(object.sequenceNumber)
......
......@@ -19,6 +19,7 @@
"description": "Travel to a position in 3D space.",
"specifiesCoordinate": true,
"friendlyEdit": true,
"category": "Basic",
"param1": {
"label": "Hold:",
"units": "seconds",
......@@ -33,6 +34,7 @@
"description": "Travel to a position and Loiter around the specified radius indefinitely.",
"specifiesCoordinate": true,
"friendlyEdit": true,
"category": "Basic",
"param3": {
"label": "Radius:",
"units": "meters",
......@@ -47,6 +49,7 @@
"description": "Travel to a position and Loiter around the specified radius for a number of turns.",
"specifiesCoordinate": true,
"friendlyEdit": true,
"category": "Basic",
"param1": {
"label": "Turns:",
"default": 1,
......@@ -66,6 +69,7 @@
"description": "Travel to a position and Loiter around the specified radius for an amount of time.",
"specifiesCoordinate": true,
"friendlyEdit": true,
"category": "Basic",
"param1": {
"label": "Hold:",
"units": "seconds",
......@@ -84,7 +88,8 @@
"rawName": "MAV_CMD_NAV_RETURN_TO_LAUNCH",
"friendlyName": "Return Home",
"description": "Send the vehicle back to the home position.",
"friendlyEdit": true
"friendlyEdit": true,
"category": "Basic"
},
{
"id": 21,
......@@ -93,6 +98,7 @@
"description": "Land vehicle at the specified location.",
"specifiesCoordinate": true,
"friendlyEdit": true,
"category": "Basic",
"param1": {
"label": "Abort Alt:",
"units": "meters",
......@@ -113,6 +119,7 @@
"description": "Take off from the ground and travel towards the specified position.",
"specifiesCoordinate": true,
"friendlyEdit": true,
"category": "Basic",
"param1": {
"label": "Pitch:",
"units": "degreesConvert",
......@@ -138,6 +145,7 @@
"description": "Sets the region of interest for cameras.",
"specifiesCoordinate": true,
"friendlyEdit": true,
"category": "Camera",
"param1": {
"label": "Mode:",
"enumStrings": "None,Next waypoint,Mission item,Location,ROI item",
......@@ -176,6 +184,7 @@
"friendlyName": "Delay",
"description": "Delay the mission for the number of seconds.",
"friendlyEdit": true,
"category": "Basic",
"param1": {
"label": "Hold:",
"units": "seconds",
......@@ -188,6 +197,7 @@
"rawName": "MAV_CMD_CONDITION_CHANGE_ALT",
"description": "Delay the mission until the specified altitide is reached.",
"friendlyName": "Wait for altitude",
"category": "Conditionals",
"param1": {
"label": "Rate:",
"units": "m/s",
......@@ -206,6 +216,7 @@
"rawName": "MAV_CMD_CONDITION_DISTANCE",
"description": "Delay the mission until within the specified distance of the next waypoint.",
"friendlyName": "Wait for distance",
"category": "Conditionals",
"param1": {
"label": "Distance:",
"units": "meters",
......@@ -218,6 +229,7 @@
"rawName": "MAV_CMD_CONDITION_YAW",
"friendlyName": "Wait for Heading",
"description": "Delay the mission until the specified heading is reached.",
"category": "Conditionals",
"param1": {
"label": "Heading:",
"units": "degrees",
......@@ -250,6 +262,7 @@
"friendlyName": "Jump to item",
"description": "Mission will continue at the specified item.",
"friendlyEdit": true,
"category": "Basic",
"param1": {
"label": "Item #:",
"default": 1,
......@@ -380,6 +393,7 @@
"description": "Sets the region of interest for cameras.",
"specifiesCoordinate": true,
"friendlyEdit": true,
"category": "Camera",
"param1": {
"label": "Mode:",
"enumStrings": "None,Next waypoint,Mission item,Location,ROI item",
......@@ -403,6 +417,7 @@
"rawName": "MAV_CMD_DO_DIGICAM_CONFIGURE",
"friendlyName": "Camera config",
"description": "Configure onboard camera controller.",
"category": "Camera",
"param1": {
"label": "Mode:",
"default": 0,
......@@ -446,6 +461,7 @@
"friendlyName": "Camera control",
"rawName": "MAV_CMD_DO_DIGICAM_CONTROL",
"description": "Control onboard camera.",
"category": "Camera",
"param1": {
"label": "Session:",
"default": 0,
......@@ -483,6 +499,7 @@
"rawName": "MAV_CMD_DO_MOUNT_CONTROL",
"friendlyName": "Mount config",
"description": "Control antenna mount or camera.",
"category": "Camera",
"param1": {
"label": "Lat/Pitch:",
"default": 0,
......@@ -511,6 +528,7 @@
"rawName": "MAV_CMD_DO_SET_CAM_TRIGG_DIST",
"friendlyName": "Camera trigger distance",
"description": "Set camera trigger distance.",
"category": "Camera",
"param1": {
"label": "Distance:",
"default": 25,
......
This diff is collapsed.
/*=====================================================================
QGroundControl Open Source Ground Control Station
(c) 2009 - 2014 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/>.
======================================================================*/
#ifndef MissionCommands_H
#define MissionCommands_H
#include "QGCToolbox.h"
#include "QGCMAVLink.h"
#include "QGCLoggingCategory.h"
#include "QmlObjectListModel.h"
#include "MavlinkQmlSingleton.h"
#include <QObject>
#include <QString>
#include <QJsonObject>
#include <QJsonValue>
Q_DECLARE_LOGGING_CATEGORY(MissionCommandsLog)
class MissionCommands;
class MavCmdParamInfo : public QObject {
Q_OBJECT
public:
MavCmdParamInfo(QObject* parent = NULL)
: QObject(parent)
{
}
Q_PROPERTY(int decimalPlaces READ decimalPlaces CONSTANT)
Q_PROPERTY(double defaultValue READ defaultValue CONSTANT)
Q_PROPERTY(QStringList enumStrings READ enumStrings CONSTANT)
Q_PROPERTY(QVariantList enumValues READ enumValues CONSTANT)
Q_PROPERTY(QString label READ label CONSTANT)
Q_PROPERTY(int param READ param CONSTANT)
Q_PROPERTY(QString units READ units CONSTANT)
int decimalPlaces (void) const { return _decimalPlaces; }
double defaultValue (void) const { return _defaultValue; }
QStringList enumStrings (void) const { return _enumStrings; }
QVariantList enumValues (void) const { return _enumValues; }
QString label (void) const { return _label; }
int param (void) const { return _param; }
QString units (void) const { return _units; }
private:
int _decimalPlaces;
double _defaultValue;
QStringList _enumStrings;
QVariantList _enumValues;
QString _label;
int _param;
QString _units;
friend class MissionCommands;
};
class MavCmdInfo : public QObject {
Q_OBJECT
public:
MavCmdInfo(QObject* parent = NULL)
: QObject(parent)
{
}
Q_PROPERTY(QString category READ category CONSTANT)
Q_PROPERTY(MavlinkQmlSingleton::Qml_MAV_CMD command READ command CONSTANT)
Q_PROPERTY(QString description READ description CONSTANT)
Q_PROPERTY(bool friendlyEdit READ friendlyEdit CONSTANT)
Q_PROPERTY(QString friendlyName READ friendlyName CONSTANT)
Q_PROPERTY(QString rawName READ rawName CONSTANT)
Q_PROPERTY(bool specifiesCoordinate READ specifiesCoordinate CONSTANT)
QString category (void) const { return _category; }
MavlinkQmlSingleton::Qml_MAV_CMD command(void) const { return (MavlinkQmlSingleton::Qml_MAV_CMD)_command; }
QString description (void) const { return _description; }
bool friendlyEdit (void) const { return _friendlyEdit; }
QString friendlyName (void) const { return _friendlyName; }
QString rawName (void) const { return _rawName; }
bool specifiesCoordinate (void) const { return _specifiesCoordinate; }
const QMap<int, MavCmdParamInfo*>& paramInfoMap(void) const { return _paramInfoMap; }
private:
QString _category;
MAV_CMD _command;
QString _description;
bool _friendlyEdit;
QString _friendlyName;
QMap<int, MavCmdParamInfo*> _paramInfoMap;
QString _rawName;
bool _specifiesCoordinate;
friend class MissionCommands;
};
class MissionCommands : public QGCTool
{
Q_OBJECT
public:
MissionCommands(QGCApplication* app);
Q_PROPERTY(QStringList categories READ categories CONSTANT)
Q_PROPERTY(const QmlObjectListModel* commands READ commands CONSTANT)
Q_INVOKABLE QString categoryFromCommand(MavlinkQmlSingleton::Qml_MAV_CMD command) { return _mavCmdInfoMap[(MAV_CMD)command]->category(); }
Q_INVOKABLE const QVariant getCommandsForCategory(const QString& category) const { return QVariant::fromValue(_categoryToMavCmdInfoListMap[category]); }
const QStringList categories (void) const { return _categories; }
const QmlObjectListModel* commands (void) const { return &_commandList; }
const QMap<MAV_CMD, MavCmdInfo*>& commandInfoMap(void) const { return _mavCmdInfoMap; };
static const QString _degreesUnits;
static const QString _degreesConvertUnits;
signals:
private:
void _loadMavCmdInfoJson(void);
void _setupMetaData(void);
bool _validateKeyTypes(QJsonObject& jsonObject, const QStringList& keys, const QList<QJsonValue::Type>& types);
private:
QStringList _categories;
QMap<QString, QmlObjectListModel*> _categoryToMavCmdInfoListMap;
QmlObjectListModel _commandList;
QMap<MAV_CMD, MavCmdInfo*> _mavCmdInfoMap;
static const QString _categoryJsonKey;
static const QString _decimalPlacesJsonKey;
static const QString _defaultJsonKey;
static const QString _descriptionJsonKey;
static const QString _enumStringsJsonKey;
static const QString _enumValuesJsonKey;
static const QString _friendlyNameJsonKey;
static const QString _friendlyEditJsonKey;
static const QString _idJsonKey;
static const QString _labelJsonKey;
static const QString _mavCmdInfoJsonKey;
static const QString _param1JsonKey;
static const QString _param2JsonKey;
static const QString _param3JsonKey;
static const QString _param4JsonKey;
static const QString _paramJsonKeyFormat;
static const QString _rawNameJsonKey;
static const QString _specifiesCoordinateJsonKey;
static const QString _unitsJsonKey;
static const QString _versionJsonKey;
};
#endif
This diff is collapsed.
......@@ -29,8 +29,6 @@
#include <QtQml>
#include <QTextStream>
#include <QGeoCoordinate>
#include <QJsonObject>
#include <QJsonValue>
#include "QGCMAVLink.h"
#include "QGC.h"
......@@ -39,6 +37,7 @@
#include "Fact.h"
#include "QGCLoggingCategory.h"
#include "QmlObjectListModel.h"
#include "MissionCommands.h"
Q_DECLARE_LOGGING_CATEGORY(MissionItemLog)
......@@ -70,6 +69,7 @@ public:
const MissionItem& operator=(const MissionItem& other);
Q_PROPERTY(double azimuth READ azimuth WRITE setAzimuth NOTIFY azimuthChanged) ///< Azimuth to previous waypoint
Q_PROPERTY(QString category READ category NOTIFY commandChanged)
Q_PROPERTY(MavlinkQmlSingleton::Qml_MAV_CMD command READ command WRITE setCommand NOTIFY commandChanged)
Q_PROPERTY(QString commandDescription READ commandDescription NOTIFY commandChanged)
Q_PROPERTY(QString commandName READ commandName NOTIFY commandChanged)
......@@ -97,6 +97,7 @@ public:
// Property accesors
double azimuth (void) const { return _azimuth; }
QString category (void) const;
MavlinkQmlSingleton::Qml_MAV_CMD command(void) const { return (MavlinkQmlSingleton::Qml_MAV_CMD)_commandFact.cookedValue().toInt(); };
QString commandDescription (void) const;
QString commandName (void) const;
......@@ -206,34 +207,12 @@ private slots:
private:
void _clearParamMetaData(void);
void _connectSignals(void);
bool _loadMavCmdInfoJson(void);
void _setupMetaData(void);
bool _validateKeyTypes(QJsonObject& jsonObject, const QStringList& keys, const QList<QJsonValue::Type>& types);
static QVariant _degreesToRadians(const QVariant& degrees);
static QVariant _radiansToDegrees(const QVariant& radians);
private:
typedef struct {
double defaultValue;
int decimalPlaces;
QStringList enumStrings;
QVariantList enumValues;
QString label;
int param;
QString units;
} ParamInfo_t;
typedef struct {
MAV_CMD command;
QString description;
bool friendlyEdit;
QString friendlyName;
QMap<int, ParamInfo_t> paramInfoMap;
QString rawName;
bool specifiesCoordinate;
} MavCmdInfo_t;
bool _rawEdit;
bool _dirty;
int _sequenceNumber;
......@@ -279,30 +258,7 @@ private:
bool _syncingHeadingDegreesAndParam4; ///< true: already in a sync signal, prevents signal loop
bool _syncingSupportedCommandAndCommand; ///< true: already in a sync signal, prevents signal loop
static QMap<MAV_CMD, MavCmdInfo_t> _mavCmdInfoMap;
static const QString _decimalPlacesJsonKey;
static const QString _defaultJsonKey;
static const QString _descriptionJsonKey;
static const QString _enumStringsJsonKey;
static const QString _enumValuesJsonKey;
static const QString _friendlyNameJsonKey;
static const QString _friendlyEditJsonKey;
static const QString _idJsonKey;
static const QString _labelJsonKey;
static const QString _mavCmdInfoJsonKey;
static const QString _param1JsonKey;
static const QString _param2JsonKey;
static const QString _param3JsonKey;
static const QString _param4JsonKey;
static const QString _paramJsonKeyFormat;
static const QString _rawNameJsonKey;
static const QString _specifiesCoordinateJsonKey;
static const QString _unitsJsonKey;
static const QString _versionJsonKey;
static const QString _degreesUnits;
static const QString _degreesConvertUnits;
const QMap<MAV_CMD, MavCmdInfo*>& _mavCmdInfoMap;
};
QDebug operator<<(QDebug dbg, const MissionItem& missionItem);
......
......@@ -88,6 +88,7 @@
#include "CoordinateVector.h"
#include "MainToolBarController.h"
#include "MissionController.h"
#include "MissionCommands.h"
#include "FlightDisplayViewController.h"
#include "VideoSurface.h"
#include "VideoReceiver.h"
......@@ -338,6 +339,13 @@ void QGCApplication::_initCommon(void)
qmlRegisterType<QGCPalette> ("QGroundControl.Palette", 1, 0, "QGCPalette");
qmlRegisterType<QGCMapPalette> ("QGroundControl.Palette", 1, 0, "QGCMapPalette");
qmlRegisterUncreatableType<CoordinateVector> ("QGroundControl", 1, 0, "CoordinateVector", "Reference only");
qmlRegisterUncreatableType<MissionCommands> ("QGroundControl", 1, 0, "MissionCommands", "Reference only");
qmlRegisterUncreatableType<QGCQGeoCoordinate> ("QGroundControl", 1, 0, "QGCQGeoCoordinate", "Reference only");
qmlRegisterUncreatableType<QmlObjectListModel> ("QGroundControl", 1, 0, "QmlObjectListModel", "Reference only");
qmlRegisterUncreatableType<VideoReceiver> ("QGroundControl", 1, 0, "VideoReceiver", "Reference only");
qmlRegisterUncreatableType<VideoSurface> ("QGroundControl", 1, 0, "VideoSurface", "Reference only");
qmlRegisterUncreatableType<AutoPilotPlugin> ("QGroundControl.AutoPilotPlugin", 1, 0, "AutoPilotPlugin", "Reference only");
qmlRegisterUncreatableType<VehicleComponent> ("QGroundControl.AutoPilotPlugin", 1, 0, "VehicleComponent", "Reference only");
qmlRegisterUncreatableType<Vehicle> ("QGroundControl.Vehicle", 1, 0, "Vehicle", "Reference only");
......@@ -345,11 +353,6 @@ void QGCApplication::_initCommon(void)
qmlRegisterUncreatableType<MissionManager> ("QGroundControl.Vehicle", 1, 0, "MissionManager", "Reference only");
qmlRegisterUncreatableType<JoystickManager> ("QGroundControl.JoystickManager", 1, 0, "JoystickManager", "Reference only");
qmlRegisterUncreatableType<Joystick> ("QGroundControl.JoystickManager", 1, 0, "Joystick", "Reference only");
qmlRegisterUncreatableType<QmlObjectListModel> ("QGroundControl", 1, 0, "QmlObjectListModel", "Reference only");
qmlRegisterUncreatableType<QGCQGeoCoordinate> ("QGroundControl", 1, 0, "QGCQGeoCoordinate", "Reference only");
qmlRegisterUncreatableType<CoordinateVector> ("QGroundControl", 1, 0, "CoordinateVector", "Reference only");
qmlRegisterUncreatableType<VideoSurface> ("QGroundControl", 1, 0, "VideoSurface", "Reference only");
qmlRegisterUncreatableType<VideoReceiver> ("QGroundControl", 1, 0, "VideoReceiver", "Reference only");
qmlRegisterType<ParameterEditorController> ("QGroundControl.Controllers", 1, 0, "ParameterEditorController");
qmlRegisterType<FlightModesComponentController> ("QGroundControl.Controllers", 1, 0, "FlightModesComponentController");
......
......@@ -21,73 +21,78 @@
======================================================================*/
#include "LinkManager.h"
#include "MAVLinkProtocol.h"
#include "AutoPilotPluginManager.h"
#include "FactSystem.h"
#include "FirmwarePluginManager.h"
#include "FlightMapSettings.h"
#include "GAudioOutput.h"
#include "HomePositionManager.h"
#include "FirmwarePluginManager.h"
#include "MultiVehicleManager.h"
#include "JoystickManager.h"
#include "GAudioOutput.h"
#include "AutoPilotPluginManager.h"
#include "UASMessageHandler.h"
#include "FactSystem.h"
#include "LinkManager.h"
#include "MAVLinkProtocol.h"
#include "MissionCommands.h"
#include "MultiVehicleManager.h"
#include "QGCImageProvider.h"
#include "UASMessageHandler.h"
QGCToolbox::QGCToolbox(QGCApplication* app)
: _firmwarePluginManager(NULL)
: _audioOutput(NULL)
, _autopilotPluginManager(NULL)
, _linkManager(NULL)
, _multiVehicleManager(NULL)
, _mavlinkProtocol(NULL)
, _factSystem(NULL)
, _firmwarePluginManager(NULL)
, _flightMapSettings(NULL)
, _homePositionManager(NULL)
, _imageProvider(NULL)
, _joystickManager(NULL)
, _audioOutput(NULL)
, _linkManager(NULL)
, _mavlinkProtocol(NULL)
, _missionCommands(NULL)
, _multiVehicleManager(NULL)
, _uasMessageHandler(NULL)
, _factSystem(NULL)
, _imageProvider(NULL)
{
_firmwarePluginManager = new FirmwarePluginManager(app);
_audioOutput = new GAudioOutput(app);
_autopilotPluginManager = new AutoPilotPluginManager(app);
_factSystem = new FactSystem(app);
_firmwarePluginManager = new FirmwarePluginManager(app);
_flightMapSettings = new FlightMapSettings(app);
_homePositionManager = new HomePositionManager(app);
_factSystem = new FactSystem(app);
_imageProvider = new QGCImageProvider(app);
_joystickManager = new JoystickManager(app);
_linkManager = new LinkManager(app);
_multiVehicleManager = new MultiVehicleManager(app);
_mavlinkProtocol = new MAVLinkProtocol(app);
_joystickManager = new JoystickManager(app);
_audioOutput = new GAudioOutput(app);
_missionCommands = new MissionCommands(app);
_multiVehicleManager = new MultiVehicleManager(app);
_uasMessageHandler = new UASMessageHandler(app);
_imageProvider = new QGCImageProvider(app);
_firmwarePluginManager->setToolbox(this);
_audioOutput->setToolbox(this);
_autopilotPluginManager->setToolbox(this);
_factSystem->setToolbox(this);
_firmwarePluginManager->setToolbox(this);
_flightMapSettings->setToolbox(this);
_homePositionManager->setToolbox(this);
_factSystem->setToolbox(this);
_imageProvider->setToolbox(this);
_joystickManager->setToolbox(this);
_linkManager->setToolbox(this);
_multiVehicleManager->setToolbox(this);
_mavlinkProtocol->setToolbox(this);
_joystickManager->setToolbox(this);
_audioOutput->setToolbox(this);
_missionCommands->setToolbox(this);
_multiVehicleManager->setToolbox(this);
_uasMessageHandler->setToolbox(this);
_imageProvider->setToolbox(this);
}
QGCToolbox::~QGCToolbox()
{
delete _firmwarePluginManager;
delete _audioOutput;
delete _autopilotPluginManager;
delete _linkManager;
delete _multiVehicleManager;
delete _mavlinkProtocol;
delete _factSystem;
delete _firmwarePluginManager;
delete _flightMapSettings;
delete _homePositionManager;
delete _joystickManager;
delete _audioOutput;
delete _linkManager;
delete _mavlinkProtocol;
delete _missionCommands;
delete _multiVehicleManager;
delete _uasMessageHandler;
delete _factSystem;
}
QGCTool::QGCTool(QGCApplication* app)
......
......@@ -26,19 +26,20 @@
#include <QObject>
class QGCApplication;
class AutoPilotPluginManager;
class FactSystem;
class FirmwarePluginManager;
class FlightMapSettings;
class GAudioOutput;
class HomePositionManager;
class JoystickManager;
class LinkManager;
class MAVLinkProtocol;
class MissionCommands;
class MultiVehicleManager;
class JoystickManager;
class UASMessageHandler;
class HomePositionManager;
class FlightMapSettings;
class GAudioOutput;
class FirmwarePluginManager;
class AutoPilotPluginManager;
class FactSystem;
class QGCApplication;
class QGCImageProvider;
class UASMessageHandler;
/// This is used to manage all of our top level services/tools
class QGCToolbox {
......@@ -47,31 +48,33 @@ public:
QGCToolbox(QGCApplication* app);
~QGCToolbox();
AutoPilotPluginManager* autopilotPluginManager(void) { return _autopilotPluginManager; }
FirmwarePluginManager* firmwarePluginManager(void) { return _firmwarePluginManager; }
FlightMapSettings* flightMapSettings(void) { return _flightMapSettings; }
GAudioOutput* audioOutput(void) { return _audioOutput; }
HomePositionManager* homePositionManager(void) { return _homePositionManager; }
JoystickManager* joystickManager(void) { return _joystickManager; }
LinkManager* linkManager(void) { return _linkManager; }
MAVLinkProtocol* mavlinkProtocol(void) { return _mavlinkProtocol; }
MissionCommands* missionCommands(void) { return _missionCommands; }
MultiVehicleManager* multiVehicleManager(void) { return _multiVehicleManager; }
JoystickManager* joystickManager(void) { return _joystickManager; }
UASMessageHandler* uasMessageHandler(void) { return _uasMessageHandler; }
HomePositionManager* homePositionManager(void) { return _homePositionManager; }
FlightMapSettings* flightMapSettings(void) { return _flightMapSettings; }
GAudioOutput* audioOutput(void) { return _audioOutput; }
FirmwarePluginManager* firmwarePluginManager(void) { return _firmwarePluginManager; }
AutoPilotPluginManager* autopilotPluginManager(void) { return _autopilotPluginManager; }
QGCImageProvider* imageProvider() { return _imageProvider; }
UASMessageHandler* uasMessageHandler(void) { return _uasMessageHandler; }
private:
FirmwarePluginManager* _firmwarePluginManager;
GAudioOutput* _audioOutput;
AutoPilotPluginManager* _autopilotPluginManager;
LinkManager* _linkManager;
MultiVehicleManager* _multiVehicleManager;
MAVLinkProtocol* _mavlinkProtocol;
FactSystem* _factSystem;
FirmwarePluginManager* _firmwarePluginManager;
FlightMapSettings* _flightMapSettings;
HomePositionManager* _homePositionManager;
QGCImageProvider* _imageProvider;
JoystickManager* _joystickManager;
GAudioOutput* _audioOutput;
LinkManager* _linkManager;
MAVLinkProtocol* _mavlinkProtocol;
MissionCommands* _missionCommands;
MultiVehicleManager* _multiVehicleManager;
UASMessageHandler* _uasMessageHandler;
FactSystem* _factSystem;
QGCImageProvider* _imageProvider;
};
/// This is the base class for all tools
......
/*=====================================================================
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/>.
======================================================================*/
import QtQuick 2.5
import QtQuick.Controls 1.4
import QGroundControl 1.0
import QGroundControl.Controls 1.0
import QGroundControl.ScreenTools 1.0
import QGroundControl.Palette 1.0
QGCViewDialog {
property var missionItem
QGCPalette { id: qgcPal }
QGCLabel {
id: categoryLabel
anchors.baseline: categoryCombo.baseline
text: "Category:"
}
QGCComboBox {
id: categoryCombo
anchors.margins: ScreenTools.defaultFontPixelWidth
anchors.left: categoryLabel.right
anchors.right: parent.right
model: QGroundControl.missionCommands.categories
function categorySelected(category) {
commandList.model = QGroundControl.missionCommands.getCommandsForCategory(category)
console.log("changing model", category)
}
Component.onCompleted: {
var category = missionItem.category
currentIndex = find(category)
categorySelected(category)
}
onActivated: categorySelected(textAt(index))
}
ListView {
id: commandList
anchors.margins: ScreenTools.defaultFontPixelHeight
anchors.left: parent.left
anchors.right: parent.right
anchors.top: categoryCombo.bottom
anchors.bottom: parent.bottom
spacing: ScreenTools.defaultFontPixelHeight / 2
orientation: ListView.Vertical
onModelChanged: {
var currentCategory = categoryCombo.currentText
currentIndex = -1
if (missionItem.category == currentCategory) {
var commandList = QGroundControl.missionCommands.getCommandsForCategory(currentCategory)
for (var i=0; i<commandList.count; i++) {
if (commandList.get(i).command == missionItem.command) {
currentIndex = i
break
}
}
}
}
highlight: Rectangle {
color: qgcPal.buttonHighlight
}
delegate: Rectangle {
width: parent.width
height: commandColumn.height + ScreenTools.defaultFontPixelSize
color: currentItem ? qgcPal.buttonHighlight : qgcPal.button
property var mavCmdInfo: object
property bool currentItem: commandList.currentItem == this
property var textColor: currentItem ? qgcPal.buttonHighlightText : qgcPal.buttonText
Column {
id: commandColumn
anchors.margins: ScreenTools.defaultFontPixelWidth
anchors.left: parent.left
anchors.right: parent.right
anchors.top: parent.top
QGCLabel {
text: mavCmdInfo.friendlyName
color: textColor
}
QGCLabel {
anchors.margins: ScreenTools.defaultFontPixelWidth
anchors.left: parent.left
anchors.right: parent.right
text: mavCmdInfo.description
wrapMode: Text.WordWrap
color: textColor
}
}
MouseArea {
anchors.fill: parent
onClicked: {
missionItem.command = mavCmdInfo.command
accept()
}
}
}
} // ListView
} // QGCViewDialog
import QtQuick 2.2
import QtQuick.Controls 1.2
import QtQuick.Controls.Styles 1.2
import QtQuick.Dialogs 1.2
import QGroundControl.ScreenTools 1.0
import QGroundControl.Vehicle 1.0
......@@ -15,6 +16,7 @@ Rectangle {
property var missionItem ///< MissionItem associated with this editor
property bool readOnly ///< true: read only view, false: full editing view
property var qgcView ///< QGCView control used for showing dialogs
signal clicked
signal remove
......@@ -56,8 +58,8 @@ Rectangle {
Image {
id: rawEdit
anchors.leftMargin: ScreenTools.defaultFontPixelWidth * 8
anchors.left: label.right
anchors.rightMargin: ScreenTools.defaultFontPixelWidth
anchors.right: parent.right
anchors.verticalCenter: commandPicker.verticalCenter
width: commandPicker.height
height: commandPicker.height
......@@ -70,16 +72,24 @@ Rectangle {
}
}
FactComboBox {
id: commandPicker
anchors.leftMargin: ScreenTools.defaultFontPixelWidth
anchors.left: rawEdit.right
anchors.right: parent.right
indexModel: false
fact: missionItem.supportedCommand
visible: missionItem.sequenceNumber != 0 && missionItem.isCurrentItem && !missionItem.rawEdit
QGCButton {
id: commandPicker
anchors.leftMargin: ScreenTools.defaultFontPixelWidth * 2
anchors.rightMargin: ScreenTools.defaultFontPixelWidth
anchors.left: label.right
anchors.right: rawEdit.left
visible: missionItem.sequenceNumber != 0 && missionItem.isCurrentItem && !missionItem.rawEdit
text: missionItem.commandName
Component {
id: commandDialog
MissionCommandDialog {
missionItem: _root.missionItem
}
}
onActivated: missionItem.commandByIndex = index
onClicked: qgcView.showDialog(commandDialog, "Select Mission Command", 40, StandardButton.Cancel)
}
Rectangle {
......
......@@ -306,7 +306,7 @@ FactPanel {
QGCButton {
id: __rejectButton
anchors.right: __acceptButton.left
anchors.right: __acceptButton.visible ? __acceptButton.left : parent.right
anchors.bottom: parent.bottom
onClicked: __dialogComponentLoader.item.reject()
......
......@@ -6,6 +6,7 @@ ExclusiveGroupItem 1.0 ExclusiveGroupItem.qml
IndicatorButton 1.0 IndicatorButton.qml
JoystickThumbPad 1.0 JoystickThumbPad.qml
MainToolBar 1.0 MainToolBar.qml
MissionCommandDialog 1.0 MissionCommandDialog.qml
MissionItemEditor 1.0 MissionItemEditor.qml
MissionItemIndexLabel 1.0 MissionItemIndexLabel.qml
ModeSwitchDisplay 1.0 ModeSwitchDisplay.qml
......
......@@ -29,16 +29,17 @@
#include <QSettings>
static const char* kQmlGlobalKeyName = "QGCQml";
static const char* kQmlGlobalKeyName = "QGCQml";
const char* QGroundControlQmlGlobal::_virtualTabletJoystickKey = "VirtualTabletJoystick";
QGroundControlQmlGlobal::QGroundControlQmlGlobal(QGCToolbox* toolbox, QObject* parent)
: QObject(parent)
, _multiVehicleManager(toolbox->multiVehicleManager())
, _linkManager(toolbox->linkManager())
, _homePositionManager(toolbox->homePositionManager())
, _flightMapSettings(toolbox->flightMapSettings())
, _homePositionManager(toolbox->homePositionManager())
, _linkManager(toolbox->linkManager())
, _missionCommands(toolbox->missionCommands())
, _multiVehicleManager(toolbox->multiVehicleManager())
, _virtualTabletJoystick(false)
{
QSettings settings;
......
......@@ -34,6 +34,7 @@
#include "LinkManager.h"
#include "HomePositionManager.h"
#include "FlightMapSettings.h"
#include "MissionCommands.h"
#ifdef QT_DEBUG
#include "MockLink.h"
......@@ -48,10 +49,11 @@ class QGroundControlQmlGlobal : public QObject
public:
QGroundControlQmlGlobal(QGCToolbox* toolbox, QObject* parent = NULL);
Q_PROPERTY(FlightMapSettings* flightMapSettings READ flightMapSettings CONSTANT)
Q_PROPERTY(HomePositionManager* homePositionManager READ homePositionManager CONSTANT)
Q_PROPERTY(LinkManager* linkManager READ linkManager CONSTANT)
Q_PROPERTY(MissionCommands* missionCommands READ missionCommands CONSTANT)
Q_PROPERTY(MultiVehicleManager* multiVehicleManager READ multiVehicleManager CONSTANT)
Q_PROPERTY(HomePositionManager* homePositionManager READ homePositionManager CONSTANT)
Q_PROPERTY(FlightMapSettings* flightMapSettings READ flightMapSettings CONSTANT)
Q_PROPERTY(qreal zOrderTopMost READ zOrderTopMost CONSTANT) ///< z order for top most items, toolbar, main window sub view
Q_PROPERTY(qreal zOrderWidgets READ zOrderWidgets CONSTANT) ///< z order value to widgets, for example: zoom controls, hud widgetss
......@@ -85,10 +87,11 @@ public:
// Property accesors
FlightMapSettings* flightMapSettings () { return _flightMapSettings; }
HomePositionManager* homePositionManager () { return _homePositionManager; }
LinkManager* linkManager () { return _linkManager; }
MissionCommands* missionCommands () { return _missionCommands; }
MultiVehicleManager* multiVehicleManager () { return _multiVehicleManager; }
HomePositionManager* homePositionManager () { return _homePositionManager; }
FlightMapSettings* flightMapSettings () { return _flightMapSettings; }
qreal zOrderTopMost () { return 1000; }
qreal zOrderWidgets () { return 100; }
......@@ -133,10 +136,11 @@ private:
void _startMockLink(MockConfiguration* mockConfig);
#endif
MultiVehicleManager* _multiVehicleManager;
LinkManager* _linkManager;
HomePositionManager* _homePositionManager;
FlightMapSettings* _flightMapSettings;
HomePositionManager* _homePositionManager;
LinkManager* _linkManager;
MissionCommands* _missionCommands;
MultiVehicleManager* _multiVehicleManager;
bool _virtualTabletJoystick;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment