Commit d1632543 authored by Don Gagne's avatar Don Gagne

QGCViewPanel no longer needs to be in component

parent c0a45987
......@@ -34,208 +34,195 @@ import QGroundControl.Controllers 1.0
import QGroundControl.ScreenTools 1.0
QGCView {
id: rootQGCView
viewComponent: view
id: rootQGCView
viewPanel: panel
Component {
id: view
QGCViewPanel {
id: panel
Connections {
target: rootQGCView
QGCPalette { id: qgcPal; colorGroupEnabled: panel.enabled }
onCompleted: {
if (controller.showCustomConfigPanel) {
panel.showDialog(customConfigDialogComponent, "Custom Airframe Config", 50, StandardButton.Reset)
}
}
}
AirframeComponentController {
id: controller
factPanel: panel
AirframeComponentController {
id: controller
factPanel: panel
Component.onCompleted: {
if (controller.showCustomConfigPanel) {
showDialog(customConfigDialogComponent, "Custom Airframe Config", 50, StandardButton.Reset)
}
}
}
Component {
id: customConfigDialogComponent
Component {
id: customConfigDialogComponent
QGCViewMessage {
id: customConfigDialog
QGCViewMessage {
id: customConfigDialog
message: "Your vehicle is using a custom airframe configuration. " +
"This configuration can only be modified through the Parameter Editor.\n\n" +
"If you want to Reset your airframe configuration and select a standard configuration, click 'Reset' above."
message: "Your vehicle is using a custom airframe configuration. " +
"This configuration can only be modified through the Parameter Editor.\n\n" +
"If you want to Reset your airframe configuration and select a standard configuration, click 'Reset' above."
property Fact sys_autostart: controller.getParameterFact(-1, "SYS_AUTOSTART")
property Fact sys_autostart: controller.getParameterFact(-1, "SYS_AUTOSTART")
function accept() {
sys_autostart.value = 0
customConfigDialog.hideDialog()
}
}
function accept() {
sys_autostart.value = 0
customConfigDialog.hideDialog()
}
}
}
Component {
id: applyRestartDialogComponent
QGCViewDialog {
id: applyRestartDialog
Component {
id: applyRestartDialogComponent
function accept() {
controller.changeAutostart()
applyRestartDialog.hideDialog()
}
QGCViewDialog {
id: applyRestartDialog
QGCLabel {
anchors.fill: parent
wrapMode: Text.WordWrap
text: "Clicking Apply will save the changes you have made to your aiframe configuration. " +
"Your vehicle will also be rebooted in order to complete the process. " +
"After your vehicle reboots, you can reconnect it to QGroundControl."
}
}
function accept() {
controller.changeAutostart()
applyRestartDialog.hideDialog()
}
Rectangle {
anchors.fill: parent
QGCPalette { id: qgcPal; colorGroupEnabled: true }
color: qgcPal.window
QGCLabel {
id: header
width: parent.width
font.pointSize: ScreenTools.largeFontPointSize
text: "AIRFRAME CONFIG"
}
Item {
id: headingSpacer
anchors.top: header.bottom
height: 20
width: 20
QGCLabel {
anchors.fill: parent
wrapMode: Text.WordWrap
text: "Clicking Apply will save the changes you have made to your aiframe configuration. " +
"Your vehicle will also be rebooted in order to complete the process. " +
"After your vehicle reboots, you can reconnect it to QGroundControl."
}
}
}
QGCViewPanel {
id: panel
anchors.fill: parent
QGCLabel {
id: header
width: parent.width
font.pointSize: ScreenTools.largeFontPointSize
text: "AIRFRAME CONFIG"
}
Item {
id: headingSpacer
anchors.top: header.bottom
height: 20
width: 20
}
QGCLabel {
anchors.top: headingSpacer.bottom
width: parent.width - applyButton.width - 5
text: "Select your airframe type and specific vehicle bellow. Click 'Apply and Restart' when ready and your vehicle will be disconnected, rebooted to the new settings and re-connected."
wrapMode: Text.WordWrap
}
QGCButton {
id: applyButton
anchors.top: headingSpacer.bottom
anchors.right: parent.right
text: "Apply and Restart"
onClicked: showDialog(applyRestartDialogComponent, "Apply and Restart", 50, StandardButton.Apply | StandardButton.Cancel)
}
Item {
id: lastSpacer
anchors.top: applyButton.bottom
height: 20
width: 10
}
ScrollView {
id: scroll
anchors.top: lastSpacer.bottom
anchors.bottom: parent.bottom
width: parent.width
horizontalScrollBarPolicy: Qt.ScrollBarAlwaysOff
Flow {
width: scroll.width
spacing: 10
ExclusiveGroup {
id: airframeTypeExclusive
}
QGCLabel {
anchors.top: headingSpacer.bottom
width: parent.width - applyButton.width - 5
text: "Select your airframe type and specific vehicle bellow. Click 'Apply and Restart' when ready and your vehicle will be disconnected, rebooted to the new settings and re-connected."
wrapMode: Text.WordWrap
}
Repeater {
model: controller.airframeTypes
QGCButton {
id: applyButton
anchors.top: headingSpacer.bottom
anchors.right: parent.right
text: "Apply and Restart"
// Outer summary item rectangle
Rectangle {
readonly property real titleHeight: 30
readonly property real innerMargin: 10
onClicked: panel.showDialog(applyRestartDialogComponent, "Apply and Restart", 50, StandardButton.Apply | StandardButton.Cancel)
}
width: 250
height: 200
color: qgcPal.windowShade
Item {
id: lastSpacer
anchors.top: applyButton.bottom
height: 20
width: 10
}
Rectangle {
id: title
width: parent.width
height: parent.titleHeight
color: qgcPal.windowShadeDark
ScrollView {
id: scroll
anchors.top: lastSpacer.bottom
anchors.bottom: parent.bottom
width: parent.width
horizontalScrollBarPolicy: Qt.ScrollBarAlwaysOff
Text {
anchors.fill: parent
Flow {
width: scroll.width
spacing: 10
color: qgcPal.buttonText
font.pixelSize: 12
text: modelData.name
ExclusiveGroup {
id: airframeTypeExclusive
verticalAlignment: TextEdit.AlignVCenter
horizontalAlignment: TextEdit.AlignHCenter
}
}
Repeater {
model: controller.airframeTypes
// Outer summary item rectangle
Rectangle {
readonly property real titleHeight: 30
readonly property real innerMargin: 10
width: 250
height: 200
color: qgcPal.windowShade
Rectangle {
id: title
width: parent.width
height: parent.titleHeight
color: qgcPal.windowShadeDark
Text {
anchors.fill: parent
Image {
id: image
x: innerMargin
width: parent.width - (innerMargin * 2)
height: parent.height - title.height - combo.height - (innerMargin * 3)
anchors.topMargin: innerMargin
anchors.top: title.bottom
color: qgcPal.buttonText
font.pixelSize: 12
text: modelData.name
source: modelData.imageResource
fillMode: Image.PreserveAspectFit
smooth: true
verticalAlignment: TextEdit.AlignVCenter
horizontalAlignment: TextEdit.AlignHCenter
}
}
Image {
id: image
x: innerMargin
width: parent.width - (innerMargin * 2)
height: parent.height - title.height - combo.height - (innerMargin * 3)
anchors.topMargin: innerMargin
anchors.top: title.bottom
source: modelData.imageResource
fillMode: Image.PreserveAspectFit
smooth: true
}
}
QGCCheckBox {
id: airframeCheckBox
anchors.bottom: image.bottom
anchors.right: image.right
checked: modelData.name == controller.currentAirframeType
exclusiveGroup: airframeTypeExclusive
QGCCheckBox {
id: airframeCheckBox
anchors.bottom: image.bottom
anchors.right: image.right
checked: modelData.name == controller.currentAirframeType
exclusiveGroup: airframeTypeExclusive
onCheckedChanged: {
if (checked && combo.currentIndex != -1) {
controller.autostartId = modelData.airframes[combo.currentIndex].autostartId
}
}
onCheckedChanged: {
if (checked && combo.currentIndex != -1) {
controller.autostartId = modelData.airframes[combo.currentIndex].autostartId
}
}
}
QGCComboBox {
id: combo
objectName: modelData.airframeType + "ComboBox"
x: innerMargin
anchors.topMargin: innerMargin
anchors.top: image.bottom
width: parent.width - (innerMargin * 2)
model: modelData.airframes
currentIndex: (modelData.name == controller.currentAirframeType) ? controller.currentVehicleIndex : 0
onCurrentIndexChanged: {
if (airframeCheckBox.checked) {
controller.autostartId = modelData.airframes[currentIndex].autostartId
}
}
QGCComboBox {
id: combo
objectName: modelData.airframeType + "ComboBox"
x: innerMargin
anchors.topMargin: innerMargin
anchors.top: image.bottom
width: parent.width - (innerMargin * 2)
model: modelData.airframes
currentIndex: (modelData.name == controller.currentAirframeType) ? controller.currentVehicleIndex : 0
onCurrentIndexChanged: {
if (airframeCheckBox.checked) {
controller.autostartId = modelData.airframes[currentIndex].autostartId
}
}
} // Repeater - summary boxes
} // Flow - summary boxes
} // Scroll View - summary boxes
} // Rectangle - background
} // FactPanel
} // Component - View
}
\ No newline at end of file
}
}
} // Repeater - summary boxes
} // Flow - summary boxes
} // Scroll View - summary boxes
} // QGCViewPanel
} // QGCView
\ No newline at end of file
......@@ -37,309 +37,295 @@ import QGroundControl.ScreenTools 1.0
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
property int firstColumnWidth: 220
property int textEditWidth: 80
property Fact battNumCells: controller.getParameterFact(-1, "BAT_N_CELLS")
property Fact battHighVolt: controller.getParameterFact(-1, "BAT_V_CHARGED")
property Fact battLowVolt: controller.getParameterFact(-1, "BAT_V_EMPTY")
property Fact battVoltLoadDrop: controller.getParameterFact(-1, "BAT_V_LOAD_DROP")
property alias battHigh: battHighRow
property alias battLow: battLowRow
function getBatteryImage()
{
switch(battNumCells.value) {
case 1: return "/qml/PowerComponentBattery_01cell.svg";
case 2: return "/qml/PowerComponentBattery_02cell.svg"
case 3: return "/qml/PowerComponentBattery_03cell.svg"
case 4: return "/qml/PowerComponentBattery_04cell.svg"
case 5: return "/qml/PowerComponentBattery_05cell.svg"
case 6: return "/qml/PowerComponentBattery_06cell.svg"
default: return "/qml/PowerComponentBattery_01cell.svg";
}
}
function drawArrowhead(ctx, x, y, radians)
{
ctx.save();
ctx.beginPath();
ctx.translate(x,y);
ctx.rotate(radians);
ctx.moveTo(0,0);
ctx.lineTo(5,10);
ctx.lineTo(-5,10);
ctx.closePath();
ctx.restore();
ctx.fill();
id: rootQGCView
viewPanel: panel
property int firstColumnWidth: 220
property int textEditWidth: 80
property Fact battNumCells: controller.getParameterFact(-1, "BAT_N_CELLS")
property Fact battHighVolt: controller.getParameterFact(-1, "BAT_V_CHARGED")
property Fact battLowVolt: controller.getParameterFact(-1, "BAT_V_EMPTY")
property Fact battVoltLoadDrop: controller.getParameterFact(-1, "BAT_V_LOAD_DROP")
property alias battHigh: battHighRow
property alias battLow: battLowRow
function getBatteryImage()
{
switch(battNumCells.value) {
case 1: return "/qml/PowerComponentBattery_01cell.svg";
case 2: return "/qml/PowerComponentBattery_02cell.svg"
case 3: return "/qml/PowerComponentBattery_03cell.svg"
case 4: return "/qml/PowerComponentBattery_04cell.svg"
case 5: return "/qml/PowerComponentBattery_05cell.svg"
case 6: return "/qml/PowerComponentBattery_06cell.svg"
default: return "/qml/PowerComponentBattery_01cell.svg";
}
}
function drawArrowhead(ctx, x, y, radians)
{
ctx.save();
ctx.beginPath();
ctx.translate(x,y);
ctx.rotate(radians);
ctx.moveTo(0,0);
ctx.lineTo(5,10);
ctx.lineTo(-5,10);
ctx.closePath();
ctx.restore();
ctx.fill();
}
function drawLineWithArrow(ctx, x1, y1, x2, y2)
{
ctx.beginPath();
ctx.moveTo(x1, y1);
ctx.lineTo(x2, y2);
ctx.stroke();
var rd = Math.atan((y2 - y1) / (x2 - x1));
rd += ((x2 > x1) ? 90 : -90) * Math.PI/180;
drawArrowhead(ctx, x2, y2, rd);
}
PowerComponentController {
id: controller
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)
onBatteryConnected: showMessage("ESC Calibration", "Performing calibration. This will take a few seconds..", 0)
onCalibrationFailed: showMessage("ESC Calibration failed", errorMessage, StandardButton.Ok)
onCalibrationSuccess: showMessage("ESC Calibration", "Calibration complete. You can disconnect your battery now if you like.", StandardButton.Ok)
onConnectBattery: showMessage("ESC Calibration", "WARNING: Props must be removed from vehicle prior to performing ESC calibration.\n\nConnect the battery now and calibration will begin.", 0)
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
QGCLabel {
text: "POWER CONFIG"
font.pointSize: ScreenTools.largeFontPointSize
}
function drawLineWithArrow(ctx, x1, y1, x2, y2)
{
ctx.beginPath();
ctx.moveTo(x1, y1);
ctx.lineTo(x2, y2);
ctx.stroke();
var rd = Math.atan((y2 - y1) / (x2 - x1));
rd += ((x2 > x1) ? 90 : -90) * Math.PI/180;
drawArrowhead(ctx, x2, y2, rd);
QGCLabel {
text: "Battery"
font.pointSize: ScreenTools.mediumFontPointSize
}
PowerComponentController {
id: controller
factPanel: viewPanel
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)
onBatteryConnected: showMessage("ESC Calibration", "Performing calibration. This will take a few seconds..", 0)
onCalibrationFailed: showMessage("ESC Calibration failed", errorMessage, StandardButton.Ok)
onCalibrationSuccess: showMessage("ESC Calibration", "Calibration complete. You can disconnect your battery now if you like.", StandardButton.Ok)
onConnectBattery: showMessage("ESC Calibration", "WARNING: Props must be removed from vehicle prior to performing ESC calibration.\n\nConnect the battery now and calibration will begin.", 0)
onDisconnectBattery: showMessage("ESC Calibration failed", "You must disconnect the battery prior to performing ESC Calibration. Disconnect your battery and try again.", StandardButton.Ok)
}
Column {
anchors.fill: parent
spacing: 10
QGCLabel {
text: "POWER CONFIG"
font.pointSize: ScreenTools.largeFontPointSize
}
QGCLabel {
text: "Battery"
color: palette.text
font.pointSize: ScreenTools.mediumFontPointSize
}
Rectangle {
width: parent.width
height: 120
color: palette.windowShade
Rectangle {
width: parent.width
height: 120
color: palette.windowShade
Column {
id: batteryColumn
spacing: 10
anchors.verticalCenter: parent.verticalCenter
x: (parent.x + 20)
Column {
id: batteryColumn
Row {
spacing: 10
anchors.verticalCenter: parent.verticalCenter
x: (parent.x + 20)
Row {
Column {
id: voltageCol
spacing: 10
Column {
id: voltageCol
Row {
spacing: 10
Row {
spacing: 10
QGCLabel { text: "Number of Cells (in Series)"; width: firstColumnWidth; anchors.baseline: cellsField.baseline}
FactTextField {
id: cellsField
width: textEditWidth
fact: battNumCells
showUnits: true
}
}
Row {
id: battHighRow
spacing: 10
QGCLabel { text: "Full Voltage (per cell)"; width: firstColumnWidth; anchors.baseline: battHighField.baseline}
FactTextField {
id: battHighField
width: textEditWidth
fact: battHighVolt
showUnits: true
}
QGCLabel { text: "Number of Cells (in Series)"; width: firstColumnWidth; anchors.baseline: cellsField.baseline}
FactTextField {
id: cellsField
width: textEditWidth
fact: battNumCells
showUnits: true
}
Row {
id: battLowRow
spacing: 10
QGCLabel { text: "Empty Voltage (per cell)"; width: firstColumnWidth; anchors.baseline: battLowField.baseline}
FactTextField {
id: battLowField
width: textEditWidth
fact: battLowVolt
showUnits: true
}
}
Row {
id: battHighRow
spacing: 10
QGCLabel { text: "Full Voltage (per cell)"; width: firstColumnWidth; anchors.baseline: battHighField.baseline}
FactTextField {
id: battHighField
width: textEditWidth
fact: battHighVolt
showUnits: true
}
}
Canvas {
id: arrows
height: voltageCol.height
width: 40
antialiasing: true
Connections {
target: ScreenTools
onRepaintRequestedChanged: {
arrows.requestPaint();
}
Row {
id: battLowRow
spacing: 10
QGCLabel { text: "Empty Voltage (per cell)"; width: firstColumnWidth; anchors.baseline: battLowField.baseline}
FactTextField {
id: battLowField
width: textEditWidth
fact: battLowVolt
showUnits: true
}
onPaint: {
var y0 = voltageCol.mapFromItem(battHigh, 0, battHigh.height / 2).y;
var y1 = voltageCol.mapFromItem(battLow, 0, battLow.height / 2).y;
var context = getContext("2d");
context.reset();
context.strokeStyle = palette.button;
context.fillStyle = palette.button;
drawLineWithArrow(context, 0, y0, width, height * 0.25);
drawLineWithArrow(context, 0, y1, width, height * 0.85);
}
}
Canvas {
id: arrows
height: voltageCol.height
width: 40
antialiasing: true
Connections {
target: ScreenTools
onRepaintRequestedChanged: {
arrows.requestPaint();
}
}
QGCColoredImage {
height: voltageCol.height
width: voltageCol.height * 0.75
source: getBatteryImage();
fillMode: Image.PreserveAspectFit
smooth: true
color: palette.button
cache: false
onPaint: {
var y0 = voltageCol.mapFromItem(battHigh, 0, battHigh.height / 2).y;
var y1 = voltageCol.mapFromItem(battLow, 0, battLow.height / 2).y;
var context = getContext("2d");
context.reset();
context.strokeStyle = palette.button;
context.fillStyle = palette.button;
drawLineWithArrow(context, 0, y0, width, height * 0.25);
drawLineWithArrow(context, 0, y1, width, height * 0.85);
}
}
QGCColoredImage {
height: voltageCol.height
width: voltageCol.height * 0.75
source: getBatteryImage();
fillMode: Image.PreserveAspectFit
smooth: true
color: palette.button
cache: false
}
Item { width: 20; height: 1; }
Column {
spacing: 10
anchors.verticalCenter: parent.verticalCenter
Row {
spacing: 10
QGCLabel {
text: "Battery Max:"
width: 80
}
QGCLabel {
text: (battNumCells.value * battHighVolt.value).toFixed(1) + ' V'
}
}
Item { width: 20; height: 1; }
Column {
Row {
spacing: 10
anchors.verticalCenter: parent.verticalCenter
Row {
spacing: 10
QGCLabel {
text: "Battery Max:"
color: palette.text
width: 80
}
QGCLabel {
text: (battNumCells.value * battHighVolt.value).toFixed(1) + ' V'
color: palette.text
}
QGCLabel {
text: "Battery Min:"
width: 80
}
Row {
spacing: 10
QGCLabel {
text: "Battery Min:"
color: palette.text
width: 80
}
QGCLabel {
text: (battNumCells.value * battLowVolt.value).toFixed(1) + ' V'
color: palette.text
}
QGCLabel {
text: (battNumCells.value * battLowVolt.value).toFixed(1) + ' V'
}
}
}
}
}
}
QGCLabel {
text: "ESC Calibration"
font.pointSize: ScreenTools.mediumFontPointSize
}
QGCLabel {
text: "ESC Calibration"
font.pointSize: ScreenTools.mediumFontPointSize
}
Rectangle {
width: parent.width
height: 80
color: palette.windowShade
Rectangle {
width: parent.width
height: 80
color: palette.windowShade
Column {
anchors.margins: 10
anchors.fill: parent
spacing: 10
Column {
anchors.margins: 10
anchors.fill: parent
spacing: 10
QGCLabel {
text: "WARNING: Props must be removed from vehicle prior to performing ESC calibration."
}
QGCLabel {
text: "WARNING: Props must be removed from vehicle prior to performing ESC calibration."
}
QGCButton {
text: "Calibrate"
onClicked: controller.calibrateEsc()
}
QGCButton {
text: "Calibrate"
onClicked: controller.calibrateEsc()
}
}
}
/*
* This is disabled for now
Row {
width: parent.width
spacing: 30
visible: showAdvanced.checked
Column {
spacing: 10
width: (parent.width / 2) - 5
QGCLabel {
text: "Propeller Function"
color: palette.text
font.pointSize: ScreenTools.fontPointFactor * (20);
}
Rectangle {
width: parent.width
height: 160
color: palette.windowShade
}
/*
* This is disabled for now
Row {
width: parent.width
spacing: 30
visible: showAdvanced.checked
Column {
spacing: 10
width: (parent.width / 2) - 5
QGCLabel {
text: "Propeller Function"
font.pointSize: ScreenTools.fontPointFactor * (20);
}
Column {
spacing: 10
width: (parent.width / 2) - 5
QGCLabel {
text: "Magnetometer Distortion"
color: palette.text
font.pointSize: ScreenTools.fontPointFactor * (20);
}
Rectangle {
width: parent.width
height: 160
color: palette.windowShade
}
Rectangle {
width: parent.width
height: 160
color: palette.windowShade
}
}
*/
Column {
spacing: 10
width: (parent.width / 2) - 5
QGCLabel {
text: "Magnetometer Distortion"
font.pointSize: ScreenTools.fontPointFactor * (20);
}
Rectangle {
width: parent.width
height: 160
color: palette.windowShade
}
//-- Advanced Settings
QGCCheckBox {
id: showAdvanced
text: "Show Advanced Settings"
}
QGCLabel {
text: "Advanced Power Settings"
color: palette.text
font.pointSize: ScreenTools.fontPointFactor * (20);
visible: showAdvanced.checked
}
Rectangle {
width: parent.width
height: 40
color: palette.windowShade
visible: showAdvanced.checked
Column {
id: advBatteryColumn
}
*/
//-- Advanced Settings
QGCCheckBox {
id: showAdvanced
text: "Show Advanced Settings"
}
QGCLabel {
text: "Advanced Power Settings"
font.pointSize: ScreenTools.fontPointFactor * (20);
visible: showAdvanced.checked
}
Rectangle {
width: parent.width
height: 40
color: palette.windowShade
visible: showAdvanced.checked
Column {
id: advBatteryColumn
spacing: 10
anchors.verticalCenter: parent.verticalCenter
x: (parent.x + 20)
Row {
spacing: 10
anchors.verticalCenter: parent.verticalCenter
x: (parent.x + 20)
Row {
spacing: 10
QGCLabel { text: "Voltage Drop on Full Load (per cell)"; width: firstColumnWidth; anchors.baseline: battDropField.baseline}
FactTextField {
id: battDropField
width: textEditWidth
fact: battVoltLoadDrop
showUnits: true
}
QGCLabel { text: "Voltage Drop on Full Load (per cell)"; width: firstColumnWidth; anchors.baseline: battDropField.baseline}
FactTextField {
id: battDropField
width: textEditWidth
fact: battVoltLoadDrop
showUnits: true
}
}
}
} // Column
} // QGCViewPanel
} // Component - view
}
} // Column
} // QGCViewPanel
}
......@@ -37,474 +37,483 @@ import QGroundControl.ScreenTools 1.0
import QGroundControl.Controllers 1.0
QGCView {
id: rootQGCView
viewComponent: view
Component {
id: view
id: rootQGCView
viewPanel: panel
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: panel
statusText: statusText
cancelButton: cancelButton
nextButton: nextButton
skipButton: skipButton
onChannelCountChanged: updateChannelCount()
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
QGCViewMessage {
message: controller.channelCount == 0 ? "Please turn on transmitter." : controller.minChannelCount + " channels or more are needed to fly."
}
}
QGCViewPanel {
id: viewPanel
Component {
id: spektrumBindDialogComponent
QGCPalette { id: qgcPal; colorGroupEnabled: enabled }
QGCViewDialog {
readonly property real labelToMonitorMargin: defaultTextWidth * 3
function accept() {
controller.spektrumBindMode(radioGroup.current.bindMode)
hideDialog()
}
function updateChannelCount()
{
if (controller.channelCount < controller.minChannelCount) {
showDialog(channelCountDialogComponent, "Radio Config", 50, 0)
} else {
function reject() {
hideDialog()
}
}
RadioComponentController {
id: controller
factPanel: viewPanel
statusText: statusText
cancelButton: cancelButton
nextButton: nextButton
skipButton: skipButton
Column {
anchors.fill: parent
spacing: 5
onChannelCountChanged: updateChannelCount()
}
QGCLabel {
width: parent.width
wrapMode: Text.WordWrap
text: "Click Ok to place your Spektrum receiver in the bind mode. Select the specific receiver type below:"
}
Connections {
target: rootQGCView
ExclusiveGroup { id: radioGroup }
onCompleted: {
controller.start()
updateChannelCount()
}
}
QGCRadioButton {
exclusiveGroup: radioGroup
text: "DSM2 Mode"
Component {
id: channelCountDialogComponent
property int bindMode: RadioComponentController.DSM2
}
QGCViewMessage {
message: controller.channelCount == 0 ? "Please turn on transmitter." : controller.minChannelCount + " channels or more are needed to fly."
}
}
QGCRadioButton {
exclusiveGroup: radioGroup
text: "DSMX (7 channels or less)"
Component {
id: spektrumBindDialogComponent
property int bindMode: RadioComponentController.DSMX7
}
QGCViewDialog {
QGCRadioButton {
exclusiveGroup: radioGroup
checked: true
text: "DSMX (8 channels or more)"
function accept() {
controller.spektrumBindMode(radioGroup.current.bindMode)
hideDialog()
property int bindMode: RadioComponentController.DSMX8
}
}
}
} // Component - spektrumBindDialogComponent
function reject() {
hideDialog()
}
// Live channel monitor control component
Component {
id: channelMonitorDisplayComponent
Column {
anchors.fill: parent
spacing: 5
Item {
property int rcValue: 1500
QGCLabel {
width: parent.width
wrapMode: Text.WordWrap
text: "Click Ok to place your Spektrum receiver in the bind mode. Select the specific receiver type below:"
}
ExclusiveGroup { id: radioGroup }
property int __lastRcValue: 1500
readonly property int __rcValueMaxJitter: 2
property color __barColor: qgcPal.windowShade
QGCRadioButton {
exclusiveGroup: radioGroup
text: "DSM2 Mode"
// Bar
Rectangle {
id: bar
anchors.verticalCenter: parent.verticalCenter
width: parent.width
height: parent.height / 2
color: __barColor
}
property int bindMode: RadioComponentController.DSM2
}
// Center point
Rectangle {
anchors.horizontalCenter: parent.horizontalCenter
width: defaultTextWidth / 2
height: parent.height
color: qgcPal.window
}
QGCRadioButton {
exclusiveGroup: radioGroup
text: "DSMX (7 channels or less)"
// Indicator
Rectangle {
anchors.verticalCenter: parent.verticalCenter
width: parent.height * 0.75
height: width
x: ((Math.abs((rcValue - 1000) - (reversed ? 1000 : 0)) / 1000) * parent.width) - (width / 2)
radius: width / 2
color: qgcPal.text
visible: mapped
}
property int bindMode: RadioComponentController.DSMX7
}
QGCLabel {
anchors.fill: parent
horizontalAlignment: Text.AlignHCenter
verticalAlignment: Text.AlignVCenter
text: "Not Mapped"
visible: !mapped
}
QGCRadioButton {
exclusiveGroup: radioGroup
checked: true
text: "DSMX (8 channels or more)"
ColorAnimation {
id: barAnimation
target: bar
property: "color"
from: "yellow"
to: __barColor
duration: 1500
}
property int bindMode: RadioComponentController.DSMX8
}
onRcValueChanged: {
if (Math.abs(rcValue - __lastRcValue) > __rcValueMaxJitter) {
__lastRcValue = rcValue
barAnimation.restart()
}
}
} // Component - spektrumBindDialogComponent
// Live channel monitor control component
Component {
id: channelMonitorDisplayComponent
/*
// rcValue debugger
QGCLabel {
anchors.fill: parent
text: rcValue
}
*/
}
} // Component - channelMonitorDisplayComponent
// Main view Qml starts here
QGCLabel {
id: header
font.pointSize: ScreenTools.largeFontPointSize
text: "RADIO CONFIG"
}
Item {
id: spacer
anchors.top: header.bottom
width: parent.width
height: 10
}
// Left side column
Column {
id: leftColumn
anchors.top: spacer.bottom
anchors.left: parent.left
anchors.right: columnSpacer.left
spacing: 10
Row {
spacing: 10
Item {
property int rcValue: 1500
QGCLabel {
anchors.baseline: bindButton.baseline
text: "Place Spektrum satellite receiver in bind mode:"
}
QGCButton {
id: bindButton
text: "Spektrum Bind"
property int __lastRcValue: 1500
readonly property int __rcValueMaxJitter: 2
property color __barColor: qgcPal.windowShade
onClicked: showDialog(spektrumBindDialogComponent, "Radio Config", 50, StandardButton.Ok | StandardButton.Cancel)
}
}
// Bar
Rectangle {
id: bar
anchors.verticalCenter: parent.verticalCenter
width: parent.width
height: parent.height / 2
color: __barColor
}
// Attitude Controls
Column {
width: parent.width
spacing: 5
// Center point
Rectangle {
anchors.horizontalCenter: parent.horizontalCenter
width: defaultTextWidth / 2
height: parent.height
color: qgcPal.window
}
QGCLabel { text: "Attitude Controls" }
// Indicator
Rectangle {
anchors.verticalCenter: parent.verticalCenter
width: parent.height * 0.75
height: width
x: ((Math.abs((rcValue - 1000) - (reversed ? 1000 : 0)) / 1000) * parent.width) - (width / 2)
radius: width / 2
color: qgcPal.text
visible: mapped
}
Item {
width: parent.width
height: defaultTextHeight * 2
QGCLabel {
anchors.fill: parent
horizontalAlignment: Text.AlignHCenter
verticalAlignment: Text.AlignVCenter
text: "Not Mapped"
visible: !mapped
id: rollLabel
width: defaultTextWidth * 10
text: "Roll"
}
ColorAnimation {
id: barAnimation
target: bar
property: "color"
from: "yellow"
to: __barColor
duration: 1500
Loader {
id: rollLoader
anchors.left: rollLabel.right
anchors.right: parent.right
height: rootQGCView.defaultTextHeight
width: 100
sourceComponent: channelMonitorDisplayComponent
property real defaultTextWidth: rootQGCView.defaultTextWidth
property bool mapped: controller.rollChannelMapped
property bool reversed: controller.rollChannelReversed
}
onRcValueChanged: {
if (Math.abs(rcValue - __lastRcValue) > __rcValueMaxJitter) {
__lastRcValue = rcValue
barAnimation.restart()
}
}
Connections {
target: controller
/*
// rcValue debugger
QGCLabel {
anchors.fill: parent
text: rcValue
onRollChannelRCValueChanged: rollLoader.item.rcValue = rcValue
}
*/
}
} // Component - channelMonitorDisplayComponent
// Main view Qml starts here
QGCLabel {
id: header
font.pointSize: ScreenTools.largeFontPointSize
text: "RADIO CONFIG"
}
Item {
id: spacer
anchors.top: header.bottom
width: parent.width
height: 10
}
// Left side column
Column {
id: leftColumn
anchors.top: spacer.bottom
anchors.left: parent.left
anchors.right: columnSpacer.left
spacing: 10
Row {
spacing: 10
Item {
width: parent.width
height: defaultTextHeight * 2
QGCLabel {
anchors.baseline: bindButton.baseline
text: "Place Spektrum satellite receiver in bind mode:"
id: pitchLabel
width: defaultTextWidth * 10
text: "Pitch"
}
QGCButton {
id: bindButton
text: "Spektrum Bind"
onClicked: showDialog(spektrumBindDialogComponent, "Radio Config", 50, StandardButton.Ok | StandardButton.Cancel)
Loader {
id: pitchLoader
anchors.left: pitchLabel.right
anchors.right: parent.right
height: rootQGCView.defaultTextHeight
width: 100
sourceComponent: channelMonitorDisplayComponent
property real defaultTextWidth: rootQGCView.defaultTextWidth
property bool mapped: controller.pitchChannelMapped
property bool reversed: controller.pitchChannelReversed
}
}
// Attitude Controls
Column {
width: parent.width
spacing: 5
QGCLabel { text: "Attitude Controls" }
Item {
width: parent.width
height: defaultTextHeight * 2
QGCLabel {
id: rollLabel
width: defaultTextWidth * 10
text: "Roll"
}
Loader {
id: rollLoader
anchors.left: rollLabel.right
anchors.right: parent.right
height: rootQGCView.defaultTextHeight
width: 100
sourceComponent: channelMonitorDisplayComponent
property real defaultTextWidth: rootQGCView.defaultTextWidth
property bool mapped: controller.rollChannelMapped
property bool reversed: controller.rollChannelReversed
}
Connections {
target: controller
Connections {
target: controller
onRollChannelRCValueChanged: rollLoader.item.rcValue = rcValue
}
onPitchChannelRCValueChanged: pitchLoader.item.rcValue = rcValue
}
}
Item {
width: parent.width
height: defaultTextHeight * 2
QGCLabel {
id: pitchLabel
width: defaultTextWidth * 10
text: "Pitch"
}
Loader {
id: pitchLoader
anchors.left: pitchLabel.right
anchors.right: parent.right
height: rootQGCView.defaultTextHeight
width: 100
sourceComponent: channelMonitorDisplayComponent
property real defaultTextWidth: rootQGCView.defaultTextWidth
property bool mapped: controller.pitchChannelMapped
property bool reversed: controller.pitchChannelReversed
}
Connections {
target: controller
Item {
width: parent.width
height: defaultTextHeight * 2
onPitchChannelRCValueChanged: pitchLoader.item.rcValue = rcValue
}
QGCLabel {
id: yawLabel
width: defaultTextWidth * 10
text: "Yaw"
}
Item {
width: parent.width
height: defaultTextHeight * 2
Loader {
id: yawLoader
anchors.left: yawLabel.right
anchors.right: parent.right
height: rootQGCView.defaultTextHeight
width: 100
sourceComponent: channelMonitorDisplayComponent
property real defaultTextWidth: rootQGCView.defaultTextWidth
property bool mapped: controller.yawChannelMapped
property bool reversed: controller.yawChannelReversed
}
QGCLabel {
id: yawLabel
width: defaultTextWidth * 10
text: "Yaw"
}
Connections {
target: controller
Loader {
id: yawLoader
anchors.left: yawLabel.right
anchors.right: parent.right
height: rootQGCView.defaultTextHeight
width: 100
sourceComponent: channelMonitorDisplayComponent
property real defaultTextWidth: rootQGCView.defaultTextWidth
property bool mapped: controller.yawChannelMapped
property bool reversed: controller.yawChannelReversed
}
onYawChannelRCValueChanged: yawLoader.item.rcValue = rcValue
}
}
Connections {
target: controller
Item {
width: parent.width
height: defaultTextHeight * 2
onYawChannelRCValueChanged: yawLoader.item.rcValue = rcValue
}
QGCLabel {
id: throttleLabel
width: defaultTextWidth * 10
text: "Throttle"
}
Item {
width: parent.width
height: defaultTextHeight * 2
Loader {
id: throttleLoader
anchors.left: throttleLabel.right
anchors.right: parent.right
height: rootQGCView.defaultTextHeight
width: 100
sourceComponent: channelMonitorDisplayComponent
property real defaultTextWidth: rootQGCView.defaultTextWidth
property bool mapped: controller.throttleChannelMapped
property bool reversed: controller.throttleChannelReversed
}
QGCLabel {
id: throttleLabel
width: defaultTextWidth * 10
text: "Throttle"
}
Connections {
target: controller
Loader {
id: throttleLoader
anchors.left: throttleLabel.right
anchors.right: parent.right
height: rootQGCView.defaultTextHeight
width: 100
sourceComponent: channelMonitorDisplayComponent
property real defaultTextWidth: rootQGCView.defaultTextWidth
property bool mapped: controller.throttleChannelMapped
property bool reversed: controller.throttleChannelReversed
}
onThrottleChannelRCValueChanged: throttleLoader.item.rcValue = rcValue
}
}
} // Column - Attitude Control labels
Connections {
target: controller
// Command Buttons
Row {
spacing: 10
onThrottleChannelRCValueChanged: throttleLoader.item.rcValue = rcValue
}
}
} // Column - Attitude Control labels
QGCButton {
id: skipButton
text: "Skip"
// Command Buttons
Row {
spacing: 10
onClicked: controller.skipButtonClicked()
}
QGCButton {
id: skipButton
text: "Skip"
QGCButton {
id: cancelButton
text: "Cancel"
onClicked: controller.skipButtonClicked()
}
onClicked: controller.cancelButtonClicked()
}
QGCButton {
id: cancelButton
text: "Cancel"
QGCButton {
id: nextButton
primary: true
text: "Calibrate"
onClicked: controller.cancelButtonClicked()
}
onClicked: controller.nextButtonClicked()
}
} // Row - Buttons
QGCButton {
id: nextButton
primary: true
text: "Calibrate"
// Status Text
QGCLabel {
id: statusText
width: parent.width
wrapMode: Text.WordWrap
}
} // Column - Left Column
Item {
id: columnSpacer
anchors.right: rightColumn.left
width: 20
}
// Right side column
Column {
id: rightColumn
anchors.top: spacer.bottom
anchors.right: parent.right
width: defaultTextWidth * 35
spacing: 10
Row {
spacing: 10
ExclusiveGroup { id: modeGroup }
QGCRadioButton {
exclusiveGroup: modeGroup
text: "Mode 1"
checked: controller.transmitterMode == 1
onClicked: controller.transmitterMode = 1
}
onClicked: controller.nextButtonClicked()
}
} // Row - Buttons
QGCRadioButton {
exclusiveGroup: modeGroup
text: "Mode 2"
checked: controller.transmitterMode == 2
// Status Text
QGCLabel {
id: statusText
width: parent.width
wrapMode: Text.WordWrap
onClicked: controller.transmitterMode = 2
}
} // Column - Left Column
}
Item {
id: columnSpacer
anchors.right: rightColumn.left
width: 20
Image {
width: parent.width
height: defaultTextHeight * 15
fillMode: Image.PreserveAspectFit
smooth: true
source: controller.imageHelp
}
// Right side column
// Channel monitor
Column {
id: rightColumn
anchors.top: spacer.bottom
anchors.right: parent.right
width: defaultTextWidth * 35
spacing: 10
width: parent.width
spacing: 5
Row {
spacing: 10
ExclusiveGroup { id: modeGroup }
QGCLabel { text: "Channel Monitor" }
QGCRadioButton {
exclusiveGroup: modeGroup
text: "Mode 1"
checked: controller.transmitterMode == 1
onClicked: controller.transmitterMode = 1
}
Connections {
target: controller
QGCRadioButton {
exclusiveGroup: modeGroup
text: "Mode 2"
checked: controller.transmitterMode == 2
onClicked: controller.transmitterMode = 2
onChannelRCValueChanged: {
if (channelMonitorRepeater.itemAt(channel)) {
channelMonitorRepeater.itemAt(channel).loader.item.rcValue = rcValue
}
}
}
Image {
width: parent.width
height: defaultTextHeight * 15
fillMode: Image.PreserveAspectFit
smooth: true
source: controller.imageHelp
}
Repeater {
id: channelMonitorRepeater
model: controller.channelCount
width: parent.width
// Channel monitor
Column {
width: parent.width
spacing: 5
QGCLabel { text: "Channel Monitor" }
Row {
spacing: 5
Connections {
target: controller
// Need this to get to loader from Connections above
property Item loader: theLoader
onChannelRCValueChanged: {
if (channelMonitorRepeater.itemAt(channel)) {
channelMonitorRepeater.itemAt(channel).loader.item.rcValue = rcValue
}
QGCLabel {
id: channelLabel
text: modelData + 1
}
}
Repeater {
id: channelMonitorRepeater
model: controller.channelCount
width: parent.width
Row {
spacing: 5
// Need this to get to loader from Connections above
property Item loader: theLoader
QGCLabel {
id: channelLabel
text: modelData + 1
}
Loader {
id: theLoader
anchors.verticalCenter: channelLabel.verticalCenter
height: rootQGCView.defaultTextHeight
width: 200
sourceComponent: channelMonitorDisplayComponent
property real defaultTextWidth: rootQGCView.defaultTextWidth
property bool mapped: true
readonly property bool reversed: false
}
Loader {
id: theLoader
anchors.verticalCenter: channelLabel.verticalCenter
height: rootQGCView.defaultTextHeight
width: 200
sourceComponent: channelMonitorDisplayComponent
property real defaultTextWidth: rootQGCView.defaultTextWidth
property bool mapped: true
readonly property bool reversed: false
}
}
} // Column - Channel Monitor
} // Column - Right Column
} // QGCViewPanel
} // Component - view
}
} // Column - Channel Monitor
} // Column - Right Column
} // QGCViewPanel
}
......@@ -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
......
......@@ -34,8 +34,8 @@ import QGroundControl.ScreenTools 1.0
import QGroundControl.Controllers 1.0
QGCView {
id: rootQGCView
viewComponent: view
id: rootQGCView
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.
......@@ -113,8 +113,17 @@ QGCView {
property bool showCompass2Rot: cal_mag2_id.value > 0 && cal_mag2_rot.value >= 0
SensorsComponentController {
id: controller
factPanel: rootQGCView.viewPanel
id: controller
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,337 +271,310 @@ 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 }
QGCViewPanel {
id: panel
anchors.fill: parent
Column {
anchors.fill: parent
QGCLabel {
text: "SENSORS CONFIG"
font.pointSize: ScreenTools.largeFontPointSize
}
color: qgcPal.window
Column {
anchors.fill: parent
QGCLabel {
text: "SENSORS CONFIG"
font.pointSize: ScreenTools.largeFontPointSize
}
Item { height: 20; width: 10 } // spacer
Item { height: 20; width: 10 } // spacer
Row {
readonly property int buttonWidth: 120
Row {
readonly property int buttonWidth: 120
spacing: 20
spacing: 20
QGCLabel { text: "Calibrate:"; anchors.baseline: compassButton.baseline }
QGCLabel { text: "Calibrate:"; anchors.baseline: compassButton.baseline }
IndicatorButton {
id: compassButton
width: parent.buttonWidth
text: "Compass"
indicatorGreen: cal_mag0_id.value != 0
IndicatorButton {
id: compassButton
width: parent.buttonWidth
text: "Compass"
indicatorGreen: cal_mag0_id.value != 0
onClicked: {
preCalibrationDialogType = "compass"
preCalibrationDialogHelp = compassHelp
showDialog(preCalibrationDialogComponent, "Calibrate Compass", 50, StandardButton.Cancel | StandardButton.Ok)
}
onClicked: {
preCalibrationDialogType = "compass"
preCalibrationDialogHelp = compassHelp
showDialog(preCalibrationDialogComponent, "Calibrate Compass", 50, StandardButton.Cancel | StandardButton.Ok)
}
}
IndicatorButton {
id: gyroButton
width: parent.buttonWidth
text: "Gyroscope"
indicatorGreen: cal_gyro0_id.value != 0
IndicatorButton {
id: gyroButton
width: parent.buttonWidth
text: "Gyroscope"
indicatorGreen: cal_gyro0_id.value != 0
onClicked: {
preCalibrationDialogType = "gyro"
preCalibrationDialogHelp = gyroHelp
showDialog(preCalibrationDialogComponent, "Calibrate Gyro", 50, StandardButton.Cancel | StandardButton.Ok)
}
onClicked: {
preCalibrationDialogType = "gyro"
preCalibrationDialogHelp = gyroHelp
showDialog(preCalibrationDialogComponent, "Calibrate Gyro", 50, StandardButton.Cancel | StandardButton.Ok)
}
}
IndicatorButton {
id: accelButton
width: parent.buttonWidth
text: "Accelerometer"
indicatorGreen: cal_acc0_id.value != 0
IndicatorButton {
id: accelButton
width: parent.buttonWidth
text: "Accelerometer"
indicatorGreen: cal_acc0_id.value != 0
onClicked: {
preCalibrationDialogType = "accel"
preCalibrationDialogHelp = accelHelp
showDialog(preCalibrationDialogComponent, "Calibrate Accelerometer", 50, StandardButton.Cancel | StandardButton.Ok)
}
onClicked: {
preCalibrationDialogType = "accel"
preCalibrationDialogHelp = accelHelp
showDialog(preCalibrationDialogComponent, "Calibrate Accelerometer", 50, StandardButton.Cancel | StandardButton.Ok)
}
}
IndicatorButton {
id: levelButton
width: parent.buttonWidth
text: "Level Horizon"
indicatorGreen: sens_board_x_off.value != 0
enabled: cal_acc0_id.value != 0 && cal_gyro0_id.value != 0
onClicked: {
preCalibrationDialogType = "level"
preCalibrationDialogHelp = levelHelp
showDialog(preCalibrationDialogComponent, "Level Horizon", 50, StandardButton.Cancel | StandardButton.Ok)
}
IndicatorButton {
id: levelButton
width: parent.buttonWidth
text: "Level Horizon"
indicatorGreen: sens_board_x_off.value != 0
enabled: cal_acc0_id.value != 0 && cal_gyro0_id.value != 0
onClicked: {
preCalibrationDialogType = "level"
preCalibrationDialogHelp = levelHelp
showDialog(preCalibrationDialogComponent, "Level Horizon", 50, StandardButton.Cancel | StandardButton.Ok)
}
}
IndicatorButton {
id: airspeedButton
width: parent.buttonWidth
text: "Airspeed"
visible: controller.fixedWing
indicatorGreen: sens_dpres_off.value != 0
onClicked: {
preCalibrationDialogType = "airspeed"
preCalibrationDialogHelp = airspeedHelp
showDialog(preCalibrationDialogComponent, "Calibrate Airspeed", 50, StandardButton.Cancel | StandardButton.Ok)
}
IndicatorButton {
id: airspeedButton
width: parent.buttonWidth
text: "Airspeed"
visible: controller.fixedWing
indicatorGreen: sens_dpres_off.value != 0
onClicked: {
preCalibrationDialogType = "airspeed"
preCalibrationDialogHelp = airspeedHelp
showDialog(preCalibrationDialogComponent, "Calibrate Airspeed", 50, StandardButton.Cancel | StandardButton.Ok)
}
}
QGCButton {
id: cancelButton
text: "Cancel"
enabled: false
onClicked: controller.cancelCalibration()
}
QGCButton {
id: cancelButton
text: "Cancel"
enabled: false
onClicked: controller.cancelCalibration()
}
}
Item { height: 20; width: 10 } // spacer
Item { height: 20; width: 10 } // spacer
ProgressBar {
id: progressBar
width: parent.width - rotationColumnWidth
}
ProgressBar {
id: progressBar
width: parent.width - rotationColumnWidth
}
Item { height: 10; width: 10 } // spacer
Item { height: 10; width: 10 } // spacer
Item {
readonly property int calibrationAreaHeight: 300
property int calDisplayAreaWidth: parent.width - rotationColumnWidth
Item {
readonly property int calibrationAreaHeight: 300
property int calDisplayAreaWidth: parent.width - rotationColumnWidth
width: parent.width
height: parent.height - y
width: parent.width
height: parent.height - y
TextArea {
id: statusTextArea
width: parent.calDisplayAreaWidth
height: parent.height
readOnly: true
frameVisible: false
text: statusTextAreaDefaultText
TextArea {
id: statusTextArea
width: parent.calDisplayAreaWidth
height: parent.height
readOnly: true
frameVisible: false
text: statusTextAreaDefaultText
style: TextAreaStyle {
textColor: qgcPal.text
backgroundColor: qgcPal.windowShade
style: TextAreaStyle {
textColor: qgcPal.text
backgroundColor: qgcPal.windowShade
}
}
Rectangle {
id: orientationCalArea
width: parent.calDisplayAreaWidth
height: parent.height
visible: controller.showOrientationCalArea
color: qgcPal.windowShade
QGCLabel {
id: orientationCalAreaHelpText
width: parent.width
wrapMode: Text.WordWrap
font.pointSize: ScreenTools.fontPointFactor * (22);
anchors.top: orientationCalArea.top
anchors.left: orientationCalArea.left
anchors.topMargin: 15
anchors.leftMargin: 15
anchors.rightMargin: 15
anchors.bottomMargin: 15
}
Flow {
anchors.top: orientationCalAreaHelpText.bottom
anchors.left: orientationCalAreaHelpText.left
anchors.topMargin: 15
width: parent.width
height: parent.height - orientationCalAreaHelpText.implicitHeight
spacing: 5
VehicleRotationCal {
visible: controller.orientationCalDownSideVisible
calValid: controller.orientationCalDownSideDone
calInProgress: controller.orientationCalDownSideInProgress
calInProgressText: controller.orientationCalDownSideRotate ? "Rotate" : "Hold Still"
imageSource: controller.orientationCalDownSideRotate ? "qrc:///qml/VehicleDownRotate.png" : "qrc:///qml/VehicleDown.png"
}
VehicleRotationCal {
visible: controller.orientationCalUpsideDownSideVisible
calValid: controller.orientationCalUpsideDownSideDone
calInProgress: controller.orientationCalUpsideDownSideInProgress
calInProgressText: "Hold Still"
imageSource: "qrc:///qml/VehicleUpsideDown.png"
}
VehicleRotationCal {
visible: controller.orientationCalNoseDownSideVisible
calValid: controller.orientationCalNoseDownSideDone
calInProgress: controller.orientationCalNoseDownSideInProgress
calInProgressText: controller.orientationCalNoseDownSideRotate ? "Rotate" : "Hold Still"
imageSource: controller.orientationCalNoseDownSideRotate ? "qrc:///qml/VehicleNoseDownRotate.png" : "qrc:///qml/VehicleNoseDown.png"
}
VehicleRotationCal {
visible: controller.orientationCalTailDownSideVisible
calValid: controller.orientationCalTailDownSideDone
calInProgress: controller.orientationCalTailDownSideInProgress
calInProgressText: "Hold Still"
imageSource: "qrc:///qml/VehicleTailDown.png"
}
VehicleRotationCal {
visible: controller.orientationCalLeftSideVisible
calValid: controller.orientationCalLeftSideDone
calInProgress: controller.orientationCalLeftSideInProgress
calInProgressText: controller.orientationCalLeftSideRotate ? "Rotate" : "Hold Still"
imageSource: controller.orientationCalLeftSideRotate ? "qrc:///qml/VehicleLeftRotate.png" : "qrc:///qml/VehicleLeft.png"
}
VehicleRotationCal {
visible: controller.orientationCalRightSideVisible
calValid: controller.orientationCalRightSideDone
calInProgress: controller.orientationCalRightSideInProgress
calInProgressText: "Hold Still"
imageSource: "qrc:///qml/VehicleRight.png"
}
}
}
Column {
anchors.left: orientationCalArea.right
anchors.leftMargin: 5
spacing: 20
x: parent.width - rotationColumnWidth
Rectangle {
id: orientationCalArea
width: parent.calDisplayAreaWidth
height: parent.height
visible: controller.showOrientationCalArea
color: qgcPal.windowShade
Column {
spacing: 5
QGCLabel {
id: orientationCalAreaHelpText
width: parent.width
wrapMode: Text.WordWrap
font.pointSize: ScreenTools.fontPointFactor * (22);
anchors.top: orientationCalArea.top
anchors.left: orientationCalArea.left
anchors.topMargin: 15
anchors.leftMargin: 15
anchors.rightMargin: 15
anchors.bottomMargin: 15
font.pointSize: sideBarH1PointSize
text: "Autopilot Orientation"
}
Flow {
anchors.top: orientationCalAreaHelpText.bottom
anchors.left: orientationCalAreaHelpText.left
anchors.topMargin: 15
QGCLabel {
width: parent.width
height: parent.height - orientationCalAreaHelpText.implicitHeight
spacing: 5
VehicleRotationCal {
visible: controller.orientationCalDownSideVisible
calValid: controller.orientationCalDownSideDone
calInProgress: controller.orientationCalDownSideInProgress
calInProgressText: controller.orientationCalDownSideRotate ? "Rotate" : "Hold Still"
imageSource: controller.orientationCalDownSideRotate ? "qrc:///qml/VehicleDownRotate.png" : "qrc:///qml/VehicleDown.png"
}
VehicleRotationCal {
visible: controller.orientationCalUpsideDownSideVisible
calValid: controller.orientationCalUpsideDownSideDone
calInProgress: controller.orientationCalUpsideDownSideInProgress
calInProgressText: "Hold Still"
imageSource: "qrc:///qml/VehicleUpsideDown.png"
}
VehicleRotationCal {
visible: controller.orientationCalNoseDownSideVisible
calValid: controller.orientationCalNoseDownSideDone
calInProgress: controller.orientationCalNoseDownSideInProgress
calInProgressText: controller.orientationCalNoseDownSideRotate ? "Rotate" : "Hold Still"
imageSource: controller.orientationCalNoseDownSideRotate ? "qrc:///qml/VehicleNoseDownRotate.png" : "qrc:///qml/VehicleNoseDown.png"
}
VehicleRotationCal {
visible: controller.orientationCalTailDownSideVisible
calValid: controller.orientationCalTailDownSideDone
calInProgress: controller.orientationCalTailDownSideInProgress
calInProgressText: "Hold Still"
imageSource: "qrc:///qml/VehicleTailDown.png"
}
VehicleRotationCal {
visible: controller.orientationCalLeftSideVisible
calValid: controller.orientationCalLeftSideDone
calInProgress: controller.orientationCalLeftSideInProgress
calInProgressText: controller.orientationCalLeftSideRotate ? "Rotate" : "Hold Still"
imageSource: controller.orientationCalLeftSideRotate ? "qrc:///qml/VehicleLeftRotate.png" : "qrc:///qml/VehicleLeft.png"
}
VehicleRotationCal {
visible: controller.orientationCalRightSideVisible
calValid: controller.orientationCalRightSideDone
calInProgress: controller.orientationCalRightSideInProgress
calInProgressText: "Hold Still"
imageSource: "qrc:///qml/VehicleRight.png"
}
wrapMode: Text.WordWrap
text: boardRotationText
}
FactComboBox {
id: boardRotationCombo
width: rotationColumnWidth;
model: rotations
fact: sens_board_rot
}
}
Column {
anchors.left: orientationCalArea.right
anchors.leftMargin: 5
spacing: 20
x: parent.width - rotationColumnWidth
spacing: 5
Column {
spacing: 5
// Compass 0 rotation
Component {
id: compass0ComponentLabel2
QGCLabel {
font.pointSize: sideBarH1PointSize
text: "Autopilot Orientation"
}
QGCLabel {
width: parent.width
wrapMode: Text.WordWrap
text: boardRotationText
text: "External Compass Orientation"
}
}
Component {
id: compass0ComponentCombo2
FactComboBox {
id: boardRotationCombo
width: rotationColumnWidth;
id: compass0RotationCombo
width: rotationColumnWidth
model: rotations
fact: sens_board_rot
fact: cal_mag0_rot
}
}
Loader { sourceComponent: showCompass0Rot ? compass0ComponentLabel2 : null }
Loader { sourceComponent: showCompass0Rot ? compass0ComponentCombo2 : null }
}
Column {
spacing: 5
// Compass 0 rotation
Component {
id: compass0ComponentLabel2
Column {
spacing: 5
// Compass 1 rotation
Component {
id: compass1ComponentLabel2
QGCLabel {
font.pointSize: sideBarH1PointSize
text: "External Compass Orientation"
}
}
Component {
id: compass0ComponentCombo2
FactComboBox {
id: compass0RotationCombo
width: rotationColumnWidth
model: rotations
fact: cal_mag0_rot
}
QGCLabel {
font.pointSize: sideBarH1PointSize
text: "External Compass 1 Orientation"
}
Loader { sourceComponent: showCompass0Rot ? compass0ComponentLabel2 : null }
Loader { sourceComponent: showCompass0Rot ? compass0ComponentCombo2 : null }
}
Component {
id: compass1ComponentCombo2
Column {
spacing: 5
// Compass 1 rotation
Component {
id: compass1ComponentLabel2
QGCLabel {
font.pointSize: sideBarH1PointSize
text: "External Compass 1 Orientation"
}
}
Component {
id: compass1ComponentCombo2
FactComboBox {
id: compass1RotationCombo
width: rotationColumnWidth
model: rotations
fact: cal_mag1_rot
}
FactComboBox {
id: compass1RotationCombo
width: rotationColumnWidth
model: rotations
fact: cal_mag1_rot
}
Loader { sourceComponent: showCompass1Rot ? compass1ComponentLabel2 : null }
Loader { sourceComponent: showCompass1Rot ? compass1ComponentCombo2 : null }
}
Loader { sourceComponent: showCompass1Rot ? compass1ComponentLabel2 : null }
Loader { sourceComponent: showCompass1Rot ? compass1ComponentCombo2 : null }
}
Column {
spacing: 5
// Compass 2 rotation
Component {
id: compass2ComponentLabel2
Column {
spacing: 5
// Compass 2 rotation
Component {
id: compass2ComponentLabel2
QGCLabel {
font.pointSize: sidebarH1PointSize
text: "Compass 2 Orientation"
}
QGCLabel {
font.pointSize: sidebarH1PointSize
text: "Compass 2 Orientation"
}
Component {
id: compass2ComponentCombo2
FactComboBox {
id: compass1RotationCombo
width: rotationColumnWidth
model: rotations
fact: cal_mag2_rot
}
}
Component {
id: compass2ComponentCombo2
FactComboBox {
id: compass1RotationCombo
width: rotationColumnWidth
model: rotations
fact: cal_mag2_rot
}
Loader { sourceComponent: showCompass2Rot ? compass2ComponentLabel2 : null }
Loader { sourceComponent: showCompass2Rot ? compass2ComponentCombo2 : null }
}
Loader { sourceComponent: showCompass2Rot ? compass2ComponentLabel2 : null }
Loader { sourceComponent: showCompass2Rot ? compass2ComponentCombo2 : null }
}
}
}
} // 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,233 +37,225 @@ 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
QGCViewPanel {
id: panel
ParameterEditorController { id: controller; factPanel: panel }
ParameterEditorController { id: controller; factPanel: panel }
QGCViewPanel {
id: panel
anchors.fill: parent
Component {
id: factRowsComponent
Component {
id: factRowsComponent
Column {
id: factColumn
x: __leftMargin
Column {
id: factColumn
x: __leftMargin
QGCLabel {
height: __textHeight + (ScreenTools.pixelSizeFactor * (9))
text: group
verticalAlignment: Text.AlignVCenter
font.pointSize: ScreenTools.fontPointFactor * (16);
}
QGCLabel {
height: defaultTextHeight + (ScreenTools.pixelSizeFactor * (9))
text: group
verticalAlignment: Text.AlignVCenter
font.pointSize: ScreenTools.fontPointFactor * (16);
}
Rectangle {
width: parent.width
height: 1
color: __qgcPal.text
}
Rectangle {
width: parent.width
height: 1
color: __qgcPal.text
}
Repeater {
model: controller.getFactsForGroup(componentId, group)
Repeater {
model: controller.getFactsForGroup(componentId, group)
Column {
property Fact modelFact: controller.getParameterFact(componentId, modelData)
Column {
property Fact modelFact: controller.getParameterFact(componentId, modelData)
Item {
x: __leftMargin
width: parent.width
height: __textHeight + (ScreenTools.pixelSizeFactor * (9))
Item {
x: __leftMargin
width: parent.width
height: defaultTextHeight + (ScreenTools.pixelSizeFactor * (9))
QGCLabel {
id: nameLabel
width: __textWidth * (__maxParamChars + 1)
height: parent.height
verticalAlignment: Text.AlignVCenter
text: modelFact.name
}
QGCLabel {
id: nameLabel
width: defaultTextWidth * (__maxParamChars + 1)
height: parent.height
verticalAlignment: Text.AlignVCenter
text: modelFact.name
}
QGCLabel {
id: valueLabel
width: __textWidth * 20
height: parent.height
anchors.left: nameLabel.right
verticalAlignment: Text.AlignVCenter
color: modelFact.valueEqualsDefault ? __qgcPal.text : "orange"
text: modelFact.valueString + " " + modelFact.units
}
QGCLabel {
id: valueLabel
width: defaultTextWidth * 20
height: parent.height
anchors.left: nameLabel.right
verticalAlignment: Text.AlignVCenter
color: modelFact.valueEqualsDefault ? __qgcPal.text : "orange"
text: modelFact.valueString + " " + modelFact.units
}
QGCLabel {
height: parent.height
anchors.left: valueLabel.right
verticalAlignment: Text.AlignVCenter
visible: fullMode
text: modelFact.shortDescription
}
QGCLabel {
height: parent.height
anchors.left: valueLabel.right
verticalAlignment: Text.AlignVCenter
visible: fullMode
text: modelFact.shortDescription
}
MouseArea {
anchors.fill: parent
acceptedButtons: Qt.LeftButton
MouseArea {
anchors.fill: parent
acceptedButtons: Qt.LeftButton
onClicked: {
__editorDialogFact = modelFact
panel.showDialog(editorDialogComponent, "Parameter Editor", fullMode ? 50 : -1, StandardButton.Cancel | StandardButton.Save)
}
onClicked: {
__editorDialogFact = modelFact
showDialog(editorDialogComponent, "Parameter Editor", fullMode ? 50 : -1, StandardButton.Cancel | StandardButton.Save)
}
}
}
Rectangle {
x: __leftMargin
width: factColumn.width - __leftMargin - __rightMargin
height: 1
color: __qgcPal.windowShade
}
} // Column - Fact
} // Repeater - Facts
} // Column - Facts
} // Component - factRowsComponent
Rectangle {
x: __leftMargin
width: factColumn.width - __leftMargin - __rightMargin
height: 1
color: __qgcPal.windowShade
}
} // Column - Fact
} // Repeater - Facts
} // Column - Facts
} // Component - factRowsComponent
Column {
anchors.fill: parent
Column {
anchors.fill: parent
Item {
width: parent.width
height: firstButton.height
Item {
width: parent.width
height: firstButton.height
QGCLabel {
font.pointSize: ScreenTools.fontPointFactor * (20)
visible: fullMode
text: "PARAMETER EDITOR"
}
QGCLabel {
font.pointSize: ScreenTools.fontPointFactor * (20)
visible: fullMode
text: "PARAMETER EDITOR"
}
Row {
spacing: 10
layoutDirection: Qt.RightToLeft
width: parent.width
Row {
spacing: 10
layoutDirection: Qt.RightToLeft
width: parent.width
QGCButton {
text: "Clear RC to Param"
onClicked: controller.clearRCToParam()
}
QGCButton {
text: "Save to file"
visible: fullMode
onClicked: controller.saveToFile()
}
QGCButton {
text: "Load from file"
visible: fullMode
onClicked: controller.loadFromFile()
}
QGCButton {
id: firstButton
text: "Refresh"
onClicked: controller.refresh()
}
QGCButton {
text: "Clear RC to Param"
onClicked: controller.clearRCToParam()
}
QGCButton {
text: "Save to file"
visible: fullMode
onClicked: controller.saveToFile()
}
QGCButton {
text: "Load from file"
visible: fullMode
onClicked: controller.loadFromFile()
}
QGCButton {
id: firstButton
text: "Refresh"
onClicked: controller.refresh()
}
}
}
Item {
id: lastSpacer
height: 10
width: 5
}
Item {
id: lastSpacer
height: 10
width: 5
}
Item {
width: parent.width
height: parent.height - (lastSpacer.y + lastSpacer.height)
ScrollView {
id : groupScroll
width: __textWidth * 25
height: parent.height
Column {
Repeater {
model: controller.componentIds
Column {
id: componentColumn
readonly property int componentId: parseInt(modelData)
QGCLabel {
height: contentHeight + (ScreenTools.pixelSizeFactor * (9))
text: "Component #: " + componentId.toString()
verticalAlignment: Text.AlignVCenter
font.pointSize: ScreenTools.fontPointFactor * (16);
}
Repeater {
model: controller.getGroupsForComponent(componentColumn.componentId)
Column {
QGCButton {
x: __leftMargin
width: groupScroll.width - __leftMargin - __rightMargin
text: modelData
onClicked: {
factRowsLoader.sourceComponent = null
factRowsLoader.componentId = componentId
factRowsLoader.group = modelData
factRowsLoader.sourceComponent = factRowsComponent
}
}
Item {
width: parent.width
height: parent.height - (lastSpacer.y + lastSpacer.height)
ScrollView {
id : groupScroll
width: defaultTextWidth * 25
height: parent.height
Column {
Repeater {
model: controller.componentIds
Column {
id: componentColumn
readonly property int componentId: parseInt(modelData)
QGCLabel {
height: contentHeight + (ScreenTools.pixelSizeFactor * (9))
text: "Component #: " + componentId.toString()
verticalAlignment: Text.AlignVCenter
font.pointSize: ScreenTools.fontPointFactor * (16);
}
Repeater {
model: controller.getGroupsForComponent(componentColumn.componentId)
Column {
QGCButton {
x: __leftMargin
width: groupScroll.width - __leftMargin - __rightMargin
text: modelData
Item {
width: 1
height: ScreenTools.pixelSizeFactor * (3)
onClicked: {
factRowsLoader.sourceComponent = null
factRowsLoader.componentId = componentId
factRowsLoader.group = modelData
factRowsLoader.sourceComponent = factRowsComponent
}
} // Column - Group
} // Repeater - Groups
Item {
height: 10
width: 10
}
} // Column - Component
} // Repeater - Components
} // Column - Component
} // ScrollView - Groups
ScrollView {
id: factScrollView
anchors.left: groupScroll.right
anchors.right: parent.right
height: parent.height
Loader {
id: factRowsLoader
width: factScrollView.width
property int componentId: controller.componentIds[0]
property string group: controller.getGroupsForComponent(controller.componentIds[0])[0]
sourceComponent: factRowsComponent
}
} // ScrollView - Facts
} // Item - Group ScrollView + Facts
} // Column - Outer
}
} // Component - Parameter List
}
Item {
width: 1
height: ScreenTools.pixelSizeFactor * (3)
}
} // Column - Group
} // Repeater - Groups
Item {
height: 10
width: 10
}
} // Column - Component
} // Repeater - Components
} // Column - Component
} // ScrollView - Groups
ScrollView {
id: factScrollView
anchors.left: groupScroll.right
anchors.right: parent.right
height: parent.height
Loader {
id: factRowsLoader
width: factScrollView.width
property int componentId: controller.componentIds[0]
property string group: controller.getGroupsForComponent(controller.componentIds[0])[0]
sourceComponent: factRowsComponent
}
} // ScrollView - Facts
} // Item - Group ScrollView + Facts
} // Column - Outer
}
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,161 +34,158 @@ import QGroundControl.Controllers 1.0
import QGroundControl.ScreenTools 1.0
QGCView {
viewComponent: viewPanelComponent
viewPanel: panel
property string firmwareWarningMessage
Component {
id: viewPanelComponent
QGCPalette { id: qgcPal; colorGroupEnabled: panel.enabled }
QGCViewPanel {
id: panel
FirmwareUpgradeController {
id: controller
upgradeButton: upgradeButton
progressBar: progressBar
statusLog: statusTextArea
firmwareType: FirmwareUpgradeController.StableFirmware
QGCPalette { id: qgcPal; colorGroupEnabled: enabled }
onShowMessage: {
showMessage(title, message, StandardButton.Ok)
}
}
FirmwareUpgradeController {
id: controller
upgradeButton: upgradeButton
progressBar: progressBar
statusLog: statusTextArea
firmwareType: FirmwareUpgradeController.StableFirmware
QGCViewPanel {
id: panel
anchors.fill: parent
onShowMessage: {
panel.showMessage(title, message, StandardButton.Ok)
Component {
id: firmwareWarningComponent
QGCViewMessage {
message: firmwareWarningMessage
function accept() {
hideDialog()
controller.doFirmwareUpgrade();
}
}
}
Component {
id: firmwareWarningComponent
Column {
anchors.fill: parent
QGCViewMessage {
message: firmwareWarningMessage
QGCLabel {
text: "FIRMWARE UPDATE"
font.pointSize: ScreenTools.fontPointFactor * (20);
}
function accept() {
panel.hideDialog()
controller.doFirmwareUpgrade();
}
}
Item {
// Just used as a spacer
height: 20
width: 10
}
Column {
anchors.fill: parent
Row {
spacing: 10
QGCLabel {
text: "FIRMWARE UPDATE"
font.pointSize: ScreenTools.fontPointFactor * (20);
ListModel {
id: firmwareItems
ListElement {
text: qsTr("Standard Version (stable)");
firmwareType: FirmwareUpgradeController.StableFirmware
}
ListElement {
text: qsTr("Beta Testing (beta)");
firmwareType: FirmwareUpgradeController.BetaFirmware
}
ListElement {
text: qsTr("Developer Build (master)");
firmwareType: FirmwareUpgradeController.DeveloperFirmware
}
ListElement {
text: qsTr("Custom firmware file...");
firmwareType: FirmwareUpgradeController.CustomFirmware
}
}
Item {
// Just used as a spacer
height: 20
width: 10
QGCComboBox {
id: firmwareCombo
width: 200
height: upgradeButton.height
model: firmwareItems
}
Row {
spacing: 10
ListModel {
id: firmwareItems
ListElement {
text: qsTr("Standard Version (stable)");
firmwareType: FirmwareUpgradeController.StableFirmware
}
ListElement {
text: qsTr("Beta Testing (beta)");
firmwareType: FirmwareUpgradeController.BetaFirmware
}
ListElement {
text: qsTr("Developer Build (master)");
firmwareType: FirmwareUpgradeController.DeveloperFirmware
QGCButton {
id: upgradeButton
text: "UPGRADE"
primary: true
onClicked: {
if (controller.activeQGCConnections()) {
showMessage("Firmware Upgrade",
"There are still vehicles connected to QGroundControl. " +
"You must disconnect all vehicles from QGroundControl prior to Firmware Upgrade.",
StandardButton.Ok)
return
}
ListElement {
text: qsTr("Custom firmware file...");
firmwareType: FirmwareUpgradeController.CustomFirmware
}
}
QGCComboBox {
id: firmwareCombo
width: 200
height: upgradeButton.height
model: firmwareItems
}
if (controller.pluggedInBoard()) {
showMessage("Firmware Upgrade",
"You vehicle is currently connected via USB. " +
"You must unplug your vehicle from USB prior to Firmware Upgrade.",
StandardButton.Ok)
return
}
QGCButton {
id: upgradeButton
text: "UPGRADE"
primary: true
onClicked: {
if (controller.activeQGCConnections()) {
panel.showMessage("Firmware Upgrade",
"There are still vehicles connected to QGroundControl. " +
"You must disconnect all vehicles from QGroundControl prior to Firmware Upgrade.",
StandardButton.Ok)
return
}
if (controller.pluggedInBoard()) {
panel.showMessage("Firmware Upgrade",
"You vehicle is currently connected via USB. " +
"You must unplug your vehicle from USB prior to Firmware Upgrade.",
StandardButton.Ok)
return
}
controller.firmwareType = firmwareItems.get(firmwareCombo.currentIndex).firmwareType
if (controller.firmwareType == 1) {
firmwareWarningMessage = "WARNING: BETA FIRMWARE\n" +
"This firmware version is ONLY intended for beta testers. " +
"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)
} else if (controller.firmwareType == 2) {
firmwareWarningMessage = "WARNING: CONTINUOUS BUILD FIRMWARE\n" +
"This firmware has NOT BEEN FLIGHT TESTED. " +
"It is only intended for DEVELOPERS. " +
"Run bench tests without props first. " +
"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)
} else {
controller.doFirmwareUpgrade();
}
controller.firmwareType = firmwareItems.get(firmwareCombo.currentIndex).firmwareType
if (controller.firmwareType == 1) {
firmwareWarningMessage = "WARNING: BETA FIRMWARE\n" +
"This firmware version is ONLY intended for beta testers. " +
"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"
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. " +
"It is only intended for DEVELOPERS. " +
"Run bench tests without props first. " +
"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"
showDialog(firmwareWarningComponent, "Firmware Upgrade", 50, StandardButton.Cancel | StandardButton.Ok)
} else {
controller.doFirmwareUpgrade();
}
}
}
}
Item {
// Just used as a spacer
height: 20
width: 10
}
Item {
// Just used as a spacer
height: 20
width: 10
}
ProgressBar {
id: progressBar
width: parent.width
}
ProgressBar {
id: progressBar
width: parent.width
}
TextArea {
id: statusTextArea
TextArea {
id: statusTextArea
width: parent.width
height: 300
readOnly: true
frameVisible: false
font.pointSize: ScreenTools.defaultFontPointSize
text: qsTr("Please disconnect all vehicles from QGroundControl before selecting Upgrade.")
width: parent.width
height: 300
readOnly: true
frameVisible: false
font.pointSize: ScreenTools.defaultFontPointSize
text: qsTr("Please disconnect all vehicles from QGroundControl before selecting Upgrade.")
style: TextAreaStyle {
textColor: qgcPal.text
backgroundColor: qgcPal.windowShade
}
style: TextAreaStyle {
textColor: qgcPal.text
backgroundColor: qgcPal.windowShade
}
} // Column
} // QGCViewPanel
} // Component - View Panel
}
} // Column
} // QGCViewPanel
} // 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