Skip to content

Commit

Permalink
One small actual change. a bit of refactoring otherwise (#664)
Browse files Browse the repository at this point in the history
* exp - can we run on QT 6

* exp - can we run on QT 6

* exp - can we run on QT 6

* exp - can we run on QT 6

* exp - can we run on QT 6

* add disable autofetch option in dev
  • Loading branch information
Consti10 authored Feb 25, 2024
1 parent dc4d61c commit fcc8cbb
Show file tree
Hide file tree
Showing 54 changed files with 384 additions and 89 deletions.
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -84,3 +84,5 @@ build
qopenhd.qmltypes
qopenhd_metatypes.json
qopenhd_qmltyperegistrations.cpp

CMakeLists.txt.user
111 changes: 111 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -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}
#)
7 changes: 1 addition & 6 deletions QOpenHD.pro
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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 \

Expand Down
12 changes: 0 additions & 12 deletions app/common/openhd-util.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -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
5 changes: 5 additions & 0 deletions app/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand Down
2 changes: 1 addition & 1 deletion app/osd/altitudeladder.h
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
#include <QQuickPaintedItem>
#include <QPainter>

#include "../../../lib/lqtutils_master/lqtutils_prop.h"
#include "util/lqutils_include.h"

class AltitudeLadder : public QQuickPaintedItem {
Q_OBJECT
Expand Down
2 changes: 1 addition & 1 deletion app/osd/headingladder.h
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
#include <QQuickPaintedItem>
#include <QPainter>

#include "../../../lib/lqtutils_master/lqtutils_prop.h"
#include "util/lqutils_include.h"

class HeadingLadder : public QQuickPaintedItem {
Q_OBJECT
Expand Down
2 changes: 1 addition & 1 deletion app/osd/speedladder.h
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
#include <QQuickPaintedItem>
#include <QPainter>

#include "../../../lib/lqtutils_master/lqtutils_prop.h"
#include "util/lqutils_include.h"

class SpeedLadder : public QQuickPaintedItem {
Q_OBJECT
Expand Down
5 changes: 2 additions & 3 deletions app/telemetry/MavlinkTelemetry.cpp
Original file line number Diff line number Diff line change
@@ -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"
Expand Down Expand Up @@ -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());
Expand Down
2 changes: 1 addition & 1 deletion app/telemetry/MavlinkTelemetry.h
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
#include <mutex>
#include <thread>

#include "util/mavlink_include.h"
#include "tutil/mavlink_include.h"
#include "../../lib/lqtutils_master/lqtutils_prop.h"
#include "../common/TimeHelper.hpp"

Expand Down
2 changes: 1 addition & 1 deletion app/telemetry/action/create_cmd_helper.hpp
Original file line number Diff line number Diff line change
@@ -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{
Expand Down
2 changes: 1 addition & 1 deletion app/telemetry/action/fcaction.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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}
Expand Down
2 changes: 1 addition & 1 deletion app/telemetry/action/fcaction.h
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
#include <QObject>
#include <mutex>

#include "../util/mavlink_include.h"
#include "../tutil/mavlink_include.h"
#include "../../../lib/lqtutils_master/lqtutils_prop.h"

/**
Expand Down
4 changes: 2 additions & 2 deletions app/telemetry/action/fcmissionhandler.cpp
Original file line number Diff line number Diff line change
@@ -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"
Expand Down
2 changes: 1 addition & 1 deletion app/telemetry/action/fcmissionhandler.h
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down
2 changes: 1 addition & 1 deletion app/telemetry/action/fcmsgintervalhandler.h
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
#include <optional>
#include <qsettings.h>

#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
Expand Down
4 changes: 2 additions & 2 deletions app/telemetry/action/impl/cmdsender.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@

#include <qdebug.h>

#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 <future>

CmdSender::CmdSender()
Expand Down
2 changes: 1 addition & 1 deletion app/telemetry/action/impl/cmdsender.h
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
#ifndef CMDSENDER_H
#define CMDSENDER_H

#include "../../util/mavlink_include.h"
#include "../../tutil/mavlink_include.h"

#include <optional>
#include <functional>
Expand Down
2 changes: 1 addition & 1 deletion app/telemetry/action/impl/xparam.cpp
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#include "xparam.h"
#include "util/qopenhdmavlinkhelper.hpp"
#include "tutil/qopenhdmavlinkhelper.hpp"

#include <cstring>
#include <sstream>
Expand Down
2 changes: 1 addition & 1 deletion app/telemetry/action/impl/xparam.h
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
#include <functional>
#include <vector>

#include "../../util/mavlink_include.h"
#include "../../tutil/mavlink_include.h"

class XParam
{
Expand Down
2 changes: 1 addition & 1 deletion app/telemetry/action/ohdaction.cpp
Original file line number Diff line number Diff line change
@@ -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"
Expand Down
2 changes: 1 addition & 1 deletion app/telemetry/connection/tcp_connection.cpp
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#include "tcp_connection.h"
#include "util/qopenhdmavlinkhelper.hpp"
#include "tutil/qopenhdmavlinkhelper.hpp"

#ifdef __windows__
#define _WIN32_WINNT 0x0600 //TODO dirty
Expand Down
2 changes: 1 addition & 1 deletion app/telemetry/connection/tcp_connection.h
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
#ifndef TCPCONNECTION2_H
#define TCPCONNECTION2_H

#include "../util/mavlink_include.h"
#include "../tutil/mavlink_include.h"

#include <thread>
#include <memory.h>
Expand Down
2 changes: 1 addition & 1 deletion app/telemetry/connection/udp_connection.cpp
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#include "udp_connection.h"
#include "util/qopenhdmavlinkhelper.hpp"
#include "tutil/qopenhdmavlinkhelper.hpp"

#ifdef __windows__
#define _WIN32_WINNT 0x0600 //TODO dirty
Expand Down
2 changes: 1 addition & 1 deletion app/telemetry/connection/udp_connection.h
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
#ifndef MUDPLINK_H
#define MUDPLINK_H

#include "../util/mavlink_include.h"
#include "../tutil/mavlink_include.h"

#include <thread>
#include <memory.h>
Expand Down
7 changes: 5 additions & 2 deletions app/telemetry/models/aohdsystem.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand All @@ -16,7 +16,7 @@
#include <logging/hudlogmessagesmodel.h>

#include "util/qopenhd.h"
#include "../util/qopenhdmavlinkhelper.hpp"
#include "../tutil/qopenhdmavlinkhelper.hpp"

#include <../util/WorkaroundMessageBox.h>
#include "../settings/wblinksettingshelper.h"
Expand Down Expand Up @@ -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){
Expand Down
Loading

0 comments on commit fcc8cbb

Please sign in to comment.