Commit 2929f008 authored by Gus Grubba's avatar Gus Grubba

Merge branch 'master' of https://github.com/mavlink/qgroundcontrol into Airmap

# Conflicts:
#	src/Vehicle/Vehicle.cc
#	src/api/QGCCorePlugin.cc
parents 587c42a7 70f899c6
# QGroundControl Change Log
Note: This file only contains high level features or important fixes.
## 3.5
### 3.5.0 - Not yet released
* Add ESTIMATOR_STATUS values to new estimatorStatus Vehicle FactGroup. These are now available to display in instrument panel.
## 3.4
### 3.4.1 - Not yet released
* Fix crash when Survery with terrain follow is moved quickly
* Fix terrain follow climb/descent rate fields swapped in ui
...@@ -2,6 +2,7 @@ ...@@ -2,6 +2,7 @@
!include LogicLib.nsh !include LogicLib.nsh
!include Win\COM.nsh !include Win\COM.nsh
!include Win\Propkey.nsh !include Win\Propkey.nsh
!include "FileFunc.nsh"
!macro DemoteShortCut target !macro DemoteShortCut target
!insertmacro ComHlpr_CreateInProcInstance ${CLSID_ShellLink} ${IID_IShellLink} r0 "" !insertmacro ComHlpr_CreateInProcInstance ${CLSID_ShellLink} ${IID_IShellLink} r0 ""
...@@ -61,7 +62,7 @@ Section ...@@ -61,7 +62,7 @@ Section
ReadRegStr $R0 HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\${APPNAME}" "UninstallString" ReadRegStr $R0 HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\${APPNAME}" "UninstallString"
StrCmp $R0 "" doinstall StrCmp $R0 "" doinstall
ExecWait "$R0 /S _?=$INSTDIR" ExecWait "$R0 /S _?=$INSTDIR -LEAVE_DATA=1"
IntCmp $0 0 doinstall IntCmp $0 0 doinstall
MessageBox MB_OK|MB_ICONEXCLAMATION \ MessageBox MB_OK|MB_ICONEXCLAMATION \
...@@ -104,12 +105,16 @@ done: ...@@ -104,12 +105,16 @@ done:
SectionEnd SectionEnd
Section "Uninstall" Section "Uninstall"
${GetParameters} $R0
${GetOptions} $R0 "-LEAVE_DATA=" $R1
!insertmacro MUI_STARTMENU_GETFOLDER Application $StartMenuFolder !insertmacro MUI_STARTMENU_GETFOLDER Application $StartMenuFolder
SetShellVarContext all SetShellVarContext all
RMDir /r /REBOOTOK $INSTDIR RMDir /r /REBOOTOK $INSTDIR
RMDir /r /REBOOTOK "$SMPROGRAMS\$StartMenuFolder\" RMDir /r /REBOOTOK "$SMPROGRAMS\$StartMenuFolder\"
SetShellVarContext current SetShellVarContext current
RMDir /r /REBOOTOK "$APPDATA\${ORGNAME}\" ${If} $R1 != 1
RMDir /r /REBOOTOK "$APPDATA\${ORGNAME}\"
${Endif}
DeleteRegKey HKLM "SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\${APPNAME}" DeleteRegKey HKLM "SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\${APPNAME}"
DeleteRegKey HKLM "SOFTWARE\Microsoft\Windows\Windows Error Reporting\LocalDumps\${EXENAME}.exe" DeleteRegKey HKLM "SOFTWARE\Microsoft\Windows\Windows Error Reporting\LocalDumps\${EXENAME}.exe"
SectionEnd SectionEnd
......
...@@ -44,29 +44,6 @@ MacBuild { ...@@ -44,29 +44,6 @@ MacBuild {
} }
} }
iOSBuild {
LIBS += -framework AVFoundation
#-- Info.plist (need an "official" one for the App Store)
ForAppStore {
message(App Store Build)
#-- Create official, versioned Info.plist
APP_STORE = $$system(cd $${BASEDIR} && $${BASEDIR}/tools/update_ios_version.sh $${BASEDIR}/ios/iOSForAppStore-Info-Source.plist $${BASEDIR}/ios/iOSForAppStore-Info.plist)
APP_ERROR = $$find(APP_STORE, "Error")
count(APP_ERROR, 1) {
error("Error building .plist file. 'ForAppStore' builds are only possible through the official build system.")
}
QT += qml-private
QMAKE_INFO_PLIST = $${BASEDIR}/ios/iOSForAppStore-Info.plist
OTHER_FILES += $${BASEDIR}/ios/iOSForAppStore-Info.plist
} else {
QMAKE_INFO_PLIST = $${BASEDIR}/ios/iOS-Info.plist
OTHER_FILES += $${BASEDIR}/ios/iOS-Info.plist
}
QMAKE_ASSET_CATALOGS += ios/Images.xcassets
BUNDLE.files = ios/QGCLaunchScreen.xib $$QMAKE_INFO_PLIST
QMAKE_BUNDLE_DATA += BUNDLE
}
LinuxBuild { LinuxBuild {
CONFIG += qesp_linux_udev CONFIG += qesp_linux_udev
} }
...@@ -132,6 +109,36 @@ WindowsBuild { ...@@ -132,6 +109,36 @@ WindowsBuild {
QMAKE_TARGET_PRODUCT = "$${QGC_APP_NAME}" QMAKE_TARGET_PRODUCT = "$${QGC_APP_NAME}"
} }
#-------------------------------------------------------------------------------------
# iOS
iOSBuild {
contains (CONFIG, DISABLE_BUILTIN_IOS) {
message("Skipping builtin support for iOS")
} else {
LIBS += -framework AVFoundation
#-- Info.plist (need an "official" one for the App Store)
ForAppStore {
message(App Store Build)
#-- Create official, versioned Info.plist
APP_STORE = $$system(cd $${BASEDIR} && $${BASEDIR}/tools/update_ios_version.sh $${BASEDIR}/ios/iOSForAppStore-Info-Source.plist $${BASEDIR}/ios/iOSForAppStore-Info.plist)
APP_ERROR = $$find(APP_STORE, "Error")
count(APP_ERROR, 1) {
error("Error building .plist file. 'ForAppStore' builds are only possible through the official build system.")
}
QT += qml-private
QMAKE_INFO_PLIST = $${BASEDIR}/ios/iOSForAppStore-Info.plist
OTHER_FILES += $${BASEDIR}/ios/iOSForAppStore-Info.plist
} else {
QMAKE_INFO_PLIST = $${BASEDIR}/ios/iOS-Info.plist
OTHER_FILES += $${BASEDIR}/ios/iOS-Info.plist
}
QMAKE_ASSET_CATALOGS += ios/Images.xcassets
BUNDLE.files = ios/QGCLaunchScreen.xib $$QMAKE_INFO_PLIST
QMAKE_BUNDLE_DATA += BUNDLE
}
}
# #
# Plugin configuration # Plugin configuration
# #
......
...@@ -237,6 +237,7 @@ ...@@ -237,6 +237,7 @@
<file alias="Vehicle/BatteryFact.json">src/Vehicle/BatteryFact.json</file> <file alias="Vehicle/BatteryFact.json">src/Vehicle/BatteryFact.json</file>
<file alias="Vehicle/ClockFact.json">src/Vehicle/ClockFact.json</file> <file alias="Vehicle/ClockFact.json">src/Vehicle/ClockFact.json</file>
<file alias="Vehicle/DistanceSensorFact.json">src/Vehicle/DistanceSensorFact.json</file> <file alias="Vehicle/DistanceSensorFact.json">src/Vehicle/DistanceSensorFact.json</file>
<file alias="Vehicle/EstimatorStatusFactGroup.json">src/Vehicle/EstimatorStatusFactGroup.json</file>
<file alias="Vehicle/GPSFact.json">src/Vehicle/GPSFact.json</file> <file alias="Vehicle/GPSFact.json">src/Vehicle/GPSFact.json</file>
<file alias="Vehicle/GPSRTKFact.json">src/Vehicle/GPSRTKFact.json</file> <file alias="Vehicle/GPSRTKFact.json">src/Vehicle/GPSRTKFact.json</file>
<file alias="Vehicle/SetpointFact.json">src/Vehicle/SetpointFact.json</file> <file alias="Vehicle/SetpointFact.json">src/Vehicle/SetpointFact.json</file>
......
...@@ -159,8 +159,8 @@ bool ExifParser::write(QByteArray& buf, GeoTagWorker::cameraFeedbackPacket& geot ...@@ -159,8 +159,8 @@ bool ExifParser::write(QByteArray& buf, GeoTagWorker::cameraFeedbackPacket& geot
gpsData.readable.fields.gpsLon.content = gpsDataExtInd + 6 * 4; gpsData.readable.fields.gpsLon.content = gpsDataExtInd + 6 * 4;
gpsData.readable.fields.gpsAltRef.tagID = 5; gpsData.readable.fields.gpsAltRef.tagID = 5;
gpsData.readable.fields.gpsAltRef.type = 2; gpsData.readable.fields.gpsAltRef.type = 1;
gpsData.readable.fields.gpsAltRef.size = 2; gpsData.readable.fields.gpsAltRef.size = 1;
gpsData.readable.fields.gpsAltRef.content = 0x00; gpsData.readable.fields.gpsAltRef.content = 0x00;
gpsData.readable.fields.gpsAlt.tagID = 6; gpsData.readable.fields.gpsAlt.tagID = 6;
......
...@@ -132,10 +132,8 @@ Item { ...@@ -132,10 +132,8 @@ Item {
onResetStatusTextArea: statusLog.text = statusTextAreaDefaultText onResetStatusTextArea: statusLog.text = statusTextAreaDefaultText
onMagCalComplete: { onMagCalComplete: {
//if (!_sensorsHaveFixedOrientation && (showCompass0Rot || showCompass1Rot || showCompass2Rot)) { setOrientationsDialogShowBoardOrientation = false
setOrientationsDialogShowBoardOrientation = false showDialog(setOrientationsDialogComponent, qsTr("Compass Calibration Complete"), qgcView.showDialogDefaultWidth, StandardButton.Ok)
showDialog(setOrientationsDialogComponent, qsTr("Compass Calibration Complete"), qgcView.showDialogDefaultWidth, StandardButton.Ok)
//}
} }
onWaitingForCancelChanged: { onWaitingForCancelChanged: {
...@@ -255,7 +253,9 @@ Item { ...@@ -255,7 +253,9 @@ Item {
QGCLabel { QGCLabel {
width: parent.width width: parent.width
wrapMode: Text.WordWrap wrapMode: Text.WordWrap
text: qsTr("Set your compass orientations below and the make sure to reboot the vehicle prior to flight.") text: _sensorsHaveFixedOrientation ?
qsTr("Make sure to reboot the vehicle prior to flight.") :
qsTr("Set your compass orientations below and the make sure to reboot the vehicle prior to flight.")
} }
QGCButton { QGCButton {
...@@ -270,6 +270,7 @@ Item { ...@@ -270,6 +270,7 @@ Item {
width: parent.width width: parent.width
wrapMode: Text.WordWrap wrapMode: Text.WordWrap
text: boardRotationText text: boardRotationText
visible: !_sensorsHaveFixedOrientation
} }
Column { Column {
...@@ -287,8 +288,10 @@ Item { ...@@ -287,8 +288,10 @@ Item {
} }
} }
// Compass 0 rotation
Column { Column {
// Compass 0 rotation visible: !_sensorsHaveFixedOrientation
Component { Component {
id: compass0ComponentLabel2 id: compass0ComponentLabel2
...@@ -312,8 +315,10 @@ Item { ...@@ -312,8 +315,10 @@ Item {
Loader { sourceComponent: showCompass0Rot ? compass0ComponentCombo2 : null } Loader { sourceComponent: showCompass0Rot ? compass0ComponentCombo2 : null }
} }
// Compass 1 rotation
Column { Column {
// Compass 1 rotation visible: !_sensorsHaveFixedOrientation
Component { Component {
id: compass1ComponentLabel2 id: compass1ComponentLabel2
...@@ -337,10 +342,11 @@ Item { ...@@ -337,10 +342,11 @@ Item {
Loader { sourceComponent: showCompass1Rot ? compass1ComponentCombo2 : null } Loader { sourceComponent: showCompass1Rot ? compass1ComponentCombo2 : null }
} }
// Compass 2 rotation
Column { Column {
visible: !_sensorsHaveFixedOrientation
spacing: ScreenTools.defaultFontPixelWidth spacing: ScreenTools.defaultFontPixelWidth
// Compass 2 rotation
Component { Component {
id: compass2ComponentLabel2 id: compass2ComponentLabel2
......
...@@ -310,6 +310,9 @@ QString Fact::_variantToString(const QVariant& variant, int decimalPlaces) const ...@@ -310,6 +310,9 @@ QString Fact::_variantToString(const QVariant& variant, int decimalPlaces) const
} }
} }
break; break;
case FactMetaData::valueTypeBool:
valueString = variant.toBool() ? tr("true") : tr("false");
break;
case FactMetaData::valueTypeElapsedTimeInSeconds: case FactMetaData::valueTypeElapsedTimeInSeconds:
{ {
double dValue = variant.toDouble(); double dValue = variant.toDouble();
......
...@@ -1207,7 +1207,7 @@ QMap<QString, FactMetaData*> FactMetaData::createMapFromJsonFile(const QString& ...@@ -1207,7 +1207,7 @@ QMap<QString, FactMetaData*> FactMetaData::createMapFromJsonFile(const QString&
QJsonParseError jsonParseError; QJsonParseError jsonParseError;
QJsonDocument doc = QJsonDocument::fromJson(bytes, &jsonParseError); QJsonDocument doc = QJsonDocument::fromJson(bytes, &jsonParseError);
if (jsonParseError.error != QJsonParseError::NoError) { if (jsonParseError.error != QJsonParseError::NoError) {
qWarning() << "Unable to parse json document" << jsonFilename << jsonParseError.errorString(); qWarning() << "Unable to parse json document filename:error:offset" << jsonFilename << jsonParseError.errorString() << jsonParseError.offset;
return metaDataMap; return metaDataMap;
} }
......
...@@ -285,7 +285,7 @@ QList<MAV_CMD> PX4FirmwarePlugin::supportedMissionCommands(void) ...@@ -285,7 +285,7 @@ QList<MAV_CMD> PX4FirmwarePlugin::supportedMissionCommands(void)
list << MAV_CMD_NAV_WAYPOINT list << MAV_CMD_NAV_WAYPOINT
<< MAV_CMD_NAV_LOITER_UNLIM << MAV_CMD_NAV_LOITER_TIME << MAV_CMD_NAV_LOITER_TO_ALT << MAV_CMD_NAV_LOITER_UNLIM << MAV_CMD_NAV_LOITER_TIME << MAV_CMD_NAV_LOITER_TO_ALT
<< MAV_CMD_NAV_LAND << MAV_CMD_NAV_TAKEOFF << MAV_CMD_NAV_LAND << MAV_CMD_NAV_TAKEOFF << MAV_CMD_NAV_RETURN_TO_LAUNCH
<< MAV_CMD_DO_JUMP << MAV_CMD_DO_JUMP
<< MAV_CMD_DO_VTOL_TRANSITION << MAV_CMD_NAV_VTOL_TAKEOFF << MAV_CMD_NAV_VTOL_LAND << MAV_CMD_DO_VTOL_TRANSITION << MAV_CMD_NAV_VTOL_TAKEOFF << MAV_CMD_NAV_VTOL_LAND
<< MAV_CMD_DO_DIGICAM_CONTROL << MAV_CMD_DO_DIGICAM_CONTROL
......
...@@ -43,12 +43,10 @@ Item { ...@@ -43,12 +43,10 @@ Item {
QGCPalette { id: qgcPal } QGCPalette { id: qgcPal }
function getPreferredInstrumentWidth() { function getPreferredInstrumentWidth() {
if(ScreenTools.isMobile) { // Don't allow instrument panel to chew more than 1/4 of full window
return mainWindow.width * 0.25 var defaultWidth = ScreenTools.defaultFontPixelWidth * 30
} else if(ScreenTools.isHugeScreen) { var maxWidth = mainWindow.width * 0.25
return mainWindow.width * 0.11 return Math.min(maxWidth, defaultWidth)
}
return ScreenTools.defaultFontPixelWidth * 30
} }
function _setInstrumentWidget() { function _setInstrumentWidget() {
......
...@@ -58,8 +58,8 @@ const int MissionController::_missionFileVersion = 2; ...@@ -58,8 +58,8 @@ const int MissionController::_missionFileVersion = 2;
MissionController::MissionController(PlanMasterController* masterController, QObject *parent) MissionController::MissionController(PlanMasterController* masterController, QObject *parent)
: PlanElementController (masterController, parent) : PlanElementController (masterController, parent)
, _missionManager (_managerVehicle->missionManager()) , _missionManager (_managerVehicle->missionManager())
, _visualItems (NULL) , _visualItems (nullptr)
, _settingsItem (NULL) , _settingsItem (nullptr)
, _firstItemsFromVehicle (false) , _firstItemsFromVehicle (false)
, _itemsRequested (false) , _itemsRequested (false)
, _inRecalcSequence (false) , _inRecalcSequence (false)
...@@ -70,7 +70,7 @@ MissionController::MissionController(PlanMasterController* masterController, QOb ...@@ -70,7 +70,7 @@ MissionController::MissionController(PlanMasterController* masterController, QOb
, _appSettings (qgcApp()->toolbox()->settingsManager()->appSettings()) , _appSettings (qgcApp()->toolbox()->settingsManager()->appSettings())
, _progressPct (0) , _progressPct (0)
, _currentPlanViewIndex (-1) , _currentPlanViewIndex (-1)
, _currentPlanViewItem (NULL) , _currentPlanViewItem (nullptr)
{ {
_resetMissionFlightStatus(); _resetMissionFlightStatus();
managerVehicleChanged(_managerVehicle); managerVehicleChanged(_managerVehicle);
...@@ -113,7 +113,7 @@ void MissionController::_resetMissionFlightStatus(void) ...@@ -113,7 +113,7 @@ void MissionController::_resetMissionFlightStatus(void)
_controllerVehicle->firmwarePlugin()->batteryConsumptionData(_controllerVehicle, _missionFlightStatus.mAhBattery, _missionFlightStatus.hoverAmps, _missionFlightStatus.cruiseAmps); _controllerVehicle->firmwarePlugin()->batteryConsumptionData(_controllerVehicle, _missionFlightStatus.mAhBattery, _missionFlightStatus.hoverAmps, _missionFlightStatus.cruiseAmps);
if (_missionFlightStatus.mAhBattery != 0) { if (_missionFlightStatus.mAhBattery != 0) {
double batteryPercentRemainingAnnounce = qgcApp()->toolbox()->settingsManager()->appSettings()->batteryPercentRemainingAnnounce()->rawValue().toDouble(); double batteryPercentRemainingAnnounce = qgcApp()->toolbox()->settingsManager()->appSettings()->batteryPercentRemainingAnnounce()->rawValue().toDouble();
_missionFlightStatus.ampMinutesAvailable = (double)_missionFlightStatus.mAhBattery / 1000.0 * 60.0 * ((100.0 - batteryPercentRemainingAnnounce) / 100.0); _missionFlightStatus.ampMinutesAvailable = static_cast<double>(_missionFlightStatus.mAhBattery) / 1000.0 * 60.0 * ((100.0 - batteryPercentRemainingAnnounce) / 100.0);
} }
emit missionDistanceChanged(_missionFlightStatus.totalDistance); emit missionDistanceChanged(_missionFlightStatus.totalDistance);
...@@ -186,8 +186,8 @@ void MissionController::_newMissionItemsAvailableFromVehicle(bool removeAllReque ...@@ -186,8 +186,8 @@ void MissionController::_newMissionItemsAvailableFromVehicle(bool removeAllReque
_deinitAllVisualItems(); _deinitAllVisualItems();
_visualItems->deleteLater(); _visualItems->deleteLater();
_settingsItem = NULL; _settingsItem = nullptr;
_visualItems = NULL; _visualItems = nullptr;
_updateContainsItems(); // This will clear containsItems which will be set again below. This will re-pop Start Mission confirmation. _updateContainsItems(); // This will clear containsItems which will be set again below. This will re-pop Start Mission confirmation.
_visualItems = newControllerMissionItems; _visualItems = newControllerMissionItems;
...@@ -353,20 +353,19 @@ int MissionController::insertSimpleMissionItem(QGeoCoordinate coordinate, int i) ...@@ -353,20 +353,19 @@ int MissionController::insertSimpleMissionItem(QGeoCoordinate coordinate, int i)
newItem->setCoordinate(coordinate); newItem->setCoordinate(coordinate);
newItem->setCommand(MAV_CMD_NAV_WAYPOINT); newItem->setCommand(MAV_CMD_NAV_WAYPOINT);
_initVisualItem(newItem); _initVisualItem(newItem);
if (_visualItems->count() == 1) { if (_visualItems->count() == 1 && (_controllerVehicle->fixedWing() || _controllerVehicle->vtol() || _controllerVehicle->multiRotor())) {
MAV_CMD takeoffCmd = _controllerVehicle->vtol() ? MAV_CMD_NAV_VTOL_TAKEOFF : MAV_CMD_NAV_TAKEOFF; MAV_CMD takeoffCmd = _controllerVehicle->vtol() ? MAV_CMD_NAV_VTOL_TAKEOFF : MAV_CMD_NAV_TAKEOFF;
if (_controllerVehicle->firmwarePlugin()->supportedMissionCommands().contains((MAV_CMD)takeoffCmd)) { if (_controllerVehicle->firmwarePlugin()->supportedMissionCommands().contains(takeoffCmd)) {
newItem->setCommand(takeoffCmd); newItem->setCommand(takeoffCmd);
} }
} }
newItem->setDefaultsForCommand();
if (newItem->specifiesAltitude()) { if (newItem->specifiesAltitude()) {
double prevAltitude; double prevAltitude;
int prevAltitudeMode; int prevAltitudeMode;
if (_findPreviousAltitude(i, &prevAltitude, &prevAltitudeMode)) { if (_findPreviousAltitude(i, &prevAltitude, &prevAltitudeMode)) {
newItem->altitude()->setRawValue(prevAltitude); newItem->altitude()->setRawValue(prevAltitude);
newItem->setAltitudeMode((SimpleMissionItem::AltitudeMode)prevAltitudeMode); newItem->setAltitudeMode(static_cast<SimpleMissionItem::AltitudeMode>(prevAltitudeMode));
} }
} }
newItem->setMissionFlightStatus(_missionFlightStatus); newItem->setMissionFlightStatus(_missionFlightStatus);
...@@ -381,11 +380,10 @@ int MissionController::insertROIMissionItem(QGeoCoordinate coordinate, int i) ...@@ -381,11 +380,10 @@ int MissionController::insertROIMissionItem(QGeoCoordinate coordinate, int i)
int sequenceNumber = _nextSequenceNumber(); int sequenceNumber = _nextSequenceNumber();
SimpleMissionItem * newItem = new SimpleMissionItem(_controllerVehicle, _flyView, this); SimpleMissionItem * newItem = new SimpleMissionItem(_controllerVehicle, _flyView, this);
newItem->setSequenceNumber(sequenceNumber); newItem->setSequenceNumber(sequenceNumber);
newItem->setCommand((MAV_CMD)(_controllerVehicle->firmwarePlugin()->supportedMissionCommands().contains((MAV_CMD)MAV_CMD_DO_SET_ROI_LOCATION) ? newItem->setCommand((_controllerVehicle->firmwarePlugin()->supportedMissionCommands().contains(MAV_CMD_DO_SET_ROI_LOCATION) ?
MAV_CMD_DO_SET_ROI_LOCATION : MAV_CMD_DO_SET_ROI_LOCATION :
MAV_CMD_DO_SET_ROI)); MAV_CMD_DO_SET_ROI));
_initVisualItem(newItem); _initVisualItem(newItem);
newItem->setDefaultsForCommand();
newItem->setCoordinate(coordinate); newItem->setCoordinate(coordinate);
double prevAltitude; double prevAltitude;
...@@ -393,7 +391,7 @@ int MissionController::insertROIMissionItem(QGeoCoordinate coordinate, int i) ...@@ -393,7 +391,7 @@ int MissionController::insertROIMissionItem(QGeoCoordinate coordinate, int i)
if (_findPreviousAltitude(i, &prevAltitude, &prevAltitudeMode)) { if (_findPreviousAltitude(i, &prevAltitude, &prevAltitudeMode)) {
newItem->altitude()->setRawValue(prevAltitude); newItem->altitude()->setRawValue(prevAltitude);
newItem->setAltitudeMode((SimpleMissionItem::AltitudeMode)prevAltitudeMode); newItem->setAltitudeMode(static_cast<SimpleMissionItem::AltitudeMode>(prevAltitudeMode));
} }
_visualItems->insert(i, newItem); _visualItems->insert(i, newItem);
...@@ -542,7 +540,7 @@ void MissionController::removeAll(void) ...@@ -542,7 +540,7 @@ void MissionController::removeAll(void)
_deinitAllVisualItems(); _deinitAllVisualItems();
_visualItems->clearAndDeleteContents(); _visualItems->clearAndDeleteContents();
_visualItems->deleteLater(); _visualItems->deleteLater();
_settingsItem = NULL; _settingsItem = nullptr;
_visualItems = new QmlObjectListModel(this); _visualItems = new QmlObjectListModel(this);
_addMissionSettings(_visualItems, false /* addToCenter */); _addMissionSettings(_visualItems, false /* addToCenter */);
_initAllVisualItems(); _initAllVisualItems();
...@@ -670,9 +668,9 @@ bool MissionController::_loadJsonMissionFileV2(const QJsonObject& json, QmlObjec ...@@ -670,9 +668,9 @@ bool MissionController::_loadJsonMissionFileV2(const QJsonObject& json, QmlObjec
if (_masterController->offline()) { if (_masterController->offline()) {
// We only update if offline since if we are online we use the online vehicle settings // We only update if offline since if we are online we use the online vehicle settings
appSettings->offlineEditingFirmwareType()->setRawValue(AppSettings::offlineEditingFirmwareTypeFromFirmwareType((MAV_AUTOPILOT)json[_jsonFirmwareTypeKey].toInt())); appSettings->offlineEditingFirmwareType()->setRawValue(AppSettings::offlineEditingFirmwareTypeFromFirmwareType(static_cast<MAV_AUTOPILOT>(json[_jsonFirmwareTypeKey].toInt())));
if (json.contains(_jsonVehicleTypeKey)) { if (json.contains(_jsonVehicleTypeKey)) {
appSettings->offlineEditingVehicleType()->setRawValue(AppSettings::offlineEditingVehicleTypeFromVehicleType((MAV_TYPE)json[_jsonVehicleTypeKey].toInt())); appSettings->offlineEditingVehicleType()->setRawValue(AppSettings::offlineEditingVehicleTypeFromVehicleType(static_cast<MAV_TYPE>(json[_jsonVehicleTypeKey].toInt())));
} }
} }
if (json.contains(_jsonCruiseSpeedKey)) { if (json.contains(_jsonCruiseSpeedKey)) {
...@@ -790,9 +788,9 @@ bool MissionController::_loadJsonMissionFileV2(const QJsonObject& json, QmlObjec ...@@ -790,9 +788,9 @@ bool MissionController::_loadJsonMissionFileV2(const QJsonObject& json, QmlObjec
for (int i=0; i<visualItems->count(); i++) { for (int i=0; i<visualItems->count(); i++) {
if (visualItems->value<VisualMissionItem*>(i)->isSimpleItem()) { if (visualItems->value<VisualMissionItem*>(i)->isSimpleItem()) {
SimpleMissionItem* doJumpItem = visualItems->value<SimpleMissionItem*>(i); SimpleMissionItem* doJumpItem = visualItems->value<SimpleMissionItem*>(i);
if ((MAV_CMD)doJumpItem->command() == MAV_CMD_DO_JUMP) { if (doJumpItem->command() == MAV_CMD_DO_JUMP) {
bool found = false; bool found = false;
int findDoJumpId = doJumpItem->missionItem().param1(); int findDoJumpId = static_cast<int>(doJumpItem->missionItem().param1());
for (int j=0; j<visualItems->count(); j++) { for (int j=0; j<visualItems->count(); j++) {
if (visualItems->value<VisualMissionItem*>(j)->isSimpleItem()) { if (visualItems->value<VisualMissionItem*>(j)->isSimpleItem()) {
SimpleMissionItem* targetItem = visualItems->value<SimpleMissionItem*>(j); SimpleMissionItem* targetItem = visualItems->value<SimpleMissionItem*>(j);
...@@ -887,7 +885,7 @@ bool MissionController::_loadTextMissionFile(QTextStream& stream, QmlObjectListM ...@@ -887,7 +885,7 @@ bool MissionController::_loadTextMissionFile(QTextStream& stream, QmlObjectListM
for (int i=1; i<visualItems->count(); i++) { for (int i=1; i<visualItems->count(); i++) {
SimpleMissionItem* item = qobject_cast<SimpleMissionItem*>(visualItems->get(i)); SimpleMissionItem* item = qobject_cast<SimpleMissionItem*>(visualItems->get(i));
if (item && item->command() == MAV_CMD_DO_JUMP) { if (item && item->command() == MAV_CMD_DO_JUMP) {
item->missionItem().setParam1((int)item->missionItem().param1() + 1); item->missionItem().setParam1(static_cast<int>(item->missionItem().param1()) + 1);
} }
} }
} }
...@@ -900,7 +898,7 @@ void MissionController::_initLoadedVisualItems(QmlObjectListModel* loadedVisualI ...@@ -900,7 +898,7 @@ void MissionController::_initLoadedVisualItems(QmlObjectListModel* loadedVisualI
if (_visualItems) { if (_visualItems) {
_deinitAllVisualItems(); _deinitAllVisualItems();
_visualItems->deleteLater(); _visualItems->deleteLater();
_settingsItem = NULL; _settingsItem = nullptr;
} }
_visualItems = loadedVisualItems; _visualItems = loadedVisualItems;
...@@ -996,11 +994,11 @@ void MissionController::save(QJsonObject& json) ...@@ -996,11 +994,11 @@ void MissionController::save(QJsonObject& json)
} }
QJsonValue coordinateValue; QJsonValue coordinateValue;
JsonHelper::saveGeoCoordinate(settingsItem->coordinate(), true /* writeAltitude */, coordinateValue); JsonHelper::saveGeoCoordinate(settingsItem->coordinate(), true /* writeAltitude */, coordinateValue);
json[_jsonPlannedHomePositionKey] = coordinateValue; json[_jsonPlannedHomePositionKey] = coordinateValue;
json[_jsonFirmwareTypeKey] = _controllerVehicle->firmwareType(); json[_jsonFirmwareTypeKey] = _controllerVehicle->firmwareType();
json[_jsonVehicleTypeKey] = _controllerVehicle->vehicleType(); json[_jsonVehicleTypeKey] = _controllerVehicle->vehicleType();
json[_jsonCruiseSpeedKey] = _controllerVehicle->defaultCruiseSpeed(); json[_jsonCruiseSpeedKey] = _controllerVehicle->defaultCruiseSpeed();
json[_jsonHoverSpeedKey] = _controllerVehicle->defaultHoverSpeed(); json[_jsonHoverSpeedKey] = _controllerVehicle->defaultHoverSpeed();
// Save the visual items // Save the visual items
......
...@@ -9,6 +9,7 @@ ...@@ -9,6 +9,7 @@
#include "PlanMasterController.h" #include "PlanMasterController.h"
#include "QGCApplication.h" #include "QGCApplication.h"
#include "QGCCorePlugin.h"
#include "MultiVehicleManager.h" #include "MultiVehicleManager.h"
#include "SettingsManager.h" #include "SettingsManager.h"
#include "AppSettings.h" #include "AppSettings.h"
...@@ -25,16 +26,19 @@ ...@@ -25,16 +26,19 @@
QGC_LOGGING_CATEGORY(PlanMasterControllerLog, "PlanMasterControllerLog") QGC_LOGGING_CATEGORY(PlanMasterControllerLog, "PlanMasterControllerLog")
const int PlanMasterController::_planFileVersion = 1; const int PlanMasterController::kPlanFileVersion = 1;
const char* PlanMasterController::_planFileType = "Plan"; const char* PlanMasterController::kPlanFileType = "Plan";
const char* PlanMasterController::_jsonMissionObjectKey = "mission"; const char* PlanMasterController::kJsonMissionObjectKey = "mission";
const char* PlanMasterController::_jsonGeoFenceObjectKey = "geoFence"; const char* PlanMasterController::kJsonGeoFenceObjectKey = "geoFence";
const char* PlanMasterController::_jsonRallyPointsObjectKey = "rallyPoints"; const char* PlanMasterController::kJsonRallyPointsObjectKey = "rallyPoints";
PlanMasterController::PlanMasterController(QObject* parent) PlanMasterController::PlanMasterController(QObject* parent)
: QObject (parent) : QObject (parent)
, _multiVehicleMgr (qgcApp()->toolbox()->multiVehicleManager()) , _multiVehicleMgr (qgcApp()->toolbox()->multiVehicleManager())
, _controllerVehicle (new Vehicle((MAV_AUTOPILOT)qgcApp()->toolbox()->settingsManager()->appSettings()->offlineEditingFirmwareType()->rawValue().toInt(), (MAV_TYPE)qgcApp()->toolbox()->settingsManager()->appSettings()->offlineEditingVehicleType()->rawValue().toInt(), qgcApp()->toolbox()->firmwarePluginManager())) , _controllerVehicle (new Vehicle(
static_cast<MAV_AUTOPILOT>(qgcApp()->toolbox()->settingsManager()->appSettings()->offlineEditingFirmwareType()->rawValue().toInt()),
static_cast<MAV_TYPE>(qgcApp()->toolbox()->settingsManager()->appSettings()->offlineEditingVehicleType()->rawValue().toInt()),
qgcApp()->toolbox()->firmwarePluginManager()))
, _managerVehicle (_controllerVehicle) , _managerVehicle (_controllerVehicle)
, _flyView (true) , _flyView (true)
, _offline (true) , _offline (true)
...@@ -111,7 +115,7 @@ void PlanMasterController::_activeVehicleChanged(Vehicle* activeVehicle) ...@@ -111,7 +115,7 @@ void PlanMasterController::_activeVehicleChanged(Vehicle* activeVehicle)
} }
bool newOffline = false; bool newOffline = false;
if (activeVehicle == NULL) { if (activeVehicle == nullptr) {
// Since there is no longer an active vehicle we use the offline controller vehicle as the manager vehicle // Since there is no longer an active vehicle we use the offline controller vehicle as the manager vehicle
_managerVehicle = _controllerVehicle; _managerVehicle = _controllerVehicle;
newOffline = true; newOffline = true;
...@@ -309,28 +313,33 @@ void PlanMasterController::loadFromFile(const QString& filename) ...@@ -309,28 +313,33 @@ void PlanMasterController::loadFromFile(const QString& filename)
return; return;
} }
int version;
QJsonObject json = jsonDoc.object(); QJsonObject json = jsonDoc.object();
if (!JsonHelper::validateQGCJsonFile(json, _planFileType, _planFileVersion, _planFileVersion, version, errorString)) { //-- Allow plugins to pre process the load
qgcApp()->toolbox()->corePlugin()->preLoadFromJson(this, json);
int version;
if (!JsonHelper::validateQGCJsonFile(json, kPlanFileType, kPlanFileVersion, kPlanFileVersion, version, errorString)) {
qgcApp()->showMessage(errorMessage.arg(errorString)); qgcApp()->showMessage(errorMessage.arg(errorString));
return; return;
} }
QList<JsonHelper::KeyValidateInfo> rgKeyInfo = { QList<JsonHelper::KeyValidateInfo> rgKeyInfo = {
{ _jsonMissionObjectKey, QJsonValue::Object, true }, { kJsonMissionObjectKey, QJsonValue::Object, true },
{ _jsonGeoFenceObjectKey, QJsonValue::Object, true }, { kJsonGeoFenceObjectKey, QJsonValue::Object, true },
{ _jsonRallyPointsObjectKey, QJsonValue::Object, true }, { kJsonRallyPointsObjectKey, QJsonValue::Object, true },
}; };
if (!JsonHelper::validateKeys(json, rgKeyInfo, errorString)) { if (!JsonHelper::validateKeys(json, rgKeyInfo, errorString)) {
qgcApp()->showMessage(errorMessage.arg(errorString)); qgcApp()->showMessage(errorMessage.arg(errorString));
return; return;
} }
if (!_missionController.load(json[_jsonMissionObjectKey].toObject(), errorString) || if (!_missionController.load(json[kJsonMissionObjectKey].toObject(), errorString) ||
!_geoFenceController.load(json[_jsonGeoFenceObjectKey].toObject(), errorString) || !_geoFenceController.load(json[kJsonGeoFenceObjectKey].toObject(), errorString) ||
!_rallyPointController.load(json[_jsonRallyPointsObjectKey].toObject(), errorString)) { !_rallyPointController.load(json[kJsonRallyPointsObjectKey].toObject(), errorString)) {
qgcApp()->showMessage(errorMessage.arg(errorString)); qgcApp()->showMessage(errorMessage.arg(errorString));
} else { } else {
//-- Allow plugins to post process the load
qgcApp()->toolbox()->corePlugin()->postLoadFromJson(this, json);
success = true; success = true;
} }
} else if (fileInfo.suffix() == AppSettings::missionFileExtension) { } else if (fileInfo.suffix() == AppSettings::missionFileExtension) {
...@@ -364,16 +373,22 @@ void PlanMasterController::loadFromFile(const QString& filename) ...@@ -364,16 +373,22 @@ void PlanMasterController::loadFromFile(const QString& filename)
QJsonDocument PlanMasterController::saveToJson() QJsonDocument PlanMasterController::saveToJson()
{ {
QJsonObject planJson; QJsonObject planJson;
qgcApp()->toolbox()->corePlugin()->preSaveToJson(this, planJson);
QJsonObject missionJson; QJsonObject missionJson;
QJsonObject fenceJson; QJsonObject fenceJson;
QJsonObject rallyJson; QJsonObject rallyJson;
JsonHelper::saveQGCJsonFileHeader(planJson, _planFileType, _planFileVersion); JsonHelper::saveQGCJsonFileHeader(planJson, kPlanFileType, kPlanFileVersion);
//-- Allow plugin to preemptly add its own keys to mission
qgcApp()->toolbox()->corePlugin()->preSaveToMissionJson(this, missionJson);
_missionController.save(missionJson); _missionController.save(missionJson);
//-- Allow plugin to add its own keys to mission
qgcApp()->toolbox()->corePlugin()->postSaveToMissionJson(this, missionJson);
_geoFenceController.save(fenceJson); _geoFenceController.save(fenceJson);
_rallyPointController.save(rallyJson); _rallyPointController.save(rallyJson);
planJson[_jsonMissionObjectKey] = missionJson; planJson[kJsonMissionObjectKey] = missionJson;
planJson[_jsonGeoFenceObjectKey] = fenceJson; planJson[kJsonGeoFenceObjectKey] = fenceJson;
planJson[_jsonRallyPointsObjectKey] = rallyJson; planJson[kJsonRallyPointsObjectKey] = rallyJson;
qgcApp()->toolbox()->corePlugin()->postSaveToJson(this, planJson);
return QJsonDocument(planJson); return QJsonDocument(planJson);
} }
......
...@@ -91,6 +91,12 @@ public: ...@@ -91,6 +91,12 @@ public:
Vehicle* controllerVehicle(void) { return _controllerVehicle; } Vehicle* controllerVehicle(void) { return _controllerVehicle; }
Vehicle* managerVehicle(void) { return _managerVehicle; } Vehicle* managerVehicle(void) { return _managerVehicle; }
static const int kPlanFileVersion;
static const char* kPlanFileType;
static const char* kJsonMissionObjectKey;
static const char* kJsonGeoFenceObjectKey;
static const char* kJsonRallyPointsObjectKey;
signals: signals:
void containsItemsChanged (bool containsItems); void containsItemsChanged (bool containsItems);
void syncInProgressChanged (void); void syncInProgressChanged (void);
...@@ -124,9 +130,4 @@ private: ...@@ -124,9 +130,4 @@ private:
bool _sendRallyPoints; bool _sendRallyPoints;
QString _currentPlanFile; QString _currentPlanFile;
static const int _planFileVersion;
static const char* _planFileType;
static const char* _jsonMissionObjectKey;
static const char* _jsonGeoFenceObjectKey;
static const char* _jsonRallyPointsObjectKey;
}; };
...@@ -78,7 +78,7 @@ SimpleMissionItem::SimpleMissionItem(Vehicle* vehicle, bool flyView, QObject* pa ...@@ -78,7 +78,7 @@ SimpleMissionItem::SimpleMissionItem(Vehicle* vehicle, bool flyView, QObject* pa
_connectSignals(); _connectSignals();
_updateOptionalSections(); _updateOptionalSections();
setDefaultsForCommand(); _setDefaultsForCommand();
_rebuildFacts(); _rebuildFacts();
setDirty(false); setDirty(false);
...@@ -213,7 +213,7 @@ void SimpleMissionItem::_connectSignals(void) ...@@ -213,7 +213,7 @@ void SimpleMissionItem::_connectSignals(void)
connect(&_missionItem._frameFact, &Fact::valueChanged, this, &SimpleMissionItem::_sendFriendlyEditAllowedChanged); connect(&_missionItem._frameFact, &Fact::valueChanged, this, &SimpleMissionItem::_sendFriendlyEditAllowedChanged);
// A command change triggers a number of other changes as well. // A command change triggers a number of other changes as well.
connect(&_missionItem._commandFact, &Fact::valueChanged, this, &SimpleMissionItem::setDefaultsForCommand); connect(&_missionItem._commandFact, &Fact::valueChanged, this, &SimpleMissionItem::_setDefaultsForCommand);
connect(&_missionItem._commandFact, &Fact::valueChanged, this, &SimpleMissionItem::commandNameChanged); connect(&_missionItem._commandFact, &Fact::valueChanged, this, &SimpleMissionItem::commandNameChanged);
connect(&_missionItem._commandFact, &Fact::valueChanged, this, &SimpleMissionItem::commandDescriptionChanged); connect(&_missionItem._commandFact, &Fact::valueChanged, this, &SimpleMissionItem::commandDescriptionChanged);
connect(&_missionItem._commandFact, &Fact::valueChanged, this, &SimpleMissionItem::abbreviationChanged); connect(&_missionItem._commandFact, &Fact::valueChanged, this, &SimpleMissionItem::abbreviationChanged);
...@@ -729,15 +729,32 @@ bool SimpleMissionItem::readyForSave(void) const ...@@ -729,15 +729,32 @@ bool SimpleMissionItem::readyForSave(void) const
return !specifiesAltitude() || !qIsNaN(_missionItem._param7Fact.rawValue().toDouble()); return !specifiesAltitude() || !qIsNaN(_missionItem._param7Fact.rawValue().toDouble());
} }
void SimpleMissionItem::setDefaultsForCommand(void) void SimpleMissionItem::_setDefaultsForCommand(void)
{ {
// We set these global defaults first, then if there are param defaults they will get reset // First reset params 1-4 to 0, we leave 5-7 alone to preserve any previous location information on command change
_missionItem._param1Fact.setRawValue(0);
_missionItem._param2Fact.setRawValue(0);
_missionItem._param3Fact.setRawValue(0);
_missionItem._param4Fact.setRawValue(0);
if (!specifiesCoordinate() && !isStandaloneCoordinate()) {
// No need to carry across previous lat/lon
_missionItem._param5Fact.setRawValue(0);
_missionItem._param6Fact.setRawValue(0);
}
// Set global defaults first, then if there are param defaults they will get reset
_altitudeMode = AltitudeRelative; _altitudeMode = AltitudeRelative;
emit altitudeModeChanged(); emit altitudeModeChanged();
double defaultAlt = qgcApp()->toolbox()->settingsManager()->appSettings()->defaultMissionItemAltitude()->rawValue().toDouble();
_altitudeFact.setRawValue(defaultAlt);
_missionItem._param7Fact.setRawValue(defaultAlt);
_amslAltAboveTerrainFact.setRawValue(qQNaN()); _amslAltAboveTerrainFact.setRawValue(qQNaN());
if (specifiesCoordinate() || isStandaloneCoordinate() || specifiesAltitudeOnly()) {
double defaultAlt = qgcApp()->toolbox()->settingsManager()->appSettings()->defaultMissionItemAltitude()->rawValue().toDouble();
_altitudeFact.setRawValue(defaultAlt);
_missionItem._param7Fact.setRawValue(defaultAlt);
} else {
_altitudeFact.setRawValue(0);
_missionItem._param7Fact.setRawValue(0);
}
MAV_CMD command = (MAV_CMD)this->command(); MAV_CMD command = (MAV_CMD)this->command();
const MissionCommandUIInfo* uiInfo = _commandTree->getUIInfo(_vehicle, command); const MissionCommandUIInfo* uiInfo = _commandTree->getUIInfo(_vehicle, command);
......
...@@ -134,9 +134,6 @@ public: ...@@ -134,9 +134,6 @@ public:
int lastSequenceNumber (void) const final; int lastSequenceNumber (void) const final;
void save (QJsonArray& missionItems) final; void save (QJsonArray& missionItems) final;
public slots:
void setDefaultsForCommand(void);
signals: signals:
void commandChanged (int command); void commandChanged (int command);
void friendlyEditAllowedChanged (bool friendlyEditAllowed); void friendlyEditAllowedChanged (bool friendlyEditAllowed);
...@@ -160,6 +157,7 @@ private slots: ...@@ -160,6 +157,7 @@ private slots:
void _rebuildFacts (void); void _rebuildFacts (void);
void _rebuildTextFieldFacts (void); void _rebuildTextFieldFacts (void);
void _possibleAdditionalTimeDelayChanged(void); void _possibleAdditionalTimeDelayChanged(void);
void _setDefaultsForCommand (void);
private: private:
void _connectSignals (void); void _connectSignals (void);
......
...@@ -412,11 +412,6 @@ void TransectStyleComplexItem::_setBoundingCube(QGCGeoBoundingCube bc) ...@@ -412,11 +412,6 @@ void TransectStyleComplexItem::_setBoundingCube(QGCGeoBoundingCube bc)
void TransectStyleComplexItem::_queryTransectsPathHeightInfo(void) void TransectStyleComplexItem::_queryTransectsPathHeightInfo(void)
{ {
_transectsPathHeightInfo.clear(); _transectsPathHeightInfo.clear();
if (_terrainPolyPathQuery) {
// Toss previous query
_terrainPolyPathQuery->deleteLater();
_terrainPolyPathQuery = NULL;
}
if (_transects.count()) { if (_transects.count()) {
// We don't actually send the query until this timer times out. This way we only send // We don't actually send the query until this timer times out. This way we only send
...@@ -427,6 +422,20 @@ void TransectStyleComplexItem::_queryTransectsPathHeightInfo(void) ...@@ -427,6 +422,20 @@ void TransectStyleComplexItem::_queryTransectsPathHeightInfo(void)
void TransectStyleComplexItem::_reallyQueryTransectsPathHeightInfo(void) void TransectStyleComplexItem::_reallyQueryTransectsPathHeightInfo(void)
{ {
// Clear any previous query
if (_terrainPolyPathQuery) {
// FIXME: We should really be blowing away any previous query here. But internally that is difficult to implement so instead we let
// it complete and drop the results.
#if 0
// Toss previous query
_terrainPolyPathQuery->deleteLater();
#else
// Let the signal fall on the floor
disconnect(_terrainPolyPathQuery, &TerrainPolyPathQuery::terrainDataReceived, this, &TransectStyleComplexItem::_polyPathTerrainData);
#endif
_terrainPolyPathQuery = NULL;
}
// Append all transects into a single PolyPath query // Append all transects into a single PolyPath query
QList<QGeoCoordinate> transectPoints; QList<QGeoCoordinate> transectPoints;
...@@ -463,6 +472,12 @@ void TransectStyleComplexItem::_polyPathTerrainData(bool success, const QList<Te ...@@ -463,6 +472,12 @@ void TransectStyleComplexItem::_polyPathTerrainData(bool success, const QList<Te
// Now that we have terrain data we can adjust // Now that we have terrain data we can adjust
_adjustTransectsForTerrain(); _adjustTransectsForTerrain();
} }
if (_terrainPolyPathQuery != sender()) {
qWarning() << "TransectStyleComplexItem::_polyPathTerrainData _terrainPolyPathQuery != sender()";
}
disconnect(_terrainPolyPathQuery, &TerrainPolyPathQuery::terrainDataReceived, this, &TransectStyleComplexItem::_polyPathTerrainData);
_terrainPolyPathQuery = NULL;
} }
bool TransectStyleComplexItem::readyForSave(void) const bool TransectStyleComplexItem::readyForSave(void) const
......
...@@ -54,8 +54,8 @@ public: ...@@ -54,8 +54,8 @@ public:
Fact* hoverAndCapture (void) { return &_hoverAndCaptureFact; } Fact* hoverAndCapture (void) { return &_hoverAndCaptureFact; }
Fact* refly90Degrees (void) { return &_refly90DegreesFact; } Fact* refly90Degrees (void) { return &_refly90DegreesFact; }
Fact* terrainAdjustTolerance (void) { return &_terrainAdjustToleranceFact; } Fact* terrainAdjustTolerance (void) { return &_terrainAdjustToleranceFact; }
Fact* terrainAdjustMaxDescentRate (void) { return &_terrainAdjustMaxClimbRateFact; } Fact* terrainAdjustMaxDescentRate (void) { return &_terrainAdjustMaxDescentRateFact; }
Fact* terrainAdjustMaxClimbRate (void) { return &_terrainAdjustMaxDescentRateFact; } Fact* terrainAdjustMaxClimbRate (void) { return &_terrainAdjustMaxClimbRateFact; }
const Fact* hoverAndCapture (void) const { return &_hoverAndCaptureFact; } const Fact* hoverAndCapture (void) const { return &_hoverAndCaptureFact; }
......
...@@ -36,8 +36,9 @@ Rectangle { ...@@ -36,8 +36,9 @@ Rectangle {
property var _fileExtension: QGroundControl.settingsManager.appSettings.missionFileExtension property var _fileExtension: QGroundControl.settingsManager.appSettings.missionFileExtension
property var _appSettings: QGroundControl.settingsManager.appSettings property var _appSettings: QGroundControl.settingsManager.appSettings
property bool _waypointsOnlyMode: QGroundControl.corePlugin.options.missionWaypointsOnly property bool _waypointsOnlyMode: QGroundControl.corePlugin.options.missionWaypointsOnly
property bool _showCameraSection: !_waypointsOnlyMode || QGroundControl.corePlugin.showAdvancedUI property bool _showCameraSection: (!_waypointsOnlyMode || QGroundControl.corePlugin.showAdvancedUI) && !_missionVehicle.apmFirmware
property bool _simpleMissionStart: QGroundControl.corePlugin.options.showSimpleMissionStart property bool _simpleMissionStart: QGroundControl.corePlugin.options.showSimpleMissionStart
property bool _showFlightSpeed: !_missionVehicle.vtol && !_simpleMissionStart && !_missionVehicle.apmFirmware
readonly property string _firmwareLabel: qsTr("Firmware") readonly property string _firmwareLabel: qsTr("Firmware")
readonly property string _vehicleLabel: qsTr("Vehicle") readonly property string _vehicleLabel: qsTr("Vehicle")
...@@ -72,14 +73,14 @@ Rectangle { ...@@ -72,14 +73,14 @@ Rectangle {
QGCCheckBox { QGCCheckBox {
id: flightSpeedCheckBox id: flightSpeedCheckBox
text: qsTr("Flight speed") text: qsTr("Flight speed")
visible: !_missionVehicle.vtol && !_simpleMissionStart visible: _showFlightSpeed
checked: missionItem.speedSection.specifyFlightSpeed checked: missionItem.speedSection.specifyFlightSpeed
onClicked: missionItem.speedSection.specifyFlightSpeed = checked onClicked: missionItem.speedSection.specifyFlightSpeed = checked
} }
FactTextField { FactTextField {
Layout.fillWidth: true Layout.fillWidth: true
fact: missionItem.speedSection.flightSpeed fact: missionItem.speedSection.flightSpeed
visible: flightSpeedCheckBox.visible visible: _showFlightSpeed
enabled: flightSpeedCheckBox.checked enabled: flightSpeedCheckBox.checked
} }
} }
......
...@@ -53,20 +53,20 @@ Item { ...@@ -53,20 +53,20 @@ Item {
readonly property real mediumFontPointRatio: 1.25 readonly property real mediumFontPointRatio: 1.25
readonly property real largeFontPointRatio: 1.5 readonly property real largeFontPointRatio: 1.5
property real realPixelDensity: QGroundControl.corePlugin.options.devicePixelDensity != 0 ? QGroundControl.corePlugin.options.devicePixelDensity : Screen.pixelDensity property real realPixelDensity: {
property real realPixelRatio: {
//-- If a plugin defines it, just use what it tells us //-- If a plugin defines it, just use what it tells us
if (QGroundControl.corePlugin.options.devicePixelRatio != 0) if(QGroundControl.corePlugin.options.devicePixelDensity != 0) {
return QGroundControl.corePlugin.options.devicePixelRatio return QGroundControl.corePlugin.options.devicePixelDensity
//-- Mobile is rather unreliable. They all return 1 for Screen.devicePixelRatio. }
if(isMobile) { //-- Android is rather unreliable
// Lets assume it's unlikely you have a tablet over 300mm wide if(isAndroid) {
if((Screen.width / Screen.pixelDensity * Screen.devicePixelRatio) > 300) // Lets assume it's unlikely you have a tablet over 300mm wide
return 2 if((Screen.width / Screen.pixelDensity) > 300) {
return Screen.pixelDensity * 2
}
} }
//-- Use whatever the system tells us //-- Let's use what the system tells us
return Screen.devicePixelRatio return Screen.pixelDensity
} }
property bool isAndroid: ScreenToolsController.isAndroid property bool isAndroid: ScreenToolsController.isAndroid
...@@ -74,9 +74,10 @@ Item { ...@@ -74,9 +74,10 @@ Item {
property bool isMobile: ScreenToolsController.isMobile property bool isMobile: ScreenToolsController.isMobile
property bool isWindows: ScreenToolsController.isWindows property bool isWindows: ScreenToolsController.isWindows
property bool isDebug: ScreenToolsController.isDebug property bool isDebug: ScreenToolsController.isDebug
property bool isMac: ScreenToolsController.isMacOS
property bool isTinyScreen: (Screen.width / realPixelDensity) < 120 // 120mm property bool isTinyScreen: (Screen.width / realPixelDensity) < 120 // 120mm
property bool isShortScreen: ScreenToolsController.isMobile && ((Screen.height / Screen.width) < 0.6) // Nexus 7 for example property bool isShortScreen: ScreenToolsController.isMobile && ((Screen.height / Screen.width) < 0.6) // Nexus 7 for example
property bool isHugeScreen: Screen.width >= 1920*2 property bool isHugeScreen: (Screen.width / realPixelDensity) >= (23.5 * 25.4) // 27" monitor
readonly property real minTouchMillimeters: 10 ///< Minimum touch size in millimeters readonly property real minTouchMillimeters: 10 ///< Minimum touch size in millimeters
property real minTouchPixels: 0 ///< Minimum touch size in pixels property real minTouchPixels: 0 ///< Minimum touch size in pixels
...@@ -111,10 +112,6 @@ Item { ...@@ -111,10 +112,6 @@ Item {
_setBasePointSize(defaultFontPointSize) _setBasePointSize(defaultFontPointSize)
} }
onRealPixelRatioChanged: {
_setBasePointSize(defaultFontPointSize)
}
function printScreenStats() { function printScreenStats() {
console.log('ScreenTools: Screen.width: ' + Screen.width + ' Screen.height: ' + Screen.height + ' Screen.pixelDensity: ' + Screen.pixelDensity) console.log('ScreenTools: Screen.width: ' + Screen.width + ' Screen.height: ' + Screen.height + ' Screen.pixelDensity: ' + Screen.pixelDensity)
} }
...@@ -138,7 +135,7 @@ Item { ...@@ -138,7 +135,7 @@ Item {
smallFontPointSize = defaultFontPointSize * _screenTools.smallFontPointRatio smallFontPointSize = defaultFontPointSize * _screenTools.smallFontPointRatio
mediumFontPointSize = defaultFontPointSize * _screenTools.mediumFontPointRatio mediumFontPointSize = defaultFontPointSize * _screenTools.mediumFontPointRatio
largeFontPointSize = defaultFontPointSize * _screenTools.largeFontPointRatio largeFontPointSize = defaultFontPointSize * _screenTools.largeFontPointRatio
minTouchPixels = Math.round(minTouchMillimeters * realPixelDensity * realPixelRatio) minTouchPixels = Math.round(minTouchMillimeters * realPixelDensity)
if (minTouchPixels / Screen.height > 0.15) { if (minTouchPixels / Screen.height > 0.15) {
// If using physical sizing takes up too much of the vertical real estate fall back to font based sizing // If using physical sizing takes up too much of the vertical real estate fall back to font based sizing
minTouchPixels = defaultFontPixelHeight * 3 minTouchPixels = defaultFontPixelHeight * 3
......
...@@ -416,7 +416,7 @@ bool TerrainTileManager::_getAltitudesForCoordinates(const QList<QGeoCoordinate> ...@@ -416,7 +416,7 @@ bool TerrainTileManager::_getAltitudesForCoordinates(const QList<QGeoCoordinate>
error = true; error = true;
qCWarning(TerrainQueryLog) << "TerrainTileManager::_getAltitudesForCoordinates Internal Error: negative elevation in tile cache"; qCWarning(TerrainQueryLog) << "TerrainTileManager::_getAltitudesForCoordinates Internal Error: negative elevation in tile cache";
} else { } else {
qCWarning(TerrainQueryLog) << "TerrainTileManager::_getAltitudesForCoordinates returning elevation from tile cache" << elevation; qCDebug(TerrainQueryLog) << "TerrainTileManager::_getAltitudesForCoordinates returning elevation from tile cache" << elevation;
} }
altitudes.push_back(elevation); altitudes.push_back(elevation);
} else { } else {
......
[
{
"name": "goodAttitudeEsimate",
"shortDescription": "Good Attitude Esimate",
"type": "bool",
"default": false
},
{
"name": "goodHorizVelEstimate",
"shortDescription": "Good Horiz Vel Estimate",
"type": "bool",
"default": false
},
{
"name": "goodVertVelEstimate",
"shortDescription": "Good Vert Vel Estimate",
"type": "bool",
"default": false
},
{
"name": "goodHorizPosRelEstimate",
"shortDescription": "Good Horiz Pos Rel Estimate",
"type": "bool",
"default": false
},
{
"name": "goodHorizPosAbsEstimate",
"shortDescription": "Good Horiz Pos Abs Estimate",
"type": "bool",
"default": false
},
{
"name": "goodVertPosAbsEstimate",
"shortDescription": "Good Vert Pos Abs Estimate",
"type": "bool",
"default": false
},
{
"name": "goodVertPosAGLEstimate",
"shortDescription": "Good Vert Pos AGL Estimate",
"type": "bool",
"default": false
},
{
"name": "goodConstPosModeEstimate",
"shortDescription": "Good Const Pos Mode Estimate",
"type": "bool",
"default": false
},
{
"name": "goodPredHorizPosRelEstimate",
"shortDescription": "Good Pred Horiz Pos Rel Estimate",
"type": "bool",
"default": false
},
{
"name": "goodPredHorizPosAbsEstimate",
"shortDescription": "Good Pred Horiz Pos Abs Estimate",
"type": "bool",
"default": false
},
{
"name": "gpsGlitch",
"shortDescription": "Gps Glitch",
"type": "bool",
"default": false
},
{
"name": "accelError",
"shortDescription": "Accel Error",
"type": "bool",
"default": false
},
{
"name": "velRatio",
"shortDescription": "Vel Ratio",
"type": "float",
"decimalPlaces": 2,
"default": null
},
{
"name": "horizPosRatio",
"shortDescription": "Horiz Pos Ratio",
"type": "float",
"decimalPlaces": 2,
"default": null
},
{
"name": "vertPosRatio",
"shortDescription": "Vert Pos Ratio",
"type": "float",
"decimalPlaces": 2,
"default": null
},
{
"name": "magRatio",
"shortDescription": "Mag Ratio",
"type": "float",
"decimalPlaces": 2,
"default": null
},
{
"name": "haglRatio",
"shortDescription": "HAGL Ratio",
"type": "float",
"decimalPlaces": 2,
"default": null
},
{
"name": "tasRatio",
"shortDescription": "TAS Ratio",
"type": "float",
"decimalPlaces": 2,
"default": null
},
{
"name": "horizPosAccuracy",
"shortDescription": "Horiz Pos Accuracy",
"type": "float",
"decimalPlaces": 2,
"default": null
},
{
"name": "vertPosAccuracy",
"shortDescription": "Vert Pos Accuracy",
"type": "float",
"decimalPlaces": 2,
"default": null
}
]
This diff is collapsed.
This diff is collapsed.
...@@ -28,25 +28,25 @@ class QGCCorePlugin_p ...@@ -28,25 +28,25 @@ class QGCCorePlugin_p
{ {
public: public:
QGCCorePlugin_p() QGCCorePlugin_p()
: pGeneral (NULL) : pGeneral (nullptr)
, pCommLinks (NULL) , pCommLinks (nullptr)
, pOfflineMaps (NULL) , pOfflineMaps (nullptr)
#if defined(QGC_AIRMAP_ENABLED) #if defined(QGC_AIRMAP_ENABLED)
, pAirmap (NULL) , pAirmap (nullptr)
#endif #endif
, pMAVLink (NULL) , pMAVLink (nullptr)
, pConsole (NULL) , pConsole (nullptr)
, pHelp (NULL) , pHelp (nullptr)
#if defined(QT_DEBUG) #if defined(QT_DEBUG)
, pMockLink (NULL) , pMockLink (nullptr)
, pDebug (NULL) , pDebug (nullptr)
#endif #endif
, defaultOptions (NULL) , defaultOptions (nullptr)
, valuesPageWidgetInfo (NULL) , valuesPageWidgetInfo (nullptr)
, cameraPageWidgetInfo (NULL) , cameraPageWidgetInfo (nullptr)
, videoPageWidgetInfo (NULL) , videoPageWidgetInfo (nullptr)
, healthPageWidgetInfo (NULL) , healthPageWidgetInfo (nullptr)
, vibrationPageWidgetInfo (NULL) , vibrationPageWidgetInfo (nullptr)
{ {
} }
...@@ -129,41 +129,41 @@ QVariantList &QGCCorePlugin::settingsPages() ...@@ -129,41 +129,41 @@ QVariantList &QGCCorePlugin::settingsPages()
{ {
if(!_p->pGeneral) { if(!_p->pGeneral) {
_p->pGeneral = new QmlComponentInfo(tr("General"), _p->pGeneral = new QmlComponentInfo(tr("General"),
QUrl::fromUserInput("qrc:/qml/GeneralSettings.qml"), QUrl::fromUserInput("qrc:/qml/GeneralSettings.qml"),
QUrl::fromUserInput("qrc:/res/gear-white.svg")); QUrl::fromUserInput("qrc:/res/gear-white.svg"));
_p->settingsList.append(QVariant::fromValue((QmlComponentInfo*)_p->pGeneral)); _p->settingsList.append(QVariant::fromValue(reinterpret_cast<QmlComponentInfo*>(_p->pGeneral)));
_p->pCommLinks = new QmlComponentInfo(tr("Comm Links"), _p->pCommLinks = new QmlComponentInfo(tr("Comm Links"),
QUrl::fromUserInput("qrc:/qml/LinkSettings.qml"), QUrl::fromUserInput("qrc:/qml/LinkSettings.qml"),
QUrl::fromUserInput("qrc:/res/waves.svg")); QUrl::fromUserInput("qrc:/res/waves.svg"));
_p->settingsList.append(QVariant::fromValue((QmlComponentInfo*)_p->pCommLinks)); _p->settingsList.append(QVariant::fromValue(reinterpret_cast<QmlComponentInfo*>(_p->pCommLinks)));
_p->pOfflineMaps = new QmlComponentInfo(tr("Offline Maps"), _p->pOfflineMaps = new QmlComponentInfo(tr("Offline Maps"),
QUrl::fromUserInput("qrc:/qml/OfflineMap.qml"), QUrl::fromUserInput("qrc:/qml/OfflineMap.qml"),
QUrl::fromUserInput("qrc:/res/waves.svg")); QUrl::fromUserInput("qrc:/res/waves.svg"));
_p->settingsList.append(QVariant::fromValue((QmlComponentInfo*)_p->pOfflineMaps)); _p->settingsList.append(QVariant::fromValue(reinterpret_cast<QmlComponentInfo*>(_p->pOfflineMaps)));
#if defined(QGC_AIRMAP_ENABLED) #if defined(QGC_AIRMAP_ENABLED)
_p->pAirmap = new QmlComponentInfo(tr("AirMap"), _p->pAirmap = new QmlComponentInfo(tr("AirMap"),
QUrl::fromUserInput("qrc:/qml/AirmapSettings.qml"), QUrl::fromUserInput("qrc:/qml/AirmapSettings.qml"),
QUrl::fromUserInput("")); QUrl::fromUserInput(""));
_p->settingsList.append(QVariant::fromValue((QmlComponentInfo*)_p->pAirmap)); _p->settingsList.append(QVariant::fromValue(reinterpret_cast<QmlComponentInfo*>(_p->pAirmap)));
#endif #endif
_p->pMAVLink = new QmlComponentInfo(tr("MAVLink"), _p->pMAVLink = new QmlComponentInfo(tr("MAVLink"),
QUrl::fromUserInput("qrc:/qml/MavlinkSettings.qml"), QUrl::fromUserInput("qrc:/qml/MavlinkSettings.qml"),
QUrl::fromUserInput("qrc:/res/waves.svg")); QUrl::fromUserInput("qrc:/res/waves.svg"));
_p->settingsList.append(QVariant::fromValue((QmlComponentInfo*)_p->pMAVLink)); _p->settingsList.append(QVariant::fromValue(reinterpret_cast<QmlComponentInfo*>(_p->pMAVLink)));
_p->pConsole = new QmlComponentInfo(tr("Console"), _p->pConsole = new QmlComponentInfo(tr("Console"),
QUrl::fromUserInput("qrc:/qml/QGroundControl/Controls/AppMessages.qml")); QUrl::fromUserInput("qrc:/qml/QGroundControl/Controls/AppMessages.qml"));
_p->settingsList.append(QVariant::fromValue((QmlComponentInfo*)_p->pConsole)); _p->settingsList.append(QVariant::fromValue(reinterpret_cast<QmlComponentInfo*>(_p->pConsole)));
_p->pHelp = new QmlComponentInfo(tr("Help"), _p->pHelp = new QmlComponentInfo(tr("Help"),
QUrl::fromUserInput("qrc:/qml/HelpSettings.qml")); QUrl::fromUserInput("qrc:/qml/HelpSettings.qml"));
_p->settingsList.append(QVariant::fromValue((QmlComponentInfo*)_p->pHelp)); _p->settingsList.append(QVariant::fromValue(reinterpret_cast<QmlComponentInfo*>(_p->pHelp)));
#if defined(QT_DEBUG) #if defined(QT_DEBUG)
//-- These are always present on Debug builds //-- These are always present on Debug builds
_p->pMockLink = new QmlComponentInfo(tr("Mock Link"), _p->pMockLink = new QmlComponentInfo(tr("Mock Link"),
QUrl::fromUserInput("qrc:/qml/MockLink.qml")); QUrl::fromUserInput("qrc:/qml/MockLink.qml"));
_p->settingsList.append(QVariant::fromValue((QmlComponentInfo*)_p->pMockLink)); _p->settingsList.append(QVariant::fromValue(reinterpret_cast<QmlComponentInfo*>(_p->pMockLink)));
_p->pDebug = new QmlComponentInfo(tr("Debug"), _p->pDebug = new QmlComponentInfo(tr("Debug"),
QUrl::fromUserInput("qrc:/qml/DebugWindow.qml")); QUrl::fromUserInput("qrc:/qml/DebugWindow.qml"));
_p->settingsList.append(QVariant::fromValue((QmlComponentInfo*)_p->pDebug)); _p->settingsList.append(QVariant::fromValue(reinterpret_cast<QmlComponentInfo*>(_p->pDebug)));
#endif #endif
} }
return _p->settingsList; return _p->settingsList;
......
...@@ -32,6 +32,7 @@ class Vehicle; ...@@ -32,6 +32,7 @@ class Vehicle;
class LinkInterface; class LinkInterface;
class QmlObjectListModel; class QmlObjectListModel;
class VideoReceiver; class VideoReceiver;
class PlanMasterController;
class QGCCorePlugin : public QGCTool class QGCCorePlugin : public QGCTool
{ {
...@@ -88,7 +89,7 @@ public: ...@@ -88,7 +89,7 @@ public:
virtual QString showAdvancedUIMessage(void) const; virtual QString showAdvancedUIMessage(void) const;
/// @return An instance of an alternate position source (or NULL if not available) /// @return An instance of an alternate position source (or NULL if not available)
virtual QGeoPositionInfoSource* createPositionSource(QObject* parent) { Q_UNUSED(parent); return NULL; } virtual QGeoPositionInfoSource* createPositionSource(QObject* parent) { Q_UNUSED(parent); return nullptr; }
/// Allows a plugin to override the specified color name from the palette /// Allows a plugin to override the specified color name from the palette
virtual void paletteOverride(QString colorName, QGCPalette::PaletteColorInfo_t& colorInfo); virtual void paletteOverride(QString colorName, QGCPalette::PaletteColorInfo_t& colorInfo);
...@@ -110,6 +111,20 @@ public: ...@@ -110,6 +111,20 @@ public:
/// should derive from QmlComponentInfo and set the url property. /// should derive from QmlComponentInfo and set the url property.
virtual QmlObjectListModel* customMapItems(void); virtual QmlObjectListModel* customMapItems(void);
/// Allows custom builds to add custom items to the plan file. Either before the document is
/// created or after.
virtual void preSaveToJson (PlanMasterController* pController, QJsonObject& json) { Q_UNUSED(pController); Q_UNUSED(json); }
virtual void postSaveToJson (PlanMasterController* pController, QJsonObject& json) { Q_UNUSED(pController); Q_UNUSED(json); }
/// Same for the specific "mission" portion
virtual void preSaveToMissionJson (PlanMasterController* pController, QJsonObject& missionJson) { Q_UNUSED(pController); Q_UNUSED(missionJson); }
virtual void postSaveToMissionJson (PlanMasterController* pController, QJsonObject& missionJson) { Q_UNUSED(pController); Q_UNUSED(missionJson); }
/// Allows custom builds to load custom items from the plan file. Either before the document is
/// parsed or after.
virtual void preLoadFromJson (PlanMasterController* pController, QJsonObject& json) { Q_UNUSED(pController); Q_UNUSED(json); }
virtual void postLoadFromJson (PlanMasterController* pController, QJsonObject& json) { Q_UNUSED(pController); Q_UNUSED(json); }
bool showTouchAreas(void) const { return _showTouchAreas; } bool showTouchAreas(void) const { return _showTouchAreas; }
bool showAdvancedUI(void) const { return _showAdvancedUI; } bool showAdvancedUI(void) const { return _showAdvancedUI; }
void setShowTouchAreas(bool show); void setShowTouchAreas(bool show);
......
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