├── .github └── workflows │ ├── appimage.yml │ └── doc.yml ├── .gitignore ├── .gitmodules ├── CHANGELOG.md ├── CMakeLists.txt ├── Readme.md ├── appimage-amd64.yml ├── assets ├── 128-apps-pprzgcs.png ├── 16-apps-pprzgcs.png ├── 32-apps-pprzgcs.png ├── 48-apps-pprzgcs.png ├── 64-apps-pprzgcs.png ├── CMakeLists.txt ├── org.paparazzi.pprzgcs.appdata.xml.in ├── org.paparazzi.pprzgcs.desktop └── pprzgcs.svg ├── build.sh ├── build_deb.sh ├── data ├── default_layout.xml ├── default_style.qss ├── fp_editor_layout.xml ├── gvf_layout.xml ├── pictures │ ├── aircraft_icons │ │ ├── fixedwing.svg │ │ ├── flyingwing.svg │ │ ├── quadrotor_x.svg │ │ ├── rotorcraft.svg │ │ └── rover.svg │ ├── chat.svg │ ├── checklist.svg │ ├── flight_plan.svg │ ├── gps.svg │ ├── gvf.svg │ ├── icon.svg │ ├── link.png │ ├── link_nok.svg │ ├── link_ok.svg │ ├── map_layers_hover.svg │ ├── map_layers_normal.svg │ ├── map_layers_pressed.svg │ ├── map_thumbnails │ │ ├── DroneRestrict.png │ │ ├── Google Hybrid.png │ │ ├── Google.png │ │ ├── Hiking.png │ │ ├── ICAO.png │ │ ├── OpenStreetMap.png │ │ └── default.png │ ├── nav.svg │ ├── pfd.svg │ ├── plotter.svg │ └── settings.svg └── tile_sources.xml ├── debian ├── Readme.md ├── changelog ├── compat ├── control └── rules ├── docs ├── Makefile ├── requirements.txt └── source │ ├── conf.py │ ├── developer_guide │ ├── aircraft.rst │ ├── concepts.rst │ ├── how_to_build.rst │ ├── index_developer.rst │ ├── map.rst │ ├── pprzapplication.rst │ ├── settings.rst │ └── widgets.rst │ ├── icon.svg │ ├── index.rst │ └── user_guide │ ├── PFD.png │ ├── commands.png │ ├── flightplan_blocks.png │ ├── flightplan_details.png │ ├── index_user.rst │ ├── layout.rst │ ├── layout_example.png │ ├── map2d_configure.png │ ├── map_tile_sources.rst │ ├── plotter.png │ ├── settings.png │ ├── strip.png │ └── widgets.rst ├── examples ├── cpp │ ├── CMakeLists.txt │ ├── Readme.md │ └── greeter_client.cpp └── grpc_example.py ├── pprzgcs_version.sh ├── protos ├── CMakeLists.txt └── pprzgcs.proto ├── resources ├── pictures │ ├── agl.svg │ ├── airspeed.svg │ ├── bat_catastrophic.svg │ ├── bat_critic.svg │ ├── bat_low.svg │ ├── bat_ok.svg │ ├── block_time.svg │ ├── cursor_circle_black.svg │ ├── cursor_path_black.svg │ ├── cursor_waypoint_black.svg │ ├── displayed.svg │ ├── flight_time.svg │ ├── gps_nok.svg │ ├── gps_ok.svg │ ├── green_led.svg │ ├── ground_speed.svg │ ├── hidden.svg │ ├── icon.svg │ ├── imu_nok.svg │ ├── imu_ok.svg │ ├── link.png │ ├── link_nok.svg │ ├── link_ok.svg │ ├── link_warning.svg │ ├── lock.svg │ ├── lock_dark.svg │ ├── lock_warning.svg │ ├── map_layers_hover.svg │ ├── map_layers_normal.svg │ ├── map_layers_pressed.svg │ ├── msl.svg │ ├── no_ac.svg │ ├── pfd_aircraft_pitch.svg │ ├── pfd_aircraft_pitch_rotorcraft.svg │ ├── pfd_aircraft_roll.svg │ ├── pfd_aircraft_roll_rotorcraft.svg │ ├── pfd_aircraft_yaw.svg │ ├── pfd_aircraft_yaw_rotorcraft.svg │ ├── pfd_rover_pitch.svg │ ├── pfd_rover_roll.svg │ ├── pfd_rover_yaw.svg │ ├── rc_nok.svg │ ├── rc_ok.svg │ ├── red_led.svg │ ├── settings.svg │ ├── stage_time.svg │ ├── throttle_killed.svg │ ├── throttle_on.svg │ ├── unlocked.svg │ ├── vertical_speed.svg │ ├── wind_rose.svg │ ├── windsock.svg │ └── windsock_no_wind.svg └── ressources.qrc ├── screenshots └── screenshot.png └── src ├── CMakeLists.txt ├── PprzApplication.cpp ├── PprzApplication.h ├── PprzToolbox.cpp ├── PprzToolbox.h ├── app_settings.cpp ├── app_settings.h ├── common ├── CMakeLists.txt ├── aircraft.cpp ├── aircraft.h ├── aircraft_status.cpp ├── aircraft_status.h ├── aircraft_watcher.cpp ├── aircraft_watcher.h ├── airframe.cpp ├── airframe.h ├── block.cpp ├── block.h ├── configurable.h ├── flightplan.cpp ├── flightplan.h ├── gcs_utils.cpp ├── gcs_utils.h ├── pprzpalette.cpp ├── pprzpalette.h ├── sector.cpp ├── sector.h ├── setting.cpp ├── setting.h ├── setting_menu.cpp ├── setting_menu.h ├── tuple_helpers.h ├── waypoint.cpp └── waypoint.h ├── configurator.cpp ├── configurator.h ├── geometry ├── CMakeLists.txt ├── point2dlatlon.cpp ├── point2dlatlon.h ├── point2dpseudomercator.cpp ├── point2dpseudomercator.h ├── point2dtile.cpp └── point2dtile.h ├── globalconfig.cpp ├── globalconfig.h ├── main.cpp ├── pprzmain.cpp ├── pprzmain.h ├── pprzmain.ui ├── tools ├── AircraftManager.cpp ├── AircraftManager.h ├── CMakeLists.txt ├── coordinatestransform.cpp ├── coordinatestransform.h ├── dispatcher_ui.cpp ├── dispatcher_ui.h ├── grpcconnector.cpp ├── grpcconnector.h ├── pprz_dispatcher.cpp ├── pprz_dispatcher.h ├── speaker.cpp ├── speaker.h ├── srtm_manager.cpp ├── srtm_manager.h ├── units.cpp ├── units.h ├── watcher.cpp └── watcher.h ├── uisignals.h ├── utils.h └── widgets ├── CMakeLists.txt ├── ac_selector.cpp ├── ac_selector.h ├── basics ├── CMakeLists.txt ├── chatbubble.cpp ├── chatbubble.h ├── chatbubble.ui ├── colorbar.cpp ├── colorbar.h ├── colorlabel.cpp ├── colorlabel.h ├── double_slider.cpp ├── double_slider.h ├── flowlayout.cpp ├── flowlayout.h ├── graphlabel.cpp ├── graphlabel.h ├── graphwidget.cpp ├── graphwidget.h ├── imagebutton.cpp ├── imagebutton.h ├── jaugelabel.cpp ├── jaugelabel.h ├── lock_button.cpp ├── lock_button.h ├── mbpushbutton.cpp ├── mbpushbutton.h ├── switch.cpp └── switch.h ├── chat.cpp ├── chat.h ├── chat.ui ├── checklist.cpp ├── checklist.h ├── checklist.ui ├── commands.cpp ├── commands.h ├── flightplan_viewerv2.cpp ├── flightplan_viewerv2.h ├── flightplaneditor.cpp ├── flightplaneditor.h ├── flightplaneditor.ui ├── gps_classic_viewer.cpp ├── gps_classic_viewer.h ├── gvf_viewer.cpp ├── gvf_viewer.h ├── layer_combo.cpp ├── layer_combo.h ├── link_status.cpp ├── link_status.h ├── listcontainer.cpp ├── listcontainer.h ├── map ├── CMakeLists.txt ├── acitemmanager.cpp ├── acitemmanager.h ├── fpedit_statemachines │ ├── CMakeLists.txt │ ├── circleitem_sm.cpp │ ├── circleitem_sm.h │ ├── item_edit_state_machine.cpp │ ├── item_edit_state_machine.h │ ├── pathitem_sm.cpp │ ├── pathitem_sm.h │ ├── waypointitem_sm.cpp │ └── waypointitem_sm.h ├── graphics_objects │ ├── CMakeLists.txt │ ├── graphics_aircraft.cpp │ ├── graphics_aircraft.h │ ├── graphics_circle.cpp │ ├── graphics_circle.h │ ├── graphics_group.cpp │ ├── graphics_group.h │ ├── graphics_icon.cpp │ ├── graphics_icon.h │ ├── graphics_intruder.cpp │ ├── graphics_intruder.h │ ├── graphics_line.cpp │ ├── graphics_line.h │ ├── graphics_object.cpp │ ├── graphics_object.h │ ├── graphics_point.cpp │ ├── graphics_point.h │ ├── graphics_quiver.cpp │ ├── graphics_quiver.h │ ├── graphics_text.cpp │ └── graphics_text.h ├── gvf_trajectories │ ├── CMakeLists.txt │ ├── gvf_traj_3D_ellipse.cpp │ ├── gvf_traj_3D_ellipse.h │ ├── gvf_traj_3D_lissajous.cpp │ ├── gvf_traj_3D_lissajous.h │ ├── gvf_traj_bezier.cpp │ ├── gvf_traj_bezier.h │ ├── gvf_traj_ellipse.cpp │ ├── gvf_traj_ellipse.h │ ├── gvf_traj_line.cpp │ ├── gvf_traj_line.h │ ├── gvf_traj_sin.cpp │ ├── gvf_traj_sin.h │ ├── gvf_traj_trefoil.cpp │ ├── gvf_traj_trefoil.h │ ├── gvf_trajectory.cpp │ └── gvf_trajectory.h ├── map2d.cpp ├── map2d.h ├── map_items │ ├── CMakeLists.txt │ ├── aircraft_item.cpp │ ├── aircraft_item.h │ ├── arrow_item.cpp │ ├── arrow_item.h │ ├── circle_item.cpp │ ├── circle_item.h │ ├── intruder_item.cpp │ ├── intruder_item.h │ ├── map_item.cpp │ ├── map_item.h │ ├── path_item.cpp │ ├── path_item.h │ ├── quiver_item.cpp │ ├── quiver_item.h │ ├── waypoint_item.cpp │ └── waypoint_item.h ├── maplayercontrol.cpp ├── maplayercontrol.h ├── mapscene.cpp ├── mapscene.h ├── maputils.cpp ├── maputils.h ├── mapwidget.cpp ├── mapwidget.h ├── papget.cpp ├── papget.h ├── papgetconfig.cpp ├── papgetconfig.h ├── tileitem.cpp ├── tileitem.h ├── tileprovider.cpp ├── tileprovider.h ├── tileproviderconfig.cpp ├── tileproviderconfig.h ├── waypointeditor.cpp └── waypointeditor.h ├── mini_strip.cpp ├── mini_strip.h ├── pfd.cpp ├── pfd.h ├── plotter.cpp ├── plotter.h ├── pprzmap.cpp ├── pprzmap.h ├── pprzmap.ui ├── settings_viewer.cpp ├── settings_viewer.h ├── stackcontainer.cpp ├── stackcontainer.h ├── strip.cpp ├── strip.h ├── widget_utils.cpp ├── widget_utils.h ├── windindicator.cpp └── windindicator.h /.github/workflows/doc.yml: -------------------------------------------------------------------------------- 1 | name: Doc 2 | 3 | on: 4 | push: 5 | branches: 6 | - 'master' 7 | paths: 8 | - 'docs/**' 9 | 10 | jobs: 11 | # This workflow contains a single job called "build" 12 | build: 13 | # The type of runner that the job will run on 14 | runs-on: ubuntu-latest 15 | 16 | # Steps represent a sequence of tasks that will be executed as part of the job 17 | steps: 18 | # Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it 19 | - name: checkout 20 | uses: actions/checkout@v2 21 | 22 | - name: build sphinx doc 23 | uses: ammaraskar/sphinx-action@master 24 | with: 25 | build-command: "make html" 26 | docs-folder: "docs" 27 | 28 | - name: Check files 29 | run: ls docs/build 30 | 31 | 32 | - name: Commit documentation changes 33 | run: | 34 | git clone https://github.com/$GITHUB_REPOSITORY.git --branch gh-pages --single-branch gh-pages 35 | rm -r gh-pages/* 36 | cp -r docs/build/html/* gh-pages/ 37 | cd gh-pages 38 | git config --local user.email "action@github.com" 39 | git config --local user.name "GitHub Action" 40 | git add . 41 | git commit -m "Update PprzGCS doc" -a || true 42 | # The above command will fail if no changes were present, so we ignore 43 | # the return code. 44 | - name: Push changes 45 | uses: ad-m/github-push-action@master 46 | with: 47 | branch: gh-pages 48 | directory: gh-pages 49 | github_token: ${{ secrets.GITHUB_TOKEN }} 50 | #force: true 51 | 52 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | # This file is used to ignore files which are generated 2 | # ---------------------------------------------------------------------------- 3 | 4 | *~ 5 | *.autosave 6 | *.a 7 | *.core 8 | *.moc 9 | *.o 10 | *.obj 11 | *.orig 12 | *.rej 13 | *.so 14 | *.so.* 15 | *_pch.h.cpp 16 | *_resource.rc 17 | *.qm 18 | .#* 19 | *.*# 20 | core 21 | !core/ 22 | tags 23 | .DS_Store 24 | .directory 25 | *.debug 26 | Makefile* 27 | *.prl 28 | *.app 29 | moc_*.cpp 30 | ui_*.h 31 | qrc_*.cpp 32 | Thumbs.db 33 | *.res 34 | *.rc 35 | /.qmake.cache 36 | /.qmake.stash 37 | 38 | # qtcreator generated files 39 | *.pro.user* 40 | 41 | # xemacs temporary files 42 | *.flc 43 | 44 | # Vim temporary files 45 | .*.swp 46 | 47 | # Visual Studio generated files 48 | *.ib_pdb_index 49 | *.idb 50 | *.ilk 51 | *.pdb 52 | *.sln 53 | *.suo 54 | *.vcproj 55 | *vcproj.*.*.user 56 | *.ncb 57 | *.sdf 58 | *.opensdf 59 | *.vcxproj 60 | *vcxproj.* 61 | 62 | # MinGW generated files 63 | *.Debug 64 | *.Release 65 | 66 | # Python byte code 67 | *.pyc 68 | 69 | # Binaries 70 | # -------- 71 | *.dll 72 | *.exe 73 | 74 | # build directory for manual build 75 | build/ 76 | 77 | -------------------------------------------------------------------------------- /.gitmodules: -------------------------------------------------------------------------------- 1 | [submodule "ext/pprzlinkQt"] 2 | path = ext/pprzlinkQt 3 | url = https://github.com/Fabien-B/pprzlinkQt.git 4 | [submodule "ext/IvyQt"] 5 | path = ext/IvyQt 6 | url = https://gitlab.com/ivybus/IvyQt.git 7 | -------------------------------------------------------------------------------- /assets/128-apps-pprzgcs.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/paparazzi/PprzGCS/df4be571069813f7619b92959421e756378c9432/assets/128-apps-pprzgcs.png -------------------------------------------------------------------------------- /assets/16-apps-pprzgcs.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/paparazzi/PprzGCS/df4be571069813f7619b92959421e756378c9432/assets/16-apps-pprzgcs.png -------------------------------------------------------------------------------- /assets/32-apps-pprzgcs.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/paparazzi/PprzGCS/df4be571069813f7619b92959421e756378c9432/assets/32-apps-pprzgcs.png -------------------------------------------------------------------------------- /assets/48-apps-pprzgcs.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/paparazzi/PprzGCS/df4be571069813f7619b92959421e756378c9432/assets/48-apps-pprzgcs.png -------------------------------------------------------------------------------- /assets/64-apps-pprzgcs.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/paparazzi/PprzGCS/df4be571069813f7619b92959421e756378c9432/assets/64-apps-pprzgcs.png -------------------------------------------------------------------------------- /assets/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | 2 | find_package(ECM 1.0.0 REQUIRED NO_MODULE) 3 | set(CMAKE_MODULE_PATH ${ECM_MODULE_PATH}) 4 | include(ECMInstallIcons) 5 | include(KDEInstallDirs) 6 | 7 | ecm_install_icons( 8 | ICONS 9 | 16-apps-pprzgcs.png 10 | 32-apps-pprzgcs.png 11 | 48-apps-pprzgcs.png 12 | 64-apps-pprzgcs.png 13 | 128-apps-pprzgcs.png 14 | 15 | THEME 16 | hicolor 17 | 18 | DESTINATION 19 | ${KDE_INSTALL_ICONDIR} 20 | ) 21 | 22 | configure_file( 23 | org.paparazzi.pprzgcs.appdata.xml.in 24 | org.paparazzi.pprzgcs.appdata.xml 25 | ) 26 | 27 | install(FILES ${CMAKE_BINARY_DIR}/assets/org.paparazzi.pprzgcs.appdata.xml 28 | DESTINATION ${KDE_INSTALL_METAINFODIR} 29 | ) 30 | 31 | 32 | install(FILES pprzgcs.svg 33 | DESTINATION ${KDE_INSTALL_FULL_ICONDIR}/hicolor/scalable/apps 34 | ) 35 | 36 | 37 | install(FILES "org.paparazzi.pprzgcs.desktop" 38 | DESTINATION ${KDE_INSTALL_APPDIR} 39 | ) 40 | 41 | -------------------------------------------------------------------------------- /assets/org.paparazzi.pprzgcs.appdata.xml.in: -------------------------------------------------------------------------------- 1 | 2 | 3 | org.paparazzi.pprzgcs 4 | CC0-1.0 5 | PprzGCS 6 | Paparazzi UAV GCS 7 | org.paparazzi.pprzgcs.desktop 8 | 9 | Paparazzi UAV 10 | 11 | pprzgcs 12 | 13 | 14 | 15 | 16 | 17 | GPL-3.0-or-later 18 | 19 | PprzGCS is a ground control station for Paparazzi UAV. 20 | 21 | 22 | Science 23 | 24 | https://docs.paparazziuav.org/PprzGCS/ 25 | https://github.com/paparazzi/PprzGCS/issues 26 | https://docs.paparazziuav.org/PprzGCS/ 27 | 28 | 29 | -------------------------------------------------------------------------------- /assets/org.paparazzi.pprzgcs.desktop: -------------------------------------------------------------------------------- 1 | [Desktop Entry] 2 | Name=PprzGCS 3 | Comment=GCS for PaparazziUAV 4 | Exec=/usr/bin/pprzgcs 5 | Terminal=false 6 | Type=Application 7 | Icon=pprzgcs 8 | StartupNotify=true 9 | Categories=Robotics;Science;Qt; 10 | 11 | -------------------------------------------------------------------------------- /build.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | WD="${WD:-$(pwd)}" 4 | build_libs="${1:-false}" 5 | 6 | # try getting 2nd argument, then the first one 7 | build_app="${2:-$1}" 8 | build_app="${build_app:-false}" 9 | 10 | install_prefix="${install_prefix:-$WD/build/install}" 11 | 12 | echo "install_prefix set to $install_prefix." 13 | 14 | # exit on error 15 | set -e 16 | 17 | #export QT_DIR="/path/to/Qt/5.12.5/gcc_64/lib/cmake/Qt5" 18 | 19 | export MAKEFLAGS=-j$(nproc) 20 | 21 | if [ $build_libs = "libs" ] 22 | then 23 | ivyqt_src=$WD/ext/IvyQt 24 | ivyqt_build=$WD/build/ext/IvyQt 25 | 26 | pprzlinkqt_src=$WD/ext/pprzlinkQt/ 27 | pprzlinkqt_build=$WD/build/ext/pprzlinkQt 28 | 29 | cmake -S $ivyqt_src -B $ivyqt_build -DCMAKE_BUILD_TYPE=Debug -DCMAKE_INSTALL_PREFIX=$install_prefix 30 | cmake --build $ivyqt_build 31 | cmake --install $ivyqt_build 32 | 33 | cmake -S $pprzlinkqt_src -B $pprzlinkqt_build -DCMAKE_BUILD_TYPE=Debug -DCMAKE_INSTALL_PREFIX=$install_prefix 34 | cmake --build $pprzlinkqt_build 35 | cmake --install $pprzlinkqt_build 36 | fi 37 | 38 | if [ $build_app = "app" ] 39 | then 40 | cmake -S . -B $WD/build/pprzgcs -DCMAKE_INSTALL_PREFIX="$install_prefix" -DDEFAULT_APP_DATA_PATH="$WD/data" -DCMAKE_BUILD_TYPE=RelWithDebInfo 41 | cmake --build $WD/build/pprzgcs 42 | fi 43 | 44 | -------------------------------------------------------------------------------- /build_deb.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | if [ -z ${1} ]; 4 | then 5 | echo "Usage: ./build_deb.sh " 6 | exit 1 7 | fi 8 | 9 | version=$(echo $1 | sed 's/.*v\(.*\)/\1/g') 10 | 11 | 12 | WD="${WD:-$(pwd)}" 13 | 14 | install_prefix=$WD/build/install 15 | 16 | debian=$WD/misc/debian/pprzgcs 17 | deb_install_prefix=$debian/usr/local 18 | 19 | 20 | echo "install_prefix set to $install_prefix." 21 | 22 | # exit on error 23 | set -e 24 | 25 | 26 | ivyqt_src=$WD/ext/IvyQt 27 | ivyqt_build=$WD/build/IvyQt 28 | 29 | pprzlinkqt_src=$WD/ext/pprzlinkQt/ 30 | pprzlinkqt_build=$WD/build/ext/pprzlinkQt 31 | 32 | cmake -S $ivyqt_src -B $ivyqt_build -DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_PREFIX=$install_prefix 33 | cmake --build $ivyqt_build 34 | cmake --install $ivyqt_build 35 | 36 | cmake -S $pprzlinkqt_src -B $pprzlinkqt_build -DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_PREFIX=$install_prefix 37 | cmake --build $pprzlinkqt_build 38 | cmake --install $pprzlinkqt_build 39 | 40 | cmake -S . -B $WD/build/pprzgcs -DCMAKE_INSTALL_PREFIX=$deb_install_prefix -DCMAKE_PREFIX_PATH=$install_prefix -DCMAKE_BUILD_TYPE=Release -DPPRZGCS_VERSION=$(git describe --tags) 41 | cmake --build $WD/build/pprzgcs 42 | cmake --install $WD/build/pprzgcs 43 | 44 | strip --strip-unneeded $deb_install_prefix/bin/pprzgcs 45 | 46 | # Add changelog 47 | cp $WD/CHANGELOG.md changelog.Debian 48 | gzip changelog.Debian 49 | mv changelog.Debian.gz $deb_install_prefix/share/doc/pprzgcs/ 50 | 51 | # set correct version 52 | echo "Setting version to $version" 53 | sed -i "s/__VERSION__/$version/g" $debian/DEBIAN/control 54 | 55 | # set correct size 56 | size=$(du -s $debian/usr/ | cut -f 1) 57 | echo "Setting installed size to $size" 58 | sed -i "s/__SIZE__/$size/g" $debian/DEBIAN/control 59 | 60 | dpkg-deb --root-owner-group --build misc/debian/pprzgcs 61 | 62 | 63 | -------------------------------------------------------------------------------- /data/default_layout.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | -------------------------------------------------------------------------------- /data/default_style.qss: -------------------------------------------------------------------------------- 1 | 2 | /* Buttons on the map */ 3 | LockButton { 4 | qproperty-color_idle: #b0252525; 5 | qproperty-color_hover: #b0404040; 6 | qproperty-color_pressed: #b0000000; 7 | qproperty-size: 80; 8 | } 9 | 10 | WindIndicator { 11 | qproperty-arrow_color: #ff0000; 12 | qproperty-pen_color: #000000; 13 | qproperty-background_color: #6046d0ff; 14 | qproperty-size: 100; 15 | } 16 | 17 | MiniStrip { 18 | qproperty-size: 30; 19 | } 20 | 21 | MapWidget { 22 | qproperty-color_background: #404040; 23 | qproperty-ac_arrow_size: 50; 24 | qproperty-show_hidden_waypoints: false; 25 | } 26 | 27 | -------------------------------------------------------------------------------- /data/fp_editor_layout.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | -------------------------------------------------------------------------------- /data/gvf_layout.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | -------------------------------------------------------------------------------- /data/pictures/link.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/paparazzi/PprzGCS/df4be571069813f7619b92959421e756378c9432/data/pictures/link.png -------------------------------------------------------------------------------- /data/pictures/map_thumbnails/DroneRestrict.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/paparazzi/PprzGCS/df4be571069813f7619b92959421e756378c9432/data/pictures/map_thumbnails/DroneRestrict.png -------------------------------------------------------------------------------- /data/pictures/map_thumbnails/Google Hybrid.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/paparazzi/PprzGCS/df4be571069813f7619b92959421e756378c9432/data/pictures/map_thumbnails/Google Hybrid.png -------------------------------------------------------------------------------- /data/pictures/map_thumbnails/Google.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/paparazzi/PprzGCS/df4be571069813f7619b92959421e756378c9432/data/pictures/map_thumbnails/Google.png -------------------------------------------------------------------------------- /data/pictures/map_thumbnails/Hiking.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/paparazzi/PprzGCS/df4be571069813f7619b92959421e756378c9432/data/pictures/map_thumbnails/Hiking.png -------------------------------------------------------------------------------- /data/pictures/map_thumbnails/ICAO.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/paparazzi/PprzGCS/df4be571069813f7619b92959421e756378c9432/data/pictures/map_thumbnails/ICAO.png -------------------------------------------------------------------------------- /data/pictures/map_thumbnails/OpenStreetMap.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/paparazzi/PprzGCS/df4be571069813f7619b92959421e756378c9432/data/pictures/map_thumbnails/OpenStreetMap.png -------------------------------------------------------------------------------- /data/pictures/map_thumbnails/default.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/paparazzi/PprzGCS/df4be571069813f7619b92959421e756378c9432/data/pictures/map_thumbnails/default.png -------------------------------------------------------------------------------- /data/pictures/nav.svg: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /data/pictures/settings.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | -------------------------------------------------------------------------------- /data/tile_sources.xml: -------------------------------------------------------------------------------- 1 | 2 | 9 | 16 | 23 | 30 | 38 | 46 | 53 | 60 | 61 | 62 | -------------------------------------------------------------------------------- /debian/Readme.md: -------------------------------------------------------------------------------- 1 | 2 | How to make a new release 3 | ========================= 4 | 5 | 1. Update `debian/changelog` with: `$ dch`. Makes sure the author name and email matches one of your gpg keys (get the list with `gpg --list-secret-keys`). 6 | 2. Update `pprzgcs_version.sh` with the correct DEFAULT_VERSION. (TODO: use version from debian/changelog) 7 | 3. Commit your changes and tag the commit. 8 | 4. `git ls-files --recurse-submodules | tar -cvf pprzgcs.tar -T -` 9 | 5. `mkdir ../pprzgcs_release && src=$(pwd) && cd ../pprzgcs_release` 10 | 6. `tar -xvf "$src/pprzgcs.tar"` 11 | 7. Install dependencies: `sudo apt install ivy-qt-dev` 12 | 8. `debuild -S` 13 | 9. `dput ppa:paparazzi-uav/ppa ` 14 | 10. Update changelog minor version number and distribution name in the release directory to build for other distributions, and restart from step 8. Do not commit those changes. 15 | 16 | 17 | 18 | Building with pbuilder-dist 19 | =========================== 20 | pbuilder-dist is a wrapper that makes it easy to use pbuilder with many 21 | different versions of Ubuntu and/or Debian. 22 | 23 | Setup pbuilder-dist 24 | ------------------- 25 | - Create the pbuilder environment for your desired distributions and architectures, e.g.: 26 | 27 | pbuilder-dist focal create 28 | 29 | - To update a pbuilder environment: 30 | 31 | pbuilder-dist focal update --override-config --release-only 32 | 33 | Build the debian package 34 | ------------------------ 35 | See the respective package directory on how the get the source. 36 | 37 | - First build a source package if not already available: 38 | 39 | cd package 40 | debuild -S 41 | 42 | - Build the binary package from the source package: 43 | 44 | pbuilder-dist focal build ../.dsc 45 | 46 | You will find the finished packages in ~/pbuilder/ 47 | 48 | 49 | -------------------------------------------------------------------------------- /debian/compat: -------------------------------------------------------------------------------- 1 | 9 2 | -------------------------------------------------------------------------------- /debian/control: -------------------------------------------------------------------------------- 1 | Source: pprzgcs 2 | Maintainer: Fabien Bonneval 3 | Section: devel 4 | Priority: optional 5 | Build-Depends: debhelper (>= 8.0.0), cmake, git, libsqlite3-dev, libzip-dev, qtbase5-dev, libqt5svg5-dev, libqt5texttospeech5-dev, libproj-dev, mesa-common-dev, libglu1-mesa-dev, libxml2-dev, ivy-qt-dev, extra-cmake-modules 6 | Standards-Version: 4.0.0 7 | Homepage: https://paparazzi.github.io/PprzGCS/ 8 | Vcs-Git: https://github.com/paparazzi/PprzGCS 9 | Rules-Requires-Root: binary-targets 10 | 11 | 12 | Package: pprzgcs 13 | Architecture: any 14 | Section: devel 15 | Priority: optional 16 | Depends: ${shlibs:Depends}, ${misc:Depends}, ivy-qt, appmenu-gtk3-module 17 | Homepage: https://paparazzi.github.io/PprzGCS/ 18 | Description: Ground Control Station for PaparazziUAV 19 | 20 | -------------------------------------------------------------------------------- /debian/rules: -------------------------------------------------------------------------------- 1 | #!/usr/bin/make -f 2 | # -*- makefile -*- 3 | 4 | pprzlinkqt_src=ext/pprzlinkQt/ 5 | pprzlinkqt_build=build/ext/pprzlinkQt 6 | install_prefix=build/install 7 | #export MAKEFLAGS=-j$(nproc) 8 | prefix = /usr 9 | DESTDIR=debian/pprzgcs 10 | 11 | %: 12 | dh $@ 13 | 14 | override_dh_auto_configure: 15 | cmake -S $(pprzlinkqt_src) -B $(pprzlinkqt_build) -DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_PREFIX=$(install_prefix) 16 | cmake --build $(pprzlinkqt_build) 17 | cmake --install $(pprzlinkqt_build) 18 | cmake -S . -B build/pprzgcs -DCMAKE_INSTALL_PREFIX=$(DESTDIR)$(prefix) -DCMAKE_PREFIX_PATH=$(install_prefix) -DCMAKE_BUILD_TYPE=RelWithDebInfo 19 | 20 | override_dh_auto_build: 21 | 22 | cmake --build build/pprzgcs 23 | 24 | override_dh_auto_install: 25 | cmake --install build/pprzgcs 26 | 27 | -------------------------------------------------------------------------------- /docs/Makefile: -------------------------------------------------------------------------------- 1 | # Minimal makefile for Sphinx documentation 2 | # 3 | 4 | # You can set these variables from the command line. 5 | SPHINXOPTS = 6 | SPHINXBUILD = sphinx-build 7 | SPHINXPROJ = PprzGCS 8 | SOURCEDIR = source 9 | BUILDDIR = build 10 | 11 | # Put it first so that "make" without argument is like "make help". 12 | help: 13 | @$(SPHINXBUILD) -M help "$(SOURCEDIR)" "$(BUILDDIR)" $(SPHINXOPTS) $(O) 14 | 15 | .PHONY: help Makefile 16 | 17 | # Catch-all target: route all unknown targets to Sphinx using the new 18 | # "make mode" option. $(O) is meant as a shortcut for $(SPHINXOPTS). 19 | %: Makefile 20 | @$(SPHINXBUILD) -M $@ "$(SOURCEDIR)" "$(BUILDDIR)" $(SPHINXOPTS) $(O) 21 | 22 | -------------------------------------------------------------------------------- /docs/requirements.txt: -------------------------------------------------------------------------------- 1 | sphinx_rtd_theme 2 | 3 | -------------------------------------------------------------------------------- /docs/source/developer_guide/aircraft.rst: -------------------------------------------------------------------------------- 1 | .. developer_guide aircraft 2 | 3 | Aircrafts 4 | ========= 5 | 6 | AircraftManager 7 | --------------- 8 | 9 | Aircrafts are uniquely identified by their ID. 10 | 11 | Get an aircraft with the ``Aircraft* AircraftManager::getAircraft(QString id)`` method. 12 | 13 | .. _aircraft: 14 | 15 | Aircraft 16 | -------- 17 | 18 | The ``Aircraft`` class is central in PprzGCS. It holds all the data relative to a given aircraft: 19 | 20 | + AC ID 21 | + name 22 | + flight plan 23 | + airframe 24 | + settings 25 | + position 26 | + status 27 | + config 28 | 29 | 30 | 31 | Status 32 | ------ 33 | 34 | Get the status with the ``Aircraft::getStatus()`` method. 35 | 36 | The ``AircraftStatus`` class store some of the most used aircraft's messages: 37 | 38 | + AP_STATUS 39 | + NAV_STATUS 40 | + CIRCLE_STATUS 41 | + SEGMENT_STATUS 42 | + ENGINE_STATUS 43 | + DL_VALUES 44 | + TELEMETRY_STATUS 45 | + FLY_BY_WIRE 46 | + FLIGHT_PARAM 47 | + SVSINFO 48 | 49 | Use the ``getMessage(QString name)`` method to get the last received message. 50 | 51 | This class also emit a signal for each of the above messages when a new one is received. 52 | 53 | 54 | -------------------------------------------------------------------------------- /docs/source/developer_guide/concepts.rst: -------------------------------------------------------------------------------- 1 | .. developer_guide concepts 2 | 3 | Arborescence 4 | ============ 5 | 6 | Root directory 7 | -------------- 8 | 9 | The essential directories are these ones : 10 | 11 | .. code-block:: 12 | 13 | PprzGCS 14 | ├── data 15 | ├── docs 16 | ├── ext 17 | ├── resources 18 | └── src 19 | 20 | + ``data`` holds all customizable resources. It will usually be installed in ``/usr/share/pprzgcs``. 21 | Files in this directory are overridden by files with similar path in user's directory ``$HOME/.local/share/pprzgcs`` (See AppDataLocation `QStandardPaths `_). 22 | + ``docs`` contains the documentation consultable at `https://docs.paparazziuav.org/PprzGCS/ `_. 23 | + ``ext`` contains external dependencies 24 | + ``resources`` holds static resources. PprzGCS must be rebuild when changes are made in this directory. 25 | + ``src`` contains all the source code. 26 | 27 | 28 | Sources 29 | ------- 30 | 31 | 32 | 33 | 34 | -------------------------------------------------------------------------------- /docs/source/developer_guide/index_developer.rst: -------------------------------------------------------------------------------- 1 | .. developer_guide index_developer 2 | 3 | Developer guide 4 | =============== 5 | 6 | This part will guide you through the code of PprzGCS, and some desing choices that have been made. 7 | 8 | .. toctree:: 9 | :maxdepth: 1 10 | 11 | how_to_build 12 | concepts 13 | pprzapplication 14 | settings 15 | aircraft 16 | widgets 17 | map 18 | 19 | -------------------------------------------------------------------------------- /docs/source/developer_guide/map.rst: -------------------------------------------------------------------------------- 1 | .. developer_guide widgets 2 | 3 | Map 4 | === 5 | 6 | The map is by far the most complex widget. Let's see how is works! 7 | 8 | Map2D 9 | ----- 10 | 11 | First, let focus on the map itself, without all the elements that populates it. 12 | 13 | The *Map2D* widget inherits *QGraphicsView*, and holds a *MapScene* (that inherits *QGraphicsScene*). 14 | 15 | This widget only support maps in the Pseudo-Mercator projected coordinate system, a.k.a *EPSG:3857*. There are plans to support other coordinate systems in the future. 16 | 17 | See ``_ to learn how this kind of map works. 18 | 19 | In our case, the QGraphicsScene coordinates are directly related to the tiles coordinates, multiplied by the size of the tiles. 20 | 21 | 22 | .. admonition:: Example 23 | 24 | + At zoom level 0, the map's bottom right coordinate is (256, 256), 25 | + At zoom level 1, it's (512, 512), 26 | + At zoom level 1, it's (1024, 1024), 27 | + ... 28 | 29 | See ``src/widgets/map/maputils.cpp`` for some helper functions. 30 | 31 | There is a *TileProvider*, associated with each map layers. New tile providers can be added in the ``tile_sources.xml`` file. 32 | 33 | Tiles are fist opened from local cache directory, or downloaded from the net is not present locally. Remove local cache to get the latest tiles. 34 | 35 | 36 | Downloading tile can take a few seconds, or can fail. Before a tile is downloaded succesfully, it is recreated by assembling its 4 child tiles (at zoom n+1), or by scaling up its parent's tile. 37 | 38 | 39 | 40 | -------------------------------------------------------------------------------- /docs/source/developer_guide/pprzapplication.rst: -------------------------------------------------------------------------------- 1 | .. developer_guide pprzapplication 2 | 3 | PprzApplication 4 | =============== 5 | 6 | ``PprzApplication`` subclass ``QApplication`` to add two attributes: the toolbox and the main window. 7 | 8 | There should be only one instance of ``PprzApplication``. 9 | 10 | Get the PprzApplication instance from anywhere with the ``pprzApp()`` function. 11 | 12 | 13 | Toolbox 14 | ------- 15 | 16 | The toolbox holds these tools: 17 | 18 | + **AircraftManager**: manage the list of aircrafts 19 | + **SRTMManager**: holds STRM data (ground elevation data) 20 | + **PprzDispatcher**: Handle Ivy communication 21 | + **CoordinatesTransform**: Use PROJ to convert coordinates across different coordinates reference systems 22 | + **Units**: Manage units conversions 23 | + **DispatcherUi**: propagate specific events across all the application 24 | + **Speaker**: Handles text to speech. 25 | 26 | 27 | Get the tools from the toolbox getters, e.g. : ``pprzApp()->toolbox()->aircraftManager()`` 28 | 29 | 30 | PprzMain 31 | -------- 32 | 33 | PprzMain is the main window of the application. 34 | 35 | -------------------------------------------------------------------------------- /docs/source/developer_guide/settings.rst: -------------------------------------------------------------------------------- 1 | 2 | Settings and config 3 | =================== 4 | 5 | Settings and global configurations are both global and accessible from anywhere in the application. They differ only by the intended lifespan. 6 | 7 | Settings 8 | -------- 9 | 10 | Settings are stored in a file and are saved accross sessions. 11 | 12 | It uses the QSettings interface, with a file named ``settings.conf`` at the standard path ``QStandardPaths::AppDataLocation``. 13 | Thus, it's most probably corresponds to ``$HOME/.local/share/pprzgcs/settings.conf``. 14 | 15 | 16 | Use the helper function ``QSettings getAppSettings()`` from ``gcs_utils.h`` to start using them. 17 | 18 | 19 | GlobalConfig 20 | ------------ 21 | 22 | The global config is a singleton holding a key/value configuration. 23 | 24 | It lives only for the current session. 25 | 26 | Use the helper function ``GlobalConfig* appConfig()`` from ``gcs_utils.h`` to start using it. 27 | 28 | Like the settings, it uses QVariant type to hold its items. 29 | 30 | 31 | 32 | -------------------------------------------------------------------------------- /docs/source/index.rst: -------------------------------------------------------------------------------- 1 | .. PprzGCS documentation master file, created by 2 | sphinx-quickstart on Mon Mar 22 16:44:25 2021. 3 | You can adapt this file completely to your liking, but it should at least 4 | contain the root `toctree` directive. 5 | 6 | PprzGCS's documentation 7 | ======================= 8 | 9 | .. image:: icon.svg 10 | :align: center 11 | :width: 50% 12 | 13 | 14 | **PprzGCS** is a new GCS for `Paparazzi UAV `_ using C++ and Qt. 15 | It aims at replacing the old one which use deprecated OCaml libraries. 16 | 17 | .. toctree:: 18 | :maxdepth: 2 19 | 20 | developer_guide/index_developer 21 | user_guide/index_user 22 | 23 | 24 | Indices and tables 25 | ================== 26 | 27 | * :ref:`genindex` 28 | * :ref:`modindex` 29 | * :ref:`search` 30 | -------------------------------------------------------------------------------- /docs/source/user_guide/PFD.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/paparazzi/PprzGCS/df4be571069813f7619b92959421e756378c9432/docs/source/user_guide/PFD.png -------------------------------------------------------------------------------- /docs/source/user_guide/commands.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/paparazzi/PprzGCS/df4be571069813f7619b92959421e756378c9432/docs/source/user_guide/commands.png -------------------------------------------------------------------------------- /docs/source/user_guide/flightplan_blocks.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/paparazzi/PprzGCS/df4be571069813f7619b92959421e756378c9432/docs/source/user_guide/flightplan_blocks.png -------------------------------------------------------------------------------- /docs/source/user_guide/flightplan_details.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/paparazzi/PprzGCS/df4be571069813f7619b92959421e756378c9432/docs/source/user_guide/flightplan_details.png -------------------------------------------------------------------------------- /docs/source/user_guide/index_user.rst: -------------------------------------------------------------------------------- 1 | .. developer_guide index_developer 2 | 3 | User guide 4 | =============== 5 | 6 | What can you do with PprzGCS ? 7 | How to configure it the way you want ? 8 | Learn everything here! 9 | 10 | .. toctree:: 11 | :maxdepth: 2 12 | 13 | layout 14 | widgets 15 | map_tile_sources 16 | 17 | -------------------------------------------------------------------------------- /docs/source/user_guide/layout_example.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/paparazzi/PprzGCS/df4be571069813f7619b92959421e756378c9432/docs/source/user_guide/layout_example.png -------------------------------------------------------------------------------- /docs/source/user_guide/map2d_configure.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/paparazzi/PprzGCS/df4be571069813f7619b92959421e756378c9432/docs/source/user_guide/map2d_configure.png -------------------------------------------------------------------------------- /docs/source/user_guide/plotter.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/paparazzi/PprzGCS/df4be571069813f7619b92959421e756378c9432/docs/source/user_guide/plotter.png -------------------------------------------------------------------------------- /docs/source/user_guide/settings.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/paparazzi/PprzGCS/df4be571069813f7619b92959421e756378c9432/docs/source/user_guide/settings.png -------------------------------------------------------------------------------- /docs/source/user_guide/strip.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/paparazzi/PprzGCS/df4be571069813f7619b92959421e756378c9432/docs/source/user_guide/strip.png -------------------------------------------------------------------------------- /examples/cpp/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | cmake_minimum_required(VERSION 3.16) 2 | 3 | project(TestGRPC) 4 | 5 | # find protobuf 6 | find_package(Protobuf CONFIG REQUIRED) 7 | message(STATUS "Using protobuf ${Protobuf_VERSION}") 8 | 9 | # Find gRPC installation 10 | # Looks for gRPCConfig.cmake file installed by gRPC's cmake installation. 11 | find_package(gRPC CONFIG REQUIRED) 12 | message(STATUS "Using gRPC ${gRPC_VERSION}") 13 | 14 | find_package(PprzgcsGRCP CONFIG REQUIRED) 15 | 16 | add_executable(greeter_client "greeter_client.cpp") 17 | 18 | target_link_libraries(greeter_client 19 | PprzgcsGRCP 20 | gRPC::grpc++_reflection 21 | gRPC::grpc++ 22 | protobuf::libprotobuf 23 | ) 24 | 25 | -------------------------------------------------------------------------------- /examples/cpp/Readme.md: -------------------------------------------------------------------------------- 1 | # C++ gRPC example 2 | 3 | ## prerequisites 4 | 5 | - Install [gRPC](https://grpc.io/docs/languages/cpp/quickstart/) 6 | - Install PprzGCS with `cmake --install` 7 | 8 | ## Build 9 | 10 | - `mkdir build && cd build` 11 | - Configure with `cmake .. -D CMAKE_PREFIX_PATH=";"` 12 | - `make` 13 | 14 | 15 | -------------------------------------------------------------------------------- /examples/cpp/greeter_client.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | #include 4 | #include 5 | #include "pprzgcs.grpc.pb.h" 6 | 7 | using grpc::Channel; 8 | using grpc::ClientContext; 9 | using grpc::Status; 10 | using pprzgcs::GCSService; 11 | using pprzgcs::CenterOnRequest; 12 | using pprzgcs::CenterOnResponse; 13 | 14 | class PprzgcsClient { 15 | public: 16 | PprzgcsClient(std::shared_ptr channel): stub_(GCSService::NewStub(channel)) {} 17 | 18 | // Assembles the client's payload, sends it and presents the response back 19 | // from the server. 20 | void CenterOn(double lat, double lon) { 21 | // Data we are sending to the server. 22 | CenterOnRequest request; 23 | auto coor = request.mutable_coordinate(); 24 | coor->set_crs("WGS84"); 25 | coor->set_lat(lat); 26 | coor->set_lon(lon); 27 | //request.mutable_aircraft()->set_ac_name("JP"); 28 | 29 | // Container for the data we expect from the server. 30 | CenterOnResponse reply; 31 | 32 | // Context for the client. It could be used to convey extra information to 33 | // the server and/or tweak certain RPC behaviors. 34 | ClientContext context; 35 | 36 | // The actual RPC. 37 | Status status = stub_->CenterOn(&context, request, &reply); 38 | 39 | // Act upon its status. 40 | if (status.ok()) { 41 | std::cout << reply.status() << " " << reply.msg() << std::endl; 42 | } else { 43 | std::cout << status.error_code() << ": " << status.error_message()<< std::endl; 44 | } 45 | } 46 | 47 | private: 48 | std::unique_ptr stub_; 49 | }; 50 | 51 | int main(int argc, char** argv) { 52 | std::string target_str = "localhost:50051"; 53 | 54 | PprzgcsClient greeter(grpc::CreateChannel(target_str, grpc::InsecureChannelCredentials())); 55 | 56 | greeter.CenterOn(43.5, 1.2); 57 | 58 | return 0; 59 | } 60 | 61 | -------------------------------------------------------------------------------- /pprzgcs_version.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | 4 | DEFAULT_VERSION="v1.0.13" 5 | 6 | if test -d .git -o -f .git 7 | then 8 | GIT_VN=$(git describe --tags) 9 | if echo "$GIT_VN" | grep -Eq "^v[0-9].*" 10 | then 11 | VN="$GIT_VN" 12 | else 13 | VN="$DEFAULT_VERSION"-none-g"$GIT_VN" 14 | fi 15 | else 16 | VN="$DEFAULT_VERSION" 17 | fi 18 | 19 | echo $VN 20 | 21 | 22 | -------------------------------------------------------------------------------- /resources/pictures/ground_speed.svg: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /resources/pictures/link.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/paparazzi/PprzGCS/df4be571069813f7619b92959421e756378c9432/resources/pictures/link.png -------------------------------------------------------------------------------- /resources/pictures/lock.svg: -------------------------------------------------------------------------------- 1 | 2 | 17 | 19 | 20 | 22 | image/svg+xml 23 | 25 | 26 | 27 | 28 | 30 | 50 | 52 | lock 53 | 54 | 58 | 59 | -------------------------------------------------------------------------------- /resources/pictures/lock_dark.svg: -------------------------------------------------------------------------------- 1 | 2 | 17 | 19 | 20 | 22 | image/svg+xml 23 | 25 | 26 | 27 | 28 | 30 | 50 | 52 | lock 53 | 54 | 58 | 59 | -------------------------------------------------------------------------------- /resources/pictures/lock_warning.svg: -------------------------------------------------------------------------------- 1 | 2 | 17 | 19 | 20 | 22 | image/svg+xml 23 | 25 | 26 | 27 | 28 | 30 | 50 | 52 | lock 53 | 54 | 58 | 59 | -------------------------------------------------------------------------------- /resources/pictures/red_led.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 19 | 21 | 40 | 42 | 43 | 45 | image/svg+xml 46 | 48 | 49 | 50 | 51 | 52 | 57 | 63 | 64 | 65 | -------------------------------------------------------------------------------- /resources/pictures/unlocked.svg: -------------------------------------------------------------------------------- 1 | 2 | 17 | 19 | 20 | 22 | image/svg+xml 23 | 25 | 26 | 27 | 28 | 30 | 50 | 52 | lock 53 | 54 | 58 | 59 | -------------------------------------------------------------------------------- /screenshots/screenshot.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/paparazzi/PprzGCS/df4be571069813f7619b92959421e756378c9432/screenshots/screenshot.png -------------------------------------------------------------------------------- /src/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | 2 | set(SOURCE 3 | ${SOURCE} 4 | ${CMAKE_CURRENT_SOURCE_DIR}/main.cpp 5 | ${CMAKE_CURRENT_SOURCE_DIR}/PprzToolbox.cpp 6 | ${CMAKE_CURRENT_SOURCE_DIR}/PprzApplication.cpp 7 | ${CMAKE_CURRENT_SOURCE_DIR}/app_settings.cpp 8 | ${CMAKE_CURRENT_SOURCE_DIR}/configurator.cpp 9 | ${CMAKE_CURRENT_SOURCE_DIR}/pprzmain.cpp 10 | ${CMAKE_CURRENT_SOURCE_DIR}/globalconfig.cpp 11 | ) 12 | 13 | set(INC_DIRS ${INC_DIRS} ${CMAKE_CURRENT_SOURCE_DIR}) 14 | 15 | add_subdirectory(widgets) 16 | add_subdirectory(common) 17 | add_subdirectory(geometry) 18 | add_subdirectory(tools) 19 | 20 | set(SOURCE ${SOURCE} PARENT_SCOPE) 21 | set(INC_DIRS ${INC_DIRS} PARENT_SCOPE) 22 | 23 | 24 | -------------------------------------------------------------------------------- /src/PprzApplication.cpp: -------------------------------------------------------------------------------- 1 | #include "PprzApplication.h" 2 | #include "PprzToolbox.h" 3 | #include "pprzmain.h" 4 | #include "point2dlatlon.h" 5 | 6 | PprzApplication* PprzApplication::_app = nullptr; 7 | 8 | PprzApplication::PprzApplication(int &argc, char **argv, int flags) : QApplication(argc, argv, flags) 9 | { 10 | _app = this; 11 | _toolbox = new PprzToolbox(this); 12 | //_toolbox->setChildToolboxes(); 13 | _mainWindow = new PprzMain(); 14 | qRegisterMetaType(); 15 | } 16 | 17 | /// @brief Returns the PprzApplication object singleton. 18 | PprzApplication* pprzApp(void) 19 | { 20 | return PprzApplication::_app; 21 | } 22 | 23 | void PprzApplication::init() { 24 | _toolbox->setChildToolboxes(); 25 | } 26 | 27 | void PprzApplication::_shutdown() { 28 | delete _toolbox; 29 | delete _mainWindow; 30 | } 31 | 32 | PprzApplication::~PprzApplication() { 33 | _app = nullptr; 34 | } 35 | -------------------------------------------------------------------------------- /src/PprzApplication.h: -------------------------------------------------------------------------------- 1 | #ifndef PPRZAPPLICATION_H 2 | #define PPRZAPPLICATION_H 3 | 4 | #include 5 | 6 | class PprzToolbox; 7 | class PprzMain; 8 | 9 | class PprzApplication : public QApplication 10 | { 11 | Q_OBJECT 12 | public: 13 | explicit PprzApplication(int &argc, char **argv, int = ApplicationFlags); 14 | ~PprzApplication(); 15 | 16 | static PprzApplication* _app; 17 | void init(); 18 | 19 | void _shutdown(); 20 | 21 | PprzToolbox* toolbox() {return _toolbox;} 22 | PprzMain* mainWindow() {return _mainWindow;} 23 | 24 | private: 25 | PprzToolbox* _toolbox = nullptr; 26 | PprzMain* _mainWindow = nullptr; 27 | 28 | signals: 29 | 30 | }; 31 | 32 | /// @brief Returns the PprzApplication object singleton. 33 | PprzApplication* pprzApp(void); 34 | 35 | #endif // PPRZAPPLICATION_H 36 | -------------------------------------------------------------------------------- /src/PprzToolbox.cpp: -------------------------------------------------------------------------------- 1 | #include "PprzToolbox.h" 2 | #include "AircraftManager.h" 3 | #include "srtm_manager.h" 4 | #include "pprz_dispatcher.h" 5 | #include "coordinatestransform.h" 6 | #include "units.h" 7 | #include "dispatcher_ui.h" 8 | #include "watcher.h" 9 | 10 | #if defined(SPEECH_ENABLED) 11 | #include "speaker.h" 12 | #endif 13 | #if GRPC_ENABLED 14 | #include "grpcconnector.h" 15 | #endif 16 | 17 | PprzToolbox::PprzToolbox(PprzApplication* app) 18 | { 19 | _aircraftManager = new AircraftManager (app, this); 20 | _srtmManager = new SRTMManager (app, this); 21 | _pprzDispatcher = new PprzDispatcher (app, this); 22 | _coordinatesTransform = new CoordinatesTransform(app, this); 23 | _units = new Units (app, this); 24 | _dispatcherUi = new DispatcherUi (app, this); 25 | _watcher = new Watcher (app, this); 26 | #if defined(SPEECH_ENABLED) 27 | _speaker = new Speaker (app, this); 28 | #endif 29 | #if GRPC_ENABLED 30 | _connector = new GRPCConnector (app, this); 31 | #endif 32 | } 33 | 34 | void PprzToolbox::setChildToolboxes(void) { 35 | _aircraftManager->setToolbox(this); 36 | _srtmManager->setToolbox(this); 37 | _pprzDispatcher->setToolbox(this); 38 | _coordinatesTransform->setToolbox(this); 39 | _units->setToolbox(this); 40 | _dispatcherUi->setToolbox(this); 41 | _watcher->setToolbox(this); 42 | #if defined(SPEECH_ENABLED) 43 | _speaker->setToolbox(this); 44 | #endif 45 | #if GRPC_ENABLED 46 | _connector->setToolbox(this); 47 | #endif 48 | } 49 | 50 | 51 | PprzTool::PprzTool(PprzApplication* app, PprzToolbox* toolbox) : 52 | QObject(toolbox), 53 | _app(app), _toolbox(nullptr) 54 | { 55 | (void)toolbox; 56 | } 57 | 58 | void PprzTool::setToolbox(PprzToolbox* toolbox) 59 | { 60 | _toolbox = toolbox; 61 | } 62 | -------------------------------------------------------------------------------- /src/app_settings.h: -------------------------------------------------------------------------------- 1 | #ifndef CONFIGURE_H 2 | #define CONFIGURE_H 3 | 4 | #include 5 | #include 6 | #include 7 | 8 | void set_app_settings(); 9 | 10 | class SettingsEditor : public QDialog 11 | { 12 | Q_OBJECT 13 | public: 14 | explicit SettingsEditor(bool standalone = false, QWidget *parent = nullptr); 15 | 16 | 17 | 18 | private: 19 | 20 | enum Type { 21 | STRING, 22 | INT, 23 | DOUBLE, 24 | PATH_DIR, 25 | PATH_FILE, 26 | STRING_COMBO, 27 | }; 28 | 29 | std::function addSetting(QString name, QString key, QWidget* w, QGridLayout* gl, int &row, Type type, QVariant data = QVariant()); 30 | 31 | QList> callbacks; 32 | 33 | }; 34 | 35 | #endif // CONFIGURE_H 36 | -------------------------------------------------------------------------------- /src/common/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | 2 | set(SOURCE 3 | ${SOURCE} 4 | ${CMAKE_CURRENT_SOURCE_DIR}/aircraft.cpp 5 | ${CMAKE_CURRENT_SOURCE_DIR}/waypoint.cpp 6 | ${CMAKE_CURRENT_SOURCE_DIR}/sector.cpp 7 | ${CMAKE_CURRENT_SOURCE_DIR}/block.cpp 8 | ${CMAKE_CURRENT_SOURCE_DIR}/flightplan.cpp 9 | ${CMAKE_CURRENT_SOURCE_DIR}/setting_menu.cpp 10 | ${CMAKE_CURRENT_SOURCE_DIR}/setting.cpp 11 | ${CMAKE_CURRENT_SOURCE_DIR}/airframe.cpp 12 | ${CMAKE_CURRENT_SOURCE_DIR}/aircraft_status.cpp 13 | ${CMAKE_CURRENT_SOURCE_DIR}/gcs_utils.cpp 14 | ${CMAKE_CURRENT_SOURCE_DIR}/pprzpalette.cpp 15 | ${CMAKE_CURRENT_SOURCE_DIR}/aircraft_watcher.cpp 16 | ) 17 | 18 | set(INC_DIRS ${INC_DIRS} ${CMAKE_CURRENT_SOURCE_DIR}) 19 | 20 | set(SOURCE ${SOURCE} PARENT_SCOPE) 21 | set(INC_DIRS ${INC_DIRS} PARENT_SCOPE) 22 | -------------------------------------------------------------------------------- /src/common/aircraft.h: -------------------------------------------------------------------------------- 1 | #ifndef AIRCRAFT_H 2 | #define AIRCRAFT_H 3 | 4 | #include 5 | #include 6 | #include "flightplan.h" 7 | #include "setting_menu.h" 8 | #include "airframe.h" 9 | #include "point2dlatlon.h" 10 | #include "pprz_dispatcher.h" 11 | #include "aircraft_status.h" 12 | 13 | class ConfigData; 14 | 15 | class Aircraft: public QObject 16 | { 17 | Q_OBJECT 18 | public: 19 | Aircraft(ConfigData* config, QObject* parent=nullptr); 20 | QColor getColor(){return color;} 21 | QString getId(){return ac_id;} 22 | QString getIcon(){return icon;} 23 | QString name() {return _name;} 24 | FlightPlan* getFlightPlan() {return flight_plan;} 25 | //SettingMenu& getSettingMenu() {return setting_menu;} 26 | SettingMenu* getSettingMenu() {return setting_menu;} 27 | Airframe* getAirframe() {return airframe;} 28 | AircraftStatus* getStatus() {return status;} 29 | ConfigData* getConfig() {return config;} 30 | QList getChecklist() {return checklist;} 31 | void setConfig(ConfigData* c) {config = c;} 32 | 33 | Point2DLatLon getPosition() {return position;} 34 | void setPosition(Point2DLatLon pos) {position = pos;} 35 | 36 | void setSetting(Setting*, QString value); 37 | void setSetting(Setting*, float value); 38 | void setSetting(uint8_t setting_no, float value); 39 | 40 | bool isReal() {return real;} 41 | bool checklistFinished(); 42 | 43 | private: 44 | QString ac_id; 45 | QColor color; 46 | QString icon; 47 | QString _name; 48 | FlightPlan* flight_plan; 49 | SettingMenu* setting_menu; 50 | Airframe* airframe; 51 | ConfigData* config; 52 | QList checklist; 53 | 54 | Point2DLatLon position; 55 | 56 | AircraftStatus* status; 57 | 58 | // false if this is a "flight plan only" AC. Just to edit the flight plan. 59 | bool real; 60 | 61 | }; 62 | 63 | #endif // AIRCRAFT_H 64 | -------------------------------------------------------------------------------- /src/common/aircraft_status.h: -------------------------------------------------------------------------------- 1 | #ifndef AIRCRAFTSTATUS_H 2 | #define AIRCRAFTSTATUS_H 3 | 4 | #include 5 | #include 6 | #include "pprz_dispatcher.h" 7 | #include 8 | #include "aircraft_watcher.h" 9 | 10 | 11 | class AircraftStatus : public QObject 12 | { 13 | Q_OBJECT 14 | public: 15 | explicit AircraftStatus(QString ac_id, QObject *parent = nullptr); 16 | 17 | void updateMessage(pprzlink::Message msg); 18 | std::optional getMessage(QString name); 19 | QMap getTelemetryMessages() {return telemetry_messages;} 20 | 21 | AircraftWatcher* getWatcher() {return watcher;} 22 | 23 | signals: 24 | void flight_param(); 25 | void ap_status(); 26 | void nav_status(); 27 | void circle_status(); 28 | void segment_status(); 29 | void engine_status(); 30 | void waypoint_moved(); 31 | void dl_values(); 32 | void telemetry_status(); 33 | void fly_by_wire(); 34 | void svsinfo(); 35 | 36 | public slots: 37 | 38 | private: 39 | QString ac_id; 40 | 41 | QMap last_messages; 42 | QMap telemetry_messages; 43 | 44 | AircraftWatcher* watcher; 45 | }; 46 | 47 | #endif // AIRCRAFTSTATUS_H 48 | -------------------------------------------------------------------------------- /src/common/aircraft_watcher.cpp: -------------------------------------------------------------------------------- 1 | #include "aircraft_watcher.h" 2 | #include "AircraftManager.h" 3 | 4 | AircraftWatcher::AircraftWatcher(QString ac_id, QObject *parent) : QObject(parent), 5 | ac_id(ac_id) 6 | { 7 | } 8 | 9 | void AircraftWatcher::init() { 10 | auto airframe = pprzApp()->toolbox()->aircraftManager()->getAircraft(ac_id)->getAirframe(); 11 | auto lbl = airframe->getDefine("LOW_BAT_LEVEL"); 12 | auto cbl = airframe->getDefine("CRITIC_BAT_LEVEL"); 13 | auto ctbl = airframe->getDefine("CATASTROPHIC_BAT_LEVEL"); 14 | 15 | bat_low = lbl.has_value() ? lbl->value.toDouble() : 10.5; 16 | bat_critic = cbl.has_value() ? cbl->value.toDouble() : 10.; 17 | bat_catastrophic = ctbl.has_value() ? ctbl->value.toDouble() : 9.; 18 | } 19 | 20 | void AircraftWatcher::watch_bat(pprzlink::Message msg) { 21 | float bat; 22 | msg.getField("bat", bat); 23 | 24 | BatStatus bs; 25 | if(bat < bat_catastrophic) { 26 | bs = BatStatus::CATASTROPHIC; 27 | } else if(bat < bat_critic) { 28 | bs = BatStatus::CRITIC; 29 | } else if(bat < bat_low) { 30 | bs = BatStatus::LOW; 31 | } else { 32 | bs = BatStatus::OK; 33 | } 34 | 35 | emit bat_status(bs); 36 | } 37 | 38 | void AircraftWatcher::watch_links(pprzlink::Message msg) { 39 | QString link_id; 40 | float time_since_last_msg; 41 | msg.getField("link_id", link_id); 42 | msg.getField("time_since_last_msg", time_since_last_msg); 43 | link_times[link_id] = time_since_last_msg; 44 | 45 | int nb_link_losts = std::accumulate(link_times.begin(), link_times.end(), 0, 46 | [](int n, auto t){ 47 | if(t>5) { ++n; } 48 | return n; 49 | } 50 | ); 51 | 52 | LinkStatus status; 53 | if(nb_link_losts == 0) { 54 | status = LinkStatus::LINK_OK; 55 | } else if (nb_link_losts == link_times.size()) { 56 | status = LinkStatus::LINK_LOST; 57 | } else { 58 | status = LinkStatus::LINK_PARTIALY_LOST; 59 | } 60 | 61 | emit link_status(status); 62 | } 63 | -------------------------------------------------------------------------------- /src/common/aircraft_watcher.h: -------------------------------------------------------------------------------- 1 | #ifndef AIRCRAFTWATCHER_H 2 | #define AIRCRAFTWATCHER_H 3 | 4 | #include 5 | #include "pprz_dispatcher.h" 6 | 7 | class AircraftWatcher : public QObject 8 | { 9 | Q_OBJECT 10 | public: 11 | explicit AircraftWatcher(QString ac_id, QObject *parent = nullptr); 12 | void init(); 13 | 14 | void watch_bat(pprzlink::Message msg); 15 | void watch_links(pprzlink::Message msg); 16 | 17 | enum BatStatus{ 18 | OK, 19 | LOW, 20 | CRITIC, 21 | CATASTROPHIC, 22 | }; 23 | 24 | enum LinkStatus { 25 | LINK_OK, 26 | LINK_LOST, 27 | LINK_PARTIALY_LOST 28 | }; 29 | 30 | signals: 31 | void bat_status(BatStatus); 32 | void link_status(LinkStatus); 33 | 34 | private: 35 | 36 | 37 | QString ac_id; 38 | 39 | float bat_low; 40 | float bat_critic; 41 | float bat_catastrophic; 42 | 43 | QMap link_times; 44 | 45 | }; 46 | 47 | #endif // AIRCRAFTWATCHER_H 48 | -------------------------------------------------------------------------------- /src/common/airframe.h: -------------------------------------------------------------------------------- 1 | #ifndef AIRFRAME_H 2 | #define AIRFRAME_H 3 | 4 | #include 5 | #include 6 | #include 7 | 8 | struct Param { 9 | QString name; 10 | QString unit; 11 | QString value; 12 | }; 13 | 14 | struct ChecklistItem { 15 | QString name; 16 | QString description; 17 | QString type; 18 | QString value; 19 | }; 20 | 21 | class Airframe: public QObject 22 | { 23 | Q_OBJECT 24 | public: 25 | 26 | Airframe(QDomDocument doc, QObject* parent=nullptr); 27 | 28 | QString getFirmware() {return firmware;} 29 | QString getIconName(); 30 | float getAltShiftPlus(); 31 | float getAltShiftPlusPlus(); 32 | float getAltShiftMinus(); 33 | std::optional getDefine(QString name, QString section=""); 34 | 35 | void saveSettings(QString filename); 36 | void setParams(QMap changed_params); 37 | QList getParams(); 38 | QList getChecklistItems(); 39 | 40 | private: 41 | QString name; 42 | QString firmware; 43 | 44 | QDomDocument doc; 45 | 46 | static constexpr float ALT_PLUS_FW = 10; 47 | static constexpr float ALT_MINUS_FW = -10; 48 | static constexpr float ALT_PLUS_PLUS_FW = 30; 49 | 50 | static constexpr float ALT_PLUS_RC = 1; 51 | static constexpr float ALT_MINUS_RC = -1; 52 | static constexpr float ALT_PLUS_PLUS_RC = 3; 53 | }; 54 | 55 | #endif // AIRFRAME_H 56 | -------------------------------------------------------------------------------- /src/common/block.cpp: -------------------------------------------------------------------------------- 1 | #include "block.h" 2 | #include 3 | #include 4 | #include 5 | 6 | Block::Block(QString name, uint8_t no) : 7 | name(name), no(no) 8 | { 9 | 10 | } 11 | 12 | Block::Block(QDomElement blk) { 13 | 14 | assert(blk.hasAttribute("name")); 15 | 16 | name = blk.attribute("name"); 17 | no = blk.attribute("no", "0").toUInt(); 18 | 19 | setIcon(blk.attribute("strip_icon", "")); 20 | setText(blk.attribute("strip_button", "")); 21 | setKey(blk.attribute("key", "")); 22 | setGroup(blk.attribute("group", "")); 23 | 24 | 25 | auto attr = blk.attributes(); 26 | for(int i=0; i < attr.count(); i++) { 27 | auto att = attr.item(i).toAttr(); 28 | attributes[att.name()] = att.value(); 29 | } 30 | 31 | parse_block_stages(blk); 32 | } 33 | 34 | void Block::parse_block_stages(QDomElement blk) { 35 | for(auto stel=blk.firstChildElement(); 36 | !stel.isNull(); 37 | stel = stel.nextSiblingElement()) { 38 | Stage stage; 39 | stage.no = 255; 40 | stage.instruction = stel.tagName(); 41 | 42 | auto attr = stel.attributes(); 43 | for(int i=0; i < attr.count(); i++) { 44 | auto att = attr.item(i).toAttr(); 45 | stage.attributes[att.name()] = att.value(); 46 | } 47 | 48 | stage.no = stel.attribute("no", "0").toUInt(); 49 | stages.push_back(stage); 50 | } 51 | } 52 | 53 | 54 | ostream& operator<<(ostream& os, const Block& bk) { 55 | 56 | os << "{" << bk.name.toStdString() << ", no: " << to_string(bk.no); 57 | 58 | if(bk.strip_icon != "") { 59 | os << " icon: " << bk.strip_icon.toStdString(); 60 | } 61 | 62 | if(bk.strip_button_txt != "") { 63 | os << " text: " << bk.strip_button_txt.toStdString(); 64 | } 65 | 66 | if(bk.key != "") { 67 | os << " key: " << bk.key.toStdString(); 68 | } 69 | 70 | if(bk.group != "") { 71 | os << " group: " << bk.group.toStdString(); 72 | } 73 | 74 | os << "}"; 75 | 76 | return os; 77 | } 78 | -------------------------------------------------------------------------------- /src/common/block.h: -------------------------------------------------------------------------------- 1 | #ifndef BLOCK_H 2 | #define BLOCK_H 3 | 4 | #include 5 | #include 6 | #include 7 | 8 | using namespace std; 9 | 10 | struct Stage { 11 | QString instruction; 12 | map attributes; 13 | uint8_t no; 14 | }; 15 | 16 | class Block 17 | { 18 | public: 19 | Block(QDomElement blk); 20 | Block(QString name, uint8_t no); 21 | 22 | void setIcon(QString icon) {strip_icon = icon;} 23 | void setText(QString text) {strip_button_txt = text;} 24 | void setKey(QString key) {this->key = key;} 25 | void setGroup(QString group) {this->group = group;} 26 | 27 | QString getName() {return name;} 28 | uint8_t getNo() {return no;} 29 | QString getIcon() {return strip_icon;} 30 | QString getText() {return strip_button_txt ;} 31 | QString getKey() {return key;} 32 | QString getGroup() {return group;} 33 | QList& getStages() {return stages;} 34 | 35 | friend ostream& operator<<(ostream& os, const Block& wp); 36 | 37 | private: 38 | void parse_block_stages(QDomElement blk); 39 | 40 | QString name; 41 | uint8_t no; 42 | 43 | QString strip_icon; 44 | QString strip_button_txt; 45 | QString key; 46 | QString group; 47 | 48 | map attributes; 49 | 50 | QList stages; 51 | }; 52 | 53 | #endif // BLOCK_H 54 | -------------------------------------------------------------------------------- /src/common/configurable.h: -------------------------------------------------------------------------------- 1 | #ifndef CONFIGURABLEWIDGET_H 2 | #define CONFIGURABLEWIDGET_H 3 | 4 | #include 5 | 6 | class Configurable 7 | { 8 | public: 9 | virtual void configure(QDomElement) = 0; 10 | }; 11 | 12 | #endif // CONFIGURABLEWIDGET_H 13 | -------------------------------------------------------------------------------- /src/common/gcs_utils.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | #include 3 | #include 4 | #include 5 | #include 6 | #include "globalconfig.h" 7 | #include 8 | 9 | enum LogLevel { 10 | LOG_LOW, 11 | LOG_MID, 12 | LOG_HIGH, 13 | }; 14 | 15 | QString user_or_app_path(QString data_path); 16 | 17 | double parse_coordinate(QString str); 18 | 19 | double getFloatingField(pprzlink::Message &msg, const QString &field); 20 | 21 | QSettings getAppSettings(); 22 | GlobalConfig* appConfig(); 23 | 24 | bool verbose(); 25 | void setVerbose(bool v); 26 | bool speech(); 27 | void setSpeech(bool s); 28 | 29 | void logDebug(QString log_class, QString msg, LogLevel level = LogLevel::LOG_MID); 30 | QStringList getLayoutFiles(QString location); 31 | -------------------------------------------------------------------------------- /src/common/pprzpalette.cpp: -------------------------------------------------------------------------------- 1 | #include "pprzpalette.h" 2 | 3 | PprzPalette::PprzPalette() 4 | { 5 | 6 | } 7 | 8 | PprzPalette::PprzPalette(QColor color): main_color(color), main_brush(color) 9 | { 10 | makeVariants(); 11 | } 12 | 13 | 14 | PprzPalette::PprzPalette(QColor color, QBrush brush): main_color(color), main_brush(brush) 15 | { 16 | makeVariants(); 17 | } 18 | 19 | void PprzPalette::makeVariants() { 20 | 21 | variants.append(main_color); 22 | 23 | int h, s, v, a; 24 | main_color.getHsv(&h, &s, &v, &a); 25 | 26 | int v1 = qMin(static_cast(v/1.2), 255); 27 | QColor c1 = QColor(main_color); 28 | c1.setHsv(h, s, v1, a); 29 | variants.append(c1); 30 | 31 | int a2 = qMin(static_cast(a/2), 255); 32 | QColor c2 = QColor(main_color); 33 | c2.setHsv(h, s, v, a2); 34 | variants.append(c2); 35 | 36 | 37 | int s3 = static_cast(s/2); 38 | QColor c3 = QColor(main_color); 39 | //c3.setHsv(h, s3, v, a); 40 | c3.setHsv(h, s3, v, a2); 41 | variants.append(c3); 42 | } 43 | -------------------------------------------------------------------------------- /src/common/pprzpalette.h: -------------------------------------------------------------------------------- 1 | #ifndef PPRZPALETTE_H 2 | #define PPRZPALETTE_H 3 | 4 | #include 5 | #include 6 | 7 | class PprzPalette 8 | { 9 | public: 10 | PprzPalette(); 11 | PprzPalette(QColor color); 12 | PprzPalette(QColor color, QBrush brush); 13 | 14 | QColor getColor() {return main_color;} 15 | QBrush getBrush() {return main_brush;} 16 | bool isValid() {return main_color.isValid();} 17 | QList getVariants() {return variants;} 18 | QColor getVariant(int i) {return variants[i];} 19 | 20 | private: 21 | void makeVariants(); 22 | 23 | QColor main_color; 24 | QBrush main_brush; 25 | 26 | QList variants; 27 | }; 28 | 29 | #endif // PPRZPALETTE_H 30 | -------------------------------------------------------------------------------- /src/common/sector.cpp: -------------------------------------------------------------------------------- 1 | #include "sector.h" 2 | 3 | Sector::Sector(QList corners, QString name, QString color_str): 4 | name(name), corners(corners) 5 | { 6 | color = QColor(color_str); 7 | } 8 | -------------------------------------------------------------------------------- /src/common/sector.h: -------------------------------------------------------------------------------- 1 | #ifndef SECTOR_H 2 | #define SECTOR_H 3 | 4 | #include 5 | #include "waypoint.h" 6 | #include 7 | #include 8 | 9 | using namespace std; 10 | class Sector 11 | { 12 | public: 13 | Sector(QList corners, QString name, QString color); 14 | 15 | QString getName() {return name;} 16 | QList getCorners() {return corners;} 17 | QColor getColor(){return color;} 18 | 19 | 20 | private: 21 | QString name; 22 | QColor color; // override AC color 23 | QList corners; 24 | }; 25 | 26 | #endif // SECTOR_H 27 | -------------------------------------------------------------------------------- /src/common/setting_menu.h: -------------------------------------------------------------------------------- 1 | #ifndef SETTINGS_H 2 | #define SETTINGS_H 3 | 4 | #include 5 | #include "setting.h" 6 | #include 7 | #include 8 | 9 | using namespace std; 10 | 11 | class SettingMenu: public QObject 12 | { 13 | Q_OBJECT 14 | public: 15 | 16 | struct ButtonGroup { 17 | QString group_name; 18 | QList> buttons; 19 | }; 20 | 21 | SettingMenu(QDomDocument doc, QObject* parent); 22 | SettingMenu(QDomElement setel, uint8_t& setting_no, QObject* parent); 23 | 24 | QList getSettingMenus() {return setting_menus;} 25 | QList getSettings() {return settings;} 26 | QList getAllSettings(); 27 | QList> getButtonGroups(); 28 | 29 | QString getName() {return name;} 30 | 31 | private: 32 | void init(QDomElement setel, uint8_t& setting_no); 33 | 34 | QString name; 35 | QList setting_menus; 36 | QList settings; 37 | }; 38 | 39 | #endif // SETTINGS_H 40 | -------------------------------------------------------------------------------- /src/common/tuple_helpers.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include 4 | 5 | // helper template to get the index of a type in a tuple at compile time 6 | // See https://devblogs.microsoft.com/oldnewthing/20200629-00/?p=103910 7 | // usage: 8 | // constexpr std::size_t index = tuple_element_index_v>; // = 1 9 | 10 | 11 | template 12 | struct tuple_element_index_helper; 13 | 14 | template 15 | struct tuple_element_index_helper> 16 | { 17 | static constexpr std::size_t value = 0; 18 | }; 19 | 20 | template 21 | struct tuple_element_index_helper> 22 | { 23 | static constexpr std::size_t value = 0; 24 | using RestTuple = std::tuple; 25 | static_assert( 26 | tuple_element_index_helper::value == 27 | std::tuple_size_v, 28 | "type appears more than once in tuple"); 29 | }; 30 | 31 | template 32 | struct tuple_element_index_helper> 33 | { 34 | using RestTuple = std::tuple; 35 | static constexpr std::size_t value = 1 + 36 | tuple_element_index_helper::value; 37 | }; 38 | 39 | template 40 | struct tuple_element_index 41 | { 42 | static constexpr std::size_t value = 43 | tuple_element_index_helper::value; 44 | static_assert(value < std::tuple_size_v, 45 | "type does not appear in tuple"); 46 | }; 47 | 48 | template 49 | inline constexpr std::size_t tuple_element_index_v 50 | = tuple_element_index::value; 51 | -------------------------------------------------------------------------------- /src/common/waypoint.h: -------------------------------------------------------------------------------- 1 | #ifndef WAYPOINT_H 2 | #define WAYPOINT_H 3 | 4 | #include 5 | #include 6 | #include 7 | #include 8 | #include 9 | #include 10 | 11 | class Point2DLatLon; 12 | class FlightPlan; 13 | 14 | class Waypoint: public QObject 15 | { 16 | Q_OBJECT 17 | public: 18 | 19 | enum WpFrame { 20 | WGS84, 21 | UTM, 22 | LTP 23 | }; 24 | 25 | Waypoint(Waypoint* original, QObject* parent=nullptr); 26 | Waypoint(QString name, uint8_t id, Point2DLatLon pos, double alt, QObject* parent=nullptr); 27 | Waypoint(QDomElement wp, uint8_t wp_id, Waypoint* orig, double defaultAlt, double ground_alt, WpFrame frame_type, QObject* parent=nullptr); 28 | 29 | uint8_t getId() const {return id;} 30 | double getLat() const; 31 | double getLon() const; 32 | void setLat (double lat); 33 | void setLon(double lon); 34 | void setRelative(WpFrame frame, double dx, double dy, Waypoint* wp=nullptr); 35 | void getRelative(WpFrame frame, double &dx, double &dy, Waypoint* wp=nullptr); 36 | 37 | void setAlt(double alt) {this->alt = alt;} 38 | double getAlt() const {return alt;} 39 | WpFrame getType() const {return type;} 40 | QString getName() const {return name;} 41 | void setName(QString new_name); 42 | Waypoint* getOrigin() {return origin;} 43 | void setOrigin(Waypoint* wp) {origin = wp;} 44 | QMap& getXmlAttributes() { return xml_attibutes;} 45 | FlightPlan* getFlightPlan() {return flight_plan;} 46 | 47 | friend std::ostream& operator<<(std::ostream& os, const Waypoint& wp); 48 | 49 | private: 50 | 51 | void affectFlightPlan(); 52 | 53 | FlightPlan* flight_plan; 54 | 55 | WpFrame type; 56 | 57 | uint8_t id; 58 | 59 | double lat; 60 | double lon; 61 | 62 | Waypoint* origin; 63 | 64 | double alt; 65 | 66 | QString name; 67 | 68 | QMap xml_attibutes; 69 | }; 70 | 71 | 72 | #endif // WAYPOINT_H 73 | -------------------------------------------------------------------------------- /src/configurator.h: -------------------------------------------------------------------------------- 1 | #ifndef LAYOUT_BUILDER_H 2 | #define LAYOUT_BUILDER_H 3 | 4 | #include 5 | #include 6 | #include 7 | #include "pprzmain.h" 8 | 9 | #define DECLARE_LAYOUT_EXCEPT(a) class a : public layout_exception {\ 10 | public:\ 11 | explicit a(const std::string &arg) :\ 12 | layout_exception(arg) {}\ 13 | }; 14 | 15 | 16 | class layout_exception : public std::runtime_error { 17 | public: 18 | layout_exception(const std::string &arg) : runtime_error(arg){} 19 | }; 20 | 21 | DECLARE_LAYOUT_EXCEPT(invalid_widget_name) 22 | DECLARE_LAYOUT_EXCEPT(invalid_tag) 23 | DECLARE_LAYOUT_EXCEPT(file_error) 24 | DECLARE_LAYOUT_EXCEPT(invalid_node) 25 | DECLARE_LAYOUT_EXCEPT(unknown_widget) 26 | 27 | PprzMain* configure(QString filename); 28 | QWidget* rec_layout_build(QDomNode &node, QSplitter* parent, int* size); 29 | 30 | 31 | #endif // LAYOUT_BUILDER_H 32 | -------------------------------------------------------------------------------- /src/geometry/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | 2 | set(SOURCE 3 | ${SOURCE} 4 | ${CMAKE_CURRENT_SOURCE_DIR}/point2dlatlon.cpp 5 | ${CMAKE_CURRENT_SOURCE_DIR}/point2dtile.cpp 6 | ${CMAKE_CURRENT_SOURCE_DIR}/point2dpseudomercator.cpp 7 | ) 8 | 9 | set(INC_DIRS ${INC_DIRS} ${CMAKE_CURRENT_SOURCE_DIR}) 10 | 11 | set(SOURCE ${SOURCE} PARENT_SCOPE) 12 | set(INC_DIRS ${INC_DIRS} PARENT_SCOPE) 13 | -------------------------------------------------------------------------------- /src/geometry/point2dlatlon.cpp: -------------------------------------------------------------------------------- 1 | #include "point2dlatlon.h" 2 | #include "math.h" 3 | 4 | Point2DLatLon::Point2DLatLon() : latp(0), lonp(0) 5 | { 6 | } 7 | 8 | Point2DLatLon::Point2DLatLon(double lat, double lon) { 9 | setLat(lat); 10 | setLon(lon); 11 | } 12 | 13 | //Point2DLatLon::Point2DLatLon(Point2DTile pt) { 14 | // double lon = pt.x() / static_cast(1 << pt.zoom()) * 360.0 - 180; 15 | // double n = M_PI - 2.0 * M_PI * pt.y() / static_cast(1 << pt.zoom()); 16 | // double lat = 180.0 / M_PI * atan(0.5 * (exp(n) - exp(-n))); 17 | // setLat(lat); 18 | // setLon(lon); 19 | //} 20 | 21 | Point2DLatLon::Point2DLatLon(Waypoint* wp) { 22 | latp = wp->getLat(); 23 | lonp = wp->getLon(); 24 | } 25 | 26 | 27 | QString Point2DLatLon::toString(bool sexagesimal) { 28 | if(sexagesimal) { 29 | auto sexformat = [](double nb) { 30 | int deg = static_cast(nb); 31 | int min = static_cast((nb - deg) * 60); 32 | int sec = static_cast((((nb - deg) * 60) - min)*60); 33 | QString txt = QString("%1").arg(deg, 3, 10, QChar(' ')) + "° " + QString("%1").arg(min, 2, 10, QChar('0')) + "' " + QString("%1").arg(sec, 2, 10, QChar('0')) + "\""; 34 | return txt; 35 | }; 36 | 37 | QString txtLat = sexformat(abs(latp)); 38 | QString txtLon = sexformat(abs(lonp)); 39 | 40 | QString latGeo = latp > 0 ? "N" : "S"; 41 | QString lonGeo = lonp > 0 ? "E" : "W"; 42 | 43 | QString txt = txtLat + latGeo + " " + txtLon + lonGeo; 44 | return txt; 45 | } else { 46 | // Why 6 digits ? Its smaller than a person, and bigger than a waldo: https://xkcd.com/2170/ 47 | QString txt = QString("%1").arg(latp, 10, 'f', 6, QChar(' ')) + "," + QString("%1").arg(lonp, 11, 'f', 6, QChar(' ')); 48 | return txt; 49 | } 50 | } 51 | -------------------------------------------------------------------------------- /src/geometry/point2dlatlon.h: -------------------------------------------------------------------------------- 1 | #ifndef POINT2DLATLON_H 2 | #define POINT2DLATLON_H 3 | 4 | #include "waypoint.h" 5 | #include 6 | 7 | class Point2DTile; 8 | 9 | class Point2DLatLon 10 | { 11 | public: 12 | Point2DLatLon(); 13 | Point2DLatLon(double lat, double lon); 14 | //Point2DLatLon(Point2DTile pt); 15 | Point2DLatLon(Waypoint* wp); 16 | 17 | double lat() {return latp;} 18 | double lon() {return lonp;} 19 | void setLat(double lat) {latp = std::clamp(lat, -90., 90.);} 20 | void setLon(double lon) {lonp = std::clamp(lon, -180., 180.);} 21 | 22 | QString toString(bool sexagesimal=false); 23 | 24 | private: 25 | double latp; 26 | double lonp; 27 | }; 28 | 29 | Q_DECLARE_METATYPE(Point2DLatLon) 30 | 31 | #endif // POINT2DLATLON_H 32 | -------------------------------------------------------------------------------- /src/geometry/point2dpseudomercator.cpp: -------------------------------------------------------------------------------- 1 | #include "point2dpseudomercator.h" 2 | #include "point2dtile.h" 3 | 4 | constexpr double EXTENT = 20037508.342789244; 5 | 6 | const QString Point2DPseudoMercator::EPSG = "EPSG:3857"; 7 | //EPSG:900913 8 | 9 | Point2DPseudoMercator::Point2DPseudoMercator(): _x(0), _y(0) 10 | { 11 | } 12 | 13 | Point2DPseudoMercator::Point2DPseudoMercator(double x, double y): _x(x), _y(y) 14 | { 15 | } 16 | 17 | Point2DPseudoMercator::Point2DPseudoMercator(Point2DTile pt) { 18 | _x = (2*pt.x()/(1< 5 | #include 6 | 7 | class Point2DTile; 8 | 9 | class Point2DPseudoMercator 10 | { 11 | public: 12 | Point2DPseudoMercator(); 13 | Point2DPseudoMercator(double _x, double _y); 14 | Point2DPseudoMercator(Point2DTile); 15 | 16 | double x() const { return _x; } 17 | double y() const { return _y; } 18 | 19 | Point2DPseudoMercator operator-(const Point2DPseudoMercator& other) const; 20 | Point2DPseudoMercator operator+(const Point2DPseudoMercator& other) const; 21 | Point2DPseudoMercator operator/(double d) const; 22 | Point2DPseudoMercator operator*(double d) const; 23 | 24 | 25 | 26 | static QRectF getBounds(); 27 | 28 | 29 | Point2DTile toTile(int zoom); 30 | 31 | static const QString EPSG; 32 | private: 33 | //unit: meters 34 | double _x; 35 | double _y; 36 | }; 37 | 38 | #endif // POINT2DPSEUDOMERCATOR_H 39 | -------------------------------------------------------------------------------- /src/geometry/point2dtile.cpp: -------------------------------------------------------------------------------- 1 | #include "point2dtile.h" 2 | #include "point2dlatlon.h" 3 | #include "math.h" 4 | 5 | Point2DTile::Point2DTile(double x, double y, int zoom) : 6 | xp(x), yp(y), zoomp(zoom) 7 | { 8 | } 9 | 10 | Point2DTile::Point2DTile(Point2DLatLon latLon, int zoom): 11 | zoomp(zoom) 12 | { 13 | double tileX = (latLon.lon() + 180.0) / 360.0 * (1 << zoom); 14 | double latrad = latLon.lat() * M_PI/180.0; 15 | double tileY = (1.0 - asinh(tan(latrad)) / M_PI) / 2.0 * (1 << zoom); 16 | xp = tileX; 17 | yp = tileY; 18 | } 19 | 20 | void Point2DTile::changeZoom(int zoom) { 21 | int oldZoom = zoomp; 22 | zoomp = zoom; 23 | int zoom_delta = zoomp - oldZoom; 24 | xp *= pow(2, zoom_delta); 25 | yp *= pow(2, zoom_delta); 26 | } 27 | 28 | QString Point2DTile::to_istring() { 29 | QString pStr = "X" + QString::number(xi()) + "Y" + QString::number(yi()) + "Z" + QString::number(zoomp); 30 | return QString(pStr); 31 | } 32 | 33 | bool Point2DTile::isValid() { 34 | int max = 1 << zoomp; 35 | bool ret = xp >= 0 && xp < max && 36 | yp >= 0 && yp < max; 37 | return ret; 38 | } 39 | 40 | Point2DTile Point2DTile::childPoint(int i, int j) { 41 | Point2DTile child(xp*2+i, yp*2+j, zoomp+1); 42 | return child; 43 | } 44 | -------------------------------------------------------------------------------- /src/geometry/point2dtile.h: -------------------------------------------------------------------------------- 1 | #ifndef POINT2DTILE_H 2 | #define POINT2DTILE_H 3 | 4 | #include "utils.h" 5 | #include "QString" 6 | #include "QPointF" 7 | 8 | class Point2DLatLon; 9 | class TileProvider; 10 | 11 | class Point2DTile 12 | { 13 | 14 | public: 15 | Point2DTile(double x, double y, int zoom); 16 | Point2DTile(Point2DLatLon latLon, int zoom); 17 | 18 | double x() {return xp;} 19 | double y() {return yp;} 20 | int xi() {return static_cast(xp);} 21 | int yi() {return static_cast(yp);} 22 | 23 | int zoom() {return zoomp;} 24 | void setX(double x) {xp = x;} 25 | void setY(double y) {yp = y;} 26 | void setZoom(int zoom) { zoomp = zoom; } 27 | 28 | bool isValid(); 29 | 30 | QString to_istring(); 31 | void changeZoom(int zoom); 32 | Point2DTile childPoint(int i, int j); 33 | 34 | private: 35 | double xp; 36 | double yp; 37 | int zoomp; 38 | }; 39 | 40 | 41 | #endif // POINT2DTILE_H 42 | -------------------------------------------------------------------------------- /src/globalconfig.cpp: -------------------------------------------------------------------------------- 1 | #include "globalconfig.h" 2 | 3 | 4 | GlobalConfig* GlobalConfig::singleton = nullptr; 5 | 6 | GlobalConfig::GlobalConfig(QObject *parent) : QObject(parent) 7 | { 8 | 9 | } 10 | 11 | void GlobalConfig::setValue(const QString &key, const QVariant &value) { 12 | map[key] = value; 13 | } 14 | 15 | QVariant GlobalConfig::value(const QString &key, const QVariant &default_value) { 16 | if(map.contains(key)) { 17 | return map[key]; 18 | } else { 19 | return default_value; 20 | } 21 | } 22 | -------------------------------------------------------------------------------- /src/globalconfig.h: -------------------------------------------------------------------------------- 1 | #ifndef GLOBALCONFIG_H 2 | #define GLOBALCONFIG_H 3 | 4 | #include 5 | #include 6 | #include 7 | 8 | class GlobalConfig : public QObject 9 | { 10 | Q_OBJECT 11 | public: 12 | static GlobalConfig* get() { 13 | if(singleton == nullptr) { 14 | singleton = new GlobalConfig(); 15 | } 16 | return singleton; 17 | } 18 | 19 | void setValue(const QString &key, const QVariant &value); 20 | QVariant value(const QString &key, const QVariant &default_value=QVariant()); 21 | bool contains(const QString &key) { 22 | return map.contains(key); 23 | } 24 | 25 | signals: 26 | 27 | private: 28 | static GlobalConfig* singleton; 29 | explicit GlobalConfig(QObject *parent = nullptr); 30 | 31 | QMap map; 32 | 33 | 34 | 35 | }; 36 | 37 | #endif // GLOBALCONFIG_H 38 | -------------------------------------------------------------------------------- /src/pprzmain.h: -------------------------------------------------------------------------------- 1 | #ifndef PPRZMAIN_H 2 | #define PPRZMAIN_H 3 | 4 | #include 5 | #include 6 | 7 | enum LaunchTypes { 8 | DEFAULT, 9 | NORMAL, 10 | FLIGHTPLAN_EDIT, 11 | CONFIGURE, 12 | QUIT, 13 | }; 14 | 15 | class PprzMain : public QMainWindow 16 | { 17 | Q_OBJECT 18 | 19 | public: 20 | explicit PprzMain(QWidget *parent = nullptr); 21 | static LaunchTypes launch_type; 22 | static int const EXIT_CODE_REBOOT = -123456; 23 | void setupUi(int width, int height, QWidget* centralWidget); 24 | 25 | void setServerStatus(bool active); 26 | 27 | signals: 28 | void ready(); 29 | 30 | 31 | private: 32 | void newAC(QString ac_id); 33 | void removeAC(QString ac_id); 34 | void delete_ac(QString ac_id); 35 | 36 | void populate_menu(); 37 | 38 | QMenuBar *menu_bar; 39 | QToolBar *mainToolBar; 40 | QStatusBar *statusBar; 41 | 42 | QMenu* aircraftsTopMenu; 43 | QMap acMenus; 44 | QMap acActions; 45 | QLabel* serverStatusLed; 46 | }; 47 | 48 | 49 | #endif // PPRZMAIN_H 50 | -------------------------------------------------------------------------------- /src/tools/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | 2 | set(SOURCE ${SOURCE}) 3 | 4 | 5 | list(APPEND SOURCE 6 | ${CMAKE_CURRENT_SOURCE_DIR}/srtm_manager.cpp 7 | ${CMAKE_CURRENT_SOURCE_DIR}/coordinatestransform.cpp 8 | ${CMAKE_CURRENT_SOURCE_DIR}/dispatcher_ui.cpp 9 | ${CMAKE_CURRENT_SOURCE_DIR}/pprz_dispatcher.cpp 10 | ${CMAKE_CURRENT_SOURCE_DIR}/AircraftManager.cpp 11 | ${CMAKE_CURRENT_SOURCE_DIR}/units.cpp 12 | ${CMAKE_CURRENT_SOURCE_DIR}/watcher.cpp 13 | ) 14 | 15 | if(${SPEECH}) 16 | list(APPEND SOURCE ${CMAKE_CURRENT_SOURCE_DIR}/speaker.cpp) 17 | endif() 18 | 19 | if(${GRPC}) 20 | list(APPEND SOURCE ${CMAKE_CURRENT_SOURCE_DIR}/grpcconnector.cpp) 21 | endif() 22 | 23 | set(INC_DIRS ${INC_DIRS} ${CMAKE_CURRENT_SOURCE_DIR}) 24 | 25 | set(SOURCE ${SOURCE} PARENT_SCOPE) 26 | set(INC_DIRS ${INC_DIRS} PARENT_SCOPE) 27 | -------------------------------------------------------------------------------- /src/tools/coordinatestransform.h: -------------------------------------------------------------------------------- 1 | #ifndef COORDINATESTRANSFORM_H 2 | #define COORDINATESTRANSFORM_H 3 | 4 | //#pragma once 5 | 6 | #include 7 | #include 8 | #include "point2dlatlon.h" 9 | #include "point2dpseudomercator.h" 10 | #include "point2dtile.h" 11 | #include 12 | #include 13 | #include 14 | #include "PprzToolbox.h" 15 | #include "PprzApplication.h" 16 | 17 | class CoordinatesTransform : public PprzTool 18 | { 19 | public: 20 | 21 | CoordinatesTransform(PprzApplication* app, PprzToolbox* toolbox); 22 | 23 | static inline const QString TRANSFORM_WGS84_WEB_MERCATOR = "WGS84_WEB_MERCATOR"; 24 | static inline const QString TRANSFORM_NONE = "NO_TRANSFORM"; 25 | 26 | static CoordinatesTransform* get() { 27 | return pprzApp()->toolbox()->coordinatesTransform(); 28 | } 29 | 30 | 31 | ~CoordinatesTransform(); 32 | 33 | Point2DPseudoMercator WGS84_to_pseudoMercator(Point2DLatLon); 34 | Point2DLatLon pseudoMercator_to_WGS84(Point2DPseudoMercator); 35 | Point2DLatLon wgs84_from_scene(QPointF scenePoint, int zoom, int tile_size); 36 | 37 | Point2DLatLon relative_utm_to_wgs84(Point2DLatLon origin, double x, double y); 38 | void wgs84_to_relative_utm(Point2DLatLon origin, Point2DLatLon geo, double& x, double& y); 39 | Point2DLatLon ltp_to_wgs84(Point2DLatLon origin, double x, double y); 40 | void wgs84_to_ltp(Point2DLatLon origin, Point2DLatLon geo, double& x, double& y); 41 | Point2DLatLon utm_to_wgs84(double east, double north, int zone, bool isNorth); 42 | 43 | void distance_azimut(Point2DLatLon pt1, Point2DLatLon pt2, double& distance, double& azimut); 44 | 45 | void add_projector(QString name, QString source, QString target); 46 | 47 | PJ_COORD apply_transfrom(QString name, PJ_COORD in, PJ_DIRECTION direction=PJ_FWD); 48 | 49 | 50 | private: 51 | static QString utm_epsg(double lat, double lon); 52 | static QString utm_epsg(int zone, bool isNorth); 53 | 54 | PJ_CONTEXT* pj_context; 55 | QMap projectors; 56 | 57 | }; 58 | 59 | #endif // COORDINATESTRANSFORM_H 60 | -------------------------------------------------------------------------------- /src/tools/dispatcher_ui.cpp: -------------------------------------------------------------------------------- 1 | #include "dispatcher_ui.h" 2 | 3 | DispatcherUi::DispatcherUi(PprzApplication* app, PprzToolbox* toolbox) : PprzTool(app, toolbox), 4 | selected_ac_id("") 5 | { 6 | connect(this, &DispatcherUi::ac_selected, [=](QString ac_id){ 7 | selected_ac_id = ac_id; 8 | }); 9 | 10 | } 11 | -------------------------------------------------------------------------------- /src/tools/dispatcher_ui.h: -------------------------------------------------------------------------------- 1 | #ifndef UI_DISPATCHER_H 2 | #define UI_DISPATCHER_H 3 | 4 | #include 5 | #include "waypoint.h" 6 | #include "point2dlatlon.h" 7 | #include "PprzToolbox.h" 8 | #include "PprzApplication.h" 9 | 10 | class Setting; 11 | 12 | class DispatcherUi : public PprzTool 13 | { 14 | Q_OBJECT 15 | 16 | public: 17 | explicit DispatcherUi(PprzApplication* app, PprzToolbox* toolbox); 18 | static DispatcherUi* get() { 19 | return pprzApp()->toolbox()->dispatcherUi(); 20 | } 21 | 22 | QString getSelectedAcId() { return selected_ac_id;} 23 | 24 | signals: 25 | void ac_selected(QString); 26 | void ac_deleted(QString); 27 | void new_ac_config(QString); 28 | void move_waypoint_ui(Waypoint*, QString ac_id); //wp moved from UI 29 | void settingUpdated(QString ac_id, Setting*, float value); 30 | void mapRotated(double); // map view rotation in degrees 31 | void centerMap(Point2DLatLon pos); 32 | //void create_waypoint(Waypoint*); 33 | 34 | // GVF viewer signals 35 | void gvf_settingUpdated(QString ac_id, QVector *gvfViewer_config); 36 | void gvf_defaultFieldSettings(QString ac_id, int area, int xpts, int ypts); 37 | void gvf_zlimits(QString ac_id, float minz, float maxz); 38 | 39 | public slots: 40 | 41 | private: 42 | QString selected_ac_id; 43 | 44 | }; 45 | 46 | #endif // UI_DISPATCHER_H 47 | -------------------------------------------------------------------------------- /src/tools/grpcconnector.h: -------------------------------------------------------------------------------- 1 | #ifndef GRPCCONNECTOR_H 2 | #define GRPCCONNECTOR_H 3 | 4 | #include 5 | #include "PprzToolbox.h" 6 | #include "PprzApplication.h" 7 | #include 8 | #include 9 | #include "pprzgcs.grpc.pb.h" 10 | 11 | using grpc::Server; 12 | using grpc::Status; 13 | using grpc::ServerContext; 14 | 15 | namespace p = pprzgcs; 16 | 17 | 18 | class GRPCConnector : public PprzTool, public p::GCSService::Service 19 | { 20 | Q_OBJECT 21 | public: 22 | explicit GRPCConnector(PprzApplication* app, PprzToolbox* toolbox); 23 | static GRPCConnector* get() { 24 | return pprzApp()->toolbox()->connector(); 25 | } 26 | 27 | virtual void setToolbox(PprzToolbox* toolbox) override; 28 | 29 | Status LoadSRTM([[maybe_unused]] ServerContext* context, 30 | const p::SRTMRequest* request, p::SRTMReply* reply) override; 31 | Status CenterOn(grpc::ServerContext *context, 32 | const p::CenterOnRequest *request,p::CenterOnResponse *response) override; 33 | Status SetWidgetProperty(grpc::ServerContext *context, 34 | const p::WidgetProperty *request, ::google::protobuf::Empty *response) override; 35 | 36 | signals: 37 | void dl_srtm(); 38 | 39 | private: 40 | void runServer(); 41 | 42 | std::unique_ptr server; 43 | 44 | }; 45 | 46 | #endif // GRPCCONNECTOR_H 47 | -------------------------------------------------------------------------------- /src/tools/speaker.h: -------------------------------------------------------------------------------- 1 | #ifndef SPEAKER_H 2 | #define SPEAKER_H 3 | 4 | #include 5 | #include 6 | #include "PprzToolbox.h" 7 | #include "PprzApplication.h" 8 | #include "pprz_dispatcher.h" 9 | 10 | 11 | 12 | class Speaker : public PprzTool 13 | { 14 | Q_OBJECT 15 | public: 16 | explicit Speaker(PprzApplication* app, PprzToolbox* toolbox); 17 | void setToolbox(PprzToolbox* toolbox) override; 18 | void addSentence(QString txt, int priority=0, int validity=30); 19 | void registerMessage(QString name, QString text, int period, int expire, int priority, bool onChange, QString postprocessing); 20 | void setLocale(QString l); 21 | signals: 22 | 23 | public slots: 24 | void enableSpeech(bool s); 25 | 26 | private: 27 | 28 | struct Sentence { 29 | QString text; 30 | int priority; 31 | QTime expiration; 32 | }; 33 | 34 | struct Message { 35 | QString name; 36 | QString text; 37 | int timeout; 38 | int expire; 39 | int priority; 40 | bool onChange; 41 | QString postprocessing; 42 | }; 43 | 44 | 45 | void bindMessage(struct Message msg); 46 | void handleMsg(struct Message msg, QString sender, pprzlink::Message pprz_msg); 47 | 48 | template 49 | QString value_to_string(T val); 50 | 51 | QString value_to_string(double val); 52 | QString value_to_string(float val); 53 | QString value_to_string(QString val); 54 | 55 | QString postprocess(QString process, QString valstr, QString ac_id); 56 | 57 | template 58 | void make_sentence(struct Message msg, QString field, pprzlink::Message pprz_msg, QString ac_id); 59 | 60 | void say(); 61 | 62 | QTextToSpeech* tts; 63 | QString locale; 64 | 65 | QList sentences; 66 | QList messages; 67 | QList bids; 68 | QMap msg_times; 69 | QMap last_values; 70 | 71 | QTimer* timer; 72 | 73 | }; 74 | 75 | #endif // SPEAKER_H 76 | -------------------------------------------------------------------------------- /src/tools/srtm_manager.h: -------------------------------------------------------------------------------- 1 | #ifndef SRTM_MANAGER_H 2 | #define SRTM_MANAGER_H 3 | 4 | #include 5 | #include 6 | #include 7 | #include 8 | #include 9 | #include 10 | #include 11 | #include 12 | #include "PprzToolbox.h" 13 | #include "PprzApplication.h" 14 | 15 | using namespace std; 16 | 17 | class SRTMManager : public PprzTool 18 | { 19 | Q_OBJECT 20 | public: 21 | explicit SRTMManager(PprzApplication* app, PprzToolbox* toolbox); 22 | ~SRTMManager(); 23 | static SRTMManager* get() { 24 | return pprzApp()->toolbox()->srtmManager(); 25 | } 26 | 27 | optional get_elevation(double lat, double lon); 28 | void load_tiles(QList names, bool local_only=false); 29 | int load_tile(QString name, bool dl); 30 | QList get_tile_names(double _lat_min, double _lat_max, double _lon_min, double _lon_max); 31 | 32 | private slots: 33 | void handleReply(QNetworkReply *reply); 34 | 35 | private: 36 | QString get_tile_name(int lat, int lon); 37 | optional get_tile_region(QString name); 38 | 39 | static const QString srtm_url; 40 | 41 | map tiles; // key example: "N43E001" 42 | 43 | QNetworkAccessManager* manager; 44 | QNetworkDiskCache* diskCache; 45 | QList pending_downloads; 46 | }; 47 | 48 | 49 | class SRTMDialog : public QDialog{ 50 | Q_OBJECT 51 | public: 52 | explicit SRTMDialog(QList tiles_names, QWidget *parent = nullptr); 53 | 54 | signals: 55 | void tilesConfirmed(QList); 56 | 57 | protected: 58 | void keyPressEvent(QKeyEvent *e) override; 59 | }; 60 | 61 | #endif // SRTM_MANAGER_H 62 | -------------------------------------------------------------------------------- /src/tools/units.cpp: -------------------------------------------------------------------------------- 1 | #include "units.h" 2 | #include 3 | #include 4 | #include 5 | #include "iostream" 6 | #include 7 | #include "gcs_utils.h" 8 | 9 | using namespace std; 10 | 11 | Units::Units(PprzApplication* app, PprzToolbox* toolbox) : PprzTool(app, toolbox) 12 | { 13 | 14 | } 15 | 16 | void Units::setToolbox(PprzToolbox* toolbox) { 17 | PprzTool::setToolbox(toolbox); 18 | auto settings = getAppSettings(); 19 | auto filename = appConfig()->value("PAPARAZZI_HOME").toString() + "/var/units.xml"; 20 | 21 | 22 | QDomDocument doc; 23 | QFile f(filename); 24 | if(!f.open(QIODevice::ReadOnly)) { 25 | throw std::runtime_error("Error while loading unit file"); 26 | } 27 | doc.setContent(&f); 28 | f.close(); 29 | 30 | auto units_root = doc.firstChildElement("units"); 31 | for(auto unit=units_root.firstChildElement(); 32 | !unit.isNull(); 33 | unit=unit.nextSiblingElement()) { 34 | 35 | assert(unit.hasAttribute("from")); 36 | assert(unit.hasAttribute("to")); 37 | assert(unit.hasAttribute("coef")); 38 | auto from = unit.attribute("from"); 39 | auto to = unit.attribute("to"); 40 | auto _coef = unit.attribute("coef"); 41 | 42 | // auto _auto = unit.attribute("auto"); 43 | auto coef = _coef.toDouble(); 44 | QPair key(from, to); 45 | coefs[key] = coef; 46 | } 47 | 48 | 49 | } 50 | 51 | std::optional Units::getCoef(QString inputUnit, QString outputUnit) { 52 | QPair key(inputUnit, outputUnit); 53 | if(coefs.find(key) != coefs.end()) { 54 | return coefs[key]; 55 | } else { 56 | return std::nullopt; 57 | } 58 | } 59 | -------------------------------------------------------------------------------- /src/tools/units.h: -------------------------------------------------------------------------------- 1 | #ifndef UNITS_H 2 | #define UNITS_H 3 | #include 4 | #include 5 | #include "PprzToolbox.h" 6 | #include "PprzApplication.h" 7 | 8 | class Units : public PprzTool { 9 | public: 10 | explicit Units(PprzApplication* app, PprzToolbox* toolbox); 11 | static Units* get() { 12 | return pprzApp()->toolbox()->units(); 13 | } 14 | 15 | virtual void setToolbox(PprzToolbox* toolbox) override; 16 | 17 | std::optional getCoef(QString inputUnit, QString outputUnit); 18 | 19 | private: 20 | QMap, float> coefs; 21 | }; 22 | #endif // UNITS_H 23 | -------------------------------------------------------------------------------- /src/tools/watcher.cpp: -------------------------------------------------------------------------------- 1 | #include "watcher.h" 2 | 3 | Watcher::Watcher(PprzApplication* app, PprzToolbox* toolbox) : PprzTool(app, toolbox) 4 | { 5 | 6 | } 7 | 8 | void Watcher::setToolbox(PprzToolbox* toolbox) { 9 | PprzTool::setToolbox(toolbox); 10 | } 11 | 12 | -------------------------------------------------------------------------------- /src/tools/watcher.h: -------------------------------------------------------------------------------- 1 | #ifndef WATCHER_H 2 | #define WATCHER_H 3 | 4 | #include 5 | #include "PprzToolbox.h" 6 | #include "PprzApplication.h" 7 | #include "pprz_dispatcher.h" 8 | 9 | class Watcher : public PprzTool 10 | { 11 | Q_OBJECT 12 | public: 13 | explicit Watcher(PprzApplication* app, PprzToolbox* toolbox); 14 | void setToolbox(PprzToolbox* toolbox) override; 15 | 16 | signals: 17 | 18 | private: 19 | 20 | }; 21 | 22 | #endif // WATCHER_H 23 | -------------------------------------------------------------------------------- /src/uisignals.h: -------------------------------------------------------------------------------- 1 | #ifndef UISIGNALS_H 2 | #define UISIGNALS_H 3 | #include 4 | #include "pprzmessage.h" 5 | 6 | class Waypoint; 7 | 8 | class UiSignals : public virtual QObject 9 | { 10 | Q_OBJECT 11 | signals: 12 | void ac_selected(int); 13 | void create_waypoint(Waypoint*); 14 | }; 15 | 16 | #endif // UISIGNALS_H 17 | -------------------------------------------------------------------------------- /src/utils.h: -------------------------------------------------------------------------------- 1 | #ifndef UTILS_H 2 | #define UTILS_H 3 | 4 | #include 5 | #include 6 | 7 | 8 | //template 9 | //const T& clamp( const T& v, const T& lo, const T& hi ) 10 | //{ 11 | // assert( !(hi < lo) ); 12 | // return std::min(hi, std::max(v, lo)); 13 | //} 14 | 15 | 16 | #endif // UTILS_H 17 | -------------------------------------------------------------------------------- /src/widgets/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | 2 | set(SOURCE 3 | ${SOURCE} 4 | ${CMAKE_CURRENT_SOURCE_DIR}/strip.cpp 5 | ${CMAKE_CURRENT_SOURCE_DIR}/ac_selector.cpp 6 | ${CMAKE_CURRENT_SOURCE_DIR}/settings_viewer.cpp 7 | ${CMAKE_CURRENT_SOURCE_DIR}/pprzmap.cpp 8 | ${CMAKE_CURRENT_SOURCE_DIR}/pfd.cpp 9 | ${CMAKE_CURRENT_SOURCE_DIR}/listcontainer.cpp 10 | ${CMAKE_CURRENT_SOURCE_DIR}/mini_strip.cpp 11 | ${CMAKE_CURRENT_SOURCE_DIR}/flightplan_viewerv2.cpp 12 | ${CMAKE_CURRENT_SOURCE_DIR}/stackcontainer.cpp 13 | ${CMAKE_CURRENT_SOURCE_DIR}/layer_combo.cpp 14 | ${CMAKE_CURRENT_SOURCE_DIR}/widget_utils.cpp 15 | ${CMAKE_CURRENT_SOURCE_DIR}/pprzmap.ui 16 | ${CMAKE_CURRENT_SOURCE_DIR}/commands.cpp 17 | ${CMAKE_CURRENT_SOURCE_DIR}/gps_classic_viewer.cpp 18 | ${CMAKE_CURRENT_SOURCE_DIR}/flightplaneditor.ui 19 | ${CMAKE_CURRENT_SOURCE_DIR}/flightplaneditor.cpp 20 | ${CMAKE_CURRENT_SOURCE_DIR}/plotter.cpp 21 | ${CMAKE_CURRENT_SOURCE_DIR}/windindicator.cpp 22 | ${CMAKE_CURRENT_SOURCE_DIR}/link_status.cpp 23 | ${CMAKE_CURRENT_SOURCE_DIR}/gvf_viewer.cpp 24 | ${CMAKE_CURRENT_SOURCE_DIR}/chat.cpp 25 | ${CMAKE_CURRENT_SOURCE_DIR}/chat.ui 26 | ${CMAKE_CURRENT_SOURCE_DIR}/checklist.cpp 27 | ${CMAKE_CURRENT_SOURCE_DIR}/checklist.ui 28 | ) 29 | 30 | set(INC_DIRS ${INC_DIRS} ${CMAKE_CURRENT_SOURCE_DIR}) 31 | 32 | add_subdirectory(map) 33 | add_subdirectory(basics) 34 | 35 | set(SOURCE ${SOURCE} PARENT_SCOPE) 36 | set(INC_DIRS ${INC_DIRS} PARENT_SCOPE) 37 | -------------------------------------------------------------------------------- /src/widgets/ac_selector.h: -------------------------------------------------------------------------------- 1 | #ifndef AC_SELECTOR_H 2 | #define AC_SELECTOR_H 3 | 4 | #include 5 | #include 6 | #include 7 | #include 8 | #include 9 | 10 | class ACSelector : public QWidget, public Configurable 11 | { 12 | Q_OBJECT 13 | 14 | public: 15 | explicit ACSelector(QWidget *parent = nullptr); 16 | void configure(QDomElement) {}; 17 | 18 | QSize sizeHint() const; 19 | QSize minimumSizeHint() const; 20 | 21 | void removeAC(QString ac_id); 22 | 23 | protected: 24 | // virtual void enterEvent(QEvent* e); 25 | // virtual void leaveEvent(QEvent* e); 26 | virtual void paintEvent(QPaintEvent* e); 27 | virtual void mousePressEvent(QMouseEvent *e); 28 | virtual void mouseReleaseEvent(QMouseEvent *e); 29 | virtual void wheelEvent(QWheelEvent *event); 30 | 31 | private: 32 | void handleNewAC(QString ac_id); 33 | 34 | 35 | static int const ARROW_WIDTH = 20; 36 | 37 | QList ac_ids; 38 | QString current_ac_id; 39 | 40 | }; 41 | 42 | #endif // AC_SELECTOR_H 43 | -------------------------------------------------------------------------------- /src/widgets/basics/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | 2 | set(SOURCE 3 | ${SOURCE} 4 | ${CMAKE_CURRENT_SOURCE_DIR}/imagebutton.cpp 5 | ${CMAKE_CURRENT_SOURCE_DIR}/double_slider.cpp 6 | ${CMAKE_CURRENT_SOURCE_DIR}/switch.cpp 7 | ${CMAKE_CURRENT_SOURCE_DIR}/graphlabel.cpp 8 | ${CMAKE_CURRENT_SOURCE_DIR}/jaugelabel.cpp 9 | ${CMAKE_CURRENT_SOURCE_DIR}/colorlabel.cpp 10 | ${CMAKE_CURRENT_SOURCE_DIR}/flowlayout.cpp 11 | ${CMAKE_CURRENT_SOURCE_DIR}/mbpushbutton.cpp 12 | ${CMAKE_CURRENT_SOURCE_DIR}/lock_button.cpp 13 | ${CMAKE_CURRENT_SOURCE_DIR}/graphwidget.cpp 14 | ${CMAKE_CURRENT_SOURCE_DIR}/colorbar.cpp 15 | ${CMAKE_CURRENT_SOURCE_DIR}/chatbubble.cpp 16 | ${CMAKE_CURRENT_SOURCE_DIR}/chatbubble.ui 17 | ) 18 | 19 | set(INC_DIRS ${INC_DIRS} ${CMAKE_CURRENT_SOURCE_DIR}) 20 | 21 | set(SOURCE ${SOURCE} PARENT_SCOPE) 22 | set(INC_DIRS ${INC_DIRS} PARENT_SCOPE) 23 | -------------------------------------------------------------------------------- /src/widgets/basics/chatbubble.h: -------------------------------------------------------------------------------- 1 | #ifndef CHATBUBBLE_H 2 | #define CHATBUBBLE_H 3 | 4 | #include 5 | #include 6 | 7 | namespace Ui { 8 | class ChatBubble; 9 | } 10 | 11 | class ChatBubble : public QWidget 12 | { 13 | Q_OBJECT 14 | 15 | public: 16 | explicit ChatBubble(QString source, QString dest, QString msg, bool sent=false, QWidget *parent = nullptr); 17 | ~ChatBubble(); 18 | 19 | QString getSource() {return source;} 20 | QString getDest() {return dest;} 21 | QTime getTime() {return chat_time;} 22 | void addText(QString text); 23 | 24 | protected: 25 | bool eventFilter(QObject *obj, QEvent *ev) override; 26 | 27 | private: 28 | Ui::ChatBubble *ui; 29 | 30 | QString source; 31 | QString dest; 32 | QTime chat_time; 33 | }; 34 | 35 | #endif // CHATBUBBLE_H 36 | -------------------------------------------------------------------------------- /src/widgets/basics/colorbar.h: -------------------------------------------------------------------------------- 1 | #ifndef COLORBAR_H 2 | #define COLORBAR_H 3 | 4 | #include 5 | #include 6 | #include 7 | #include 8 | 9 | class ColorBar : public QWidget 10 | { 11 | Q_OBJECT 12 | public: 13 | explicit ColorBar(qreal bar_height = 20, QWidget *parent = nullptr); 14 | 15 | void set_zlimits(float minz, float maxz); 16 | QSize minimumSizeHint() const override; 17 | 18 | protected: 19 | void paintEvent(QPaintEvent* e) override; 20 | 21 | private: 22 | float max_value = 0; 23 | float min_value = 0; 24 | 25 | QColor min_color; 26 | QColor max_color; 27 | 28 | qreal bar_height; 29 | QSize minSize; 30 | }; 31 | 32 | #endif //COLORBAR_H 33 | -------------------------------------------------------------------------------- /src/widgets/basics/colorlabel.cpp: -------------------------------------------------------------------------------- 1 | #include "colorlabel.h" 2 | #include 3 | #include 4 | #include 5 | #include 6 | #include 7 | 8 | ColorLabel::ColorLabel(qreal radius, QWidget *parent) : QWidget(parent), 9 | text(""), brush(Qt::red), minSize(QSize(10, 10)), radius(radius) 10 | { 11 | 12 | } 13 | 14 | void ColorLabel::paintEvent(QPaintEvent *e) { 15 | (void)e; 16 | QPainter p(this); 17 | // Set bold font 18 | QFont font = p.font(); 19 | font.setBold(true); 20 | auto fm = QFontMetricsF(font); 21 | // Compute minimum widget size based of text size. 22 | auto txt_rect = fm.boundingRect(text != "" ? text:"00"); 23 | 24 | int minWidth = static_cast(ceil(txt_rect.width()))+6; 25 | int minHeigth = static_cast(ceil(txt_rect.height())); 26 | minSize = QSize(minWidth, minHeigth); 27 | setMinimumSize(minSize); 28 | 29 | // Draw background 30 | p.setPen(Qt::NoPen); 31 | p.setBrush(brush); 32 | p.drawRoundedRect(rect(), radius, radius); 33 | 34 | // Draw text 35 | p.setFont(font); 36 | p.setPen(Qt::black); 37 | p.drawText(rect(), Qt::AlignCenter, text); 38 | } 39 | 40 | QSize ColorLabel::minimumSizeHint() const 41 | { 42 | return minSize; 43 | } 44 | -------------------------------------------------------------------------------- /src/widgets/basics/colorlabel.h: -------------------------------------------------------------------------------- 1 | #ifndef COLORLABEL_H 2 | #define COLORLABEL_H 3 | 4 | #include 5 | 6 | class ColorLabel : public QWidget 7 | { 8 | Q_OBJECT 9 | public: 10 | explicit ColorLabel(qreal radius, QWidget *parent = nullptr); 11 | void setText(QString t) {text = t; update();} 12 | void setBrush(QBrush b) {brush = b; update();} 13 | void setMinSize(QSize s) {minSize = s;} 14 | 15 | QSize minimumSizeHint() const override; 16 | 17 | signals: 18 | 19 | public slots: 20 | 21 | protected: 22 | void paintEvent(QPaintEvent*) override; 23 | 24 | private: 25 | QString text; 26 | QBrush brush; 27 | QSize minSize; 28 | qreal radius; 29 | }; 30 | 31 | #endif // COLORLABEL_H 32 | -------------------------------------------------------------------------------- /src/widgets/basics/double_slider.cpp: -------------------------------------------------------------------------------- 1 | #include "double_slider.h" 2 | #include 3 | #include 4 | #include 5 | #include 6 | #include 7 | 8 | DoubleSlider::DoubleSlider(Qt::Orientation orientation, QWidget *parent) : QSlider(orientation, parent) 9 | { 10 | connect(this, &QSlider::valueChanged, this, &DoubleSlider::notifyValueChanged); 11 | } 12 | 13 | 14 | void DoubleSlider::notifyValueChanged(int value) { 15 | double doubleValue = value * step + min; 16 | emit doubleValueChanged(doubleValue); 17 | } 18 | 19 | 20 | void DoubleSlider::setDoubleRange(double mi, double ma, double sp) { 21 | min = mi; 22 | max = ma; 23 | step = sp; 24 | int nb_steps = ceil((max - min) / step); 25 | setRange(0, nb_steps); 26 | if(nb_steps < 20) { 27 | setTickPosition(QSlider::TicksBelow); 28 | } 29 | } 30 | 31 | void DoubleSlider::setDoubleValue(double v) { 32 | setValue((v - min)/step); 33 | } 34 | 35 | double DoubleSlider::doubleValue() { 36 | return value()*step + min; 37 | } 38 | 39 | void DoubleSlider::sliderChange(QAbstractSlider::SliderChange change) 40 | { 41 | QSlider::sliderChange(change); 42 | 43 | if (change == QAbstractSlider::SliderValueChange ) 44 | { 45 | QStyleOptionSlider opt; 46 | initStyleOption(&opt); 47 | } 48 | } 49 | 50 | void DoubleSlider::wheelEvent(QWheelEvent* e) { 51 | if(e->angleDelta().y() > 0) { 52 | setValue(value()+1); 53 | } else { 54 | setValue(value()-1); 55 | } 56 | e->accept(); 57 | } 58 | -------------------------------------------------------------------------------- /src/widgets/basics/double_slider.h: -------------------------------------------------------------------------------- 1 | #ifndef DOUBLE_SLIDER_H 2 | #define DOUBLE_SLIDER_H 3 | 4 | #include 5 | #include 6 | 7 | class DoubleSlider : public QSlider 8 | { 9 | Q_OBJECT 10 | public: 11 | explicit DoubleSlider(Qt::Orientation orientation, QWidget *parent = nullptr); 12 | 13 | void setDoubleRange(double min, double max, double step); 14 | double doubleValue(); 15 | void setDoubleValue(double value); 16 | 17 | signals: 18 | void doubleValueChanged(double value); 19 | 20 | public slots: 21 | 22 | protected: 23 | virtual void sliderChange(SliderChange change) override; 24 | virtual void wheelEvent(QWheelEvent *e) override; 25 | 26 | private slots: 27 | void notifyValueChanged(int value); 28 | 29 | private: 30 | double min; 31 | double max; 32 | double step; 33 | }; 34 | 35 | #endif // DOUBLE_SLIDER_H 36 | -------------------------------------------------------------------------------- /src/widgets/basics/graphlabel.h: -------------------------------------------------------------------------------- 1 | #ifndef GRAPHLABEL_H 2 | #define GRAPHLABEL_H 3 | 4 | #include 5 | #include 6 | 7 | class GraphLabel : public QWidget 8 | { 9 | Q_OBJECT 10 | public: 11 | explicit GraphLabel(QWidget *parent = nullptr); 12 | explicit GraphLabel(double min, double max, QWidget *parent = nullptr); 13 | 14 | void pushData(double value); 15 | void setDualText(bool d) {dual_text = d;} 16 | void setSecondayText(QString t) {secondary_text = t;} 17 | void setPrecision(int p) {precision = p;} 18 | void setUnit(QString u) {unit = u;} 19 | 20 | void setIndicator(bool i) {indicator = i;} 21 | void setIndicatorAngle(double angle) {indicator_angle = angle;} 22 | 23 | 24 | QSize minimumSizeHint() const override; 25 | 26 | protected: 27 | void paintEvent(QPaintEvent*) override; 28 | //void enterEvent(QEvent*) override; 29 | 30 | signals: 31 | 32 | public slots: 33 | 34 | private: 35 | QBrush brushTop, brushBottom; 36 | double timespan; // total time the graph represent (in seconds) 37 | double min, max; 38 | 39 | QList> data; 40 | QString unit; 41 | 42 | int precision; 43 | 44 | bool dual_text; 45 | QString secondary_text; 46 | 47 | bool indicator; 48 | double indicator_angle; 49 | }; 50 | 51 | #endif // GRAPHLABEL_H 52 | -------------------------------------------------------------------------------- /src/widgets/basics/graphwidget.h: -------------------------------------------------------------------------------- 1 | #ifndef GRAPHWIDGET_H 2 | #define GRAPHWIDGET_H 3 | 4 | #include 5 | 6 | class GraphWidget : public QWidget 7 | { 8 | Q_OBJECT 9 | public: 10 | 11 | struct DataPoint { 12 | double value; 13 | QTime time; 14 | }; 15 | 16 | struct Params { 17 | double max; 18 | double min; 19 | bool autoscale; 20 | double scale; 21 | }; 22 | 23 | explicit GraphWidget(QWidget *parent = nullptr); 24 | 25 | void setParams(struct Params p) { 26 | if(p.min > p.max) { 27 | auto min = p.max; 28 | p.max = p.min; 29 | p.min = min; 30 | } 31 | params = p; 32 | if(p.autoscale == true && !data.isEmpty()) { 33 | params.min = data.last().value; 34 | params.max = params.min; 35 | } 36 | } 37 | struct Params getParams() {return params;} 38 | void setAutoscale(bool a) { 39 | auto new_params = params; 40 | new_params.autoscale = a; 41 | params = new_params; 42 | } 43 | 44 | void setHistory(int h) {history = h; update();} 45 | int getHistory() {return history;} 46 | void pushData(double d); 47 | void clearData(); 48 | 49 | QSize minimumSizeHint() const override; 50 | 51 | protected: 52 | void paintEvent(QPaintEvent*) override; 53 | void mousePressEvent(QMouseEvent *event) override; 54 | void mouseReleaseEvent(QMouseEvent *event) override; 55 | void mouseDoubleClickEvent(QMouseEvent *event) override; 56 | void mouseMoveEvent(QMouseEvent *event) override; 57 | void leaveEvent(QEvent *event) override; 58 | void wheelEvent(QWheelEvent *event) override; 59 | 60 | signals: 61 | void autoscaleChanged(bool); 62 | 63 | private: 64 | struct Params params; 65 | 66 | QList data; 67 | int history; 68 | 69 | QPoint mousePos; 70 | 71 | std::function val_of_y; 72 | double val_last_move; 73 | bool moving; 74 | int wheelAccumulator; 75 | }; 76 | 77 | #endif // GRAPHWIDGET_H 78 | -------------------------------------------------------------------------------- /src/widgets/basics/imagebutton.cpp: -------------------------------------------------------------------------------- 1 | #include "imagebutton.h" 2 | #include 3 | #include 4 | #include 5 | #include 6 | #include 7 | 8 | ImageButton::ImageButton(QIcon normal, QSize size, bool mask, QWidget *parent) : QPushButton(parent) 9 | { 10 | icon_normal = normal; 11 | setIcon(icon_normal); 12 | setIconSize(size); 13 | 14 | if(mask) { 15 | QPixmap p = icon().pixmap(iconSize()); 16 | setMask(p.mask()); 17 | } 18 | } 19 | 20 | void ImageButton::enterEvent(QEvent* e) { 21 | QPushButton::enterEvent( e ); 22 | if(icon_hover.isNull()) { 23 | setIcon(icon_normal); 24 | } else { 25 | setIcon(icon_hover); 26 | } 27 | } 28 | 29 | void ImageButton::leaveEvent(QEvent* e) { 30 | QPushButton::leaveEvent( e ); 31 | setIcon(icon_normal); 32 | } 33 | 34 | void ImageButton::mousePressEvent(QMouseEvent *e) { 35 | QPushButton::mousePressEvent(e); 36 | QPushButton::enterEvent( e ); 37 | if(icon_pressed.isNull()) { 38 | setIcon(icon_normal); 39 | } else { 40 | setIcon(icon_pressed); 41 | } 42 | } 43 | 44 | void ImageButton::mouseReleaseEvent(QMouseEvent *e) { 45 | QPushButton::mouseReleaseEvent(e); 46 | if(icon_hover.isNull()) { 47 | setIcon(icon_normal); 48 | } else { 49 | setIcon(icon_hover); 50 | } 51 | } 52 | 53 | void ImageButton::paintEvent(QPaintEvent* e) { 54 | (void)e; 55 | QPainter painter(this); 56 | icon().paint(&painter,rect()); 57 | } 58 | -------------------------------------------------------------------------------- /src/widgets/basics/imagebutton.h: -------------------------------------------------------------------------------- 1 | #ifndef IMAGEBUTTON_H 2 | #define IMAGEBUTTON_H 3 | 4 | #include 5 | #include 6 | #include 7 | 8 | class ImageButton : public QPushButton 9 | { 10 | Q_OBJECT 11 | public: 12 | explicit ImageButton(QIcon normal, QSize size, bool mask, QWidget *parent = nullptr); 13 | 14 | void setNormalIcon(QIcon ic) {icon_normal = ic;} 15 | void setHoverIcon(QIcon ic) {icon_hover = ic;} 16 | void setPressedIcon(QIcon ic) {icon_pressed = ic;} 17 | 18 | protected: 19 | virtual void enterEvent(QEvent* e); 20 | virtual void leaveEvent(QEvent* e); 21 | virtual void paintEvent(QPaintEvent* e); 22 | virtual void mousePressEvent(QMouseEvent *e); 23 | virtual void mouseReleaseEvent(QMouseEvent *e); 24 | 25 | signals: 26 | 27 | public slots: 28 | 29 | private: 30 | QIcon icon_normal; 31 | QIcon icon_hover; 32 | QIcon icon_pressed; 33 | }; 34 | 35 | #endif // IMAGEBUTTON_H 36 | -------------------------------------------------------------------------------- /src/widgets/basics/jaugelabel.cpp: -------------------------------------------------------------------------------- 1 | #include "jaugelabel.h" 2 | #include 3 | #include 4 | #include 5 | 6 | JaugeLabel::JaugeLabel(QWidget *parent) : JaugeLabel(0, 1, "%", parent) 7 | { 8 | } 9 | 10 | JaugeLabel::JaugeLabel(double min, double max, QString unit, QWidget *parent) : 11 | QWidget(parent), min(min), max(max), unit(unit), precision(2), minSize(20,10) 12 | { 13 | brushBackEnabled = QColor(0xffa500); 14 | brushLeft = QColor(0x7ef17e); 15 | brushBackDisabled = Qt::red; 16 | } 17 | 18 | QSize JaugeLabel::minimumSizeHint() const 19 | { 20 | return minSize; 21 | //return QSize(60, 18); 22 | } 23 | 24 | void JaugeLabel::paintEvent(QPaintEvent *e) { 25 | (void)e; 26 | QPainter p(this); 27 | p.setPen(Qt::NoPen); 28 | 29 | if(status) { 30 | p.setBrush(brushBackEnabled); 31 | } else { 32 | p.setBrush(brushBackDisabled); 33 | } 34 | p.drawRect(rect()); 35 | 36 | 37 | 38 | p.setBrush(brushLeft); 39 | int x = static_cast(std::clamp((value - min) / (max - min), 0., 1.) * rect().width()); 40 | p.drawRect(0, 0, x, rect().height()); 41 | 42 | 43 | 44 | QFont font = p.font(); 45 | font.setPointSize(12); 46 | font.setBold(true); 47 | p.setFont(font); 48 | p.setPen(Qt::black); 49 | QString txt = QString::number(value, 'f', precision) + unit; 50 | p.drawText(rect(), Qt::AlignCenter, txt); 51 | 52 | auto fm = QFontMetricsF(font); 53 | // Compute minimum widget size based of text size. 54 | auto txt_rect = fm.boundingRect(txt); 55 | minSize = QSize(static_cast(txt_rect.width())+6, static_cast(txt_rect.height())); 56 | setMinimumSize(minSize); 57 | 58 | } 59 | -------------------------------------------------------------------------------- /src/widgets/basics/jaugelabel.h: -------------------------------------------------------------------------------- 1 | #ifndef JAUGELABEL_H 2 | #define JAUGELABEL_H 3 | 4 | #include 5 | 6 | class JaugeLabel : public QWidget 7 | { 8 | Q_OBJECT 9 | public: 10 | explicit JaugeLabel(QWidget *parent = nullptr); 11 | explicit JaugeLabel(double min, double max, QString unit, QWidget *parent = nullptr); 12 | QSize minimumSizeHint() const override; 13 | 14 | 15 | void setValue(double v) {value = v; update();} 16 | void setStatus(bool s) {status = s; update();} 17 | void setPrecision(int p) {precision = p;} 18 | 19 | protected: 20 | void paintEvent(QPaintEvent*) override; 21 | 22 | private: 23 | QBrush brushLeft; 24 | QBrush brushBackEnabled; 25 | QBrush brushBackDisabled; 26 | double min, max; 27 | QString unit; 28 | int precision; 29 | 30 | double value; 31 | bool status; 32 | 33 | QSize minSize; 34 | 35 | }; 36 | 37 | #endif // JAUGELABEL_H 38 | -------------------------------------------------------------------------------- /src/widgets/basics/lock_button.h: -------------------------------------------------------------------------------- 1 | #ifndef LOCK_BUTTON_H 2 | #define LOCK_BUTTON_H 3 | 4 | #include 5 | #include 6 | #include 7 | #include 8 | #include 9 | 10 | class LockButton : public QWidget 11 | { 12 | Q_OBJECT 13 | Q_PROPERTY(QColor color_hover MEMBER m_color_hover DESIGNABLE true) 14 | Q_PROPERTY(QColor color_idle MEMBER m_color_idle DESIGNABLE true) 15 | Q_PROPERTY(QColor color_pressed MEMBER m_color_pressed DESIGNABLE true) 16 | Q_PROPERTY(int size READ getSizeProperty WRITE setSizeProperty DESIGNABLE true) 17 | public: 18 | explicit LockButton(QIcon icon, QWidget *parent = nullptr); 19 | void setSizeProperty(int s) {setSize(QSize(s,s));} 20 | int getSizeProperty() {return _size.width();} 21 | 22 | QSize sizeHint() const; 23 | QSize minimumSizeHint() const; 24 | 25 | void setActive(bool a) { active = a; repaint();} 26 | bool isActive() {return active;} 27 | bool isLocked(){return _locked;} 28 | void setWidget(QWidget* w) {_widget = w;} 29 | QWidget* widget(){return _widget;} 30 | void setSize(QSize s); 31 | void setActiveSide(bool activeLeft); 32 | 33 | protected: 34 | virtual void enterEvent(QEvent* e); 35 | virtual void leaveEvent(QEvent* e); 36 | virtual void paintEvent(QPaintEvent* e); 37 | virtual void mousePressEvent(QMouseEvent *e); 38 | virtual void mouseReleaseEvent(QMouseEvent *e); 39 | 40 | signals: 41 | void clicked(bool); 42 | void locked(bool); 43 | 44 | public slots: 45 | 46 | private: 47 | 48 | enum State { 49 | IDLE, 50 | HOVER, 51 | PRESSED 52 | }; 53 | 54 | State state; 55 | 56 | QSize _size; 57 | QMargins icon_margins; 58 | 59 | QIcon icon; 60 | QIcon icon_lock; 61 | QIcon icon_unlocked; 62 | bool activeSide; 63 | 64 | bool _locked; 65 | bool active; 66 | 67 | QColor m_color_idle; 68 | QColor m_color_hover; 69 | QColor m_color_pressed; 70 | 71 | QRect lock_rect; 72 | QRect active_rect; 73 | 74 | QWidget* _widget; 75 | }; 76 | 77 | #endif // LOCK_BUTTON_H 78 | -------------------------------------------------------------------------------- /src/widgets/basics/mbpushbutton.cpp: -------------------------------------------------------------------------------- 1 | #include "mbpushbutton.h" 2 | #include 3 | #include 4 | 5 | MbPushButton::MbPushButton(QWidget *parent) : QPushButton(parent) 6 | { 7 | 8 | } 9 | 10 | MbPushButton::MbPushButton(QString txt, QWidget *parent) : QPushButton (txt, parent) 11 | { 12 | 13 | } 14 | 15 | 16 | void MbPushButton::mousePressEvent(QMouseEvent *e) { 17 | QPushButton::mousePressEvent(e); 18 | } 19 | 20 | void MbPushButton::mouseReleaseEvent(QMouseEvent *e) { 21 | QPushButton::mouseReleaseEvent(e); 22 | if(e->button() == Qt::RightButton) { 23 | emit rightClicked(); 24 | } 25 | } 26 | 27 | void MbPushButton::mouseMoveEvent(QMouseEvent *e) { 28 | QPushButton::mouseMoveEvent(e); 29 | } 30 | 31 | void MbPushButton::enterEvent(QEvent *event) { 32 | emit enter(); 33 | QPushButton::enterEvent(event); 34 | } 35 | 36 | void MbPushButton::leaveEvent(QEvent *event) { 37 | emit leave(); 38 | QPushButton::leaveEvent(event); 39 | } 40 | -------------------------------------------------------------------------------- /src/widgets/basics/mbpushbutton.h: -------------------------------------------------------------------------------- 1 | #ifndef MBPUSHBUTTON_H 2 | #define MBPUSHBUTTON_H 3 | 4 | #include 5 | #include 6 | 7 | class MbPushButton : public QPushButton 8 | { 9 | Q_OBJECT 10 | public: 11 | explicit MbPushButton(QWidget *parent = nullptr); 12 | explicit MbPushButton(QString txt, QWidget *parent = nullptr); 13 | 14 | protected: 15 | void mousePressEvent(QMouseEvent *e); 16 | void mouseReleaseEvent(QMouseEvent *e); 17 | void mouseMoveEvent(QMouseEvent *e); 18 | void enterEvent(QEvent *event); 19 | void leaveEvent(QEvent *event); 20 | 21 | signals: 22 | void rightClicked(); 23 | void enter(); 24 | void leave(); 25 | 26 | public slots: 27 | }; 28 | 29 | #endif // MBPUSHBUTTON_H 30 | -------------------------------------------------------------------------------- /src/widgets/basics/switch.cpp: -------------------------------------------------------------------------------- 1 | #include "switch.h" 2 | 3 | Switch::Switch(QWidget *parent) : QAbstractButton(parent), 4 | _opacity(0.000), 5 | _height(16), 6 | _margin(3) 7 | { 8 | setOffset(_height / 2); 9 | _y = _height / 2; 10 | setBrush(QColor("#009688")); 11 | setCheckable(true); 12 | } 13 | 14 | Switch::Switch(const QBrush &brush, QWidget *parent) : QAbstractButton(parent), 15 | _opacity(0.000), 16 | _height(16), 17 | _margin(3) 18 | { 19 | setOffset(_height / 2); 20 | _y = _height / 2; 21 | setBrush(brush); 22 | setCheckable(true); 23 | } 24 | 25 | void Switch::paintEvent(QPaintEvent *e) { 26 | (void)e; 27 | QPainter p(this); 28 | p.setPen(Qt::NoPen); 29 | if (isEnabled()) { 30 | setOffset(isChecked() ? width() - (_height) : _height / 2); 31 | p.setBrush(isChecked() ? brush() : Qt::black); 32 | p.setOpacity(isChecked() ? 0.5 : 0.38); 33 | p.setRenderHint(QPainter::Antialiasing, true); 34 | p.drawRoundedRect(QRect(_margin, _margin, width() - 2 * _margin, height() - 2 * _margin), 8.0, 8.0); 35 | p.setBrush(isChecked() ? brush() : QBrush("#d5d5d5")); 36 | p.setOpacity(1.0); 37 | p.drawEllipse(QRectF(offset() - (_height / 2), _y - (_height / 2), height(), height())); 38 | } else { 39 | p.setBrush(Qt::black); 40 | p.setOpacity(0.12); 41 | p.drawRoundedRect(QRect(_margin, _margin, width() - 2 * _margin, height() - 2 * _margin), 8.0, 8.0); 42 | p.setOpacity(1.0); 43 | p.setBrush(QColor("#BDBDBD")); 44 | p.drawEllipse(QRectF(offset() - (_height / 2), _y - (_height / 2), height(), height())); 45 | } 46 | } 47 | 48 | void Switch::enterEvent(QEvent *e) { 49 | setCursor(Qt::PointingHandCursor); 50 | QAbstractButton::enterEvent(e); 51 | } 52 | 53 | QSize Switch::sizeHint() const { 54 | return QSize(2 * (_height + _margin), _height + 2 * _margin); 55 | } 56 | -------------------------------------------------------------------------------- /src/widgets/basics/switch.h: -------------------------------------------------------------------------------- 1 | #ifndef SWITCH_H 2 | #define SWITCH_H 3 | 4 | #include 5 | 6 | class Switch : public QAbstractButton { 7 | Q_OBJECT 8 | Q_PROPERTY(int offset READ offset WRITE setOffset) 9 | Q_PROPERTY(QBrush brush READ brush WRITE setBrush) 10 | 11 | public: 12 | Switch(QWidget* parent = nullptr); 13 | Switch(const QBrush& brush, QWidget* parent = nullptr); 14 | 15 | QSize sizeHint() const override; 16 | 17 | QBrush brush() const { 18 | return _brush; 19 | } 20 | void setBrush(const QBrush &brsh) { 21 | _brush = brsh; 22 | } 23 | 24 | int offset() const { 25 | return _x; 26 | } 27 | void setOffset(int o) { 28 | _x = o; 29 | update(); 30 | } 31 | 32 | protected: 33 | void paintEvent(QPaintEvent*) override; 34 | void enterEvent(QEvent*) override; 35 | 36 | private: 37 | qreal _opacity; 38 | int _x, _y, _height, _margin; 39 | QBrush _brush; 40 | }; 41 | 42 | #endif // SWITCH_H 43 | -------------------------------------------------------------------------------- /src/widgets/chat.h: -------------------------------------------------------------------------------- 1 | #ifndef CHAT_H 2 | #define CHAT_H 3 | 4 | #include 5 | 6 | namespace Ui { 7 | class Chat; 8 | } 9 | 10 | class Chat : public QFrame 11 | { 12 | Q_OBJECT 13 | 14 | public: 15 | explicit Chat(QWidget *parent = nullptr); 16 | ~Chat(); 17 | 18 | private: 19 | 20 | void onSend(); 21 | //void onNewMessage(); 22 | void addMessage(QString txt, QString source, QString dst=QString(), bool sent=false); 23 | 24 | void onNewAircraft(QString ac_id); 25 | void onAcDeleted(QString ac_id); 26 | 27 | QString chat_id; 28 | 29 | Ui::Chat *ui; 30 | }; 31 | 32 | #endif // CHAT_H 33 | -------------------------------------------------------------------------------- /src/widgets/checklist.h: -------------------------------------------------------------------------------- 1 | #ifndef CHECKLIST_H 2 | #define CHECKLIST_H 3 | 4 | #include 5 | #include "airframe.h" 6 | 7 | namespace Ui { 8 | class Checklist; 9 | } 10 | 11 | class Checklist : public QFrame 12 | { 13 | Q_OBJECT 14 | 15 | public: 16 | explicit Checklist(QString ac_id, QWidget *parent = nullptr); 17 | ~Checklist(); 18 | 19 | private: 20 | void sendMessage(QString ac_id, ChecklistItem *item); 21 | 22 | QString pprzlink_id; 23 | Ui::Checklist *ui; 24 | }; 25 | 26 | #endif // CHECKLIST_H 27 | -------------------------------------------------------------------------------- /src/widgets/checklist.ui: -------------------------------------------------------------------------------- 1 | 2 | 3 | Checklist 4 | 5 | 6 | 7 | 0 8 | 0 9 | 350 10 | 30 11 | 12 | 13 | 14 | 15 | 350 16 | 30 17 | 18 | 19 | 20 | Form 21 | 22 | 23 | QFrame::StyledPanel 24 | 25 | 26 | QFrame::Sunken 27 | 28 | 29 | 30 | 9 31 | 32 | 33 | 34 | 35 | font-weight:bold; 36 | 37 | 38 | Checklist 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | -------------------------------------------------------------------------------- /src/widgets/commands.h: -------------------------------------------------------------------------------- 1 | #ifndef COMMANDS_H 2 | #define COMMANDS_H 3 | 4 | #include 5 | #include "setting.h" 6 | #include "pprz_dispatcher.h" 7 | 8 | class Commands : public QWidget 9 | { 10 | Q_OBJECT 11 | public: 12 | explicit Commands(QString ac_id, QWidget *parent = nullptr); 13 | 14 | signals: 15 | 16 | public slots: 17 | 18 | protected: 19 | void paintEvent(QPaintEvent*) override; 20 | 21 | private: 22 | void addFlightPlanButtons(QGridLayout* fp_buttons_layout); 23 | void addSettingsButtons(QGridLayout* settings_buttons_layout); 24 | void addSpecialCommands(QGridLayout* special_commands_layout); 25 | void addCommandButton(QGridLayout*, QString icon, int row, int col, std::function callback, QString tootltip=""); 26 | 27 | void updateTargetAlt(pprzlink::Message msg); 28 | 29 | QString ac_id; 30 | 31 | float target_alt; 32 | }; 33 | 34 | #endif // COMMANDS_H 35 | -------------------------------------------------------------------------------- /src/widgets/flightplan_viewerv2.h: -------------------------------------------------------------------------------- 1 | #ifndef FLIGHTPLAN_VIEWERV2_H 2 | #define FLIGHTPLAN_VIEWERV2_H 3 | 4 | #include 5 | #include 6 | #include 7 | #include 8 | #include "pprz_dispatcher.h" 9 | 10 | class FlightPlanViewerV2 : public QTabWidget 11 | { 12 | Q_OBJECT 13 | public: 14 | explicit FlightPlanViewerV2(QString ac_id, QWidget *parent = nullptr); 15 | 16 | signals: 17 | 18 | public slots: 19 | 20 | private: 21 | void handleNavStatus(); 22 | void updateNavStatus(uint8_t cur_block, uint8_t cur_stage); 23 | 24 | QWidget* make_blocks_tab(); 25 | QString ac_id; 26 | uint8_t current_block, current_stage; 27 | 28 | QList block_labels; 29 | 30 | QString labels_stylesheet; 31 | }; 32 | 33 | #endif // FLIGHTPLAN_VIEWERV2_H 34 | -------------------------------------------------------------------------------- /src/widgets/flightplaneditor.h: -------------------------------------------------------------------------------- 1 | #ifndef FLIGHTPLANEDITOR_H 2 | #define FLIGHTPLANEDITOR_H 3 | 4 | #include 5 | #include 6 | #include "waypoint.h" 7 | 8 | namespace Ui { 9 | class FlightPlanEditor; 10 | } 11 | 12 | struct AttributeDef { 13 | const xmlChar* name; 14 | bool required; 15 | }; 16 | 17 | class FlightPlanEditor : public QWidget 18 | { 19 | Q_OBJECT 20 | public: 21 | explicit FlightPlanEditor(QString ac_id, QWidget *parent = nullptr); 22 | ~FlightPlanEditor(); 23 | 24 | int parse(QString filename); 25 | 26 | bool validate(); 27 | QByteArray output(); 28 | 29 | signals: 30 | void waypointEdited(Waypoint*); 31 | 32 | private: 33 | Ui::FlightPlanEditor *ui; 34 | 35 | static void applyRecursive(QTreeWidgetItem* item, std::function f); 36 | 37 | void onItemClicked(QTreeWidgetItem *item, int column); 38 | void onItemDoubleClicked(QTreeWidgetItem *item, int column); 39 | void onAttributeChanged(QTreeWidgetItem *item, int column); 40 | void onNavStatus(); 41 | 42 | void onMoveWaypointUi(Waypoint*, QString ac_id); 43 | void onWaypointAdded(Waypoint*, QString ac_id); 44 | 45 | QTreeWidgetItem* populate(xmlNodePtr node, QTreeWidgetItem* parent=nullptr, QTreeWidgetItem* prev=nullptr); 46 | 47 | void openElementsContextMenu(QPoint pos); 48 | void openAttributesContextMenu(QPoint pos); 49 | void onArrowClicked(bool up); 50 | 51 | QString sumaryFromNode(xmlNodePtr node); 52 | 53 | QList attributeDefs(const xmlChar* nodeName); 54 | QStringList elementDefs(xmlElementContentPtr c); 55 | 56 | QString ac_id; 57 | 58 | xmlDocPtr doc; 59 | xmlDtdPtr dtd; 60 | 61 | QMap nodes; 62 | QMap attributes_nodes; 63 | QMap waypoints; 64 | QMap blocks; 65 | 66 | uint8_t last_block; 67 | 68 | QTreeWidgetItem* waypoints_item; 69 | 70 | bool readOnly; 71 | 72 | }; 73 | 74 | #endif // FLIGHTPLANEDITOR_H 75 | -------------------------------------------------------------------------------- /src/widgets/gps_classic_viewer.h: -------------------------------------------------------------------------------- 1 | #ifndef GPS_CLASSIC_VIEWER_H 2 | #define GPS_CLASSIC_VIEWER_H 3 | 4 | #include 5 | 6 | class GPSClassicViewer : public QWidget 7 | { 8 | Q_OBJECT 9 | public: 10 | explicit GPSClassicViewer(QString ac_id, QWidget *parent = nullptr); 11 | 12 | QSize sizeHint() const; 13 | QSize minimumSizeHint() const; 14 | 15 | protected: 16 | void paintEvent(QPaintEvent *event); 17 | virtual void mousePressEvent(QMouseEvent *event); 18 | 19 | signals: 20 | 21 | public slots: 22 | 23 | private: 24 | 25 | struct SvInfo { 26 | int id; 27 | int flags; 28 | int cno; 29 | int age; 30 | }; 31 | 32 | std::tuple
PprzGCS is a ground control station for Paparazzi UAV.