Commit a93076dd authored by Don Gagne's avatar Don Gagne Committed by GitHub

Merge pull request #4130 from DonLakeFlyer/APMSetupPage

Switch ArduPilot setup pages to new SetupPage usage, plus vehicle branding
parents 8f594e50 698e6bb1
......@@ -152,6 +152,8 @@
<file alias="ArrowDirection.svg">src/AutoPilotPlugins/Common/Images/ArrowDirection.svg</file>
<file alias="ArrowCW.svg">src/AutoPilotPlugins/Common/Images/ArrowCW.svg</file>
<file alias="ArrowCCW.svg">src/AutoPilotPlugins/Common/Images/ArrowCCW.svg</file>
<file alias="APM/BrandImage">src/FirmwarePlugin/APM/APMBrandImage.png</file>
<file alias="PX4/BrandImage">src/FirmwarePlugin/PX4/PX4BrandImage.png</file>
</qresource>
<qresource prefix="/res">
<file alias="AntennaRC">resources/Antenna_RC.svg</file>
......
......@@ -32,8 +32,8 @@ QString APMAirframeComponent::name(void) const
QString APMAirframeComponent::description(void) const
{
return tr("The Airframe Component is used to select the airframe which matches your vehicle. "
"This will in turn set up the various tuning values for flight parameters.");
return tr("Airframe Setup is used to select the airframe which matches your vehicle. "
"You can also the load default parameter values associated with known vehicle types.");
}
QString APMAirframeComponent::iconResource(void) const
......
......@@ -11,26 +11,24 @@
import QtQuick 2.5
import QtQuick.Controls 1.2
import QtQuick.Dialogs 1.2
import QtQuick.Layouts 1.2
import QGroundControl.FactSystem 1.0
import QGroundControl.FactControls 1.0
import QGroundControl.Palette 1.0
import QGroundControl.Controls 1.0
import QGroundControl.Controllers 1.0
import QGroundControl.ScreenTools 1.0
QGCView {
id: qgcView
viewPanel: panel
QGCPalette { id: qgcPal; colorGroupEnabled: panel.enabled }
SetupPage {
id: airframePage
pageComponent: airframePageComponent
property real _margins: ScreenTools.defaultFontPixelWidth
property Fact _frame: controller.getParameterFact(-1, "FRAME")
APMAirframeComponentController {
id: controller
factPanel: panel
factPanel: airframePage.viewPanel
}
ExclusiveGroup {
......@@ -89,73 +87,47 @@ QGCView {
}
}
QGCViewPanel {
id: panel
anchors.fill: parent
Item {
id: helpApplyRow
anchors.top: parent.top
anchors.left: parent.left
anchors.right: parent.right
height: Math.max(helpText.contentHeight, applyButton.height)
Component {
id: airframePageComponent
QGCLabel {
id: helpText
anchors.rightMargin: _margins
anchors.left: parent.left
anchors.right: applyButton.right
text: qsTr("Please select your airframe type")
font.pointSize: ScreenTools.mediumFontPointSize
wrapMode: Text.WordWrap
}
Column {
width: availableWidth
height: 1000
spacing: _margins
QGCButton {
id: applyButton
RowLayout {
anchors.left: parent.left
anchors.right: parent.right
text: qsTr("Load common parameters")
onClicked: showDialog(applyRestartDialogComponent, qsTr("Load common parameters"), qgcView.showDialogDefaultWidth, StandardButton.Close)
}
}
Item {
id: helpSpacer
anchors.top: helpApplyRow.bottom
height: parent.spacerHeight
width: 10
}
QGCFlickable {
id: scroll
anchors.top: helpSpacer.bottom
anchors.bottom: parent.bottom
anchors.left: parent.left
anchors.right: parent.right
contentHeight: frameColumn.height
contentWidth: frameColumn.width
spacing: _margins
QGCLabel {
font.pointSize: ScreenTools.mediumFontPointSize
wrapMode: Text.WordWrap
text: qsTr("Please select your airframe type")
Layout.fillWidth: true
}
Column {
id: frameColumn
spacing: _margins
QGCButton {
text: qsTr("Load common parameters")
onClicked: showDialog(applyRestartDialogComponent, qsTr("Load common parameters"), qgcView.showDialogDefaultWidth, StandardButton.Close)
}
}
Repeater {
model: controller.airframeTypesModel
Repeater {
model: controller.airframeTypesModel
QGCRadioButton {
text: object.name
checked: controller.currentAirframeType == object
exclusiveGroup: airframeTypeExclusive
QGCRadioButton {
text: object.name
checked: controller.currentAirframeType == object
exclusiveGroup: airframeTypeExclusive
onCheckedChanged: {
if (checked) {
controller.currentAirframeType = object
}
onCheckedChanged: {
if (checked) {
controller.currentAirframeType = object
}
}
}
}
}
} // QGCViewPanel
} // QGCView
} // Column
} // Component - pageComponent
} // SetupPage
......@@ -29,7 +29,7 @@ QString APMCameraComponent::name(void) const
QString APMCameraComponent::description(void) const
{
return tr("The Camera Component is used to setup camera and gimbal settings.");
return tr("Camera setup is used to adjust camera and gimbal settings.");
}
QString APMCameraComponent::iconResource(void) const
......
......@@ -26,7 +26,7 @@ QString APMFlightModesComponent::name(void) const
QString APMFlightModesComponent::description(void) const
{
return QStringLiteral("The Flight Modes Component is used to assign FLight Modes to Channel 5.");
return tr("Flight Modes Setup is used to configure the transmitter switches associated with Flight Modes.");
}
QString APMFlightModesComponent::iconResource(void) const
......
......@@ -18,9 +18,9 @@ import QGroundControl.Controls 1.0
import QGroundControl.Controllers 1.0
import QGroundControl.ScreenTools 1.0
QGCView {
id: rootQGCView
viewPanel: panel
SetupPage {
id: flightModePage
pageComponent: flightModePageComponent
readonly property string _modeChannelParam: controller.modeChannelParam
readonly property string _modeParamPrefix: controller.modeParamPrefix
......@@ -33,26 +33,19 @@ QGCView {
property bool _fltmodeChExists: controller.parameterExists(-1, _modeChannelParam)
property Fact _fltmodeCh: _fltmodeChExists ? controller.getParameterFact(-1, _modeChannelParam) : _nullFact
QGCPalette { id: qgcPal; colorGroupEnabled: panel.enabled }
QGCPalette { id: qgcPal; colorGroupEnabled: true }
APMFlightModesComponentController {
id: controller
factPanel: panel
factPanel: flightModePage.viewPanel
}
QGCViewPanel {
id: panel
anchors.fill: parent
QGCFlickable {
anchors.fill: parent
clip: true
contentHeight: flowLayout.height
contentWidth: flowLayout.width
Component {
id: flightModePageComponent
Flow {
id: flowLayout
width: panel.width // parent.width doesn't work here for some reason!
width: availableWidth
spacing: _margins
Column {
......@@ -181,6 +174,5 @@ QGCView {
} // Rectangle - Channel options
} // Column - Channel options
} // Flow
} // QGCFlickable
} // QGCViewPanel
} // QGCView
} // Component - flightModePageComponent
} // SetupPage
......@@ -29,7 +29,7 @@ QString APMSafetyComponent::name(void) const
QString APMSafetyComponent::description(void) const
{
return tr("The Safety Component is used to setup triggers for Return to Land as well as the settings for Return to Land itself.");
return tr("Safety Setup is used to setup triggers for Return to Land as well as the settings for Return to Land itself.");
}
QString APMSafetyComponent::iconResource(void) const
......
......@@ -30,8 +30,7 @@ QString APMSensorsComponent::name(void) const
QString APMSensorsComponent::description(void) const
{
return tr("The Sensors Component allows you to calibrate the sensors within your vehicle. "
"Prior to flight you must calibrate the Magnetometer, Gyroscope and Accelerometer.");
return tr("Sensors Setup is used to calibrate the sensors within your vehicle.");
}
QString APMSensorsComponent::iconResource(void) const
......
......@@ -26,7 +26,7 @@ QString APMTuningComponent::name(void) const
QString APMTuningComponent::description(void) const
{
return tr("The Tuning Component is used to tune the flight characteristics of the Vehicle.");
return tr("Tuning Setup is used to tune the flight characteristics of the Vehicle.");
}
QString APMTuningComponent::iconResource(void) const
......
......@@ -95,6 +95,7 @@ public:
QObject* loadParameterMetaData (const QString& metaDataFile);
GeoFenceManager* newGeoFenceManager (Vehicle* vehicle) { return new APMGeoFenceManager(vehicle); }
RallyPointManager* newRallyPointManager (Vehicle* vehicle) { return new APMRallyPointManager(vehicle); }
QString brandImage (const Vehicle* vehicle) const { Q_UNUSED(vehicle); return QStringLiteral("/qmlimages/APM/BrandImage"); }
QString getParameterMetaDataFile(Vehicle* vehicle);
......
......@@ -222,6 +222,9 @@ public:
/// Return the resource file which contains the set of params loaded for offline editing.
virtual QString offlineEditingParamFile(Vehicle* vehicle) { Q_UNUSED(vehicle); return QString(); }
/// Return the resource file which contains the brand image for the vehicle.
virtual QString brandImage(const Vehicle* vehicle) const { Q_UNUSED(vehicle) return QString(); }
};
#endif
......@@ -58,6 +58,7 @@ public:
bool adjustIncomingMavlinkMessage (Vehicle* vehicle, mavlink_message_t* message);
GeoFenceManager* newGeoFenceManager (Vehicle* vehicle) { return new PX4GeoFenceManager(vehicle); }
QString offlineEditingParamFile(Vehicle* vehicle) final { Q_UNUSED(vehicle); return QStringLiteral(":/FirmwarePlugin/PX4/PX4.OfflineEditing.params"); }
QString brandImage (const Vehicle* vehicle) const { Q_UNUSED(vehicle); return QStringLiteral("/qmlimages/PX4/BrandImage"); }
// Use these constants to set flight modes using setFlightMode method. Don't use hardcoded string names since the
// names may change.
......
......@@ -1922,6 +1922,11 @@ void Vehicle::_newGeoFenceAvailable(void)
}
}
QString Vehicle::brandImage(void) const
{
return _firmwarePlugin->brandImage(this);
}
const char* VehicleGPSFactGroup::_hdopFactName = "hdop";
const char* VehicleGPSFactGroup::_vdopFactName = "vdop";
const char* VehicleGPSFactGroup::_courseOverGroundFactName = "courseOverGround";
......
......@@ -279,6 +279,7 @@ public:
Q_PROPERTY(bool coaxialMotors READ coaxialMotors CONSTANT)
Q_PROPERTY(bool xConfigMotors READ xConfigMotors CONSTANT)
Q_PROPERTY(bool isOfflineEditingVehicle READ isOfflineEditingVehicle CONSTANT)
Q_PROPERTY(QString brandImage READ brandImage CONSTANT)
/// true: Vehicle is flying, false: Vehicle is on ground
Q_PROPERTY(bool flying READ flying WRITE setFlying NOTIFY flyingChanged)
......@@ -524,6 +525,7 @@ public:
uint8_t baseMode () const { return _base_mode; }
uint32_t customMode () const { return _custom_mode; }
bool isOfflineEditingVehicle () const { return _offlineEditingVehicle; }
QString brandImage () const;
Fact* roll (void) { return &_rollFact; }
Fact* heading (void) { return &_headingFact; }
......
......@@ -54,7 +54,7 @@ Rectangle {
MainToolBarController { id: _controller }
function checkSettingsButton() {
settingsButton.checked = true
settingsButton.checked = true
}
function checkSetupButton() {
......@@ -421,6 +421,17 @@ Rectangle {
primary: true
onClicked: activeVehicle.disconnectInactiveVehicle()
}
Image {
anchors.rightMargin: ScreenTools.defaultFontPixelWidth / 2
anchors.right: parent.right
anchors.top: parent.top
anchors.bottom: parent.bottom
visible: parent.x < x && !disconnectButton.visible && source != ""
fillMode: Image.PreserveAspectFit
source: activeVehicle ? activeVehicle.brandImage : ""
}
}
// Progress bar
......
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