diff --git a/.travis.yml b/.travis.yml index b5e1c8dd31abd27bd855c78898db09f1fff14edb..a73ea759a8f90bb346e40cfb83e1c94ffe02cf10 100644 --- a/.travis.yml +++ b/.travis.yml @@ -64,7 +64,6 @@ addons: - libgstreamer-plugins-base1.0-dev - libgstreamer1.0-0:amd64 - libgstreamer1.0-dev - - libsdl2-dev - libudev-dev - wget @@ -81,6 +80,11 @@ before_install: export JOBS=$((`sysctl -n hw.ncpu`+1)); fi + # Linux needs sdl2 but not android + - if [ "${SPEC}" = "linux-g++-64" ]; then + sudo apt-get install -y libsdl2-dev; + fi + install: # linux dependencies: qt - if [ "${SPEC}" = "linux-g++-64" ]; then diff --git a/CodingStyle.cc b/CodingStyle.cc index 0555bdbb6b4a9246e79d8cb33f2a69b8de23d5e2..d50968fd0c7fa4267a7110349e9399c1d1b3cfc4 100644 --- a/CodingStyle.cc +++ b/CodingStyle.cc @@ -85,8 +85,11 @@ void CodingStyle::_methodWithManyArguments(QWidget* parent, const QString& caption, const QString& dir, Options options1, - Options options2, + Options /* options2 */, Options options3) { + // options2 is an unused method argument. + // Do not use Q_UNUSUED and do not just remove the argument name and leave the type. + // Implementataion here... } diff --git a/src/FirmwarePlugin/FirmwarePlugin.cc b/src/FirmwarePlugin/FirmwarePlugin.cc index 6638f8b23af4c2913ba11110c387761575ebbc6b..c09cf30f5620d77f76ee0bc44ed779c1bf706d6d 100644 --- a/src/FirmwarePlugin/FirmwarePlugin.cc +++ b/src/FirmwarePlugin/FirmwarePlugin.cc @@ -323,16 +323,16 @@ const QVariantList &FirmwarePlugin::toolBarIndicators(const Vehicle* vehicle) //-- Default list of indicators for all vehicles. if(_toolBarIndicatorList.size() == 0) { _toolBarIndicatorList = QVariantList({ - QVariant::fromValue(QUrl::fromUserInput("qrc:/toolbar/MultiVehicleSelector.qml")), QVariant::fromValue(QUrl::fromUserInput("qrc:/toolbar/MessageIndicator.qml")), QVariant::fromValue(QUrl::fromUserInput("qrc:/toolbar/GPSIndicator.qml")), QVariant::fromValue(QUrl::fromUserInput("qrc:/toolbar/TelemetryRSSIIndicator.qml")), QVariant::fromValue(QUrl::fromUserInput("qrc:/toolbar/RCRSSIIndicator.qml")), QVariant::fromValue(QUrl::fromUserInput("qrc:/toolbar/BatteryIndicator.qml")), + QVariant::fromValue(QUrl::fromUserInput("qrc:/toolbar/GPSRTKIndicator.qml")), QVariant::fromValue(QUrl::fromUserInput("qrc:/toolbar/ModeIndicator.qml")), QVariant::fromValue(QUrl::fromUserInput("qrc:/toolbar/VTOLModeIndicator.qml")), QVariant::fromValue(QUrl::fromUserInput("qrc:/toolbar/ArmedIndicator.qml")), - QVariant::fromValue(QUrl::fromUserInput("qrc:/toolbar/GPSRTKIndicator.qml")), + QVariant::fromValue(QUrl::fromUserInput("qrc:/toolbar/MultiVehicleSelector.qml")), QVariant::fromValue(QUrl::fromUserInput("qrc:/toolbar/LinkIndicator.qml")), }); } diff --git a/src/FirmwarePlugin/PX4/PX4ParameterFactMetaData.xml b/src/FirmwarePlugin/PX4/PX4ParameterFactMetaData.xml index c162d512751845989bb74c84c89c03bca43fccb1..aff5056af4ece4bd461fe61d7572dce606fce09d 100644 --- a/src/FirmwarePlugin/PX4/PX4ParameterFactMetaData.xml +++ b/src/FirmwarePlugin/PX4/PX4ParameterFactMetaData.xml @@ -5713,8 +5713,8 @@ the setpoint will be capped to MPC_XY_VEL_MAX - Thrust to PWM model parameter - Parameter used to model the relationship between static thrust and motor input PWM. Model is: thrust = (1-factor)*PWM + factor * PWM^2 + Thrust to motor control signal model parameter + Parameter used to model the nonlinear relationship between motor control signal (e.g. PWM) and static thrust. The model is: rel_thrust = factor * rel_signal^2 + (1-factor) * rel_signal, where rel_thrust is the normalized thrust between 0 and 1, and rel_signal is the relative motor control signal between 0 and 1. 0.0 1.0 diff --git a/src/FlightDisplay/FlightDisplayViewMap.qml b/src/FlightDisplay/FlightDisplayViewMap.qml index 5a8c378916f1a2e71deeeb8c0132c1c1124dd769..ac4b35bdf84adb9e64c60c464b052be4b67e1670 100644 --- a/src/FlightDisplay/FlightDisplayViewMap.qml +++ b/src/FlightDisplay/FlightDisplayViewMap.qml @@ -31,11 +31,6 @@ FlightMap { allowVehicleLocationCenter: !_keepVehicleCentered planView: false - onVisibleChanged: { - // I don't know what is causing this to become invisible when a connection is dropped - if(!visible) visible = true - } - property alias scaleState: mapScale.state // The following properties must be set by the consumer @@ -190,7 +185,7 @@ FlightMap { line.width: 3 line.color: "red" z: QGroundControl.zOrderTrajectoryLines - visible: true//mainIsMap + visible: mainIsMap Connections { target: QGroundControl.multiVehicleManager @@ -320,9 +315,9 @@ FlightMap { property bool inGotoFlightMode: activeVehicle ? activeVehicle.flightMode === activeVehicle.gotoFlightMode : false onInGotoFlightModeChanged: { - if (!inGotoFlightMode && visible) { + if (!inGotoFlightMode && gotoLocationItem.visible) { // Hide goto indicator when vehicle falls out of guided mode - visible = false + gotoLocationItem.visible = false } } @@ -330,7 +325,7 @@ FlightMap { target: mainWindow onActiveVehicleChanged: { if (!activeVehicle) { - visible = false + gotoLocationItem.visible = false } } } @@ -368,7 +363,7 @@ FlightMap { target: mainWindow onActiveVehicleChanged: { if (!activeVehicle) { - visible = false + orbitMapCircle.visible = false } } } diff --git a/src/ui/toolbar/MainToolBar.qml b/src/ui/toolbar/MainToolBar.qml index 0d12bf021891d28b018b56dd4434a77dec1d81c7..3560ae320e195dfa72c6289edcca6e3155eed465 100644 --- a/src/ui/toolbar/MainToolBar.qml +++ b/src/ui/toolbar/MainToolBar.qml @@ -50,7 +50,7 @@ Item { anchors.bottomMargin: 1 anchors.rightMargin: ScreenTools.defaultFontPixelWidth / 2 anchors.fill: parent - spacing: ScreenTools.defaultFontPixelWidth * 2 + spacing: ScreenTools.defaultFontPixelWidth / 2 ButtonGroup { buttons: viewRow.children diff --git a/src/ui/toolbar/MultiVehicleSelector.qml b/src/ui/toolbar/MultiVehicleSelector.qml index 5937e9f62b9e8887ca10d57e8ccded0d6e9609de..36b8e52bcae80373cb5cb27926ecd25929a77dd8 100644 --- a/src/ui/toolbar/MultiVehicleSelector.qml +++ b/src/ui/toolbar/MultiVehicleSelector.qml @@ -18,61 +18,49 @@ import QGroundControl.ScreenTools 1.0 import QGroundControl.Palette 1.0 //------------------------------------------------------------------------- -//-- Mode Indicator -Item { +//-- Multiple Vehicle Selector +QGCComboBox { anchors.top: parent.top anchors.bottom: parent.bottom - visible: _multiVehicles - width: _multiVehicles ? multiVehicleSelector.width : 0 + font.pointSize: ScreenTools.mediumFontPointSize + currentIndex: -1 + sizeToContents: true + model: _vehicleModel + visible: _multipleVehicles - property bool _multiVehicles: activeVehicle ? QGroundControl.multiVehicleManager.vehicles.count > 1 : false + property var _activeVehicle: QGroundControl.multiVehicleManager.activeVehicle + property bool _multipleVehicles: _activeVehicle ? QGroundControl.multiVehicleManager.vehicles.count > 1 : false + property var _vehicleModel: [ ] Connections { target: QGroundControl.multiVehicleManager.vehicles - onCountChanged: multiVehicleSelector.updatemultiVehiclesMenu() + onCountChanged: _updateVehicleModel() } - QGCLabel { - id: multiVehicleSelector - text: "Vehicle " + (activeVehicle ? activeVehicle.id : "None") - font.pointSize: ScreenTools.mediumFontPointSize - color: qgcPal.buttonText - anchors.verticalCenter: parent.verticalCenter - QGCMenu { - id: multiVehiclesMenu - } - Component { - id: multiVehicleMenuItemComponent - QGCMenuItem { - onTriggered: QGroundControl.multiVehicleManager.activeVehicle = vehicle - property int vehicleId: Number(text.split(" ")[1]) - property var vehicle: QGroundControl.multiVehicleManager.getVehicleById(vehicleId) - } - } - property var multiVehiclesMenuItems: [] - function updatemultiVehiclesMenu() { - if (_multiVehicles) { - // Remove old menu items - for (var i = 0; i < multiVehiclesMenuItems.length; i++) { - multiVehiclesMenu.removeItem(multiVehiclesMenuItems[i]) - } - multiVehiclesMenuItems.length = 0 - // Add new items - for (i = 0; i < QGroundControl.multiVehicleManager.vehicles.count; i++) { - var vehicle = QGroundControl.multiVehicleManager.vehicles.get(i) - var menuItem = multiVehicleMenuItemComponent.createObject(null, { "text": "Vehicle " + vehicle.id }) - multiVehiclesMenuItems.push(menuItem) - multiVehiclesMenu.insertItem(i, menuItem) + Component.onCompleted: _updateVehicleModel() + + function _updateVehicleModel() { + var newCurrentIndex = -1 + var newModel = [ ] + if (_multipleVehicles) { + for (var i = 0; i < QGroundControl.multiVehicleManager.vehicles.count; i++) { + var vehicle = QGroundControl.multiVehicleManager.vehicles.get(i) + newModel.push(qsTr("Vehicle") + " " + vehicle.id) + + if (vehicle.id === _activeVehicle.id) { + newCurrentIndex = i } } } - Component.onCompleted: { - multiVehicleSelector.updatemultiVehiclesMenu() - } + currentIndex = -1 + _vehicleModel = newModel + currentIndex = newCurrentIndex } - MouseArea { - visible: _multiVehicles - anchors.fill: parent - onClicked: multiVehiclesMenu.popup() + + onActivated: { + var vehicleId = textAt(index).split(" ")[1] + var vehicle = QGroundControl.multiVehicleManager.getVehicleById(vehicleId) + QGroundControl.multiVehicleManager.activeVehicle = vehicle } } +