Skip to content

Commit

Permalink
QT 6 migration things. no functional changes (#671)
Browse files Browse the repository at this point in the history
* qt6 porting

* exp android Qt6

* exp android Qt6 - works

* exp android Qt6 - works

* add android and androidqt6 directories for android qt5, qt6 respective

* add android and androidqt6 directories for android qt5, qt6 respective

* update camera.hpp

* update camera.hpp

* re-enable rotation for QT5
  • Loading branch information
Consti10 authored Mar 11, 2024
1 parent 261877c commit a7a4977
Show file tree
Hide file tree
Showing 21 changed files with 90 additions and 25 deletions.
27 changes: 15 additions & 12 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ find_package(Qt6 ${X_QT_VERSION} REQUIRED COMPONENTS Widgets)

qt_standard_project_setup(REQUIRES ${X_QT_VERSION})

qt_add_executable(QOpenHDApp
set(QOPENHD_SOURCE_FILES_LIST
app/main.cpp
#
app/adsb/adsbvehicle.cpp
Expand Down Expand Up @@ -45,14 +45,11 @@ qt_add_executable(QOpenHDApp
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
Expand All @@ -61,18 +58,15 @@ qt_add_executable(QOpenHDApp
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/telemetry/tutil/geodesi_helper.cpp

###
#
#app/videostreaming/vscommon/custom/rawreceiver.cpp
#app/videostreaming/vscommon/rtp/rtpreceiver.cpp
#app/videostreaming/vscommon/rtp/ParseRTP.cpp
Expand All @@ -82,13 +76,17 @@ qt_add_executable(QOpenHDApp
app/videostreaming/vscommon/rtp/rtpreceiver.cpp
app/videostreaming/vscommon/udp/UDPReceiver.cpp
app/videostreaming/vscommon/decodingstatistcs.cpp
)

qt_add_executable(QOpenHDApp
MANUAL_FINALIZATION
${QOPENHD_SOURCE_FILES_LIST}
##
lib/geographiclib-c-2.0/src/geodesic.c
##
##
##
qml/qml.qrc
##
androidqt6/AndroidManifest.xml
)

target_include_directories(QOpenHDApp PUBLIC app)
Expand Down Expand Up @@ -124,10 +122,15 @@ target_link_libraries(QOpenHDApp
PRIVATE Qt6::Core Qt6::Quick Qt6::Gui Qt6::Widgets
)

set_property(TARGET QOpenHDApp APPEND PROPERTY QT_ANDROID_PACKAGE_SOURCE_DIR
${CMAKE_CURRENT_SOURCE_DIR}/androidqt6)

include(lib/h264/h264.cmake)
include(app/videostreaming/avcodec/avcodec_video.cmake)
include(app/videostreaming/android/videostreamingandroid.cmake)
#include(app/videostreaming/avcodec/avcodec_video.cmake)
#include(app/videostreaming/android/videostreamingandroid.cmake)
#include(app/videostreaming/gstreamer/gst_video.cmake)

qt_finalize_executable(QOpenHDApp)
#include(GNUInstallDirs)
#install(TARGETS QOpenHD
# BUNDLE DESTINATION .
Expand Down
32 changes: 32 additions & 0 deletions androidqt6/AndroidManifest.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
<?xml version="1.0"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android" android:installLocation="auto" android:versionName="v16" android:versionCode="16" package="com.openhd.openhd">

<!-- The following comment will be replaced upon deployment with default permissions based on the dependencies of the application.
Remove the comment if you do not require these default permissions. -->
<uses-permission android:name="android.permission.INTERNET"/>
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE"/>
<uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE"/>

<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE"/>
<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION"/>

<!-- The following comment will be replaced upon deployment with default features based on the dependencies of the application.
Remove the comment if you do not require these default features. -->
<!-- %%INSERT_FEATURES -->

<supports-screens android:largeScreens="true" android:normalScreens="true" android:anyDensity="true" android:smallScreens="true"/>

<application android:name="org.qtproject.qt.android.bindings.QtApplication" android:extractNativeLibs="true" android:hardwareAccelerated="true" android:label="QOpenHD" android:requestLegacyExternalStorage="true" android:icon="@drawable/icon" android:allowBackup="true" android:fullBackupOnly="false">

<activity android:name="org.qtproject.qt.android.bindings.QtActivity" android:configChanges="orientation|uiMode|screenLayout|screenSize|smallestScreenSize|layoutDirection|locale|fontScale|keyboard|keyboardHidden|navigation|mcc|mnc|density" android:label="QOpenHDActivity" android:launchMode="singleTop" android:screenOrientation="userLandscape" android:exported="true">
<intent-filter>
<action android:name="android.intent.action.MAIN"/>
<category android:name="android.intent.category.LAUNCHER"/>
</intent-filter>
<meta-data android:name="android.app.lib_name" android:value="-- %%INSERT_APP_LIB_NAME%% --"/>
<meta-data android:name="android.app.background_running" android:value="false"/>
<meta-data android:name="android.app.extract_android_style" android:value="none"/>
</activity>
<!-- For adding service(s) please check: https://wiki.qt.io/AndroidServices -->
</application>
</manifest>
Binary file added androidqt6/qopenhd_key.jks
Binary file not shown.
Binary file added androidqt6/res/drawable-hdpi/icon.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added androidqt6/res/drawable-hdpi/splashscreen.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added androidqt6/res/drawable-ldpi/icon.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added androidqt6/res/drawable-ldpi/splashscreen.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added androidqt6/res/drawable-mdpi/icon.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added androidqt6/res/drawable-mdpi/splashscreen.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added androidqt6/res/drawable-xhdpi/icon.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added androidqt6/res/drawable-xhdpi/splashscreen.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added androidqt6/res/drawable-xxhdpi/icon.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added androidqt6/res/drawable-xxhdpi/splashscreen.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added androidqt6/res/drawable-xxxhdpi/icon.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added androidqt6/res/drawable-xxxhdpi/splashscreen.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added androidqt6/res/play_store.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
6 changes: 3 additions & 3 deletions app/telemetry/models/camerastreammodel.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ CameraStreamModel &CameraStreamModel::instance(int cam_index)
QString CameraStreamModel::camera_type_to_string(int camera_type)
{
if(camera_type<0)return "N/A";
auto tmp=XCamera{camera_type,0,""};
auto tmp=XCamera{camera_type,0,0};
return tmp.cam_type_as_verbose_string().c_str();
}

Expand Down Expand Up @@ -78,15 +78,15 @@ bool CameraStreamModel::is_valid_resolution_fps_string(QString input)

QString CameraStreamModel::get_default_resolution()
{
auto tmp=XCamera{m_camera_type,0,""};
auto tmp=XCamera{m_camera_type,0,0};
auto default_res_fps=tmp.get_default_resolution_fps();
return default_res_fps.as_string().c_str();
}

QStringList CameraStreamModel::get_supported_resolutions()
{
QStringList ret;
auto tmp_cam=XCamera{m_camera_type,0,""};
auto tmp_cam=XCamera{m_camera_type,0,0};
auto tmp=tmp_cam.get_supported_resolutions();
for(auto& element:tmp){
ret.push_back(element.as_string().c_str());
Expand Down
17 changes: 10 additions & 7 deletions app/telemetry/models/openhd_core/camera.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -171,7 +171,7 @@ struct XCamera {
// Only valid if camera is of type USB
// For CSI camera(s) we in general 'know' from platform and cam type how to
// tell the pipeline which cam/source to use.
std::string usb_v4l2_device_node;
int usb_v4l2_device_number;
bool requires_rpi_mmal_pipeline() const {
return camera_type == X_CAM_TYPE_RPI_MMAL_HDMI_TO_CSI;
}
Expand Down Expand Up @@ -202,16 +202,13 @@ struct XCamera {
std::vector<ResolutionFramerate> get_supported_resolutions() const {
if (requires_rpi_veye_pipeline()) {
// Except one, all veye camera(s) only do 1080p30 -
// Urghs but not via v4l2. So we only expose 1080p30
/*if(camera_type==X_CAM_TYPE_RPI_V4L2_VEYE_CSIMX307){
if (camera_type == X_CAM_TYPE_RPI_V4L2_VEYE_CSIMX307) {
std::vector<ResolutionFramerate> ret;
ret.push_back(ResolutionFramerate{640, 480, 90});
ret.push_back(ResolutionFramerate{1280, 720, 50});
ret.push_back(ResolutionFramerate{1280, 720, 60});
ret.push_back(ResolutionFramerate{1920, 1080, 30});
}else{
} else {
return {ResolutionFramerate{1920, 1080, 30}};
}*/
}
return {ResolutionFramerate{1920, 1080, 30}};
} else if (requires_x20_cedar_pipeline()) {
// also easy, 720p60 only (for now)
Expand Down Expand Up @@ -380,4 +377,10 @@ static std::string get_verbose_string_of_resolution(
return ss.str();
}

static std::string get_v4l2_device_name_string(int value) {
std::stringstream ss;
ss << "/dev/video" << value;
return ss.str();
}

#endif // OPENHD_CAMERA_HPP
2 changes: 1 addition & 1 deletion app/telemetry/settings/mavlinksettingsmodel.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -294,7 +294,7 @@ QVariant MavlinkSettingsModel::data(const QModelIndex &index, int role) const
if(std::holds_alternative<int>(data.value)){
if(data.unique_id=="CAMERA_TYPE"){
auto value=std::get<int>(data.value);
XCamera tmp{value,0,""};
XCamera tmp{value,0,0};
return tmp.cam_type_as_verbose_string().c_str();
}
auto value=std::get<int>(data.value);
Expand Down
27 changes: 27 additions & 0 deletions app/videostreaming/gstreamer/gst_video.cmake
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
set(GSTREAMER_SOURCES
${CMAKE_CURRENT_LIST_DIR}/gstqmlglsinkstream.cpp
${CMAKE_CURRENT_LIST_DIR}/gstrtpaudioplayer.cpp
${CMAKE_CURRENT_LIST_DIR}/gstrtpreceiver.cpp
)

target_sources(QOpenHDApp PRIVATE ${GSTREAMER_SOURCES})

target_include_directories(QOpenHDApp
PUBLIC
${CMAKE_CURRENT_LIST_DIR}
)

# Link to gstreamer

find_package(PkgConfig REQUIRED)
pkg_search_module(GST REQUIRED
gstreamer-1.0>=1.4
gstreamer-app-1.0>=1.4
)
pkg_search_module(gstreamer REQUIRED IMPORTED_TARGET gstreamer-1.0>=1.4)
pkg_search_module(gstreamer-app REQUIRED IMPORTED_TARGET gstreamer-app-1.0>=1.4)
target_link_libraries(QOpenHDApp PRIVATE PkgConfig::gstreamer PkgConfig::gstreamer-app)
#target_link_libraries(QOpenHDApp PRIVATE gstreamer-1.0 gstreamer-video-1.0 gstreamer-gl-1.0 gstreamer-app-1.0)

add_compile_definitions(QOPENHD_ENABLE_GSTREAMER_QMLGLSINK)
add_compile_definitions(QOPENHD_GSTREAMER_SECONDARY_VIDEO)
4 changes: 2 additions & 2 deletions qml/main.qml
Original file line number Diff line number Diff line change
Expand Up @@ -35,8 +35,8 @@ ApplicationWindow {
_qrenderstats.set_window_height(height)
}

//contentOrientation: settings.general_screen_rotation===0 ? Qt.PortraitOrientation : Qt.LandscapeOrientation
//contentItem.rotation: settings.general_screen_rotation
contentOrientation: settings.general_screen_rotation===0 ? Qt.PortraitOrientation : Qt.LandscapeOrientation
contentItem.rotation: settings.general_screen_rotation

//minimumWidth: 850
//minimumHeight: 480
Expand Down

0 comments on commit a7a4977

Please sign in to comment.