Commit 698e6bb1 authored by Don Gagne's avatar Don Gagne

Switch ArduPIlot setup pages to new SetupPage usage

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