|
|
@ -184,15 +184,19 @@ Rectangle { |
|
|
|
Layout.fillWidth: true |
|
|
|
Layout.fillWidth: true |
|
|
|
text: qsTr("Delete Preset") |
|
|
|
text: qsTr("Delete Preset") |
|
|
|
enabled: _missionItem.presetNames.length != 0 |
|
|
|
enabled: _missionItem.presetNames.length != 0 |
|
|
|
onClicked: mainWindow.showComponentDialog(deletePresetMessage, qsTr("Delete Preset"), mainWindow.showDialogDefaultWidth, StandardButton.Yes | StandardButton.No) |
|
|
|
onClicked: mainWindow.showPopupDialogFromComponent(deletePresetDialog, { presetName: presetCombo.textAt(presetCombo.currentIndex) }) |
|
|
|
|
|
|
|
|
|
|
|
Component { |
|
|
|
Component { |
|
|
|
id: deletePresetMessage |
|
|
|
id: deletePresetDialog |
|
|
|
QGCViewMessage { |
|
|
|
|
|
|
|
message: qsTr("Are you sure you want to delete '%1' preset?").arg(presetName) |
|
|
|
QGCPopupDialog { |
|
|
|
property string presetName: presetCombo.textAt(presetCombo.currentIndex) |
|
|
|
title: qsTr("Delete Preset") |
|
|
|
|
|
|
|
buttons: StandardButton.Yes | StandardButton.No |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
QGCLabel { text: qsTr("Are you sure you want to delete '%1' preset?").arg(dialogProperties.presetName) } |
|
|
|
|
|
|
|
|
|
|
|
function accept() { |
|
|
|
function accept() { |
|
|
|
_missionItem.deletePreset(presetName) |
|
|
|
_missionItem.deletePreset(dialogProperties.presetName) |
|
|
|
hideDialog() |
|
|
|
hideDialog() |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
@ -206,7 +210,7 @@ Rectangle { |
|
|
|
Layout.alignment: Qt.AlignCenter |
|
|
|
Layout.alignment: Qt.AlignCenter |
|
|
|
Layout.fillWidth: true |
|
|
|
Layout.fillWidth: true |
|
|
|
text: qsTr("Save Settings As New Preset") |
|
|
|
text: qsTr("Save Settings As New Preset") |
|
|
|
onClicked: mainWindow.showComponentDialog(savePresetDialog, qsTr("Save Preset"), mainWindow.showDialogDefaultWidth, StandardButton.Save | StandardButton.Cancel) |
|
|
|
onClicked: mainWindow.showPopupDialogFromComponent(savePresetDialog) |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
SectionHeader { |
|
|
|
SectionHeader { |
|
|
@ -240,18 +244,21 @@ Rectangle { |
|
|
|
Component { |
|
|
|
Component { |
|
|
|
id: savePresetDialog |
|
|
|
id: savePresetDialog |
|
|
|
|
|
|
|
|
|
|
|
QGCViewDialog { |
|
|
|
QGCPopupDialog { |
|
|
|
|
|
|
|
id: popupDialog |
|
|
|
|
|
|
|
title: qsTr("Save Preset") |
|
|
|
|
|
|
|
buttons: StandardButton.Save | StandardButton.Cancel |
|
|
|
|
|
|
|
|
|
|
|
function accept() { |
|
|
|
function accept() { |
|
|
|
if (presetNameField.text != "") { |
|
|
|
if (presetNameField.text != "") { |
|
|
|
_missionItem.savePreset(presetNameField.text) |
|
|
|
_missionItem.savePreset(presetNameField.text.trim()) |
|
|
|
hideDialog() |
|
|
|
hideDialog() |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
ColumnLayout { |
|
|
|
ColumnLayout { |
|
|
|
anchors.left: parent.left |
|
|
|
width: ScreenTools.defaultFontPixelWidth * 30 |
|
|
|
anchors.right: parent.right |
|
|
|
spacing: ScreenTools.defaultFontPixelHeight |
|
|
|
spacing: ScreenTools.defaultFontPixelHeight |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
QGCLabel { |
|
|
|
QGCLabel { |
|
|
|
Layout.fillWidth: true |
|
|
|
Layout.fillWidth: true |
|
|
@ -266,6 +273,31 @@ Rectangle { |
|
|
|
QGCTextField { |
|
|
|
QGCTextField { |
|
|
|
id: presetNameField |
|
|
|
id: presetNameField |
|
|
|
Layout.fillWidth: true |
|
|
|
Layout.fillWidth: true |
|
|
|
|
|
|
|
placeholderText: qsTr("Enter preset name") |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Component.onCompleted: validateText(presetNameField.text) |
|
|
|
|
|
|
|
onTextChanged: validateText(text) |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
function validateText(text) { |
|
|
|
|
|
|
|
if (text.trim() === "") { |
|
|
|
|
|
|
|
nameError.text = qsTr("Preset name cannot be blank.") |
|
|
|
|
|
|
|
popupDialog.disableAcceptButton() |
|
|
|
|
|
|
|
} else if (text.includes("/")) { |
|
|
|
|
|
|
|
nameError.text = qsTr("Preset name cannot include the \"/\" character.") |
|
|
|
|
|
|
|
popupDialog.disableAcceptButton() |
|
|
|
|
|
|
|
} else { |
|
|
|
|
|
|
|
nameError.text = "" |
|
|
|
|
|
|
|
popupDialog.enableAcceptButton() |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
QGCLabel { |
|
|
|
|
|
|
|
id: nameError |
|
|
|
|
|
|
|
Layout.fillWidth: true |
|
|
|
|
|
|
|
wrapMode: Text.WordWrap |
|
|
|
|
|
|
|
color: QGroundControl.globalPalette.warningText |
|
|
|
|
|
|
|
visible: text !== "" |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|