Commit 3adba8e2 authored by dogmaphobic's avatar dogmaphobic

Fix QGCView.showDialog() when called from FactTextField.

Actually, changed so showDialog figures out on its own if it should use available height or full parent height. The variable is now set by the main window, which controls which view is being shown.
I commented off some code in ParameterEditorDialog.qml as it is not properly handling the dialog and causing it to get "stuck".
parent eb935daa
...@@ -53,7 +53,7 @@ QGCFlickable { ...@@ -53,7 +53,7 @@ QGCFlickable {
} }
function showPicker() { function showPicker() {
qgcView.showDialog(propertyPicker, qsTr("Value Widget Setup"), qgcView.showDialogDefaultWidth, StandardButton.Ok, true /*use available height*/ ) qgcView.showDialog(propertyPicker, qsTr("Value Widget Setup"), qgcView.showDialogDefaultWidth, StandardButton.Ok)
} }
function listContains(list, value) { function listContains(list, value) {
......
...@@ -90,7 +90,7 @@ QGCView { ...@@ -90,7 +90,7 @@ QGCView {
function loadFromFile() { function loadFromFile() {
if (ScreenTools.isMobile) { if (ScreenTools.isMobile) {
_root.showDialog(mobileFilePicker, qsTr("Select Mission File"), _root.showDialogDefaultWidth, StandardButton.Yes | StandardButton.Cancel, true) _root.showDialog(mobileFilePicker, qsTr("Select Mission File"), _root.showDialogDefaultWidth, StandardButton.Yes | StandardButton.Cancel)
} else { } else {
controller.loadMissionFromFilePicker() controller.loadMissionFromFilePicker()
fitViewportToMissionItems() fitViewportToMissionItems()
...@@ -99,7 +99,7 @@ QGCView { ...@@ -99,7 +99,7 @@ QGCView {
function saveToFile() { function saveToFile() {
if (ScreenTools.isMobile) { if (ScreenTools.isMobile) {
_root.showDialog(mobileFileSaver, qsTr("Save Mission File"), _root.showDialogDefaultWidth, StandardButton.Save | StandardButton.Cancel, true) _root.showDialog(mobileFileSaver, qsTr("Save Mission File"), _root.showDialogDefaultWidth, StandardButton.Save | StandardButton.Cancel)
} else { } else {
controller.saveMissionToFilePicker() controller.saveMissionToFilePicker()
} }
...@@ -801,7 +801,7 @@ QGCView { ...@@ -801,7 +801,7 @@ QGCView {
onClicked: { onClicked: {
syncButton.hideDropDown() syncButton.hideDropDown()
if (syncNeeded) { if (syncNeeded) {
_root.showDialog(syncLoadFromVehicleOverwrite, qsTr("Mission overwrite"), _root.showDialogDefaultWidth, StandardButton.Yes | StandardButton.Cancel, true) _root.showDialog(syncLoadFromVehicleOverwrite, qsTr("Mission overwrite"), _root.showDialogDefaultWidth, StandardButton.Yes | StandardButton.Cancel)
} else { } else {
loadFromVehicle() loadFromVehicle()
} }
...@@ -829,7 +829,7 @@ QGCView { ...@@ -829,7 +829,7 @@ QGCView {
onClicked: { onClicked: {
syncButton.hideDropDown() syncButton.hideDropDown()
if (syncNeeded) { if (syncNeeded) {
_root.showDialog(syncLoadFromFileOverwrite, qsTr("Mission overwrite"), _root.showDialogDefaultWidth, StandardButton.Yes | StandardButton.Cancel, true) _root.showDialog(syncLoadFromFileOverwrite, qsTr("Mission overwrite"), _root.showDialogDefaultWidth, StandardButton.Yes | StandardButton.Cancel)
} else { } else {
loadFromFile() loadFromFile()
} }
...@@ -841,7 +841,7 @@ QGCView { ...@@ -841,7 +841,7 @@ QGCView {
text: qsTr("Remove all") text: qsTr("Remove all")
onClicked: { onClicked: {
syncButton.hideDropDown() syncButton.hideDropDown()
_root.showDialog(removeAllPromptDialog, qsTr("Delete all"), _root.showDialogDefaultWidth, StandardButton.Yes | StandardButton.No, true) _root.showDialog(removeAllPromptDialog, qsTr("Delete all"), _root.showDialogDefaultWidth, StandardButton.Yes | StandardButton.No)
} }
} }
......
...@@ -47,6 +47,7 @@ QGCViewDialog { ...@@ -47,6 +47,7 @@ QGCViewDialog {
QGCPalette { id: qgcPal; colorGroupEnabled: true } QGCPalette { id: qgcPal; colorGroupEnabled: true }
function accept() { function accept() {
/*
if (bitmaskEditor.visible) { if (bitmaskEditor.visible) {
var value = 0; var value = 0;
for (var i = 0; i < fact.bitmaskValues.length; ++i) { for (var i = 0; i < fact.bitmaskValues.length; ++i) {
...@@ -58,12 +59,12 @@ QGCViewDialog { ...@@ -58,12 +59,12 @@ QGCViewDialog {
fact.value = value; fact.value = value;
fact.valueChanged(fact.value) fact.valueChanged(fact.value)
} }
else if (factCombo.visible) { else */ if (factCombo.visible) {
fact.enumIndex = factCombo.currentIndex fact.enumIndex = factCombo.currentIndex
hideDialog() hideDialog()
} else { } else {
var errorString = fact.validate(valueField.text, forceSave.checked) var errorString = fact.validate(valueField.text, forceSave.checked)
if (errorString == "") { if (errorString === "") {
fact.value = valueField.text fact.value = valueField.text
fact.valueChanged(fact.value) fact.valueChanged(fact.value)
hideDialog() hideDialog()
...@@ -96,7 +97,7 @@ QGCViewDialog { ...@@ -96,7 +97,7 @@ QGCViewDialog {
QGCLabel { QGCLabel {
width: parent.width width: parent.width
wrapMode: Text.WordWrap wrapMode: Text.WordWrap
text: fact.shortDescription ? fact.shortDescription : qsTr("Description missing") text: fact.shortDescription ? fact.shortDescription : qsTr("Parameter Description (not defined)")
} }
QGCLabel { QGCLabel {
......
...@@ -43,8 +43,6 @@ FactPanel { ...@@ -43,8 +43,6 @@ FactPanel {
property var viewPanel property var viewPanel
property bool __useAvailableHeight: false
/// This is signalled when the top level Item reaches Component.onCompleted. This allows /// This is signalled when the top level Item reaches Component.onCompleted. This allows
/// the view subcomponent to connect to this signal and do work once the full ui is ready /// the view subcomponent to connect to this signal and do work once the full ui is ready
/// to go. /// to go.
...@@ -136,13 +134,11 @@ FactPanel { ...@@ -136,13 +134,11 @@ FactPanel {
readonly property int showDialogFullWidth: -1 ///< Use for full width dialog readonly property int showDialogFullWidth: -1 ///< Use for full width dialog
readonly property int showDialogDefaultWidth: 40 ///< Use for default dialog width readonly property int showDialogDefaultWidth: 40 ///< Use for default dialog width
function showDialog(component, title, charWidth, buttons, useAvailableHeight) { function showDialog(component, title, charWidth, buttons) {
if (__checkForEarlyDialog(title)) { if (__checkForEarlyDialog(title)) {
return return
} }
__useAvailableHeight = typeof useAvailableHeight !== 'undefined' ? useAvailableHeight : false
__stopAllAnimations() __stopAllAnimations()
__dialogCharWidth = charWidth __dialogCharWidth = charWidth
...@@ -282,7 +278,7 @@ FactPanel { ...@@ -282,7 +278,7 @@ FactPanel {
// This covers the parent with an transparent section // This covers the parent with an transparent section
Rectangle { Rectangle {
id: __transparentSection id: __transparentSection
height: __useAvailableHeight ? ScreenTools.availableHeight : parent.height height: ScreenTools.availableHeight ? ScreenTools.availableHeight : parent.height
anchors.bottom: parent.bottom anchors.bottom: parent.bottom
anchors.left: parent.left anchors.left: parent.left
anchors.right: __dialogPanel.left anchors.right: __dialogPanel.left
...@@ -295,7 +291,7 @@ FactPanel { ...@@ -295,7 +291,7 @@ FactPanel {
id: __dialogPanel id: __dialogPanel
width: __dialogCharWidth == showDialogFullWidth ? parent.width : defaultTextWidth * __dialogCharWidth width: __dialogCharWidth == showDialogFullWidth ? parent.width : defaultTextWidth * __dialogCharWidth
anchors.topMargin: topDialogMargin anchors.topMargin: topDialogMargin
height: __useAvailableHeight ? ScreenTools.availableHeight : parent.height height: ScreenTools.availableHeight ? ScreenTools.availableHeight : parent.height
anchors.bottom: parent.bottom anchors.bottom: parent.bottom
anchors.right: parent.right anchors.right: parent.right
color: __qgcPal.windowShadeDark color: __qgcPal.windowShadeDark
...@@ -330,7 +326,9 @@ FactPanel { ...@@ -330,7 +326,9 @@ FactPanel {
anchors.right: parent.right anchors.right: parent.right
primary: true primary: true
onClicked: __dialogComponentLoader.item.accept() onClicked: {
__dialogComponentLoader.item.accept()
}
} }
} }
......
...@@ -57,13 +57,17 @@ Item { ...@@ -57,13 +57,17 @@ Item {
property string formatedMessage: activeVehicle ? activeVehicle.formatedMessage : "" property string formatedMessage: activeVehicle ? activeVehicle.formatedMessage : ""
onHeightChanged: { onHeightChanged: {
ScreenTools.availableHeight = parent.height - toolBar.height //-- We only deal with the available height if within the Fly or Plan view
if(!setupViewLoader.visible) {
ScreenTools.availableHeight = parent.height - toolBar.height
}
} }
function showFlyView() { function showFlyView() {
if(currentPopUp) { if(currentPopUp) {
currentPopUp.close() currentPopUp.close()
} }
ScreenTools.availableHeight = parent.height - toolBar.height
flightView.visible = true flightView.visible = true
setupViewLoader.visible = false setupViewLoader.visible = false
planViewLoader.visible = false planViewLoader.visible = false
...@@ -77,6 +81,7 @@ Item { ...@@ -77,6 +81,7 @@ Item {
if (planViewLoader.source != _planViewSource) { if (planViewLoader.source != _planViewSource) {
planViewLoader.source = _planViewSource planViewLoader.source = _planViewSource
} }
ScreenTools.availableHeight = parent.height - toolBar.height
flightView.visible = false flightView.visible = false
setupViewLoader.visible = false setupViewLoader.visible = false
planViewLoader.visible = true planViewLoader.visible = true
...@@ -87,6 +92,8 @@ Item { ...@@ -87,6 +92,8 @@ Item {
if(currentPopUp) { if(currentPopUp) {
currentPopUp.close() currentPopUp.close()
} }
//-- In setup view, the full height is available. Set to 0 so it is ignored.
ScreenTools.availableHeight = 0
if (setupViewLoader.source != _setupViewSource) { if (setupViewLoader.source != _setupViewSource) {
setupViewLoader.source = _setupViewSource setupViewLoader.source = _setupViewSource
} }
......
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