Commit 6b9a3290 authored by Don Gagne's avatar Don Gagne

Merge pull request #2516 from DonLakeFlyer/DialogStdSize

QGCView::showDialog std size
parents 01498cb2 e07413f6
...@@ -127,7 +127,7 @@ QGCView { ...@@ -127,7 +127,7 @@ QGCView {
id: applyButton id: applyButton
anchors.right: parent.right anchors.right: parent.right
text: "Load common parameters" text: "Load common parameters"
onClicked: showDialog(applyRestartDialogComponent, qsTr("Load common parameters"), 50, StandardButton.Close) onClicked: showDialog(applyRestartDialogComponent, "Load common parameters", qgcView.showDialogDefaultWidth, StandardButton.Close)
} }
} }
......
...@@ -34,7 +34,7 @@ import QGroundControl.ScreenTools 1.0 ...@@ -34,7 +34,7 @@ import QGroundControl.ScreenTools 1.0
import QGroundControl.Controllers 1.0 import QGroundControl.Controllers 1.0
QGCView { QGCView {
id: rootQGCView id: qgcView
viewPanel: panel viewPanel: panel
// Help text which is shown both in the status text area prior to pressing a cal button and in the // 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 { ...@@ -157,7 +157,7 @@ QGCView {
_postCalibrationDialogParams.push("COMPASS_OFS3_Z") _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 { ...@@ -362,7 +362,7 @@ QGCView {
} else { } else {
preCalibrationDialogType = "compass" preCalibrationDialogType = "compass"
preCalibrationDialogHelp = compassHelp 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 { ...@@ -376,7 +376,7 @@ QGCView {
onClicked: { onClicked: {
preCalibrationDialogType = "accel" preCalibrationDialogType = "accel"
preCalibrationDialogHelp = accelHelp preCalibrationDialogHelp = accelHelp
showDialog(preCalibrationDialogComponent, "Calibrate Accelerometer", 50, StandardButton.Cancel | StandardButton.Ok) showDialog(preCalibrationDialogComponent, "Calibrate Accelerometer", qgcView.showDialogDefaultWidth, StandardButton.Cancel | StandardButton.Ok)
} }
} }
QGCButton { QGCButton {
......
...@@ -34,7 +34,7 @@ import QGroundControl.ScreenTools 1.0 ...@@ -34,7 +34,7 @@ import QGroundControl.ScreenTools 1.0
import QGroundControl.Controllers 1.0 import QGroundControl.Controllers 1.0
QGCView { QGCView {
id: rootQGCView id: qgcView
viewPanel: panel viewPanel: panel
QGCPalette { id: qgcPal; colorGroupEnabled: panel.enabled } QGCPalette { id: qgcPal; colorGroupEnabled: panel.enabled }
...@@ -51,7 +51,7 @@ QGCView { ...@@ -51,7 +51,7 @@ QGCView {
FIXME: Turned off for now, since it prevents binding. Need to restructure to FIXME: Turned off for now, since it prevents binding. Need to restructure to
allow binding and still check channel count allow binding and still check channel count
if (controller.channelCount < controller.minChannelCount) { if (controller.channelCount < controller.minChannelCount) {
showDialog(channelCountDialogComponent, dialogTitle, 50, 0) showDialog(channelCountDialogComponent, dialogTitle, qgcView.showDialogDefaultWidth, 0)
} else { } else {
hideDialog() hideDialog()
} }
...@@ -68,7 +68,7 @@ QGCView { ...@@ -68,7 +68,7 @@ QGCView {
Component.onCompleted: { Component.onCompleted: {
controllerCompleted = true controllerCompleted = true
if (rootQGCView.completedSignalled) { if (qgcView.completedSignalled) {
controllerAndViewReady = true controllerAndViewReady = true
controller.start() controller.start()
updateChannelCount() updateChannelCount()
...@@ -283,11 +283,11 @@ QGCView { ...@@ -283,11 +283,11 @@ QGCView {
id: rollLoader id: rollLoader
anchors.left: rollLabel.right anchors.left: rollLabel.right
anchors.right: parent.right anchors.right: parent.right
height: rootQGCView.defaultTextHeight height: qgcView.defaultTextHeight
width: 100 width: 100
sourceComponent: channelMonitorDisplayComponent sourceComponent: channelMonitorDisplayComponent
property real defaultTextWidth: rootQGCView.defaultTextWidth property real defaultTextWidth: qgcView.defaultTextWidth
property bool mapped: controller.rollChannelMapped property bool mapped: controller.rollChannelMapped
property bool reversed: controller.rollChannelReversed property bool reversed: controller.rollChannelReversed
} }
...@@ -313,11 +313,11 @@ QGCView { ...@@ -313,11 +313,11 @@ QGCView {
id: pitchLoader id: pitchLoader
anchors.left: pitchLabel.right anchors.left: pitchLabel.right
anchors.right: parent.right anchors.right: parent.right
height: rootQGCView.defaultTextHeight height: qgcView.defaultTextHeight
width: 100 width: 100
sourceComponent: channelMonitorDisplayComponent sourceComponent: channelMonitorDisplayComponent
property real defaultTextWidth: rootQGCView.defaultTextWidth property real defaultTextWidth: qgcView.defaultTextWidth
property bool mapped: controller.pitchChannelMapped property bool mapped: controller.pitchChannelMapped
property bool reversed: controller.pitchChannelReversed property bool reversed: controller.pitchChannelReversed
} }
...@@ -343,11 +343,11 @@ QGCView { ...@@ -343,11 +343,11 @@ QGCView {
id: yawLoader id: yawLoader
anchors.left: yawLabel.right anchors.left: yawLabel.right
anchors.right: parent.right anchors.right: parent.right
height: rootQGCView.defaultTextHeight height: qgcView.defaultTextHeight
width: 100 width: 100
sourceComponent: channelMonitorDisplayComponent sourceComponent: channelMonitorDisplayComponent
property real defaultTextWidth: rootQGCView.defaultTextWidth property real defaultTextWidth: qgcView.defaultTextWidth
property bool mapped: controller.yawChannelMapped property bool mapped: controller.yawChannelMapped
property bool reversed: controller.yawChannelReversed property bool reversed: controller.yawChannelReversed
} }
...@@ -373,11 +373,11 @@ QGCView { ...@@ -373,11 +373,11 @@ QGCView {
id: throttleLoader id: throttleLoader
anchors.left: throttleLabel.right anchors.left: throttleLabel.right
anchors.right: parent.right anchors.right: parent.right
height: rootQGCView.defaultTextHeight height: qgcView.defaultTextHeight
width: 100 width: 100
sourceComponent: channelMonitorDisplayComponent sourceComponent: channelMonitorDisplayComponent
property real defaultTextWidth: rootQGCView.defaultTextWidth property real defaultTextWidth: qgcView.defaultTextWidth
property bool mapped: controller.throttleChannelMapped property bool mapped: controller.throttleChannelMapped
property bool reversed: controller.throttleChannelReversed property bool reversed: controller.throttleChannelReversed
} }
...@@ -418,7 +418,7 @@ QGCView { ...@@ -418,7 +418,7 @@ QGCView {
onClicked: { onClicked: {
if (text == "Calibrate") { if (text == "Calibrate") {
showDialog(zeroTrimsDialogComponent, dialogTitle, 50, StandardButton.Ok | StandardButton.Cancel) showDialog(zeroTrimsDialogComponent, dialogTitle, qgcView.showDialogDefaultWidth, StandardButton.Ok | StandardButton.Cancel)
} else { } else {
controller.nextButtonClicked() controller.nextButtonClicked()
} }
...@@ -460,7 +460,7 @@ QGCView { ...@@ -460,7 +460,7 @@ QGCView {
showBorder: true showBorder: true
text: "Spektrum Bind" 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 { ...@@ -468,7 +468,7 @@ QGCView {
showBorder: true showBorder: true
text: "Copy Trims" text: "Copy Trims"
visible: QGroundControl.multiVehicleManager.activeVehicle.px4Firmware 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 } // Column - Left Column
...@@ -552,11 +552,11 @@ QGCView { ...@@ -552,11 +552,11 @@ QGCView {
Loader { Loader {
id: theLoader id: theLoader
anchors.verticalCenter: channelLabel.verticalCenter anchors.verticalCenter: channelLabel.verticalCenter
height: rootQGCView.defaultTextHeight height: qgcView.defaultTextHeight
width: 200 width: 200
sourceComponent: channelMonitorDisplayComponent sourceComponent: channelMonitorDisplayComponent
property real defaultTextWidth: rootQGCView.defaultTextWidth property real defaultTextWidth: qgcView.defaultTextWidth
property bool mapped: true property bool mapped: true
readonly property bool reversed: false readonly property bool reversed: false
} }
......
...@@ -67,7 +67,7 @@ QGCView { ...@@ -67,7 +67,7 @@ QGCView {
Component.onCompleted: { Component.onCompleted: {
if (controller.showCustomConfigPanel) { 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 { ...@@ -138,7 +138,7 @@ QGCView {
anchors.right: parent.right anchors.right: parent.right
text: "Apply and Restart" 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)
} }
} }
......
...@@ -35,7 +35,7 @@ import QGroundControl.Controllers 1.0 ...@@ -35,7 +35,7 @@ import QGroundControl.Controllers 1.0
import QGroundControl.ScreenTools 1.0 import QGroundControl.ScreenTools 1.0
QGCView { QGCView {
id: rootQGCView id: qgcView
viewPanel: panel viewPanel: panel
readonly property int monitorThresholdCharWidth: 8 // Character width of Monitor and Threshold labels readonly property int monitorThresholdCharWidth: 8 // Character width of Monitor and Threshold labels
...@@ -138,7 +138,7 @@ QGCView { ...@@ -138,7 +138,7 @@ QGCView {
onTriggered: { onTriggered: {
recalcModePositions() recalcModePositions()
if (rcInMode.value == 1) { if (rcInMode.value == 1) {
showDialog(joystickEnabledDialogComponent, title, 50, 0) showDialog(joystickEnabledDialogComponent, title, qgcView.showDialogDefaultWidth, 0)
} }
} }
} }
......
...@@ -34,7 +34,7 @@ import QGroundControl.ScreenTools 1.0 ...@@ -34,7 +34,7 @@ import QGroundControl.ScreenTools 1.0
import QGroundControl.Controllers 1.0 import QGroundControl.Controllers 1.0
QGCView { QGCView {
id: rootQGCView id: qgcView
viewPanel: panel viewPanel: panel
// Help text which is shown both in the status text area prior to pressing a cal button and in the // 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 { ...@@ -130,7 +130,7 @@ QGCView {
onSetCompassRotations: { onSetCompassRotations: {
if (showCompass0Rot || showCompass1Rot || showCompass2Rot) { 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 { ...@@ -295,7 +295,7 @@ QGCView {
onClicked: { onClicked: {
preCalibrationDialogType = "compass" preCalibrationDialogType = "compass"
preCalibrationDialogHelp = compassHelp 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 { ...@@ -308,7 +308,7 @@ QGCView {
onClicked: { onClicked: {
preCalibrationDialogType = "gyro" preCalibrationDialogType = "gyro"
preCalibrationDialogHelp = gyroHelp 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 { ...@@ -321,7 +321,7 @@ QGCView {
onClicked: { onClicked: {
preCalibrationDialogType = "accel" preCalibrationDialogType = "accel"
preCalibrationDialogHelp = accelHelp 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 { ...@@ -335,7 +335,7 @@ QGCView {
onClicked: { onClicked: {
preCalibrationDialogType = "level" preCalibrationDialogType = "level"
preCalibrationDialogHelp = levelHelp 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 { ...@@ -349,7 +349,7 @@ QGCView {
onClicked: { onClicked: {
preCalibrationDialogType = "airspeed" preCalibrationDialogType = "airspeed"
preCalibrationDialogHelp = airspeedHelp preCalibrationDialogHelp = airspeedHelp
showDialog(preCalibrationDialogComponent, "Calibrate Airspeed", 50, StandardButton.Cancel | StandardButton.Ok) showDialog(preCalibrationDialogComponent, "Calibrate Airspeed", qgcView.showDialogDefaultWidth, StandardButton.Cancel | StandardButton.Ok)
} }
} }
......
...@@ -29,7 +29,7 @@ QGCTextField { ...@@ -29,7 +29,7 @@ QGCTextField {
fact.value = text fact.value = text
} else { } else {
_validateString = text _validateString = text
qgcView.showDialog(editorDialogComponent, "Invalid Parameter Value", 50, StandardButton.Save) qgcView.showDialog(editorDialogComponent, "Invalid Parameter Value", qgcView.showDialogDefaultWidth, StandardButton.Save)
} }
} else { } else {
fact.value = text fact.value = text
......
...@@ -95,7 +95,7 @@ Rectangle { ...@@ -95,7 +95,7 @@ Rectangle {
MenuItem { MenuItem {
text: "Delete all" 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 { } MenuSeparator { }
...@@ -139,7 +139,7 @@ Rectangle { ...@@ -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 { QGCLabel {
......
...@@ -119,7 +119,7 @@ QGCView { ...@@ -119,7 +119,7 @@ QGCView {
} }
MenuItem { MenuItem {
text: "Search..." 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 } MenuSeparator { visible: !ScreenTools.isMobile }
MenuItem { MenuItem {
...@@ -314,7 +314,7 @@ QGCView { ...@@ -314,7 +314,7 @@ QGCView {
acceptedButtons: Qt.LeftButton acceptedButtons: Qt.LeftButton
onClicked: { onClicked: {
__editorDialogFact = factRow.modelFact __editorDialogFact = factRow.modelFact
showDialog(editorDialogComponent, "Parameter Editor", 50, StandardButton.Cancel | StandardButton.Save) showDialog(editorDialogComponent, "Parameter Editor", qgcView.showDialogDefaultWidth, StandardButton.Cancel | StandardButton.Save)
} }
} }
} }
......
...@@ -128,8 +128,12 @@ FactPanel { ...@@ -128,8 +128,12 @@ FactPanel {
/// Shows a QGCViewDialog component /// Shows a QGCViewDialog component
/// @param compoent QGCViewDialog component /// @param compoent QGCViewDialog component
/// @param title Title for dialog /// @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 /// @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) { function showDialog(component, title, charWidth, buttons) {
if (__checkForEarlyDialog(title)) { if (__checkForEarlyDialog(title)) {
return return
...@@ -158,7 +162,7 @@ FactPanel { ...@@ -158,7 +162,7 @@ FactPanel {
__stopAllAnimations() __stopAllAnimations()
__dialogCharWidth = 50 __dialogCharWidth = showDialogDefaultWidth
__dialogTitle = title __dialogTitle = title
__messageDialogText = message __messageDialogText = message
...@@ -285,7 +289,7 @@ FactPanel { ...@@ -285,7 +289,7 @@ FactPanel {
// This is the main dialog panel which is anchored to the right edge // This is the main dialog panel which is anchored to the right edge
Rectangle { Rectangle {
id: __dialogPanel id: __dialogPanel
width: __dialogCharWidth == -1 ? parent.width : defaultTextWidth * __dialogCharWidth width: __dialogCharWidth == showDialogFullWidth ? parent.width : defaultTextWidth * __dialogCharWidth
anchors.topMargin: topDialogMargin anchors.topMargin: topDialogMargin
anchors.top: parent.top anchors.top: parent.top
anchors.bottom: parent.bottom anchors.bottom: parent.bottom
......
...@@ -109,7 +109,7 @@ QGCView { ...@@ -109,7 +109,7 @@ QGCView {
// We end up here when we detect a board plugged in after we've started upgrade // We end up here when we detect a board plugged in after we've started upgrade
statusTextArea.append(highlightPrefix + "Found device" + highlightSuffix + ": " + controller.boardType) statusTextArea.append(highlightPrefix + "Found device" + highlightSuffix + ": " + controller.boardType)
if (controller.boardType == "Pixhawk" || controller.boardType == "AeroCore" || controller.boardType == "PX4 Flow" || controller.boardType == "PX4 FMU V1") { 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)
} }
} }
} }
......
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