@ -9,6 +9,7 @@ import QGroundControl.Controls 1.0
@@ -9,6 +9,7 @@ import QGroundControl.Controls 1.0
import QGroundControl . FactControls 1.0
import QGroundControl . Palette 1.0
import QGroundControl . SettingsManager 1.0
import QGroundControl . Controllers 1.0
/ / E d i t o r f o r M i s s i o n S e t t i n g s
Rectangle {
@ -19,6 +20,38 @@ Rectangle {
@@ -19,6 +20,38 @@ Rectangle {
visible: missionItem . isCurrentItem
radius: _radius
property var _missionVehicle : missionController . vehicle
property bool _vehicleHasHomePosition : _missionVehicle . homePosition . isValid
property bool _offlineEditing : _missionVehicle . isOfflineEditingVehicle
property bool _showOfflineVehicleCombos : _offlineEditing && _multipleFirmware && _noMissionItemsAdded
property bool _showCruiseSpeed : ! _missionVehicle . multiRotor
property bool _showHoverSpeed : _missionVehicle . multiRotor || _missionVehicle . vtol
property bool _multipleFirmware : QGroundControl . supportedFirmwareCount > 2
property real _fieldWidth : ScreenTools . defaultFontPixelWidth * 16
property bool _mobile : ScreenTools . isMobile
property var _savePath : QGroundControl . settingsManager . appSettings . missionSavePath
property var _fileExtension : QGroundControl . settingsManager . appSettings . missionFileExtension
property bool _newMissionAlreadyExists : false
property bool _noMissionName : missionItem . missionName . valueString === ""
property bool _showMissionList : _noMissionItemsAdded && ( _noMissionName || _newMissionAlreadyExists )
property bool _existingMissionLoaded : missionItem . existingMission
readonly property string _firmwareLabel : qsTr ( "Firmware" )
readonly property string _vehicleLabel : qsTr ( "Vehicle" )
QGCPalette { id: qgcPal }
QFileDialogController { id: fileController }
Connections {
target: missionItem . missionName
onRawValueChanged: {
if ( ! _existingMissionLoaded ) {
_newMissionAlreadyExists = ! _noMissionName && fileController . fileExists ( _savePath + "/" + missionItem . missionName . valueString + "." + _fileExtension )
}
}
}
Loader {
id: deferedload
active: valuesRect . visible
@ -33,21 +66,6 @@ Rectangle {
@@ -33,21 +66,6 @@ Rectangle {
id: valuesItem
height: valuesColumn . height + ( _margin * 2 )
property var _missionVehicle : missionController . vehicle
property bool _vehicleHasHomePosition : _missionVehicle . homePosition . isValid
property bool _offlineEditing : _missionVehicle . isOfflineEditingVehicle
property bool _showOfflineVehicleCombos : _offlineEditing && _multipleFirmware && _noMissionItemsAdded
property bool _showCruiseSpeed : ! _missionVehicle . multiRotor
property bool _showHoverSpeed : _missionVehicle . multiRotor || _missionVehicle . vtol
property bool _multipleFirmware : QGroundControl . supportedFirmwareCount > 2
property real _fieldWidth : ScreenTools . defaultFontPixelWidth * 16
property bool _mobile : ScreenTools . isMobile
readonly property string _firmwareLabel : qsTr ( "Firmware" )
readonly property string _vehicleLabel : qsTr ( "Vehicle" )
QGCPalette { id: qgcPal }
Column {
id: valuesColumn
anchors.left: parent . left
@ -55,176 +73,269 @@ Rectangle {
@@ -55,176 +73,269 @@ Rectangle {
anchors.top: parent . top
spacing: _margin
SectionHeader {
id: plannedHomePositionSection
text: qsTr ( "Planned Home Position" )
showSpacer: false
visible: ! _vehicleHasHomePosition
QGCLabel {
text: qsTr ( "Mission name" )
font.pointSize: ScreenTools . smallFontPointSize
}
Column {
FactTextField {
anchors.left: parent . left
anchors.right: parent . right
spacing: _margin
visible: plannedHomePositionSection . checked && ! _vehicleHasHomePosition
GridLayout {
anchors.left: parent . left
anchors.right: parent . right
columnSpacing: ScreenTools . defaultFontPixelWidth
rowSpacing: columnSpacing
columns: 2
QGCLabel {
text: qsTr ( "Altitude" )
}
FactTextField {
fact: missionItem . plannedHomePositionAltitude
Layout.fillWidth: true
}
}
fact: missionItem . missionName
visible: ! _existingMissionLoaded
}
QGCLabel {
width: parent . width
wrapMode: Text . WordWrap
font.pointSize: ScreenTools . smallFontPointSize
text: qsTr ( "Actual position set by vehicle at flight time." )
horizontalAlignment: Text . AlignHCenter
}
QGCLabel {
text: missionItem . missionName . valueString
visible: _existingMissionLoaded
}
QGCButton {
text: qsTr ( "Set Home To Map Center " )
onClicked: missionItem . coordinate = map . center
anchors.horizontalCenter: parent . horizontalCenter
}
QGCLabel {
text: qsTr ( "Mission already exists" )
font.pointSize: ScreenTools . smallFontPointSize
color: qgcPal . warningText
visible: ! _existingMissionLoaded && _newMissionAlreadyExists
}
SectionHeader {
id: vehicleInfoSectionHeader
text: qsTr ( "Vehicle Info" )
visible: _offlineEditing
checked: false
QGCButton {
text: qsTr ( "Clear mission" )
visible: ! _noMissionItemsAdded
onClicked: missionController . clearMission ( )
}
GridLayout {
anchors.left: parent . left
anchors.right: parent . right
columnSpacing: ScreenTools . defaultFontPixelWidth
rowSpacing: columnSpacing
columns: 2
visible: vehicleInfoSectionHeader . visible && vehicleInfoSectionHeader . checked
QGCLabel {
text: _firmwareLabel
Layout.fillWidth: true
visible: _showOfflineVehicleCombos
}
FactComboBox {
fact: QGroundControl . settingsManager . appSettings . offlineEditingFirmwareType
indexModel: false
Layout.preferredWidth: _fieldWidth
visible: _showOfflineVehicleCombos
}
Loader {
anchors.left: parent . left
anchors.right: parent . right
sourceComponent: _showMissionList ? missionList : missionSettings
}
} / / C o l u m n
} / / I t e m
} / / C o m p o n e n t
} / / L o a d e r
QGCLabel {
text: _vehicleLabel
Layout.fillWidth: true
visible: _showOfflineVehicleCombos
}
FactComboBox {
fact: QGroundControl . settingsManager . appSettings . offlineEditingVehicleType
indexModel: false
Layout.preferredWidth: _fieldWidth
visible: _showOfflineVehicleCombos
}
Component {
id: missionList
QGCLabel {
text: qsTr ( "Cruise speed" )
visible: _showCruiseSpeed
Layout.fillWidth: true
}
FactTextField {
fact: QGroundControl . settingsManager . appSettings . offlineEditingCruiseSpeed
visible: _showCruiseSpeed
Layout.preferredWidth: _fieldWidth
}
QGCFlickable {
anchors.left: parent . left
anchors.right: parent . right
height: missionColumn . height
QGCLabel {
text: qsTr ( "Hover speed" )
visible: _showHoverSpeed
Layout.fillWidth: true
}
FactTextField {
fact: QGroundControl . settingsManager . appSettings . offlineEditingHoverSpeed
visible: _showHoverSpeed
Layout.preferredWidth: _fieldWidth
}
} / / G r i d L a y o u t
Column {
id: missionColumn
anchors.left: parent . left
anchors.right: parent . right
spacing: _margin
SectionHeader {
text: qsTr ( "Load Mission" )
showSpacer: false
}
SectionHeader {
id: missionDefaultsSectionHeader
text: qsTr ( "Mission Defaults" )
checked: true
QGCButton {
anchors.left: parent . left
anchors.right: parent . right
text: qsTr ( "Load from Vehicle" )
visible: ! _offlineEditing
onClicked: {
missionController . loadFromVehicle ( )
}
}
QGCLabel {
text: qsTr ( "No mission files" )
visible: missionRepeater . model . length === 0
}
Column {
Repeater {
id: missionRepeater
model: fileController . getFiles ( _savePath , _fileExtension ) ;
QGCButton {
anchors.left: parent . left
anchors.right: parent . right
spacing: _margin
visible: missionDefaultsSectionHeader . checked
GridLayout {
anchors.left: parent . left
anchors.right: parent . right
columnSpacing: ScreenTools . defaultFontPixelWidth
rowSpacing: columnSpacing
columns: 2
QGCLabel {
text: qsTr ( "Altitude" )
}
FactTextField {
fact: QGroundControl . settingsManager . appSettings . defaultMissionItemAltitude
Layout.fillWidth: true
}
QGCCheckBox {
id: flightSpeedCheckBox
text: qsTr ( "Flight speed" )
visible: ! _missionVehicle . vtol
checked: missionItem . specifyMissionFlightSpeed
onClicked: missionItem . specifyMissionFlightSpeed = checked
}
FactTextField {
Layout.fillWidth: true
fact: missionItem . missionFlightSpeed
visible: flightSpeedCheckBox . visible
enabled: flightSpeedCheckBox . checked
}
} / / G r i d L a y o u t
FactComboBox {
anchors.left: parent . left
anchors.right: parent . right
fact: missionItem . missionEndAction
indexModel: false
text: modelData
onClicked: {
missionController . loadFromFile ( fileController . fullyQualifiedFilename ( _savePath , modelData , _fileExtension ) )
}
}
}
}
}
}
Component {
id: missionSettings
Column {
id: valuesColumn
anchors.left: parent . left
anchors.right: parent . right
anchors.top: parent . top
spacing: _margin
SectionHeader {
id: missionDefaultsSectionHeader
text: qsTr ( "Mission Defaults" )
checked: true
showSpacer: false
}
Column {
anchors.left: parent . left
anchors.right: parent . right
spacing: _margin
visible: missionDefaultsSectionHeader . checked
GridLayout {
anchors.left: parent . left
anchors.right: parent . right
columnSpacing: ScreenTools . defaultFontPixelWidth
rowSpacing: columnSpacing
columns: 2
QGCLabel {
text: qsTr ( "Waypoint alt" )
}
FactTextField {
fact: QGroundControl . settingsManager . appSettings . defaultMissionItemAltitude
Layout.fillWidth: true
}
CameraSection {
checked: missionItem . cameraSection . settingsSpecified
QGCCheckBox {
id: flightSpeedCheckBox
text: qsTr ( "Flight speed" )
visible: ! _missionVehicle . vtol
checked: missionItem . specifyMissionFlightSpeed
onClicked: missionItem . specifyMissionFlightSpeed = checked
}
FactTextField {
Layout.fillWidth: true
fact: missionItem . missionFlightSpeed
visible: flightSpeedCheckBox . visible
enabled: flightSpeedCheckBox . checked
}
} / / G r i d L a y o u t
FactComboBox {
anchors.left: parent . left
anchors.right: parent . right
fact: missionItem . missionEndAction
indexModel: false
}
}
CameraSection {
checked: missionItem . cameraSection . settingsSpecified
}
SectionHeader {
id: vehicleInfoSectionHeader
text: qsTr ( "Vehicle Info" )
visible: _offlineEditing
checked: false
}
GridLayout {
anchors.left: parent . left
anchors.right: parent . right
columnSpacing: ScreenTools . defaultFontPixelWidth
rowSpacing: columnSpacing
columns: 2
visible: vehicleInfoSectionHeader . visible && vehicleInfoSectionHeader . checked
QGCLabel {
text: _firmwareLabel
Layout.fillWidth: true
visible: _showOfflineVehicleCombos
}
FactComboBox {
fact: QGroundControl . settingsManager . appSettings . offlineEditingFirmwareType
indexModel: false
Layout.preferredWidth: _fieldWidth
visible: _showOfflineVehicleCombos
}
QGCLabel {
text: _vehicleLabel
Layout.fillWidth: true
visible: _showOfflineVehicleCombos
}
FactComboBox {
fact: QGroundControl . settingsManager . appSettings . offlineEditingVehicleType
indexModel: false
Layout.preferredWidth: _fieldWidth
visible: _showOfflineVehicleCombos
}
QGCLabel {
text: qsTr ( "Cruise speed" )
visible: _showCruiseSpeed
Layout.fillWidth: true
}
FactTextField {
fact: QGroundControl . settingsManager . appSettings . offlineEditingCruiseSpeed
visible: _showCruiseSpeed
Layout.preferredWidth: _fieldWidth
}
QGCLabel {
text: qsTr ( "Hover speed" )
visible: _showHoverSpeed
Layout.fillWidth: true
}
FactTextField {
fact: QGroundControl . settingsManager . appSettings . offlineEditingHoverSpeed
visible: _showHoverSpeed
Layout.preferredWidth: _fieldWidth
}
} / / G r i d L a y o u t
SectionHeader {
id: plannedHomePositionSection
text: qsTr ( "Planned Home Position" )
visible: ! _vehicleHasHomePosition
checked: false
}
Column {
anchors.left: parent . left
anchors.right: parent . right
spacing: _margin
visible: plannedHomePositionSection . checked && ! _vehicleHasHomePosition
GridLayout {
anchors.left: parent . left
anchors.right: parent . right
columnSpacing: ScreenTools . defaultFontPixelWidth
rowSpacing: columnSpacing
columns: 2
QGCLabel {
width: parent . width
wrapMode: Text . WordWrap
font.pointSize: ScreenTools . smallFontPointSize
text: qsTr ( "Speeds are only used for time calculations. Actual vehicle speed will not be affected." )
horizontalAlignment: Text . AlignHCenter
visible: _offlineEditing && _missionVehicle . vtol
text: qsTr ( "Altitude" )
}
} / / C o l u m n
} / / I t e m
} / / C o m p o n e n t
} / / L o a d e r
FactTextField {
fact: missionItem . plannedHomePositionAltitude
Layout.fillWidth: true
}
}
QGCLabel {
width: parent . width
wrapMode: Text . WordWrap
font.pointSize: ScreenTools . smallFontPointSize
text: qsTr ( "Actual position set by vehicle at flight time." )
horizontalAlignment: Text . AlignHCenter
}
QGCButton {
text: qsTr ( "Set Home To Map Center" )
onClicked: missionItem . coordinate = map . center
anchors.horizontalCenter: parent . horizontalCenter
}
}
} / / C o l u m n
}
} / / R e c t a n g l e