Commit e3a27797 authored by Don Gagne's avatar Don Gagne

Merge pull request #1627 from DonLakeFlyer/QGCView

QGCViewPanel no longer needs to be in component
parents c0a45987 d1632543
......@@ -35,29 +35,21 @@ import QGroundControl.ScreenTools 1.0
QGCView {
id: rootQGCView
viewComponent: view
viewPanel: panel
Component {
id: view
QGCPalette { id: qgcPal; colorGroupEnabled: panel.enabled }
QGCViewPanel {
id: panel
Connections {
target: rootQGCView
AirframeComponentController {
id: controller
factPanel: panel
onCompleted: {
Component.onCompleted: {
if (controller.showCustomConfigPanel) {
panel.showDialog(customConfigDialogComponent, "Custom Airframe Config", 50, StandardButton.Reset)
showDialog(customConfigDialogComponent, "Custom Airframe Config", 50, StandardButton.Reset)
}
}
}
AirframeComponentController {
id: controller
factPanel: panel
}
Component {
id: customConfigDialogComponent
......@@ -98,13 +90,10 @@ QGCView {
}
}
Rectangle {
QGCViewPanel {
id: panel
anchors.fill: parent
QGCPalette { id: qgcPal; colorGroupEnabled: true }
color: qgcPal.window
QGCLabel {
id: header
width: parent.width
......@@ -132,7 +121,7 @@ QGCView {
anchors.right: parent.right
text: "Apply and Restart"
onClicked: panel.showDialog(applyRestartDialogComponent, "Apply and Restart", 50, StandardButton.Apply | StandardButton.Cancel)
onClicked: showDialog(applyRestartDialogComponent, "Apply and Restart", 50, StandardButton.Apply | StandardButton.Cancel)
}
Item {
......@@ -235,7 +224,5 @@ QGCView {
} // Repeater - summary boxes
} // Flow - summary boxes
} // Scroll View - summary boxes
} // Rectangle - background
} // FactPanel
} // Component - View
}
\ No newline at end of file
} // QGCViewPanel
} // QGCView
\ No newline at end of file
......@@ -38,19 +38,7 @@ import QGroundControl.Controllers 1.0
QGCView {
id: rootQGCView
viewComponent: view
Component {
id: view
QGCViewPanel {
id: viewPanel
QGCPalette { id: palette; colorGroupEnabled: enabled }
width: 600
height: 600
color: palette.window
viewPanel: panel
property int firstColumnWidth: 220
property int textEditWidth: 80
......@@ -103,7 +91,7 @@ QGCView {
PowerComponentController {
id: controller
factPanel: viewPanel
factPanel: panel
onOldFirmware: showMessage("ESC Calibration", "QGroundControl cannot perform ESC Calibration with this version of firmware. You will need to upgrade to a newer firmware.", StandardButton.Ok)
onNewerFirmware: showMessage("ESC Calibration", "QGroundControl cannot perform ESC Calibration with this version of firmware. You will need to upgrade QGroundControl.", StandardButton.Ok)
......@@ -114,6 +102,13 @@ QGCView {
onDisconnectBattery: showMessage("ESC Calibration failed", "You must disconnect the battery prior to performing ESC Calibration. Disconnect your battery and try again.", StandardButton.Ok)
}
QGCPalette { id: palette; colorGroupEnabled: panel.enabled }
QGCViewPanel {
id: panel
anchors.fill: parent
Column {
anchors.fill: parent
spacing: 10
......@@ -125,7 +120,6 @@ QGCView {
QGCLabel {
text: "Battery"
color: palette.text
font.pointSize: ScreenTools.mediumFontPointSize
}
......@@ -217,24 +211,20 @@ QGCView {
spacing: 10
QGCLabel {
text: "Battery Max:"
color: palette.text
width: 80
}
QGCLabel {
text: (battNumCells.value * battHighVolt.value).toFixed(1) + ' V'
color: palette.text
}
}
Row {
spacing: 10
QGCLabel {
text: "Battery Min:"
color: palette.text
width: 80
}
QGCLabel {
text: (battNumCells.value * battLowVolt.value).toFixed(1) + ' V'
color: palette.text
}
}
}
......@@ -279,7 +269,6 @@ QGCView {
width: (parent.width / 2) - 5
QGCLabel {
text: "Propeller Function"
color: palette.text
font.pointSize: ScreenTools.fontPointFactor * (20);
}
Rectangle {
......@@ -293,7 +282,6 @@ QGCView {
width: (parent.width / 2) - 5
QGCLabel {
text: "Magnetometer Distortion"
color: palette.text
font.pointSize: ScreenTools.fontPointFactor * (20);
}
Rectangle {
......@@ -313,7 +301,6 @@ QGCView {
}
QGCLabel {
text: "Advanced Power Settings"
color: palette.text
font.pointSize: ScreenTools.fontPointFactor * (20);
visible: showAdvanced.checked
}
......@@ -341,5 +328,4 @@ QGCView {
}
} // Column
} // QGCViewPanel
} // Component - view
}
......@@ -38,47 +38,57 @@ import QGroundControl.Controllers 1.0
QGCView {
id: rootQGCView
viewComponent: view
viewPanel: panel
Component {
id: view
QGCViewPanel {
id: viewPanel
QGCPalette { id: qgcPal; colorGroupEnabled: enabled }
QGCPalette { id: qgcPal; colorGroupEnabled: panel.enabled }
readonly property real labelToMonitorMargin: defaultTextWidth * 3
property bool controllerCompleted: false
property bool controllerAndViewReady: false
function updateChannelCount()
{
if (controllerAndViewReady) {
if (controller.channelCount < controller.minChannelCount) {
showDialog(channelCountDialogComponent, "Radio Config", 50, 0)
} else {
hideDialog()
}
}
}
RadioComponentController {
id: controller
factPanel: viewPanel
factPanel: panel
statusText: statusText
cancelButton: cancelButton
nextButton: nextButton
skipButton: skipButton
onChannelCountChanged: updateChannelCount()
}
Connections {
target: rootQGCView
Component.onCompleted: {
controllerCompleted = true
if (rootQGCView.completedSignalled) {
controllerAndViewReady = true
controller.start()
updateChannelCount()
}
}
}
onCompleted: {
if (controllerCompleted) {
controllerAndViewReady = true
controller.start()
updateChannelCount()
}
}
QGCViewPanel {
id: panel
anchors.fill: parent
Component {
id: channelCountDialogComponent
......@@ -506,5 +516,4 @@ QGCView {
} // Column - Channel Monitor
} // Column - Right Column
} // QGCViewPanel
} // Component - view
}
......@@ -34,7 +34,7 @@ import QGroundControl.ScreenTools 1.0
FactPanel {
id: panel
QGCPalette { id: palette; colorGroupEnabled: true }
QGCPalette { id: palette; colorGroupEnabled: enabled }
FactPanelController { id: controller; factPanel: panel }
property int flightLineWidth: 2 // width of lines for flight graphic
......
......@@ -35,7 +35,7 @@ import QGroundControl.Controllers 1.0
QGCView {
id: rootQGCView
viewComponent: view
viewPanel: panel
// Help text which is shown both in the status text area prior to pressing a cal button and in the
// pre-calibration dialog.
......@@ -114,7 +114,16 @@ QGCView {
SensorsComponentController {
id: controller
factPanel: rootQGCView.viewPanel
factPanel: panel
statusLog: statusTextArea
progressBar: progressBar
compassButton: compassButton
gyroButton: gyroButton
accelButton: accelButton
airspeedButton: airspeedButton
levelButton: levelButton
cancelButton: cancelButton
orientationCalAreaHelpText: orientationCalAreaHelpText
onResetStatusTextArea: statusLog.text = statusTextAreaDefaultText
......@@ -133,6 +142,8 @@ QGCView {
}
}
QGCPalette { id: qgcPal; colorGroupEnabled: panel.enabled }
Component {
id: preCalibrationDialogComponent
......@@ -260,35 +271,9 @@ QGCView {
} // QGCViewDialog
} // Component - compassRotationDialogComponent
Component {
id: view
QGCViewPanel {
id: viewPanel
Connections {
target: rootQGCView
onCompleted: {
controller.factPanel = viewPanel
controller.statusLog = statusTextArea
controller.progressBar = progressBar
controller.compassButton = compassButton
controller.gyroButton = gyroButton
controller.accelButton = accelButton
controller.airspeedButton = airspeedButton
controller.levelButton = levelButton
controller.cancelButton = cancelButton
controller.orientationCalAreaHelpText = orientationCalAreaHelpText
}
}
QGCPalette { id: qgcPal; colorGroupEnabled: enabled }
color: qgcPal.window
id: panel
anchors.fill: parent
Column {
anchors.fill: parent
......@@ -591,6 +576,5 @@ QGCView {
}
}
}
} // Rectangle
} // Component - view
}
} // QGCViewPanel
} // QGCView
......@@ -32,9 +32,9 @@ import QGroundControl.Controls 1.0
import QGroundControl.Palette 1.0
Rectangle {
color: __qgcPal.window
color: qgcPal.window
QGCPalette { id: __qgcPal; colorGroupEnabled: true }
QGCPalette { id: qgcPal; colorGroupEnabled: enabled }
property string __missingParams: ""
property string __errorMsg: ""
......@@ -57,7 +57,7 @@ Rectangle {
anchors.fill: parent
z: 9999
visible: false
color: __qgcPal.window
color: qgcPal.window
opacity: 0.85
QGCLabel {
......
......@@ -37,30 +37,23 @@ import QGroundControl.FactSystem 1.0
import QGroundControl.FactControls 1.0
QGCView {
viewComponent: parameterList
viewPanel: panel
/// true: show full information, false: for use in smaller widgets
property bool fullMode: true
QGCPalette { id: __qgcPal; colorGroupEnabled: true }
QGCLabel { id: __textMeasure; text: "X"; visible: false }
property Fact __editorDialogFact: Fact { }
readonly property real __leftMargin: 10
readonly property real __rightMargin: 20
readonly property int __maxParamChars: 16
property real __textHeight: __textMeasure.contentHeight
property real __textWidth: __textMeasure.contentWidth
Component {
id: parameterList
ParameterEditorController { id: controller; factPanel: panel }
QGCViewPanel {
id: panel
ParameterEditorController { id: controller; factPanel: panel }
anchors.fill: parent
Component {
id: factRowsComponent
......@@ -70,7 +63,7 @@ QGCView {
x: __leftMargin
QGCLabel {
height: __textHeight + (ScreenTools.pixelSizeFactor * (9))
height: defaultTextHeight + (ScreenTools.pixelSizeFactor * (9))
text: group
verticalAlignment: Text.AlignVCenter
font.pointSize: ScreenTools.fontPointFactor * (16);
......@@ -91,11 +84,11 @@ QGCView {
Item {
x: __leftMargin
width: parent.width
height: __textHeight + (ScreenTools.pixelSizeFactor * (9))
height: defaultTextHeight + (ScreenTools.pixelSizeFactor * (9))
QGCLabel {
id: nameLabel
width: __textWidth * (__maxParamChars + 1)
width: defaultTextWidth * (__maxParamChars + 1)
height: parent.height
verticalAlignment: Text.AlignVCenter
text: modelFact.name
......@@ -103,7 +96,7 @@ QGCView {
QGCLabel {
id: valueLabel
width: __textWidth * 20
width: defaultTextWidth * 20
height: parent.height
anchors.left: nameLabel.right
verticalAlignment: Text.AlignVCenter
......@@ -125,7 +118,7 @@ QGCView {
onClicked: {
__editorDialogFact = modelFact
panel.showDialog(editorDialogComponent, "Parameter Editor", fullMode ? 50 : -1, StandardButton.Cancel | StandardButton.Save)
showDialog(editorDialogComponent, "Parameter Editor", fullMode ? 50 : -1, StandardButton.Cancel | StandardButton.Save)
}
}
}
......@@ -193,7 +186,7 @@ QGCView {
ScrollView {
id : groupScroll
width: __textWidth * 25
width: defaultTextWidth * 25
height: parent.height
Column {
......@@ -263,7 +256,6 @@ QGCView {
} // Item - Group ScrollView + Facts
} // Column - Outer
}
} // Component - Parameter List
Component {
id: editorDialogComponent
......@@ -281,7 +273,7 @@ QGCView {
}
Column {
spacing: __textHeight
spacing: defaultTextHeight
anchors.left: parent.left
anchors.right: parent.right
......@@ -306,28 +298,28 @@ QGCView {
QGCLabel { text: __editorDialogFact.name }
Row {
spacing: __textWidth
spacing: defaultTextWidth
QGCLabel { text: "Units:" }
QGCLabel { text: __editorDialogFact.units ? __editorDialogFact.units : "none" }
}
Row {
spacing: __textWidth
spacing: defaultTextWidth
QGCLabel { text: "Minimum value:" }
QGCLabel { text: __editorDialogFact.min }
}
Row {
spacing: __textWidth
spacing: defaultTextWidth
QGCLabel { text: "Maxmimum value:" }
QGCLabel { text: __editorDialogFact.max }
}
Row {
spacing: __textWidth
spacing: defaultTextWidth
QGCLabel { text: "Default value:" }
QGCLabel { text: __editorDialogFact.defaultValueAvailable ? __editorDialogFact.defaultValue : "none" }
......@@ -343,7 +335,7 @@ QGCView {
QGCButton {
anchors.rightMargin: __textWidth
anchors.rightMargin: defaultTextWidth
anchors.right: rcButton.left
anchors.bottom: parent.bottom
visible: __editorDialogFact.defaultValueAvailable
......
......@@ -37,10 +37,9 @@ import QGroundControl.FactControls 1.0
FactPanel {
id: __rootItem
property bool __completedSignalled: false
property bool completedSignalled: false
property Component viewComponent
property var viewPanel: __viewPanelLoader.item
property var viewPanel
/// 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
......@@ -115,7 +114,17 @@ FactPanel {
}
}
function __checkForEarlyDialog() {
if (!completedSignalled) {
console.warn("showDialog|Message called before QGCView.completed signalled")
}
}
function showDialog(component, title, charWidth, buttons) {
if (__checkForEarlyDialog()) {
return
}
__stopAllAnimations()
__dialogCharWidth = charWidth
......@@ -124,13 +133,17 @@ FactPanel {
__setupDialogButtons(buttons)
__dialogComponent = component
__viewPanelLoader.enabled = false
viewPanel.enabled = false
__dialogOverlay.visible = true
__animateShowDialog.start()
}
function showMessage(title, message, buttons) {
if (__checkForEarlyDialog()) {
return
}
__stopAllAnimations()
__dialogCharWidth = 50
......@@ -140,14 +153,14 @@ FactPanel {
__setupDialogButtons(buttons)
__dialogComponent = __messageDialog
__viewPanelLoader.enabled = false
viewPanel.enabled = false
__dialogOverlay.visible = true
__animateShowDialog.start()
}
function hideDialog() {
__viewPanelLoader.enabled = true
viewPanel.enabled = true
__animateHideDialog.start()
}
......@@ -171,8 +184,8 @@ FactPanel {
// When we use this control inside a QGCQmlWidgetHolder Component.onCompleted is signalled
// before the width and height are adjusted. So we need to wait for width and heigth to be
// set before we signal our own completed signal.
if (!__completedSignalled && width != 0 && height != 0) {
__completedSignalled = true
if (!completedSignalled && width != 0 && height != 0) {
completedSignalled = true
completed()
}
}
......@@ -181,27 +194,12 @@ FactPanel {
onWidthChanged: __signalCompleted()
onHeightChanged: __signalCompleted()
Connections {
target: __viewPanelLoader.item
onShowDialog: __rootItem.showDialog(component, title, charWidth, buttons)
onShowMessage: __rootItem.showMessage(title, message, buttons)
onHideDialog: __rootItem.hideDialog()
}
Connections {
target: __dialogComponentLoader.item
onHideDialog: __rootItem.hideDialog()
}
Loader {
id: __viewPanelLoader
anchors.fill: parent
focus: true
sourceComponent: viewComponent
}
Item {
id: __dialogOverlay
visible: false
......
......@@ -34,11 +34,5 @@ import QGroundControl.FactSystem 1.0
import QGroundControl.FactControls 1.0
FactPanel {
QGCPalette { id: __qgcPal; colorGroupEnabled: enabled }
signal showDialog(Component component, string title, int charWidth, int buttons)
signal hideDialog
signal showMessage(string title, string message, int buttons)
color: __qgcPal.window
}
......@@ -34,17 +34,11 @@ import QGroundControl.Controllers 1.0
import QGroundControl.ScreenTools 1.0
QGCView {
viewComponent: viewPanelComponent
viewPanel: panel
property string firmwareWarningMessage
Component {
id: viewPanelComponent
QGCViewPanel {
id: panel
QGCPalette { id: qgcPal; colorGroupEnabled: enabled }
QGCPalette { id: qgcPal; colorGroupEnabled: panel.enabled }
FirmwareUpgradeController {
id: controller
......@@ -54,10 +48,14 @@ QGCView {
firmwareType: FirmwareUpgradeController.StableFirmware
onShowMessage: {
panel.showMessage(title, message, StandardButton.Ok)
showMessage(title, message, StandardButton.Ok)
}
}
QGCViewPanel {
id: panel
anchors.fill: parent
Component {
id: firmwareWarningComponent
......@@ -65,7 +63,7 @@ QGCView {
message: firmwareWarningMessage
function accept() {
panel.hideDialog()
hideDialog()
controller.doFirmwareUpgrade();
}
}
......@@ -121,7 +119,7 @@ QGCView {
primary: true
onClicked: {
if (controller.activeQGCConnections()) {
panel.showMessage("Firmware Upgrade",
showMessage("Firmware Upgrade",
"There are still vehicles connected to QGroundControl. " +
"You must disconnect all vehicles from QGroundControl prior to Firmware Upgrade.",
StandardButton.Ok)
......@@ -129,7 +127,7 @@ QGCView {
}
if (controller.pluggedInBoard()) {
panel.showMessage("Firmware Upgrade",
showMessage("Firmware Upgrade",
"You vehicle is currently connected via USB. " +
"You must unplug your vehicle from USB prior to Firmware Upgrade.",
StandardButton.Ok)
......@@ -144,7 +142,7 @@ QGCView {
"Although it has received FLIGHT TESTING, it represents actively changed code. " +
"Do NOT use for normal operation.\n\n" +
"Click Cancel to abort upgrade, Click Ok to Upgrade anwyay"
panel.showDialog(firmwareWarningComponent, "Firmware Upgrade", 50, StandardButton.Cancel | StandardButton.Ok)
showDialog(firmwareWarningComponent, "Firmware Upgrade", 50, StandardButton.Cancel | StandardButton.Ok)
} else if (controller.firmwareType == 2) {
firmwareWarningMessage = "WARNING: CONTINUOUS BUILD FIRMWARE\n" +
"This firmware has NOT BEEN FLIGHT TESTED. " +
......@@ -153,7 +151,7 @@ QGCView {
"Do NOT fly this without addional safety precautions. " +
"Follow the mailing list actively when using it.\n\n" +
"Click Cancel to abort upgrade, Click Ok to Upgrade anwyay"
panel.showDialog(firmwareWarningComponent, "Firmware Upgrade", 50, StandardButton.Cancel | StandardButton.Ok)
showDialog(firmwareWarningComponent, "Firmware Upgrade", 50, StandardButton.Cancel | StandardButton.Ok)
} else {
controller.doFirmwareUpgrade();
}
......@@ -190,5 +188,4 @@ QGCView {
}
} // Column
} // QGCViewPanel
} // Component - View Panel
} // QGCView
\ No newline at end of file
......@@ -167,6 +167,7 @@ void RadioConfigTest::init(void)
// This will instatiate the widget with an active uas with ready parameters
_calWidget = new QGCQmlWidgetHolder();
_calWidget->resize(600, 600);
Q_CHECK_PTR(_calWidget);
_calWidget->setAutoPilot(_autopilot);
_calWidget->setSource(QUrl::fromUserInput("qrc:/qml/RadioComponent.qml"));
......
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