diff --git a/.gitignore b/.gitignore index cddbe379c..ea04db8b7 100644 --- a/.gitignore +++ b/.gitignore @@ -84,3 +84,5 @@ build qopenhd.qmltypes qopenhd_metatypes.json qopenhd_qmltyperegistrations.cpp + +CMakeLists.txt.user diff --git a/CMakeLists.txt b/CMakeLists.txt new file mode 100644 index 000000000..4b1022583 --- /dev/null +++ b/CMakeLists.txt @@ -0,0 +1,111 @@ +cmake_minimum_required(VERSION 3.16) + +project(QOpenHDProject VERSION 0.1 LANGUAGES CXX) + +set(CMAKE_CXX_STANDARD 17) +set(CMAKE_CXX_STANDARD_REQUIRED ON) + +find_package(Qt6 6.5 REQUIRED COMPONENTS Core) +find_package(Qt6 6.5 REQUIRED COMPONENTS Quick) +find_package(Qt6 6.5 REQUIRED COMPONENTS Gui) +find_package(Qt6 6.5 REQUIRED COMPONENTS Widgets) + +qt_standard_project_setup(REQUIRES 6.5) + +qt_add_executable(QOpenHDApp + app/main.cpp + # + app/adsb/adsbvehicle.cpp + app/adsb/adsbvehiclemanager.cpp + app/adsb/qmlobjectlistmodel.cpp + # + app/util/WorkaroundMessageBox.cpp + app/util/mousehelper.cpp + app/util/qopenhd.cpp + app/util/qrenderstats.cpp + app/util/restartqopenhdmessagebox.cpp + # + app/osd/altitudeladder.cpp + app/osd/aoagauge.cpp + app/osd/flightpathvector.cpp + app/osd/headingladder.cpp + app/osd/horizonladder.cpp + app/osd/speedladder.cpp + # + app/logging/hudlogmessagesmodel.cpp + app/logging/logmessagesmodel.cpp + # + app/telemetry/MavlinkTelemetry.cpp + app/telemetry/action/fcaction.cpp + app/telemetry/action/fcmissionhandler.cpp + app/telemetry/action/fcmsgintervalhandler.cpp + app/telemetry/action/ohdaction.cpp + # + app/telemetry/action/impl/cmdsender.cpp + app/telemetry/action/impl/xparam.cpp + ## + app/telemetry/connection/mavlinkchannel.cpp + app/telemetry/connection/tcp_connection.cpp + app/telemetry/connection/udp_connection.cpp + # + app/telemetry/models/aohdsystem.cpp + app/telemetry/models/camerastreammodel.cpp + app/telemetry/models/fcmapmodel.cpp + app/telemetry/models/fcmavlinkmissionitemsmodel.cpp + app/telemetry/models/fcmavlinksystem.cpp + app/telemetry/models/markermodel.cpp + app/telemetry/models/rcchannelsmodel.cpp + app/telemetry/models/wificard.cpp + # + app/telemetry/settings/documentedparam.cpp + app/telemetry/settings/frequencyhelper.cpp + app/telemetry/settings/improvedintsetting.cpp + app/telemetry/settings/improvedstringsetting.cpp + app/telemetry/settings/mavlinksettingsmodel.cpp + app/telemetry/settings/pollutionhelper.cpp + app/telemetry/settings/wblinksettingshelper.cpp + + ### + #app/videostreaming/vscommon/custom/rawreceiver.cpp + #app/videostreaming/vscommon/rtp/rtpreceiver.cpp + #app/videostreaming/vscommon/rtp/ParseRTP.cpp + app/videostreaming/vscommon/decodingstatistcs.cpp + app/videostreaming/vscommon/decodingstatistcs.h + ## + lib/geographiclib-c-2.0/src/geodesic.c + ## + ## + ## + qml/qml.qrc +) + +target_include_directories(QOpenHDApp PUBLIC app) +target_include_directories(QOpenHDApp PUBLIC app/common) +target_include_directories(QOpenHDApp PUBLIC app/adsb) +target_include_directories(QOpenHDApp PUBLIC app/logging) +target_include_directories(QOpenHDApp PUBLIC app/osd) +target_include_directories(QOpenHDApp PUBLIC app/util) +target_include_directories(QOpenHDApp PUBLIC app/telemetry) +target_include_directories(QOpenHDApp PUBLIC app/telemetry/util) + +target_include_directories(QOpenHDApp PUBLIC app/videostreaming/vscommon) +target_include_directories(QOpenHDApp PUBLIC lib) + +qt_add_qml_module(QOpenHDApp + URI QOpenHD + VERSION 1.0 + QML_FILES + qml/MainX.qml +) + + +target_link_libraries(QOpenHDApp + PRIVATE Qt6::Core Qt6::Quick Qt6::Gui Qt6::Widgets +) + +#include(GNUInstallDirs) +#install(TARGETS QOpenHD +# BUNDLE DESTINATION . +# LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR} +# RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR} +#) diff --git a/QOpenHD.pro b/QOpenHD.pro index 83ba8f7d8..96d9d1cfb 100755 --- a/QOpenHD.pro +++ b/QOpenHD.pro @@ -129,6 +129,7 @@ HEADERS += \ app/util/WorkaroundMessageBox.h \ app/util/qrenderstats.h \ app/util/restartqopenhdmessagebox.h \ + app/util/lqutils_include.h \ # Geographic lib updated to c-2.0, so much cleaner @@ -180,12 +181,6 @@ DISTFILES += \ android/src/org/freedesktop/gstreamer/androidmedia/GstAmcOnFrameAvailableListener.java \ android/src/org/openhd/IsConnected.java \ android/src/org/openhd/LiveVideoPlayerWrapper.java \ - app/telemetry/telemetry.pri \ - app/videostreaming/gst_qmlglsink/gst_video.pri \ - app/videostreaming/vscommon/vscommon.pri \ - app/vs_android/videostreamingandroid.pri \ - extra_build_qmake.sh \ - lib/h264nal/h264nal.pri \ qml/qtquickcontrols2.conf \ qml/ui/qmldir \ diff --git a/app/common/openhd-util.hpp b/app/common/openhd-util.hpp index 8ce184757..bb4011cd3 100644 --- a/app/common/openhd-util.hpp +++ b/app/common/openhd-util.hpp @@ -92,18 +92,6 @@ static std::string yes_or_no(bool yes){ return (yes ? "Y" : "N"); } -static bool is_valid_ip(const std::string& ip) { -#if defined(__linux__) || defined(__macos__) - unsigned char buf[sizeof(struct in6_addr)]; - auto result = inet_pton(AF_INET, ip.c_str(), buf); - return result == 1; -#else - // TODO find method - return true; -#endif //#ifdef __linux__ - -} - } #endif diff --git a/app/main.cpp b/app/main.cpp index d911f7c8d..00ab6103b 100755 --- a/app/main.cpp +++ b/app/main.cpp @@ -418,7 +418,12 @@ int main(int argc, char *argv[]) { #endif ); + // TODO QT 6 engine.load(QUrl(QLatin1String("qrc:/main.qml"))); + //engine.loadFromModule("QOpenHD", "qrc:/main.qml"); + //engine.loadFromModule("QOpenHDApp","qrc:/main.qml"); + //engine.load("qml/main.qml"); + //engine.loadFromModule("QOpenHD", "MainX"); #if defined(__android__) QtAndroid::hideSplashScreen(); diff --git a/app/osd/altitudeladder.h b/app/osd/altitudeladder.h index 0b5c6ea6e..ab59e4543 100644 --- a/app/osd/altitudeladder.h +++ b/app/osd/altitudeladder.h @@ -2,7 +2,7 @@ #include #include -#include "../../../lib/lqtutils_master/lqtutils_prop.h" +#include "util/lqutils_include.h" class AltitudeLadder : public QQuickPaintedItem { Q_OBJECT diff --git a/app/osd/headingladder.h b/app/osd/headingladder.h index 341b3ff0a..b56d8a0ba 100644 --- a/app/osd/headingladder.h +++ b/app/osd/headingladder.h @@ -2,7 +2,7 @@ #include #include -#include "../../../lib/lqtutils_master/lqtutils_prop.h" +#include "util/lqutils_include.h" class HeadingLadder : public QQuickPaintedItem { Q_OBJECT diff --git a/app/osd/speedladder.h b/app/osd/speedladder.h index 225185480..ce6a720c1 100644 --- a/app/osd/speedladder.h +++ b/app/osd/speedladder.h @@ -2,7 +2,7 @@ #include #include -#include "../../../lib/lqtutils_master/lqtutils_prop.h" +#include "util/lqutils_include.h" class SpeedLadder : public QQuickPaintedItem { Q_OBJECT diff --git a/app/telemetry/MavlinkTelemetry.cpp b/app/telemetry/MavlinkTelemetry.cpp index 708a6aa62..225eab8ad 100644 --- a/app/telemetry/MavlinkTelemetry.cpp +++ b/app/telemetry/MavlinkTelemetry.cpp @@ -1,11 +1,10 @@ #include "MavlinkTelemetry.h" -#include "common/openhd-util.hpp" #include "models/aohdsystem.h" #include "models/fcmavlinksystem.h" #include "settings/mavlinksettingsmodel.h" -#include "util/qopenhdmavlinkhelper.hpp" +#include "tutil/qopenhdmavlinkhelper.hpp" #include "action/fcmissionhandler.h" #include "action/impl/cmdsender.h" @@ -317,7 +316,7 @@ void MavlinkTelemetry::change_telemetry_connection_mode(int mavlink_connection_m bool MavlinkTelemetry::change_manual_tcp_ip(QString ip) { - if(!OHDUtil::is_valid_ip(ip.toStdString())){ + if(!QOpenHD::instance().is_valid_ip(ip)){ return false; } threadsafe_set_manual_tcp_ip(ip.toStdString()); diff --git a/app/telemetry/MavlinkTelemetry.h b/app/telemetry/MavlinkTelemetry.h index 413c59d57..b8e952701 100644 --- a/app/telemetry/MavlinkTelemetry.h +++ b/app/telemetry/MavlinkTelemetry.h @@ -7,7 +7,7 @@ #include #include -#include "util/mavlink_include.h" +#include "tutil/mavlink_include.h" #include "../../lib/lqtutils_master/lqtutils_prop.h" #include "../common/TimeHelper.hpp" diff --git a/app/telemetry/action/create_cmd_helper.hpp b/app/telemetry/action/create_cmd_helper.hpp index 136c3d011..85dbd2687 100644 --- a/app/telemetry/action/create_cmd_helper.hpp +++ b/app/telemetry/action/create_cmd_helper.hpp @@ -1,7 +1,7 @@ #ifndef CMD_HELPER_H #define CMD_HELPER_H -#include "../util/mavlink_include.h" +#include "../tutil/mavlink_include.h" // Here we have various util methods to create mavlink_command_long_t commands namespace cmd::helper{ diff --git a/app/telemetry/action/fcaction.cpp b/app/telemetry/action/fcaction.cpp index 37c478314..3f9df715c 100644 --- a/app/telemetry/action/fcaction.cpp +++ b/app/telemetry/action/fcaction.cpp @@ -7,7 +7,7 @@ #include "create_cmd_helper.hpp" #include "../models/fcmavlinksystem.h" -#include "util/mavlink_enum_to_string.h" +#include "tutil/mavlink_enum_to_string.h" FCAction::FCAction(QObject *parent) : QObject{parent} diff --git a/app/telemetry/action/fcaction.h b/app/telemetry/action/fcaction.h index 430a94098..35137e9de 100644 --- a/app/telemetry/action/fcaction.h +++ b/app/telemetry/action/fcaction.h @@ -4,7 +4,7 @@ #include #include -#include "../util/mavlink_include.h" +#include "../tutil/mavlink_include.h" #include "../../../lib/lqtutils_master/lqtutils_prop.h" /** diff --git a/app/telemetry/action/fcmissionhandler.cpp b/app/telemetry/action/fcmissionhandler.cpp index 709a99260..a12868d1e 100644 --- a/app/telemetry/action/fcmissionhandler.cpp +++ b/app/telemetry/action/fcmissionhandler.cpp @@ -1,6 +1,6 @@ #include "fcmissionhandler.h" -#include "../util/qopenhdmavlinkhelper.hpp" -#include "../util/telemetryutil.hpp" +#include "../tutil/qopenhdmavlinkhelper.hpp" +#include "../tutil/telemetryutil.hpp" #include "../MavlinkTelemetry.h" #include "../models/fcmavlinkmissionitemsmodel.h" diff --git a/app/telemetry/action/fcmissionhandler.h b/app/telemetry/action/fcmissionhandler.h index f14778480..9dfce7316 100644 --- a/app/telemetry/action/fcmissionhandler.h +++ b/app/telemetry/action/fcmissionhandler.h @@ -13,7 +13,7 @@ #include "../../../lib/lqtutils_master/lqtutils_prop.h" -#include "../util/mavlink_include.h" +#include "../tutil/mavlink_include.h" /** * Simple class to (semi-reliably) get all the mission waypoints from the FC and more. diff --git a/app/telemetry/action/fcmsgintervalhandler.h b/app/telemetry/action/fcmsgintervalhandler.h index b527872e5..dbb42e9eb 100644 --- a/app/telemetry/action/fcmsgintervalhandler.h +++ b/app/telemetry/action/fcmsgintervalhandler.h @@ -7,7 +7,7 @@ #include #include -#include "../util/mavlink_include.h" +#include "../tutil/mavlink_include.h" /** * We need to manually request / set the message interval(s) for specific messages on ardupilot diff --git a/app/telemetry/action/impl/cmdsender.cpp b/app/telemetry/action/impl/cmdsender.cpp index 5954408d3..55f0a61a8 100644 --- a/app/telemetry/action/impl/cmdsender.cpp +++ b/app/telemetry/action/impl/cmdsender.cpp @@ -2,9 +2,9 @@ #include -#include "../../util/qopenhdmavlinkhelper.hpp" +#include "../../tutil/qopenhdmavlinkhelper.hpp" #include "../../MavlinkTelemetry.h" -#include "util/mavlink_enum_to_string.h" +#include "tutil/mavlink_enum_to_string.h" #include CmdSender::CmdSender() diff --git a/app/telemetry/action/impl/cmdsender.h b/app/telemetry/action/impl/cmdsender.h index bb8483e37..9e8c6adea 100644 --- a/app/telemetry/action/impl/cmdsender.h +++ b/app/telemetry/action/impl/cmdsender.h @@ -1,7 +1,7 @@ #ifndef CMDSENDER_H #define CMDSENDER_H -#include "../../util/mavlink_include.h" +#include "../../tutil/mavlink_include.h" #include #include diff --git a/app/telemetry/action/impl/xparam.cpp b/app/telemetry/action/impl/xparam.cpp index 4d521786a..fd6b19a10 100644 --- a/app/telemetry/action/impl/xparam.cpp +++ b/app/telemetry/action/impl/xparam.cpp @@ -1,5 +1,5 @@ #include "xparam.h" -#include "util/qopenhdmavlinkhelper.hpp" +#include "tutil/qopenhdmavlinkhelper.hpp" #include #include diff --git a/app/telemetry/action/impl/xparam.h b/app/telemetry/action/impl/xparam.h index ecc7ed95a..c384b2ab7 100644 --- a/app/telemetry/action/impl/xparam.h +++ b/app/telemetry/action/impl/xparam.h @@ -9,7 +9,7 @@ #include #include -#include "../../util/mavlink_include.h" +#include "../../tutil/mavlink_include.h" class XParam { diff --git a/app/telemetry/action/ohdaction.cpp b/app/telemetry/action/ohdaction.cpp index 44042545d..3f19b90d7 100644 --- a/app/telemetry/action/ohdaction.cpp +++ b/app/telemetry/action/ohdaction.cpp @@ -1,7 +1,7 @@ #include "ohdaction.h" #include "create_cmd_helper.hpp" -#include "../util/openhd_defines.hpp" +#include "../tutil/openhd_defines.hpp" #include "impl/cmdsender.h" //#include "../models/aohdsystem.h" diff --git a/app/telemetry/connection/tcp_connection.cpp b/app/telemetry/connection/tcp_connection.cpp index fa058d81e..28608cacc 100644 --- a/app/telemetry/connection/tcp_connection.cpp +++ b/app/telemetry/connection/tcp_connection.cpp @@ -1,5 +1,5 @@ #include "tcp_connection.h" -#include "util/qopenhdmavlinkhelper.hpp" +#include "tutil/qopenhdmavlinkhelper.hpp" #ifdef __windows__ #define _WIN32_WINNT 0x0600 //TODO dirty diff --git a/app/telemetry/connection/tcp_connection.h b/app/telemetry/connection/tcp_connection.h index 08432a462..219433803 100644 --- a/app/telemetry/connection/tcp_connection.h +++ b/app/telemetry/connection/tcp_connection.h @@ -1,7 +1,7 @@ #ifndef TCPCONNECTION2_H #define TCPCONNECTION2_H -#include "../util/mavlink_include.h" +#include "../tutil/mavlink_include.h" #include #include diff --git a/app/telemetry/connection/udp_connection.cpp b/app/telemetry/connection/udp_connection.cpp index 3f236110d..ac363f990 100644 --- a/app/telemetry/connection/udp_connection.cpp +++ b/app/telemetry/connection/udp_connection.cpp @@ -1,5 +1,5 @@ #include "udp_connection.h" -#include "util/qopenhdmavlinkhelper.hpp" +#include "tutil/qopenhdmavlinkhelper.hpp" #ifdef __windows__ #define _WIN32_WINNT 0x0600 //TODO dirty diff --git a/app/telemetry/connection/udp_connection.h b/app/telemetry/connection/udp_connection.h index 2119b8bc1..6046410d2 100644 --- a/app/telemetry/connection/udp_connection.h +++ b/app/telemetry/connection/udp_connection.h @@ -1,7 +1,7 @@ #ifndef MUDPLINK_H #define MUDPLINK_H -#include "../util/mavlink_include.h" +#include "../tutil/mavlink_include.h" #include #include diff --git a/app/telemetry/models/aohdsystem.cpp b/app/telemetry/models/aohdsystem.cpp index 93d0bc988..6869e8e1c 100644 --- a/app/telemetry/models/aohdsystem.cpp +++ b/app/telemetry/models/aohdsystem.cpp @@ -3,7 +3,7 @@ #include "../../common/StringHelper.hpp" #include "../../common/TimeHelper.hpp" #include "QOpenHDVideoHelper.hpp" -#include "util/telemetryutil.hpp" +#include "tutil/telemetryutil.hpp" #include "wificard.h" #include "rcchannelsmodel.h" #include "camerastreammodel.h" @@ -16,7 +16,7 @@ #include #include "util/qopenhd.h" -#include "../util/qopenhdmavlinkhelper.hpp" +#include "../tutil/qopenhdmavlinkhelper.hpp" #include <../util/WorkaroundMessageBox.h> #include "../settings/wblinksettingshelper.h" @@ -481,6 +481,9 @@ void AOHDSystem::process_op_mode(const mavlink_openhd_wifbroadcast_gnd_operating void AOHDSystem::autofech_params_if_apropriate() { + QSettings settings; + const bool dev_disable_autofetch=settings.value("dev_disable_autofetch",false).toBool(); + if(dev_disable_autofetch)return; if(!m_is_air){ // Ground - auto-fetch IF ;) if(m_wb_gnd_operating_mode==0){ diff --git a/app/telemetry/models/aohdsystem.h b/app/telemetry/models/aohdsystem.h index c44764960..c1dd0ea1d 100644 --- a/app/telemetry/models/aohdsystem.h +++ b/app/telemetry/models/aohdsystem.h @@ -8,10 +8,10 @@ #include #include -#include "../util/mavlink_include.h" +#include "../tutil/mavlink_include.h" -#include "../../../lib/lqtutils_master/lqtutils_prop.h" -#include "util/openhd_defines.hpp" +#include "util/lqutils_include.h" +#include "tutil/openhd_defines.hpp" /** * Abstract OHD (Mavlink) system. diff --git a/app/telemetry/models/camerastreammodel.cpp b/app/telemetry/models/camerastreammodel.cpp index ebac49ec4..eb5818ba4 100644 --- a/app/telemetry/models/camerastreammodel.cpp +++ b/app/telemetry/models/camerastreammodel.cpp @@ -1,6 +1,6 @@ #include "camerastreammodel.h" #include "qdebug.h" -#include "../util/telemetryutil.hpp" +#include "../tutil/telemetryutil.hpp" #include "../videostreaming/vscommon/QOpenHDVideoHelper.hpp" #include diff --git a/app/telemetry/models/camerastreammodel.h b/app/telemetry/models/camerastreammodel.h index b41bbf6bb..8ee61f83f 100644 --- a/app/telemetry/models/camerastreammodel.h +++ b/app/telemetry/models/camerastreammodel.h @@ -3,9 +3,9 @@ #include -#include "../util/mavlink_include.h" +#include "../tutil/mavlink_include.h" -#include "../../../lib/lqtutils_master/lqtutils_prop.h" +#include "util/lqutils_include.h" // NOTE1: This class exists to avoid duplicated code for primary and secondary camera(stream)-stats displayed in the HUD // NOTE2: Here we have only stats for one camera / camera stream that are transmitted via lossy diff --git a/app/telemetry/models/fcmavlinksystem.cpp b/app/telemetry/models/fcmavlinksystem.cpp index c2a25a701..9d17bb78f 100644 --- a/app/telemetry/models/fcmavlinksystem.cpp +++ b/app/telemetry/models/fcmavlinksystem.cpp @@ -4,16 +4,15 @@ #include #include "util/qopenhd.h" -#include -#include "../util/geodesi_helper.h" +#include "../tutil/geodesi_helper.h" #include #include #include -#include "util/qopenhdmavlinkhelper.hpp" -#include "util/telemetryutil.hpp" +#include "tutil/qopenhdmavlinkhelper.hpp" +#include "tutil/telemetryutil.hpp" #include "../action/fcaction.h" @@ -124,10 +123,10 @@ bool FCMavlinkSystem::process_message(const mavlink_message_t &msg) mavlink_system_time_t sys_time; mavlink_msg_system_time_decode(&msg, &sys_time); set_sys_time_unix_usec(sys_time.time_unix_usec); + // TODO QT 6 doesn't have it QDateTime time; - time.setTime_t(sys_time.time_unix_usec/1000/1000); + time.setMSecsSinceEpoch(sys_time.time_unix_usec/1000); set_sys_time_unix_as_str(time.toString()); - uint32_t boot_time = sys_time.time_boot_ms; /*if (boot_time < m_last_boot || m_last_boot == 0) { m_last_boot = boot_time; diff --git a/app/telemetry/models/fcmavlinksystem.h b/app/telemetry/models/fcmavlinksystem.h index 81e6a154d..32ab5d2d3 100644 --- a/app/telemetry/models/fcmavlinksystem.h +++ b/app/telemetry/models/fcmavlinksystem.h @@ -6,14 +6,13 @@ #include #include -#include "../util/mavlink_include.h" +#include "../tutil/mavlink_include.h" #include #include #include -// Really nice, this way we don't have to write all the setters / getters / signals ourselves ! -#include "../../../lib/lqtutils_master/lqtutils_prop.h" +#include "util/lqutils_include.h" /** * This used to be called OpenHD and was a mix of everything, it has become FCMavlinkSystem - diff --git a/app/telemetry/models/rcchannelsmodel.cpp b/app/telemetry/models/rcchannelsmodel.cpp index 461ab2b88..1dbbe7c75 100644 --- a/app/telemetry/models/rcchannelsmodel.cpp +++ b/app/telemetry/models/rcchannelsmodel.cpp @@ -1,6 +1,6 @@ #include "rcchannelsmodel.h" #include "qdebug.h" -#include "../util/qopenhdmavlinkhelper.hpp" +#include "../tutil/qopenhdmavlinkhelper.hpp" diff --git a/app/telemetry/models/rcchannelsmodel.h b/app/telemetry/models/rcchannelsmodel.h index 150b30973..08abf638a 100644 --- a/app/telemetry/models/rcchannelsmodel.h +++ b/app/telemetry/models/rcchannelsmodel.h @@ -9,7 +9,7 @@ #include #include -#include "../../../lib/lqtutils_master/lqtutils_prop.h" +#include "util/lqutils_include.h" // Don't get confused - we have 2 instances of this model: // instanceGround()-> The OpenHD ground instance for now broadcasts the rc channel value(s) to QOpenHD for display / debugging. diff --git a/app/telemetry/models/wificard.cpp b/app/telemetry/models/wificard.cpp index 618676c74..5ebb11c5e 100644 --- a/app/telemetry/models/wificard.cpp +++ b/app/telemetry/models/wificard.cpp @@ -3,7 +3,7 @@ #include #include "../../logging/hudlogmessagesmodel.h" -#include "util/qopenhdmavlinkhelper.hpp" +#include "tutil/qopenhdmavlinkhelper.hpp" static std::string wifi_card_type_to_string(const int card_type) { diff --git a/app/telemetry/models/wificard.h b/app/telemetry/models/wificard.h index d9ae011bc..5054edfbe 100644 --- a/app/telemetry/models/wificard.h +++ b/app/telemetry/models/wificard.h @@ -4,9 +4,8 @@ #include #include #include -#include "../../../lib/lqtutils_master/lqtutils_prop.h" - -#include "../util/mavlink_include.h" +#include "util/lqutils_include.h" +#include "../tutil/mavlink_include.h" // Stats unique per each connected (wifibroadcast) wfi card // Air has only one card, ground can have one or more card(s) diff --git a/app/telemetry/settings/mavlinksettingsmodel.cpp b/app/telemetry/settings/mavlinksettingsmodel.cpp index 3d9f032ac..61a4244c4 100644 --- a/app/telemetry/settings/mavlinksettingsmodel.cpp +++ b/app/telemetry/settings/mavlinksettingsmodel.cpp @@ -5,7 +5,7 @@ #include "../../util/qopenhd.h" #include "improvedintsetting.h" #include "improvedstringsetting.h" -#include "util/openhd_defines.hpp" +#include "tutil/openhd_defines.hpp" #include #include diff --git a/app/telemetry/settings/mavlinksettingsmodel.h b/app/telemetry/settings/mavlinksettingsmodel.h index 036f7c469..82220b777 100644 --- a/app/telemetry/settings/mavlinksettingsmodel.h +++ b/app/telemetry/settings/mavlinksettingsmodel.h @@ -9,7 +9,7 @@ #include #include -#include "../util/mavlink_include.h" +#include "../tutil/mavlink_include.h" #include "../../../lib/lqtutils_master/lqtutils_prop.h" #include "../action/impl/xparam.h" diff --git a/app/telemetry/settings/wblinksettingshelper.h b/app/telemetry/settings/wblinksettingshelper.h index e99d7d5f9..19f0a9b28 100644 --- a/app/telemetry/settings/wblinksettingshelper.h +++ b/app/telemetry/settings/wblinksettingshelper.h @@ -9,8 +9,8 @@ #include #include -#include "../util/mavlink_include.h" -#include "util/openhd_defines.hpp" +#include "../tutil/mavlink_include.h" +#include "tutil/openhd_defines.hpp" // DON'T ASK, THIS CLASS IS HUGE AND REALLY HARD TO DESCRIBE diff --git a/app/telemetry/telemetry.pri b/app/telemetry/telemetry.pri index 0808c9daa..0ca10ddf7 100644 --- a/app/telemetry/telemetry.pri +++ b/app/telemetry/telemetry.pri @@ -45,12 +45,12 @@ HEADERS += \ $$PWD/settings/frequencyhelper.h \ $$PWD/settings/pollutionhelper.h \ $$PWD/settings/wifi_channel.h \ - $$PWD/util/geodesi_helper.h \ - $$PWD/util/mavlink_enum_to_string.h \ - $$PWD//util/openhd_defines.hpp \ - $$PWD//util/qopenhdmavlinkhelper.hpp \ - $$PWD//util/telemetryutil.hpp \ - $$PWD/util/mavlink_include.h \ + $$PWD/tutil/geodesi_helper.h \ + $$PWD/tutil/mavlink_enum_to_string.h \ + $$PWD//tutil/openhd_defines.hpp \ + $$PWD//tutil/qopenhdmavlinkhelper.hpp \ + $$PWD//tutil/telemetryutil.hpp \ + $$PWD/tutil/mavlink_include.h \ $$PWD/models/fcmapmodel.h \ $$PWD/settings/wblinksettingshelper.h \ app/telemetry/models/aohdsystem.h \ diff --git a/app/telemetry/util/geodesi_helper.h b/app/telemetry/tutil/geodesi_helper.h similarity index 62% rename from app/telemetry/util/geodesi_helper.h rename to app/telemetry/tutil/geodesi_helper.h index cd085e7a9..6a35526ef 100644 --- a/app/telemetry/util/geodesi_helper.h +++ b/app/telemetry/tutil/geodesi_helper.h @@ -1,7 +1,8 @@ #ifndef GEODESI_HELPER_H #define GEODESI_HELPER_H -#include +//#include +#include "lib/geographiclib-c-2.0/src/geodesic.h" // return: distance in m between 2 points static double distance_between(double lat1,double lon1,double lat2,double lon2){ @@ -11,12 +12,14 @@ static double distance_between(double lat1,double lon1,double lat2,double lon2){ geod_geodesic geod{}; // from https://manpages.ubuntu.com/manpages/bionic/man3/geodesic.3.html - const double a = 6378137, f = 1/298.257223563; /* WGS84 */ + const double a = 6378137, f = 1/298.257223563; // WGS84 geod_init(&geod,a,f); geod_inverse(&geod,lat1,lon1,lat2,lon2,&s12,0,0); //&azi1,&azi2 return s12; - /* todo: this could be easily extended to save the azimuth as well, which gives us the direction - home for free as a result of the calculation above. - */ } + +/*static double distance_between(double lat1,double lon1,double lat2,double lon2){ + return 0; +}*/ + #endif // GEODESI_HELPER_H diff --git a/app/telemetry/util/mavlink_enum_to_string.h b/app/telemetry/tutil/mavlink_enum_to_string.h similarity index 100% rename from app/telemetry/util/mavlink_enum_to_string.h rename to app/telemetry/tutil/mavlink_enum_to_string.h diff --git a/app/telemetry/util/mavlink_include.h b/app/telemetry/tutil/mavlink_include.h similarity index 100% rename from app/telemetry/util/mavlink_include.h rename to app/telemetry/tutil/mavlink_include.h diff --git a/app/telemetry/util/openhd_defines.hpp b/app/telemetry/tutil/openhd_defines.hpp similarity index 100% rename from app/telemetry/util/openhd_defines.hpp rename to app/telemetry/tutil/openhd_defines.hpp diff --git a/app/telemetry/util/qopenhdmavlinkhelper.hpp b/app/telemetry/tutil/qopenhdmavlinkhelper.hpp similarity index 100% rename from app/telemetry/util/qopenhdmavlinkhelper.hpp rename to app/telemetry/tutil/qopenhdmavlinkhelper.hpp diff --git a/app/telemetry/util/telemetryutil.hpp b/app/telemetry/tutil/telemetryutil.hpp similarity index 100% rename from app/telemetry/util/telemetryutil.hpp rename to app/telemetry/tutil/telemetryutil.hpp diff --git a/app/util/lqutils_include.h b/app/util/lqutils_include.h new file mode 100644 index 000000000..08856e186 --- /dev/null +++ b/app/util/lqutils_include.h @@ -0,0 +1,8 @@ +#ifndef LQUTILS_INCLUDE_H +#define LQUTILS_INCLUDE_H + +// Really nice, this way we don't have to write all the setters / getters / signals ourselves ! +#include "../../../lib/lqtutils_master/lqtutils_prop.h" +//#include "../lib/lqtutils_master/lqtutils_prop.h" + +#endif // LQUTILS_INCLUDE_H diff --git a/app/util/qopenhd.cpp b/app/util/qopenhd.cpp index c3cad5649..ce461e339 100644 --- a/app/util/qopenhd.cpp +++ b/app/util/qopenhd.cpp @@ -79,7 +79,7 @@ void QOpenHD::switchToLanguage(const QString &language) { qDebug()<<"Error switch language- engine not set"; return; } - QLocale::setDefault(language); + QLocale::setDefault(QLocale(language)); if (!m_translator.isEmpty()) { QCoreApplication::removeTranslator(&m_translator); @@ -312,7 +312,9 @@ bool QOpenHD::is_valid_ip(QString ip) //TODO fix windows return true; #else - return OHDUtil::is_valid_ip(ip.toStdString()); + // TODO + return true; + #endif } diff --git a/app/util/qrenderstats.h b/app/util/qrenderstats.h index e3d805237..478208884 100644 --- a/app/util/qrenderstats.h +++ b/app/util/qrenderstats.h @@ -6,7 +6,7 @@ #include #include "../common/TimeHelper.hpp" -#include "../lib/lqtutils_master/lqtutils_prop.h" +#include "util/lqutils_include.h" // Stats about the QT (QOpenHD) OpenGL rendering. // E.g frame time of the QT OpenGL rendering thread. diff --git a/app/videostreaming/vscommon/decodingstatistcs.h b/app/videostreaming/vscommon/decodingstatistcs.h index 58b459b7e..bd46def4b 100644 --- a/app/videostreaming/vscommon/decodingstatistcs.h +++ b/app/videostreaming/vscommon/decodingstatistcs.h @@ -4,7 +4,7 @@ #include // Really nice, this way we don't have to write all the setters / getters / signals ourselves ! -#include "../lib/lqtutils_master/lqtutils_prop.h" +#include "util/lqutils_include.h" /** * @brief Simple QT model to expose QOpenHD decoding statistics to the UI. diff --git a/qml/MainX.qml b/qml/MainX.qml new file mode 100644 index 000000000..755ab5602 --- /dev/null +++ b/qml/MainX.qml @@ -0,0 +1,171 @@ + +import QtQuick 2.12 +import QtQuick.Controls 2.12 +import QtQuick.Controls.Material 2.12 +import QtQuick.Layouts 1.0 +import Qt.labs.settings 1.0 + +import OpenHD 1.0 + +import "./ui" +import "./ui/widgets" +import "./ui/elements" +import "./ui/configpopup" +import "./video" + +ApplicationWindow { + id: applicationWindow + visible: true + + + //property int m_window_width: 1280 + //property int m_window_height: 720 + property int m_window_width: 850 // This is 480p 16:9 + property int m_window_height: 480 + + //width: 850 + //height: 480 + width: (settings.general_screen_rotation == 90 || settings.general_screen_rotation == 270) ? m_window_height : m_window_width + height: (settings.general_screen_rotation == 90 || settings.general_screen_rotation == 270) ? m_window_width : m_window_height + + onWidthChanged: { + _qrenderstats.set_window_width(width) + } + onHeightChanged: { + _qrenderstats.set_window_height(height) + } + + contentOrientation: settings.general_screen_rotation===0 ? Qt.PortraitOrientation : Qt.LandscapeOrientation + contentItem.rotation: settings.general_screen_rotation + + //minimumWidth: 850 + //minimumHeight: 480 + title: qsTr("QOpenHD EVO") + // Transparent background is needed when the video is not rendered via (OpenGL) inside QT, + // but rather done independently by using a pipeline that directly goes to the HW composer (e.g. mmal on pi). + //color: "transparent" //Consti10 transparent background + //color : "#2C3E50" // reduce KREBS + color: settings.app_background_transparent ? "transparent" : "#2C3E50" + //flags: Qt.WindowStaysOnTopHint| Qt.FramelessWindowHint| Qt.X11BypassWindowManagerHint; + //flags: Qt.WindowStaysOnTopHint| Qt.X11BypassWindowManagerHint; + //visibility: "FullScreen" + // android / ios - specifc: We need to explicitly say full screen, otherwise things might be "cut off" + visibility: (settings.dev_force_show_full_screen || QOPENHD_IS_MOBILE) ? "FullScreen" : "AutomaticVisibility" + + // This only exists to be able to fully rotate "everything" for users that have their screen upside down for some reason. + // Won't affect the video, but heck, then just mount your camera upside down. + // TODO: the better fix really would be to somehow the the RPI HDMI config to rotate the screen in HW - but r.n there seems to be + // no way, at least on MMAL + // NOTE: If this creates issues, just comment it out - I'd love to get rid of it as soon as we can. + Item{ + // rotation: settings.general_screen_rotation + anchors.centerIn: parent + width: (settings.general_screen_rotation == 90 || settings.general_screen_rotation == 270) ? parent.height : parent.width + height: (settings.general_screen_rotation == 90 || settings.general_screen_rotation == 270) ? parent.width : parent.height + + // Local app settings. Uses the "user defaults" system on Mac/iOS, the Registry on Windows, + // and equivalent settings systems on Linux and Android + // On linux, they generally are stored under /home/username/.config/Open.HD + // See https://doc.qt.io/qt-5/qsettings.html#platform-specific-notes for more info + AppSettings { + id: settings + Component.onCompleted: { + // + } + } + + // Loads the proper (platform-dependent) video widget for the main (primary) video + // primary video is always full-screen and behind the HUD OSD Elements + Loader { + anchors.fill: parent + z: 1.0 + source: { + if(QOPENHD_ENABLE_VIDEO_VIA_ANDROID){ + return "../video/ExpMainVideoAndroid.qml" + } + // If we have avcodec at compile time, we prefer it over qmlglsink since it provides lower latency + // (not really avcodec itself, but in this namespace we have 1) the preferred sw decode path and + // 2) also the mmal rpi path ) + if(QOPENHD_ENABLE_VIDEO_VIA_AVCODEC){ + return "../video/MainVideoQSG.qml"; + } + // Fallback / windows or similar + if(QOPENHD_ENABLE_GSTREAMER_QMLGLSINK){ + return "../video/MainVideoGStreamer.qml"; + } + console.warn("No primary video implementation") + return "" + } + } + + + ColorPicker { + id: colorPicker + height: 264 + width: 380 + z: 15.0 + anchors.centerIn: parent + } + + // UI areas + + HUDOverlayGrid { + id: hudOverlayGrid + anchors.fill: parent + z: 3.0 + //onSettingsButtonClicked: { + // settings_panel.openSettings(); + //} + // Performance seems to be better on embedded devices like + // rpi with layers disabled (aka default) but this is not exact science + layer.enabled: false + } + + + ConfigPopup { + id: settings_panel + visible: false + } + + WorkaroundMessageBox{ + id: workaroundmessagebox + } + + CardToast{ + id: card_toast + m_text: _qopenhd.toast_text + visible: _qopenhd.toast_visible + } + + // Used by settings that require a restart + RestartQOpenHDMessageBox{ + id: restartQOpenHDMessageBox + } + + // Allows closing QOpenHD via a keyboard shortcut + // also stops the service, such that it is not restartet + Shortcut { + sequence: "Ctrl+F12" + onActivated: { + _qopenhd.disable_service_and_quit() + } + } + AnyParamBusyIndicator{ + z: 10 + } + + Component.onCompleted: { + console.log("Completed"); + hudOverlayGrid.regain_focus() + } + } +} + +/*##^## +Designer { + D{i:6;anchors_y:8}D{i:7;anchors_y:32}D{i:8;anchors_y:32}D{i:9;anchors_y:8}D{i:10;anchors_y:32} +D{i:11;anchors_y:32}D{i:12;anchors_y:11}D{i:13;anchors_y:11}D{i:14;anchors_x:62}D{i:15;anchors_x:128} +D{i:16;anchors_x:136;anchors_y:11}D{i:17;anchors_x:82;anchors_y:8}D{i:19;anchors_y:8} +D{i:21;anchors_y:31}D{i:22;anchors_y:8}D{i:23;anchors_y:11}D{i:24;anchors_y:32} +} +##^##*/ diff --git a/qml/main.qml b/qml/main.qml index 8ba46dc81..dce107cf3 100755 --- a/qml/main.qml +++ b/qml/main.qml @@ -1,10 +1,8 @@ import QtQuick 2.12 import QtQuick.Controls 2.12 -import QtQuick.Controls.Styles 1.4 import QtQuick.Controls.Material 2.12 import QtQuick.Layouts 1.0 -import QtGraphicalEffects 1.12 import Qt.labs.settings 1.0 import OpenHD 1.0 diff --git a/qml/ui/configpopup/qopenhd_settings/AppDevSettingsView.qml b/qml/ui/configpopup/qopenhd_settings/AppDevSettingsView.qml index 581dbd497..fd2871318 100755 --- a/qml/ui/configpopup/qopenhd_settings/AppDevSettingsView.qml +++ b/qml/ui/configpopup/qopenhd_settings/AppDevSettingsView.qml @@ -85,6 +85,20 @@ ScrollView { onCheckedChanged: settings.dev_show_5180mhz_lowband = checked } } + SettingBaseElement{ + m_short_description:"dev_disable_autofetch_params" + m_long_description: "Disables automatic fetching of the air / ground openhd param set(s)" + Switch { + width: 32 + height: elementHeight + anchors.rightMargin: Qt.inputMethod.visible ? 96 : 36 + + anchors.right: parent.right + anchors.verticalCenter: parent.verticalCenter + checked: settings.dev_disable_autofetch + onCheckedChanged: settings.dev_disable_autofetch = checked + } + } SettingBaseElement{ m_short_description: "Save Settings to file" m_long_description: "Save your QOpenHD settings (e.g. OSD layout,..) to your SD card as a backup in between updates. Only works from/to linux." diff --git a/qml/ui/elements/AppSettings.qml b/qml/ui/elements/AppSettings.qml index b998c1595..c06c45323 100644 --- a/qml/ui/elements/AppSettings.qml +++ b/qml/ui/elements/AppSettings.qml @@ -87,6 +87,7 @@ Settings { property bool dev_show_advanced_button: false property bool dev_allow_freq_change_when_armed: false property bool dev_show_5180mhz_lowband: false + property bool dev_disable_autofetch: false // WARNING END //WARNING: THIS makes the RC panel visible property bool app_show_RC: false diff --git a/qml/video/ExpMainVideoAndroid.qml b/qml/video/ExpMainVideoAndroid.qml index 6f3f8bdb1..08862d86e 100644 --- a/qml/video/ExpMainVideoAndroid.qml +++ b/qml/video/ExpMainVideoAndroid.qml @@ -1,15 +1,13 @@ import QtQuick 2.12 import QtQuick.Controls 2.12 -import QtQuick.Controls.Styles 1.4 import QtQuick.Controls.Material 2.12 import QtQuick.Layouts 1.0 -import QtGraphicalEffects 1.12 import Qt.labs.settings 1.0 import OpenHD 1.0 // TODO remove me ? -import QtMultimedia 5.15 +//import QtMultimedia 5.15 // Written in c++ and exposed to qml SurfaceTexture {