Commit 6d20e85d authored by dogmaphobic's avatar dogmaphobic

Merge remote-tracking branch 'mavlink/master' into toggleMapButtons

* mavlink/master:
  Increase size of controls for tablet
  Make sync warning less tall
  Use Flickable to allow scroll on Tablet
  More header fixes for Mobile build
  More header moves for Mobile build
  More header moves for no widgets in Mobile build
  Move widget controllers out of Mobile build
  QGCUnconnectedInfoWidget needed in Mobile builds
  Remove widget code from Mobile builds
parents f299ff45 76077ac5
...@@ -153,7 +153,6 @@ INCLUDEPATH += \ ...@@ -153,7 +153,6 @@ INCLUDEPATH += \
src/ui/linechart \ src/ui/linechart \
src/ui/map \ src/ui/map \
src/ui/mapdisplay \ src/ui/mapdisplay \
src/ui/mavlink \
src/ui/mission \ src/ui/mission \
src/ui/px4_configuration \ src/ui/px4_configuration \
src/ui/toolbar \ src/ui/toolbar \
...@@ -166,28 +165,18 @@ FORMS += \ ...@@ -166,28 +165,18 @@ FORMS += \
src/ui/Linechart.ui \ src/ui/Linechart.ui \
src/ui/LogReplayLinkConfigurationWidget.ui \ src/ui/LogReplayLinkConfigurationWidget.ui \
src/ui/MainWindow.ui \ src/ui/MainWindow.ui \
src/ui/mavlink/QGCMAVLinkMessageSender.ui \
src/ui/MAVLinkSettingsWidget.ui \ src/ui/MAVLinkSettingsWidget.ui \
src/ui/MultiVehicleDockWidget.ui \
src/ui/QGCCommConfiguration.ui \ src/ui/QGCCommConfiguration.ui \
src/ui/QGCDataPlot2D.ui \ src/ui/QGCDataPlot2D.ui \
src/ui/QGCLinkConfiguration.ui \ src/ui/QGCLinkConfiguration.ui \
src/ui/QGCMapRCToParamDialog.ui \ src/ui/QGCMapRCToParamDialog.ui \
src/ui/QGCMAVLinkInspector.ui \
src/ui/QGCMAVLinkLogPlayer.ui \ src/ui/QGCMAVLinkLogPlayer.ui \
src/ui/QGCPluginHost.ui \ src/ui/QGCPluginHost.ui \
src/ui/QGCTabbedInfoView.ui \
src/ui/QGCTCPLinkConfiguration.ui \ src/ui/QGCTCPLinkConfiguration.ui \
src/ui/QGCUASFileView.ui \
src/ui/QGCUASFileViewMulti.ui \
src/ui/QGCUDPLinkConfiguration.ui \ src/ui/QGCUDPLinkConfiguration.ui \
src/ui/SettingsDialog.ui \ src/ui/SettingsDialog.ui \
src/ui/uas/QGCUnconnectedInfoWidget.ui \ src/ui/uas/QGCUnconnectedInfoWidget.ui \
src/ui/uas/UASMessageView.ui \ src/ui/uas/UASMessageView.ui \
src/ui/uas/UASQuickView.ui \
src/ui/uas/UASQuickViewItemSelect.ui \
src/ui/UASInfo.ui \
src/ui/UASRawStatusView.ui \
!iOSBuild { !iOSBuild {
FORMS += \ FORMS += \
...@@ -196,10 +185,19 @@ FORMS += \ ...@@ -196,10 +185,19 @@ FORMS += \
!MobileBuild { !MobileBuild {
FORMS += \ FORMS += \
src/ui/MultiVehicleDockWidget.ui \
src/ui/QGCHilConfiguration.ui \ src/ui/QGCHilConfiguration.ui \
src/ui/QGCHilFlightGearConfiguration.ui \ src/ui/QGCHilFlightGearConfiguration.ui \
src/ui/QGCHilJSBSimConfiguration.ui \ src/ui/QGCHilJSBSimConfiguration.ui \
src/ui/QGCHilXPlaneConfiguration.ui \ src/ui/QGCHilXPlaneConfiguration.ui \
src/ui/QGCMAVLinkInspector.ui \
src/ui/QGCTabbedInfoView.ui \
src/ui/QGCUASFileView.ui \
src/ui/QGCUASFileViewMulti.ui \
src/ui/uas/UASQuickView.ui \
src/ui/uas/UASQuickViewItemSelect.ui \
src/ui/UASInfo.ui \
src/ui/UASRawStatusView.ui \
} }
HEADERS += \ HEADERS += \
...@@ -232,7 +230,6 @@ HEADERS += \ ...@@ -232,7 +230,6 @@ HEADERS += \
src/QGCApplication.h \ src/QGCApplication.h \
src/QGCComboBox.h \ src/QGCComboBox.h \
src/QGCConfig.h \ src/QGCConfig.h \
src/QGCDockWidget.h \
src/QGCFileDialog.h \ src/QGCFileDialog.h \
src/QGCGeo.h \ src/QGCGeo.h \
src/QGCLoggingCategory.h \ src/QGCLoggingCategory.h \
...@@ -263,37 +260,20 @@ HEADERS += \ ...@@ -263,37 +260,20 @@ HEADERS += \
src/ui/linechart/ScrollZoomer.h \ src/ui/linechart/ScrollZoomer.h \
src/ui/LogReplayLinkConfigurationWidget.h \ src/ui/LogReplayLinkConfigurationWidget.h \
src/ui/MainWindow.h \ src/ui/MainWindow.h \
src/ui/mavlink/QGCMAVLinkMessageSender.h \
src/ui/MAVLinkDecoder.h \ src/ui/MAVLinkDecoder.h \
src/ui/MAVLinkSettingsWidget.h \ src/ui/MAVLinkSettingsWidget.h \
src/ui/MultiVehicleDockWidget.h \
src/ui/QGCCommConfiguration.h \ src/ui/QGCCommConfiguration.h \
src/ui/QGCDataPlot2D.h \ src/ui/QGCDataPlot2D.h \
src/ui/QGCLinkConfiguration.h \ src/ui/QGCLinkConfiguration.h \
src/ui/QGCMainWindowAPConfigurator.h \
src/ui/QGCMapRCToParamDialog.h \ src/ui/QGCMapRCToParamDialog.h \
src/ui/QGCMAVLinkInspector.h \
src/ui/QGCMAVLinkLogPlayer.h \ src/ui/QGCMAVLinkLogPlayer.h \
src/ui/QGCPluginHost.h \ src/ui/QGCPluginHost.h \
src/ui/QGCTabbedInfoView.h \
src/ui/QGCTCPLinkConfiguration.h \ src/ui/QGCTCPLinkConfiguration.h \
src/ui/QGCUASFileView.h \
src/ui/QGCUASFileViewMulti.h \
src/ui/QGCUDPLinkConfiguration.h \ src/ui/QGCUDPLinkConfiguration.h \
src/ui/SettingsDialog.h \ src/ui/SettingsDialog.h \
src/ui/toolbar/MainToolBar.h \ src/ui/toolbar/MainToolBar.h \
src/ui/uas/QGCUnconnectedInfoWidget.h \ src/ui/uas/QGCUnconnectedInfoWidget.h \
src/ui/uas/UASInfoWidget.h \
src/ui/uas/UASMessageView.h \ src/ui/uas/UASMessageView.h \
src/ui/uas/UASQuickView.h \
src/ui/uas/UASQuickViewGaugeItem.h \
src/ui/uas/UASQuickViewItem.h \
src/ui/uas/UASQuickViewItemSelect.h \
src/ui/uas/UASQuickViewTextItem.h \
src/ui/UASRawStatusView.h \
src/ViewWidgets/CustomCommandWidget.h \
src/ViewWidgets/CustomCommandWidgetController.h \
src/ViewWidgets/ViewWidgetController.h \
src/MissionItem.h \ src/MissionItem.h \
src/AutoPilotPlugins/PX4/PX4AirframeLoader.h src/AutoPilotPlugins/PX4/PX4AirframeLoader.h
...@@ -309,13 +289,29 @@ HEADERS += \ ...@@ -309,13 +289,29 @@ HEADERS += \
src/comm/QGCHilLink.h \ src/comm/QGCHilLink.h \
src/comm/QGCJSBSimLink.h \ src/comm/QGCJSBSimLink.h \
src/comm/QGCXPlaneLink.h \ src/comm/QGCXPlaneLink.h \
src/QGCDockWidget.h \
src/ui/CameraView.h \ src/ui/CameraView.h \
src/ui/HILDockWidget.h \ src/ui/HILDockWidget.h \
src/ui/MultiVehicleDockWidget.h \
src/ui/QGCHilConfiguration.h \ src/ui/QGCHilConfiguration.h \
src/ui/QGCHilFlightGearConfiguration.h \ src/ui/QGCHilFlightGearConfiguration.h \
src/ui/QGCHilJSBSimConfiguration.h \ src/ui/QGCHilJSBSimConfiguration.h \
src/ui/QGCHilXPlaneConfiguration.h \ src/ui/QGCHilXPlaneConfiguration.h \
src/ui/QGCMAVLinkInspector.h \
src/ui/QGCTabbedInfoView.h \
src/ui/QGCUASFileView.h \
src/ui/QGCUASFileViewMulti.h \
src/ui/uas/UASInfoWidget.h \
src/ui/uas/UASQuickView.h \
src/ui/uas/UASQuickViewGaugeItem.h \
src/ui/uas/UASQuickViewItem.h \
src/ui/uas/UASQuickViewItemSelect.h \
src/ui/uas/UASQuickViewTextItem.h \
src/ui/UASRawStatusView.h \
src/VehicleSetup/JoystickConfigController.h \ src/VehicleSetup/JoystickConfigController.h \
src/ViewWidgets/CustomCommandWidget.h \
src/ViewWidgets/CustomCommandWidgetController.h \
src/ViewWidgets/ViewWidgetController.h \
} }
SOURCES += \ SOURCES += \
...@@ -344,7 +340,6 @@ SOURCES += \ ...@@ -344,7 +340,6 @@ SOURCES += \
src/QGC.cc \ src/QGC.cc \
src/QGCApplication.cc \ src/QGCApplication.cc \
src/QGCComboBox.cc \ src/QGCComboBox.cc \
src/QGCDockWidget.cc \
src/QGCFileDialog.cc \ src/QGCFileDialog.cc \
src/QGCLoggingCategory.cc \ src/QGCLoggingCategory.cc \
src/QGCPalette.cc \ src/QGCPalette.cc \
...@@ -370,37 +365,20 @@ SOURCES += \ ...@@ -370,37 +365,20 @@ SOURCES += \
src/ui/linechart/ScrollZoomer.cc \ src/ui/linechart/ScrollZoomer.cc \
src/ui/LogReplayLinkConfigurationWidget.cc \ src/ui/LogReplayLinkConfigurationWidget.cc \
src/ui/MainWindow.cc \ src/ui/MainWindow.cc \
src/ui/mavlink/QGCMAVLinkMessageSender.cc \
src/ui/MAVLinkDecoder.cc \ src/ui/MAVLinkDecoder.cc \
src/ui/MAVLinkSettingsWidget.cc \ src/ui/MAVLinkSettingsWidget.cc \
src/ui/MultiVehicleDockWidget.cc \
src/ui/QGCCommConfiguration.cc \ src/ui/QGCCommConfiguration.cc \
src/ui/QGCDataPlot2D.cc \ src/ui/QGCDataPlot2D.cc \
src/ui/QGCLinkConfiguration.cc \ src/ui/QGCLinkConfiguration.cc \
src/ui/QGCMainWindowAPConfigurator.cc \
src/ui/QGCMapRCToParamDialog.cpp \ src/ui/QGCMapRCToParamDialog.cpp \
src/ui/QGCMAVLinkInspector.cc \
src/ui/QGCMAVLinkLogPlayer.cc \ src/ui/QGCMAVLinkLogPlayer.cc \
src/ui/QGCPluginHost.cc \ src/ui/QGCPluginHost.cc \
src/ui/QGCTabbedInfoView.cpp \
src/ui/QGCTCPLinkConfiguration.cc \ src/ui/QGCTCPLinkConfiguration.cc \
src/ui/QGCUASFileView.cc \
src/ui/QGCUASFileViewMulti.cc \
src/ui/QGCUDPLinkConfiguration.cc \ src/ui/QGCUDPLinkConfiguration.cc \
src/ui/SettingsDialog.cc \ src/ui/SettingsDialog.cc \
src/ui/toolbar/MainToolBar.cc \ src/ui/toolbar/MainToolBar.cc \
src/ui/uas/QGCUnconnectedInfoWidget.cc \ src/ui/uas/QGCUnconnectedInfoWidget.cc \
src/ui/uas/UASInfoWidget.cc \
src/ui/uas/UASMessageView.cc \ src/ui/uas/UASMessageView.cc \
src/ui/uas/UASQuickView.cc \
src/ui/uas/UASQuickViewGaugeItem.cc \
src/ui/uas/UASQuickViewItem.cc \
src/ui/uas/UASQuickViewItemSelect.cc \
src/ui/uas/UASQuickViewTextItem.cc \
src/ui/UASRawStatusView.cpp \
src/ViewWidgets/CustomCommandWidget.cc \
src/ViewWidgets/CustomCommandWidgetController.cc \
src/ViewWidgets/ViewWidgetController.cc \
src/MissionItem.cc \ src/MissionItem.cc \
src/AutoPilotPlugins/PX4/PX4AirframeLoader.cc src/AutoPilotPlugins/PX4/PX4AirframeLoader.cc
...@@ -415,13 +393,29 @@ SOURCES += \ ...@@ -415,13 +393,29 @@ SOURCES += \
src/comm/QGCFlightGearLink.cc \ src/comm/QGCFlightGearLink.cc \
src/comm/QGCJSBSimLink.cc \ src/comm/QGCJSBSimLink.cc \
src/comm/QGCXPlaneLink.cc \ src/comm/QGCXPlaneLink.cc \
src/QGCDockWidget.cc \
src/ui/CameraView.cc \ src/ui/CameraView.cc \
src/ui/HILDockWidget.cc \ src/ui/HILDockWidget.cc \
src/ui/MultiVehicleDockWidget.cc \
src/ui/QGCHilConfiguration.cc \ src/ui/QGCHilConfiguration.cc \
src/ui/QGCHilFlightGearConfiguration.cc \ src/ui/QGCHilFlightGearConfiguration.cc \
src/ui/QGCHilJSBSimConfiguration.cc \ src/ui/QGCHilJSBSimConfiguration.cc \
src/ui/QGCHilXPlaneConfiguration.cc \ src/ui/QGCHilXPlaneConfiguration.cc \
src/ui/QGCMAVLinkInspector.cc \
src/ui/QGCTabbedInfoView.cpp \
src/ui/QGCUASFileView.cc \
src/ui/QGCUASFileViewMulti.cc \
src/ui/uas/UASInfoWidget.cc \
src/ui/uas/UASQuickView.cc \
src/ui/uas/UASQuickViewGaugeItem.cc \
src/ui/uas/UASQuickViewItem.cc \
src/ui/uas/UASQuickViewItemSelect.cc \
src/ui/uas/UASQuickViewTextItem.cc \
src/ui/UASRawStatusView.cpp \
src/VehicleSetup/JoystickConfigController.cc \ src/VehicleSetup/JoystickConfigController.cc \
src/ViewWidgets/CustomCommandWidget.cc \
src/ViewWidgets/CustomCommandWidgetController.cc \
src/ViewWidgets/ViewWidgetController.cc \
} }
# #
......
...@@ -29,6 +29,7 @@ ...@@ -29,6 +29,7 @@
#include "QGCMessageBox.h" #include "QGCMessageBox.h"
#include "MainWindow.h" #include "MainWindow.h"
#include "ParameterLoader.h" #include "ParameterLoader.h"
#include "UAS.h"
AutoPilotPlugin::AutoPilotPlugin(Vehicle* vehicle, QObject* parent) AutoPilotPlugin::AutoPilotPlugin(Vehicle* vehicle, QObject* parent)
: QObject(parent) : QObject(parent)
......
...@@ -28,6 +28,7 @@ ...@@ -28,6 +28,7 @@
#include "FlightModesComponentController.h" #include "FlightModesComponentController.h"
#include "AirframeComponentController.h" #include "AirframeComponentController.h"
#include "QGCMessageBox.h" #include "QGCMessageBox.h"
#include "UAS.h"
/// @file /// @file
/// @brief This is the AutoPilotPlugin implementatin for the MAV_AUTOPILOT_PX4 type. /// @brief This is the AutoPilotPlugin implementatin for the MAV_AUTOPILOT_PX4 type.
......
...@@ -104,253 +104,260 @@ QGCView { ...@@ -104,253 +104,260 @@ QGCView {
id: panel id: panel
anchors.fill: parent anchors.fill: parent
Flickable {
anchors.fill: parent
flickableDirection: Flickable.VerticalFlick
contentHeight: innerColumn.height
Column {
id: innerColumn
anchors.left: parent.left
anchors.right: parent.right
spacing: ScreenTools.defaultFontPixelHeight
QGCLabel {
text: "POWER CONFIG"
font.pixelSize: ScreenTools.largeFontPixelSize
}
Column { QGCLabel {
anchors.fill: parent text: "Battery"
spacing: ScreenTools.defaultFontPixelHeight font.pixelSize: ScreenTools.mediumFontPixelSize
}
QGCLabel {
text: "POWER CONFIG"
font.pixelSize: ScreenTools.largeFontPixelSize
}
QGCLabel { Rectangle {
text: "Battery" width: parent.width
font.pixelSize: ScreenTools.mediumFontPixelSize height: voltageCol.height + ScreenTools.defaultFontPixelHeight
} color: palette.windowShade
Rectangle { Column {
width: parent.width id: voltageCol
height: voltageCol.height + ScreenTools.defaultFontPixelHeight anchors.margins: ScreenTools.defaultFontPixelHeight / 2
color: palette.windowShade anchors.left: parent.left
anchors.top: parent.top
spacing: ScreenTools.defaultFontPixelHeight / 2
Column { property real firstColumnWidth: Math.max(Math.max(cellsLabel.contentWidth, battHighLabel.contentWidth), battLowLabel.contentWidth) + ScreenTools.defaultFontPixelWidth
id: voltageCol
anchors.margins: ScreenTools.defaultFontPixelHeight / 2
anchors.left: parent.left
anchors.top: parent.top
spacing: ScreenTools.defaultFontPixelHeight / 2
property real firstColumnWidth: Math.max(Math.max(cellsLabel.contentWidth, battHighLabel.contentWidth), battLowLabel.contentWidth) + ScreenTools.defaultFontPixelWidth Row {
spacing: ScreenTools.defaultFontPixelWidth
Row { QGCLabel {
spacing: ScreenTools.defaultFontPixelWidth id: cellsLabel
text: "Number of Cells (in Series)"
anchors.baseline: cellsField.baseline
}
QGCLabel { FactTextField {
id: cellsLabel id: cellsField
text: "Number of Cells (in Series)" x: voltageCol.firstColumnWidth
anchors.baseline: cellsField.baseline width: textEditWidth
fact: battNumCells
showUnits: true
}
} }
FactTextField { Row {
id: cellsField spacing: ScreenTools.defaultFontPixelWidth
x: voltageCol.firstColumnWidth
width: textEditWidth QGCLabel {
fact: battNumCells id: battHighLabel
showUnits: true text: "Full Voltage (per cell)"
anchors.baseline: battHighField.baseline
}
FactTextField {
id: battHighField
x: voltageCol.firstColumnWidth
width: textEditWidth
fact: battHighVolt
showUnits: true
}
} }
}
Row { Row {
spacing: ScreenTools.defaultFontPixelWidth spacing: ScreenTools.defaultFontPixelWidth
QGCLabel { QGCLabel {
id: battHighLabel id: battLowLabel
text: "Full Voltage (per cell)" text: "Empty Voltage (per cell)"
anchors.baseline: battHighField.baseline anchors.baseline: battLowField.baseline
} }
FactTextField { FactTextField {
id: battHighField id: battLowField
x: voltageCol.firstColumnWidth x: voltageCol.firstColumnWidth
width: textEditWidth width: textEditWidth
fact: battHighVolt fact: battLowVolt
showUnits: true showUnits: true
}
} }
} // Column
QGCColoredImage {
id: batteryImage
anchors.verticalCenter: voltageCol.verticalCenter
x: voltageCol.firstColumnWidth + textEditWidth + (ScreenTools.defaultFontPixelWidth * 3)
width: height * 0.75
height: voltageCol.height
fillMode: Image.PreserveAspectFit
smooth: true
color: palette.button
cache: false
source: getBatteryImage();
} }
Row { Column {
spacing: ScreenTools.defaultFontPixelWidth anchors.leftMargin: ScreenTools.defaultFontPixelWidth * 2
anchors.left: batteryImage.right
anchors.verticalCenter: voltageCol.verticalCenter
spacing: ScreenTools.defaultFontPixelHeight
QGCLabel { QGCLabel {
id: battLowLabel text: "Battery Max: " + (battNumCells.value * battHighVolt.value).toFixed(1) + ' V'
text: "Empty Voltage (per cell)"
anchors.baseline: battLowField.baseline
} }
FactTextField { QGCLabel {
id: battLowField text: "Battery Min: " + (battNumCells.value * battLowVolt.value).toFixed(1) + ' V'
x: voltageCol.firstColumnWidth
width: textEditWidth
fact: battLowVolt
showUnits: true
} }
} }
} // Column } // Rectangle - Battery settings
QGCColoredImage { QGCLabel {
id: batteryImage text: "ESC Calibration"
anchors.verticalCenter: voltageCol.verticalCenter font.pixelSize: ScreenTools.mediumFontPixelSize
x: voltageCol.firstColumnWidth + textEditWidth + (ScreenTools.defaultFontPixelWidth * 3)
width: height * 0.75
height: voltageCol.height
fillMode: Image.PreserveAspectFit
smooth: true
color: palette.button
cache: false
source: getBatteryImage();
} }
Column { Rectangle {
anchors.leftMargin: ScreenTools.defaultFontPixelWidth * 2 width: parent.width
anchors.left: batteryImage.right height: escCalColumn.height + ScreenTools.defaultFontPixelHeight
anchors.verticalCenter: voltageCol.verticalCenter color: palette.windowShade
spacing: ScreenTools.defaultFontPixelHeight
QGCLabel { Column {
text: "Battery Max: " + (battNumCells.value * battHighVolt.value).toFixed(1) + ' V' id : escCalColumn
} anchors.margins: ScreenTools.defaultFontPixelHeight / 2
anchors.left: parent.left
anchors.top: parent.top
spacing: ScreenTools.defaultFontPixelWidth
QGCLabel { QGCLabel {
text: "Battery Min: " + (battNumCells.value * battLowVolt.value).toFixed(1) + ' V' color: palette.warningText
} text: "<font color=\"yellow\">WARNING: Propellers must be removed from vehicle prior to performing ESC calibration.</font>"
} }
} // Rectangle - Battery settings
QGCLabel {
text: "ESC Calibration"
font.pixelSize: ScreenTools.mediumFontPixelSize
}
Rectangle {
width: parent.width
height: escCalColumn.height + ScreenTools.defaultFontPixelHeight
color: palette.windowShade
Column {
id : escCalColumn
anchors.margins: ScreenTools.defaultFontPixelHeight / 2
anchors.left: parent.left
anchors.top: parent.top
spacing: ScreenTools.defaultFontPixelWidth
QGCLabel {
color: palette.warningText
text: "<font color=\"yellow\">WARNING: Propellers must be removed from vehicle prior to performing ESC calibration.</font>"
}
QGCLabel { QGCLabel {
text: "You must use USB connection for this operation." text: "You must use USB connection for this operation."
} }
QGCButton { QGCButton {
text: "Calibrate" text: "Calibrate"
onClicked: controller.calibrateEsc() onClicked: controller.calibrateEsc()
}
} }
} }
}
QGCLabel {
text: "UAVCAN ESC Configuration"
font.pixelSize: ScreenTools.mediumFontPixelSize
}
Rectangle {
width: parent.width
height: uavCanEscCalColumn.height + ScreenTools.defaultFontPixelHeight
color: palette.windowShade
Column {
id: uavCanEscCalColumn
anchors.margins: ScreenTools.defaultFontPixelHeight / 2
anchors.left: parent.left
anchors.top: parent.top
spacing: ScreenTools.defaultFontPixelWidth
QGCLabel {
color: palette.warningText
text: "<font color=\"yellow\">WARNING: Propellers must be removed from vehicle prior to performing UAVCAN ESC configuration.</font>"
}
QGCLabel { QGCLabel {
text: "You must use USB connection for this operation." text: "UAVCAN ESC Configuration"
} font.pixelSize: ScreenTools.mediumFontPixelSize
}
QGCButton { Rectangle {
text: "Start Configuration" width: parent.width
onClicked: controller.busConfigureActuators() height: uavCanEscCalColumn.height + ScreenTools.defaultFontPixelHeight
} color: palette.windowShade
QGCButton { Column {
text: "End Configuration" id: uavCanEscCalColumn
onClicked: controller.StopBusConfigureActuators() anchors.margins: ScreenTools.defaultFontPixelHeight / 2
} anchors.left: parent.left
} anchors.top: parent.top
} spacing: ScreenTools.defaultFontPixelWidth
QGCCheckBox {
id: showAdvanced
text: "Show Advanced Settings"
}
QGCLabel {
text: "Advanced Power Settings"
font.pixelSize: ScreenTools.mediumFontPixelSize
visible: showAdvanced.checked
}
Rectangle {
id: batteryRectangle
width: parent.width
height: advBatteryColumn.height + ScreenTools.defaultFontPixelHeight
color: palette.windowShade
visible: showAdvanced.checked
Column {
id: advBatteryColumn
anchors.margins: ScreenTools.defaultFontPixelHeight / 2
anchors.left: parent.left
anchors.right: parent.right
anchors.top: parent.top
spacing: ScreenTools.defaultFontPixelWidth
Row {
spacing: ScreenTools.defaultFontPixelWidth
QGCLabel { QGCLabel {
text: "Voltage Drop on Full Load (per cell)" color: palette.warningText
anchors.baseline: battDropField.baseline text: "<font color=\"yellow\">WARNING: Propellers must be removed from vehicle prior to performing UAVCAN ESC configuration.</font>"
} }
FactTextField { QGCLabel {
id: battDropField text: "You must use USB connection for this operation."
width: textEditWidth
fact: battVoltLoadDrop
showUnits: true
} }
}
QGCLabel { QGCButton {
width: parent.width text: "Start Configuration"
wrapMode: Text.WordWrap onClicked: controller.busConfigureActuators()
text: "Batteries show less voltage at high throttle. Enter the difference in Volts between idle throttle and full " + }
"throttle, divided by the number of battery cells. Leave at the default if unsure. " +
"<font color=\"yellow\">If this value is set too high, the battery might be deep discharged and damaged.</font>" QGCButton {
text: "End Configuration"
onClicked: controller.StopBusConfigureActuators()
}
} }
}
Row { QGCCheckBox {
spacing: ScreenTools.defaultFontPixelWidth id: showAdvanced
text: "Show Advanced Settings"
}
QGCLabel { QGCLabel {
text: "Compensated Minimum Voltage:" text: "Advanced Power Settings"
font.pixelSize: ScreenTools.mediumFontPixelSize
visible: showAdvanced.checked
}
Rectangle {
id: batteryRectangle
width: parent.width
height: advBatteryColumn.height + ScreenTools.defaultFontPixelHeight
color: palette.windowShade
visible: showAdvanced.checked
Column {
id: advBatteryColumn
anchors.margins: ScreenTools.defaultFontPixelHeight / 2
anchors.left: parent.left
anchors.right: parent.right
anchors.top: parent.top
spacing: ScreenTools.defaultFontPixelWidth
Row {
spacing: ScreenTools.defaultFontPixelWidth
QGCLabel {
text: "Voltage Drop on Full Load (per cell)"
anchors.baseline: battDropField.baseline
}
FactTextField {
id: battDropField
width: textEditWidth
fact: battVoltLoadDrop
showUnits: true
}
} }
QGCLabel { QGCLabel {
text: ((battNumCells.value * battLowVolt.value) - (battNumCells.value * battVoltLoadDrop.value)).toFixed(1) + ' V' width: parent.width
wrapMode: Text.WordWrap
text: "Batteries show less voltage at high throttle. Enter the difference in Volts between idle throttle and full " +
"throttle, divided by the number of battery cells. Leave at the default if unsure. " +
"<font color=\"yellow\">If this value is set too high, the battery might be deep discharged and damaged.</font>"
}
Row {
spacing: ScreenTools.defaultFontPixelWidth
QGCLabel {
text: "Compensated Minimum Voltage:"
}
QGCLabel {
text: ((battNumCells.value * battLowVolt.value) - (battNumCells.value * battVoltLoadDrop.value)).toFixed(1) + ' V'
}
} }
} }
} } // Rectangle - Advanced power settings
} // Rectangle - Advanced power settings } // Column
} // Column } // Flickable
} // QGCViewPanel } // QGCViewPanel
} // QGCView } // QGCView
...@@ -27,6 +27,7 @@ ...@@ -27,6 +27,7 @@
#include "PowerComponentController.h" #include "PowerComponentController.h"
#include "QGCMAVLink.h" #include "QGCMAVLink.h"
#include "QGCMessageBox.h" #include "QGCMessageBox.h"
#include "UAS.h"
#include <QVariant> #include <QVariant>
#include <QQmlProperty> #include <QQmlProperty>
......
...@@ -27,6 +27,7 @@ ...@@ -27,6 +27,7 @@
#include "SensorsComponentController.h" #include "SensorsComponentController.h"
#include "QGCMAVLink.h" #include "QGCMAVLink.h"
#include "QGCMessageBox.h" #include "QGCMessageBox.h"
#include "UAS.h"
#include <QVariant> #include <QVariant>
#include <QQmlProperty> #include <QQmlProperty>
......
...@@ -24,6 +24,7 @@ ...@@ -24,6 +24,7 @@
#include "FactPanelController.h" #include "FactPanelController.h"
#include "MultiVehicleManager.h" #include "MultiVehicleManager.h"
#include "QGCMessageBox.h" #include "QGCMessageBox.h"
#include "UAS.h"
#include <QQmlEngine> #include <QQmlEngine>
......
...@@ -31,6 +31,7 @@ ...@@ -31,6 +31,7 @@
#include "QGCMessageBox.h" #include "QGCMessageBox.h"
#include "UASMessageHandler.h" #include "UASMessageHandler.h"
#include "FirmwarePlugin.h" #include "FirmwarePlugin.h"
#include "UAS.h"
#include <QFile> #include <QFile>
#include <QDebug> #include <QDebug>
......
...@@ -115,7 +115,7 @@ QGCView { ...@@ -115,7 +115,7 @@ QGCView {
Rectangle { Rectangle {
anchors.horizontalCenter: parent.horizontalCenter anchors.horizontalCenter: parent.horizontalCenter
anchors.bottom: parent.bottom anchors.bottom: parent.bottom
width: parent.width / 3 width: parent.width * 0.75
height: syncNeededText.height + (ScreenTools.defaultFontPixelWidth * 2) height: syncNeededText.height + (ScreenTools.defaultFontPixelWidth * 2)
border.width: 1 border.width: 1
border.color: "white" border.color: "white"
......
...@@ -163,9 +163,6 @@ QGCApplication::QGCApplication(int &argc, char* argv[], bool unitTesting) ...@@ -163,9 +163,6 @@ QGCApplication::QGCApplication(int &argc, char* argv[], bool unitTesting)
, _runningUnitTests(unitTesting) , _runningUnitTests(unitTesting)
, _styleIsDark(true) , _styleIsDark(true)
, _fakeMobile(false) , _fakeMobile(false)
#ifdef UNITTEST_BUILD
, _useNewMissionEditor(true) // Unit Tests run new mission editor
#endif
#ifdef QT_DEBUG #ifdef QT_DEBUG
, _testHighDPI(false) , _testHighDPI(false)
#endif #endif
...@@ -337,9 +334,7 @@ void QGCApplication::_initCommon(void) ...@@ -337,9 +334,7 @@ void QGCApplication::_initCommon(void)
qmlRegisterUncreatableType<QGCQGeoCoordinate> ("QGroundControl", 1, 0, "QGCQGeoCoordinate", "Reference only"); qmlRegisterUncreatableType<QGCQGeoCoordinate> ("QGroundControl", 1, 0, "QGCQGeoCoordinate", "Reference only");
qmlRegisterUncreatableType<CoordinateVector> ("QGroundControl", 1, 0, "CoordinateVector", "Reference only"); qmlRegisterUncreatableType<CoordinateVector> ("QGroundControl", 1, 0, "CoordinateVector", "Reference only");
qmlRegisterType<ViewWidgetController> ("QGroundControl.Controllers", 1, 0, "ViewWidgetController");
qmlRegisterType<ParameterEditorController> ("QGroundControl.Controllers", 1, 0, "ParameterEditorController"); qmlRegisterType<ParameterEditorController> ("QGroundControl.Controllers", 1, 0, "ParameterEditorController");
qmlRegisterType<CustomCommandWidgetController> ("QGroundControl.Controllers", 1, 0, "CustomCommandWidgetController");
qmlRegisterType<FlightModesComponentController> ("QGroundControl.Controllers", 1, 0, "FlightModesComponentController"); qmlRegisterType<FlightModesComponentController> ("QGroundControl.Controllers", 1, 0, "FlightModesComponentController");
qmlRegisterType<AirframeComponentController> ("QGroundControl.Controllers", 1, 0, "AirframeComponentController"); qmlRegisterType<AirframeComponentController> ("QGroundControl.Controllers", 1, 0, "AirframeComponentController");
qmlRegisterType<SensorsComponentController> ("QGroundControl.Controllers", 1, 0, "SensorsComponentController"); qmlRegisterType<SensorsComponentController> ("QGroundControl.Controllers", 1, 0, "SensorsComponentController");
...@@ -348,6 +343,8 @@ void QGCApplication::_initCommon(void) ...@@ -348,6 +343,8 @@ void QGCApplication::_initCommon(void)
qmlRegisterType<ScreenToolsController> ("QGroundControl.Controllers", 1, 0, "ScreenToolsController"); qmlRegisterType<ScreenToolsController> ("QGroundControl.Controllers", 1, 0, "ScreenToolsController");
#ifndef __mobile__ #ifndef __mobile__
qmlRegisterType<ViewWidgetController> ("QGroundControl.Controllers", 1, 0, "ViewWidgetController");
qmlRegisterType<CustomCommandWidgetController> ("QGroundControl.Controllers", 1, 0, "CustomCommandWidgetController");
qmlRegisterType<FirmwareUpgradeController> ("QGroundControl.Controllers", 1, 0, "FirmwareUpgradeController"); qmlRegisterType<FirmwareUpgradeController> ("QGroundControl.Controllers", 1, 0, "FirmwareUpgradeController");
qmlRegisterType<JoystickConfigController> ("QGroundControl.Controllers", 1, 0, "JoystickConfigController"); qmlRegisterType<JoystickConfigController> ("QGroundControl.Controllers", 1, 0, "JoystickConfigController");
#endif #endif
...@@ -420,14 +417,6 @@ bool QGCApplication::_initForNormalAppBoot(void) ...@@ -420,14 +417,6 @@ bool QGCApplication::_initForNormalAppBoot(void)
_styleIsDark = settings.value(_styleKey, _styleIsDark).toBool(); _styleIsDark = settings.value(_styleKey, _styleIsDark).toBool();
_loadCurrentStyle(); _loadCurrentStyle();
// Temp hack for new mission editor
#ifdef __mobile__
// Mobile builds always use new Mission Editor
_useNewMissionEditor = true;
#else
_useNewMissionEditor = settings.value("UseNewMissionEditor", false).toBool();
#endif
// Show splash screen // Show splash screen
QPixmap splashImage(":/res/SplashScreen"); QPixmap splashImage(":/res/SplashScreen");
QSplashScreen* splashScreen = new QSplashScreen(splashImage); QSplashScreen* splashScreen = new QSplashScreen(splashImage);
......
...@@ -178,8 +178,6 @@ private: ...@@ -178,8 +178,6 @@ private:
QStringList _missingParams; ///< List of missing facts to be displayed QStringList _missingParams; ///< List of missing facts to be displayed
bool _fakeMobile; ///< true: Fake ui into displaying mobile interface bool _fakeMobile; ///< true: Fake ui into displaying mobile interface
bool _useNewMissionEditor; ///< true: Use new Mission Editor
#ifdef QT_DEBUG #ifdef QT_DEBUG
bool _testHighDPI; ///< true: double fonts sizes for simulating high dpi devices bool _testHighDPI; ///< true: double fonts sizes for simulating high dpi devices
......
...@@ -32,6 +32,7 @@ ...@@ -32,6 +32,7 @@
#include <QRegularExpression> #include <QRegularExpression>
#include <QMessageBox> #include <QMessageBox>
#include <QPushButton>
QString QGCFileDialog::getExistingDirectory( QString QGCFileDialog::getExistingDirectory(
QWidget* parent, QWidget* parent,
......
...@@ -64,7 +64,7 @@ Button { ...@@ -64,7 +64,7 @@ Button {
background: Item { background: Item {
property bool down: control.pressed || (control.checkable && control.checked) property bool down: control.pressed || (control.checkable && control.checked)
implicitWidth: Math.round(TextSingleton.implicitHeight * 4.5) implicitWidth: Math.round(TextSingleton.implicitHeight * 4.5)
implicitHeight: Math.max(25, Math.round(TextSingleton.implicitHeight * 1.2)) implicitHeight: ScreenTools.isMobile ? ScreenTools.defaultFontPixelHeight * 3 * 0.75 : Math.max(25, Math.round(TextSingleton.implicitHeight * 1.2))
Rectangle { Rectangle {
anchors.fill: parent anchors.fill: parent
......
...@@ -11,7 +11,7 @@ CheckBox { ...@@ -11,7 +11,7 @@ CheckBox {
style: CheckBoxStyle { style: CheckBoxStyle {
label: Item { label: Item {
implicitWidth: text.implicitWidth + 2 implicitWidth: text.implicitWidth + 2
implicitHeight: text.implicitHeight implicitHeight: ScreenTools.isMobile ? ScreenTools.defaultFontPixelHeight * 3 * 0.75 : text.implicitHeight
baselineOffset: text.baselineOffset baselineOffset: text.baselineOffset
Rectangle { Rectangle {
anchors.fill: text anchors.fill: text
......
...@@ -18,7 +18,7 @@ ComboBox { ...@@ -18,7 +18,7 @@ ComboBox {
background: Item { background: Item {
implicitWidth: Math.round(TextSingleton.implicitHeight * 4.5) implicitWidth: Math.round(TextSingleton.implicitHeight * 4.5)
implicitHeight: Math.max(25, Math.round(TextSingleton.implicitHeight * 1.2)) implicitHeight: ScreenTools.isMobile ? ScreenTools.defaultFontPixelHeight * 3 * 0.75 : Math.max(25, Math.round(TextSingleton.implicitHeight * 1.2))
Rectangle { Rectangle {
anchors.fill: parent anchors.fill: parent
......
...@@ -11,7 +11,7 @@ RadioButton { ...@@ -11,7 +11,7 @@ RadioButton {
style: RadioButtonStyle { style: RadioButtonStyle {
label: Item { label: Item {
implicitWidth: text.implicitWidth + 2 implicitWidth: text.implicitWidth + 2
implicitHeight: text.implicitHeight implicitHeight: ScreenTools.isMobile ? ScreenTools.defaultFontPixelHeight * 3 * 0.75 : text.implicitHeight
baselineOffset: text.y + text.baselineOffset baselineOffset: text.y + text.baselineOffset
Rectangle { Rectangle {
anchors.fill: text anchors.fill: text
......
...@@ -12,6 +12,7 @@ TextField { ...@@ -12,6 +12,7 @@ TextField {
property var __qgcPal: QGCPalette { colorGroupEnabled: enabled } property var __qgcPal: QGCPalette { colorGroupEnabled: enabled }
textColor: __qgcPal.textFieldText textColor: __qgcPal.textFieldText
height: ScreenTools.isMobile ? ScreenTools.defaultFontPixelHeight * 3 * 0.75 : implicitHeight
Label { Label {
id: unitsLabelWidthGenerator id: unitsLabelWidthGenerator
......
...@@ -31,21 +31,25 @@ This file is part of the QGROUNDCONTROL project ...@@ -31,21 +31,25 @@ This file is part of the QGROUNDCONTROL project
#include <QtGlobal> #include <QtGlobal>
#include <QApplication> #include <QApplication>
#include <QSslSocket> #include <QSslSocket>
#include <QProcessEnvironment>
#ifndef __mobile__ #ifndef __mobile__
#include <QSerialPortInfo> #include <QSerialPortInfo>
#endif #endif
#include <QProcessEnvironment>
#include "QGCApplication.h" #include "QGCApplication.h"
#include "MainWindow.h" #include "MainWindow.h"
#ifdef QT_DEBUG #ifdef QT_DEBUG
#ifndef __mobile__ #ifndef __mobile__
#include "UnitTest.h" #include "UnitTest.h"
#endif #endif
#include "CmdLineOptParser.h" #include "CmdLineOptParser.h"
#ifdef Q_OS_WIN #ifdef Q_OS_WIN
#include <crtdbg.h> #include <crtdbg.h>
#endif #endif
#endif #endif
#include <iostream> #include <iostream>
/* SDL does ugly things to main() */ /* SDL does ugly things to main() */
......
...@@ -33,11 +33,11 @@ This file is part of the QGROUNDCONTROL project ...@@ -33,11 +33,11 @@ This file is part of the QGROUNDCONTROL project
#include <QTimer> #include <QTimer>
#include <QHostInfo> #include <QHostInfo>
#include <QSplashScreen> #include <QSplashScreen>
#include <QQuickView> #include <QQuickView>
#include <QDesktopWidget> #include <QDesktopWidget>
#include <QScreen> #include <QScreen>
#include <QDesktopServices> #include <QDesktopServices>
#include <QDockWidget>
#include "QGC.h" #include "QGC.h"
#include "MAVLinkProtocol.h" #include "MAVLinkProtocol.h"
...@@ -46,27 +46,28 @@ This file is part of the QGROUNDCONTROL project ...@@ -46,27 +46,28 @@ This file is part of the QGROUNDCONTROL project
#include "QGCMAVLinkLogPlayer.h" #include "QGCMAVLinkLogPlayer.h"
#include "SettingsDialog.h" #include "SettingsDialog.h"
#include "MAVLinkDecoder.h" #include "MAVLinkDecoder.h"
#include "QGCMAVLinkMessageSender.h"
#include "UASQuickView.h"
#include "QGCDataPlot2D.h" #include "QGCDataPlot2D.h"
#include "Linecharts.h" #include "Linecharts.h"
#include "QGCTabbedInfoView.h"
#include "UASRawStatusView.h"
#include "FlightDisplayView.h" #include "FlightDisplayView.h"
#include "FlightDisplayWidget.h"
#include "SetupView.h" #include "SetupView.h"
#include "QGCUASFileViewMulti.h"
#include "QGCApplication.h" #include "QGCApplication.h"
#include "QGCFileDialog.h" #include "QGCFileDialog.h"
#include "QGCMessageBox.h" #include "QGCMessageBox.h"
#include "QGCDockWidget.h"
#include "MultiVehicleManager.h" #include "MultiVehicleManager.h"
#include "CustomCommandWidget.h"
#include "HomePositionManager.h" #include "HomePositionManager.h"
#include "MissionEditor.h" #include "MissionEditor.h"
#include "LogCompressor.h" #include "LogCompressor.h"
#include "UAS.h"
#ifndef __mobile__ #ifndef __mobile__
#include "QGCUASFileViewMulti.h"
#include "UASQuickView.h"
#include "QGCTabbedInfoView.h"
#include "UASRawStatusView.h"
#include "CustomCommandWidget.h"
#include "QGCDockWidget.h"
#include "FlightDisplayWidget.h"
#include "UASInfoWidget.h"
#include "HILDockWidget.h" #include "HILDockWidget.h"
#endif #endif
...@@ -86,6 +87,7 @@ This file is part of the QGROUNDCONTROL project ...@@ -86,6 +87,7 @@ This file is part of the QGROUNDCONTROL project
/// The key under which the Main Window settings are saved /// The key under which the Main Window settings are saved
const char* MAIN_SETTINGS_GROUP = "QGC_MAINWINDOW"; const char* MAIN_SETTINGS_GROUP = "QGC_MAINWINDOW";
#ifndef __mobile__
const char* MainWindow::_mavlinkDockWidgetName = "MAVLINK_INSPECTOR_DOCKWIDGET"; const char* MainWindow::_mavlinkDockWidgetName = "MAVLINK_INSPECTOR_DOCKWIDGET";
const char* MainWindow::_customCommandWidgetName = "CUSTOM_COMMAND_DOCKWIDGET"; const char* MainWindow::_customCommandWidgetName = "CUSTOM_COMMAND_DOCKWIDGET";
const char* MainWindow::_filesDockWidgetName = "FILE_VIEW_DOCKWIDGET"; const char* MainWindow::_filesDockWidgetName = "FILE_VIEW_DOCKWIDGET";
...@@ -94,6 +96,7 @@ const char* MainWindow::_mapViewDockWidgetName = "MAP_VIEW_DOCKWIDGET"; ...@@ -94,6 +96,7 @@ const char* MainWindow::_mapViewDockWidgetName = "MAP_VIEW_DOCKWIDGET";
const char* MainWindow::_pfdDockWidgetName = "PRIMARY_FLIGHT_DISPLAY_DOCKWIDGET"; const char* MainWindow::_pfdDockWidgetName = "PRIMARY_FLIGHT_DISPLAY_DOCKWIDGET";
const char* MainWindow::_uasInfoViewDockWidgetName = "UAS_INFO_INFOVIEW_DOCKWIDGET"; const char* MainWindow::_uasInfoViewDockWidgetName = "UAS_INFO_INFOVIEW_DOCKWIDGET";
const char* MainWindow::_hilDockWidgetName = "HIL_DOCKWIDGET"; const char* MainWindow::_hilDockWidgetName = "HIL_DOCKWIDGET";
#endif
static MainWindow* _instance = NULL; ///< @brief MainWindow singleton static MainWindow* _instance = NULL; ///< @brief MainWindow singleton
...@@ -162,10 +165,12 @@ MainWindow::MainWindow(QSplashScreen* splashScreen) ...@@ -162,10 +165,12 @@ MainWindow::MainWindow(QSplashScreen* splashScreen)
menuBar()->setNativeMenuBar(false); menuBar()->setNativeMenuBar(false);
#endif #endif
#ifndef __mobile__
#ifdef UNITTEST_BUILD #ifdef UNITTEST_BUILD
QAction* qmlTestAction = new QAction("Test QML palette and controls", NULL); QAction* qmlTestAction = new QAction("Test QML palette and controls", NULL);
connect(qmlTestAction, &QAction::triggered, this, &MainWindow::_showQmlTestWidget); connect(qmlTestAction, &QAction::triggered, this, &MainWindow::_showQmlTestWidget);
_ui.menuWidgets->addAction(qmlTestAction); _ui.menuWidgets->addAction(qmlTestAction);
#endif
#endif #endif
// Load QML Toolbar // Load QML Toolbar
...@@ -184,9 +189,12 @@ MainWindow::MainWindow(QSplashScreen* splashScreen) ...@@ -184,9 +189,12 @@ MainWindow::MainWindow(QSplashScreen* splashScreen)
setStatusBar(new QStatusBar(this)); setStatusBar(new QStatusBar(this));
statusBar()->setSizeGripEnabled(true); statusBar()->setSizeGripEnabled(true);
#ifndef __mobile__
emit initStatusChanged(tr("Building common widgets."), Qt::AlignLeft | Qt::AlignBottom, QColor(62, 93, 141)); emit initStatusChanged(tr("Building common widgets."), Qt::AlignLeft | Qt::AlignBottom, QColor(62, 93, 141));
_buildCommonWidgets(); _buildCommonWidgets();
emit initStatusChanged(tr("Building common actions"), Qt::AlignLeft | Qt::AlignBottom, QColor(62, 93, 141)); emit initStatusChanged(tr("Building common actions"), Qt::AlignLeft | Qt::AlignBottom, QColor(62, 93, 141));
#endif
// Create actions // Create actions
connectCommonActions(); connectCommonActions();
// Connect user interface devices // Connect user interface devices
...@@ -332,6 +340,7 @@ QString MainWindow::_getWindowGeometryKey() ...@@ -332,6 +340,7 @@ QString MainWindow::_getWindowGeometryKey()
return "_geometry"; return "_geometry";
} }
#ifndef __mobile__
void MainWindow::_createDockWidget(const QString& title, const QString& name, Qt::DockWidgetArea area, QWidget* innerWidget) void MainWindow::_createDockWidget(const QString& title, const QString& name, Qt::DockWidgetArea area, QWidget* innerWidget)
{ {
Q_ASSERT(!_mapName2DockWidget.contains(name)); Q_ASSERT(!_mapName2DockWidget.contains(name));
...@@ -401,46 +410,6 @@ void MainWindow::_buildCommonWidgets(void) ...@@ -401,46 +410,6 @@ void MainWindow::_buildCommonWidgets(void)
} }
} }
void MainWindow::_buildMissionEditorView(void)
{
if (!_missionEditorView) {
_missionEditorView = new MissionEditor(this);
_missionEditorView->setVisible(false);
}
}
void MainWindow::_buildFlightView(void)
{
if (!_flightView) {
_flightView = new FlightDisplayView(this);
_flightView->setVisible(false);
}
}
void MainWindow::_buildSetupView(void)
{
if (!_setupView) {
_setupView = new SetupView(this);
_setupView->setVisible(false);
}
}
void MainWindow::_buildAnalyzeView(void)
{
if (!_analyzeView) {
_analyzeView = new QGCDataPlot2D(this);
_analyzeView->setVisible(false);
}
}
void MainWindow::_buildSimView(void)
{
if (!_simView) {
_simView = new FlightDisplayView(this);
_simView->setVisible(false);
}
}
/// Shows or hides the specified dock widget, creating if necessary /// Shows or hides the specified dock widget, creating if necessary
void MainWindow::_showDockWidget(const QString& name, bool show) void MainWindow::_showDockWidget(const QString& name, bool show)
{ {
...@@ -449,18 +418,18 @@ void MainWindow::_showDockWidget(const QString& name, bool show) ...@@ -449,18 +418,18 @@ void MainWindow::_showDockWidget(const QString& name, bool show)
// Which would cause us to end up here. // Which would cause us to end up here.
return; return;
} }
// Create the inner widget if we need to // Create the inner widget if we need to
if (!_mapName2DockWidget[name]->widget()) { if (!_mapName2DockWidget[name]->widget()) {
_createInnerDockWidget(name); _createInnerDockWidget(name);
} }
Q_ASSERT(_mapName2DockWidget.contains(name)); Q_ASSERT(_mapName2DockWidget.contains(name));
QDockWidget* dockWidget = _mapName2DockWidget[name]; QDockWidget* dockWidget = _mapName2DockWidget[name];
Q_ASSERT(dockWidget); Q_ASSERT(dockWidget);
dockWidget->setVisible(show); dockWidget->setVisible(show);
Q_ASSERT(_mapDockWidget2Action.contains(dockWidget)); Q_ASSERT(_mapDockWidget2Action.contains(dockWidget));
_mapDockWidget2Action[dockWidget]->setChecked(show); _mapDockWidget2Action[dockWidget]->setChecked(show);
} }
...@@ -470,9 +439,9 @@ void MainWindow::_createInnerDockWidget(const QString& widgetName) ...@@ -470,9 +439,9 @@ void MainWindow::_createInnerDockWidget(const QString& widgetName)
{ {
Q_ASSERT(_mapName2DockWidget.contains(widgetName)); // QDockWidget should already exist Q_ASSERT(_mapName2DockWidget.contains(widgetName)); // QDockWidget should already exist
Q_ASSERT(!_mapName2DockWidget[widgetName]->widget()); // Inner widget should not Q_ASSERT(!_mapName2DockWidget[widgetName]->widget()); // Inner widget should not
QWidget* widget = NULL; QWidget* widget = NULL;
if (widgetName == _mavlinkDockWidgetName) { if (widgetName == _mavlinkDockWidgetName) {
widget = new QGCMAVLinkInspector(MAVLinkProtocol::instance(),this); widget = new QGCMAVLinkInspector(MAVLinkProtocol::instance(),this);
} else if (widgetName == _customCommandWidgetName) { } else if (widgetName == _customCommandWidgetName) {
...@@ -494,7 +463,7 @@ void MainWindow::_createInnerDockWidget(const QString& widgetName) ...@@ -494,7 +463,7 @@ void MainWindow::_createInnerDockWidget(const QString& widgetName)
} else { } else {
qWarning() << "Attempt to create unknown Inner Dock Widget" << widgetName; qWarning() << "Attempt to create unknown Inner Dock Widget" << widgetName;
} }
if (widget) { if (widget) {
QDockWidget* dockWidget = _mapName2DockWidget[widgetName]; QDockWidget* dockWidget = _mapName2DockWidget[widgetName];
Q_CHECK_PTR(dockWidget); Q_CHECK_PTR(dockWidget);
...@@ -503,6 +472,53 @@ void MainWindow::_createInnerDockWidget(const QString& widgetName) ...@@ -503,6 +472,53 @@ void MainWindow::_createInnerDockWidget(const QString& widgetName)
} }
} }
void MainWindow::_hideAllDockWidgets(void)
{
foreach(QDockWidget* dockWidget, _mapName2DockWidget) {
dockWidget->setVisible(false);
}
}
void MainWindow::_showDockWidgetAction(bool show)
{
QAction* action = dynamic_cast<QAction*>(QObject::sender());
Q_ASSERT(action);
_showDockWidget(action->data().toString(), show);
}
#endif
void MainWindow::_buildMissionEditorView(void)
{
if (!_missionEditorView) {
_missionEditorView = new MissionEditor(this);
_missionEditorView->setVisible(false);
}
}
void MainWindow::_buildFlightView(void)
{
if (!_flightView) {
_flightView = new FlightDisplayView(this);
_flightView->setVisible(false);
}
}
void MainWindow::_buildSetupView(void)
{
if (!_setupView) {
_setupView = new SetupView(this);
_setupView->setVisible(false);
}
}
void MainWindow::_buildAnalyzeView(void)
{
if (!_analyzeView) {
_analyzeView = new QGCDataPlot2D(this);
_analyzeView->setVisible(false);
}
}
void MainWindow::fullScreenActionItemCallback(bool) void MainWindow::fullScreenActionItemCallback(bool)
{ {
_ui.actionNormal->setChecked(false); _ui.actionNormal->setChecked(false);
...@@ -804,10 +820,10 @@ void MainWindow::_loadCurrentViewState(void) ...@@ -804,10 +820,10 @@ void MainWindow::_loadCurrentViewState(void)
_centralLayout->setContentsMargins(0, 0, 0, 0); _centralLayout->setContentsMargins(0, 0, 0, 0);
_currentViewWidget->setVisible(true); _currentViewWidget->setVisible(true);
#ifndef __mobile__
// Hide all widgets from previous view // Hide all widgets from previous view
_hideAllDockWidgets(); _hideAllDockWidgets();
#ifndef __mobile__
// Restore the widgets for the new view // Restore the widgets for the new view
QString widgetNames = settings.value(_getWindowStateKey() + "WIDGETS", defaultWidgets).toString(); QString widgetNames = settings.value(_getWindowStateKey() + "WIDGETS", defaultWidgets).toString();
qDebug() << widgetNames; qDebug() << widgetNames;
...@@ -829,21 +845,6 @@ void MainWindow::_loadCurrentViewState(void) ...@@ -829,21 +845,6 @@ void MainWindow::_loadCurrentViewState(void)
emit repaintCanvas(); emit repaintCanvas();
} }
void MainWindow::_hideAllDockWidgets(void)
{
foreach(QDockWidget* dockWidget, _mapName2DockWidget) {
dockWidget->setVisible(false);
}
}
void MainWindow::_showDockWidgetAction(bool show)
{
QAction* action = dynamic_cast<QAction*>(QObject::sender());
Q_ASSERT(action);
_showDockWidget(action->data().toString(), show);
}
void MainWindow::loadAnalyzeView() void MainWindow::loadAnalyzeView()
{ {
if (_currentView != VIEW_ANALYZE) if (_currentView != VIEW_ANALYZE)
......
...@@ -41,7 +41,6 @@ This file is part of the QGROUNDCONTROL project ...@@ -41,7 +41,6 @@ This file is part of the QGROUNDCONTROL project
#include "LinkManager.h" #include "LinkManager.h"
#include "LinkInterface.h" #include "LinkInterface.h"
#include "UASInterface.h" #include "UASInterface.h"
#include "UASInfoWidget.h"
#include "CameraView.h" #include "CameraView.h"
#if (defined QGC_MOUSE_ENABLED_WIN) | (defined QGC_MOUSE_ENABLED_LINUX) #if (defined QGC_MOUSE_ENABLED_WIN) | (defined QGC_MOUSE_ENABLED_LINUX)
#include "Mouse6dofInput.h" #include "Mouse6dofInput.h"
...@@ -53,16 +52,13 @@ This file is part of the QGROUNDCONTROL project ...@@ -53,16 +52,13 @@ This file is part of the QGROUNDCONTROL project
#include "QGCMAVLinkInspector.h" #include "QGCMAVLinkInspector.h"
#include "QGCMAVLinkLogPlayer.h" #include "QGCMAVLinkLogPlayer.h"
#include "MAVLinkDecoder.h" #include "MAVLinkDecoder.h"
#include "QGCUASFileViewMulti.h"
#include "Vehicle.h" #include "Vehicle.h"
class QGCMAVLinkMessageSender;
class QGCFirmwareUpdate; class QGCFirmwareUpdate;
class QSplashScreen; class QSplashScreen;
class QGCStatusBar; class QGCStatusBar;
class Linecharts; class Linecharts;
class QGCDataPlot2D; class QGCDataPlot2D;
class QGCUASFileViewMulti;
/** /**
* @brief Main Application Window * @brief Main Application Window
...@@ -212,19 +208,11 @@ protected: ...@@ -212,19 +208,11 @@ protected:
// Center widgets // Center widgets
QPointer<Linecharts> linechartWidget; QPointer<Linecharts> linechartWidget;
#ifdef QGC_OSG_ENABLED
QPointer<QWidget> q3DWidget;
#endif
QPointer<QGCFirmwareUpdate> firmwareUpdateWidget;
QPointer<MainToolBar> _mainToolBar; QPointer<MainToolBar> _mainToolBar;
QPointer<QDockWidget> mavlinkInspectorWidget;
QPointer<MAVLinkDecoder> mavlinkDecoder; QPointer<MAVLinkDecoder> mavlinkDecoder;
QPointer<QDockWidget> mavlinkSenderWidget;
QGCMAVLinkLogPlayer* logPlayer; QGCMAVLinkLogPlayer* logPlayer;
QPointer<QGCUASFileViewMulti> fileWidget;
#ifdef QGC_MOUSE_ENABLED_WIN #ifdef QGC_MOUSE_ENABLED_WIN
/** @brief 3d Mouse support (WIN only) */ /** @brief 3d Mouse support (WIN only) */
Mouse3DInput* mouseInput; ///< 3dConnexion 3dMouse SDK Mouse3DInput* mouseInput; ///< 3dConnexion 3dMouse SDK
...@@ -251,15 +239,17 @@ protected: ...@@ -251,15 +239,17 @@ protected:
QTimer windowNameUpdateTimer; QTimer windowNameUpdateTimer;
private slots: private slots:
void _showDockWidgetAction(bool show);
void _linkStateChange(LinkInterface*); void _linkStateChange(LinkInterface*);
void _closeWindow(void) { close(); }
void _vehicleAdded(Vehicle* vehicle);
#ifndef __mobile__
void _showDockWidgetAction(bool show);
#endif
#ifdef UNITTEST_BUILD #ifdef UNITTEST_BUILD
void _showQmlTestWidget(void); void _showQmlTestWidget(void);
#endif #endif
void _closeWindow(void) { close(); }
private slots:
void _vehicleAdded(Vehicle* vehicle);
private: private:
/// Constructor is private since all creation should be through MainWindow::_create /// Constructor is private since all creation should be through MainWindow::_create
...@@ -272,10 +262,9 @@ private: ...@@ -272,10 +262,9 @@ private:
QPointer<QWidget> _flightView; QPointer<QWidget> _flightView;
QPointer<QWidget> _setupView; QPointer<QWidget> _setupView;
QPointer<QWidget> _analyzeView; QPointer<QWidget> _analyzeView;
QPointer<QWidget> _simView;
QPointer<QWidget> _terminalView;
QPointer<QWidget> _missionEditorView; QPointer<QWidget> _missionEditorView;
#ifndef __mobile__
// Dock widget names // Dock widget names
static const char* _mavlinkDockWidgetName; static const char* _mavlinkDockWidgetName;
static const char* _customCommandWidgetName; static const char* _customCommandWidgetName;
...@@ -288,23 +277,25 @@ private: ...@@ -288,23 +277,25 @@ private:
QMap<QString, QDockWidget*> _mapName2DockWidget; QMap<QString, QDockWidget*> _mapName2DockWidget;
QMap<QDockWidget*, QAction*> _mapDockWidget2Action; QMap<QDockWidget*, QAction*> _mapDockWidget2Action;
#endif
void _buildPlanView(void); void _buildPlanView(void);
void _buildFlightView(void); void _buildFlightView(void);
void _buildSetupView(void); void _buildSetupView(void);
void _buildAnalyzeView(void); void _buildAnalyzeView(void);
void _buildSimView(void);
void _buildTerminalView(void); void _buildTerminalView(void);
void _buildMissionEditorView(void); void _buildMissionEditorView(void);
void _storeCurrentViewState(void); void _storeCurrentViewState(void);
void _loadCurrentViewState(void); void _loadCurrentViewState(void);
#ifndef __mobile__
void _createDockWidget(const QString& title, const QString& name, Qt::DockWidgetArea area, QWidget* innerWidget); void _createDockWidget(const QString& title, const QString& name, Qt::DockWidgetArea area, QWidget* innerWidget);
void _createInnerDockWidget(const QString& widgetName); void _createInnerDockWidget(const QString& widgetName);
void _buildCommonWidgets(void); void _buildCommonWidgets(void);
void _hideAllDockWidgets(void); void _hideAllDockWidgets(void);
void _showDockWidget(const QString &name, bool show); void _showDockWidget(const QString &name, bool show);
#endif
bool _autoReconnect; bool _autoReconnect;
bool _lowPowerMode; ///< If enabled, QGC reduces the update rates of all widgets bool _lowPowerMode; ///< If enabled, QGC reduces the update rates of all widgets
......
#include "QGCMainWindowAPConfigurator.h"
QGCMainWindowAPConfigurator::QGCMainWindowAPConfigurator(QObject *parent) :
QObject(parent)
{
}
#ifndef QGCMAINWINDOWAPCONFIGURATOR_H
#define QGCMAINWINDOWAPCONFIGURATOR_H
#include <QObject>
class QGCMainWindowAPConfigurator : public QObject
{
Q_OBJECT
public:
explicit QGCMainWindowAPConfigurator(QObject *parent = 0);
signals:
public slots:
};
#endif // QGCMAINWINDOWAPCONFIGURATOR_H
...@@ -2,8 +2,8 @@ ...@@ -2,8 +2,8 @@
#include "Linecharts.h" #include "Linecharts.h"
#include "MultiVehicleManager.h" #include "MultiVehicleManager.h"
#include "MainWindow.h" #include "MainWindow.h"
#include "UAS.h"
Linecharts::Linecharts(QWidget *parent) : Linecharts::Linecharts(QWidget *parent) :
QStackedWidget(parent), QStackedWidget(parent),
......
#include "QGCMAVLinkMessageSender.h"
#include "ui_QGCMAVLinkMessageSender.h"
#include "MAVLinkProtocol.h"
QGCMAVLinkMessageSender::QGCMAVLinkMessageSender(MAVLinkProtocol* mavlink, QWidget *parent) :
QWidget(parent),
protocol(mavlink),
ui(new Ui::QGCMAVLinkMessageSender)
{
ui->setupUi(this);
mavlink_message_info_t msg[256] = MAVLINK_MESSAGE_INFO;
memcpy(messageInfo, msg, sizeof(mavlink_message_info_t)*256);
QStringList header;
header << tr("Name");
header << tr("Value");
header << tr("Type");
ui->treeWidget->setHeaderLabels(header);
createTreeView();
connect(&refreshTimer, SIGNAL(timeout()), this, SLOT(refresh()));
//refreshTimer.start(1000); // Refresh at 1 Hz interval
connect(ui->sendButton, SIGNAL(pressed()), this, SLOT(sendMessage()));
}
void QGCMAVLinkMessageSender::refresh()
{
// Send messages
foreach (unsigned int i, managementItems.keys())
{
if (!sendTimers.contains(i))
{
//sendTimers.insert(i, new QTimer())
}
}
// ui->treeWidget->topLevelItem(0)->children();
}
bool QGCMAVLinkMessageSender::sendMessage()
{
return sendMessage(ui->messageIdSpinBox->value());
}
bool QGCMAVLinkMessageSender::sendMessage(unsigned int msgid)
{
QString msgname(messageInfo[msgid].name);
if (msgid == 0 || msgid > 255 || messageInfo[msgid].name == NULL || msgname.compare(QString("EMPTY")))
{
return false;
}
bool result = true;
if (treeWidgetItems.contains(msgid))
{
// Fill message fields
mavlink_message_t msg;
QList<QTreeWidgetItem*> fields;// = treeWidgetItems.value(msgid)->;
for (unsigned int i = 0; i < messageInfo[msgid].num_fields; ++i)
{
QTreeWidgetItem* field = fields.at(i);
int fieldid = i;
uint8_t* m = ((uint8_t*)(&msg))+8;
switch (messageInfo[msgid].fields[fieldid].type)
{
case MAVLINK_TYPE_CHAR:
if (messageInfo[msgid].fields[fieldid].array_length > 0)
{
char* str = (char*)(m+messageInfo[msgid].fields[fieldid].wire_offset);
// Copy data
QString string = field->data(1, Qt::DisplayRole).toString();
// Copy string size
int len = qMin((unsigned int)string.length(), messageInfo[msgid].fields[fieldid].array_length);
memcpy(str, string.toStdString().c_str(), len);
// Enforce null termination
str[len-1] = '\0';
}
else
{
// Single char
char* b = ((char*)(m+messageInfo[msgid].fields[fieldid].wire_offset));
*b = field->data(1, Qt::DisplayRole).toChar().toLatin1();
}
break;
case MAVLINK_TYPE_UINT8_T:
if (messageInfo[msgid].fields[fieldid].array_length > 0)
{
uint8_t* nums = m+messageInfo[msgid].fields[fieldid].wire_offset;
for (unsigned int j = 0; j < messageInfo[msgid].fields[fieldid].array_length; ++j)
{
if ((unsigned int)(field->data(1, Qt::DisplayRole).toString().split(" ").size()) > j)
{
nums[j] = field->data(1, Qt::DisplayRole).toString().split(" ").at(j).toInt();
}
}
}
else
{
// Single value
uint8_t* u = (m+messageInfo[msgid].fields[fieldid].wire_offset);
*u = field->data(1, Qt::DisplayRole).toChar().toLatin1();
}
break;
case MAVLINK_TYPE_INT8_T:
if (messageInfo[msgid].fields[fieldid].array_length > 0)
{
int8_t* nums = reinterpret_cast<int8_t*>((m+messageInfo[msgid].fields[fieldid].wire_offset));
for (unsigned int j = 0; j < messageInfo[msgid].fields[fieldid].array_length; ++j)
{
if ((unsigned int)(field->data(1, Qt::DisplayRole).toString().split(" ").size()) > j)
{
nums[j] = field->data(1, Qt::DisplayRole).toString().split(" ").at(j).toInt();
}
}
}
else
{
// Single value
int8_t* u = reinterpret_cast<int8_t*>(m+messageInfo[msgid].fields[fieldid].wire_offset);
*u = field->data(1, Qt::DisplayRole).toChar().toLatin1();
}
break;
case MAVLINK_TYPE_INT16_T:
case MAVLINK_TYPE_UINT16_T:
if (messageInfo[msgid].fields[fieldid].array_length > 0)
{
uint16_t* nums = reinterpret_cast<uint16_t*>(m+messageInfo[msgid].fields[fieldid].wire_offset);
for (unsigned int j = 0; j < messageInfo[msgid].fields[fieldid].array_length; ++j)
{
if ((unsigned int)(field->data(1, Qt::DisplayRole).toString().split(" ").size()) > j)
{
nums[j] = field->data(1, Qt::DisplayRole).toString().split(" ").at(j).toUInt();
}
}
}
else
{
// Single value
uint16_t* u = reinterpret_cast<uint16_t*>(m+messageInfo[msgid].fields[fieldid].wire_offset);
*u = field->data(1, Qt::DisplayRole).toUInt();
}
break;
case MAVLINK_TYPE_INT32_T:
case MAVLINK_TYPE_UINT32_T:
if (messageInfo[msgid].fields[fieldid].array_length > 0)
{
int32_t* nums = reinterpret_cast<int32_t*>(m+messageInfo[msgid].fields[fieldid].wire_offset);
for (unsigned int j = 0; j < messageInfo[msgid].fields[fieldid].array_length; ++j)
{
if ((unsigned int)(field->data(1, Qt::DisplayRole).toString().split(" ").size()) > j)
{
nums[j] = field->data(1, Qt::DisplayRole).toString().split(" ").at(j).toUInt();
}
}
}
else
{
// Single value
int32_t* u = reinterpret_cast<int32_t*>(m+messageInfo[msgid].fields[fieldid].wire_offset);
*u = field->data(1, Qt::DisplayRole).toUInt();
}
break;
case MAVLINK_TYPE_INT64_T:
case MAVLINK_TYPE_UINT64_T:
if (messageInfo[msgid].fields[fieldid].array_length > 0)
{
int64_t* nums = reinterpret_cast<int64_t*>(m+messageInfo[msgid].fields[fieldid].wire_offset);
for (unsigned int j = 0; j < messageInfo[msgid].fields[fieldid].array_length; ++j)
{
if ((unsigned int)(field->data(1, Qt::DisplayRole).toString().split(" ").size()) > j)
{
nums[j] = field->data(1, Qt::DisplayRole).toString().split(" ").at(j).toULongLong();
}
}
}
else
{
// Single value
int64_t* u = reinterpret_cast<int64_t*>(m+messageInfo[msgid].fields[fieldid].wire_offset);
*u = field->data(1, Qt::DisplayRole).toULongLong();
}
break;
case MAVLINK_TYPE_FLOAT:
if (messageInfo[msgid].fields[fieldid].array_length > 0)
{
float* nums = reinterpret_cast<float*>(m+messageInfo[msgid].fields[fieldid].wire_offset);
for (unsigned int j = 0; j < messageInfo[msgid].fields[fieldid].array_length; ++j)
{
if ((unsigned int)(field->data(1, Qt::DisplayRole).toString().split(" ").size()) > j)
{
nums[j] = field->data(1, Qt::DisplayRole).toString().split(" ").at(j).toFloat();
}
}
}
else
{
// Single value
float* u = reinterpret_cast<float*>(m+messageInfo[msgid].fields[fieldid].wire_offset);
*u = field->data(1, Qt::DisplayRole).toFloat();
}
break;
case MAVLINK_TYPE_DOUBLE:
if (messageInfo[msgid].fields[fieldid].array_length > 0)
{
double* nums = reinterpret_cast<double*>(m+messageInfo[msgid].fields[fieldid].wire_offset);
for (unsigned int j = 0; j < messageInfo[msgid].fields[fieldid].array_length; ++j)
{
if ((unsigned int)(field->data(1, Qt::DisplayRole).toString().split(" ").size()) > j)
{
nums[j] = field->data(1, Qt::DisplayRole).toString().split(" ").at(j).toDouble();
}
}
}
else
{
// Single value
double* u = reinterpret_cast<double*>(m+messageInfo[msgid].fields[fieldid].wire_offset);
*u = field->data(1, Qt::DisplayRole).toDouble();
}
break;
}
}
// Send message
protocol->sendMessage(msg);
}
else
{
result = false;
}
return result;
}
QGCMAVLinkMessageSender::~QGCMAVLinkMessageSender()
{
delete ui;
}
void QGCMAVLinkMessageSender::createTreeView()
{
for (int i = 0; i < 256; ++i)//mavlink_message_t msg, receivedMessages)
{
// Update the tree view
QString messageName("%1 (%2 Hz, #%3)");
float msgHz = messagesHz.value(i, 0);
// Ignore non-existent messages
if (QString(messageInfo[i].name) == "EMPTY") continue;
messageName = messageName.arg(messageInfo[i].name).arg(msgHz, 3, 'f', 1).arg(i);
if (!treeWidgetItems.contains(i))
{
QStringList fields;
fields << messageName;
QTreeWidgetItem* widget = new QTreeWidgetItem(fields);
widget->setFirstColumnSpanned(true);
for (unsigned int j = 0; j < messageInfo[i].num_fields; ++j)
{
QTreeWidgetItem* field = new QTreeWidgetItem();
widget->addChild(field);
}
treeWidgetItems.insert(i, widget);
ui->treeWidget->addTopLevelItem(widget);
QTreeWidgetItem* message = widget;//treeWidgetItems.value(msg->msgid);
message->setFirstColumnSpanned(true);
message->setData(0, Qt::DisplayRole, QVariant(messageName));
for (unsigned int j = 0; j < messageInfo[i].num_fields; ++j)
{
createField(i, j, message->child(j));
}
// Add management fields, such as update rate and send button
// QTreeWidgetItem* management = new QTreeWidgetItem();
// widget->addChild(management);
// management->setData(0, Qt::DisplayRole, "Rate:");
// management->setData(1, Qt::DisplayRole, 0);
// management->setData(2, Qt::DisplayRole, "Hz");
// managementItems.insert(i, management);
}
}
}
void QGCMAVLinkMessageSender::createField(int msgid, int fieldid, QTreeWidgetItem* item)
{
// Add field tree widget item
item->setData(0, Qt::DisplayRole, QVariant(messageInfo[msgid].fields[fieldid].name));
//uint8_t* m = ((uint8_t*)(receivedMessages+msgid))+8;
switch (messageInfo[msgid].fields[fieldid].type)
{
case MAVLINK_TYPE_CHAR:
if (messageInfo[msgid].fields[fieldid].array_length > 0)
{
item->setData(2, Qt::DisplayRole, "char");
item->setData(1, Qt::DisplayRole, "");
}
else
{
// Single char
item->setData(2, Qt::DisplayRole, QString("char[%1]").arg(messageInfo[msgid].fields[fieldid].array_length));
item->setData(1, Qt::DisplayRole, "");
}
break;
case MAVLINK_TYPE_UINT8_T:
if (messageInfo[msgid].fields[fieldid].array_length > 0)
{
// Enforce null termination
QString tmp("%1, ");
QString string;
for (unsigned int j = 0; j < messageInfo[msgid].fields[fieldid].array_length; ++j)
{
string += tmp.arg(0);
}
item->setData(2, Qt::DisplayRole, QString("uint8_t[%1]").arg(messageInfo[msgid].fields[fieldid].array_length));
item->setData(1, Qt::DisplayRole, string);
}
else
{
// Single value
item->setData(2, Qt::DisplayRole, "uint8_t");
item->setData(1, Qt::DisplayRole, 0);
}
break;
case MAVLINK_TYPE_INT8_T:
if (messageInfo[msgid].fields[fieldid].array_length > 0)
{
// Enforce null termination
QString tmp("%1, ");
QString string;
for (unsigned int j = 0; j < messageInfo[msgid].fields[j].array_length; ++j)
{
string += tmp.arg(0);
}
item->setData(2, Qt::DisplayRole, QString("int8_t[%1]").arg(messageInfo[msgid].fields[fieldid].array_length));
item->setData(1, Qt::DisplayRole, string);
}
else
{
// Single value
item->setData(2, Qt::DisplayRole, "int8_t");
item->setData(1, Qt::DisplayRole, 0);
}
break;
case MAVLINK_TYPE_UINT16_T:
if (messageInfo[msgid].fields[fieldid].array_length > 0)
{
// Enforce null termination
QString tmp("%1, ");
QString string;
for (unsigned int j = 0; j < messageInfo[msgid].fields[j].array_length; ++j)
{
string += tmp.arg(0);
}
item->setData(2, Qt::DisplayRole, QString("uint16_t[%1]").arg(messageInfo[msgid].fields[fieldid].array_length));
item->setData(1, Qt::DisplayRole, string);
}
else
{
// Single value
item->setData(2, Qt::DisplayRole, "uint16_t");
item->setData(1, Qt::DisplayRole, 0);
}
break;
case MAVLINK_TYPE_INT16_T:
if (messageInfo[msgid].fields[fieldid].array_length > 0)
{
// Enforce null termination
QString tmp("%1, ");
QString string;
for (unsigned int j = 0; j < messageInfo[msgid].fields[j].array_length; ++j)
{
string += tmp.arg(0);
}
item->setData(2, Qt::DisplayRole, QString("int16_t[%1]").arg(messageInfo[msgid].fields[fieldid].array_length));
item->setData(1, Qt::DisplayRole, string);
}
else
{
// Single value
item->setData(2, Qt::DisplayRole, "int16_t");
item->setData(1, Qt::DisplayRole, 0);
}
break;
case MAVLINK_TYPE_UINT32_T:
if (messageInfo[msgid].fields[fieldid].array_length > 0)
{
// Enforce null termination
QString tmp("%1, ");
QString string;
for (unsigned int j = 0; j < messageInfo[msgid].fields[j].array_length; ++j)
{
string += tmp.arg(0);
}
item->setData(2, Qt::DisplayRole, QString("uint32_t[%1]").arg(messageInfo[msgid].fields[fieldid].array_length));
item->setData(1, Qt::DisplayRole, string);
}
else
{
// Single value
item->setData(2, Qt::DisplayRole, "uint32_t");
item->setData(1, Qt::DisplayRole, 0);
}
break;
case MAVLINK_TYPE_INT32_T:
if (messageInfo[msgid].fields[fieldid].array_length > 0)
{
// Enforce null termination
QString tmp("%1, ");
QString string;
for (unsigned int j = 0; j < messageInfo[msgid].fields[j].array_length; ++j)
{
string += tmp.arg(0);
}
item->setData(2, Qt::DisplayRole, QString("int32_t[%1]").arg(messageInfo[msgid].fields[fieldid].array_length));
item->setData(1, Qt::DisplayRole, string);
}
else
{
// Single value
item->setData(2, Qt::DisplayRole, "int32_t");
item->setData(1, Qt::DisplayRole, 0);
}
break;
case MAVLINK_TYPE_FLOAT:
if (messageInfo[msgid].fields[fieldid].array_length > 0)
{
// Enforce null termination
QString tmp("%1, ");
QString string;
for (unsigned int j = 0; j < messageInfo[msgid].fields[j].array_length; ++j)
{
string += tmp.arg(0.0f);
}
item->setData(2, Qt::DisplayRole, QString("float[%1]").arg(messageInfo[msgid].fields[fieldid].array_length));
item->setData(1, Qt::DisplayRole, string);
}
else
{
// Single value
item->setData(2, Qt::DisplayRole, "float");
item->setData(1, Qt::DisplayRole, 0.0f);
}
break;
case MAVLINK_TYPE_DOUBLE:
if (messageInfo[msgid].fields[fieldid].array_length > 0)
{
// Enforce null termination
QString tmp("%1, ");
QString string;
for (unsigned int j = 0; j < messageInfo[msgid].fields[j].array_length; ++j)
{
string += tmp.arg(0);
}
item->setData(2, Qt::DisplayRole, QString("double[%1]").arg(messageInfo[msgid].fields[fieldid].array_length));
item->setData(1, Qt::DisplayRole, string);
}
else
{
// Single value
item->setData(2, Qt::DisplayRole, "double");
item->setData(1, Qt::DisplayRole, 0.0);
}
break;
case MAVLINK_TYPE_UINT64_T:
if (messageInfo[msgid].fields[fieldid].array_length > 0)
{
// Enforce null termination
QString tmp("%1, ");
QString string;
for (unsigned int j = 0; j < messageInfo[msgid].fields[j].array_length; ++j)
{
string += tmp.arg(0);
}
item->setData(2, Qt::DisplayRole, QString("uint64_t[%1]").arg(messageInfo[msgid].fields[fieldid].array_length));
item->setData(1, Qt::DisplayRole, string);
}
else
{
// Single value
item->setData(2, Qt::DisplayRole, "uint64_t");
item->setData(1, Qt::DisplayRole, (quint64) 0);
}
break;
case MAVLINK_TYPE_INT64_T:
if (messageInfo[msgid].fields[fieldid].array_length > 0)
{
// Enforce null termination
QString tmp("%1, ");
QString string;
for (unsigned int j = 0; j < messageInfo[msgid].fields[j].array_length; ++j)
{
string += tmp.arg(0);
}
item->setData(2, Qt::DisplayRole, QString("int64_t[%1]").arg(messageInfo[msgid].fields[fieldid].array_length));
item->setData(1, Qt::DisplayRole, string);
}
else
{
// Single value
item->setData(2, Qt::DisplayRole, "int64_t");
item->setData(1, Qt::DisplayRole, (qint64) 0);
}
break;
}
}
#ifndef QGCMAVLINKMESSAGESENDER_H
#define QGCMAVLINKMESSAGESENDER_H
#include <QWidget>
#include <QTreeWidgetItem>
#include <QMap>
#include <QTimer>
#include "MAVLinkProtocol.h"
namespace Ui {
class QGCMAVLinkMessageSender;
}
class QGCMAVLinkMessageSender : public QWidget
{
Q_OBJECT
friend class QTimer;
public:
explicit QGCMAVLinkMessageSender(MAVLinkProtocol* mavlink, QWidget *parent = 0);
~QGCMAVLinkMessageSender();
public slots:
/** @brief Send message currently selected in ui, taking values from tree view */
bool sendMessage();
protected:
mavlink_message_info_t messageInfo[256]; ///< Meta information about all messages
MAVLinkProtocol* protocol; ///< MAVLink protocol
QMap<int, float> messagesHz; ///< Used to store update rate in Hz
QTimer refreshTimer;
QMap<unsigned int, QTimer*> sendTimers;
QMap<unsigned int, QTreeWidgetItem*> managementItems;
QMap<unsigned int, QTreeWidgetItem*> treeWidgetItems; ///< Messages
/** @brief Create the tree view of all messages */
void createTreeView();
/** @brief Create one field of one message in the tree view of all messages */
void createField(int msgid, int fieldid, QTreeWidgetItem* item);
/** @brief Send message with values taken from tree view */
bool sendMessage(unsigned int id);
protected slots:
/** @brief Read / display values in UI */
void refresh();
private:
Ui::QGCMAVLinkMessageSender *ui;
};
#endif // QGCMAVLINKMESSAGESENDER_H
<?xml version="1.0" encoding="UTF-8"?>
<ui version="4.0">
<class>QGCMAVLinkMessageSender</class>
<widget class="QWidget" name="QGCMAVLinkMessageSender">
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>400</width>
<height>300</height>
</rect>
</property>
<property name="windowTitle">
<string>Form</string>
</property>
<layout class="QGridLayout" name="gridLayout">
<property name="margin">
<number>6</number>
</property>
<item row="0" column="0" colspan="2">
<widget class="QTreeWidget" name="treeWidget">
<column>
<property name="text">
<string notr="true">1</string>
</property>
</column>
</widget>
</item>
<item row="1" column="0">
<widget class="QSpinBox" name="messageIdSpinBox"/>
</item>
<item row="1" column="1">
<widget class="QPushButton" name="sendButton">
<property name="text">
<string>Send Message</string>
</property>
</widget>
</item>
</layout>
</widget>
<resources/>
<connections/>
</ui>
...@@ -38,6 +38,7 @@ This file is part of the QGROUNDCONTROL project ...@@ -38,6 +38,7 @@ This file is part of the QGROUNDCONTROL project
#include "FlightDisplayView.h" #include "FlightDisplayView.h"
#include "QGCApplication.h" #include "QGCApplication.h"
#include "MultiVehicleManager.h" #include "MultiVehicleManager.h"
#include "UAS.h"
MainToolBar::MainToolBar(QWidget* parent) MainToolBar::MainToolBar(QWidget* parent)
: QGCQmlWidgetHolder(parent) : QGCQmlWidgetHolder(parent)
......
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