diff --git a/src/AutoPilotPlugins/APM/APMAirframeComponent.qml b/src/AutoPilotPlugins/APM/APMAirframeComponent.qml index 3f15a84c943b50edacb52930bef24a6bc952977e..30529cc563c980020d89262d21fd60322e870c2a 100644 --- a/src/AutoPilotPlugins/APM/APMAirframeComponent.qml +++ b/src/AutoPilotPlugins/APM/APMAirframeComponent.qml @@ -127,7 +127,7 @@ QGCView { id: applyButton anchors.right: parent.right text: "Load common parameters" - onClicked: showDialog(applyRestartDialogComponent, qsTr("Load common parameters"), 50, StandardButton.Close) + onClicked: showDialog(applyRestartDialogComponent, "Load common parameters", qgcView.showDialogDefaultWidth, StandardButton.Close) } } diff --git a/src/AutoPilotPlugins/APM/APMSensorsComponent.qml b/src/AutoPilotPlugins/APM/APMSensorsComponent.qml index 4efc35791068205f9b45b53c1e3861b72c58e12f..37e33f39a1d3d0907fa9039e81204c7d31f6cf00 100644 --- a/src/AutoPilotPlugins/APM/APMSensorsComponent.qml +++ b/src/AutoPilotPlugins/APM/APMSensorsComponent.qml @@ -34,7 +34,7 @@ import QGroundControl.ScreenTools 1.0 import QGroundControl.Controllers 1.0 QGCView { - id: rootQGCView + id: qgcView viewPanel: panel // Help text which is shown both in the status text area prior to pressing a cal button and in the @@ -157,7 +157,7 @@ QGCView { _postCalibrationDialogParams.push("COMPASS_OFS3_Z") } } - showDialog(postCalibrationDialogComponent, "Calibration complete", 50, StandardButton.Ok) + showDialog(postCalibrationDialogComponent, "Calibration complete", qgcView.showDialogDefaultWidth, StandardButton.Ok) } } @@ -362,7 +362,7 @@ QGCView { } else { preCalibrationDialogType = "compass" preCalibrationDialogHelp = compassHelp - showDialog(preCalibrationDialogComponent, "Calibrate Compass", 50, StandardButton.Cancel | StandardButton.Ok) + showDialog(preCalibrationDialogComponent, "Calibrate Compass", qgcView.showDialogDefaultWidth, StandardButton.Cancel | StandardButton.Ok) } } } @@ -376,7 +376,7 @@ QGCView { onClicked: { preCalibrationDialogType = "accel" preCalibrationDialogHelp = accelHelp - showDialog(preCalibrationDialogComponent, "Calibrate Accelerometer", 50, StandardButton.Cancel | StandardButton.Ok) + showDialog(preCalibrationDialogComponent, "Calibrate Accelerometer", qgcView.showDialogDefaultWidth, StandardButton.Cancel | StandardButton.Ok) } } QGCButton { diff --git a/src/AutoPilotPlugins/Common/RadioComponent.qml b/src/AutoPilotPlugins/Common/RadioComponent.qml index fe5a030afd3ec7ad27f71eba0d5517e055be275f..68eb9e5d1890d140245c93961b39ce939bc2e288 100644 --- a/src/AutoPilotPlugins/Common/RadioComponent.qml +++ b/src/AutoPilotPlugins/Common/RadioComponent.qml @@ -34,7 +34,7 @@ import QGroundControl.ScreenTools 1.0 import QGroundControl.Controllers 1.0 QGCView { - id: rootQGCView + id: qgcView viewPanel: panel QGCPalette { id: qgcPal; colorGroupEnabled: panel.enabled } @@ -51,7 +51,7 @@ QGCView { FIXME: Turned off for now, since it prevents binding. Need to restructure to allow binding and still check channel count if (controller.channelCount < controller.minChannelCount) { - showDialog(channelCountDialogComponent, dialogTitle, 50, 0) + showDialog(channelCountDialogComponent, dialogTitle, qgcView.showDialogDefaultWidth, 0) } else { hideDialog() } @@ -68,7 +68,7 @@ QGCView { Component.onCompleted: { controllerCompleted = true - if (rootQGCView.completedSignalled) { + if (qgcView.completedSignalled) { controllerAndViewReady = true controller.start() updateChannelCount() @@ -283,11 +283,11 @@ QGCView { id: rollLoader anchors.left: rollLabel.right anchors.right: parent.right - height: rootQGCView.defaultTextHeight + height: qgcView.defaultTextHeight width: 100 sourceComponent: channelMonitorDisplayComponent - property real defaultTextWidth: rootQGCView.defaultTextWidth + property real defaultTextWidth: qgcView.defaultTextWidth property bool mapped: controller.rollChannelMapped property bool reversed: controller.rollChannelReversed } @@ -313,11 +313,11 @@ QGCView { id: pitchLoader anchors.left: pitchLabel.right anchors.right: parent.right - height: rootQGCView.defaultTextHeight + height: qgcView.defaultTextHeight width: 100 sourceComponent: channelMonitorDisplayComponent - property real defaultTextWidth: rootQGCView.defaultTextWidth + property real defaultTextWidth: qgcView.defaultTextWidth property bool mapped: controller.pitchChannelMapped property bool reversed: controller.pitchChannelReversed } @@ -343,11 +343,11 @@ QGCView { id: yawLoader anchors.left: yawLabel.right anchors.right: parent.right - height: rootQGCView.defaultTextHeight + height: qgcView.defaultTextHeight width: 100 sourceComponent: channelMonitorDisplayComponent - property real defaultTextWidth: rootQGCView.defaultTextWidth + property real defaultTextWidth: qgcView.defaultTextWidth property bool mapped: controller.yawChannelMapped property bool reversed: controller.yawChannelReversed } @@ -373,11 +373,11 @@ QGCView { id: throttleLoader anchors.left: throttleLabel.right anchors.right: parent.right - height: rootQGCView.defaultTextHeight + height: qgcView.defaultTextHeight width: 100 sourceComponent: channelMonitorDisplayComponent - property real defaultTextWidth: rootQGCView.defaultTextWidth + property real defaultTextWidth: qgcView.defaultTextWidth property bool mapped: controller.throttleChannelMapped property bool reversed: controller.throttleChannelReversed } @@ -418,7 +418,7 @@ QGCView { onClicked: { if (text == "Calibrate") { - showDialog(zeroTrimsDialogComponent, dialogTitle, 50, StandardButton.Ok | StandardButton.Cancel) + showDialog(zeroTrimsDialogComponent, dialogTitle, qgcView.showDialogDefaultWidth, StandardButton.Ok | StandardButton.Cancel) } else { controller.nextButtonClicked() } @@ -460,7 +460,7 @@ QGCView { showBorder: true text: "Spektrum Bind" - onClicked: showDialog(spektrumBindDialogComponent, dialogTitle, 50, StandardButton.Ok | StandardButton.Cancel) + onClicked: showDialog(spektrumBindDialogComponent, dialogTitle, qgcView.showDialogDefaultWidth, StandardButton.Ok | StandardButton.Cancel) } } @@ -468,7 +468,7 @@ QGCView { showBorder: true text: "Copy Trims" visible: QGroundControl.multiVehicleManager.activeVehicle.px4Firmware - onClicked: showDialog(copyTrimsDialogComponent, dialogTitle, 50, StandardButton.Ok | StandardButton.Cancel) + onClicked: showDialog(copyTrimsDialogComponent, dialogTitle, qgcView.showDialogDefaultWidth, StandardButton.Ok | StandardButton.Cancel) } } // Column - Left Column @@ -552,11 +552,11 @@ QGCView { Loader { id: theLoader anchors.verticalCenter: channelLabel.verticalCenter - height: rootQGCView.defaultTextHeight + height: qgcView.defaultTextHeight width: 200 sourceComponent: channelMonitorDisplayComponent - property real defaultTextWidth: rootQGCView.defaultTextWidth + property real defaultTextWidth: qgcView.defaultTextWidth property bool mapped: true readonly property bool reversed: false } diff --git a/src/AutoPilotPlugins/PX4/AirframeComponent.qml b/src/AutoPilotPlugins/PX4/AirframeComponent.qml index 0bff1ddd8bf4162db9b6cd7feb1ed1eabfa27cae..69c63f69944bd4306bd78ca9a0ead8a000147075 100644 --- a/src/AutoPilotPlugins/PX4/AirframeComponent.qml +++ b/src/AutoPilotPlugins/PX4/AirframeComponent.qml @@ -67,7 +67,7 @@ QGCView { Component.onCompleted: { if (controller.showCustomConfigPanel) { - showDialog(customConfigDialogComponent, "Custom Airframe Config", 50, StandardButton.Reset) + showDialog(customConfigDialogComponent, "Custom Airframe Config", qgcView.showDialogDefaultWidth, StandardButton.Reset) } } } @@ -138,7 +138,7 @@ QGCView { anchors.right: parent.right text: "Apply and Restart" - onClicked: showDialog(applyRestartDialogComponent, "Apply and Restart", 50, StandardButton.Apply | StandardButton.Cancel) + onClicked: showDialog(applyRestartDialogComponent, "Apply and Restart", qgcView.showDialogDefaultWidth, StandardButton.Apply | StandardButton.Cancel) } } diff --git a/src/AutoPilotPlugins/PX4/FlightModesComponent.qml b/src/AutoPilotPlugins/PX4/FlightModesComponent.qml index a4b643cbeade0f8948ebda85faa2145031e30bb0..d63a3edcfca7c7a0ad4e59df8d180d1287b3e96f 100644 --- a/src/AutoPilotPlugins/PX4/FlightModesComponent.qml +++ b/src/AutoPilotPlugins/PX4/FlightModesComponent.qml @@ -35,7 +35,7 @@ import QGroundControl.Controllers 1.0 import QGroundControl.ScreenTools 1.0 QGCView { - id: rootQGCView + id: qgcView viewPanel: panel readonly property int monitorThresholdCharWidth: 8 // Character width of Monitor and Threshold labels @@ -138,7 +138,7 @@ QGCView { onTriggered: { recalcModePositions() if (rcInMode.value == 1) { - showDialog(joystickEnabledDialogComponent, title, 50, 0) + showDialog(joystickEnabledDialogComponent, title, qgcView.showDialogDefaultWidth, 0) } } } diff --git a/src/AutoPilotPlugins/PX4/SensorsComponent.qml b/src/AutoPilotPlugins/PX4/SensorsComponent.qml index 7fc5ac494828688857534ed7b7f6321f3efbc9e4..c6f74b77009d9e13c557b4cab6f64797b7649bc6 100644 --- a/src/AutoPilotPlugins/PX4/SensorsComponent.qml +++ b/src/AutoPilotPlugins/PX4/SensorsComponent.qml @@ -34,7 +34,7 @@ import QGroundControl.ScreenTools 1.0 import QGroundControl.Controllers 1.0 QGCView { - id: rootQGCView + id: qgcView viewPanel: panel // Help text which is shown both in the status text area prior to pressing a cal button and in the @@ -130,7 +130,7 @@ QGCView { onSetCompassRotations: { if (showCompass0Rot || showCompass1Rot || showCompass2Rot) { - showDialog(compassRotationDialogComponent, "Set Compass Rotation(s)", 50, StandardButton.Ok) + showDialog(compassRotationDialogComponent, "Set Compass Rotation(s)", qgcView.showDialogDefaultWidth, StandardButton.Ok) } } @@ -295,7 +295,7 @@ QGCView { onClicked: { preCalibrationDialogType = "compass" preCalibrationDialogHelp = compassHelp - showDialog(preCalibrationDialogComponent, "Calibrate Compass", 50, StandardButton.Cancel | StandardButton.Ok) + showDialog(preCalibrationDialogComponent, "Calibrate Compass", qgcView.showDialogDefaultWidth, StandardButton.Cancel | StandardButton.Ok) } } @@ -308,7 +308,7 @@ QGCView { onClicked: { preCalibrationDialogType = "gyro" preCalibrationDialogHelp = gyroHelp - showDialog(preCalibrationDialogComponent, "Calibrate Gyro", 50, StandardButton.Cancel | StandardButton.Ok) + showDialog(preCalibrationDialogComponent, "Calibrate Gyro", qgcView.showDialogDefaultWidth, StandardButton.Cancel | StandardButton.Ok) } } @@ -321,7 +321,7 @@ QGCView { onClicked: { preCalibrationDialogType = "accel" preCalibrationDialogHelp = accelHelp - showDialog(preCalibrationDialogComponent, "Calibrate Accelerometer", 50, StandardButton.Cancel | StandardButton.Ok) + showDialog(preCalibrationDialogComponent, "Calibrate Accelerometer", qgcView.showDialogDefaultWidth, StandardButton.Cancel | StandardButton.Ok) } } @@ -335,7 +335,7 @@ QGCView { onClicked: { preCalibrationDialogType = "level" preCalibrationDialogHelp = levelHelp - showDialog(preCalibrationDialogComponent, "Level Horizon", 50, StandardButton.Cancel | StandardButton.Ok) + showDialog(preCalibrationDialogComponent, "Level Horizon", qgcView.showDialogDefaultWidth, StandardButton.Cancel | StandardButton.Ok) } } @@ -349,7 +349,7 @@ QGCView { onClicked: { preCalibrationDialogType = "airspeed" preCalibrationDialogHelp = airspeedHelp - showDialog(preCalibrationDialogComponent, "Calibrate Airspeed", 50, StandardButton.Cancel | StandardButton.Ok) + showDialog(preCalibrationDialogComponent, "Calibrate Airspeed", qgcView.showDialogDefaultWidth, StandardButton.Cancel | StandardButton.Ok) } } diff --git a/src/FactSystem/FactControls/FactTextField.qml b/src/FactSystem/FactControls/FactTextField.qml index aa7050a0e2dda8868b29ee78a09e0d31b72150ba..e22416945ad26116f547c98c20f010b3d1a55d58 100644 --- a/src/FactSystem/FactControls/FactTextField.qml +++ b/src/FactSystem/FactControls/FactTextField.qml @@ -29,7 +29,7 @@ QGCTextField { fact.value = text } else { _validateString = text - qgcView.showDialog(editorDialogComponent, "Invalid Parameter Value", 50, StandardButton.Save) + qgcView.showDialog(editorDialogComponent, "Invalid Parameter Value", qgcView.showDialogDefaultWidth, StandardButton.Save) } } else { fact.value = text diff --git a/src/QmlControls/MissionItemEditor.qml b/src/QmlControls/MissionItemEditor.qml index 5fc35af6920c9806c8abd82296da5646ed400842..d4eb9c4bdeca49fe2304d8f8862ab9361719721b 100644 --- a/src/QmlControls/MissionItemEditor.qml +++ b/src/QmlControls/MissionItemEditor.qml @@ -95,7 +95,7 @@ Rectangle { MenuItem { text: "Delete all" - onTriggered: qgcView.showDialog(deleteAllPromptDialog, "Delete all", 40, StandardButton.Yes | StandardButton.No) + onTriggered: qgcView.showDialog(deleteAllPromptDialog, "Delete all", qgcView.showDialogDefaultWidth, StandardButton.Yes | StandardButton.No) } MenuSeparator { } @@ -139,7 +139,7 @@ Rectangle { } } - onClicked: qgcView.showDialog(commandDialog, "Select Mission Command", 40, StandardButton.Cancel) + onClicked: qgcView.showDialog(commandDialog, "Select Mission Command", qgcView.showDialogDefaultWidth, StandardButton.Cancel) } QGCLabel { diff --git a/src/QmlControls/ParameterEditor.qml b/src/QmlControls/ParameterEditor.qml index 0b0bb79dabab85f82e1393f83a69535cd1cb888a..f5def04c66da0a3f64952fab6c45ac4b19748ef7 100644 --- a/src/QmlControls/ParameterEditor.qml +++ b/src/QmlControls/ParameterEditor.qml @@ -119,7 +119,7 @@ QGCView { } MenuItem { text: "Search..." - onTriggered: showDialog(searchDialogComponent, "Parameter Search", 50, StandardButton.Reset | StandardButton.Apply) + onTriggered: showDialog(searchDialogComponent, "Parameter Search", panel.showDialogDefaultWidth, StandardButton.Reset | StandardButton.Apply) } MenuSeparator { visible: !ScreenTools.isMobile } MenuItem { @@ -314,7 +314,7 @@ QGCView { acceptedButtons: Qt.LeftButton onClicked: { __editorDialogFact = factRow.modelFact - showDialog(editorDialogComponent, "Parameter Editor", 50, StandardButton.Cancel | StandardButton.Save) + showDialog(editorDialogComponent, "Parameter Editor", qgcView.showDialogDefaultWidth, StandardButton.Cancel | StandardButton.Save) } } } diff --git a/src/QmlControls/QGCView.qml b/src/QmlControls/QGCView.qml index 199456e991b6d3975956dfc36d86abe7e12058d6..432a629fbcfbc311414ff1c768e7bee2284d8f7d 100644 --- a/src/QmlControls/QGCView.qml +++ b/src/QmlControls/QGCView.qml @@ -128,8 +128,12 @@ FactPanel { /// Shows a QGCViewDialog component /// @param compoent QGCViewDialog component /// @param title Title for dialog - /// @param charWidth Width of dialog in characters (-1 for full parent width) + /// @param charWidth Width of dialog in characters /// @param buttons Buttons to show in dialog using StandardButton enum + + readonly property int showDialogFullWidth: -1 ///< Use for full width dialog + readonly property int showDialogDefaultWidth: 40 ///< Use for default dialog width + function showDialog(component, title, charWidth, buttons) { if (__checkForEarlyDialog(title)) { return @@ -158,7 +162,7 @@ FactPanel { __stopAllAnimations() - __dialogCharWidth = 50 + __dialogCharWidth = showDialogDefaultWidth __dialogTitle = title __messageDialogText = message @@ -285,7 +289,7 @@ FactPanel { // This is the main dialog panel which is anchored to the right edge Rectangle { id: __dialogPanel - width: __dialogCharWidth == -1 ? parent.width : defaultTextWidth * __dialogCharWidth + width: __dialogCharWidth == showDialogFullWidth ? parent.width : defaultTextWidth * __dialogCharWidth anchors.topMargin: topDialogMargin anchors.top: parent.top anchors.bottom: parent.bottom diff --git a/src/VehicleSetup/FirmwareUpgrade.qml b/src/VehicleSetup/FirmwareUpgrade.qml index 11dc82a934db0d17aa22df095907c1f96a838c89..78f8bdff337bc30c41bdeac1451a7dc6e08393fa 100644 --- a/src/VehicleSetup/FirmwareUpgrade.qml +++ b/src/VehicleSetup/FirmwareUpgrade.qml @@ -109,7 +109,7 @@ QGCView { // We end up here when we detect a board plugged in after we've started upgrade statusTextArea.append(highlightPrefix + "Found device" + highlightSuffix + ": " + controller.boardType) if (controller.boardType == "Pixhawk" || controller.boardType == "AeroCore" || controller.boardType == "PX4 Flow" || controller.boardType == "PX4 FMU V1") { - showDialog(pixhawkFirmwareSelectDialog, title, 50, StandardButton.Ok | StandardButton.Cancel) + showDialog(pixhawkFirmwareSelectDialog, title, qgcView.showDialogDefaultWidth, StandardButton.Ok | StandardButton.Cancel) } } }