Commit e7f9d931 authored by Andreas Bircher's avatar Andreas Bircher

adding choice for offline mission editing vehicle type and associated cruise and hover speeds

offline mission planning settings
parent b5164290
......@@ -19,6 +19,10 @@ static const char* kQmlGlobalKeyName = "QGCQml";
SettingsFact* QGroundControlQmlGlobal::_offlineEditingFirmwareTypeFact = NULL;
FactMetaData* QGroundControlQmlGlobal::_offlineEditingFirmwareTypeMetaData = NULL;
SettingsFact* QGroundControlQmlGlobal::_offlineEditingVehicleTypeFact = NULL;
FactMetaData* QGroundControlQmlGlobal::_offlineEditingVehicleTypeMetaData = NULL;
SettingsFact* QGroundControlQmlGlobal::_offlineEditingCruiseSpeedFact = NULL;
SettingsFact* QGroundControlQmlGlobal::_offlineEditingHoverSpeedFact = NULL;
SettingsFact* QGroundControlQmlGlobal::_distanceUnitsFact = NULL;
FactMetaData* QGroundControlQmlGlobal::_distanceUnitsMetaData = NULL;
SettingsFact* QGroundControlQmlGlobal::_speedUnitsFact = NULL;
......@@ -226,6 +230,41 @@ Fact* QGroundControlQmlGlobal::offlineEditingFirmwareType(void)
return _offlineEditingFirmwareTypeFact;
}
Fact* QGroundControlQmlGlobal::offlineEditingVehicleType(void)
{
if (!_offlineEditingVehicleTypeFact) {
QStringList enumStrings;
QVariantList enumValues;
_offlineEditingVehicleTypeFact = new SettingsFact(QString(), "OfflineEditingVehicleType", FactMetaData::valueTypeUint32, (uint32_t)MAV_TYPE_FIXED_WING);
_offlineEditingVehicleTypeMetaData = new FactMetaData(FactMetaData::valueTypeUint32);
enumStrings << "Fixedwing" << "Multicopter" << "VTOL";
enumValues << QVariant::fromValue((uint32_t)MAV_TYPE_FIXED_WING) << QVariant::fromValue((uint32_t)MAV_TYPE_QUADROTOR) << QVariant::fromValue((uint32_t)MAV_TYPE_VTOL_DUOROTOR);
_offlineEditingVehicleTypeMetaData->setEnumInfo(enumStrings, enumValues);
_offlineEditingVehicleTypeFact->setMetaData(_offlineEditingVehicleTypeMetaData);
}
return _offlineEditingVehicleTypeFact;
}
Fact* QGroundControlQmlGlobal::offlineEditingCruiseSpeed(void)
{
if (!_offlineEditingCruiseSpeedFact) {
_offlineEditingCruiseSpeedFact = new SettingsFact(QString(), "OfflineEditingCruiseSpeed", FactMetaData::valueTypeDouble, 16.0);
}
return _offlineEditingCruiseSpeedFact;
}
Fact* QGroundControlQmlGlobal::offlineEditingHoverSpeed(void)
{
if (!_offlineEditingHoverSpeedFact) {
_offlineEditingHoverSpeedFact = new SettingsFact(QString(), "OfflineEditingHoverSpeed", FactMetaData::valueTypeDouble, 4.0);
}
return _offlineEditingHoverSpeedFact;
}
Fact* QGroundControlQmlGlobal::distanceUnits(void)
{
if (!_distanceUnitsFact) {
......
......@@ -82,6 +82,9 @@ public:
Q_PROPERTY(int mavlinkSystemID READ mavlinkSystemID WRITE setMavlinkSystemID NOTIFY mavlinkSystemIDChanged)
Q_PROPERTY(Fact* offlineEditingFirmwareType READ offlineEditingFirmwareType CONSTANT)
Q_PROPERTY(Fact* offlineEditingVehicleType READ offlineEditingVehicleType CONSTANT)
Q_PROPERTY(Fact* offlineEditingCruiseSpeed READ offlineEditingCruiseSpeed CONSTANT)
Q_PROPERTY(Fact* offlineEditingHoverSpeed READ offlineEditingHoverSpeed CONSTANT)
Q_PROPERTY(Fact* distanceUnits READ distanceUnits CONSTANT)
Q_PROPERTY(Fact* speedUnits READ speedUnits CONSTANT)
......@@ -158,6 +161,9 @@ public:
QGeoCoordinate lastKnownHomePosition() { return qgcApp()->lastKnownHomePosition(); }
static Fact* offlineEditingFirmwareType (void);
static Fact* offlineEditingVehicleType (void);
static Fact* offlineEditingCruiseSpeed (void);
static Fact* offlineEditingHoverSpeed (void);
static Fact* distanceUnits (void);
static Fact* speedUnits (void);
......@@ -212,6 +218,10 @@ private:
// These are static so they are available to C++ code as well as Qml
static SettingsFact* _offlineEditingFirmwareTypeFact;
static FactMetaData* _offlineEditingFirmwareTypeMetaData;
static SettingsFact* _offlineEditingVehicleTypeFact;
static FactMetaData* _offlineEditingVehicleTypeMetaData;
static SettingsFact* _offlineEditingCruiseSpeedFact;
static SettingsFact* _offlineEditingHoverSpeedFact;
static SettingsFact* _distanceUnitsFact;
static FactMetaData* _distanceUnitsMetaData;
static SettingsFact* _speedUnitsFact;
......
......@@ -378,11 +378,15 @@ QGCView {
//-----------------------------------------------------------------
//-- Offline mission editing settings
QGCLabel { text: "Offline mission editing" }
Row {
spacing: ScreenTools.defaultFontPixelWidth
QGCLabel {
text: qsTr("Offline mission editing:")
text: qsTr("Firmware:")
width: hoverSpeedLabel.width
anchors.baseline: offlineTypeCombo.baseline
}
......@@ -394,6 +398,62 @@ QGCView {
}
}
Row {
spacing: ScreenTools.defaultFontPixelWidth
QGCLabel {
text: qsTr("Vehicle:")
width: hoverSpeedLabel.width
anchors.baseline: offlineVehicleCombo.baseline
}
FactComboBox {
id: offlineVehicleCombo
width: offlineTypeCombo.width
fact: QGroundControl.offlineEditingVehicleType
indexModel: false
}
}
Row {
spacing: ScreenTools.defaultFontPixelWidth
visible: offlineVehicleCombo.currentText != "Multicopter"
QGCLabel {
text: qsTr("Cruise speed:")
width: hoverSpeedLabel.width
anchors.baseline: cruiseSpeedField.baseline
}
FactTextField {
id: cruiseSpeedField
width: offlineTypeCombo.width
fact: QGroundControl.offlineEditingCruiseSpeed
enabled: true
}
}
Row {
spacing: ScreenTools.defaultFontPixelWidth
visible: offlineVehicleCombo.currentText != "Fixedwing"
QGCLabel {
id: hoverSpeedLabel
text: qsTr("Hover speed:")
width: baseFontLabel.width
anchors.baseline: hoverSpeedField.baseline
}
FactTextField {
id: hoverSpeedField
width: offlineTypeCombo.width
fact: QGroundControl.offlineEditingHoverSpeed
enabled: true
}
}
Item {
height: ScreenTools.defaultFontPixelHeight / 2
width: parent.width
......
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