Skip to content

Commit

Permalink
Major update to simplify and document the custom build example
Browse files Browse the repository at this point in the history
  • Loading branch information
DonLakeFlyer committed Apr 30, 2020
1 parent 2923769 commit d68e558
Show file tree
Hide file tree
Showing 60 changed files with 1,051 additions and 4,604 deletions.
Binary file added custom-example/README.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
35 changes: 17 additions & 18 deletions custom-example/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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!
42 changes: 17 additions & 25 deletions custom-example/custom.pri
Original file line number Diff line number Diff line change
Expand Up @@ -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 \
Expand All @@ -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 \

37 changes: 5 additions & 32 deletions custom-example/custom.qrc
Original file line number Diff line number Diff line change
@@ -1,47 +1,24 @@
<RCC>
<qresource prefix="/custom">
<file alias="CustomArmedIndicator.qml">res/MainToolbar/CustomArmedIndicator.qml</file>
<file alias="CustomBatteryIndicator.qml">res/MainToolbar/CustomBatteryIndicator.qml</file>
<file alias="CustomCameraControl.qml">res/CustomCameraControl.qml</file>
<file alias="CustomFlyView.qml">res/CustomFlyView.qml</file>
<file alias="CustomGPSIndicator.qml">res/MainToolbar/CustomGPSIndicator.qml</file>
<file alias="CustomMainToolBar.qml">res/MainToolbar/CustomMainToolBar.qml</file>
<file alias="CustomMainToolBarIndicators.qml">res/MainToolbar/CustomMainToolBarIndicators.qml</file>
<file alias="CustomModeIndicator.qml">res/MainToolbar/CustomModeIndicator.qml</file>
<file alias="CustomMultiVehicleSelector.qml">res/MainToolbar/CustomMultiVehicleSelector.qml</file>
<file alias="CustomRCRSSIIndicator.qml">res/MainToolbar/CustomRCRSSIIndicator.qml</file>
<file alias="PairingIndicator.qml">res/PairingIndicator.qml</file>
<file alias="PreFlightCheckList.qml">res/PreFlightCheckList.qml</file>
<file alias="CustomFlyViewOverlay.qml">res/CustomFlyViewOverlay.qml</file>
</qresource>
<qresource prefix="custom/img">
<file alias="altitude.svg">res/Images/altitude.svg</file>
<file alias="attitude_crosshair.svg">res/Images/attitude_crosshair.svg</file>
<file alias="attitude_dial.svg">res/Images/attitude_dial.svg</file>
<file alias="attitude_pointer.svg">res/Images/attitude_pointer.svg</file>
<file alias="camera_photo.svg">res/Images/camera_photo.svg</file>
<file alias="camera_settings.svg">res/Images/camera_settings.svg</file>
<file alias="camera_video.svg">res/Images/camera_video.svg</file>
<file alias="chronometer.svg">res/Images/chronometer.svg</file>
<file alias="compass_needle.svg">res/Images/compass_needle.svg</file>
<file alias="compass_pointer.svg">res/Images/compass_pointer.svg</file>
<file alias="distance.svg">res/Images/distance.svg</file>
<file alias="gimbal_icon.svg">res/Images/gimbal_icon.svg</file>
<file alias="gimbal_pitch_indoors.svg">res/Images/gimbal_pitch_indoors.svg</file>
<file alias="gimbal_pitch_outdoors.svg">res/Images/gimbal_pitch_outdoors.svg</file>
<file alias="gimbal_position.svg">res/Images/gimbal_position.svg</file>
<file alias="horizontal_speed.svg">res/Images/horizontal_speed.svg</file>
<file alias="microSD.svg">res/Images/microSD.svg</file>
<file alias="odometer.svg">res/Images/odometer.svg</file>
<file alias="PairingButton.svg">res/Images/PairingButton.svg</file>
<file alias="PairingConnected.svg">res/Images/PairingConnected.svg</file>
<file alias="PairingError.svg">res/Images/PairingError.svg</file>
<file alias="PairingIcon.svg">res/Images/PairingIcon.svg</file>
<file alias="thermal-brightness.svg">res/Images/thermal-brightness.svg</file>
<file alias="thermal-palette.svg">res/Images/thermal-palette.svg</file>
<file alias="thermal-pip.svg">res/Images/thermal-pip.svg</file>
<file alias="thermal-standard.svg">res/Images/thermal-standard.svg</file>
<file alias="vertical_speed.svg">res/Images/vertical_speed.svg</file>
<file alias="void.png">res/Images/void.png</file>
<file alias="CustomAppIcon.png">res/Images/CustomAppIcon.png</file>
</qresource>
<qresource prefix="/qmlimages">
<file alias="PaperPlane.svg">res/Images/CustomVehicleIcon.svg</file>
</qresource>
<qresource prefix="Custom/Widgets">
<file alias="Custom/Widgets/CustomArtificialHorizon.qml">res/Custom/Widgets/CustomArtificialHorizon.qml</file>
Expand All @@ -54,8 +31,4 @@
<file alias="Custom/Widgets/CustomVehicleButton.qml">res/Custom/Widgets/CustomVehicleButton.qml</file>
<file alias="Custom/Widgets/qmldir">res/Custom/Widgets/qmldir</file>
</qresource>
<qresource prefix="Custom/Camera">
<file alias="Custom/Camera/qmldir">res/Custom/Camera/qmldir</file>
<file alias="Custom/Camera/ZoomControl.qml">res/Custom/Camera/ZoomControl.qml</file>
</qresource>
</RCC>
2 changes: 2 additions & 0 deletions custom-example/qgcresources.exclusion
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
<file alias="PaperPlane.svg">src/ui/toolbar/Images/PaperPlane.svg</file>

103 changes: 103 additions & 0 deletions custom-example/qgcresources.qrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,103 @@
<RCC>
<qresource prefix="/fonts">
<file alias="opensans">../resources/fonts/OpenSans-Regular.ttf</file>
<file alias="opensans-demibold">../resources/fonts/OpenSans-Semibold.ttf</file>
<file alias="NanumGothic-Regular">../resources/fonts/NanumGothic-Regular.ttf</file>
<file alias="NanumGothic-Bold">../resources/fonts/NanumGothic-Bold.ttf</file>
</qresource>
<qresource prefix="/res">
<file alias="action.svg">../resources/action.svg</file>
<file alias="AntennaRC">../resources/Antenna_RC.svg</file>
<file alias="AntennaT">../resources/Antenna_T.svg</file>
<file alias="ArrowDown.svg">../resources/ArrowDown.svg</file>
<file alias="ArrowRight.svg">../resources/ArrowRight.svg</file>
<file alias="buttonLeft.svg">../resources/buttonLeft.svg</file>
<file alias="buttonRight.svg">../resources/buttonRight.svg</file>
<file alias="cancel.svg">../resources/cancel.svg</file>
<file alias="clockwise-arrow.svg">../resources/clockwise-arrow.svg</file>
<file alias="counter-clockwise-arrow.svg">../resources/counter-clockwise-arrow.svg</file>
<file alias="chevron-down.svg">../resources/chevron-down.svg</file>
<file alias="chevron-up.svg">../resources/chevron-up.svg</file>
<file alias="DropArrow.svg">../resources/DropArrow.svg</file>
<file alias="gear-black.svg">../resources/gear-black.svg</file>
<file alias="gear-white.svg">../resources/gear-white.svg</file>
<file alias="helicoptericon.svg">../resources/helicoptericon.svg</file>
<file alias="JoystickBezel.png">../resources/JoystickBezel.png</file>
<file alias="JoystickBezelLight.png">../resources/JoystickBezelLight.png</file>
<file alias="land.svg">../resources/land.svg</file>
<file alias="LockClosed.svg">../resources/LockClosed.svg</file>
<file alias="LockOpen.svg">../resources/LockOpen.svg</file>
<file alias="notile.png">../resources/notile.png</file>
<file alias="Pause.svg">../resources/Pause.svg</file>
<file alias="pause-mission.svg">../resources/pause-mission.svg</file>
<file alias="Play">../resources/Play.svg</file>
<file alias="PowerButton">../resources/PowerButton.svg</file>
<file alias="QGCLogoBlack">../resources/QGCLogoBlack.svg</file>
<file alias="QGCLogoFull">../resources/QGCLogoFull.svg</file>
<file alias="QGCLogoWhite">../resources/QGCLogoWhite.svg</file>
<file alias="QGCLogoArrow">../resources/QGCLogoArrow.svg</file>
<file alias="QGroundControlConnect">../resources/QGroundControlConnect.svg</file>
<file alias="rtl.svg">../resources/rtl.svg</file>
<file alias="SplashScreen">../resources/SplashScreen.png</file>
<file alias="Stop">../resources/Stop.svg</file>
<file alias="takeoff.svg">../resources/takeoff.svg</file>
<file alias="TrashDelete.svg">../resources/TrashDelete.svg</file>
<file alias="waves.svg">../resources/waves.svg</file>
<file alias="wind-guru.svg">../resources/wind-guru.svg</file>
<file alias="wind-rose.svg">../resources/wind-rose.svg</file>
<file alias="wind-roseBlack.svg">../resources/wind-roseBlack.svg</file>
<file alias="wind-rose-arrow.svg">../resources/wind-rose-arrow.svg</file>
<file alias="XDelete.svg">../resources/XDelete.svg</file>
<file alias="XDeleteBlack.svg">../resources/XDeleteBlack.svg</file>
<file alias="waypoint.svg">../resources/waypoint.svg</file>
<file>../resources/icons/qgroundcontrol.ico</file>
</qresource>
<qresource prefix="/res/firmware">
<file alias="3drradio.png">../resources/firmware/3drradio.png</file>
<file alias="apm.png">../resources/firmware/apm.png</file>
<file alias="px4.png">../resources/firmware/px4.png</file>
</qresource>
<qresource prefix="/res/calibration">
<file alias="accel_back.png">../resources/calibration/accel_back.png</file>
<file alias="accel_down.png">../resources/calibration/accel_down.png</file>
<file alias="accel_front.png">../resources/calibration/accel_front.png</file>
<file alias="accel_left.png">../resources/calibration/accel_left.png</file>
<file alias="accel_right.png">../resources/calibration/accel_right.png</file>
<file alias="accel_up.png">../resources/calibration/accel_up.png</file>
</qresource>
<qresource prefix="/qml/calibration/mode1">
<file alias="radioCenter.png">../resources/calibration/mode1/radioCenter.png</file>
<file alias="radioHome.png">../resources/calibration/mode1/radioHome.png</file>
<file alias="radioPitchDown.png">../resources/calibration/mode1/radioPitchDown.png</file>
<file alias="radioPitchUp.png">../resources/calibration/mode1/radioPitchUp.png</file>
<file alias="radioRollLeft.png">../resources/calibration/mode1/radioRollLeft.png</file>
<file alias="radioRollRight.png">../resources/calibration/mode1/radioRollRight.png</file>
<file alias="radioSwitchMinMax.png">../resources/calibration/mode1/radioSwitchMinMax.png</file>
<file alias="radioThrottleDown.png">../resources/calibration/mode1/radioThrottleDown.png</file>
<file alias="radioThrottleUp.png">../resources/calibration/mode1/radioThrottleUp.png</file>
<file alias="radioYawLeft.png">../resources/calibration/mode1/radioYawLeft.png</file>
<file alias="radioYawRight.png">../resources/calibration/mode1/radioYawRight.png</file>
</qresource>
<qresource prefix="/qml/calibration/mode2">
<file alias="radioCenter.png">../resources/calibration/mode2/radioCenter.png</file>
<file alias="radioHome.png">../resources/calibration/mode2/radioHome.png</file>
<file alias="radioPitchDown.png">../resources/calibration/mode2/radioPitchDown.png</file>
<file alias="radioPitchUp.png">../resources/calibration/mode2/radioPitchUp.png</file>
<file alias="radioRollLeft.png">../resources/calibration/mode2/radioRollLeft.png</file>
<file alias="radioRollRight.png">../resources/calibration/mode2/radioRollRight.png</file>
<file alias="radioSwitchMinMax.png">../resources/calibration/mode2/radioSwitchMinMax.png</file>
<file alias="radioThrottleDown.png">../resources/calibration/mode2/radioThrottleDown.png</file>
<file alias="radioThrottleUp.png">../resources/calibration/mode2/radioThrottleUp.png</file>
<file alias="radioYawLeft.png">../resources/calibration/mode2/radioYawLeft.png</file>
<file alias="radioYawRight.png">../resources/calibration/mode2/radioYawRight.png</file>
</qresource>
<qresource prefix="/db/mapping/joystick">
<file alias="gamecontrollerdb.txt">../resources/SDL_GameControllerDB/gamecontrollerdb.txt</file>
</qresource>
<qresource prefix="/res/audio">
<file alias="Alert">../resources/audio/alert.wav</file>
</qresource>
<qresource prefix="/opengl">
<file>../resources/opengl/buglist.json</file>
</qresource>
</RCC>
Empty file.
Loading

0 comments on commit d68e558

Please sign in to comment.