diff --git a/custom-example/README.jpg b/custom-example/README.jpg new file mode 100644 index 0000000000000000000000000000000000000000..ea4f0c77a8c1f29686002378286d949bdf4c4d4c Binary files /dev/null and b/custom-example/README.jpg differ diff --git a/custom-example/README.md b/custom-example/README.md index eee240f38dba37c32d0a847729bb3b722452b6d6..529d6d290917018ad5574dcb9fa77a1733edb4f9 100644 --- a/custom-example/README.md +++ b/custom-example/README.md @@ -2,27 +2,26 @@ ## Custom Build Example -To build this sample custom version, simply rename the directory from `custom-example` to `custom` before running `qmake` (or launching Qt Creator.) The build system will automatically find anything in `custom` and incorporate it into the build. If you had already run a build before renaming the directory, delete the build directory before running `qmake`. To restore the build to a stock QGroundControl one, rename the directory back to `custom-example` (making sure to clean the build directory again.) +To build this sample custom version: -### Custom Builds +* Clean you build directory of any previous build +* Rename the directory from `custom-example` to `custom` +* Change to the `custom` directory +* Run `python updateqrc.py` +* Build QGC -The root project file (`qgroundcontrol.pro`) will look and see if `custom/custom.pri` exists. If it does, it will load it before anything else is setup. This allows you to modify the build in any way necessary for a custom build. This example shows you how to: +![Custom Build Screenshot](README.jpg) -* Fully brand your build -* Define a single flight stack to avoid carrying over unnecessary code -* Implement your own, autopilot and firmware plugin overrides -* Implement your own camera manager and plugin overrides -* Implement your own QtQuick interface module -* Implement your own toolbar, toolbar indicators and UI navigation -* Implement your own Fly View overlay (and how to hide elements from QGC such as the flight widget) -* Implement your own, custom QtQuick camera control -* Implement your own, custom Pre-flight Checklist -* Define your own resources for all of the above +More details on what a custom build is and how to create your own can be found in the [QGC Dev Guide](https://dev.qgroundcontrol.com/en/custom_build/custom_build.html). -Note that within `qgroundcontrol.pro`, most main build steps are surrounded by flags, which you can define to override them. For example, if you want to have your own Android build, done in some completely different way, you simply: +The main features of this example: -``` -DEFINES += DISABLE_BUILTIN_ANDROID -``` +* Assumes an "Off The Shelf" purchased commercial vehicle. This means most vehicle setup is hidden from the user since they should mostly never need to adjust those things. They would be set up correctly by the vehicle producing company prior to sale. +* The above assumption cause the QGC UI to adjust and not show various things. Providing an even simpler experience to the user. +* The full experience continues to be available in "Advanced Mode". +* Brands the build with various custom images and custom color palette which matches corporate branding of the theoretical commercial company this build is for. +* Customizes portions of the interface such as you can see in the above screenshot which shows a custom instrument widget replacing the standard QGC ui. +* It also overrides various QGC Application settings to hide some settings the users shouldn't modify as well as adjusting defaults for others. +* The source code is fully commented to explain what and why it is doing things. -With this defined within your `custom.pri` file, it is up to you to define how to do the Android build. You can either replace the entire process or prepare it before invoking QGC’s own Android project file on your own. You would do this if you want to have your own branding within the Android manifest. The same applies to iOS (`DISABLE_BUILTIN_IOS`). +> Important Note: This custom build is not automatically built each time regular QGC code changes. This can mean that it may fall out of date with the latest changes in QGC code. This can show up as the `python updateqrc.py` steps failing due to upstream resource changes. Or possibly fail to compile because the plugin mechanism for custom builds has changed. If this happens please notify the QGC devs and they will bring it up to date. Or even better, submit a pull for the fix yourself! \ No newline at end of file diff --git a/custom-example/custom.pri b/custom-example/custom.pri index ab24fd86fec77cb15340efc48e1d1a2196ca8b44..5f68ac774c90eadad1f2c806cb1c683ec2bd9023 100644 --- a/custom-example/custom.pri +++ b/custom-example/custom.pri @@ -35,36 +35,32 @@ CONFIG += QGC_DISABLE_PX4_PLUGIN_FACTORY DEFINES += CUSTOMHEADER=\"\\\"CustomPlugin.h\\\"\" DEFINES += CUSTOMCLASS=CustomPlugin -TARGET = CustomQGC -DEFINES += QGC_APPLICATION_NAME=\"\\\"CustomQGC\\\"\" +TARGET = MyGroundStation +DEFINES += QGC_APPLICATION_NAME='"\\\"Custom QGroundControl\\\""' DEFINES += QGC_ORG_NAME=\"\\\"qgroundcontrol.org\\\"\" DEFINES += QGC_ORG_DOMAIN=\"\\\"org.qgroundcontrol\\\"\" -QGC_APP_NAME = "Custom GS" -QGC_BINARY_NAME = "CustomQGC" +QGC_APP_NAME = "Custom QGroundControl" +QGC_BINARY_NAME = "CustomQGroundControl" QGC_ORG_NAME = "Custom" -QGC_ORG_DOMAIN = "org.qgroundcontrol" -QGC_APP_DESCRIPTION = "Custom QGC Ground Station" -QGC_APP_COPYRIGHT = "Copyright (C) 2019 QGroundControl Development Team. All rights reserved." +QGC_ORG_DOMAIN = "org.custom" +QGC_APP_DESCRIPTION = "Custom QGroundControl" +QGC_APP_COPYRIGHT = "Copyright (C) 2020 QGroundControl Development Team. All rights reserved." # Our own, custom resources RESOURCES += \ - $$QGCROOT/custom/custom.qrc + $$PWD/custom.qrc QML_IMPORT_PATH += \ - $$QGCROOT/custom/res + $$PWD/res # Our own, custom sources SOURCES += \ $$PWD/src/CustomPlugin.cc \ - $$PWD/src/CustomQuickInterface.cc \ - $$PWD/src/CustomVideoManager.cc HEADERS += \ $$PWD/src/CustomPlugin.h \ - $$PWD/src/CustomQuickInterface.h \ - $$PWD/src/CustomVideoManager.h INCLUDEPATH += \ $$PWD/src \ @@ -73,20 +69,16 @@ INCLUDEPATH += \ # Custom Firmware/AutoPilot Plugin INCLUDEPATH += \ - $$QGCROOT/custom/src/FirmwarePlugin \ - $$QGCROOT/custom/src/AutoPilotPlugin + $$PWD/src/FirmwarePlugin \ + $$PWD/src/AutoPilotPlugin HEADERS+= \ - $$QGCROOT/custom/src/AutoPilotPlugin/CustomAutoPilotPlugin.h \ - $$QGCROOT/custom/src/FirmwarePlugin/CustomCameraControl.h \ - $$QGCROOT/custom/src/FirmwarePlugin/CustomCameraManager.h \ - $$QGCROOT/custom/src/FirmwarePlugin/CustomFirmwarePlugin.h \ - $$QGCROOT/custom/src/FirmwarePlugin/CustomFirmwarePluginFactory.h \ + $$PWD/src/AutoPilotPlugin/CustomAutoPilotPlugin.h \ + $$PWD/src/FirmwarePlugin/CustomFirmwarePlugin.h \ + $$PWD/src/FirmwarePlugin/CustomFirmwarePluginFactory.h \ SOURCES += \ - $$QGCROOT/custom/src/AutoPilotPlugin/CustomAutoPilotPlugin.cc \ - $$QGCROOT/custom/src/FirmwarePlugin/CustomCameraControl.cc \ - $$QGCROOT/custom/src/FirmwarePlugin/CustomCameraManager.cc \ - $$QGCROOT/custom/src/FirmwarePlugin/CustomFirmwarePlugin.cc \ - $$QGCROOT/custom/src/FirmwarePlugin/CustomFirmwarePluginFactory.cc \ + $$PWD/src/AutoPilotPlugin/CustomAutoPilotPlugin.cc \ + $$PWD/src/FirmwarePlugin/CustomFirmwarePlugin.cc \ + $$PWD/src/FirmwarePlugin/CustomFirmwarePluginFactory.cc \ diff --git a/custom-example/custom.qrc b/custom-example/custom.qrc index 1c8f6a95fc1ee24f5fc130ead469df7d36061f80..c277e0fd6e72037a0ac820871be33bf9f8dc8517 100644 --- a/custom-example/custom.qrc +++ b/custom-example/custom.qrc @@ -1,47 +1,24 @@ - res/MainToolbar/CustomArmedIndicator.qml - res/MainToolbar/CustomBatteryIndicator.qml - res/CustomCameraControl.qml - res/CustomFlyView.qml - res/MainToolbar/CustomGPSIndicator.qml - res/MainToolbar/CustomMainToolBar.qml - res/MainToolbar/CustomMainToolBarIndicators.qml - res/MainToolbar/CustomModeIndicator.qml - res/MainToolbar/CustomMultiVehicleSelector.qml - res/MainToolbar/CustomRCRSSIIndicator.qml - res/PairingIndicator.qml - res/PreFlightCheckList.qml + res/CustomFlyViewOverlay.qml res/Images/altitude.svg res/Images/attitude_crosshair.svg res/Images/attitude_dial.svg res/Images/attitude_pointer.svg - res/Images/camera_photo.svg - res/Images/camera_settings.svg - res/Images/camera_video.svg res/Images/chronometer.svg res/Images/compass_needle.svg res/Images/compass_pointer.svg res/Images/distance.svg - res/Images/gimbal_icon.svg - res/Images/gimbal_pitch_indoors.svg - res/Images/gimbal_pitch_outdoors.svg - res/Images/gimbal_position.svg res/Images/horizontal_speed.svg res/Images/microSD.svg res/Images/odometer.svg - res/Images/PairingButton.svg - res/Images/PairingConnected.svg - res/Images/PairingError.svg - res/Images/PairingIcon.svg - res/Images/thermal-brightness.svg - res/Images/thermal-palette.svg - res/Images/thermal-pip.svg - res/Images/thermal-standard.svg res/Images/vertical_speed.svg - res/Images/void.png + res/Images/CustomAppIcon.png + + + res/Images/CustomVehicleIcon.svg res/Custom/Widgets/CustomArtificialHorizon.qml @@ -54,8 +31,4 @@ res/Custom/Widgets/CustomVehicleButton.qml res/Custom/Widgets/qmldir - - res/Custom/Camera/qmldir - res/Custom/Camera/ZoomControl.qml - diff --git a/custom-example/qgcresources.exclusion b/custom-example/qgcresources.exclusion new file mode 100644 index 0000000000000000000000000000000000000000..24807753bc3b31321840c4abc50513cc7773c77e --- /dev/null +++ b/custom-example/qgcresources.exclusion @@ -0,0 +1,2 @@ + src/ui/toolbar/Images/PaperPlane.svg + diff --git a/custom-example/qgcresources.qrc b/custom-example/qgcresources.qrc new file mode 100644 index 0000000000000000000000000000000000000000..02caa15f2a8979682fb4f2579bf3ccefaf5bc707 --- /dev/null +++ b/custom-example/qgcresources.qrc @@ -0,0 +1,103 @@ + + + ../resources/fonts/OpenSans-Regular.ttf + ../resources/fonts/OpenSans-Semibold.ttf + ../resources/fonts/NanumGothic-Regular.ttf + ../resources/fonts/NanumGothic-Bold.ttf + + + ../resources/action.svg + ../resources/Antenna_RC.svg + ../resources/Antenna_T.svg + ../resources/ArrowDown.svg + ../resources/ArrowRight.svg + ../resources/buttonLeft.svg + ../resources/buttonRight.svg + ../resources/cancel.svg + ../resources/clockwise-arrow.svg + ../resources/counter-clockwise-arrow.svg + ../resources/chevron-down.svg + ../resources/chevron-up.svg + ../resources/DropArrow.svg + ../resources/gear-black.svg + ../resources/gear-white.svg + ../resources/helicoptericon.svg + ../resources/JoystickBezel.png + ../resources/JoystickBezelLight.png + ../resources/land.svg + ../resources/LockClosed.svg + ../resources/LockOpen.svg + ../resources/notile.png + ../resources/Pause.svg + ../resources/pause-mission.svg + ../resources/Play.svg + ../resources/PowerButton.svg + ../resources/QGCLogoBlack.svg + ../resources/QGCLogoFull.svg + ../resources/QGCLogoWhite.svg + ../resources/QGCLogoArrow.svg + ../resources/QGroundControlConnect.svg + ../resources/rtl.svg + ../resources/SplashScreen.png + ../resources/Stop.svg + ../resources/takeoff.svg + ../resources/TrashDelete.svg + ../resources/waves.svg + ../resources/wind-guru.svg + ../resources/wind-rose.svg + ../resources/wind-roseBlack.svg + ../resources/wind-rose-arrow.svg + ../resources/XDelete.svg + ../resources/XDeleteBlack.svg + ../resources/waypoint.svg + ../resources/icons/qgroundcontrol.ico + + + ../resources/firmware/3drradio.png + ../resources/firmware/apm.png + ../resources/firmware/px4.png + + + ../resources/calibration/accel_back.png + ../resources/calibration/accel_down.png + ../resources/calibration/accel_front.png + ../resources/calibration/accel_left.png + ../resources/calibration/accel_right.png + ../resources/calibration/accel_up.png + + + ../resources/calibration/mode1/radioCenter.png + ../resources/calibration/mode1/radioHome.png + ../resources/calibration/mode1/radioPitchDown.png + ../resources/calibration/mode1/radioPitchUp.png + ../resources/calibration/mode1/radioRollLeft.png + ../resources/calibration/mode1/radioRollRight.png + ../resources/calibration/mode1/radioSwitchMinMax.png + ../resources/calibration/mode1/radioThrottleDown.png + ../resources/calibration/mode1/radioThrottleUp.png + ../resources/calibration/mode1/radioYawLeft.png + ../resources/calibration/mode1/radioYawRight.png + + + ../resources/calibration/mode2/radioCenter.png + ../resources/calibration/mode2/radioHome.png + ../resources/calibration/mode2/radioPitchDown.png + ../resources/calibration/mode2/radioPitchUp.png + ../resources/calibration/mode2/radioRollLeft.png + ../resources/calibration/mode2/radioRollRight.png + ../resources/calibration/mode2/radioSwitchMinMax.png + ../resources/calibration/mode2/radioThrottleDown.png + ../resources/calibration/mode2/radioThrottleUp.png + ../resources/calibration/mode2/radioYawLeft.png + ../resources/calibration/mode2/radioYawRight.png + + + ../resources/SDL_GameControllerDB/gamecontrollerdb.txt + + + ../resources/audio/alert.wav + + + ../resources/opengl/buglist.json + + diff --git a/custom-example/qgroundcontrol.exclusion b/custom-example/qgroundcontrol.exclusion new file mode 100644 index 0000000000000000000000000000000000000000..e69de29bb2d1d6434b8b29ae775ad8c2e48c5391 diff --git a/custom-example/qgroundcontrol.qrc b/custom-example/qgroundcontrol.qrc new file mode 100644 index 0000000000000000000000000000000000000000..c0f7bae9722c395c1aab76794d01661ce6c67134 --- /dev/null +++ b/custom-example/qgroundcontrol.qrc @@ -0,0 +1,314 @@ + + + ../src/FactSystem/FactSystemTest.qml + + + ../src/ui/toolbar/ArmedIndicator.qml + ../src/ui/toolbar/BatteryIndicator.qml + ../src/ui/toolbar/GPSIndicator.qml + ../src/ui/toolbar/GPSRTKIndicator.qml + ../src/ui/toolbar/JoystickIndicator.qml + ../src/ui/toolbar/LinkIndicator.qml + ../src/ui/toolbar/MainToolBar.qml + ../src/ui/toolbar/MainToolBarIndicators.qml + ../src/ui/toolbar/MessageIndicator.qml + ../src/ui/toolbar/ModeIndicator.qml + ../src/ui/toolbar/MultiVehicleSelector.qml + ../src/ui/toolbar/RCRSSIIndicator.qml + ../src/ui/toolbar/ROIIndicator.qml + ../src/ui/toolbar/TelemetryRSSIIndicator.qml + ../src/ui/toolbar/VTOLModeIndicator.qml + + + ../src/FlightDisplay/DefaultChecklist.qml + ../src/FlightDisplay/MultiRotorChecklist.qml + ../src/FlightDisplay/FixedWingChecklist.qml + ../src/FlightDisplay/VTOLChecklist.qml + ../src/FlightDisplay/RoverChecklist.qml + ../src/FlightDisplay/SubChecklist.qml + + + ../src/QmlControls/HeightIndicator.qml + ../src/QmlControls/QGCDynamicObjectManager.qml + ../src/QmlControls/QGCOptionsComboBox.qml + ../src/PlanView/TransectStyleMapVisuals.qml + ../src/MissionManager/MapLineArrow.qml + ../src/FlightMap/MapItems/SplitIndicator.qml + ../src/AnalyzeView/AnalyzeView.qml + ../src/ui/AppSettings.qml + ../src/ui/preferences/BluetoothSettings.qml + ../src/FlightMap/Widgets/CameraPageWidget.qml + ../src/PlanView/CorridorScanEditor.qml + ../src/ViewWidgets/CustomCommandWidget.qml + ../src/ui/preferences/DebugWindow.qml + ../src/AutoPilotPlugins/Common/ESP8266Component.qml + ../src/AutoPilotPlugins/Common/ESP8266ComponentSummary.qml + ../src/ui/ExitWithErrorWindow.qml + ../src/VehicleSetup/FirmwareUpgrade.qml + ../src/FlightDisplay/FlightDisplayViewDummy.qml + ../src/FlightDisplay/FlightDisplayViewUVC.qml + ../src/PlanView/FWLandingPatternEditor.qml + ../src/ui/preferences/GeneralSettings.qml + ../src/AnalyzeView/GeoTagPage.qml + ../src/FlightMap/Widgets/HealthPageWidget.qml + ../src/ui/preferences/HelpSettings.qml + ../src/VehicleSetup/JoystickConfig.qml + ../src/VehicleSetup/JoystickConfigAdvanced.qml + ../src/VehicleSetup/JoystickConfigButtons.qml + ../src/VehicleSetup/JoystickConfigCalibration.qml + ../src/VehicleSetup/JoystickConfigGeneral.qml + ../src/ui/preferences/LinkSettings.qml + ../src/AnalyzeView/LogDownloadPage.qml + ../src/ui/preferences/LogReplaySettings.qml + ../src/ui/MainRootWindow.qml + ../src/AnalyzeView/MavlinkConsolePage.qml + ../src/AnalyzeView/MAVLinkInspectorPage.qml + ../src/ui/preferences/MavlinkSettings.qml + ../src/Microhard/MicrohardSettings.qml + ../src/PlanView/MissionSettingsEditor.qml + ../src/ui/preferences/MockLink.qml + ../src/ui/preferences/MockLinkSettings.qml + ../src/AutoPilotPlugins/Common/MotorComponent.qml + ../src/QtLocationPlugin/QMLControl/OfflineMap.qml + ../src/PlanView/PlanToolBar.qml + ../src/PlanView/PlanToolBarIndicators.qml + ../src/PlanView/PlanView.qml + ../src/FlightDisplay/PreFlightCheckList.qml + ../src/VehicleSetup/PX4FlowSensor.qml + ../src/FlightMap/Widgets/QGCInstrumentWidget.qml + ../src/FlightMap/Widgets/QGCInstrumentWidgetAlternate.qml + ../src/QmlControls/QGCViewDialogContainer.qml + ../src/AnalyzeView/AnalyzePage.qml + ../src/QmlControls/AppMessages.qml + ../src/QmlControls/AxisMonitor.qml + ../src/PlanView/CameraCalcCamera.qml + ../src/PlanView/CameraCalcGrid.qml + ../src/PlanView/CameraSection.qml + ../src/QmlControls/ClickableColor.qml + ../src/PlanView/CorridorScanMapVisual.qml + ../src/QmlControls/DeadMouseArea.qml + ../src/QmlControls/DropButton.qml + ../src/QmlControls/DropPanel.qml + ../src/QmlControls/EditPositionDialog.qml + ../src/QmlControls/ExclusiveGroupItem.qml + ../src/QmlControls/FactSliderPanel.qml + ../src/QmlControls/FileButton.qml + ../src/QmlControls/FlightModeDropdown.qml + ../src/QmlControls/FlightModeMenu.qml + ../src/PlanView/FWLandingPatternMapVisual.qml + ../src/PlanView/GeoFenceEditor.qml + ../src/PlanView/GeoFenceMapVisuals.qml + ../src/QmlControls/IndicatorButton.qml + ../src/QmlControls/InstrumentValue.qml + ../src/QmlControls/InstrumentValueArea.qml + ../src/QmlControls/InstrumentValueEditDialog.qml + ../src/QmlControls/JoystickThumbPad.qml + ../src/QmlControls/KMLOrSHPFileDialog.qml + ../src/QmlControls/LogReplayStatusBar.qml + ../src/QmlControls/MainWindowSavedState.qml + ../src/QmlControls/MAVLinkChart.qml + ../src/QmlControls/MAVLinkMessageButton.qml + ../src/QmlControls/MissionCommandDialog.qml + ../src/PlanView/MissionItemEditor.qml + ../src/QmlControls/MissionItemIndexLabel.qml + ../src/PlanView/MissionItemMapVisual.qml + ../src/PlanView/MissionItemStatus.qml + ../src/QmlControls/ModeSwitchDisplay.qml + ../src/QmlControls/MultiRotorMotorDisplay.qml + ../src/QmlControls/OfflineMapButton.qml + ../src/QmlControls/PageView.qml + ../src/QmlControls/ParameterEditor.qml + ../src/QmlControls/ParameterEditorDialog.qml + ../src/QmlControls/PIDTuning.qml + ../src/PlanView/PlanEditToolbar.qml + ../src/QmlControls/PreFlightCheckButton.qml + ../src/QmlControls/PreFlightCheckGroup.qml + ../src/QmlControls/PreFlightCheckModel.qml + ../src/QmlControls/QGCButton.qml + ../src/QmlControls/QGCCheckBox.qml + ../src/QmlControls/QGCColoredImage.qml + ../src/QmlControls/QGCComboBox.qml + ../src/QmlControls/QGCFileDialog.qml + ../src/QmlControls/QGCFlickable.qml + ../src/QmlControls/QGCFlickableHorizontalIndicator.qml + ../src/QmlControls/QGCFlickableVerticalIndicator.qml + ../src/QmlControls/QGCGroupBox.qml + ../src/QmlControls/QGCHoverButton.qml + ../src/QmlControls/QGCLabel.qml + ../src/QmlControls/QGCListView.qml + ../src/MissionManager/QGCMapCircleVisuals.qml + ../src/QmlControls/QGCMapLabel.qml + ../src/MissionManager/QGCMapPolygonVisuals.qml + ../src/MissionManager/QGCMapPolylineVisuals.qml + ../src/QmlControls/QGCMenu.qml + ../src/QmlControls/QGCMenuItem.qml + ../src/QmlControls/QGCMenuSeparator.qml + ../src/QmlControls/QGCMouseArea.qml + ../src/QmlControls/QGCMovableItem.qml + ../src/QmlControls/QGCPopupDialog.qml + ../src/QmlControls/QGCPopupDialogContainer.qml + ../src/QmlControls/QGCPipable.qml + ../src/QmlControls/QGCRadioButton.qml + ../src/QmlControls/QGCSlider.qml + ../src/QmlControls/QGCSwitch.qml + ../src/QmlControls/QGCTabBar.qml + ../src/QmlControls/QGCTabButton.qml + ../src/QmlControls/QGCTextField.qml + ../src/QmlControls/QGCToolBarButton.qml + ../src/QmlControls/QGCViewDialog.qml + ../src/QmlControls/QGCViewMessage.qml + ../src/QmlControls/QGroundControl/Controls/qmldir + ../src/PlanView/RallyPointEditorHeader.qml + ../src/PlanView/RallyPointItemEditor.qml + ../src/PlanView/RallyPointMapVisuals.qml + ../src/QmlControls/RCChannelMonitor.qml + ../src/QmlControls/RCToParamDialog.qml + ../src/QmlControls/RoundButton.qml + ../src/QmlControls/SectionHeader.qml + ../src/AutoPilotPlugins/Common/SetupPage.qml + ../src/ui/toolbar/SignalStrength.qml + ../src/PlanView/SimpleItemMapVisual.qml + ../src/QmlControls/SliderSwitch.qml + ../src/PlanView/StructureScanMapVisual.qml + ../src/QmlControls/SubMenuButton.qml + ../src/PlanView/SurveyMapVisual.qml + ../src/PlanView/TerrainStatus.qml + ../src/PlanView/TakeoffItemMapVisual.qml + ../src/QmlControls/ToolStrip.qml + ../src/PlanView/TransectStyleComplexItemStats.qml + ../src/QmlControls/VehicleRotationCal.qml + ../src/QmlControls/VehicleSummaryRow.qml + ../src/ViewWidgets/ViewWidget.qml + ../src/FactSystem/FactControls/AltitudeFactTextField.qml + ../src/FactSystem/FactControls/FactBitmask.qml + ../src/FactSystem/FactControls/FactCheckBox.qml + ../src/FactSystem/FactControls/FactComboBox.qml + ../src/FactSystem/FactControls/FactLabel.qml + ../src/FactSystem/FactControls/FactTextField.qml + ../src/FactSystem/FactControls/FactTextFieldGrid.qml + ../src/FactSystem/FactControls/FactTextFieldRow.qml + ../src/FactSystem/FactControls/FactTextFieldSlider.qml + ../src/FactSystem/FactControls/FactValueSlider.qml + ../src/QmlControls/QGroundControl/FactControls/qmldir + ../src/FlightDisplay/FlightDisplayView.qml + ../src/FlightDisplay/FlightDisplayViewMap.qml + ../src/FlightDisplay/FlightDisplayViewVideo.qml + ../src/FlightDisplay/FlightDisplayViewWidgets.qml + ../src/FlightDisplay/GuidedActionConfirm.qml + ../src/FlightDisplay/GuidedActionList.qml + ../src/FlightDisplay/GuidedActionsController.qml + ../src/FlightDisplay/GuidedAltitudeSlider.qml + ../src/FlightDisplay/MultiVehicleList.qml + ../src/FlightDisplay/PreFlightBatteryCheck.qml + ../src/FlightDisplay/PreFlightGPSCheck.qml + ../src/FlightDisplay/PreFlightRCCheck.qml + ../src/FlightDisplay/PreFlightSensorsHealthCheck.qml + ../src/FlightDisplay/PreFlightSoundCheck.qml + ../src/FlightDisplay/TerrainProgress.qml + ../src/QmlControls/QGroundControl/FlightDisplay/qmldir + ../src/FlightMap/MapItems/CameraTriggerIndicator.qml + ../src/FlightMap/Widgets/CenterMapDropButton.qml + ../src/FlightMap/Widgets/CenterMapDropPanel.qml + ../src/FlightMap/Widgets/CompassRing.qml + ../src/FlightMap/MapItems/CustomMapItems.qml + ../src/FlightMap/FlightMap.qml + ../src/FlightMap/Widgets/InstrumentSwipeView.qml + ../src/FlightMap/Widgets/MapFitFunctions.qml + ../src/FlightMap/MapScale.qml + ../src/FlightMap/MapItems/MissionItemIndicator.qml + ../src/FlightMap/MapItems/MissionItemIndicatorDrag.qml + ../src/FlightMap/MapItems/MissionItemView.qml + ../src/FlightMap/MapItems/MissionLineView.qml + ../src/FlightMap/MapItems/PlanMapItems.qml + ../src/FlightMap/MapItems/PolygonEditor.qml + ../src/FlightMap/Widgets/QGCArtificialHorizon.qml + ../src/FlightMap/Widgets/QGCAttitudeHUD.qml + ../src/FlightMap/Widgets/QGCAttitudeWidget.qml + ../src/FlightMap/Widgets/QGCCompassWidget.qml + ../src/FlightMap/Widgets/QGCPitchIndicator.qml + ../src/FlightMap/QGCVideoBackground.qml + ../src/QmlControls/QGroundControl/FlightMap/qmldir + ../src/FlightMap/MapItems/VehicleMapItem.qml + ../src/QmlControls/QGroundControl/ScreenTools/qmldir + ../src/QmlControls/ScreenTools.qml + ../src/QmlControls/QmlTest.qml + ../src/AutoPilotPlugins/Common/RadioComponent.qml + ../src/ui/preferences/SerialSettings.qml + ../src/VehicleSetup/SetupParameterEditor.qml + ../src/VehicleSetup/SetupView.qml + ../src/PlanView/SimpleItemEditor.qml + ../src/PlanView/StructureScanEditor.qml + ../src/PlanView/SurveyItemEditor.qml + ../src/AutoPilotPlugins/Common/SyslinkComponent.qml + ../src/Taisync/TaisyncSettings.qml + ../src/ui/preferences/TcpSettings.qml + ../src/test.qml + ../src/ui/preferences/UdpSettings.qml + ../src/FlightMap/Widgets/ValuePageWidget.qml + ../src/VehicleSetup/VehicleSummary.qml + ../src/FlightMap/Widgets/VibrationPageWidget.qml + ../src/FlightMap/Widgets/VideoPageWidget.qml + ../src/FlightDisplay/VirtualJoystick.qml + ../src/PlanView/VTOLLandingPatternMapVisual.qml + ../src/PlanView/VTOLLandingPatternEditor.qml + ../src/QmlControls/QGroundControl/Specific/qmldir + ../src/QmlControls/QGroundControl/Specific/StartupWizard.qml + ../src/QmlControls/QGroundControl/Specific/BaseStartupWizardPage.qml + ../src/QmlControls/QGroundControl/Specific/UnitsWizardPage.qml + + + ../src/Settings/ADSBVehicleManager.SettingsGroup.json + ../src/Settings/APMMavlinkStreamRate.SettingsGroup.json + ../src/Settings/App.SettingsGroup.json + ../src/Settings/AutoConnect.SettingsGroup.json + ../src/Settings/BrandImage.SettingsGroup.json + ../src/MissionManager/BreachReturn.FactMetaData.json + ../src/MissionManager/CameraCalc.FactMetaData.json + ../src/MissionManager/CameraSection.FactMetaData.json + ../src/MissionManager/CameraSpec.FactMetaData.json + ../src/MissionManager/CorridorScan.SettingsGroup.json + ../src/QmlControls/EditPositionDialog.FactMetaData.json + ../src/Settings/FirmwareUpgrade.SettingsGroup.json + ../src/Settings/FlightMap.SettingsGroup.json + ../src/Settings/FlyView.SettingsGroup.json + ../src/MissionManager/FWLandingPattern.FactMetaData.json + ../src/MissionManager/MavCmdInfoCommon.json + ../src/MissionManager/MavCmdInfoFixedWing.json + ../src/MissionManager/MavCmdInfoMultiRotor.json + ../src/MissionManager/MavCmdInfoRover.json + ../src/MissionManager/MavCmdInfoSub.json + ../src/MissionManager/MavCmdInfoVTOL.json + ../src/MissionManager/MissionSettings.FactMetaData.json + ../src/Settings/OfflineMaps.SettingsGroup.json + ../src/Settings/PlanView.SettingsGroup.json + ../src/MissionManager/QGCMapCircle.Facts.json + ../src/MissionManager/RallyPoint.FactMetaData.json + ../src/QmlControls/RCToParamDialog.FactMetaData.json + ../src/Settings/RTK.SettingsGroup.json + ../src/MissionManager/SpeedSection.FactMetaData.json + ../src/MissionManager/StructureScan.SettingsGroup.json + ../src/MissionManager/Survey.SettingsGroup.json + ../src/MissionManager/TransectStyle.SettingsGroup.json + ../src/Settings/Units.SettingsGroup.json + ../src/comm/USBBoardInfo.json + ../src/Vehicle/BatteryFact.json + ../src/Vehicle/ClockFact.json + ../src/Vehicle/DistanceSensorFact.json + ../src/Vehicle/EstimatorStatusFactGroup.json + ../src/Vehicle/GPSFact.json + ../src/Vehicle/GPSRTKFact.json + ../src/Vehicle/SetpointFact.json + ../src/Vehicle/SubmarineFact.json + ../src/Vehicle/TemperatureFact.json + ../src/Vehicle/TerrainFactGroup.json + ../src/Vehicle/VehicleFact.json + ../src/Vehicle/VibrationFact.json + ../src/Vehicle/WindFact.json + ../src/Settings/Video.SettingsGroup.json + ../src/MissionManager/VTOLLandingPattern.FactMetaData.json + + + ../src/comm/APMArduSubMockLink.params + ../src/comm/PX4MockLink.params + + diff --git a/custom-example/res/CustomCameraControl.qml b/custom-example/res/CustomCameraControl.qml deleted file mode 100644 index d28d336c19fc8051bf3baa7802133406a247cb3f..0000000000000000000000000000000000000000 --- a/custom-example/res/CustomCameraControl.qml +++ /dev/null @@ -1,1029 +0,0 @@ -/**************************************************************************** - * - * (c) 2009-2019 QGROUNDCONTROL PROJECT - * - * QGroundControl is licensed according to the terms in the file - * COPYING.md in the root of the source code directory. - * - * @file - * @author Gus Grubba - */ - -import QtQuick 2.11 -import QtQuick.Controls 2.4 -import QtQuick.Layouts 1.11 -import QtQuick.Dialogs 1.3 -import QtGraphicalEffects 1.0 - -import QtMultimedia 5.9 -import QtPositioning 5.2 - -import QGroundControl 1.0 -import QGroundControl.Controls 1.0 -import QGroundControl.FactControls 1.0 -import QGroundControl.FactSystem 1.0 -import QGroundControl.FlightMap 1.0 -import QGroundControl.Palette 1.0 -import QGroundControl.ScreenTools 1.0 -import QGroundControl.Vehicle 1.0 - -import CustomQuickInterface 1.0 -import Custom.Widgets 1.0 -import Custom.Camera 1.0 - -Item { - id: _root - height: mainColumn.height - width: mainColumn.width + (ScreenTools.defaultFontPixelWidth * 2) - visible: !QGroundControl.videoManager.fullScreen - - readonly property string _commLostStr: qsTr("NO CAMERA") - readonly property real buttonSize: ScreenTools.defaultFontPixelWidth * 5 - - property real _spacers: ScreenTools.defaultFontPixelHeight * 0.5 - property real _labelFieldWidth: ScreenTools.defaultFontPixelWidth * 28 - property real _editFieldWidth: ScreenTools.defaultFontPixelWidth * 30 - property real _editFieldHeight: ScreenTools.defaultFontPixelHeight * 2 - property var _videoManager: QGroundControl.videoManager - property bool _recordingLocalVideo: QGroundControl.videoManager.recording - - property var _dynamicCameras: activeVehicle ? activeVehicle.dynamicCameras : null - property bool _isCamera: _dynamicCameras ? _dynamicCameras.cameras.count > 0 : false - property int _curCameraIndex: _dynamicCameras ? _dynamicCameras.currentCamera : 0 - property var _camera: _isCamera ? _dynamicCameras.cameras.get(_curCameraIndex) : null - property bool _communicationLost: activeVehicle ? activeVehicle.connectionLost : false - property bool _noSdCard: _camera && _camera.storageTotal === 0 - property bool _fullSD: _camera && _camera.storageTotal !== 0 && _camera.storageFree > 0 && _camera.storageFree < 250 // We get kiB from the camera - property bool _cameraVideoMode: !_communicationLost && (_noSdCard ? false : _camera && _camera.cameraMode === QGCCameraControl.CAM_MODE_VIDEO) - property bool _cameraPhotoMode: !_communicationLost && (_noSdCard ? false : _camera && (_camera.cameraMode === QGCCameraControl.CAM_MODE_PHOTO || _camera.cameraMode === QGCCameraControl.CAM_MODE_SURVEY)) - property bool _cameraPhotoIdle: !_communicationLost && (_noSdCard ? false : _camera && _camera.photoStatus === QGCCameraControl.PHOTO_CAPTURE_IDLE) - property bool _cameraElapsedMode: !_communicationLost && (_noSdCard ? false : _camera && _camera.cameraMode === QGCCameraControl.CAM_MODE_PHOTO && _camera.photoMode === QGCCameraControl.PHOTO_CAPTURE_TIMELAPSE) - property bool _cameraModeUndefined: !_cameraPhotoMode && !_cameraVideoMode - property bool _recordingVideo: _cameraVideoMode && _camera.videoStatus === QGCCameraControl.VIDEO_CAPTURE_STATUS_RUNNING - property bool _settingsEnabled: !_communicationLost && _camera && _camera.cameraMode !== QGCCameraControl.CAM_MODE_UNDEFINED && _camera.photoStatus === QGCCameraControl.PHOTO_CAPTURE_IDLE && !_recordingVideo - property bool _hasZoom: _camera && _camera.hasZoom - property Fact _irPaletteFact: _camera ? _camera.irPalette : null - property bool _isShortScreen: mainWindow.height / ScreenTools.realPixelDensity < 120 - property real _gimbalPitch: activeVehicle ? -activeVehicle.gimbalPitch : 0 - property real _gimbalYaw: activeVehicle ? activeVehicle.gimbalYaw : 0 - property bool _hasGimbal: activeVehicle && activeVehicle.gimbalData - Connections { - target: QGroundControl.multiVehicleManager.activeVehicle - onConnectionLostChanged: { - if(_communicationLost && cameraSettings.visible) { - cameraSettings.close() - } - } - } - - DeadMouseArea { - anchors.fill: parent - } - - //------------------------------------------------------------------------- - //-- Main Column - Column { - id: mainColumn - spacing: _spacers - anchors.centerIn: parent - //--------------------------------------------------------------------- - //-- Quick Thermal Modes - Item { - id: thermalBackgroundRect - width: buttonsRow.width + (ScreenTools.defaultFontPixelWidth * 4) - height: buttonsRow.height + (ScreenTools.defaultFontPixelHeight) - visible: QGroundControl.videoManager.hasThermal || _irPaletteFact || _camera.vendor === "NextVision" - anchors.horizontalCenter: parent.horizontalCenter - Component.onCompleted: { - if(_irPaletteFact && QGroundControl.videoManager.hasThermal) { - if(_camera.thermalMode === QGCCameraControl.THERMAL_OFF) - standardMode.checked = true - if(_camera.thermalMode === QGCCameraControl.THERMAL_PIP) - thermalPip.checked = true - if(_camera.thermalMode === QGCCameraControl.THERMAL_FULL) - thermalFull.checked = true - } - else - standardMode.checked = true - } - ButtonGroup { - id: buttonGroup - exclusive: true - buttons: buttonsRow.children - } - Row { - id: buttonsRow - spacing: ScreenTools.defaultFontPixelWidth * 0.5 - anchors.centerIn: parent - //-- Standard - CustomQuickButton { - id: standardMode - width: buttonSize - height: buttonSize - iconSource: "/custom/img/thermal-standard.svg" - onClicked: { - _camera.thermalMode = QGCCameraControl.THERMAL_OFF - } - } - //-- PIP - CustomQuickButton { - id: thermalPip - width: buttonSize - height: buttonSize - visible: _camera.vendor !== "NextVision" - iconSource: "/custom/img/thermal-pip.svg" - onClicked: { - _camera.thermalMode = QGCCameraControl.THERMAL_PIP - } - } - // Thermal - CustomQuickButton { - id: thermalFull - width: buttonSize - height: buttonSize - iconSource: "/custom/img/thermal-brightness.svg" - onClicked: { - _camera.thermalMode = QGCCameraControl.THERMAL_FULL - } - } - // Thermal palette options - CustomQuickButton { - checkable: false - width: buttonSize - height: buttonSize - visible: _irPaletteFact - iconSource: "/custom/img/thermal-palette.svg" - onClicked: { - thermalPalettes.open() - } - } - } - } - //--------------------------------------------------------------------- - //-- Main Camera Control - Row { - spacing: ScreenTools.defaultFontPixelWidth * 0.5 - anchors.horizontalCenter: parent.horizontalCenter - Rectangle { - id: cameraRect - height: cameraCol.height - width: cameraCol.width + (ScreenTools.defaultFontPixelWidth * 4) - color: qgcPal.window - radius: ScreenTools.defaultFontPixelWidth * 0.5 - Column { - id: cameraCol - spacing: _spacers - anchors.centerIn: parent - Item { - height: 1 - width: 1 - } - //----------------------------------------------------------------- - //-- Camera Name - QGCLabel { - text: activeVehicle ? (_camera && _camera.modelName !== "" ? _camera.modelName : _commLostStr) : _commLostStr - font.pointSize: ScreenTools.smallFontPointSize - anchors.horizontalCenter: parent.horizontalCenter - } - QGCLabel { - text: { - if(_noSdCard) return qsTr("NONE") - if(_fullSD) return qsTr("FULL") - return _camera ? _camera.storageFreeStr : "" - } - visible: _isShortScreen - color: (_noSdCard || _fullSD) ? qgcPal.colorOrange : qgcPal.text - font.pointSize: ScreenTools.smallFontPointSize - anchors.horizontalCenter: parent.horizontalCenter - } - //----------------------------------------------------------------- - //-- Camera Mode - Item { - width: modeCol.width - height: modeCol.height - anchors.horizontalCenter: parent.horizontalCenter - Column { - id: modeCol - spacing: _spacers - QGCColoredImage { - height: ScreenTools.defaultFontPixelHeight * 1.25 - width: height - source: (_cameraModeUndefined || _cameraPhotoMode) ? "/custom/img/camera_photo.svg" : "/custom/img/camera_video.svg" - color: qgcPal.text - fillMode: Image.PreserveAspectFit - sourceSize.height: height - anchors.horizontalCenter: parent.horizontalCenter - } - QGCLabel { - text: _cameraVideoMode ? qsTr("Video") : qsTr("Photo") - font.pointSize: ScreenTools.smallFontPointSize - anchors.horizontalCenter: parent.horizontalCenter - } - } - MouseArea { - anchors.fill: parent - enabled: !_cameraModeUndefined && _camera && _camera.videoStatus !== QGCCameraControl.VIDEO_CAPTURE_STATUS_RUNNING && _cameraPhotoIdle - onClicked: { - _camera.toggleMode() - } - } - } - //----------------------------------------------------------------- - //-- Shutter - Rectangle { - color: Qt.rgba(0,0,0,0) - width: height - height: ScreenTools.defaultFontPixelHeight * 4 - radius: width * 0.5 - border.color: qgcPal.buttonText - border.width: 1 - anchors.horizontalCenter: parent.horizontalCenter - Rectangle { - width: parent.width * 0.85 - height: width - radius: width * 0.5 - color: _cameraModeUndefined ? qgcPal.colorGrey : ( _cameraVideoMode ? qgcPal.colorRed : qgcPal.text ) - visible: !pauseVideo.visible - anchors.centerIn: parent - QGCColoredImage { - id: busyIndicator - height: parent.height * 0.75 - width: height - source: "/qmlimages/MapSync.svg" - sourceSize.height: height - fillMode: Image.PreserveAspectFit - mipmap: true - smooth: true - color: qgcPal.window - visible: { - if(_cameraPhotoMode && !_cameraPhotoIdle && !_cameraElapsedMode) { - return true - } - return false - } - anchors.centerIn: parent - RotationAnimation on rotation { - loops: Animation.Infinite - from: 360 - to: 0 - duration: 740 - running: busyIndicator.visible - } - } - QGCLabel { - text: _camera ? _camera.photoLapse.toFixed(0) + 's' : qsTr('N/A') - font.family: ScreenTools.demiboldFontFamily - color: qgcPal.colorBlue - visible: _cameraElapsedMode - anchors.centerIn: parent - } - } - Rectangle { - id: pauseVideo - width: parent.width * 0.5 - height: width - color: _cameraModeUndefined ? qgcPal.colorGrey : qgcPal.colorRed - visible: { - if(_cameraVideoMode && _camera.videoStatus === QGCCameraControl.VIDEO_CAPTURE_STATUS_RUNNING) { - return true - } - if(_cameraPhotoMode) { - if(_camera.photoStatus === QGCCameraControl.PHOTO_CAPTURE_INTERVAL_IDLE || _camera.photoStatus === QGCCameraControl.PHOTO_CAPTURE_INTERVAL_IN_PROGRESS) { - return true - } - } - return false - } - anchors.centerIn: parent - } - MouseArea { - anchors.fill: parent - enabled: !_noSdCard - onClicked: { - if(_cameraVideoMode) { - if(_camera.videoStatus === QGCCameraControl.VIDEO_CAPTURE_STATUS_RUNNING) { - _camera.stopVideo() - //-- Local video as well - if (_recordingVideo) { - _videoManager.stopRecording() - } - } else { - if(!_fullSD) { - _camera.startVideo() - } - //-- Local video as well - if(_videoManager) { - _videoManager.startRecording() - } - } - } else { - if(_camera.photoStatus === QGCCameraControl.PHOTO_CAPTURE_INTERVAL_IDLE || _camera.photoStatus === QGCCameraControl.PHOTO_CAPTURE_INTERVAL_IN_PROGRESS) { - _camera.stopTakePhoto() - } else { - if(!_fullSD) { - _camera.takePhoto() - } - } - } - } - } - } - //----------------------------------------------------------------- - //-- Settings - Item { - width: settingsCol.width - height: settingsCol.height - anchors.horizontalCenter: parent.horizontalCenter - Column { - id: settingsCol - spacing: _spacers - anchors.horizontalCenter: parent.horizontalCenter - QGCColoredImage { - width: ScreenTools.defaultFontPixelHeight * 1.25 - height: width - sourceSize.width: width - source: "qrc:/custom/img/camera_settings.svg" - color: qgcPal.text - fillMode: Image.PreserveAspectFit - opacity: _settingsEnabled ? 1 : 0.5 - anchors.horizontalCenter: parent.horizontalCenter - } - QGCLabel { - text: qsTr("Settings") - font.pointSize: ScreenTools.smallFontPointSize - anchors.horizontalCenter: parent.horizontalCenter - } - } - MouseArea { - anchors.fill: parent - enabled: _settingsEnabled - onClicked: { - cameraSettings.open() - } - } - } - //----------------------------------------------------------------- - //-- microSD Card - Column { - spacing: _spacers - visible: !_isShortScreen - anchors.horizontalCenter: parent.horizontalCenter - QGCColoredImage { - width: ScreenTools.defaultFontPixelHeight * 1.25 - height: width - sourceSize.width: width - source: "qrc:/custom/img/microSD.svg" - color: qgcPal.text - fillMode: Image.PreserveAspectFit - opacity: _settingsEnabled ? 1 : 0.5 - anchors.horizontalCenter: parent.horizontalCenter - } - QGCLabel { - text: { - if(_noSdCard) return qsTr("NONE") - if(_fullSD) return qsTr("FULL") - return _camera ? _camera.storageFreeStr : "" - } - color: (_noSdCard || _fullSD) ? qgcPal.colorOrange : qgcPal.text - font.pointSize: ScreenTools.smallFontPointSize - anchors.horizontalCenter: parent.horizontalCenter - } - } - //----------------------------------------------------------------- - //-- Recording Time / Images Captured - QGCLabel { - text: (_cameraVideoMode && _camera.videoStatus === QGCCameraControl.VIDEO_CAPTURE_STATUS_RUNNING) ? _camera.recordTimeStr : "00:00:00" - visible: _cameraVideoMode - font.pointSize: ScreenTools.smallFontPointSize - anchors.horizontalCenter: parent.horizontalCenter - } - QGCLabel { - text: activeVehicle && _cameraPhotoMode ? ('00000' + activeVehicle.cameraTriggerPoints.count).slice(-5) : "00000" - visible: _cameraPhotoMode - font.pointSize: ScreenTools.smallFontPointSize - anchors.horizontalCenter: parent.horizontalCenter - } - Item { - height: 1 - width: 1 - } - } - } - //-- Gimbal Indicator - Rectangle { - id: gimbalBackground - width: _hasGimbal ? ScreenTools.defaultFontPixelWidth * 6 : 0 - height: _hasGimbal ? (gimbalCol.height + (ScreenTools.defaultFontPixelHeight * 2)) : 0 - visible: _hasGimbal - color: Qt.rgba(qgcPal.window.r, qgcPal.window.g, qgcPal.window.b, 0.75) - radius: ScreenTools.defaultFontPixelWidth * 0.5 - anchors.verticalCenter: cameraRect.verticalCenter - Column { - id: gimbalCol - spacing: ScreenTools.defaultFontPixelHeight * 0.75 - anchors.centerIn: parent - QGCColoredImage { - id: gimbalIcon - source: "/custom/img/gimbal_icon.svg" - color: qgcPal.text - width: ScreenTools.defaultFontPixelWidth * 2 - height: width - smooth: true - mipmap: true - antialiasing: true - fillMode: Image.PreserveAspectFit - sourceSize.width: width - anchors.horizontalCenter: parent.horizontalCenter - } - Image { - id: pitchScale - height: cameraRect.height * 0.65 - source: qgcPal.globalTheme === QGCPalette.Light ? "/custom/img/gimbal_pitch_indoors.svg" : "/custom/img/gimbal_pitch_outdoors.svg" - fillMode: Image.PreserveAspectFit - sourceSize.height: height - smooth: true - mipmap: true - antialiasing: true - - Image { - id: yawIndicator - width: ScreenTools.defaultFontPixelWidth * 4 - source: "/custom/img/gimbal_position.svg" - fillMode: Image.PreserveAspectFit - sourceSize.width: width - x: pitchScale.width/2 - y: (pitchScale.height * pitchScale.scaleRatio) + (pitchScale._pitch / pitchScale.rangeValue) * pitchScale.height - smooth: true - mipmap: true - transform: [ - Translate { - x: -yawIndicator.width / 2 - y: -yawIndicator.height / 2 - }, - Rotation { - angle: _gimbalYaw - } - ] - } - readonly property real minValue: -15 - readonly property real centerValue: 0 - readonly property real maxValue: 90 - readonly property real rangeValue: maxValue - minValue - readonly property real scaleRatio: 1/7 - property real _pitch: _gimbalPitch < minValue ? minValue : (_gimbalPitch > maxValue ? maxValue : _gimbalPitch) - } - QGCLabel { - id: gimbalLabel - width: gimbalCol.width - color: qgcPal.text - font.pointSize: ScreenTools.smallFontPointSize - text: activeVehicle ? activeVehicle.gimbalPitch.toFixed(0) : "-" - horizontalAlignment: Text.AlignHCenter - } - } - } // Gimbal Indicator - } - //-- Zoom Buttons - ZoomControl { - id: zoomControl - visible: _hasZoom - mainColor: qgcPal.window - contentColor: qgcPal.text - fontPointSize: ScreenTools.defaultFontPointSize * 1.75 - zoomLevelVisible: false - zoomLevel: _hasZoom ? _camera.zoomLevel : NaN - anchors.horizontalCenter: parent.horizontalCenter - onlyContinousZoom: true - onZoomIn: { - _camera.stepZoom(1) - } - onZoomOut: { - _camera.stepZoom(-1) - } - onContinuousZoomStart: { - _camera.startZoom(zoomIn ? 1 : -1) - } - onContinuousZoomStop: { - _camera.stopZoom() - } - } - } - //------------------------------------------------------------------------- - //-- Camera Settings - Popup { - id: cameraSettings - width: Math.min(mainWindow.width * 0.666, ScreenTools.defaultFontPixelWidth * 80) - height: mainWindow.height * 0.666 - modal: true - focus: true - parent: Overlay.overlay - x: Math.round((mainWindow.width - width) * 0.5) - y: Math.round((mainWindow.height - height) * 0.5) - closePolicy: Popup.CloseOnEscape | Popup.CloseOnPressOutside - background: Rectangle { - anchors.fill: parent - color: qgcPal.globalTheme === QGCPalette.Light ? Qt.rgba(1,1,1,0.95) : Qt.rgba(0,0,0,0.75) - border.color: qgcPal.text - radius: ScreenTools.defaultFontPixelWidth - } - Item { - anchors.fill: parent - anchors.margins: ScreenTools.defaultFontPixelHeight - function showEditFact(fact) { - factEditor.text = fact.valueString - factEdit.fact = fact - factEdit.visible = true - } - function hideEditFact() { - factEdit.visible = false - factEdit.fact = null - } - QGCLabel { - id: cameraSettingsLabel - text: _noSdCard ? qsTr("Settings") : (_cameraVideoMode ? qsTr("Video Settings") : qsTr("Photo Settings")) - font.family: ScreenTools.demiboldFontFamily - font.pointSize: ScreenTools.mediumFontPointSize - anchors.margins: ScreenTools.defaultFontPixelWidth - anchors.top: parent.top - anchors.left: parent.left - } - QGCFlickable { - clip: true - anchors.top: cameraSettingsLabel.bottom - anchors.bottom: parent.bottom - anchors.margins: ScreenTools.defaultFontPixelWidth - width: cameraSettingsCol.width + (ScreenTools.defaultFontPixelWidth * 2) - contentHeight: cameraSettingsCol.height - contentWidth: cameraSettingsCol.width - anchors.horizontalCenter: parent.horizontalCenter - Column { - id: cameraSettingsCol - spacing: _spacers - anchors.margins: ScreenTools.defaultFontPixelHeight - anchors.horizontalCenter: parent.horizontalCenter - //------------------------------------------- - //-- Camera Selector - Row { - spacing: ScreenTools.defaultFontPixelWidth - visible: _isCamera && _dynamicCameras.cameraLabels.length > 1 - anchors.horizontalCenter: parent.horizontalCenter - QGCLabel { - text: qsTr("Camera Selector:") - width: _labelFieldWidth - anchors.verticalCenter: parent.verticalCenter - } - QGCComboBox { - model: _isCamera ? _dynamicCameras.cameraLabels : [] - width: _editFieldWidth - height: _editFieldHeight - onActivated: _dynamicCameras.currentCamera = index - currentIndex: _dynamicCameras ? _dynamicCameras.currentCamera : 0 - } - } - Rectangle { - color: qgcPal.button - height: 1 - width: cameraSettingsCol.width - visible: _isCamera && _dynamicCameras.cameraLabels.length > 1 - } - //------------------------------------------- - //-- Stream Selector - Row { - spacing: ScreenTools.defaultFontPixelWidth - visible: _isCamera && _camera.streamLabels.length > 1 - anchors.horizontalCenter: parent.horizontalCenter - QGCLabel { - text: qsTr("Stream Selector:") - width: _labelFieldWidth - anchors.verticalCenter: parent.verticalCenter - } - QGCComboBox { - model: _camera ? _camera.streamLabels : [] - width: _editFieldWidth - height: _editFieldHeight - onActivated: _camera.currentStream = index - currentIndex: _camera ? _camera.currentStream : 0 - } - } - Rectangle { - color: qgcPal.button - height: 1 - width: cameraSettingsCol.width - visible: _isCamera && _camera.streamLabels.length > 1 - } - //------------------------------------------- - //-- Thermal Modes - Row { - spacing: ScreenTools.defaultFontPixelWidth - anchors.horizontalCenter: parent.horizontalCenter - visible: QGroundControl.videoManager.hasThermal - property var thermalModes: [qsTr("Off"), qsTr("Blend"), qsTr("Full"), qsTr("Picture In Picture")] - QGCLabel { - text: qsTr("Thermal View Mode") - width: _labelFieldWidth - anchors.verticalCenter: parent.verticalCenter - } - QGCComboBox { - width: _editFieldWidth - height: _editFieldHeight - model: parent.thermalModes - currentIndex: _camera ? _camera.thermalMode : 0 - onActivated: _camera.thermalMode = index - } - } - Rectangle { - color: qgcPal.button - height: 1 - width: cameraSettingsCol.width - visible: QGroundControl.videoManager.hasThermal - } - //------------------------------------------- - //-- Thermal Video Opacity - Row { - spacing: ScreenTools.defaultFontPixelWidth - anchors.horizontalCenter: parent.horizontalCenter - visible: QGroundControl.videoManager.hasThermal && _camera.thermalMode === QGCCameraControl.THERMAL_BLEND - QGCLabel { - text: qsTr("Blend Opacity") - width: _labelFieldWidth - anchors.verticalCenter: parent.verticalCenter - } - Slider { - width: _editFieldWidth - height: _editFieldHeight - to: 100 - from: 0 - value: _camera ? _camera.thermalOpacity : 0 - live: true - onValueChanged: { - _camera.thermalOpacity = value - } - } - } - Rectangle { - color: qgcPal.button - height: 1 - width: cameraSettingsCol.width - visible: QGroundControl.videoManager.hasThermal && _camera.thermalMode === QGCCameraControl.THERMAL_BLEND - } - //------------------------------------------- - //-- Settings from Camera Definition File - Repeater { - model: _camera ? _camera.activeSettings : [] - Item { - width: repCol.width - height: repCol.height - Column { - id: repCol - spacing: _spacers - property var _fact: _camera.getFact(modelData) - Row { - height: visible ? undefined : 0 - spacing: ScreenTools.defaultFontPixelWidth - anchors.horizontalCenter: parent.horizontalCenter - property bool _isBool: parent._fact.typeIsBool - property bool _isCombo: !_isBool && parent._fact.enumStrings.length > 0 - property bool _isSlider: parent._fact && !isNaN(parent._fact.increment) - property bool _isEdit: !_isBool && !_isSlider && parent._fact.enumStrings.length < 1 - QGCLabel { - text: parent.parent._fact.shortDescription - width: _labelFieldWidth - anchors.verticalCenter: parent.verticalCenter - } - FactComboBox { - width: parent._isCombo ? _editFieldWidth : 0 - height: parent._isCombo ? _editFieldHeight : 0 - fact: parent.parent._fact - indexModel: false - visible: parent._isCombo - anchors.verticalCenter: parent.verticalCenter - } - QGCButton { - visible: parent._isEdit - width: parent._isEdit ? _editFieldWidth : 0 - height: parent._isEdit ? _editFieldHeight : 0 - text: parent.parent._fact.valueString - onClicked: { - showEditFact(parent.parent._fact) - } - } - QGCSlider { - width: parent._isSlider ? _editFieldWidth : 0 - height: parent._isSlider ? _editFieldHeight : 0 - maximumValue: parent.parent._fact.max - minimumValue: parent.parent._fact.min - stepSize: parent.parent._fact.increment - visible: parent._isSlider - updateValueWhileDragging: false - anchors.verticalCenter: parent.verticalCenter - Component.onCompleted: { - value = parent.parent._fact.value - } - onValueChanged: { - parent.parent._fact.value = value - } - } - CustomOnOffSwitch { - width: parent._isBool ? _editFieldWidth : 0 - height: parent._isBool ? _editFieldHeight : 0 - checked: parent.parent._fact ? parent.parent._fact.value : false - onClicked: parent.parent._fact.value = checked ? 1 : 0 - visible: parent._isBool - anchors.verticalCenter: parent.verticalCenter - } - } - Rectangle { - color: qgcPal.button - height: 1 - width: cameraSettingsCol.width - } - } - } - } - //------------------------------------------- - //-- Time Lapse - Row { - spacing: ScreenTools.defaultFontPixelWidth - anchors.horizontalCenter: parent.horizontalCenter - visible: _cameraPhotoMode && !_noSdCard - property var photoModes: [qsTr("Single"), qsTr("Time Lapse")] - QGCLabel { - text: qsTr("Photo Mode") - width: _labelFieldWidth - anchors.verticalCenter: parent.verticalCenter - } - QGCComboBox { - width: _editFieldWidth - height: _editFieldHeight - model: parent.photoModes - currentIndex: _camera ? _camera.photoMode : 0 - onActivated: _camera.photoMode = index - } - } - Rectangle { - color: qgcPal.button - height: 1 - width: cameraSettingsCol.width - visible: _cameraPhotoMode && !_noSdCard - } - //------------------------------------------- - //-- Time Lapse Interval - Row { - spacing: ScreenTools.defaultFontPixelWidth - anchors.horizontalCenter: parent.horizontalCenter - visible: _cameraPhotoMode && _camera.photoMode === QGCCameraControl.PHOTO_CAPTURE_TIMELAPSE && !_noSdCard - QGCLabel { - text: qsTr("Photo Interval (seconds)") - width: _labelFieldWidth - anchors.verticalCenter: parent.verticalCenter - } - QGCSlider { - width: _editFieldWidth - height: _editFieldHeight - maximumValue: 60 - minimumValue: _camera ? (_camera.isE90 ? 3 : 5) : 5 - stepSize: 1 - value: _camera ? _camera.photoLapse : 5 - updateValueWhileDragging: true - anchors.verticalCenter: parent.verticalCenter - onValueChanged: { - if(_camera) { - _camera.photoLapse = value - } - } - } - } - Rectangle { - color: qgcPal.button - height: 1 - width: cameraSettingsCol.width - visible: _cameraPhotoMode && _camera.photoMode === QGCCameraControl.PHOTO_CAPTURE_TIMELAPSE && !_noSdCard - } - //------------------------------------------- - //-- Gimbal Control - Row { - spacing: ScreenTools.defaultFontPixelWidth - visible: _camera && !_camera.isThermal - anchors.horizontalCenter: parent.horizontalCenter - QGCLabel { - text: qsTr("Show Gimbal Control") - width: _labelFieldWidth - anchors.verticalCenter: parent.verticalCenter - } - CustomOnOffSwitch { - checked: CustomQuickInterface.showGimbalControl - width: _editFieldWidth - height: _editFieldHeight - anchors.verticalCenter: parent.verticalCenter - onClicked: CustomQuickInterface.showGimbalControl = checked - } - } - Rectangle { - color: qgcPal.button - height: 1 - width: cameraSettingsCol.width - visible: _camera && !_camera.isThermal - } - //------------------------------------------- - //-- Screen Grid - Row { - spacing: ScreenTools.defaultFontPixelWidth - visible: _camera && !_camera.isThermal - anchors.horizontalCenter: parent.horizontalCenter - QGCLabel { - text: qsTr("Screen Grid") - width: _labelFieldWidth - anchors.verticalCenter: parent.verticalCenter - } - CustomOnOffSwitch { - checked: QGroundControl.settingsManager.videoSettings.gridLines.rawValue - width: _editFieldWidth - height: _editFieldHeight - anchors.verticalCenter: parent.verticalCenter - onClicked: QGroundControl.settingsManager.videoSettings.gridLines.rawValue = checked - } - } - Rectangle { - color: qgcPal.button - height: 1 - width: cameraSettingsCol.width - visible: _camera && !_camera.isThermal - } - //------------------------------------------- - //-- Video Fit - Row { - spacing: ScreenTools.defaultFontPixelWidth - visible: _camera - anchors.horizontalCenter: parent.horizontalCenter - QGCLabel { - text: qsTr("Video Screen Fit") - width: _labelFieldWidth - anchors.verticalCenter: parent.verticalCenter - } - FactComboBox { - width: _editFieldWidth - height: _editFieldHeight - fact: QGroundControl.settingsManager.videoSettings.videoFit - indexModel: false - anchors.verticalCenter: parent.verticalCenter - } - } - Rectangle { - color: qgcPal.button - height: 1 - width: cameraSettingsCol.width - visible: _camera && !_camera.isThermal - } - //------------------------------------------- - //-- Reset Camera - Row { - spacing: ScreenTools.defaultFontPixelWidth - anchors.horizontalCenter: parent.horizontalCenter - QGCLabel { - text: qsTr("Reset Camera Defaults") - width: _labelFieldWidth - anchors.verticalCenter: parent.verticalCenter - } - QGCButton { - text: qsTr("Reset") - onClicked: resetPrompt.open() - width: _editFieldWidth - height: _editFieldHeight - enabled: !_recordingVideo - anchors.verticalCenter: parent.verticalCenter - MessageDialog { - id: resetPrompt - title: qsTr("Reset Camera to Factory Settings") - text: qsTr("Confirm resetting all settings?") - standardButtons: StandardButton.Yes | StandardButton.No - onNo: resetPrompt.close() - onYes: { - _camera.resetSettings() - QGroundControl.settingsManager.videoSettings.gridLines.rawValue = false - _camera.photoMode = QGCCameraControl.PHOTO_CAPTURE_SINGLE - _camera.photoLapse = 5.0 - _camera.photoLapseCount = 0 - resetPrompt.close() - } - } - } - } - Rectangle { - color: qgcPal.button - height: 1 - width: cameraSettingsCol.width - } - } - } - Rectangle { - id: factEdit - visible: false - color: qgcPal.globalTheme === QGCPalette.Light ? Qt.rgba(1,1,1,0.5) : Qt.rgba(0,0,0,0.5) - anchors.fill: parent - property var fact: null - DeadMouseArea { - anchors.fill: parent - } - Rectangle { - width: factEditCol.width * 1.25 - height: factEditCol.height * 1.25 - color: qgcPal.globalTheme === QGCPalette.Light ? Qt.rgba(1,1,1,0.95) : Qt.rgba(0,0,0,0.75) - border.width: 1 - border.color: qgcPal.globalTheme === QGCPalette.Light ? Qt.rgba(0,0,0,0.35) : Qt.rgba(1,1,1,0.35) - anchors.top: parent.top - anchors.topMargin: ScreenTools.defaultFontPixelHeight * 8 - anchors.horizontalCenter: parent.horizontalCenter - Column { - id: factEditCol - spacing: ScreenTools.defaultFontPixelHeight - anchors.centerIn: parent - QGCLabel { - text: factEdit.fact ? factEdit.fact.shortDescription : "" - anchors.horizontalCenter: parent.horizontalCenter - } - FactTextField { - id: factEditor - width: _editFieldWidth - fact: factEdit.fact - anchors.horizontalCenter: parent.horizontalCenter - } - QGCButton { - text: qsTr("Close") - anchors.horizontalCenter: parent.horizontalCenter - onClicked: { - factEditor.completeEditing() - hideEditFact() - } - } - } - } - } - } - } - //------------------------------------------------------------------------- - //-- Thermal Palettes - Popup { - id: thermalPalettes - width: Math.min(mainWindow.width * 0.666, ScreenTools.defaultFontPixelWidth * 40) - height: mainWindow.height * 0.5 - modal: true - focus: true - parent: Overlay.overlay - x: Math.round((mainWindow.width - width) * 0.5) - y: Math.round((mainWindow.height - height) * 0.5) - closePolicy: Popup.CloseOnEscape | Popup.CloseOnPressOutside - - background: Rectangle { - anchors.fill: parent - color: qgcPal.globalTheme === QGCPalette.Light ? Qt.rgba(1,1,1,0.95) : Qt.rgba(0,0,0,0.75) - border.color: qgcPal.text - radius: ScreenTools.defaultFontPixelWidth * 0.5 - } - Item { - anchors.fill: parent - anchors.margins: ScreenTools.defaultFontPixelHeight - QGCFlickable { - clip: true - anchors.fill: parent - width: comboListCol.width + (ScreenTools.defaultFontPixelWidth * 2) - contentHeight: comboListCol.height - contentWidth: comboListCol.width - anchors.horizontalCenter: parent.horizontalCenter - ColumnLayout { - id: comboListCol - spacing: ScreenTools.defaultFontPixelHeight - anchors.margins: ScreenTools.defaultFontPixelHeight - anchors.horizontalCenter: parent.horizontalCenter - QGCLabel { - text: qsTr("Thermal Palettes") - Layout.alignment: Qt.AlignHCenter - } - Repeater { - model: _irPaletteFact ? _irPaletteFact.enumStrings : [] - QGCButton { - text: modelData - Layout.minimumHeight: ScreenTools.defaultFontPixelHeight * 3 - Layout.minimumWidth: ScreenTools.defaultFontPixelWidth * 30 - Layout.fillHeight: true - Layout.fillWidth: true - Layout.alignment: Qt.AlignHCenter - checked: index === _irPaletteFact.value - onClicked: { - _irPaletteFact.value = index - if(thermalBackgroundRect.visible) { - if(_camera.thermalMode !== QGCCameraControl.THERMAL_PIP && _camera.thermalMode !== QGCCameraControl.THERMAL_FULL) { - _camera.thermalMode = QGCCameraControl.THERMAL_FULL - thermalFull.checked = true - } - } - - thermalPalettes.close() - } - } - } - } - } - } - } -} - diff --git a/custom-example/res/CustomFlyView.qml b/custom-example/res/CustomFlyView.qml deleted file mode 100644 index b03fdcc5a93ff85e90fd4511e189d32c339da859..0000000000000000000000000000000000000000 --- a/custom-example/res/CustomFlyView.qml +++ /dev/null @@ -1,736 +0,0 @@ -/**************************************************************************** - * - * (c) 2009-2019 QGROUNDCONTROL PROJECT - * - * QGroundControl is licensed according to the terms in the file - * COPYING.md in the root of the source code directory. - * - * @file - * @author Gus Grubba - */ - -import QtQuick 2.11 -import QtQuick.Controls 2.4 -import QtQuick.Layouts 1.11 -import QtQuick.Dialogs 1.3 -import QtPositioning 5.2 - -import QGroundControl 1.0 -import QGroundControl.Controllers 1.0 -import QGroundControl.Controls 1.0 -import QGroundControl.FlightMap 1.0 -import QGroundControl.MultiVehicleManager 1.0 -import QGroundControl.Palette 1.0 -import QGroundControl.ScreenTools 1.0 -import QGroundControl.Vehicle 1.0 -import QGroundControl.QGCPositionManager 1.0 -import QGroundControl.Airspace 1.0 - -import CustomQuickInterface 1.0 -import Custom.Widgets 1.0 - -Item { - anchors.fill: parent - visible: !QGroundControl.videoManager.fullScreen - - readonly property string scaleState: "topMode" - readonly property string noGPS: qsTr("NO GPS") - readonly property real indicatorValueWidth: ScreenTools.defaultFontPixelWidth * 7 - - property real _indicatorDiameter: ScreenTools.defaultFontPixelWidth * 18 - property real _indicatorsHeight: ScreenTools.defaultFontPixelHeight - property var _sepColor: qgcPal.globalTheme === QGCPalette.Light ? Qt.rgba(0,0,0,0.5) : Qt.rgba(1,1,1,0.5) - property color _indicatorsColor: qgcPal.text - - property bool _communicationLost: activeVehicle ? activeVehicle.connectionLost : false - property bool _isVehicleGps: activeVehicle && activeVehicle.gps && activeVehicle.gps.count.rawValue > 1 && activeVehicle.gps.hdop.rawValue < 1.4 - property var _dynamicCameras: activeVehicle ? activeVehicle.dynamicCameras : null - property bool _isCamera: _dynamicCameras ? _dynamicCameras.cameras.count > 0 : false - property int _curCameraIndex: _dynamicCameras ? _dynamicCameras.currentCamera : 0 - property var _camera: _isCamera ? _dynamicCameras.cameras.get(_curCameraIndex) : null - property bool _cameraPresent: _camera && _camera.cameraMode !== QGCCameraControl.CAM_MODE_UNDEFINED - property var _flightPermit: QGroundControl.airmapSupported ? QGroundControl.airspaceManager.flightPlan.flightPermitStatus : null - property bool _hasGimbal: activeVehicle && activeVehicle.gimbalData - - property bool _airspaceIndicatorVisible: QGroundControl.airmapSupported && mainIsMap && _flightPermit && _flightPermit !== AirspaceFlightPlanProvider.PermitNone - - property string _altitude: activeVehicle ? (isNaN(activeVehicle.altitudeRelative.value) ? "0.0" : activeVehicle.altitudeRelative.value.toFixed(1)) + ' ' + activeVehicle.altitudeRelative.units : "0.0" - property string _distanceStr: isNaN(_distance) ? "0" : _distance.toFixed(0) + ' ' + (activeVehicle ? activeVehicle.altitudeRelative.units : "") - property real _heading: activeVehicle ? activeVehicle.heading.rawValue : 0 - - property real _distance: 0.0 - property string _messageTitle: "" - property string _messageText: "" - - function secondsToHHMMSS(timeS) { - var sec_num = parseInt(timeS, 10); - var hours = Math.floor(sec_num / 3600); - var minutes = Math.floor((sec_num - (hours * 3600)) / 60); - var seconds = sec_num - (hours * 3600) - (minutes * 60); - if (hours < 10) {hours = "0"+hours;} - if (minutes < 10) {minutes = "0"+minutes;} - if (seconds < 10) {seconds = "0"+seconds;} - return hours+':'+minutes+':'+seconds; - } - - Timer { - id: connectionTimer - interval: 5000 - running: false; - repeat: false; - onTriggered: { - //-- Vehicle is gone - if(activeVehicle) { - //-- Let video stream close - QGroundControl.settingsManager.videoSettings.rtspTimeout.rawValue = 1 - if(!activeVehicle.armed) { - //-- If it wasn't already set to auto-disconnect - if(!activeVehicle.autoDisconnect) { - //-- Vehicle is not armed. Close connection and tell user. - activeVehicle.disconnectInactiveVehicle() - connectionLostDisarmedDialog.open() - } - } else { - //-- Vehicle is armed. Show doom dialog. - connectionLostArmed.open() - } - } - } - } - - Connections { - target: QGroundControl.qgcPositionManger - onGcsPositionChanged: { - if (activeVehicle && gcsPosition.latitude && Math.abs(gcsPosition.latitude) > 0.001 && gcsPosition.longitude && Math.abs(gcsPosition.longitude) > 0.001) { - var gcs = QtPositioning.coordinate(gcsPosition.latitude, gcsPosition.longitude) - var veh = activeVehicle.coordinate; - _distance = QGroundControl.metersToAppSettingsDistanceUnits(gcs.distanceTo(veh)); - //-- Ignore absurd values - if(_distance > 99999) - _distance = 0; - if(_distance < 0) - _distance = 0; - } else { - _distance = 0; - } - } - } - - Connections { - target: QGroundControl.multiVehicleManager.activeVehicle - onConnectionLostChanged: { - if(!_communicationLost) { - //-- Communication regained - connectionTimer.stop(); - if(connectionLostArmed.visible) { - connectionLostArmed.close() - } - //-- Reset stream timeout - QGroundControl.settingsManager.videoSettings.rtspTimeout.rawValue = 60 - } else { - if(activeVehicle && !activeVehicle.autoDisconnect) { - //-- Communication lost - connectionTimer.start(); - } - } - } - } - - Connections { - target: QGroundControl.multiVehicleManager - onVehicleAdded: { - //-- Dismiss comm lost dialog if open - connectionLostDisarmedDialog.close() - } - } - //------------------------------------------------------------------------- - MessageDialog { - id: connectionLostDisarmedDialog - title: qsTr("Communication Lost") - text: qsTr("Connection to vehicle has been lost and closed.") - standardButtons: StandardButton.Ok - onAccepted: { - connectionLostDisarmedDialog.close() - } - } - //------------------------------------------------------------------------- - //-- Heading Indicator - Rectangle { - id: compassBar - height: ScreenTools.defaultFontPixelHeight * 1.5 - width: ScreenTools.defaultFontPixelWidth * 50 - color: "#DEDEDE" - radius: 2 - clip: true - anchors.top: parent.top - anchors.topMargin: ScreenTools.defaultFontPixelHeight * (_airspaceIndicatorVisible ? 3 : 1) - anchors.horizontalCenter: parent.horizontalCenter - visible: !mainIsMap - Repeater { - model: 720 - visible: !mainIsMap - QGCLabel { - function _normalize(degrees) { - var a = degrees % 360 - if (a < 0) a += 360 - return a - } - property int _startAngle: modelData + 180 + _heading - property int _angle: _normalize(_startAngle) - anchors.verticalCenter: parent.verticalCenter - x: visible ? ((modelData * (compassBar.width / 360)) - (width * 0.5)) : 0 - visible: _angle % 45 == 0 - color: "#75505565" - font.pointSize: ScreenTools.smallFontPointSize - text: { - switch(_angle) { - case 0: return "N" - case 45: return "NE" - case 90: return "E" - case 135: return "SE" - case 180: return "S" - case 225: return "SW" - case 270: return "W" - case 315: return "NW" - } - return "" - } - } - } - } - Rectangle { - id: headingIndicator - height: ScreenTools.defaultFontPixelHeight - width: ScreenTools.defaultFontPixelWidth * 4 - color: qgcPal.windowShadeDark - visible: !mainIsMap - anchors.bottom: compassBar.top - anchors.bottomMargin: ScreenTools.defaultFontPixelHeight * -0.1 - anchors.horizontalCenter: parent.horizontalCenter - QGCLabel { - text: _heading - color: qgcPal.text - font.pointSize: ScreenTools.smallFontPointSize - anchors.centerIn: parent - } - } - Image { - height: _indicatorsHeight - width: height - source: "/custom/img/compass_pointer.svg" - visible: !mainIsMap - fillMode: Image.PreserveAspectFit - sourceSize.height: height - anchors.top: compassBar.bottom - anchors.topMargin: ScreenTools.defaultFontPixelHeight * -0.5 - anchors.horizontalCenter: parent.horizontalCenter - } - //------------------------------------------------------------------------- - //-- Camera Control - Loader { - id: camControlLoader - visible: !mainIsMap && _cameraPresent && _camera.paramComplete - source: visible ? "/custom/CustomCameraControl.qml" : "" - anchors.right: parent.right - anchors.rightMargin: ScreenTools.defaultFontPixelWidth - anchors.top: parent.top - anchors.topMargin: ScreenTools.defaultFontPixelHeight - } - //------------------------------------------------------------------------- - //-- Map Scale - MapScale { - id: mapScale - anchors.left: parent.left - anchors.top: parent.top - anchors.topMargin: ScreenTools.defaultFontPixelHeight * 0.5 - anchors.leftMargin: ScreenTools.defaultFontPixelWidth * 16 - mapControl: mainWindow.flightDisplayMap - visible: rootBackground.visible && mainIsMap - } - //------------------------------------------------------------------------- - //-- Vehicle Indicator - Rectangle { - id: vehicleIndicator - color: qgcPal.window - width: vehicleStatusGrid.width + (ScreenTools.defaultFontPixelWidth * 3) - height: vehicleStatusGrid.height + (ScreenTools.defaultFontPixelHeight * 1.5) - radius: 2 - anchors.bottom: parent.bottom - anchors.bottomMargin: ScreenTools.defaultFontPixelWidth - anchors.right: attitudeIndicator.visible ? attitudeIndicator.left : parent.right - anchors.rightMargin: attitudeIndicator.visible ? -ScreenTools.defaultFontPixelWidth : ScreenTools.defaultFontPixelWidth - - readonly property bool _showGps: CustomQuickInterface.showAttitudeWidget - - - GridLayout { - id: vehicleStatusGrid - columnSpacing: ScreenTools.defaultFontPixelWidth * 1.5 - rowSpacing: ScreenTools.defaultFontPixelHeight * 0.5 - columns: 7 - anchors.centerIn: parent - - //-- Latitude - QGCLabel { - height: _indicatorsHeight - width: height - Layout.alignment: Qt.AlignVCenter | Qt.AlignHCenter - color: qgcPal.text - text: "Lat:" - visible: vehicleIndicator._showGps - } - QGCLabel { - id: firstLabel - text: activeVehicle ? activeVehicle.gps.lat.value.toFixed(activeVehicle.gps.lat.decimalPlaces) : "-" - color: _indicatorsColor - font.pointSize: ScreenTools.smallFontPointSize - Layout.fillWidth: true - Layout.minimumWidth: indicatorValueWidth - horizontalAlignment: Text.AlignLeft - visible: vehicleIndicator._showGps - } - //-- Longitude - QGCLabel { - height: _indicatorsHeight - width: height - Layout.alignment: Qt.AlignVCenter | Qt.AlignHCenter - color: qgcPal.text - text: "Lon:" - visible: vehicleIndicator._showGps - } - QGCLabel { - text: activeVehicle ? activeVehicle.gps.lon.value.toFixed(activeVehicle.gps.lon.decimalPlaces) : "-" - color: _indicatorsColor - font.pointSize: ScreenTools.smallFontPointSize - Layout.fillWidth: true - Layout.minimumWidth: indicatorValueWidth - horizontalAlignment: firstLabel.horizontalAlignment - visible: vehicleIndicator._showGps - } - //-- HDOP - QGCLabel { - height: _indicatorsHeight - width: height - Layout.alignment: Qt.AlignVCenter | Qt.AlignHCenter - color: qgcPal.text - text: "HDOP:" - visible: vehicleIndicator._showGps - } - QGCLabel { - text: activeVehicle ? activeVehicle.gps.hdop.value.toFixed(activeVehicle.gps.hdop.decimalPlaces) : "-" - color: _indicatorsColor - font.pointSize: ScreenTools.smallFontPointSize - Layout.fillWidth: true - Layout.minimumWidth: indicatorValueWidth - horizontalAlignment: firstLabel.horizontalAlignment - visible: vehicleIndicator._showGps - } - - //-- Compass - Item { - Layout.rowSpan: 3 - Layout.column: 6 - Layout.minimumWidth: mainIsMap ? parent.height * 1.25 : 0 - Layout.fillHeight: true - Layout.fillWidth: true - //-- Large circle - Rectangle { - height: mainIsMap ? parent.height : 0 - width: mainIsMap ? height : 0 - radius: height * 0.5 - border.color: qgcPal.text - border.width: 1 - color: Qt.rgba(0,0,0,0) - anchors.centerIn: parent - visible: mainIsMap - } - //-- North Label - Rectangle { - height: mainIsMap ? ScreenTools.defaultFontPixelHeight * 0.75 : 0 - width: mainIsMap ? ScreenTools.defaultFontPixelWidth * 2 : 0 - radius: ScreenTools.defaultFontPixelWidth * 0.25 - color: qgcPal.windowShade - visible: mainIsMap - anchors.top: parent.top - anchors.topMargin: ScreenTools.defaultFontPixelHeight * -0.25 - anchors.horizontalCenter: parent.horizontalCenter - QGCLabel { - text: "N" - color: qgcPal.text - font.pointSize: ScreenTools.smallFontPointSize - anchors.centerIn: parent - } - } - //-- Needle - Image { - id: compassNeedle - anchors.centerIn: parent - height: mainIsMap ? parent.height * 0.75 : 0 - width: height - source: "/custom/img/compass_needle.svg" - fillMode: Image.PreserveAspectFit - visible: mainIsMap - sourceSize.height: height - transform: [ - Rotation { - origin.x: compassNeedle.width / 2 - origin.y: compassNeedle.height / 2 - angle: _heading - }] - } - //-- Heading - Rectangle { - height: mainIsMap ? ScreenTools.defaultFontPixelHeight * 0.75 : 0 - width: mainIsMap ? ScreenTools.defaultFontPixelWidth * 3.5 : 0 - radius: ScreenTools.defaultFontPixelWidth * 0.25 - color: qgcPal.windowShade - visible: mainIsMap - anchors.bottom: parent.bottom - anchors.bottomMargin: ScreenTools.defaultFontPixelHeight * -0.25 - anchors.horizontalCenter: parent.horizontalCenter - QGCLabel { - text: _heading - color: qgcPal.text - font.pointSize: ScreenTools.smallFontPointSize - anchors.centerIn: parent - } - } - } - //-- Second Row - //-- Chronometer - QGCColoredImage { - height: _indicatorsHeight - width: height - source: "/custom/img/chronometer.svg" - fillMode: Image.PreserveAspectFit - sourceSize.height: height - Layout.alignment: Qt.AlignVCenter | Qt.AlignHCenter - color: qgcPal.text - } - QGCLabel { - text: { - if(activeVehicle) - return secondsToHHMMSS(activeVehicle.getFact("flightTime").value) - return "00:00:00" - } - color: _indicatorsColor - font.pointSize: ScreenTools.smallFontPointSize - Layout.fillWidth: true - Layout.minimumWidth: indicatorValueWidth - horizontalAlignment: firstLabel.horizontalAlignment - } - //-- Ground Speed - QGCColoredImage { - height: _indicatorsHeight - width: height - source: "/custom/img/horizontal_speed.svg" - fillMode: Image.PreserveAspectFit - sourceSize.height: height - Layout.alignment: Qt.AlignVCenter | Qt.AlignHCenter - color: qgcPal.text - } - QGCLabel { - text: activeVehicle ? activeVehicle.groundSpeed.value.toFixed(1) + ' ' + activeVehicle.groundSpeed.units : "0.0" - color: _indicatorsColor - font.pointSize: ScreenTools.smallFontPointSize - Layout.fillWidth: true - Layout.minimumWidth: indicatorValueWidth - horizontalAlignment: firstLabel.horizontalAlignment - } - //-- Vertical Speed - QGCColoredImage { - height: _indicatorsHeight - width: height - source: "/custom/img/vertical_speed.svg" - fillMode: Image.PreserveAspectFit - sourceSize.height: height - Layout.alignment: Qt.AlignVCenter | Qt.AlignHCenter - color: qgcPal.text - - } - QGCLabel { - text: activeVehicle ? activeVehicle.climbRate.value.toFixed(1) + ' ' + activeVehicle.climbRate.units : "0.0" - color: _indicatorsColor - font.pointSize: ScreenTools.smallFontPointSize - Layout.fillWidth: true - Layout.minimumWidth: indicatorValueWidth - horizontalAlignment: firstLabel.horizontalAlignment - } - //-- Third Row - //-- Odometer - QGCColoredImage { - height: _indicatorsHeight - width: height - source: "/custom/img/odometer.svg" - fillMode: Image.PreserveAspectFit - sourceSize.height: height - Layout.alignment: Qt.AlignVCenter | Qt.AlignHCenter - color: qgcPal.text - - } - QGCLabel { - text: activeVehicle ? ('00000' + activeVehicle.flightDistance.value.toFixed(0)).slice(-5) + ' ' + activeVehicle.flightDistance.units : "00000" - color: _indicatorsColor - font.pointSize: ScreenTools.smallFontPointSize - Layout.fillWidth: true - Layout.minimumWidth: indicatorValueWidth - horizontalAlignment: firstLabel.horizontalAlignment - } - //-- Altitude - QGCColoredImage { - height: _indicatorsHeight - width: height - source: "/custom/img/altitude.svg" - fillMode: Image.PreserveAspectFit - sourceSize.height: height - Layout.alignment: Qt.AlignVCenter | Qt.AlignHCenter - color: qgcPal.text - - } - QGCLabel { - text: _altitude - color: _indicatorsColor - font.pointSize: ScreenTools.smallFontPointSize - Layout.fillWidth: true - Layout.minimumWidth: indicatorValueWidth - horizontalAlignment: firstLabel.horizontalAlignment - } - //-- Distance - QGCColoredImage { - height: _indicatorsHeight - width: height - source: "/custom/img/distance.svg" - fillMode: Image.PreserveAspectFit - sourceSize.height: height - Layout.alignment: Qt.AlignVCenter | Qt.AlignHCenter - color: qgcPal.text - - } - QGCLabel { - text: _distance ? _distanceStr : noGPS - color: _distance ? _indicatorsColor : qgcPal.colorOrange - font.pointSize: ScreenTools.smallFontPointSize - Layout.fillWidth: true - Layout.minimumWidth: indicatorValueWidth - horizontalAlignment: firstLabel.horizontalAlignment - } - } - MouseArea { - anchors.fill: parent - onDoubleClicked: CustomQuickInterface.showAttitudeWidget = !CustomQuickInterface.showAttitudeWidget - } - } - //------------------------------------------------------------------------- - //-- Attitude Indicator - Rectangle { - color: qgcPal.window - width: attitudeIndicator.width * 0.5 - height: vehicleIndicator.height - visible: CustomQuickInterface.showAttitudeWidget - anchors.top: vehicleIndicator.top - anchors.left: vehicleIndicator.right - } - Rectangle { - id: attitudeIndicator - anchors.bottom: vehicleIndicator.bottom - anchors.bottomMargin: ScreenTools.defaultFontPixelWidth * -0.5 - anchors.right: parent.right - anchors.rightMargin: ScreenTools.defaultFontPixelWidth - height: ScreenTools.defaultFontPixelHeight * 6 - width: height - radius: height * 0.5 - color: qgcPal.windowShade - visible: CustomQuickInterface.showAttitudeWidget - CustomAttitudeWidget { - size: parent.height * 0.95 - vehicle: activeVehicle - showHeading: false - anchors.centerIn: parent - } - } - //------------------------------------------------------------------------- - //-- Multi Vehicle Selector - Row { - id: multiVehicleSelector - spacing: ScreenTools.defaultFontPixelWidth - anchors.bottom: parent.bottom - anchors.bottomMargin: ScreenTools.defaultFontPixelWidth * 1.5 - anchors.right: vehicleIndicator.left - anchors.rightMargin: ScreenTools.defaultFontPixelWidth - visible: QGroundControl.multiVehicleManager.vehicles.count > 1 - Repeater { - model: QGroundControl.multiVehicleManager.vehicles.count - CustomVehicleButton { - property var _vehicle: QGroundControl.multiVehicleManager.vehicles.get(modelData) - vehicle: _vehicle - checked: (_vehicle && activeVehicle) ? _vehicle.id === activeVehicle.id : false - onClicked: { - QGroundControl.multiVehicleManager.activeVehicle = _vehicle - } - } - } - } - //------------------------------------------------------------------------- - //-- Gimbal Control - Rectangle { - id: gimbalControl - visible: camControlLoader.visible && CustomQuickInterface.showGimbalControl && _hasGimbal - anchors.bottom: camControlLoader.bottom - anchors.right: camControlLoader.left - anchors.rightMargin: ScreenTools.defaultFontPixelWidth * (QGroundControl.videoManager.hasThermal ? -1 : 1) - height: parent.width * 0.125 - width: height - color: Qt.rgba(1,1,1,0.25) - radius: width * 0.5 - - property real _currentPitch: 0 - property real _currentYaw: 0 - property real time_last_seconds:0 - property real _lastHackedYaw: 0 - property real speedMultiplier: 5 - - property real maxRate: 20 - property real exponentialFactor:0.6 - property real kPFactor: 3 - - property real reportedYawDeg: activeVehicle ? activeVehicle.gimbalYaw : NaN - property real reportedPitchDeg: activeVehicle ? activeVehicle.gimbalPitch : NaN - - Timer { - interval: 100 //-- 10Hz - running: gimbalControl.visible && activeVehicle - repeat: true - onTriggered: { - if (activeVehicle) { - var yaw = gimbalControl._currentYaw - var oldYaw = yaw; - var pitch = gimbalControl._currentPitch - var oldPitch = pitch; - var pitch_stick = (stick.yAxis * 2.0 - 1.0) - if(_camera && _camera.vendor === "NextVision") { - var time_current_seconds = ((new Date()).getTime())/1000.0 - if(gimbalControl.time_last_seconds === 0.0) - gimbalControl.time_last_seconds = time_current_seconds - var pitch_angle = gimbalControl._currentPitch - // Preparing stick input with exponential curve and maximum rate - var pitch_expo = (1 - gimbalControl.exponentialFactor) * pitch_stick + gimbalControl.exponentialFactor * pitch_stick * pitch_stick * pitch_stick - var pitch_rate = pitch_stick * gimbalControl.maxRate - var pitch_angle_reported = gimbalControl.reportedPitchDeg - // Integrate the angular rate to an angle time abstracted - pitch_angle += pitch_rate * (time_current_seconds - gimbalControl.time_last_seconds) - // Control the angle quicker by driving the gimbal internal angle controller into saturation - var pitch_angle_error = pitch_angle - pitch_angle_reported - pitch_angle_error = Math.round(pitch_angle_error) - var pitch_setpoint = pitch_angle + pitch_angle_error * gimbalControl.kPFactor - //console.info("error: " + pitch_angle_error + "; angle_state: " + pitch_angle) - pitch = pitch_setpoint - yaw += stick.xAxis * gimbalControl.speedMultiplier - - yaw = clamp(yaw, -180, 180) - pitch = clamp(pitch, -90, 45) - pitch_angle = clamp(pitch_angle, -90, 45) - - //console.info("P: " + pitch + "; Y: " + yaw) - activeVehicle.gimbalControlValue(pitch, yaw); - gimbalControl._currentYaw = yaw - gimbalControl._currentPitch = pitch_angle - gimbalControl.time_last_seconds = time_current_seconds - } else { - yaw += stick.xAxis * gimbalControl.speedMultiplier - var hackedYaw = yaw + (stick.xAxis * gimbalControl.speedMultiplier * 50) - pitch += pitch_stick * gimbalControl.speedMultiplier - hackedYaw = clamp(hackedYaw, -180, 180) - yaw = clamp(yaw, -180, 180) - pitch = clamp(pitch, -90, 90) - if(gimbalControl._lastHackedYaw !== hackedYaw || gimbalControl.hackedYaw !== oldYaw || pitch !== oldPitch) { - activeVehicle.gimbalControlValue(pitch, hackedYaw) - gimbalControl._lastHackedYaw = hackedYaw - gimbalControl._currentPitch = pitch - gimbalControl._currentYaw = yaw - } - } - } - } - function clamp(num, min, max) { - return Math.min(Math.max(num, min), max); - } - } - JoystickThumbPad { - id: stick - anchors.fill: parent - lightColors: qgcPal.globalTheme === QGCPalette.Light - yAxisThrottle: true - yAxisThrottleCentered: true - xAxis: 0 - yAxis: 0.5 - } - } - //------------------------------------------------------------------------- - //-- Object Avoidance - Item { - visible: activeVehicle && activeVehicle.objectAvoidance.available && activeVehicle.objectAvoidance.enabled - anchors.centerIn: parent - width: parent.width * 0.5 - height: parent.height * 0.5 - Repeater { - model: activeVehicle && activeVehicle.objectAvoidance.gridSize > 0 ? activeVehicle.objectAvoidance.gridSize : [] - Rectangle { - width: ScreenTools.defaultFontPixelWidth - height: width - radius: width * 0.5 - color: distance < 0.25 ? "red" : "orange" - x: (parent.width * activeVehicle.objectAvoidance.grid(modelData).x) + (parent.width * 0.5) - y: (parent.height * activeVehicle.objectAvoidance.grid(modelData).y) + (parent.height * 0.5) - property real distance: activeVehicle.objectAvoidance.distance(modelData) - } - } - } - //------------------------------------------------------------------------- - //-- Connection Lost While Armed - Popup { - id: connectionLostArmed - width: mainWindow.width * 0.666 - height: connectionLostArmedCol.height * 1.5 - modal: true - focus: true - parent: Overlay.overlay - x: Math.round((mainWindow.width - width) * 0.5) - y: Math.round((mainWindow.height - height) * 0.5) - closePolicy: Popup.CloseOnEscape | Popup.CloseOnPressOutside - background: Rectangle { - anchors.fill: parent - color: qgcPal.alertBackground - border.color: qgcPal.alertBorder - radius: ScreenTools.defaultFontPixelWidth - } - Column { - id: connectionLostArmedCol - spacing: ScreenTools.defaultFontPixelHeight * 3 - anchors.margins: ScreenTools.defaultFontPixelHeight - anchors.centerIn: parent - QGCLabel { - text: qsTr("Communication Lost") - font.family: ScreenTools.demiboldFontFamily - font.pointSize: ScreenTools.largeFontPointSize - color: qgcPal.alertText - anchors.horizontalCenter: parent.horizontalCenter - } - QGCLabel { - text: qsTr("Warning: Connection to vehicle lost.") - color: qgcPal.alertText - font.family: ScreenTools.demiboldFontFamily - font.pointSize: ScreenTools.mediumFontPointSize - anchors.horizontalCenter: parent.horizontalCenter - } - QGCLabel { - text: qsTr("The vehicle will automatically cancel the flight and return to land. Ensure a clear line of sight between transmitter and vehicle. Ensure the takeoff location is clear.") - width: connectionLostArmed.width * 0.75 - wrapMode: Text.WordWrap - color: qgcPal.alertText - font.family: ScreenTools.demiboldFontFamily - font.pointSize: ScreenTools.mediumFontPointSize - anchors.horizontalCenter: parent.horizontalCenter - } - } - } -} diff --git a/custom-example/res/CustomFlyViewOverlay.qml b/custom-example/res/CustomFlyViewOverlay.qml new file mode 100644 index 0000000000000000000000000000000000000000..ebae0ba3bb17a2533784b7c986e56763c05b491a --- /dev/null +++ b/custom-example/res/CustomFlyViewOverlay.qml @@ -0,0 +1,390 @@ +/**************************************************************************** + * + * (c) 2009-2019 QGROUNDCONTROL PROJECT + * + * QGroundControl is licensed according to the terms in the file + * COPYING.md in the root of the source code directory. + * + * @file + * @author Gus Grubba + */ + +import QtQuick 2.11 +import QtQuick.Controls 2.4 +import QtQuick.Layouts 1.11 +import QtQuick.Dialogs 1.3 +import QtPositioning 5.2 + +import QGroundControl 1.0 +import QGroundControl.Controls 1.0 +import QGroundControl.FlightMap 1.0 +import QGroundControl.Palette 1.0 +import QGroundControl.ScreenTools 1.0 +import QGroundControl.Vehicle 1.0 +import QGroundControl.QGCPositionManager 1.0 + +import Custom.Widgets 1.0 + +Item { + anchors.fill: parent + visible: !QGroundControl.videoManager.fullScreen + + readonly property string scaleState: "topMode" + readonly property string noGPS: qsTr("NO GPS") + readonly property real indicatorValueWidth: ScreenTools.defaultFontPixelWidth * 7 + + property real _indicatorDiameter: ScreenTools.defaultFontPixelWidth * 18 + property real _indicatorsHeight: ScreenTools.defaultFontPixelHeight + property var _sepColor: qgcPal.globalTheme === QGCPalette.Light ? Qt.rgba(0,0,0,0.5) : Qt.rgba(1,1,1,0.5) + property color _indicatorsColor: qgcPal.text + + property bool _isVehicleGps: activeVehicle && activeVehicle.gps && activeVehicle.gps.count.rawValue > 1 && activeVehicle.gps.hdop.rawValue < 1.4 + + property string _altitude: activeVehicle ? (isNaN(activeVehicle.altitudeRelative.value) ? "0.0" : activeVehicle.altitudeRelative.value.toFixed(1)) + ' ' + activeVehicle.altitudeRelative.units : "0.0" + property string _distanceStr: isNaN(_distance) ? "0" : _distance.toFixed(0) + ' ' + (activeVehicle ? activeVehicle.altitudeRelative.units : "") + property real _heading: activeVehicle ? activeVehicle.heading.rawValue : 0 + + property real _distance: 0.0 + property string _messageTitle: "" + property string _messageText: "" + + function secondsToHHMMSS(timeS) { + var sec_num = parseInt(timeS, 10); + var hours = Math.floor(sec_num / 3600); + var minutes = Math.floor((sec_num - (hours * 3600)) / 60); + var seconds = sec_num - (hours * 3600) - (minutes * 60); + if (hours < 10) {hours = "0"+hours;} + if (minutes < 10) {minutes = "0"+minutes;} + if (seconds < 10) {seconds = "0"+seconds;} + return hours+':'+minutes+':'+seconds; + } + + // FIXE: Isn't distance to home in factgroup + Connections { + target: QGroundControl.qgcPositionManger + onGcsPositionChanged: { + if (activeVehicle && gcsPosition.latitude && Math.abs(gcsPosition.latitude) > 0.001 && gcsPosition.longitude && Math.abs(gcsPosition.longitude) > 0.001) { + var gcs = QtPositioning.coordinate(gcsPosition.latitude, gcsPosition.longitude) + var veh = activeVehicle.coordinate; + _distance = QGroundControl.metersToAppSettingsDistanceUnits(gcs.distanceTo(veh)); + //-- Ignore absurd values + if(_distance > 99999) + _distance = 0; + if(_distance < 0) + _distance = 0; + } else { + _distance = 0; + } + } + } + + //------------------------------------------------------------------------- + //-- Heading Indicator + Rectangle { + id: compassBar + height: ScreenTools.defaultFontPixelHeight * 1.5 + width: ScreenTools.defaultFontPixelWidth * 50 + color: "#DEDEDE" + radius: 2 + clip: true + anchors.top: parent.top + anchors.topMargin: ScreenTools.defaultFontPixelHeight + anchors.horizontalCenter: parent.horizontalCenter + visible: !mainIsMap + Repeater { + model: 720 + visible: !mainIsMap + QGCLabel { + function _normalize(degrees) { + var a = degrees % 360 + if (a < 0) a += 360 + return a + } + property int _startAngle: modelData + 180 + _heading + property int _angle: _normalize(_startAngle) + anchors.verticalCenter: parent.verticalCenter + x: visible ? ((modelData * (compassBar.width / 360)) - (width * 0.5)) : 0 + visible: _angle % 45 == 0 + color: "#75505565" + font.pointSize: ScreenTools.smallFontPointSize + text: { + switch(_angle) { + case 0: return "N" + case 45: return "NE" + case 90: return "E" + case 135: return "SE" + case 180: return "S" + case 225: return "SW" + case 270: return "W" + case 315: return "NW" + } + return "" + } + } + } + } + Rectangle { + id: headingIndicator + height: ScreenTools.defaultFontPixelHeight + width: ScreenTools.defaultFontPixelWidth * 4 + color: qgcPal.windowShadeDark + visible: !mainIsMap + anchors.bottom: compassBar.top + anchors.bottomMargin: ScreenTools.defaultFontPixelHeight * -0.1 + anchors.horizontalCenter: parent.horizontalCenter + QGCLabel { + text: _heading + color: qgcPal.text + font.pointSize: ScreenTools.smallFontPointSize + anchors.centerIn: parent + } + } + Image { + height: _indicatorsHeight + width: height + source: "/custom/img/compass_pointer.svg" + visible: !mainIsMap + fillMode: Image.PreserveAspectFit + sourceSize.height: height + anchors.top: compassBar.bottom + anchors.topMargin: ScreenTools.defaultFontPixelHeight * -0.5 + anchors.horizontalCenter: parent.horizontalCenter + } + //------------------------------------------------------------------------- + //-- Vehicle Indicator + Rectangle { + id: vehicleIndicator + color: qgcPal.window + width: vehicleStatusGrid.width + (ScreenTools.defaultFontPixelWidth * 3) + height: vehicleStatusGrid.height + (ScreenTools.defaultFontPixelHeight * 1.5) + radius: 2 + anchors.bottom: parent.bottom + anchors.bottomMargin: ScreenTools.defaultFontPixelWidth + anchors.right: attitudeIndicator.visible ? attitudeIndicator.left : parent.right + anchors.rightMargin: attitudeIndicator.visible ? -ScreenTools.defaultFontPixelWidth : ScreenTools.defaultFontPixelWidth + + GridLayout { + id: vehicleStatusGrid + columnSpacing: ScreenTools.defaultFontPixelWidth * 1.5 + rowSpacing: ScreenTools.defaultFontPixelHeight * 0.5 + columns: 7 + anchors.centerIn: parent + + //-- Compass + Item { + Layout.rowSpan: 3 + Layout.column: 6 + Layout.minimumWidth: mainIsMap ? parent.height * 1.25 : 0 + Layout.fillHeight: true + Layout.fillWidth: true + //-- Large circle + Rectangle { + height: mainIsMap ? parent.height : 0 + width: mainIsMap ? height : 0 + radius: height * 0.5 + border.color: qgcPal.text + border.width: 1 + color: Qt.rgba(0,0,0,0) + anchors.centerIn: parent + visible: mainIsMap + } + //-- North Label + Rectangle { + height: mainIsMap ? ScreenTools.defaultFontPixelHeight * 0.75 : 0 + width: mainIsMap ? ScreenTools.defaultFontPixelWidth * 2 : 0 + radius: ScreenTools.defaultFontPixelWidth * 0.25 + color: qgcPal.windowShade + visible: mainIsMap + anchors.top: parent.top + anchors.topMargin: ScreenTools.defaultFontPixelHeight * -0.25 + anchors.horizontalCenter: parent.horizontalCenter + QGCLabel { + text: "N" + color: qgcPal.text + font.pointSize: ScreenTools.smallFontPointSize + anchors.centerIn: parent + } + } + //-- Needle + Image { + id: compassNeedle + anchors.centerIn: parent + height: mainIsMap ? parent.height * 0.75 : 0 + width: height + source: "/custom/img/compass_needle.svg" + fillMode: Image.PreserveAspectFit + visible: mainIsMap + sourceSize.height: height + transform: [ + Rotation { + origin.x: compassNeedle.width / 2 + origin.y: compassNeedle.height / 2 + angle: _heading + }] + } + //-- Heading + Rectangle { + height: mainIsMap ? ScreenTools.defaultFontPixelHeight * 0.75 : 0 + width: mainIsMap ? ScreenTools.defaultFontPixelWidth * 3.5 : 0 + radius: ScreenTools.defaultFontPixelWidth * 0.25 + color: qgcPal.windowShade + visible: mainIsMap + anchors.bottom: parent.bottom + anchors.bottomMargin: ScreenTools.defaultFontPixelHeight * -0.25 + anchors.horizontalCenter: parent.horizontalCenter + QGCLabel { + text: _heading + color: qgcPal.text + font.pointSize: ScreenTools.smallFontPointSize + anchors.centerIn: parent + } + } + } + //-- Second Row + //-- Chronometer + QGCColoredImage { + height: _indicatorsHeight + width: height + source: "/custom/img/chronometer.svg" + fillMode: Image.PreserveAspectFit + sourceSize.height: height + Layout.alignment: Qt.AlignVCenter | Qt.AlignHCenter + color: qgcPal.text + } + QGCLabel { + id: firstLabel + text: { + if(activeVehicle) + return secondsToHHMMSS(activeVehicle.getFact("flightTime").value) + return "00:00:00" + } + color: _indicatorsColor + font.pointSize: ScreenTools.smallFontPointSize + Layout.fillWidth: true + Layout.minimumWidth: indicatorValueWidth + horizontalAlignment: Text.AlignLeft + } + //-- Ground Speed + QGCColoredImage { + height: _indicatorsHeight + width: height + source: "/custom/img/horizontal_speed.svg" + fillMode: Image.PreserveAspectFit + sourceSize.height: height + Layout.alignment: Qt.AlignVCenter | Qt.AlignHCenter + color: qgcPal.text + } + QGCLabel { + text: activeVehicle ? activeVehicle.groundSpeed.value.toFixed(1) + ' ' + activeVehicle.groundSpeed.units : "0.0" + color: _indicatorsColor + font.pointSize: ScreenTools.smallFontPointSize + Layout.fillWidth: true + Layout.minimumWidth: indicatorValueWidth + horizontalAlignment: firstLabel.horizontalAlignment + } + //-- Vertical Speed + QGCColoredImage { + height: _indicatorsHeight + width: height + source: "/custom/img/vertical_speed.svg" + fillMode: Image.PreserveAspectFit + sourceSize.height: height + Layout.alignment: Qt.AlignVCenter | Qt.AlignHCenter + color: qgcPal.text + + } + QGCLabel { + text: activeVehicle ? activeVehicle.climbRate.value.toFixed(1) + ' ' + activeVehicle.climbRate.units : "0.0" + color: _indicatorsColor + font.pointSize: ScreenTools.smallFontPointSize + Layout.fillWidth: true + Layout.minimumWidth: indicatorValueWidth + horizontalAlignment: firstLabel.horizontalAlignment + } + //-- Third Row + //-- Odometer + QGCColoredImage { + height: _indicatorsHeight + width: height + source: "/custom/img/odometer.svg" + fillMode: Image.PreserveAspectFit + sourceSize.height: height + Layout.alignment: Qt.AlignVCenter | Qt.AlignHCenter + color: qgcPal.text + + } + QGCLabel { + text: activeVehicle ? ('00000' + activeVehicle.flightDistance.value.toFixed(0)).slice(-5) + ' ' + activeVehicle.flightDistance.units : "00000" + color: _indicatorsColor + font.pointSize: ScreenTools.smallFontPointSize + Layout.fillWidth: true + Layout.minimumWidth: indicatorValueWidth + horizontalAlignment: firstLabel.horizontalAlignment + } + //-- Altitude + QGCColoredImage { + height: _indicatorsHeight + width: height + source: "/custom/img/altitude.svg" + fillMode: Image.PreserveAspectFit + sourceSize.height: height + Layout.alignment: Qt.AlignVCenter | Qt.AlignHCenter + color: qgcPal.text + + } + QGCLabel { + text: _altitude + color: _indicatorsColor + font.pointSize: ScreenTools.smallFontPointSize + Layout.fillWidth: true + Layout.minimumWidth: indicatorValueWidth + horizontalAlignment: firstLabel.horizontalAlignment + } + //-- Distance + QGCColoredImage { + height: _indicatorsHeight + width: height + source: "/custom/img/distance.svg" + fillMode: Image.PreserveAspectFit + sourceSize.height: height + Layout.alignment: Qt.AlignVCenter | Qt.AlignHCenter + color: qgcPal.text + + } + QGCLabel { + text: _distance ? _distanceStr : noGPS + color: _distance ? _indicatorsColor : qgcPal.colorOrange + font.pointSize: ScreenTools.smallFontPointSize + Layout.fillWidth: true + Layout.minimumWidth: indicatorValueWidth + horizontalAlignment: firstLabel.horizontalAlignment + } + } + } + //------------------------------------------------------------------------- + //-- Attitude Indicator + Rectangle { + color: qgcPal.window + width: attitudeIndicator.width * 0.5 + height: vehicleIndicator.height + anchors.top: vehicleIndicator.top + anchors.left: vehicleIndicator.right + } + Rectangle { + id: attitudeIndicator + anchors.bottom: vehicleIndicator.bottom + anchors.bottomMargin: ScreenTools.defaultFontPixelWidth * -0.5 + anchors.right: parent.right + anchors.rightMargin: ScreenTools.defaultFontPixelWidth + height: ScreenTools.defaultFontPixelHeight * 6 + width: height + radius: height * 0.5 + color: qgcPal.windowShade + CustomAttitudeWidget { + size: parent.height * 0.95 + vehicle: activeVehicle + showHeading: false + anchors.centerIn: parent + } + } +} diff --git a/custom-example/res/Images/CustomAppIcon.png b/custom-example/res/Images/CustomAppIcon.png new file mode 100644 index 0000000000000000000000000000000000000000..d9e9e79f6cd3df788dae2236254f5dfc2bcbff87 Binary files /dev/null and b/custom-example/res/Images/CustomAppIcon.png differ diff --git a/custom-example/res/Images/CustomVehicleIcon.svg b/custom-example/res/Images/CustomVehicleIcon.svg new file mode 100644 index 0000000000000000000000000000000000000000..341f04cebce021547f8134fb8205e83b5e80aef1 --- /dev/null +++ b/custom-example/res/Images/CustomVehicleIcon.svg @@ -0,0 +1,7 @@ + + + + + Svg Vector Icons : http://www.onlinewebfonts.com/icon + + \ No newline at end of file diff --git a/custom-example/res/Images/PairingButton.svg b/custom-example/res/Images/PairingButton.svg deleted file mode 100644 index 1166e2088531d3f02037d96689860f18e3ce50d9..0000000000000000000000000000000000000000 --- a/custom-example/res/Images/PairingButton.svg +++ /dev/null @@ -1,23 +0,0 @@ - - - - - - - diff --git a/custom-example/res/Images/PairingConnected.svg b/custom-example/res/Images/PairingConnected.svg deleted file mode 100644 index 02ac3be8013eb9ef2c442180c1884149119dc910..0000000000000000000000000000000000000000 --- a/custom-example/res/Images/PairingConnected.svg +++ /dev/null @@ -1,44 +0,0 @@ - - - - - - - - - - diff --git a/custom-example/res/Images/PairingError.svg b/custom-example/res/Images/PairingError.svg deleted file mode 100644 index db184514218ec8b85ace94d8feb58ad60bbcdd14..0000000000000000000000000000000000000000 --- a/custom-example/res/Images/PairingError.svg +++ /dev/null @@ -1,11 +0,0 @@ - - - - - - diff --git a/custom-example/res/Images/PairingIcon.svg b/custom-example/res/Images/PairingIcon.svg deleted file mode 100644 index aff3e41e0c410917695aabaa5bd7112bcdd3e70e..0000000000000000000000000000000000000000 --- a/custom-example/res/Images/PairingIcon.svg +++ /dev/null @@ -1,31 +0,0 @@ - - - - - - - diff --git a/custom-example/res/Images/PairingIconLight.svg b/custom-example/res/Images/PairingIconLight.svg deleted file mode 100644 index 76a193c96c780573af4b0b99054dfa3a6f8a18cd..0000000000000000000000000000000000000000 --- a/custom-example/res/Images/PairingIconLight.svg +++ /dev/null @@ -1,29 +0,0 @@ - - - - - - - - - - diff --git a/custom-example/res/Images/camera_photo.svg b/custom-example/res/Images/camera_photo.svg deleted file mode 100644 index 80e638941ad33bf8ec664feb4fdd5b7cdbf5b7a6..0000000000000000000000000000000000000000 --- a/custom-example/res/Images/camera_photo.svg +++ /dev/null @@ -1,15 +0,0 @@ - - - - - - - diff --git a/custom-example/res/Images/camera_settings.svg b/custom-example/res/Images/camera_settings.svg deleted file mode 100644 index 97c97489b1809b00fb818ab1000d96f8a1b203ea..0000000000000000000000000000000000000000 --- a/custom-example/res/Images/camera_settings.svg +++ /dev/null @@ -1,12 +0,0 @@ - - - - - - diff --git a/custom-example/res/Images/camera_video.svg b/custom-example/res/Images/camera_video.svg deleted file mode 100644 index 7889b35b1162b41224d03ca96bf69a044120f583..0000000000000000000000000000000000000000 --- a/custom-example/res/Images/camera_video.svg +++ /dev/null @@ -1,10 +0,0 @@ - - - - - - - - diff --git a/custom-example/res/Images/gimbal_icon.svg b/custom-example/res/Images/gimbal_icon.svg deleted file mode 100644 index e4273b7b0e6be9682eaea04c9380e9d5996d60c3..0000000000000000000000000000000000000000 --- a/custom-example/res/Images/gimbal_icon.svg +++ /dev/null @@ -1,26 +0,0 @@ - - - - -670134 -Created with Sketch. - - diff --git a/custom-example/res/Images/gimbal_pitch.svg b/custom-example/res/Images/gimbal_pitch.svg deleted file mode 100644 index d53c3129cefbdcbb6fddde958249f2bed1ce2191..0000000000000000000000000000000000000000 --- a/custom-example/res/Images/gimbal_pitch.svg +++ /dev/null @@ -1,11 +0,0 @@ - - - - - - - - - - - diff --git a/custom-example/res/Images/gimbal_pitch_indoors.svg b/custom-example/res/Images/gimbal_pitch_indoors.svg deleted file mode 100644 index f153e91bbdac565f382a55eaac480ffbecc5ef78..0000000000000000000000000000000000000000 --- a/custom-example/res/Images/gimbal_pitch_indoors.svg +++ /dev/null @@ -1,11 +0,0 @@ - - - - - - - - - - - diff --git a/custom-example/res/Images/gimbal_pitch_outdoors.svg b/custom-example/res/Images/gimbal_pitch_outdoors.svg deleted file mode 100644 index 90312c77c854b2e354f511494ae5f096a0974358..0000000000000000000000000000000000000000 --- a/custom-example/res/Images/gimbal_pitch_outdoors.svg +++ /dev/null @@ -1,11 +0,0 @@ - - - - - - - - - - - diff --git a/custom-example/res/Images/gimbal_position.svg b/custom-example/res/Images/gimbal_position.svg deleted file mode 100644 index 14e72b8a62d25f4a67fde1adbec9fa495ffec967..0000000000000000000000000000000000000000 --- a/custom-example/res/Images/gimbal_position.svg +++ /dev/null @@ -1,10 +0,0 @@ - - - - - - - - - - diff --git a/custom-example/res/Images/thermal-brightness.svg b/custom-example/res/Images/thermal-brightness.svg deleted file mode 100644 index 7319222623413a122044321560331dd5df97ac17..0000000000000000000000000000000000000000 --- a/custom-example/res/Images/thermal-brightness.svg +++ /dev/null @@ -1,19 +0,0 @@ - - - - - - - - - diff --git a/custom-example/res/Images/thermal-palette.svg b/custom-example/res/Images/thermal-palette.svg deleted file mode 100644 index 86154314242a9826f9004def7e4c5fdc69eb4bf0..0000000000000000000000000000000000000000 --- a/custom-example/res/Images/thermal-palette.svg +++ /dev/null @@ -1,17 +0,0 @@ - - - - - - - - - diff --git a/custom-example/res/Images/thermal-pip.svg b/custom-example/res/Images/thermal-pip.svg deleted file mode 100644 index 22518b141a7cef29bb2209163466007438aaa7d7..0000000000000000000000000000000000000000 --- a/custom-example/res/Images/thermal-pip.svg +++ /dev/null @@ -1,11 +0,0 @@ - - - - - - - diff --git a/custom-example/res/Images/thermal-standard.svg b/custom-example/res/Images/thermal-standard.svg deleted file mode 100644 index b5ecc3cc31caf4b042411c7b508b18b555a0dd67..0000000000000000000000000000000000000000 --- a/custom-example/res/Images/thermal-standard.svg +++ /dev/null @@ -1,9 +0,0 @@ - - - - - - diff --git a/custom-example/res/MainToolbar/CustomArmedIndicator.qml b/custom-example/res/MainToolbar/CustomArmedIndicator.qml deleted file mode 100644 index db1edb9427b9f21d5e50cc24122859b7e843ced5..0000000000000000000000000000000000000000 --- a/custom-example/res/MainToolbar/CustomArmedIndicator.qml +++ /dev/null @@ -1,56 +0,0 @@ -/**************************************************************************** - * - * (c) 2009-2019 QGROUNDCONTROL PROJECT - * - * QGroundControl is licensed according to the terms in the file - * COPYING.md in the root of the source code directory. - * - * @file - * @author Gus Grubba - */ - -import QtQuick 2.11 -import QtQuick.Controls 1.2 - -import QGroundControl 1.0 -import QGroundControl.MultiVehicleManager 1.0 -import QGroundControl.Controls 1.0 -import QGroundControl.Palette 1.0 -import QGroundControl.ScreenTools 1.0 - -//------------------------------------------------------------------------- -//-- Armed Indicator -Rectangle { - anchors.top: parent.top - anchors.bottom: parent.bottom - width: labelRow.width + (ScreenTools.defaultFontPixelWidth * 6) - color: qgcPal.windowShade - - property bool _armed: activeVehicle ? activeVehicle.armed : false - - Row { - id: labelRow - spacing: ScreenTools.defaultFontPixelWidth - anchors.centerIn: parent - QGCLabel { - id: labelText - text: _armed ? qsTr("Armed") : qsTr("Disarmed") - color: qgcPal.text - font.pointSize: ScreenTools.defaultFontPointSize - anchors.verticalCenter: parent.verticalCenter - } - Rectangle { - height: ScreenTools.defaultFontPixelHeight * 0.5 - width: height - radius: height * 0.5 - color: _armed ? qgcPal.colorGreen : qgcPal.colorRed - border.color: qgcPal.window - border.width: 1 - anchors.verticalCenter: parent.verticalCenter - } - } - QGCMouseArea { - fillItem: parent - onClicked: _armed ? mainWindow.disarmVehicle() : mainWindow.armVehicle() - } -} diff --git a/custom-example/res/MainToolbar/CustomBatteryIndicator.qml b/custom-example/res/MainToolbar/CustomBatteryIndicator.qml deleted file mode 100644 index 6e58fb95a77210bf554dc7b41947a761ec59f5b2..0000000000000000000000000000000000000000 --- a/custom-example/res/MainToolbar/CustomBatteryIndicator.qml +++ /dev/null @@ -1,207 +0,0 @@ -/**************************************************************************** - * - * (c) 2009-2019 QGROUNDCONTROL PROJECT - * - * QGroundControl is licensed according to the terms in the file - * COPYING.md in the root of the source code directory. - * - * @file - * @author Gus Grubba - */ - -import QtQuick 2.11 -import QtQuick.Controls 1.4 -import QtQuick.Layouts 1.11 - -import QGroundControl 1.0 -import QGroundControl.Controls 1.0 -import QGroundControl.MultiVehicleManager 1.0 -import QGroundControl.ScreenTools 1.0 -import QGroundControl.Palette 1.0 - -//------------------------------------------------------------------------- -//-- Battery Indicator -Item { - id: _root - width: batteryIndicatorRow.width - anchors.top: parent.top - anchors.bottom: parent.bottom - - property var battery1: activeVehicle ? activeVehicle.battery : null - property var battery2: activeVehicle ? activeVehicle.battery2 : null - property bool hasSecondBattery: battery2 && battery2.voltage.value !== -1 - - function lowestBattery() { - if(activeVehicle) { - if(hasSecondBattery) { - if(activeVehicle.battery2.percentRemaining.value < activeVehicle.battery.percentRemaining.value) { - return activeVehicle.battery2 - } - } - return activeVehicle.battery - } - return null - } - - function getBatteryColor(battery) { - if(battery) { - if(battery.percentRemaining.value > 75) { - return qgcPal.text - } - if(battery.percentRemaining.value > 50) { - return qgcPal.colorOrange - } - if(battery.percentRemaining.value > 0.1) { - return qgcPal.colorRed - } - } - return qgcPal.colorGrey - } - - function getBatteryPercentageText(battery) { - if(battery) { - if(battery.percentRemaining.value > 98.9) { - return "100%" - } - if(battery.percentRemaining.value > 0.1) { - return battery.percentRemaining.valueString + battery.percentRemaining.units - } - if(battery.voltage.value >= 0) { - return battery.voltage.valueString + battery.voltage.units - } - } - return "N/A" - } - - Component { - id: batteryInfo - - Rectangle { - width: battCol.width + ScreenTools.defaultFontPixelWidth * 3 - height: battCol.height + ScreenTools.defaultFontPixelHeight * 2 - radius: ScreenTools.defaultFontPixelHeight * 0.5 - color: qgcPal.window - - Column { - id: battCol - spacing: ScreenTools.defaultFontPixelHeight * 0.5 - width: Math.max(battGrid.width, battLabel.width) - anchors.margins: ScreenTools.defaultFontPixelHeight - anchors.centerIn: parent - - QGCLabel { - id: battLabel - text: qsTr("Battery Status") - font.family: ScreenTools.demiboldFontFamily - anchors.horizontalCenter: parent.horizontalCenter - } - - GridLayout { - id: battGrid - anchors.margins: ScreenTools.defaultFontPixelHeight - columnSpacing: ScreenTools.defaultFontPixelWidth - columns: 2 - anchors.horizontalCenter: parent.horizontalCenter - - QGCLabel { - id: batteryLabel - text: qsTr("Battery 1") - Layout.alignment: Qt.AlignVCenter - } - QGCColoredImage { - height: batteryLabel.height - width: height - sourceSize.width: width - source: "/qmlimages/Battery.svg" - color: qgcPal.text - fillMode: Image.PreserveAspectFit - Rectangle { - color: getBatteryColor(activeVehicle ? activeVehicle.battery : null) - anchors.left: parent.left - anchors.leftMargin: ScreenTools.defaultFontPixelWidth * 0.125 - height: parent.height * 0.35 - width: activeVehicle ? (activeVehicle.battery.percentRemaining.value / 100) * parent.width * 0.875 : 0 - anchors.verticalCenter: parent.verticalCenter - } - } - - QGCLabel { text: qsTr("Voltage:") } - QGCLabel { text: (battery1 && battery1.voltage.value !== -1) ? (battery1.voltage.valueString + " " + battery1.voltage.units) : "N/A" } - QGCLabel { text: qsTr("Accumulated Consumption:") } - QGCLabel { text: (battery1 && battery1.mahConsumed.value !== -1) ? (battery1.mahConsumed.valueString + " " + battery1.mahConsumed.units) : "N/A" } - Item { - width: 1 - height: 1 - visible: hasSecondBattery; - Layout.columnSpan: 2 - } - - QGCLabel { - text: qsTr("Battery 2") - visible: hasSecondBattery - Layout.alignment: Qt.AlignVCenter - } - QGCColoredImage { - height: batteryLabel.height - width: height - sourceSize.width: width - source: "/qmlimages/Battery.svg" - color: qgcPal.text - visible: hasSecondBattery - fillMode: Image.PreserveAspectFit - Rectangle { - color: getBatteryColor(activeVehicle ? activeVehicle.battery2 : null) - anchors.left: parent.left - anchors.leftMargin: ScreenTools.defaultFontPixelWidth * 0.125 - height: parent.height * 0.35 - width: activeVehicle ? (activeVehicle.battery2.percentRemaining.value / 100) * parent.width * 0.875 : 0 - anchors.verticalCenter: parent.verticalCenter - } - } - - QGCLabel { text: qsTr("Voltage:"); visible: hasSecondBattery; } - QGCLabel { text: (battery2 && battery2.voltage.value !== -1) ? (battery2.voltage.valueString + " " + battery2.voltage.units) : "N/A"; visible: hasSecondBattery; } - QGCLabel { text: qsTr("Accumulated Consumption:"); visible: hasSecondBattery; } - QGCLabel { text: (battery2 && battery2.mahConsumed.value !== -1) ? (battery2.mahConsumed.valueString + " " + battery2.mahConsumed.units) : "N/A"; visible: hasSecondBattery; } - } - } - } - } - - Row { - id: batteryIndicatorRow - anchors.top: parent.top - anchors.bottom: parent.bottom - opacity: (activeVehicle && activeVehicle.battery.voltage.value >= 0) ? 1 : 0.5 - spacing: ScreenTools.defaultFontPixelWidth - QGCColoredImage { - anchors.top: parent.top - anchors.bottom: parent.bottom - width: height - sourceSize.width: width - source: "/qmlimages/Battery.svg" - color: qgcPal.text - fillMode: Image.PreserveAspectFit - Rectangle { - color: getBatteryColor(lowestBattery()) - anchors.left: parent.left - anchors.leftMargin: ScreenTools.defaultFontPixelWidth * 0.25 - height: parent.height * 0.35 - width: activeVehicle ? (activeVehicle.battery.percentRemaining.value / 100) * parent.width * 0.75 : 0 - anchors.verticalCenter: parent.verticalCenter - } - } - QGCLabel { - text: getBatteryPercentageText(lowestBattery()) - font.pointSize: ScreenTools.smallFontPointSize - color: getBatteryColor(lowestBattery()) - anchors.verticalCenter: parent.verticalCenter - } - } - MouseArea { - anchors.fill: parent - onClicked: { - mainWindow.showPopUp(_root, batteryInfo) - } - } -} diff --git a/custom-example/res/MainToolbar/CustomGPSIndicator.qml b/custom-example/res/MainToolbar/CustomGPSIndicator.qml deleted file mode 100644 index 6dfc4f166769b36ae20f4331fa02998b050de8bf..0000000000000000000000000000000000000000 --- a/custom-example/res/MainToolbar/CustomGPSIndicator.qml +++ /dev/null @@ -1,120 +0,0 @@ -/**************************************************************************** - * - * (c) 2009-2019 QGROUNDCONTROL PROJECT - * - * QGroundControl is licensed according to the terms in the file - * COPYING.md in the root of the source code directory. - * - * @file - * @author Gus Grubba - */ - -import QtQuick 2.11 -import QtQuick.Controls 1.4 -import QtQuick.Layouts 1.11 - -import QGroundControl 1.0 -import QGroundControl.Controls 1.0 -import QGroundControl.MultiVehicleManager 1.0 -import QGroundControl.ScreenTools 1.0 -import QGroundControl.Palette 1.0 - -import Custom.Widgets 1.0 - -//------------------------------------------------------------------------- -//-- GPS Indicator -Item { - id: _root - width: gpsRow.width - anchors.top: parent.top - anchors.bottom: parent.bottom - - function getGPSSignal() { - if(!activeVehicle || activeVehicle.gps.count.rawValue < 1 || activeVehicle.gps.hdop.rawValue > 1.4) { - return 0; - } else if(activeVehicle.gps.hdop.rawValue < 1.0) { - return 100; - } else if(activeVehicle.gps.hdop.rawValue < 1.1) { - return 75; - } else if(activeVehicle.gps.hdop.rawValue < 1.2) { - return 50; - } else { - return 25; - } - } - - Component { - id: gpsInfo - - Rectangle { - width: gpsCol.width + ScreenTools.defaultFontPixelWidth * 3 - height: gpsCol.height + ScreenTools.defaultFontPixelHeight * 2 - radius: ScreenTools.defaultFontPixelHeight * 0.5 - color: qgcPal.window - - Column { - id: gpsCol - spacing: ScreenTools.defaultFontPixelHeight * 0.5 - width: Math.max(gpsGrid.width, gpsLabel.width) - anchors.margins: ScreenTools.defaultFontPixelHeight - anchors.centerIn: parent - - QGCLabel { - id: gpsLabel - text: (activeVehicle && activeVehicle.gps.count.value >= 0) ? qsTr("GPS Status") : qsTr("GPS Data Unavailable") - font.family: ScreenTools.demiboldFontFamily - anchors.horizontalCenter: parent.horizontalCenter - } - - GridLayout { - id: gpsGrid - visible: (activeVehicle && activeVehicle.gps.count.value >= 0) - anchors.margins: ScreenTools.defaultFontPixelHeight - columnSpacing: ScreenTools.defaultFontPixelWidth - anchors.horizontalCenter: parent.horizontalCenter - columns: 2 - - QGCLabel { text: qsTr("GPS Count:") } - QGCLabel { text: activeVehicle ? activeVehicle.gps.count.valueString : qsTr("N/A", "No data to display") } - QGCLabel { text: qsTr("GPS Lock:") } - QGCLabel { text: activeVehicle ? activeVehicle.gps.lock.enumStringValue : qsTr("N/A", "No data to display") } - QGCLabel { text: qsTr("HDOP:") } - QGCLabel { text: activeVehicle ? activeVehicle.gps.hdop.valueString : qsTr("--.--", "No data to display") } - QGCLabel { text: qsTr("VDOP:") } - QGCLabel { text: activeVehicle ? activeVehicle.gps.vdop.valueString : qsTr("--.--", "No data to display") } - QGCLabel { text: qsTr("Course Over Ground:") } - QGCLabel { text: activeVehicle ? activeVehicle.gps.courseOverGround.valueString : qsTr("--.--", "No data to display") } - } - } - } - } - - Row { - id: gpsRow - anchors.top: parent.top - anchors.bottom: parent.bottom - spacing: ScreenTools.defaultFontPixelWidth * 0.25 - QGCColoredImage { - width: height - anchors.top: parent.top - anchors.bottom: parent.bottom - sourceSize.height: height - source: "/qmlimages/Gps.svg" - color: qgcPal.text - fillMode: Image.PreserveAspectFit - opacity: getGPSSignal() > 0 ? 1 : 0.5 - } - CustomSignalStrength { - anchors.verticalCenter: parent.verticalCenter - size: parent.height * 0.75 - percent: getGPSSignal() - } - } - - MouseArea { - anchors.fill: parent - onClicked: { - mainWindow.showPopUp(_root, gpsInfo) - } - } -} diff --git a/custom-example/res/MainToolbar/CustomMainToolBar.qml b/custom-example/res/MainToolbar/CustomMainToolBar.qml deleted file mode 100644 index 9b8d8a47cd162269f4edb149895e48f0168af4f5..0000000000000000000000000000000000000000 --- a/custom-example/res/MainToolbar/CustomMainToolBar.qml +++ /dev/null @@ -1,286 +0,0 @@ -/**************************************************************************** - * - * (c) 2009-2019 QGROUNDCONTROL PROJECT - * - * QGroundControl is licensed according to the terms in the file - * COPYING.md in the root of the source code directory. - * - * @file - * @author Gus Grubba - */ - -import QtQuick 2.11 -import QtQuick.Controls 2.4 -import QtQuick.Layouts 1.11 - -import QGroundControl 1.0 -import QGroundControl.Controls 1.0 -import QGroundControl.Palette 1.0 -import QGroundControl.MultiVehicleManager 1.0 -import QGroundControl.ScreenTools 1.0 -import QGroundControl.Controllers 1.0 - -import Custom.Widgets 1.0 - -Item { - id: toolBar - anchors.fill: parent - property string sectionTitle: qsTr("Fly") - property bool inPlanView: planViewLoader.visible - property bool inFlyView: rootBackground.visible - property color menuSeparatorColor: qgcPal.globalTheme === QGCPalette.Light ? Qt.rgba(0,0,0,0.25) : Qt.rgba(1,1,1,0.25) - //------------------------------------------------------------------------- - //-- Setup can be invoked from c++ side - Connections { - target: setupWindow - onVisibleChanged: { - if(setupWindow.visible) { - vehicleSetup.checked = true - sectionTitle = vehicleSetup.text - } - } - } - //------------------------------------------------------------------------- - //-- Initial State - Component.onCompleted: { - flyButton.checked = true - sectionTitle = flyButton.text - } - //------------------------------------------------------------------------- - //-- Fly/Plan state toggle - onInPlanViewChanged: { - if(inPlanView) { - planButton.checked = true - sectionTitle = planButton.text - } - } - onInFlyViewChanged: { - if(inFlyView) { - flyButton.checked = true - sectionTitle = flyButton.text - } - } - Row { - id: iconRow - height: parent.height - anchors.left: parent.left - spacing: ScreenTools.defaultFontPixelWidth * 2 - - CustomIconButton { - height: parent.height - onPressed: { - if(drawer.visible) { - drawer.close() - } else { - drawer.open() - } - // Easter egg mechanism - _pressCount++ - eggTimer.restart() - if (_pressCount == 5) { - QGroundControl.corePlugin.showAdvancedUI = !QGroundControl.corePlugin.showAdvancedUI - } - } - property int _pressCount: 0 - Timer { - id: eggTimer - interval: 1000 - onTriggered: parent._pressCount = 0 - } - } - Rectangle { - width: 1 - height: parent.height - color: qgcPal.globalTheme === QGCPalette.Light ? Qt.rgba(0,0,0,0.15) : Qt.rgba(1,1,1,0.15) - } - //------------------------------------------------------------------------- - //-- Multi Vehicle Selector - Loader { - anchors.top: parent.top - anchors.bottom: parent.bottom - source: "/custom/CustomMultiVehicleSelector.qml" - visible: activeVehicle && !inPlanView - } - Rectangle { - width: 1 - height: parent.height - color: menuSeparatorColor - visible: activeVehicle && !inPlanView - } - //------------------------------------------------------------------------- - //-- Flight Mode - Loader { - anchors.top: parent.top - anchors.bottom: parent.bottom - source: "/custom/CustomModeIndicator.qml" - visible: activeVehicle && !inPlanView - } - } - //------------------------------------------------------------------------- - //-- Arm/Disarm - Loader { - anchors.top: parent.top - anchors.bottom: parent.bottom - anchors.horizontalCenter: parent.horizontalCenter - source: "/custom/CustomArmedIndicator.qml" - visible: activeVehicle && !inPlanView - } - //------------------------------------------------------------------------- - // Indicators - Loader { - source: inPlanView ? "/qml/PlanToolBarIndicators.qml" : "/custom/CustomMainToolBarIndicators.qml" - anchors.left: iconRow.right - anchors.leftMargin: ScreenTools.defaultFontPixelWidth * 2 - anchors.right: parent.right - anchors.top: parent.top - anchors.bottom: parent.bottom - } - //------------------------------------------------------------------------- - // Parameter download progress bar - Rectangle { - anchors.bottom: parent.bottom - height: ScreenTools.defaultFontPixelheight * 0.25 - width: activeVehicle ? activeVehicle.parameterManager.loadProgress * parent.width : 0 - color: qgcPal.colorGreen - } - //------------------------------------------------------------------------- - // Bottom single pixel divider - Rectangle { - anchors.left: parent.left - anchors.right: parent.right - anchors.bottom: parent.bottom - height: 1 - color: menuSeparatorColor - } - //------------------------------------------------------------------------- - //-- Navigation Drawer (Left to Right, on command or using touch gestures) - Drawer { - id: drawer - y: header.height - width: navButtonWidth - height: mainWindow.height - header.height - closePolicy: Popup.CloseOnEscape | Popup.CloseOnPressOutside - background: Rectangle { - color: qgcPal.window - } - ButtonGroup { - id: buttonGroup - buttons: buttons.children - } - ColumnLayout { - id: buttons - spacing: 0 - anchors.top: parent.top - anchors.left: parent.left - anchors.right: parent.right - Rectangle { - Layout.alignment: Qt.AlignVCenter - width: parent.width - height: 1 - color: menuSeparatorColor - } - CustomToolBarButton { - id: flyButton - spacing: 1 - text: qsTr("Fly") - icon.source: "/qmlimages/PaperPlane.svg" - Layout.fillWidth: true - onClicked: { - checked = true - drawer.close() - sectionTitle = text - mainWindow.showFlyView() - } - } - Rectangle { - Layout.alignment: Qt.AlignVCenter - width: parent.width - height: 1 - color: menuSeparatorColor - } - CustomToolBarButton { - id: planButton - text: qsTr("Plan") - icon.source: "/qmlimages/Plan.svg" - Layout.fillWidth: true - onClicked: { - checked = true - drawer.close() - sectionTitle = text - mainWindow.showPlanView() - } - } - Rectangle { - Layout.alignment: Qt.AlignVCenter - width: parent.width - height: 1 - color: menuSeparatorColor - } - CustomToolBarButton { - text: qsTr("Analyze") - icon.source: "/qmlimages/Analyze.svg" - Layout.fillWidth: true - onClicked: { - checked = true - drawer.close() - sectionTitle = text - mainWindow.showAnalyzeView() - } - } - Rectangle { - Layout.alignment: Qt.AlignVCenter - width: parent.width - height: 1 - color: menuSeparatorColor - } - CustomToolBarButton { - id: vehicleSetup - text: qsTr("Vehicle Setup") - icon.source: "/qmlimages/Gears.svg" - Layout.fillWidth: true - onClicked: { - checked = true - drawer.close() - sectionTitle = text - mainWindow.showSetupView() - } - } - Rectangle { - Layout.alignment: Qt.AlignVCenter - width: parent.width - height: 1 - color: menuSeparatorColor - } - } - ColumnLayout { - id: lowerButtons - anchors.bottom: parent.bottom - anchors.left: parent.left - anchors.right: parent.right - spacing: 0 - Rectangle { - Layout.alignment: Qt.AlignVCenter - width: parent.width - height: 1 - color: menuSeparatorColor - } - CustomToolBarButton { - id: settingsButton - text: qsTr("Settings") - icon.source: "/qmlimages/Gears.svg" - Layout.fillWidth: true - onClicked: { - checked = true - buttonGroup.checkState = Qt.Unchecked - drawer.close() - sectionTitle = text - mainWindow.showSettingsView() - } - } - Connections { - target: buttonGroup - onClicked: settingsButton.checked = false - } - } - } -} diff --git a/custom-example/res/MainToolbar/CustomMainToolBarIndicators.qml b/custom-example/res/MainToolbar/CustomMainToolBarIndicators.qml deleted file mode 100644 index a86c52d589dc05a8e7afd38476f8b0f02372eff3..0000000000000000000000000000000000000000 --- a/custom-example/res/MainToolbar/CustomMainToolBarIndicators.qml +++ /dev/null @@ -1,123 +0,0 @@ -/**************************************************************************** - * - * (c) 2009-2019 QGROUNDCONTROL PROJECT - * - * QGroundControl is licensed according to the terms in the file - * COPYING.md in the root of the source code directory. - * - * @file - * @author Gus Grubba - */ - -import QtQuick 2.11 -import QtQuick.Controls 2.4 -import QtQuick.Dialogs 1.3 -import QtQuick.Layouts 1.11 - -import QGroundControl 1.0 -import QGroundControl.Controls 1.0 -import QGroundControl.MultiVehicleManager 1.0 -import QGroundControl.ScreenTools 1.0 -import QGroundControl.Palette 1.0 - -Item { - anchors.fill: parent - readonly property real _indicatorMargins: ScreenTools.defaultFontPixelHeight * 0.75 - Component.onCompleted: { - if(QGroundControl.pairingManager) { - if(!activeVehicle) { - pairingTimer.start() - } - } - } - //------------------------------------------------------------------------- - //-- Launch pairing manager if nothing connected - Timer { - id: pairingTimer - interval: 5000 - running: false; - repeat: false; - onTriggered: { - if(!activeVehicle) { - if(QGroundControl.pairingManager.firstBoot && pairingLoader.item) { - QGroundControl.pairingManager.firstBoot = false - pairingLoader.item.runPairing() - } - } - } - } - //------------------------------------------------------------------------- - //-- Waiting for a vehicle - Row { - id: waitForVehicle - spacing: ScreenTools.defaultFontPixelWidth - visible: !activeVehicle - anchors.top: parent.top - anchors.bottom: parent.bottom - anchors.left: parent.left - QGCColoredImage { - id: menuEdge - anchors.verticalCenter: parent.verticalCenter - height: ScreenTools.defaultFontPixelHeight - width: height - sourceSize.height: parent.height - fillMode: Image.PreserveAspectFit - source: "/qmlimages/PaperPlane.svg" - color: qgcPal.buttonText - } - QGCLabel { - anchors.verticalCenter: parent.verticalCenter - text: qsTr("Waiting for a vehicle") - font.pointSize: ScreenTools.mediumFontPointSize - font.family: ScreenTools.demiboldFontFamily - } - } - //------------------------------------------------------------------------- - //-- Pairing Indicator (not connected) - Row { - id: pairingRow - anchors.top: parent.top - anchors.bottom: parent.bottom - anchors.right: parent.right - anchors.rightMargin: ScreenTools.defaultFontPixelWidth * 2 - spacing: ScreenTools.defaultFontPixelWidth * 2 - visible: !indicatorRow.visible - Loader { - id: pairingLoader - anchors.top: parent.top - anchors.bottom: parent.bottom - anchors.margins: _indicatorMargins - source: "/custom/PairingIndicator.qml" - } - } - //------------------------------------------------------------------------- - //-- Toolbar Indicators - Row { - id: indicatorRow - anchors.top: parent.top - anchors.bottom: parent.bottom - anchors.right: parent.right - anchors.rightMargin: ScreenTools.defaultFontPixelWidth * 2 - spacing: ScreenTools.defaultFontPixelWidth * 2 - visible: activeVehicle && !communicationLost - Repeater { - model: activeVehicle ? activeVehicle.toolBarIndicators : [] - Loader { - anchors.top: parent.top - anchors.bottom: parent.bottom - anchors.margins: _indicatorMargins - source: modelData; - } - } - Item { - width: 1 - height: 1 - } - Loader { - anchors.top: parent.top - anchors.bottom: parent.bottom - anchors.margins: _indicatorMargins - source: "/toolbar/MessageIndicator.qml" - } - } -} diff --git a/custom-example/res/MainToolbar/CustomModeIndicator.qml b/custom-example/res/MainToolbar/CustomModeIndicator.qml deleted file mode 100644 index 770aa4d9fad6b5c9048f8883f4d234a9651669c2..0000000000000000000000000000000000000000 --- a/custom-example/res/MainToolbar/CustomModeIndicator.qml +++ /dev/null @@ -1,101 +0,0 @@ -/**************************************************************************** - * - * (c) 2009-2019 QGROUNDCONTROL PROJECT - * - * QGroundControl is licensed according to the terms in the file - * COPYING.md in the root of the source code directory. - * - * @file - * @author Gus Grubba - */ - - -import QtQuick 2.11 -import QtQuick.Controls 2.4 -import QtQuick.Layouts 1.11 -import QtQuick.Dialogs 1.3 - -import QGroundControl 1.0 -import QGroundControl.Controls 1.0 -import QGroundControl.MultiVehicleManager 1.0 -import QGroundControl.ScreenTools 1.0 -import QGroundControl.Palette 1.0 - -//------------------------------------------------------------------------- -//-- Mode Indicator -Item { - anchors.top: parent.top - anchors.bottom: parent.bottom - width: selectorRow.width - - Row { - id: selectorRow - spacing: ScreenTools.defaultFontPixelWidth - anchors.verticalCenter: parent.verticalCenter - QGCLabel { - id: flightModeSelector - text: activeVehicle ? activeVehicle.flightMode : qsTr("N/A") - color: qgcPal.text - font.pointSize: ScreenTools.defaultFontPointSize - anchors.verticalCenter: parent.verticalCenter - } - QGCColoredImage { - anchors.verticalCenter: parent.verticalCenter - height: ScreenTools.defaultFontPixelHeight * 0.5 - width: height - sourceSize.height: parent.height - fillMode: Image.PreserveAspectFit - source: "/res/DropArrow.svg" - color: qgcPal.text - } - } - MouseArea { - visible: activeVehicle && activeVehicle.flightModeSetAvailable - anchors.fill: parent - onClicked: flightModesMenu.open() - } - //------------------------------------------------------------------------- - //-- Flight Modes - Popup { - id: flightModesMenu - width: Math.min(mainWindow.width * 0.666, ScreenTools.defaultFontPixelWidth * 40) - height: mainWindow.height * 0.5 - modal: true - focus: true - parent: Overlay.overlay - x: Math.round((mainWindow.width - width) * 0.5) - y: Math.round((mainWindow.height - height) * 0.5) - closePolicy: Popup.CloseOnEscape | Popup.CloseOnPressOutside - property int selectedIndex: 0 - background: Rectangle { - anchors.fill: parent - color: qgcPal.globalTheme === QGCPalette.Light ? Qt.rgba(1,1,1,0.95) : Qt.rgba(0,0,0,0.75) - border.color: qgcPal.text - radius: ScreenTools.defaultFontPixelWidth - } - ColumnLayout { - id: comboListCol - spacing: ScreenTools.defaultFontPixelHeight - anchors.centerIn: parent - QGCLabel { - text: qsTr("Flight Modes") - Layout.alignment: Qt.AlignHCenter - } - Repeater { - model: activeVehicle ? activeVehicle.flightModes : [ ] - QGCButton { - text: modelData - Layout.minimumHeight: ScreenTools.defaultFontPixelHeight * 3 - Layout.minimumWidth: ScreenTools.defaultFontPixelWidth * 30 - Layout.fillHeight: true - Layout.fillWidth: true - Layout.alignment: Qt.AlignHCenter - onClicked: { - activeVehicle.flightMode = modelData - flightModesMenu.close() - } - } - } - } - } -} diff --git a/custom-example/res/MainToolbar/CustomMultiVehicleSelector.qml b/custom-example/res/MainToolbar/CustomMultiVehicleSelector.qml deleted file mode 100644 index 2c23e2fbfdb9553d0ad2d0ff2be58d87a2d6f5b4..0000000000000000000000000000000000000000 --- a/custom-example/res/MainToolbar/CustomMultiVehicleSelector.qml +++ /dev/null @@ -1,104 +0,0 @@ -/**************************************************************************** - * - * (c) 2009-2019 QGROUNDCONTROL PROJECT - * - * QGroundControl is licensed according to the terms in the file - * COPYING.md in the root of the source code directory. - * - * @file - * @author Gus Grubba - */ - -import QtQuick 2.11 -import QtQuick.Controls 1.4 - -import QGroundControl 1.0 -import QGroundControl.Controls 1.0 -import QGroundControl.MultiVehicleManager 1.0 -import QGroundControl.ScreenTools 1.0 -import QGroundControl.Palette 1.0 - -//------------------------------------------------------------------------- -//-- Multi Vehicle Selector -Item { - anchors.top: parent.top - anchors.bottom: parent.bottom - width: selectorRow.width - property bool _multiVehicles: QGroundControl.multiVehicleManager.vehicles.count > 1 - Component.onCompleted: { - updatemultiVehiclesMenu() - } - Connections { - target: QGroundControl.multiVehicleManager.vehicles - onCountChanged: updatemultiVehiclesMenu() - } - Row { - id: selectorRow - spacing: ScreenTools.defaultFontPixelWidth - anchors.verticalCenter: parent.verticalCenter - QGCColoredImage { - anchors.verticalCenter: parent.verticalCenter - height: ScreenTools.defaultFontPixelHeight - width: height - sourceSize.height: parent.height - fillMode: Image.PreserveAspectFit - source: "/qmlimages/PaperPlane.svg" - color: qgcPal.text - } - QGCLabel { - id: multiVehicleSelector - text: "Vehicle " + (activeVehicle ? activeVehicle.id : "None") - color: qgcPal.buttonText - anchors.verticalCenter: parent.verticalCenter - } - QGCColoredImage { - visible: _multiVehicles - anchors.verticalCenter: parent.verticalCenter - height: ScreenTools.defaultFontPixelHeight * 0.5 - width: height - sourceSize.height: parent.height - fillMode: Image.PreserveAspectFit - source: "/res/DropArrow.svg" - color: qgcPal.text - } - } - Menu { - id: multiVehiclesMenu - } - Component { - id: multiVehicleMenuItemComponent - MenuItem { - 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) - console.log("Vehicle " + vehicle.id) - } - } else { - console.log('No multiple vehicles: ' + QGroundControl.multiVehicleManager.vehicles.count) - } - } - MouseArea { - visible: _multiVehicles - anchors.fill: parent - onClicked: { - console.log('Clicked') - multiVehiclesMenu.popup() - } - } -} diff --git a/custom-example/res/MainToolbar/CustomRCRSSIIndicator.qml b/custom-example/res/MainToolbar/CustomRCRSSIIndicator.qml deleted file mode 100644 index 15a3eb80adb8cfa380958856683bd340ae103cf9..0000000000000000000000000000000000000000 --- a/custom-example/res/MainToolbar/CustomRCRSSIIndicator.qml +++ /dev/null @@ -1,101 +0,0 @@ -/**************************************************************************** - * - * (c) 2009-2019 QGROUNDCONTROL PROJECT - * - * QGroundControl is licensed according to the terms in the file - * COPYING.md in the root of the source code directory. - * - * @file - * @author Gus Grubba - */ - -import QtQuick 2.11 -import QtQuick.Controls 1.4 -import QtQuick.Layouts 1.11 - -import QGroundControl 1.0 -import QGroundControl.Controls 1.0 -import QGroundControl.MultiVehicleManager 1.0 -import QGroundControl.ScreenTools 1.0 -import QGroundControl.Palette 1.0 - -import Custom.Widgets 1.0 - -//------------------------------------------------------------------------- -//-- RC RSSI Indicator -Item { - id: _root - width: visible ? rssiRow.width : 0 - anchors.top: parent.top - anchors.bottom: parent.bottom - visible: activeVehicle ? activeVehicle.supportsRadio : true - - property bool _rcRSSIAvailable: activeVehicle ? activeVehicle.rcRSSI > 0 && activeVehicle.rcRSSI <= 100 : false - - Component { - id: rcRSSIInfo - - Rectangle { - width: rcrssiCol.width + ScreenTools.defaultFontPixelWidth * 3 - height: rcrssiCol.height + ScreenTools.defaultFontPixelHeight * 2 - radius: ScreenTools.defaultFontPixelHeight * 0.5 - color: qgcPal.window - - Column { - id: rcrssiCol - spacing: ScreenTools.defaultFontPixelHeight * 0.5 - width: Math.max(rcrssiGrid.width, rssiLabel.width) - anchors.margins: ScreenTools.defaultFontPixelHeight - anchors.centerIn: parent - - QGCLabel { - id: rssiLabel - text: activeVehicle ? (activeVehicle.rcRSSI !== 255 ? qsTr("RC RSSI Status") : qsTr("RC RSSI Data Unavailable")) : qsTr("N/A", "No data available") - font.family: ScreenTools.demiboldFontFamily - anchors.horizontalCenter: parent.horizontalCenter - } - - GridLayout { - id: rcrssiGrid - visible: _rcRSSIAvailable - anchors.margins: ScreenTools.defaultFontPixelHeight - columnSpacing: ScreenTools.defaultFontPixelWidth - columns: 2 - anchors.horizontalCenter: parent.horizontalCenter - - QGCLabel { text: qsTr("RSSI:") } - QGCLabel { text: activeVehicle ? (activeVehicle.rcRSSI + "%") : 0 } - } - } - } - } - - Row { - id: rssiRow - anchors.top: parent.top - anchors.bottom: parent.bottom - spacing: ScreenTools.defaultFontPixelWidth * 0.25 - QGCColoredImage { - width: height - anchors.top: parent.top - anchors.bottom: parent.bottom - sourceSize.height: height - source: "/custom/img/menu_rc.svg" - color: qgcPal.text - fillMode: Image.PreserveAspectFit - opacity: _rcRSSIAvailable ? 1 : 0.5 - } - CustomSignalStrength { - anchors.verticalCenter: parent.verticalCenter - size: parent.height * 0.75 - percent: _rcRSSIAvailable ? activeVehicle.rcRSSI : 0 - } - } - - MouseArea { - anchors.fill: parent - onClicked: { - mainWindow.showPopUp(_root, rcRSSIInfo) - } - } -} diff --git a/custom-example/res/PairingIndicator.qml b/custom-example/res/PairingIndicator.qml deleted file mode 100644 index e200148f8990dfada8be8c4dc294cf29c66d3422..0000000000000000000000000000000000000000 --- a/custom-example/res/PairingIndicator.qml +++ /dev/null @@ -1,518 +0,0 @@ -/**************************************************************************** - * - * (c) 2009-2016 QGROUNDCONTROL PROJECT - * - * QGroundControl is licensed according to the terms in the file - * COPYING.md in the root of the source code directory. - * - ****************************************************************************/ - -import QtQuick 2.11 -import QtQuick.Controls 2.4 -import QtQuick.Layouts 1.11 -import QtQuick.Dialogs 1.3 - -import QGroundControl 1.0 -import QGroundControl.Controls 1.0 -import QGroundControl.MultiVehicleManager 1.0 -import QGroundControl.ScreenTools 1.0 -import QGroundControl.Palette 1.0 - -//------------------------------------------------------------------------- -//-- GPS Indicator -Item { - id: _root - width: pairingRow.width * 1.1 - anchors.top: parent.top - anchors.bottom: parent.bottom - - property bool _light: qgcPal.globalTheme === QGCPalette.Light && !activeVehicle - property real _contentWidth: ScreenTools.defaultFontPixelWidth * 34 - property real _contentSpacing: ScreenTools.defaultFontPixelHeight * 0.5 - property real _rectWidth: _contentWidth - property real _rectHeight: _contentWidth * 0.75 - - property string kPairingManager: qsTr("Pairing Manager") - - function runPairing() { - QGroundControl.pairingManager.firstBoot = false - if(QGroundControl.pairingManager.pairedDeviceNameList.length > 0) { - connectionPopup.open() - } else { - mhPopup.open() - } - } - - Connections { - target: QGroundControl.pairingManager - //-- Connect automatically once paired - onPairingStatusChanged: { - if(QGroundControl.pairingManager.pairingStatus === PairingManager.PairingSuccess) { - if(QGroundControl.pairingManager.pairedVehicle !== "") { - QGroundControl.pairingManager.connectToPairedDevice(QGroundControl.pairingManager.pairedVehicle) - } - } - } - } - - Row { - id: pairingRow - spacing: ScreenTools.defaultFontPixelWidth - anchors.top: parent.top - anchors.bottom: parent.bottom - anchors.horizontalCenter: parent.horizontalCenter - QGCColoredImage { - id: pairingIcon - height: parent.height - width: height - color: qgcPal.text - source: "/custom/img/PairingIcon.svg" - sourceSize.width: width - fillMode: Image.PreserveAspectFit - smooth: true - mipmap: true - antialiasing: true - anchors.verticalCenter: parent.verticalCenter - } - QGCLabel { - text: qsTr("Pair Vehicle") - width: !activeVehicle ? (ScreenTools.defaultFontPixelWidth * 12) : 0 - visible: !activeVehicle - font.family: ScreenTools.demiboldFontFamily - anchors.verticalCenter: parent.verticalCenter - } - } - MouseArea { - anchors.fill: parent - onClicked: { - runPairing() - } - } - //------------------------------------------------------------------------- - //-- Microhard - Popup { - id: mhPopup - width: mhBody.width - height: mhBody.height - modal: true - focus: true - parent: Overlay.overlay - x: Math.round((mainWindow.width - width) * 0.5) - y: Math.round((mainWindow.height - height) * 0.5) - closePolicy: Popup.CloseOnEscape | Popup.CloseOnPressOutside - background: Rectangle { - anchors.fill: parent - color: qgcPal.globalTheme === QGCPalette.Light ? Qt.rgba(1,1,1,0.95) : Qt.rgba(0,0,0,0.75) - radius: ScreenTools.defaultFontPixelWidth * 0.25 - } - Item { - id: mhBody - width: mhCol.width + (ScreenTools.defaultFontPixelWidth * 8) - height: mhCol.height + (ScreenTools.defaultFontPixelHeight * 2) - anchors.centerIn: parent - Column { - id: mhCol - spacing: _contentSpacing - anchors.centerIn: parent - Item { width: 1; height: 1; } - QGCLabel { - text: kPairingManager - font.family: ScreenTools.demiboldFontFamily - font.pointSize: ScreenTools.mediumFontPointSize - anchors.horizontalCenter: parent.horizontalCenter - } - Rectangle { - width: _contentWidth - height: 1 - color: qgcPal.globalTheme !== QGCPalette.Light ? Qt.rgba(1,1,1,0.25) : Qt.rgba(0,0,0,0.25) - } - Item { width: 1; height: 1; } - QGCLabel { - text: qsTr("To connect to your vehicle, please click on the pairing button in order to put the vehicle in discovery mode") - width: _contentWidth - wrapMode: Text.WordWrap - horizontalAlignment: Text.AlignHCenter - anchors.horizontalCenter: parent.horizontalCenter - } - Item { width: 1; height: ScreenTools.defaultFontPixelHeight * 2; } - QGCColoredImage { - height: ScreenTools.defaultFontPixelHeight * 6 - width: height - source: "/custom/img/PairingButton.svg" - sourceSize.height: height - fillMode: Image.PreserveAspectFit - mipmap: true - smooth: true - color: qgcPal.text - anchors.horizontalCenter: parent.horizontalCenter - } - Item { width: 1; height: ScreenTools.defaultFontPixelHeight * 2; } - QGCButton { - text: qsTr("Pair a Vehicle") - width: _contentWidth - anchors.horizontalCenter: parent.horizontalCenter - onClicked: { - mhPopup.close() - progressPopup.open() - QGroundControl.pairingManager.startMicrohardPairing(); - } - } - Item { width: 1; height: 1; } - } - } - } - //------------------------------------------------------------------------- - //-- NFC - Popup { - id: nfcPopup - width: nfcBody.width - height: nfcBody.height - modal: true - focus: true - parent: Overlay.overlay - x: Math.round((mainWindow.width - width) * 0.5) - y: Math.round((mainWindow.height - height) * 0.5) - closePolicy: Popup.CloseOnEscape | Popup.CloseOnPressOutside - background: Rectangle { - anchors.fill: parent - color: qgcPal.globalTheme === QGCPalette.Light ? Qt.rgba(1,1,1,0.95) : Qt.rgba(0,0,0,0.75) - radius: ScreenTools.defaultFontPixelWidth * 0.25 - } - Item { - id: nfcBody - width: nfcCol.width + (ScreenTools.defaultFontPixelWidth * 8) - height: nfcCol.height + (ScreenTools.defaultFontPixelHeight * 2) - anchors.centerIn: parent - Column { - id: nfcCol - spacing: _contentSpacing - anchors.centerIn: parent - Item { width: 1; height: 1; } - QGCLabel { - text: kPairingManager - font.family: ScreenTools.demiboldFontFamily - font.pointSize: ScreenTools.mediumFontPointSize - anchors.horizontalCenter: parent.horizontalCenter - } - Rectangle { - width: _contentWidth - height: 1 - color: qgcPal.globalTheme !== QGCPalette.Light ? Qt.rgba(1,1,1,0.25) : Qt.rgba(0,0,0,0.25) - } - Item { width: 1; height: 1; } - Rectangle { - width: _rectWidth - height: _rectHeight - color: Qt.rgba(0,0,0,0) - border.color: qgcPal.text - border.width: 1 - anchors.horizontalCenter: parent.horizontalCenter - QGCLabel { - text: "Vehicle and Tablet Graphic" - anchors.centerIn: parent - } - } - Item { width: 1; height: 1; } - QGCLabel { - text: qsTr("Please make sure your vehicle is close to your Ground Station device") - width: _contentWidth - wrapMode: Text.WordWrap - horizontalAlignment: Text.AlignHCenter - anchors.horizontalCenter: parent.horizontalCenter - } - Item { width: 1; height: 1; } - QGCButton { - text: qsTr("Pair Via NFC") - width: _contentWidth - anchors.horizontalCenter: parent.horizontalCenter - onClicked: { - nfcPopup.close() - progressPopup.open() - QGroundControl.pairingManager.startNFCScan(); - } - } - Item { width: 1; height: 1; } - } - } - } - //------------------------------------------------------------------------- - //-- Pairing/Connection Progress - Popup { - id: progressPopup - width: progressBody.width - height: progressBody.height - modal: true - focus: true - parent: Overlay.overlay - x: Math.round((mainWindow.width - width) * 0.5) - y: Math.round((mainWindow.height - height) * 0.5) - closePolicy: cancelButton.visible ? Popup.NoAutoClose : (Popup.CloseOnEscape | Popup.CloseOnPressOutside) - background: Rectangle { - anchors.fill: parent - color: qgcPal.globalTheme === QGCPalette.Light ? Qt.rgba(1,1,1,0.95) : Qt.rgba(0,0,0,0.75) - radius: ScreenTools.defaultFontPixelWidth * 0.25 - } - Item { - id: progressBody - width: progressCol.width + (ScreenTools.defaultFontPixelWidth * 8) - height: progressCol.height + (ScreenTools.defaultFontPixelHeight * 2) - anchors.centerIn: parent - Column { - id: progressCol - spacing: _contentSpacing - anchors.centerIn: parent - Item { width: 1; height: 1; } - QGCLabel { - text: kPairingManager - font.family: ScreenTools.demiboldFontFamily - font.pointSize: ScreenTools.mediumFontPointSize - anchors.horizontalCenter: parent.horizontalCenter - } - QGCLabel { - text: QGroundControl.pairingManager ? QGroundControl.pairingManager.pairingStatusStr : "" - visible: !connectedIndicator.visible - anchors.horizontalCenter: parent.horizontalCenter - } - Rectangle { - width: _contentWidth - height: 1 - color: qgcPal.globalTheme !== QGCPalette.Light ? Qt.rgba(1,1,1,0.25) : Qt.rgba(0,0,0,0.25) - } - Item { width: 1; height: 1; } - //-- Pairing/Connecting - Item { width: 1; height: ScreenTools.defaultFontPixelHeight * 3; visible: busyIndicator.visible; } - QGCColoredImage { - id: busyIndicator - height: ScreenTools.defaultFontPixelHeight * 4 - width: height - source: "/qmlimages/MapSync.svg" - sourceSize.height: height - fillMode: Image.PreserveAspectFit - mipmap: true - smooth: true - color: qgcPal.text - visible: QGroundControl.pairingManager.pairingStatus === PairingManager.PairingActive || QGroundControl.pairingManager.pairingStatus === PairingManager.PairingConnecting - anchors.horizontalCenter: parent.horizontalCenter - RotationAnimation on rotation { - loops: Animation.Infinite - from: 360 - to: 0 - duration: 720 - running: busyIndicator.visible - } - } - Item { width: 1; height: ScreenTools.defaultFontPixelHeight * 3; visible: busyIndicator.visible; } - //-- Error State - Image { - height: ScreenTools.defaultFontPixelHeight * 4 - width: height - source: "/custom/img/PairingError.svg" - sourceSize.height: height - fillMode: Image.PreserveAspectFit - mipmap: true - smooth: true - visible: QGroundControl.pairingManager.errorState - anchors.horizontalCenter: parent.horizontalCenter - } - //-- Connection Successful - Image { - id: connectedIndicator - height: width * 0.2 - width: _contentWidth - source: "/custom/img/PairingConnected.svg" - sourceSize.height: height - fillMode: Image.PreserveAspectFit - mipmap: true - smooth: true - visible: QGroundControl.pairingManager.pairingStatus === PairingManager.PairingConnected - anchors.horizontalCenter: parent.horizontalCenter - } - Item { width: 1; height: _contentSpacing; visible: connectedIndicator.visible; } - QGCLabel { - text: QGroundControl.pairingManager.pairedVehicle - visible: connectedIndicator.visible - anchors.horizontalCenter: parent.horizontalCenter - } - QGCLabel { - text: qsTr("Connection Successful") - visible: connectedIndicator.visible - anchors.horizontalCenter: parent.horizontalCenter - } - Item { width: 1; height: _contentSpacing; } - //-- Buttons - QGCButton { - width: _contentWidth - visible: QGroundControl.pairingManager ? (QGroundControl.pairingManager.pairingStatus === PairingManager.PairingConnected) : false - text: qsTr("Done") - anchors.horizontalCenter: parent.horizontalCenter - onClicked: { - progressPopup.close() - } - } - QGCButton { - text: qsTr("Pair Another") - width: _contentWidth - visible: QGroundControl.pairingManager ? (QGroundControl.pairingManager.pairingStatus === PairingManager.PairingConnected) : false - anchors.horizontalCenter: parent.horizontalCenter - onClicked: { - progressPopup.close() - mhPopup.open() - } - } - QGCButton { - text: qsTr("Try Again") - width: _contentWidth - visible: QGroundControl.pairingManager ? QGroundControl.pairingManager.errorState : false - anchors.horizontalCenter: parent.horizontalCenter - onClicked: { - progressPopup.close() - runPairing() - } - } - QGCButton { - id: cancelButton - width: _contentWidth - visible: QGroundControl.pairingManager ? (QGroundControl.pairingManager.pairingStatus === PairingManager.PairingActive || QGroundControl.pairingManager.pairingStatus === PairingManager.PairingConnecting || QGroundControl.pairingManager.errorState) : false - text: qsTr("Cancel") - anchors.horizontalCenter: parent.horizontalCenter - onClicked: { - if(QGroundControl.pairingManager.pairingStatus === PairingManager.PairingActive) - QGroundControl.pairingManager.stopPairing() - else { - //-- TODO: Cancel connection to paired device - } - progressPopup.close() - } - } - Item { width: 1; height: 1; } - } - } - } - //------------------------------------------------------------------------- - //-- Connection Manager - Popup { - id: connectionPopup - width: connectionBody.width - height: connectionBody.height - modal: true - focus: true - parent: Overlay.overlay - x: Math.round((mainWindow.width - width) * 0.5) - y: Math.round((mainWindow.height - height) * 0.5) - closePolicy: cancelButton.visible ? Popup.NoAutoClose : (Popup.CloseOnEscape | Popup.CloseOnPressOutside) - background: Rectangle { - anchors.fill: parent - color: qgcPal.globalTheme === QGCPalette.Light ? Qt.rgba(1,1,1,0.95) : Qt.rgba(0,0,0,0.75) - radius: ScreenTools.defaultFontPixelWidth * 0.25 - } - Item { - id: connectionBody - width: connectionCol.width + (ScreenTools.defaultFontPixelWidth * 8) - height: connectionCol.height + (ScreenTools.defaultFontPixelHeight * 2) - anchors.centerIn: parent - Column { - id: connectionCol - spacing: _contentSpacing - anchors.centerIn: parent - Item { width: 1; height: 1; } - QGCLabel { - text: kPairingManager - font.family: ScreenTools.demiboldFontFamily - font.pointSize: ScreenTools.mediumFontPointSize - anchors.horizontalCenter: parent.horizontalCenter - } - Rectangle { - width: _contentWidth - height: 1 - color: qgcPal.globalTheme !== QGCPalette.Light ? Qt.rgba(1,1,1,0.25) : Qt.rgba(0,0,0,0.25) - } - Item { width: 1; height: 1; } - QGCLabel { - text: qsTr("List Of Available Devices") - visible: QGroundControl.pairingManager ? (QGroundControl.pairingManager.pairedDeviceNameList.length > 0 && !cancelButton.visible) : false - font.family: ScreenTools.demiboldFontFamily - } - Item { width: 1; height: 1; } - GridLayout { - columns: 3 - visible: QGroundControl.pairingManager ? (QGroundControl.pairingManager.pairedDeviceNameList.length > 0 && !cancelButton.visible) : false - columnSpacing: ScreenTools.defaultFontPixelWidth - rowSpacing: ScreenTools.defaultFontPixelHeight * 0.25 - anchors.horizontalCenter: parent.horizontalCenter - property var _pairModel: QGroundControl.pairingManager ? QGroundControl.pairingManager.pairedDeviceNameList : [] - Repeater { - model: parent._pairModel - delegate: QGCLabel { - text: modelData - Layout.row: index - Layout.column: 0 - Layout.minimumWidth:ScreenTools.defaultFontPixelWidth * 14 - Layout.fillWidth: true - } - } - Repeater { - model: parent._pairModel - delegate: QGCButton { - text: qsTr("Connect") - Layout.row: index - Layout.column: 1 - onClicked: { - QGroundControl.pairingManager.connectToPairedDevice(modelData) - connectionPopup.close() - progressPopup.open() - } - } - } - Repeater { - model: parent._pairModel - delegate: QGCColoredImage { - Layout.preferredWidth: ScreenTools.defaultFontPixelHeight * 1.5 - Layout.preferredHeight: ScreenTools.defaultFontPixelHeight * 1.5 - sourceSize.height: height - source: "/res/TrashDelete.svg" - color: qgcPal.colorRed - Layout.row: index - Layout.column: 2 - MouseArea { - anchors.fill: parent - onClicked: { - removePrompt.open() - } - } - MessageDialog { - id: removePrompt - title: qsTr("Remove Paired Vehicle") - text: qsTr("Confirm removing %1?").arg(modelData) - standardButtons: StandardButton.Yes | StandardButton.No - onNo: removePrompt.close() - onYes: { - QGroundControl.pairingManager.removePairedDevice(modelData) - removePrompt.close() - } - } - } - } - } - Item { width: 1; height: _contentSpacing; } - QGCButton { - width: _contentWidth - text: qsTr("Close") - anchors.horizontalCenter: parent.horizontalCenter - onClicked: { - connectionPopup.close() - } - } - QGCButton { - text: qsTr("Pair Another") - width: _contentWidth - anchors.horizontalCenter: parent.horizontalCenter - onClicked: { - connectionPopup.close() - mhPopup.open() - } - } - Item { width: 1; height: 1; } - } - } - } -} diff --git a/custom-example/res/PreFlightCheckList.qml b/custom-example/res/PreFlightCheckList.qml deleted file mode 100644 index dc3079df0a0954f1f8e86526b32db05ef9b33b89..0000000000000000000000000000000000000000 --- a/custom-example/res/PreFlightCheckList.qml +++ /dev/null @@ -1,175 +0,0 @@ -/**************************************************************************** - * - * (c) 2009-2016 QGROUNDCONTROL PROJECT - * - * QGroundControl is licensed according to the terms in the file - * COPYING.md in the root of the source code directory. - * - ****************************************************************************/ - -import QtQuick 2.3 -import QtQuick.Controls 1.2 -import QtQml.Models 2.1 - -import QGroundControl 1.0 -import QGroundControl.ScreenTools 1.0 -import QGroundControl.Controls 1.0 -import QGroundControl.FlightDisplay 1.0 - -Rectangle { - width: mainColumn.width + ScreenTools.defaultFontPixelWidth * 3 - height: mainColumn.height + ScreenTools.defaultFontPixelHeight - color: qgcPal.windowShade - radius: 3 - - PreFlightCheckModel { - id: listModel - PreFlightCheckGroup { - name: qsTr("Initial checks") - - // Standard check list items (group 0) - Available from the start - PreFlightCheckButton { - name: qsTr("Hardware") - manualText: qsTr("Props mounted? Wings secured? Tail secured?") - } - - PreFlightBatteryCheck { - failurePercent: 40 - allowFailurePercentOverride: false - } - - PreFlightSensorsHealthCheck { - } - - PreFlightGPSCheck { - failureSatCount: 9 - allowOverrideSatCount: true - } - - PreFlightRCCheck { - } - } - - PreFlightCheckGroup { - name: qsTr("Please arm the vehicle here") - - PreFlightCheckButton { - name: qsTr("Actuators") - manualText: qsTr("Move all control surfaces. Did they work properly?") - } - - PreFlightCheckButton { - name: qsTr("Motors") - manualText: qsTr("Propellers free? Then throttle up gently. Working properly?") - } - - PreFlightCheckButton { - name: qsTr("Mission") - manualText: qsTr("Please confirm mission is valid (waypoints valid, no terrain collision).") - } - - PreFlightSoundCheck { - } - } - - PreFlightCheckGroup { - name: qsTr("Last preparations before launch") - - // Check list item group 2 - Final checks before launch - PreFlightCheckButton { - name: qsTr("Payload") - manualText: qsTr("Configured and started? Payload lid closed?") - } - - PreFlightCheckButton { - name: "Wind & weather" - manualText: qsTr("OK for your platform? Lauching into the wind?") - } - - PreFlightCheckButton { - name: qsTr("Flight area") - manualText: qsTr("Launch area and path free of obstacles/people?") - } - } - } - - property bool _passed: false - - function _handleGroupPassedChanged(index, passed) { - if (passed) { - // Collapse current group - var group = checkListRepeater.itemAt(index) - group._checked = false - // Expand next group - if (index + 1 < checkListRepeater.count) { - group = checkListRepeater.itemAt(index + 1) - group.enabled = true - group._checked = true - } - } - _passed = passed - } - - // We delay the updates when a group passes so the user can see all items green for a moment prior to hiding - Timer { - id: delayedGroupPassed - interval: 750 - - property int index - - onTriggered: _handleGroupPassedChanged(index, true /* passed */) - } - - Column { - id: mainColumn - width: 40 * ScreenTools.defaultFontPixelWidth - spacing: 0.8 * ScreenTools.defaultFontPixelWidth - anchors.left: parent.left - anchors.top: parent.top - anchors.topMargin: 0.6 * ScreenTools.defaultFontPixelWidth - anchors.leftMargin: 1.5 * ScreenTools.defaultFontPixelWidth - - function groupPassedChanged(index, passed) { - if (passed) { - delayedGroupPassed.index = index - delayedGroupPassed.restart() - } else { - _handleGroupPassedChanged(index, passed) - } - } - - // Header/title of checklist - Item { - width: parent.width - height: 1.75 * ScreenTools.defaultFontPixelHeight - - QGCLabel { - text: qsTr("Pre-Flight Checklist %1").arg(_passed ? qsTr("(passed)") : "") - anchors.left: parent.left - anchors.verticalCenter: parent.verticalCenter - font.pointSize: ScreenTools.mediumFontPointSize - } - QGCButton { - width: 1.2 * ScreenTools.defaultFontPixelHeight - height: 1.2 * ScreenTools.defaultFontPixelHeight - anchors.right: parent.right - anchors.verticalCenter: parent.verticalCenter - tooltip: qsTr("Reset the checklist (e.g. after a vehicle reboot)") - - onClicked: model.reset() - - QGCColoredImage { - source: "/qmlimages/MapSyncBlack.svg" - color: qgcPal.buttonText - anchors.fill: parent - } - } - } - - // All check list items - Repeater { - id: checkListRepeater - model: listModel - } - } -} diff --git a/custom-example/src/AutoPilotPlugin/CustomAutoPilotPlugin.cc b/custom-example/src/AutoPilotPlugin/CustomAutoPilotPlugin.cc index 5942f3bf060f74e9ca8a8a441551f27be82018a1..2003165f4ae3391eb61c48974c39bdb1f913332c 100644 --- a/custom-example/src/AutoPilotPlugin/CustomAutoPilotPlugin.cc +++ b/custom-example/src/AutoPilotPlugin/CustomAutoPilotPlugin.cc @@ -15,41 +15,36 @@ #include "QGCApplication.h" #include "QGCCorePlugin.h" -//----------------------------------------------------------------------------- CustomAutoPilotPlugin::CustomAutoPilotPlugin(Vehicle* vehicle, QObject* parent) : PX4AutoPilotPlugin(vehicle, parent) { + // Whenever we go on/out of advanced mode the available list of settings pages will change connect(qgcApp()->toolbox()->corePlugin(), &QGCCorePlugin::showAdvancedUIChanged, this, &CustomAutoPilotPlugin::_advancedChanged); } -//----------------------------------------------------------------------------- -void -CustomAutoPilotPlugin::_advancedChanged(bool) +// This signals that when Advanced Mode changes the list of Vehicle Settings page also changed +void CustomAutoPilotPlugin::_advancedChanged(bool) { _components.clear(); emit vehicleComponentsChanged(); } -//----------------------------------------------------------------------------- -const QVariantList& -CustomAutoPilotPlugin::vehicleComponents() +// This allows us to hide most Vehicle Setup pages unless we are in Advanced Mmode +const QVariantList& CustomAutoPilotPlugin::vehicleComponents() { if (_components.count() == 0 && !_incorrectParameterVersion) { if (_vehicle) { bool showAdvanced = qgcApp()->toolbox()->corePlugin()->showAdvancedUI(); - qDebug() << "Loading components:" << showAdvanced; if (_vehicle->parameterManager()->parametersReady()) { - if(showAdvanced) { - _airframeComponent = new AirframeComponent(_vehicle, this); - _airframeComponent->setupTriggerSignals(); - _components.append(QVariant::fromValue(reinterpret_cast(_airframeComponent))); - } - if (!_vehicle->hilMode()) { + if (showAdvanced) { + _airframeComponent = new AirframeComponent(_vehicle, this); + _airframeComponent->setupTriggerSignals(); + _components.append(QVariant::fromValue(reinterpret_cast(_airframeComponent))); + _sensorsComponent = new SensorsComponent(_vehicle, this); _sensorsComponent->setupTriggerSignals(); _components.append(QVariant::fromValue(reinterpret_cast(_sensorsComponent))); - } - if(showAdvanced) { + _radioComponent = new PX4RadioComponent(_vehicle, this); _radioComponent->setupTriggerSignals(); _components.append(QVariant::fromValue(reinterpret_cast(_radioComponent))); @@ -71,7 +66,7 @@ CustomAutoPilotPlugin::vehicleComponents() _safetyComponent->setupTriggerSignals(); _components.append(QVariant::fromValue(reinterpret_cast(_safetyComponent))); - if(showAdvanced) { + if (showAdvanced) { _tuningComponent = new PX4TuningComponent(_vehicle, this); _tuningComponent->setupTriggerSignals(); _components.append(QVariant::fromValue(reinterpret_cast(_tuningComponent))); @@ -83,22 +78,9 @@ CustomAutoPilotPlugin::vehicleComponents() _components.append(QVariant::fromValue(reinterpret_cast(_cameraComponent))); } } - - //-- Is there an ESP8266 Connected? - if(_vehicle->parameterManager()->parameterExists(MAV_COMP_ID_UDP_BRIDGE, "SW_VER")) { - _esp8266Component = new ESP8266Component(_vehicle, this); - _esp8266Component->setupTriggerSignals(); - _components.append(QVariant::fromValue(reinterpret_cast(_esp8266Component))); - } } else { qWarning() << "Call to vehicleCompenents prior to parametersReady"; } - - if(_vehicle->parameterManager()->parameterExists(_vehicle->id(), "SLNK_RADIO_CHAN")) { - _syslinkComponent = new SyslinkComponent(_vehicle, this); - _syslinkComponent->setupTriggerSignals(); - _components.append(QVariant::fromValue(reinterpret_cast(_syslinkComponent))); - } } else { qWarning() << "Internal error"; } diff --git a/custom-example/src/AutoPilotPlugin/CustomAutoPilotPlugin.h b/custom-example/src/AutoPilotPlugin/CustomAutoPilotPlugin.h index 9b20b4d895aea5dfb8c60e92201d217e12836804..e3bbbc0396a277664ff569da619f1bcdd347378d 100644 --- a/custom-example/src/AutoPilotPlugin/CustomAutoPilotPlugin.h +++ b/custom-example/src/AutoPilotPlugin/CustomAutoPilotPlugin.h @@ -15,15 +15,17 @@ #include "PX4AutoPilotPlugin.h" #include "Vehicle.h" -/// Custom overrides from standard PX4AutoPilotPlugin implementation class CustomAutoPilotPlugin : public PX4AutoPilotPlugin { Q_OBJECT public: CustomAutoPilotPlugin(Vehicle* vehicle, QObject* parent); - const QVariantList& vehicleComponents() override; + + const QVariantList& vehicleComponents() final; + private slots: void _advancedChanged (bool advanced); + private: QVariantList _components; diff --git a/custom-example/src/CustomPlugin.cc b/custom-example/src/CustomPlugin.cc index e7f2d9e8f0019923da9155ed775e89762e61cabb..4057d619d22b255ca5b92f4ce1f99f63da0017e7 100644 --- a/custom-example/src/CustomPlugin.cc +++ b/custom-example/src/CustomPlugin.cc @@ -16,8 +16,6 @@ #include "MAVLinkLogManager.h" #include "CustomPlugin.h" -#include "CustomQuickInterface.h" -#include "CustomVideoManager.h" #include "MultiVehicleManager.h" #include "QGCApplication.h" @@ -28,93 +26,72 @@ QGC_LOGGING_CATEGORY(CustomLog, "CustomLog") -CustomVideoReceiver::CustomVideoReceiver(QObject* parent) - : GstVideoReceiver(parent) +CustomOptions::CustomOptions(CustomPlugin*, QObject* parent) + : QGCOptions(parent) { } -CustomVideoReceiver::~CustomVideoReceiver() +// Firmware upgrade page is only shown in Advanced Mode. +bool CustomOptions::showFirmwareUpgrade() const { + return qgcApp()->toolbox()->corePlugin()->showAdvancedUI(); } -//----------------------------------------------------------------------------- -static QObject* -customQuickInterfaceSingletonFactory(QQmlEngine*, QJSEngine*) +// This custom build does not support conecting multiple vehicles to it. This in turn simplifies various parts of the QGC ui. +bool CustomOptions::enableMultiVehicleList(void) const { - qCDebug(CustomLog) << "Creating CustomQuickInterface instance"; - CustomQuickInterface* pIFace = new CustomQuickInterface(); - auto* pPlug = qobject_cast(qgcApp()->toolbox()->corePlugin()); - if(pPlug) { - pIFace->init(); - } else { - qCritical() << "Error obtaining instance of CustomPlugin"; - } - return pIFace; + return false; } -//----------------------------------------------------------------------------- -CustomOptions::CustomOptions(CustomPlugin*, QObject* parent) - : QGCOptions(parent) +// This allows you to show a custom overlay on the fly screen. +QUrl CustomOptions::flyViewOverlay(void) const { + return QUrl::fromUserInput("qrc:/custom/CustomFlyViewOverlay.qml"); } -//----------------------------------------------------------------------------- -bool -CustomOptions::showFirmwareUpgrade() const +// The standard instrement widget is now show. Only the custom overlay is shown. +CustomInstrumentWidget* CustomOptions::instrumentWidget(void) { - return qgcApp()->toolbox()->corePlugin()->showAdvancedUI(); + return nullptr; } -QColor -CustomOptions::toolbarBackgroundLight() const +// Normal QGC needs to work with an ESP8266 WiFi thing which is remarkably crappy. This in turns causes PX4 Pro calibration to fail +// quite often. There is a warning in regular QGC about this. Overriding the and returning true means that your custom vehicle has +// a reliable WiFi connection so don't show that warning. +bool CustomOptions::wifiReliableForCalibration(void) const { - return CustomPlugin::_windowShadeEnabledLightColor; + return true; } -QColor -CustomOptions::toolbarBackgroundDark() const -{ - return CustomPlugin::_windowShadeEnabledDarkColor; -} -//----------------------------------------------------------------------------- CustomPlugin::CustomPlugin(QGCApplication *app, QGCToolbox* toolbox) : QGCCorePlugin(app, toolbox) { - _pOptions = new CustomOptions(this, this); + + _options = new CustomOptions(this, this); _showAdvancedUI = false; } -//----------------------------------------------------------------------------- CustomPlugin::~CustomPlugin() { } -//----------------------------------------------------------------------------- -void -CustomPlugin::setToolbox(QGCToolbox* toolbox) +void CustomPlugin::setToolbox(QGCToolbox* toolbox) { QGCCorePlugin::setToolbox(toolbox); - qmlRegisterSingletonType("CustomQuickInterface", 1, 0, "CustomQuickInterface", customQuickInterfaceSingletonFactory); - //-- Disable automatic logging - toolbox->mavlinkLogManager()->setEnableAutoStart(false); - toolbox->mavlinkLogManager()->setEnableAutoUpload(false); + + // Allows us to be notified when the user goes in/out out advanced mode connect(qgcApp()->toolbox()->corePlugin(), &QGCCorePlugin::showAdvancedUIChanged, this, &CustomPlugin::_advancedChanged); } -//----------------------------------------------------------------------------- -void -CustomPlugin::_advancedChanged(bool changed) +void CustomPlugin::_advancedChanged(bool changed) { - //-- We are now in "Advanced Mode" (or not) - emit _pOptions->showFirmwareUpgradeChanged(changed); + // Firmware Upgrade page is only show in Advanced mode + emit _options->showFirmwareUpgradeChanged(changed); } //----------------------------------------------------------------------------- -void -CustomPlugin::addSettingsEntry(const QString& title, - const char* qmlFile, - const char* iconFile/*= nullptr*/) +void CustomPlugin::_addSettingsEntry(const QString& title, const char* qmlFile, const char* iconFile) { Q_CHECK_PTR(qmlFile); // 'this' instance will take ownership on the QmlComponentInfo instance @@ -130,118 +107,66 @@ QVariantList& CustomPlugin::settingsPages() { if(_customSettingsList.isEmpty()) { - addSettingsEntry(tr("General"), "qrc:/qml/GeneralSettings.qml", "qrc:/res/gear-white.svg"); - addSettingsEntry(tr("Comm Links"), "qrc:/qml/LinkSettings.qml", "qrc:/res/waves.svg"); - addSettingsEntry(tr("Offline Maps"),"qrc:/qml/OfflineMap.qml", "qrc:/res/waves.svg"); -#if defined(QGC_GST_MICROHARD_ENABLED) - addSettingsEntry(tr("Microhard"), "qrc:/qml/MicrohardSettings.qml"); -#endif -#if defined(QGC_GST_TAISYNC_ENABLED) - addSettingsEntry(tr("Taisync"), "qrc:/qml/TaisyncSettings.qml"); -#endif -#if defined(QGC_AIRMAP_ENABLED) - addSettingsEntry(tr("AirMap"), "qrc:/qml/AirmapSettings.qml"); -#endif - addSettingsEntry(tr("MAVLink"), "qrc:/qml/MavlinkSettings.qml", " qrc:/res/waves.svg"); - addSettingsEntry(tr("Console"), "qrc:/qml/QGroundControl/Controls/AppMessages.qml"); -#if defined(QGC_ENABLE_QZXING) - addSettingsEntry(tr("Barcode Test"),"qrc:/custom/BarcodeReader.qml"); -#endif + _addSettingsEntry(tr("General"), "qrc:/qml/GeneralSettings.qml", "qrc:/res/gear-white.svg"); + _addSettingsEntry(tr("Comm Links"), "qrc:/qml/LinkSettings.qml", "qrc:/res/waves.svg"); + _addSettingsEntry(tr("Offline Maps"),"qrc:/qml/OfflineMap.qml", "qrc:/res/waves.svg"); + _addSettingsEntry(tr("MAVLink"), "qrc:/qml/MavlinkSettings.qml", "qrc:/res/waves.svg"); + _addSettingsEntry(tr("Console"), "qrc:/qml/QGroundControl/Controls/AppMessages.qml"); #if defined(QT_DEBUG) //-- These are always present on Debug builds - addSettingsEntry(tr("Mock Link"), "qrc:/qml/MockLink.qml"); - addSettingsEntry(tr("Debug"), "qrc:/qml/DebugWindow.qml"); - addSettingsEntry(tr("Palette Test"),"qrc:/qml/QmlTest.qml"); + _addSettingsEntry(tr("Mock Link"), "qrc:/qml/MockLink.qml"); #endif } return _customSettingsList; } -//----------------------------------------------------------------------------- -QGCOptions* -CustomPlugin::options() +QGCOptions* CustomPlugin::options() { - return _pOptions; + return _options; } -//----------------------------------------------------------------------------- -QString -CustomPlugin::brandImageIndoor(void) const +QString CustomPlugin::brandImageIndoor(void) const { - return QStringLiteral("/custom/img/void.png"); + return QStringLiteral("/custom/img/CustomAppIcon.png"); } -//----------------------------------------------------------------------------- -QString -CustomPlugin::brandImageOutdoor(void) const +QString CustomPlugin::brandImageOutdoor(void) const { - return QStringLiteral("/custom/img/void.png"); + return QStringLiteral("/custom/img/CustomAppIcon.png"); } -//----------------------------------------------------------------------------- -bool -CustomPlugin::overrideSettingsGroupVisibility(QString name) +bool CustomPlugin::overrideSettingsGroupVisibility(QString name) { + // We have set up our own specific brand imaging. Hide the brand image settings such that the end user + // can't change it. if (name == BrandImageSettings::name) { return false; } return true; } -//----------------------------------------------------------------------------- -VideoManager* -CustomPlugin::createVideoManager(QGCApplication *app, QGCToolbox *toolbox) -{ - return new CustomVideoManager(app, toolbox); -} - -//----------------------------------------------------------------------------- -VideoReceiver* -CustomPlugin::createVideoReceiver(QObject* parent) -{ - return new CustomVideoReceiver(parent); -} - -//----------------------------------------------------------------------------- -QQmlApplicationEngine* -CustomPlugin::createRootWindow(QObject *parent) -{ - QQmlApplicationEngine* pEngine = new QQmlApplicationEngine(parent); - pEngine->addImportPath("qrc:/qml"); - pEngine->addImportPath("qrc:/Custom/Widgets"); - pEngine->addImportPath("qrc:/Custom/Camera"); - pEngine->rootContext()->setContextProperty("joystickManager", qgcApp()->toolbox()->joystickManager()); - pEngine->rootContext()->setContextProperty("debugMessageModel", AppMessages::getModel()); - pEngine->load(QUrl(QStringLiteral("qrc:/qml/MainRootWindow.qml"))); - return pEngine; -} - -//----------------------------------------------------------------------------- -bool -CustomPlugin::adjustSettingMetaData(const QString& settingsGroup, FactMetaData& metaData) +// This allows you to override/hide QGC Application settings +bool CustomPlugin::adjustSettingMetaData(const QString& settingsGroup, FactMetaData& metaData) { bool parentResult = QGCCorePlugin::adjustSettingMetaData(settingsGroup, metaData); + if (settingsGroup == AppSettings::settingsGroup) { - if (metaData.name() == AppSettings::appFontPointSizeName) { - #if defined(Q_OS_LINUX) - int defaultFontPointSize = 11; - metaData.setRawDefaultValue(defaultFontPointSize); - #endif - } else if (metaData.name() == AppSettings::indoorPaletteName) { - QVariant indoorPalette = 1; - metaData.setRawDefaultValue(indoorPalette); - parentResult = true; + // This tells QGC than when you are creating Plans while not connected to a vehicle + // the specific firmware/vehicle the plan is for. + if (metaData.name() == AppSettings::offlineEditingFirmwareTypeName) { + metaData.setRawDefaultValue(MAV_AUTOPILOT_PX4); + return false; + } else if (metaData.name() == AppSettings::offlineEditingVehicleTypeName) { + metaData.setRawDefaultValue(MAV_TYPE_QUADROTOR); + return false; } } + return parentResult; } -const QColor CustomPlugin::_windowShadeEnabledLightColor("#FFFFFF"); -const QColor CustomPlugin::_windowShadeEnabledDarkColor("#212529"); - -//----------------------------------------------------------------------------- -void -CustomPlugin::paletteOverride(QString colorName, QGCPalette::PaletteColorInfo_t& colorInfo) +// This modifies QGC colors palette to match possible custom corporate branding +void CustomPlugin::paletteOverride(QString colorName, QGCPalette::PaletteColorInfo_t& colorInfo) { if (colorName == QStringLiteral("window")) { colorInfo[QGCPalette::Dark][QGCPalette::ColorGroupEnabled] = QColor("#212529"); @@ -430,3 +355,11 @@ CustomPlugin::paletteOverride(QString colorName, QGCPalette::PaletteColorInfo_t& colorInfo[QGCPalette::Light][QGCPalette::ColorGroupDisabled] = QColor("#48d6ff"); } } + +// We override this so we can get access to QQmlApplicationEngine and use it to register our qml module +QQmlApplicationEngine* CustomPlugin::createQmlApplicationEngine(QObject* parent) +{ + QQmlApplicationEngine* qmlEngine = QGCCorePlugin::createQmlApplicationEngine(parent); + qmlEngine->addImportPath("qrc:/Custom/Widgets"); + return qmlEngine; +} diff --git a/custom-example/src/CustomPlugin.h b/custom-example/src/CustomPlugin.h index 6b6ca632b5448aadd2f518a1938d3e7ba65a5966..53b63fc9f41bf64483c14b8e4e3cb2a50724d891 100644 --- a/custom-example/src/CustomPlugin.h +++ b/custom-example/src/CustomPlugin.h @@ -24,48 +24,21 @@ class CustomSettings; Q_DECLARE_LOGGING_CATEGORY(CustomLog) -//-- Our own, custom video receiver -class CustomVideoReceiver : public GstVideoReceiver -{ - Q_OBJECT -public: - - explicit CustomVideoReceiver(QObject* parent = nullptr); - ~CustomVideoReceiver(); - -}; - -//----------------------------------------------------------------------------- -//-- Our own, custom options class CustomOptions : public QGCOptions { public: CustomOptions(CustomPlugin*, QObject* parent = nullptr); - bool wifiReliableForCalibration () const final { return true; } -#if defined(Q_OS_LINUX) - double toolbarHeightMultiplier () final { return 1.25; } -#endif - QUrl flyViewOverlay () const final { return QUrl::fromUserInput("qrc:/custom/CustomFlyView.qml"); } - QUrl preFlightChecklistUrl () const final { return QUrl::fromUserInput("qrc:/custom/PreFlightCheckList.qml"); } - //-- We have our own toolbar - QUrl mainToolbarUrl () const final { return QUrl::fromUserInput("qrc:/custom/CustomMainToolBar.qml"); } - QUrl planToolbarUrl () const final { return QUrl::fromUserInput("qrc:/custom/CustomMainToolBar.qml"); } - //-- Don't show instrument widget - CustomInstrumentWidget* instrumentWidget () final { return nullptr; } - bool showMavlinkLogOptions () const final { return false; } - bool showFirmwareUpgrade () const final; - //-- We handle multiple vehicles in a custom way - bool enableMultiVehicleList () const final { return false; } - //-- We handle our own map scale - bool enableMapScale () const final { return false; } - // TODO: Can't access QGCPalette without some workarounds, change this upstream - QColor toolbarBackgroundLight () const final; - QColor toolbarBackgroundDark () const final; + // Overrides from QGCOptions + + bool wifiReliableForCalibration (void) const final; + QUrl flyViewOverlay (void) const final; + CustomInstrumentWidget* instrumentWidget (void) final; + bool showFirmwareUpgrade (void) const final; + bool enableMultiVehicleList (void) const final; }; -//----------------------------------------------------------------------------- class CustomPlugin : public QGCCorePlugin { Q_OBJECT @@ -74,33 +47,25 @@ public: ~CustomPlugin(); // Overrides from QGCCorePlugin - QVariantList& settingsPages () final; - QGCOptions* options () final; - QString brandImageIndoor () const final; - QString brandImageOutdoor () const final; + QVariantList& settingsPages (void) final; + QGCOptions* options (void) final; + QString brandImageIndoor (void) const final; + QString brandImageOutdoor (void) const final; bool overrideSettingsGroupVisibility (QString name) final; - VideoManager* createVideoManager (QGCApplication* app, QGCToolbox* toolbox) final; - VideoReceiver* createVideoReceiver (QObject* parent) final; - QQmlApplicationEngine* createRootWindow (QObject* parent) final; bool adjustSettingMetaData (const QString& settingsGroup, FactMetaData& metaData) final; void paletteOverride (QString colorName, QGCPalette::PaletteColorInfo_t& colorInfo) final; + QQmlApplicationEngine* createQmlApplicationEngine (QObject* parent) final; + // Overrides from QGCTool void setToolbox (QGCToolbox* toolbox); - const static QColor _windowShadeEnabledLightColor; - const static QColor _windowShadeEnabledDarkColor; - private slots: - void _advancedChanged (bool advanced); + void _advancedChanged(bool advanced); private: - void - addSettingsEntry( - const QString& title, - const char* qmlFile, - const char* iconFile = nullptr); + void _addSettingsEntry(const QString& title, const char* qmlFile, const char* iconFile = nullptr); private: - CustomOptions* _pOptions = nullptr; - QVariantList _customSettingsList; // Not to be mixed up with QGCCorePlugin implementation + CustomOptions* _options = nullptr; + QVariantList _customSettingsList; // Not to be mixed up with QGCCorePlugin implementation }; diff --git a/custom-example/src/CustomQuickInterface.cc b/custom-example/src/CustomQuickInterface.cc deleted file mode 100644 index 3208270401f8fafcc57e687675b680b7cd4aed69..0000000000000000000000000000000000000000 --- a/custom-example/src/CustomQuickInterface.cc +++ /dev/null @@ -1,77 +0,0 @@ -/**************************************************************************** - * - * (c) 2009-2019 QGROUNDCONTROL PROJECT - * - * QGroundControl is licensed according to the terms in the file - * COPYING.md in the root of the source code directory. - * - * @file - * @brief Custom QtQuick Interface - * @author Gus Grubba - */ - -#include "QGCApplication.h" -#include "AppSettings.h" -#include "SettingsManager.h" -#include "MAVLinkLogManager.h" -#include "QGCMapEngine.h" -#include "QGCApplication.h" -#include "PositionManager.h" - -#include "CustomPlugin.h" -#include "CustomQuickInterface.h" - -#include - -static const char* kGroupName = "CustomSettings"; -static const char* kShowGimbalCtl = "ShowGimbalCtl"; -static const char* kShowAttitudeWidget = "ShowAttitudeWidget"; - -//----------------------------------------------------------------------------- -CustomQuickInterface::CustomQuickInterface(QObject* parent) - : QObject(parent) -{ - qCDebug(CustomLog) << "CustomQuickInterface Created"; -} - -//----------------------------------------------------------------------------- -CustomQuickInterface::~CustomQuickInterface() -{ - qCDebug(CustomLog) << "CustomQuickInterface Destroyed"; -} - -//----------------------------------------------------------------------------- -void -CustomQuickInterface::init() -{ - QSettings settings; - settings.beginGroup(kGroupName); - _showGimbalControl = settings.value(kShowGimbalCtl, false).toBool(); - _showAttitudeWidget = settings.value(kShowAttitudeWidget, false).toBool(); -} - -//----------------------------------------------------------------------------- -void -CustomQuickInterface::setShowGimbalControl(bool set) -{ - if(_showGimbalControl != set) { - _showGimbalControl = set; - QSettings settings; - settings.beginGroup(kGroupName); - settings.setValue(kShowGimbalCtl,set); - emit showGimbalControlChanged(); - } -} - -//----------------------------------------------------------------------------- -void -CustomQuickInterface::setShowAttitudeWidget(bool set) -{ - if(_showAttitudeWidget != set) { - _showAttitudeWidget = set; - QSettings settings; - settings.beginGroup(kGroupName); - settings.setValue(kShowAttitudeWidget,set); - emit showAttitudeWidgetChanged(); - } -} diff --git a/custom-example/src/CustomQuickInterface.h b/custom-example/src/CustomQuickInterface.h deleted file mode 100644 index c0bc2e110c44f3c2743c2cc6403c4d00e0658c80..0000000000000000000000000000000000000000 --- a/custom-example/src/CustomQuickInterface.h +++ /dev/null @@ -1,48 +0,0 @@ -/**************************************************************************** - * - * (c) 2009-2019 QGROUNDCONTROL PROJECT - * - * QGroundControl is licensed according to the terms in the file - * COPYING.md in the root of the source code directory. - * - * @file - * @brief Custom QtQuick Interface - * @author Gus Grubba - */ - -#pragma once - -#include "Vehicle.h" - -#include -#include -#include -#include -#include - -//----------------------------------------------------------------------------- -// QtQuick Interface (UI) -class CustomQuickInterface : public QObject -{ - Q_OBJECT -public: - CustomQuickInterface(QObject* parent = nullptr); - ~CustomQuickInterface(); - Q_PROPERTY(bool showGimbalControl READ showGimbalControl WRITE setShowGimbalControl NOTIFY showGimbalControlChanged) - Q_PROPERTY(bool showAttitudeWidget READ showAttitudeWidget WRITE setShowAttitudeWidget NOTIFY showAttitudeWidgetChanged) - - bool showGimbalControl () { return _showGimbalControl; } - void setShowGimbalControl (bool set); - void init (); - - bool showAttitudeWidget () { return _showAttitudeWidget; } - void setShowAttitudeWidget (bool set); - -signals: - void showGimbalControlChanged (); - void showAttitudeWidgetChanged(); - -private: - bool _showGimbalControl = true; - bool _showAttitudeWidget = false; -}; diff --git a/custom-example/src/CustomVideoManager.cc b/custom-example/src/CustomVideoManager.cc deleted file mode 100644 index 73acf7b9c0c40eee33e9c3d7a99fe2bb61958fcf..0000000000000000000000000000000000000000 --- a/custom-example/src/CustomVideoManager.cc +++ /dev/null @@ -1,29 +0,0 @@ -/**************************************************************************** - * - * (c) 2009-2019 QGROUNDCONTROL PROJECT - * - * QGroundControl is licensed according to the terms in the file - * COPYING.md in the root of the source code directory. - * - ****************************************************************************/ - -#include "CustomVideoManager.h" -#include "MultiVehicleManager.h" -#include "CustomCameraManager.h" -#include "CustomCameraControl.h" - -//----------------------------------------------------------------------------- -CustomVideoManager::CustomVideoManager(QGCApplication* app, QGCToolbox* toolbox) - : VideoManager(app, toolbox) -{ -} - -//----------------------------------------------------------------------------- -void -CustomVideoManager::_updateSettings(unsigned id) -{ - if(!_videoSettings || !_videoReceiver) - return; - VideoManager::_updateSettings(id); -} - diff --git a/custom-example/src/CustomVideoManager.h b/custom-example/src/CustomVideoManager.h deleted file mode 100644 index 030b35a332a87dba7672f975b7daf1df8058a3d8..0000000000000000000000000000000000000000 --- a/custom-example/src/CustomVideoManager.h +++ /dev/null @@ -1,28 +0,0 @@ -/**************************************************************************** - * - * (c) 2009-2019 QGROUNDCONTROL PROJECT - * - * QGroundControl is licensed according to the terms in the file - * COPYING.md in the root of the source code directory. - * - ****************************************************************************/ - -#pragma once - -#include -#include -#include -#include - -#include "VideoManager.h" - -class CustomVideoManager : public VideoManager -{ - Q_OBJECT -public: - CustomVideoManager (QGCApplication* app, QGCToolbox* toolbox); - -protected: - void _updateSettings (unsigned id); - -}; diff --git a/custom-example/src/FirmwarePlugin/CustomCameraControl.cc b/custom-example/src/FirmwarePlugin/CustomCameraControl.cc deleted file mode 100644 index 7817a46c30d0b3cc20a302499756165ff8c7d929..0000000000000000000000000000000000000000 --- a/custom-example/src/FirmwarePlugin/CustomCameraControl.cc +++ /dev/null @@ -1,134 +0,0 @@ -/**************************************************************************** - * - * (c) 2009-2019 QGROUNDCONTROL PROJECT - * - * QGroundControl is licensed according to the terms in the file - * COPYING.md in the root of the source code directory. - * - * @file - * @brief Camera Controller - * @author Gus Grubba - * - */ - -#include "CustomCameraControl.h" -#include "QGCCameraIO.h" - -QGC_LOGGING_CATEGORY(CustomCameraLog, "CustomCameraLog") -QGC_LOGGING_CATEGORY(CustomCameraVerboseLog, "CustomCameraVerboseLog") - -static const char* kCAM_IRPALETTE = "CAM_IRPALETTE"; -static const char* kCAM_NEXTVISION_IRPALETTE = "IR_SENS_POL"; - -//----------------------------------------------------------------------------- -CustomCameraControl::CustomCameraControl(const mavlink_camera_information_t *info, Vehicle* vehicle, int compID, QObject* parent) - : QGCCameraControl(info, vehicle, compID, parent) -{ -} - -//----------------------------------------------------------------------------- -bool -CustomCameraControl::takePhoto() -{ - bool res = false; - res = QGCCameraControl::takePhoto(); - return res; -} - -//----------------------------------------------------------------------------- -bool -CustomCameraControl::stopTakePhoto() -{ - bool res = QGCCameraControl::stopTakePhoto(); - return res; -} - -//----------------------------------------------------------------------------- -bool -CustomCameraControl::startVideo() -{ - bool res = QGCCameraControl::startVideo(); - return res; -} - -//----------------------------------------------------------------------------- -bool -CustomCameraControl::stopVideo() -{ - bool res = QGCCameraControl::stopVideo(); - return res; -} - -//----------------------------------------------------------------------------- -void -CustomCameraControl::setVideoMode() -{ - if(cameraMode() != CAM_MODE_VIDEO) { - qCDebug(CustomCameraLog) << "setVideoMode()"; - Fact* pFact = getFact(kCAM_MODE); - if(pFact) { - pFact->setRawValue(CAM_MODE_VIDEO); - _setCameraMode(CAM_MODE_VIDEO); - } - } -} - -//----------------------------------------------------------------------------- -void -CustomCameraControl::setPhotoMode() -{ - if(cameraMode() != CAM_MODE_PHOTO) { - qCDebug(CustomCameraLog) << "setPhotoMode()"; - Fact* pFact = getFact(kCAM_MODE); - if(pFact) { - pFact->setRawValue(CAM_MODE_PHOTO); - _setCameraMode(CAM_MODE_PHOTO); - } - } -} - -//----------------------------------------------------------------------------- -void -CustomCameraControl::_setVideoStatus(VideoStatus status) -{ - QGCCameraControl::_setVideoStatus(status); -} - -//----------------------------------------------------------------------------- -void -CustomCameraControl::handleCaptureStatus(const mavlink_camera_capture_status_t& cap) -{ - QGCCameraControl::handleCaptureStatus(cap); -} - -//----------------------------------------------------------------------------- -Fact* -CustomCameraControl::irPalette() -{ - if(_paramComplete) { - if(_activeSettings.contains(kCAM_IRPALETTE)) { - return getFact(kCAM_IRPALETTE); - } - else if(_activeSettings.contains(kCAM_NEXTVISION_IRPALETTE)) { - return getFact(kCAM_NEXTVISION_IRPALETTE); - } - } - return nullptr; -} - -//----------------------------------------------------------------------------- -void -CustomCameraControl::setThermalMode(ThermalViewMode mode) -{ - if(_paramComplete) { - if(vendor() == "NextVision" && _activeSettings.contains("CAM_SENSOR")) { - if(mode == THERMAL_FULL) { - getFact("CAM_SENSOR")->setRawValue(1); - } - else if(mode == THERMAL_OFF) { - getFact("CAM_SENSOR")->setRawValue(0); - } - } - } - QGCCameraControl::setThermalMode(mode); -} diff --git a/custom-example/src/FirmwarePlugin/CustomCameraControl.h b/custom-example/src/FirmwarePlugin/CustomCameraControl.h deleted file mode 100644 index 213af8dfab4b5908b9cdaea19ace391fc4b1e7e0..0000000000000000000000000000000000000000 --- a/custom-example/src/FirmwarePlugin/CustomCameraControl.h +++ /dev/null @@ -1,47 +0,0 @@ -/**************************************************************************** - * - * (c) 2009-2019 QGROUNDCONTROL PROJECT - * - * QGroundControl is licensed according to the terms in the file - * COPYING.md in the root of the source code directory. - * - * @file - * @brief Camera Controller - * @author Gus Grubba - * - */ - -#pragma once - -#include "QGCCameraControl.h" - -#include -#include - -Q_DECLARE_LOGGING_CATEGORY(CustomCameraLog) -Q_DECLARE_LOGGING_CATEGORY(CustomCameraVerboseLog) - -//----------------------------------------------------------------------------- -class CustomCameraControl : public QGCCameraControl -{ - Q_OBJECT -public: - CustomCameraControl(const mavlink_camera_information_t* info, Vehicle* vehicle, int compID, QObject* parent = nullptr); - - Q_PROPERTY(Fact* irPalette READ irPalette NOTIFY parametersReady) - - Fact* irPalette (); - - bool takePhoto () override; - bool stopTakePhoto () override; - bool startVideo () override; - bool stopVideo () override; - void setVideoMode () override; - void setPhotoMode () override; - void handleCaptureStatus (const mavlink_camera_capture_status_t& capStatus) override; - void setThermalMode (ThermalViewMode mode) override; - -protected: - void _setVideoStatus (VideoStatus status) override; - -}; diff --git a/custom-example/src/FirmwarePlugin/CustomCameraManager.cc b/custom-example/src/FirmwarePlugin/CustomCameraManager.cc deleted file mode 100644 index df96efcb9575c0306acad4cfbd97ee769131ea7f..0000000000000000000000000000000000000000 --- a/custom-example/src/FirmwarePlugin/CustomCameraManager.cc +++ /dev/null @@ -1,21 +0,0 @@ -/**************************************************************************** - * - * (c) 2009-2019 QGROUNDCONTROL PROJECT - * - * QGroundControl is licensed according to the terms in the file - * COPYING.md in the root of the source code directory. - * - * @file - * @brief Camera Controller - * @author Gus Grubba - * - */ - -#include "QGCApplication.h" -#include "CustomCameraManager.h" - -//----------------------------------------------------------------------------- -CustomCameraManager::CustomCameraManager(Vehicle *vehicle) - : QGCCameraManager(vehicle) -{ -} diff --git a/custom-example/src/FirmwarePlugin/CustomCameraManager.h b/custom-example/src/FirmwarePlugin/CustomCameraManager.h deleted file mode 100644 index 72e37e2d558c71e9139bee82b4f68a076df3bc38..0000000000000000000000000000000000000000 --- a/custom-example/src/FirmwarePlugin/CustomCameraManager.h +++ /dev/null @@ -1,24 +0,0 @@ -/**************************************************************************** - * - * (c) 2009-2019 QGROUNDCONTROL PROJECT - * - * QGroundControl is licensed according to the terms in the file - * COPYING.md in the root of the source code directory. - * - * @file - * @brief Camera Controller - * @author Gus Grubba - * - */ - -#pragma once - -#include "QGCCameraManager.h" - -//----------------------------------------------------------------------------- -class CustomCameraManager : public QGCCameraManager -{ - Q_OBJECT -public: - CustomCameraManager(Vehicle* vehicle); -}; diff --git a/custom-example/src/FirmwarePlugin/CustomFirmwarePlugin.cc b/custom-example/src/FirmwarePlugin/CustomFirmwarePlugin.cc index a460de252f4aacf49c5aeeeae212bc89de7d17a9..bc5747cb3240b9e8fa26d8a88bcb0d7c26b38590 100644 --- a/custom-example/src/FirmwarePlugin/CustomFirmwarePlugin.cc +++ b/custom-example/src/FirmwarePlugin/CustomFirmwarePlugin.cc @@ -13,17 +13,15 @@ #include "CustomFirmwarePlugin.h" #include "CustomAutoPilotPlugin.h" -#include "CustomCameraManager.h" -#include "CustomCameraControl.h" //----------------------------------------------------------------------------- CustomFirmwarePlugin::CustomFirmwarePlugin() { for (int i = 0; i < _flightModeInfoList.count(); i++) { FlightModeInfo_t& info = _flightModeInfoList[i]; - //-- Narrow the options to only these two - if (info.name != _altCtlFlightMode && - info.name != _posCtlFlightMode) { + //-- Narrow the flight mode options to only these + if (info.name != _holdFlightMode && info.name != _rtlFlightMode && info.name != _missionFlightMode) { + // No other flight modes can be set info.canBeSet = false; } } @@ -35,34 +33,23 @@ AutoPilotPlugin* CustomFirmwarePlugin::autopilotPlugin(Vehicle* vehicle) return new CustomAutoPilotPlugin(vehicle, vehicle); } -//----------------------------------------------------------------------------- -QGCCameraManager* -CustomFirmwarePlugin::createCameraManager(Vehicle *vehicle) -{ - return new CustomCameraManager(vehicle); -} - -//----------------------------------------------------------------------------- -QGCCameraControl* -CustomFirmwarePlugin::createCameraControl(const mavlink_camera_information_t* info, Vehicle *vehicle, int compID, QObject* parent) +const QVariantList& CustomFirmwarePlugin::toolBarIndicators(const Vehicle* vehicle) { - return new CustomCameraControl(info, vehicle, compID, parent); -} - -//----------------------------------------------------------------------------- -const QVariantList& -CustomFirmwarePlugin::toolBarIndicators(const Vehicle* vehicle) -{ - Q_UNUSED(vehicle); - if(_toolBarIndicatorList.size() == 0) { -#if defined(QGC_ENABLE_PAIRING) - _toolBarIndicatorList.append(QVariant::fromValue(QUrl::fromUserInput("qrc:/custom/PairingIndicator.qml"))); -#endif - _toolBarIndicatorList.append(QVariant::fromValue(QUrl::fromUserInput("qrc:/toolbar/GPSIndicator.qml"))); - _toolBarIndicatorList.append(QVariant::fromValue(QUrl::fromUserInput("qrc:/toolbar/TelemetryRSSIIndicator.qml"))); - _toolBarIndicatorList.append(QVariant::fromValue(QUrl::fromUserInput("qrc:/toolbar/RCRSSIIndicator.qml"))); - _toolBarIndicatorList.append(QVariant::fromValue(QUrl::fromUserInput("qrc:/toolbar/BatteryIndicator.qml"))); + if (_toolBarIndicatorList.size() == 0) { + // First call the base class to get the standard QGC list. This way we are guaranteed to always get + // any new toolbar indicators which are added upstream in our custom build. + _toolBarIndicatorList = FirmwarePlugin::toolBarIndicators(vehicle); + // Then specifically remove the RC RSSI indicator. + _toolBarIndicatorList.removeOne(QVariant::fromValue(QUrl::fromUserInput("qrc:/toolbar/RCRSSIIndicator.qml"))); } return _toolBarIndicatorList; } +// Tells QGC that your vehicle has a gimbal on it. This will in turn cause thing like gimbal commands to point +// the camera straight down for surveys to be automatically added to Plans. +bool CustomFirmwarePlugin::hasGimbal(Vehicle* /*vehicle*/, bool& rollSupported, bool& pitchSupported, bool& yawSupported) +{ + rollSupported = false; + pitchSupported = true; + yawSupported = true; +} diff --git a/custom-example/src/FirmwarePlugin/CustomFirmwarePlugin.h b/custom-example/src/FirmwarePlugin/CustomFirmwarePlugin.h index 47aa0aff832d05c2b3bc5b01273238f6df70a76b..5162e8a8ec940737443e245a9f31d6c8e44168e6 100644 --- a/custom-example/src/FirmwarePlugin/CustomFirmwarePlugin.h +++ b/custom-example/src/FirmwarePlugin/CustomFirmwarePlugin.h @@ -23,11 +23,12 @@ class CustomFirmwarePlugin : public PX4FirmwarePlugin Q_OBJECT public: CustomFirmwarePlugin(); + // FirmwarePlugin overrides - AutoPilotPlugin* autopilotPlugin (Vehicle* vehicle) override; - QGCCameraManager* createCameraManager (Vehicle *vehicle) override; - QGCCameraControl* createCameraControl (const mavlink_camera_information_t* info, Vehicle* vehicle, int compID, QObject* parent = nullptr) override; - const QVariantList& toolBarIndicators (const Vehicle* vehicle) override; + AutoPilotPlugin* autopilotPlugin (Vehicle* vehicle) final; + const QVariantList& toolBarIndicators (const Vehicle* vehicle) final; + bool hasGimbal (Vehicle* vehicle, bool& rollSupported, bool& pitchSupported, bool& yawSupported) final; + private: QVariantList _toolBarIndicatorList; }; diff --git a/custom-example/src/FirmwarePlugin/CustomFirmwarePluginFactory.cc b/custom-example/src/FirmwarePlugin/CustomFirmwarePluginFactory.cc index 6be526827d2ade4c322955acae1d4ba6e9a00ed6..36ece796fa76ad158dcd78c99b45869e3b404409 100644 --- a/custom-example/src/FirmwarePlugin/CustomFirmwarePluginFactory.cc +++ b/custom-example/src/FirmwarePlugin/CustomFirmwarePluginFactory.cc @@ -19,6 +19,7 @@ CustomFirmwarePluginFactory CustomFirmwarePluginFactoryImp; CustomFirmwarePluginFactory::CustomFirmwarePluginFactory() : _pluginInstance(nullptr) { + } QList CustomFirmwarePluginFactory::supportedFirmwareTypes() const @@ -28,9 +29,8 @@ QList CustomFirmwarePluginFactory::supportedFirmwareTypes() const return list; } -FirmwarePlugin* CustomFirmwarePluginFactory::firmwarePluginForAutopilot(MAV_AUTOPILOT autopilotType, MAV_TYPE vehicleType) +FirmwarePlugin* CustomFirmwarePluginFactory::firmwarePluginForAutopilot(MAV_AUTOPILOT autopilotType, MAV_TYPE /*vehicleType*/) { - Q_UNUSED(vehicleType); if (autopilotType == MAV_AUTOPILOT_PX4) { if (!_pluginInstance) { _pluginInstance = new CustomFirmwarePlugin; @@ -39,3 +39,11 @@ FirmwarePlugin* CustomFirmwarePluginFactory::firmwarePluginForAutopilot(MAV_AUTO } return nullptr; } + + +QList CustomFirmwarePluginFactory::supportedVehicleTypes(void) const +{ + QList mavTypes; + mavTypes.append(MAV_TYPE_QUADROTOR); + return mavTypes; +} diff --git a/custom-example/src/FirmwarePlugin/CustomFirmwarePluginFactory.h b/custom-example/src/FirmwarePlugin/CustomFirmwarePluginFactory.h index 6e8a28f71003f7750a1209a512da00889ce3c740..ffe39bea6860b005b0f0f3ad90fe92dd58dbdfcc 100644 --- a/custom-example/src/FirmwarePlugin/CustomFirmwarePluginFactory.h +++ b/custom-example/src/FirmwarePlugin/CustomFirmwarePluginFactory.h @@ -17,13 +17,19 @@ class CustomFirmwarePlugin; +/// This custom implementation of FirmwarePluginFactory creates a custom build which only supports +/// PX4 Pro firmware running on a multi-rotor vehicle. This is turn removes portions of the QGC UI +/// related to other firmware and vehicle types. This creating a more simplified UI for a specific +/// type of vehicle. class CustomFirmwarePluginFactory : public FirmwarePluginFactory { Q_OBJECT public: CustomFirmwarePluginFactory(); - QList supportedFirmwareTypes () const override; - FirmwarePlugin* firmwarePluginForAutopilot (MAV_AUTOPILOT autopilotType, MAV_TYPE vehicleType) override; + QList supportedFirmwareTypes () const final; + FirmwarePlugin* firmwarePluginForAutopilot (MAV_AUTOPILOT autopilotType, MAV_TYPE vehicleType) final; + QList supportedVehicleTypes (void) const final; + private: CustomFirmwarePlugin* _pluginInstance; }; diff --git a/custom-example/updateqrc.py b/custom-example/updateqrc.py new file mode 100755 index 0000000000000000000000000000000000000000..e5c491029037a1e22aaf0b6100860d054fa85d9f --- /dev/null +++ b/custom-example/updateqrc.py @@ -0,0 +1,38 @@ +#!/usr/bin/env python +import os + +qgc_rc = "qgroundcontrol.qrc" +res_rc = "qgcresources.qrc" +qgc_exc = "qgroundcontrol.exclusion" +res_exc = "qgcresources.exclusion" + +def read_file(filename): + with open(filename) as src: + return [line.rstrip().lstrip() for line in src.readlines()] + +def process(src, exclusion, dst): + file1 = read_file(src) + file2 = read_file(exclusion) + file3 = open(dst, 'w') + for line in file1: + if line not in file2: + if line.startswith('", ">../", 1) + file3.write(newLine + '\n') + else: + print 'Excluded:', line + file3.close() + +def main(): + if(os.path.isfile(qgc_exc)): + process(os.path.join("../",qgc_rc), qgc_exc, qgc_rc) + if(os.path.isfile(res_exc)): + process(os.path.join("../",res_rc), res_exc, res_rc) + +if __name__ == '__main__': + main() diff --git a/src/QGCApplication.cc b/src/QGCApplication.cc index 7f9534f58f0e2370908d2e6476199a5621e34564..34671d22b14f835afaadd5496340c1da816df2fb 100644 --- a/src/QGCApplication.cc +++ b/src/QGCApplication.cc @@ -584,7 +584,8 @@ bool QGCApplication::_initForNormalAppBoot() QSettings settings; - _qmlAppEngine = toolbox()->corePlugin()->createRootWindow(this); + _qmlAppEngine = toolbox()->corePlugin()->createQmlApplicationEngine(this); + toolbox()->corePlugin()->createRootWindow(_qmlAppEngine); // Image provider for PX4 Flow QQuickImageProvider* pImgProvider = dynamic_cast(qgcApp()->toolbox()->imageProvider()); diff --git a/src/api/QGCCorePlugin.cc b/src/api/QGCCorePlugin.cc index d40477744b1e1ee0c06b84773521d994c7659440..0d0948547e26d253bd4bc2ba6f2715e27af56e6d 100644 --- a/src/api/QGCCorePlugin.cc +++ b/src/api/QGCCorePlugin.cc @@ -435,14 +435,18 @@ void QGCCorePlugin::instrumentValueAreaCreateDefaultSettings(const QString& defa } } -QQmlApplicationEngine* QGCCorePlugin::createRootWindow(QObject *parent) -{ - QQmlApplicationEngine* pEngine = new QQmlApplicationEngine(parent); - pEngine->addImportPath("qrc:/qml"); - pEngine->rootContext()->setContextProperty("joystickManager", qgcApp()->toolbox()->joystickManager()); - pEngine->rootContext()->setContextProperty("debugMessageModel", AppMessages::getModel()); - pEngine->load(QUrl(QStringLiteral("qrc:/qml/MainRootWindow.qml"))); - return pEngine; +QQmlApplicationEngine* QGCCorePlugin::createQmlApplicationEngine(QObject* parent) +{ + QQmlApplicationEngine* qmlEngine = new QQmlApplicationEngine(parent); + qmlEngine->addImportPath("qrc:/qml"); + qmlEngine->rootContext()->setContextProperty("joystickManager", qgcApp()->toolbox()->joystickManager()); + qmlEngine->rootContext()->setContextProperty("debugMessageModel", AppMessages::getModel()); + return qmlEngine; +} + +void QGCCorePlugin::createRootWindow(QQmlApplicationEngine* qmlEngine) +{ + qmlEngine->load(QUrl(QStringLiteral("qrc:/qml/MainRootWindow.qml"))); } bool QGCCorePlugin::mavlinkMessage(Vehicle* vehicle, LinkInterface* link, mavlink_message_t message) diff --git a/src/api/QGCCorePlugin.h b/src/api/QGCCorePlugin.h index 83e7b3595f5f234c9192c84314bc9e2f130620d0..a2b6f1835933d37af09a7606f7b0fc58a8995fff 100644 --- a/src/api/QGCCorePlugin.h +++ b/src/api/QGCCorePlugin.h @@ -110,8 +110,12 @@ public: virtual void instrumentValueAreaCreateDefaultSettings(const QString& defaultSettingsGroup); + /// Allows the plugin to override or get access to the QmlApplicationEngine to do things like add import + /// path or stuff things into the context prior to window creation. + virtual QQmlApplicationEngine* createQmlApplicationEngine(QObject* parent); + /// Allows the plugin to override the creation of the root (native) window. - virtual QQmlApplicationEngine* createRootWindow(QObject* parent); + virtual void createRootWindow(QQmlApplicationEngine* qmlEngine); /// Allows the plugin to override the creation of VideoManager. virtual VideoManager* createVideoManager(QGCApplication* app, QGCToolbox* toolbox);