diff --git a/.github/workflows/builds_desktop.yml b/.github/workflows/builds_desktop.yml
index d5e10834f..8275f2e7f 100644
--- a/.github/workflows/builds_desktop.yml
+++ b/.github/workflows/builds_desktop.yml
@@ -49,18 +49,19 @@ jobs:
# Setup env
- name: Setup env
run: |
- qmake --version
+ cmake --version
sudo rm /home/runner/work/${{env.APP_NAME}}/Qt/${{env.QT_VERSION}}/gcc_64/plugins/sqldrivers/libqsqlmimer.so
# Build application
- name: Build application
run: |
- qmake ${{env.APP_NAME}}.pro CONFIG+=release PREFIX=/usr
- make -j$(nproc)
+ cmake -B build/ -DCMAKE_BUILD_TYPE=Release -G Ninja
+ cmake --build build/ --config Release
# Deploy application
- name: Deploy application
- run: ./deploy_linux.sh -c -i -p
+ run: |
+ ./deploy_linux.sh -c -i -p
# Upload application ZIP
- name: Upload application ZIP
@@ -102,13 +103,14 @@ jobs:
# Setup env
- name: Setup env
run: |
- qmake --version
+ cmake --version
# Build application
- name: Build application
run: |
- qmake ${{env.APP_NAME}}.pro CONFIG+=release
- make -j`sysctl -n hw.logicalcpu`
+ export CMAKE_BUILD_PARALLEL_LEVEL=`sysctl -n hw.logicalcpu`
+ cmake -B build/ -DCMAKE_BUILD_TYPE=Release
+ cmake --build build/ --config Release
# Deploy application
- name: Deploy application
@@ -156,12 +158,13 @@ jobs:
# Setup env
- name: Setup env
run: |
- qmake --version
+ cmake --version
# Build application
- name: Build application
run: |
- qmake ${{env.APP_NAME}}.pro CONFIG+=release
+ cmake -B build/ -DCMAKE_BUILD_TYPE=Release -G "NMake Makefiles"
+ cd build/
nmake
# Deploy application
diff --git a/.github/workflows/builds_mobile.yml b/.github/workflows/builds_mobile.yml
index fd3ec480a..f155c59a9 100644
--- a/.github/workflows/builds_mobile.yml
+++ b/.github/workflows/builds_mobile.yml
@@ -63,7 +63,8 @@ jobs:
# Setup env
- name: Setup env
run: |
- qmake --version
+ echo "QT_HOST_PATH=/home/runner/work/${{env.APP_NAME}}/Qt/${{env.QT_VERSION}}/gcc_64" >> $GITHUB_ENV
+ echo "QT_TARGET_PATH=/home/runner/work/${{env.APP_NAME}}/Qt/${{env.QT_VERSION}}/android_arm64_v8a" >> $GITHUB_ENV
# Build application
- name: Build application
@@ -92,10 +93,16 @@ jobs:
modules: qtconnectivity qtcharts qtpositioning
extra: '--autodesktop'
+ # Install dependencies (from package manager)
+ #- name: Install dependencies (from package manager)
+ # run: |
+ # brew install cmake
+
# Setup env
- name: Setup env
run: |
- qmake --version
+ echo "QT_HOST_PATH=/Users/runner/work/${{env.APP_NAME}}/Qt/${{env.QT_VERSION}}/macos" >> $GITHUB_ENV
+ echo "QT_TARGET_PATH=/Users/runner/work/${{env.APP_NAME}}/Qt/${{env.QT_VERSION}}/ios" >> $GITHUB_ENV
# Build application
- name: Build application
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 430053dcf..dff0c57b2 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -27,8 +27,9 @@ message(STATUS "[PROJECT] QT_HOST_PATH = ${QT_HOST_PATH}")
################################################################################
-find_package(Qt6 REQUIRED COMPONENTS Core Bluetooth Network Sql)
+find_package(Qt6 REQUIRED COMPONENTS Core Bluetooth Positioning Network Sql)
find_package(Qt6 REQUIRED COMPONENTS Gui Qml Quick QuickControls2 Svg Widgets Charts)
+find_package(Qt6 REQUIRED COMPONENTS LinguistTools)
qt_standard_project_setup(REQUIRES 6.7)
@@ -77,13 +78,12 @@ set(SOURCES
src/devices/device_esp32_geigercounter.cpp src/devices/device_esp32_geigercounter.h
src/devices/device_esp32_higrow.cpp src/devices/device_esp32_higrow.h
src/devices/device_ess_generic.cpp src/devices/device_ess_generic.h
- src/thirdparty/RC4/rc4.cpp src/thirdparty/RC4/rc4.h
+ thirdparty/RC4/rc4.cpp thirdparty/RC4/rc4.h
src/main.cpp
- i18n/i18n.qrc
qml/qml.qrc
qml/ComponentLibrary/ComponentLibrary.qrc
+ assets/icons/IconLibrary.qrc
assets/assets.qrc
- assets/icons.qrc
assets/devices.qrc
assets/plants.qrc
)
@@ -104,18 +104,79 @@ qt_add_executable(${CMAKE_PROJECT_NAME}
)
target_include_directories(${CMAKE_PROJECT_NAME} PRIVATE src/)
-target_include_directories(${CMAKE_PROJECT_NAME} PRIVATE src/thirdparty/)
+
+################################################################################
+
+qt_standard_project_setup(
+ I18N_SOURCE_LANGUAGE en
+ I18N_TRANSLATED_LANGUAGES ca da de es fr fy hu nb nl nn pt ru zh_CN zh_TW
+)
+qt_add_translations(${CMAKE_PROJECT_NAME}
+ TS_FILE_BASE ${CMAKE_PROJECT_NAME}
+ TS_FILE_DIR ${CMAKE_SOURCE_DIR}/i18n/
+ RESOURCE_PREFIX "/i18n"
+)
+
+################################################################################
+
+# SingleApplication
+set(QAPPLICATION_CLASS QApplication)
+add_subdirectory(thirdparty/SingleApplication)
+target_link_libraries(${CMAKE_PROJECT_NAME} PRIVATE SingleApplication)
+
+# AppUtils
+add_subdirectory(thirdparty/AppUtils)
+target_link_libraries(${CMAKE_PROJECT_NAME} PRIVATE AppUtils)
+
+# MobileUI
+add_subdirectory(thirdparty/MobileUI)
+target_link_libraries(${CMAKE_PROJECT_NAME} PRIVATE MobileUI)
+
+# MobileSharing
+add_subdirectory(thirdparty/MobileSharing)
+target_link_libraries(${CMAKE_PROJECT_NAME} PRIVATE MobileSharing)
+
+# SunAndMoon
+add_subdirectory(thirdparty/SunAndMoon)
+target_link_libraries(${CMAKE_PROJECT_NAME} PRIVATE SunAndMoon)
+
+# ComponentLibrary
+#add_subdirectory(thirdparty/ComponentLibrary)
+#target_link_libraries(${CMAKE_PROJECT_NAME} PRIVATE ComponentLibraryplugin)
+
+target_include_directories(${CMAKE_PROJECT_NAME} PRIVATE thirdparty/)
+
+################################################################################
+
+# Qt
+target_link_libraries(${CMAKE_PROJECT_NAME} PRIVATE
+ Qt6::Core
+ Qt6::Network
+ Qt6::Bluetooth
+ Qt6::Positioning
+ Qt6::Sql
+ Qt6::Gui
+ Qt6::Svg
+ Qt6::Qml
+ Qt6::Quick
+ Qt6::QuickControls2
+ Qt6::Charts
+)
+
+if(NOT IOS AND NOT ANDROID)
+ target_link_libraries(${CMAKE_PROJECT_NAME} PRIVATE Qt6::Widgets)
+endif()
################################################################################
## Android
-if(ANDROID)
+if (CMAKE_SYSTEM_NAME STREQUAL "Android")
set_target_properties(${CMAKE_PROJECT_NAME} PROPERTIES
- QT_ANDROID_ABIS "armeabi-v7a;arm64-v8a;x86;x86_64"
- QT_ANDROID_BUILD_ALL_ABIS ON
+ #QT_ANDROID_ABIS "armeabi-v7a;arm64-v8a;x86;x86_64"
+ #QT_ANDROID_BUILD_ALL_ABIS ON
QT_ANDROID_MIN_SDK_VERSION 23
- QT_ANDROID_TARGET_SDK_VERSION 34
- QT_ANDROID_PACKAGE_SOURCE_DIR "${CMAKE_CURRENT_SOURCE_DIR}/assets/android/"
+ QT_ANDROID_TARGET_SDK_VERSION 35
+ QT_ANDROID_PACKAGE_SOURCE_DIR "${CMAKE_SOURCE_DIR}/assets/android/"
)
target_compile_definitions(${CMAKE_PROJECT_NAME} PRIVATE QT_CONNECTIVITY_PATCHED)
@@ -135,7 +196,7 @@ if(APPLE)
endif()
## macOS
-if(APPLE AND NOT IOS)
+if (CMAKE_SYSTEM_NAME STREQUAL "Darwin")
set(CMAKE_OSX_ARCHITECTURES "x86_64;arm64")
set(CMAKE_OSX_DEPLOYMENT_TARGET "11.0")
set(CMAKE_XCODE_ATTRIBUTE_INFOPLIST_FILE "${CMAKE_CURRENT_SOURCE_DIR}/assets/macos/Info.plist")
@@ -143,75 +204,49 @@ if(APPLE AND NOT IOS)
endif()
## iOS
-if(IOS)
- set(IPHONEOS_DEPLOYMENT_TARGET "14.0")
+if (CMAKE_SYSTEM_NAME STREQUAL "iOS")
set(CMAKE_OSX_ARCHITECTURES "arm64")
set(CMAKE_OSX_SYSROOT "iphoneos")
set(CMAKE_OSX_DEPLOYMENT_TARGET "14.0")
set(CMAKE_XCODE_ATTRIBUTE_IPHONEOS_DEPLOYMENT_TARGET "14.0")
- set(CMAKE_XCODE_ATTRIBUTE_INFOPLIST_FILE "${CMAKE_CURRENT_SOURCE_DIR}/assets/ios/Info.plist")
set(CMAKE_XCODE_ATTRIBUTE_TARGETED_DEVICE_FAMILY "1,2") # iPhone,iPad
-endif()
-
-## Windows
-if(WIN32)
- target_compile_definitions(${CMAKE_PROJECT_NAME} PRIVATE _USE_MATH_DEFINES)
-endif()
-
-################################################################################
-
-# SingleApplication
-set(QAPPLICATION_CLASS QApplication)
-add_subdirectory(src/thirdparty/SingleApplication)
-target_link_libraries(${CMAKE_PROJECT_NAME} PRIVATE SingleApplication)
-
-# AppUtils
-add_subdirectory(src/thirdparty/AppUtils)
-target_link_libraries(${CMAKE_PROJECT_NAME} PRIVATE AppUtils)
-
-# MobileUI
-add_subdirectory(src/thirdparty/MobileUI)
-target_link_libraries(${CMAKE_PROJECT_NAME} PRIVATE MobileUI)
-
-# MobileSharing
-add_subdirectory(src/thirdparty/MobileSharing)
-target_link_libraries(${CMAKE_PROJECT_NAME} PRIVATE MobileSharing)
+ set(CMAKE_XCODE_ATTRIBUTE_INFOPLIST_FILE "${CMAKE_CURRENT_SOURCE_DIR}/assets/ios/Info.plist")
-# SunAndMoon
-add_subdirectory(src/thirdparty/SunAndMoon)
-target_link_libraries(${CMAKE_PROJECT_NAME} PRIVATE SunAndMoon)
+ set(assets_catalog_path "${CMAKE_SOURCE_DIR}/assets/ios/Assets.xcassets")
+ target_sources(${CMAKE_PROJECT_NAME} PRIVATE ${assets_catalog_path})
+ set_source_files_properties(${assets_catalog_path} PROPERTIES MACOSX_PACKAGE_LOCATION Resources)
-# Qt
-target_link_libraries(${CMAKE_PROJECT_NAME} PRIVATE
- Qt6::Core
- Qt6::Bluetooth
- Qt6::Network
- Qt6::Sql
- Qt6::Gui
- Qt6::Qml
- Qt6::Quick
- Qt6::QuickControls2
- Qt6::Svg
- Qt6::Charts
-)
-if(NOT IOS AND NOT ANDROID)
- target_link_libraries(${CMAKE_PROJECT_NAME} PRIVATE
- Qt6::Widgets
+ set_target_properties(${CMAKE_PROJECT_NAME} PROPERTIES
+ MACOSX_BUNDLE ON
+ MACOSX_BUNDLE_INFO_PLIST "${CMAKE_SOURCE_DIR}/assets/ios/Info.plist"
+ # Qt
+ QT_IOS_LAUNCH_SCREEN "${CMAKE_SOURCE_DIR}/assets/ios/LaunchScreen.storyboard"
+ # WIP # Old way ???
+ MACOSX_BUNDLE_GUI_IDENTIFIER "io.emeric.watchflower"
+ MACOSX_BUNDLE_BUNDLE_NAME ${CMAKE_PROJECT_NAME}
+ MACOSX_BUNDLE_BUNDLE_VERSION ${CMAKE_PROJECT_VERSION}
+ MACOSX_BUNDLE_SHORT_VERSION_STRING ${PROJECT_VERSION_MAJOR}.${PROJECT_VERSION_MINOR}
+ MACOSX_BUNDLE_COPYRIGHT "Copyright © 2024 Emeric Grange"
+ # WIP # New Xcode attributes ???
+ XCODE_ATTRIBUTE_PRODUCT_BUNDLE_IDENTIFIER "io.emeric.watchflower"
+ XCODE_ATTRIBUTE_PRODUCT_NAME ${CMAKE_PROJECT_NAME}
+ XCODE_ATTRIBUTE_CURRENT_PROJECT_VERSION ${CMAKE_PROJECT_VERSION}
+ XCODE_ATTRIBUTE_MARKETING_VERSION ${PROJECT_VERSION_MAJOR}.${PROJECT_VERSION_MINOR}
+ XCODE_ATTRIBUTE_IPHONEOS_DEPLOYMENT_TARGET "14.0"
+ XCODE_ATTRIBUTE_TARGETED_DEVICE_FAMILY "1,2" # iPhone,iPad
+ XCODE_ATTRIBUTE_ASSETCATALOG_COMPILER_APPICON_NAME "AppIcon"
)
endif()
-################################################################################
-
-if(lupdate_only)
- target_sources(${CMAKE_PROJECT_NAME} PUBLIC
- qml/*.js qml/*.qml
- qml/components/*.qml
- qml/components_generic/*.qml
- qml/components_js/*.js
+## Windows
+if(CMAKE_SYSTEM_NAME STREQUAL "Windows")
+ set_target_properties(${CMAKE_PROJECT_NAME} PROPERTIES
+ WIN32_EXECUTABLE ON
)
endif()
-if(CMAKE_BUILD_TYPE STREQUAL Release)
+## Release build? Set "no debug" macros
+if (CMAKE_BUILD_TYPE STREQUAL Release)
target_compile_definitions(${CMAKE_PROJECT_NAME} PRIVATE
NDEBUG
QT_NO_DEBUG
@@ -219,25 +254,19 @@ if(CMAKE_BUILD_TYPE STREQUAL Release)
)
endif()
+################################################################################
+
+# Output
set_target_properties(${CMAKE_PROJECT_NAME} PROPERTIES
- MACOSX_BUNDLE ON
- WIN32_EXECUTABLE ON
+ #ARCHIVE_OUTPUT_DIRECTORY "${CMAKE_SOURCE_DIR}/lib"
+ #LIBRARY_OUTPUT_DIRECTORY "${CMAKE_SOURCE_DIR}/lib"
+ RUNTIME_OUTPUT_DIRECTORY "${CMAKE_SOURCE_DIR}/bin"
)
+# Output
install(TARGETS ${CMAKE_PROJECT_NAME}
- BUNDLE DESTINATION .
- ARCHIVE DESTINATION .
- LIBRARY DESTINATION .
- RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR}
-)
-
-qt_generate_deploy_qml_app_script(
- TARGET ${CMAKE_PROJECT_NAME}
- OUTPUT_SCRIPT deploy_script
- NO_UNSUPPORTED_PLATFORM_ERROR
- DEPLOY_USER_QML_MODULES_ON_UNSUPPORTED_PLATFORM
- MACOS_BUNDLE_POST_BUILD
+ BUNDLE DESTINATION bin/
+ LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}
)
-install(SCRIPT ${deploy_script})
################################################################################
diff --git a/README.md b/README.md
index ee91ec398..2d56742bb 100644
--- a/README.md
+++ b/README.md
@@ -123,8 +123,8 @@ For Android builds, you'll need the appropriates JDK (17) SDK (28+) and NDK (26b
```bash
$ git clone https://github.com/emericg/WatchFlower.git
$ cd WatchFlower/
-$ qmake6
-$ make
+$ cmake -B build/
+$ cmake --build build/
```
#### Using WatchFlower
diff --git a/WatchFlower.pro b/WatchFlower.pro
deleted file mode 100644
index 43fce3a91..000000000
--- a/WatchFlower.pro
+++ /dev/null
@@ -1,344 +0,0 @@
-TARGET = WatchFlower
-VERSION = 6.0
-
-DEFINES+= APP_NAME=\\\"$$TARGET\\\"
-DEFINES+= APP_VERSION=\\\"$$VERSION\\\"
-
-CONFIG += c++17
-QT += core bluetooth positioning sql
-QT += qml quick quickcontrols2 svg charts
-
-!android:!ios {
- QT += widgets # for proper systray and menubar support
-}
-
-# Validate Qt version
-!versionAtLeast(QT_VERSION, 6.5) : error("You need at least Qt version 6.5 for $${TARGET}")
-
-# Bundle name
-QMAKE_TARGET_BUNDLE_PREFIX = io.emeric
-QMAKE_BUNDLE = watchflower
-
-# Project modules ##############################################################
-
-# App utils
-CONFIG += UTILS_DOCK_ENABLED
-include(src/thirdparty/AppUtils/AppUtils.pri)
-
-# MobileUI and MobileSharing for mobile OS
-include(src/thirdparty/MobileUI/MobileUI.pri)
-include(src/thirdparty/MobileSharing/MobileSharing.pri)
-
-# SingleApplication for desktop OS
-include(src/thirdparty/SingleApplication/SingleApplication.pri)
-DEFINES += QAPPLICATION_CLASS=QApplication
-
-# Sun and moon utils
-include(src/thirdparty/SunAndMoon/SunAndMoon.pri)
-
-# Project files ################################################################
-
-SOURCES += src/main.cpp \
- src/SettingsManager.cpp \
- src/DatabaseManager.cpp \
- src/NotificationManager.cpp \
- src/Plant.cpp \
- src/PlantDatabase.cpp \
- src/Journal.cpp \
- src/DeviceManager.cpp \
- src/DeviceManager_advertisement.cpp \
- src/DeviceManager_nearby.cpp \
- src/DeviceManager_export.cpp \
- src/DeviceFilter.cpp \
- src/device.cpp \
- src/device_infos.cpp \
- src/device_sensor.cpp \
- src/device_sensor_advertisement.cpp \
- src/device_plantsensor.cpp \
- src/device_thermometer.cpp \
- src/device_environmental.cpp \
- src/devices/device_flowercare.cpp \
- src/devices/device_flowercare_tuya.cpp \
- src/devices/device_flowerpower.cpp \
- src/devices/device_ropot.cpp \
- src/devices/device_parrotpot.cpp \
- src/devices/device_bparasite.cpp \
- src/devices/device_hygrotemp_atc.cpp \
- src/devices/device_hygrotemp_cgd1.cpp \
- src/devices/device_hygrotemp_cgdk2.cpp \
- src/devices/device_hygrotemp_cgg1.cpp \
- src/devices/device_hygrotemp_cgp1w.cpp \
- src/devices/device_hygrotemp_clock.cpp \
- src/devices/device_hygrotemp_square.cpp \
- src/devices/device_hygrotemp_lywsdcgq.cpp \
- src/devices/device_thermobeacon.cpp \
- src/devices/device_cgdn1.cpp \
- src/devices/device_jqjcy01ym.cpp \
- src/devices/device_wp6003.cpp \
- src/devices/device_esp32_airqualitymonitor.cpp \
- src/devices/device_esp32_geigercounter.cpp \
- src/devices/device_esp32_higrow.cpp \
- src/devices/device_ess_generic.cpp \
- src/thirdparty/RC4/rc4.cpp
-
-HEADERS += src/SettingsManager.h \
- src/DatabaseManager.h \
- src/NotificationManager.h \
- src/Plant.h \
- src/PlantUtils.h \
- src/PlantDatabase.h \
- src/Journal.h \
- src/DeviceManager.h \
- src/DeviceFilter.h \
- src/device.h \
- src/device_utils.h \
- src/device_firmwares.h \
- src/device_infos.h \
- src/device_sensor.h \
- src/device_plantsensor.h \
- src/device_thermometer.h \
- src/device_environmental.h \
- src/devices/device_flowercare.h \
- src/devices/device_flowercare_tuya.h \
- src/devices/device_flowerpower.h \
- src/devices/device_ropot.h \
- src/devices/device_parrotpot.h \
- src/devices/device_bparasite.h \
- src/devices/device_hygrotemp_atc.h \
- src/devices/device_hygrotemp_cgd1.h \
- src/devices/device_hygrotemp_cgdk2.h \
- src/devices/device_hygrotemp_cgg1.h \
- src/devices/device_hygrotemp_cgp1w.h \
- src/devices/device_hygrotemp_clock.h \
- src/devices/device_hygrotemp_square.h \
- src/devices/device_hygrotemp_lywsdcgq.h \
- src/devices/device_thermobeacon.h \
- src/devices/device_cgdn1.h \
- src/devices/device_jqjcy01ym.h \
- src/devices/device_wp6003.h \
- src/devices/device_esp32_airqualitymonitor.h \
- src/devices/device_esp32_geigercounter.h \
- src/devices/device_esp32_higrow.h \
- src/devices/device_ess_generic.h \
- src/thirdparty/RC4/rc4.h
-
-!android:!ios {
-SOURCES += src/MenubarManager.cpp \
- src/SystrayManager.cpp
-
-HEADERS += src/MenubarManager.h \
- src/SystrayManager.h
-}
-INCLUDEPATH += src/ src/thirdparty/
-
-RESOURCES += qml/ComponentLibrary/ComponentLibrary.qrc
-RESOURCES += assets/icons/IconLibrary.qrc
-
-RESOURCES += qml/qml.qrc \
- i18n/i18n.qrc \
- assets/assets.qrc \
- assets/devices.qrc \
- assets/plants.qrc
-
-OTHER_FILES += README.md \
- deploy_linux.sh \
- deploy_macos.sh \
- deploy_windows.sh \
- .github/workflows/builds_desktop.yml \
- .github/workflows/builds_mobile.yml \
- .github/workflows/flatpak.yml \
- .gitignore
-
-TRANSLATIONS = i18n/watchflower_ca.ts \
- i18n/watchflower_da.ts \
- i18n/watchflower_de.ts \
- i18n/watchflower_en.ts \
- i18n/watchflower_es.ts \
- i18n/watchflower_fr.ts \
- i18n/watchflower_fy.ts \
- i18n/watchflower_nb.ts \
- i18n/watchflower_nl.ts \
- i18n/watchflower_nn.ts \
- i18n/watchflower_pt.ts \
- i18n/watchflower_pt_BR.ts \
- i18n/watchflower_ru.ts \
- i18n/watchflower_zh_CN.ts \
- i18n/watchflower_zh_TW.ts
-
-lupdate_only {
- SOURCES += qml/*.qml qml/*.js \ qml/popups/*.qml \
- qml/components/*.qml qml/components_js/*.js
-}
-
-# Build settings ###############################################################
-
-# Use QtQuick compiler
-ios | android { CONFIG += qtquickcompiler }
-
-# Better handling of Bluetooth in the background
-#android { DEFINES += QT_CONNECTIVITY_PATCHED }
-
-win32 { DEFINES += _USE_MATH_DEFINES }
-
-DEFINES += QT_DEPRECATED_WARNINGS
-
-CONFIG(release, debug|release) : DEFINES += NDEBUG QT_NO_DEBUG QT_NO_DEBUG_OUTPUT
-
-unix {
- # Enables AddressSanitizer
- #QMAKE_CXXFLAGS += -fsanitize=address,undefined
- #QMAKE_LFLAGS += -fsanitize=address,undefined
-}
-
-# Build artifacts ##############################################################
-
-OBJECTS_DIR = build/$${QT_ARCH}/
-MOC_DIR = build/$${QT_ARCH}/
-RCC_DIR = build/$${QT_ARCH}/
-UI_DIR = build/$${QT_ARCH}/
-
-DESTDIR = bin/
-
-# Application deployment steps #################################################
-
-linux:!android {
- TARGET = $$lower($${TARGET})
-
- # Automatic application packaging # Needs linuxdeployqt installed
- #system(linuxdeployqt $${OUT_PWD}/$${DESTDIR}/ -qmldir=qml/)
-
- # Application packaging # Needs linuxdeployqt installed
- #deploy.commands = $${OUT_PWD}/$${DESTDIR}/ -qmldir=qml/
- #install.depends = deploy
- #QMAKE_EXTRA_TARGETS += install deploy
-
- # Installation steps
- isEmpty(PREFIX) { PREFIX = /usr/local }
- target_app.files += $${OUT_PWD}/$${DESTDIR}/$$lower($${TARGET})
- target_app.path = $${PREFIX}/bin/
- target_appentry.files += $${OUT_PWD}/assets/linux/$$lower($${TARGET}).desktop
- target_appentry.path = $${PREFIX}/share/applications
- target_appdata.files += $${OUT_PWD}/assets/linux/$$lower($${TARGET}).appdata.xml
- target_appdata.path = $${PREFIX}/share/appdata
- target_icon_appimage.files += $${OUT_PWD}/assets/linux/$$lower($${TARGET}).svg
- target_icon_appimage.path = $${PREFIX}/share/pixmaps/
- target_icon_flatpak.files += $${OUT_PWD}/assets/linux/$$lower($${TARGET}).svg
- target_icon_flatpak.path = $${PREFIX}/share/icons/hicolor/scalable/apps/
- INSTALLS += target_app target_appentry target_appdata target_icon_appimage target_icon_flatpak
-
- # Clean appdir/ and bin/ directories
- #QMAKE_CLEAN += $${OUT_PWD}/$${DESTDIR}/$$lower($${TARGET})
- #QMAKE_CLEAN += $${OUT_PWD}/appdir/
-}
-
-macx {
- # OS icons
- ICON = $${PWD}/assets/macos/$${TARGET}.icns
- #QMAKE_ASSET_CATALOGS_APP_ICON = "AppIcon"
- #QMAKE_ASSET_CATALOGS = $${PWD}/assets/macos/Images.xcassets
-
- # OS infos
- QMAKE_INFO_PLIST = $${PWD}/assets/macos/Info.plist
-
- # OS entitlement (sandbox and stuff)
- ENTITLEMENTS.name = CODE_SIGN_ENTITLEMENTS
- ENTITLEMENTS.value = $${PWD}/assets/macos/$${TARGET}.entitlements
- QMAKE_MAC_XCODE_SETTINGS += ENTITLEMENTS
-
- # Target architecture(s)
- QMAKE_APPLE_DEVICE_ARCHS = x86_64 arm64
-
- # Target OS
- QMAKE_MACOSX_DEPLOYMENT_TARGET = 10.15
-
- #======== Automatic bundle packaging
-
- # Deploy step (app bundle packaging)
- deploy.commands = macdeployqt $${OUT_PWD}/$${DESTDIR}/$${TARGET}.app -qmldir=qml/ -appstore-compliant
- install.depends = deploy
- QMAKE_EXTRA_TARGETS += install deploy
-
- # Installation step (note: app bundle packaging)
- isEmpty(PREFIX) { PREFIX = /usr/local }
- target.files += $${OUT_PWD}/${DESTDIR}/${TARGET}.app
- target.path = $$(HOME)/Applications
- INSTALLS += target
-
- # Clean step
- QMAKE_DISTCLEAN += -r $${OUT_PWD}/${DESTDIR}/${TARGET}.app
-
- #======== XCode
-
- # macOS developer settings
- exists($${PWD}/assets/macos/macos_signature.pri) {
- # Must contain values for:
- # QMAKE_DEVELOPMENT_TEAM
- # QMAKE_PROVISIONING_PROFILE
- # QMAKE_XCODE_CODE_SIGN_IDENTITY (optional)
- include($${PWD}/assets/macos/macos_signature.pri)
- }
-}
-
-win32 {
- # OS icon
- RC_ICONS = $${PWD}/assets/windows/$${TARGET}.ico
-
- # Deploy step
- deploy.commands = $$quote(windeployqt $${OUT_PWD}/$${DESTDIR}/ --qmldir qml/)
- install.depends = deploy
- QMAKE_EXTRA_TARGETS += install deploy
-
- # Installation step
- # TODO
-
- # Clean step
- # TODO
-}
-
-android {
- # ANDROID_TARGET_ARCH: [x86_64, armeabi-v7a, arm64-v8a]
- #message("ANDROID_TARGET_ARCH: $$ANDROID_TARGET_ARCH")
-
- SOURCES += $${PWD}/src/AndroidService.cpp
- HEADERS += $${PWD}/src/AndroidService.h
-
- OTHER_FILES += $${PWD}/assets/android/src/com/emeric/watchflower/WatchFlowerBootServiceBroadcastReceiver.java \
- $${PWD}/assets/android/src/com/emeric/watchflower/WatchFlowerAndroidService.java \
- $${PWD}/assets/android/src/com/emeric/watchflower/WatchFlowerAndroidNotifier.java \
- $${PWD}/assets/android/src/io/emeric/utils/QGpsUtils.java \
- $${PWD}/assets/android/src/io/emeric/utils/QShareUtils.java \
- $${PWD}/assets/android/src/io/emeric/utils/QSharePathResolver.java
-
- DISTFILES += $${PWD}/assets/android/AndroidManifest.xml \
- $${PWD}/assets/android/gradle.properties \
- $${PWD}/assets/android/build.gradle
-
- ANDROID_PACKAGE_SOURCE_DIR = $${PWD}/assets/android
-}
-
-ios {
- #QMAKE_IOS_DEPLOYMENT_TARGET = 11.0
- #message("QMAKE_IOS_DEPLOYMENT_TARGET: $$QMAKE_IOS_DEPLOYMENT_TARGET")
-
- CONFIG += no_autoqmake
-
- # OS infos
- QMAKE_INFO_PLIST = $${PWD}/assets/ios/Info.plist
- QMAKE_APPLE_TARGETED_DEVICE_FAMILY = 1,2 # 1: iPhone / 2: iPad / 1,2: Universal
-
- # OS icons
- QMAKE_ASSET_CATALOGS_APP_ICON = "AppIcon"
- QMAKE_ASSET_CATALOGS = $${PWD}/assets/ios/Images.xcassets
-
- # iOS launch screen
- AppLaunchScreen.files += $${PWD}/assets/ios/AppLaunchScreen.storyboard
- QMAKE_BUNDLE_DATA += AppLaunchScreen
-
- # iOS developer settings
- exists($${PWD}/assets/ios/ios_signature.pri) {
- # Must contain values for:
- # QMAKE_DEVELOPMENT_TEAM
- # QMAKE_PROVISIONING_PROFILE
- include($${PWD}/assets/ios/ios_signature.pri)
- }
-}
diff --git a/assets/ios/Info.plist b/assets/ios/Info.plist
index 7edebf08c..e8aa3f9bf 100644
--- a/assets/ios/Info.plist
+++ b/assets/ios/Info.plist
@@ -2,40 +2,36 @@
+ CFBundleInfoDictionaryVersion
+ 6.0
+
+ CFBundlePackageType
+ APPL
+
+ CFBundleName
+ WatchFlower
+
CFBundleDisplayName
WatchFlower
+
CFBundleExecutable
- ${EXECUTABLE_NAME}
- CFBundleGetInfoString
- Created by Qt/QMake
- CFBundleIconFile
- ${ASSETCATALOG_COMPILER_APPICON_NAME}
+ $(EXECUTABLE_NAME)
+
CFBundleIdentifier
- ${PRODUCT_BUNDLE_IDENTIFIER}
- CFBundleName
- ${PRODUCT_NAME}
- CFBundlePackageType
- APPL
- CFBundleShortVersionString
- 6.0
- CFBundleSignature
- ${QMAKE_PKGINFO_TYPEINFO}
+ $(PRODUCT_BUNDLE_IDENTIFIER)
+
CFBundleVersion
0600001
- LSRequiresIPhoneOS
-
- MinimumOSVersion
- ${IPHONEOS_DEPLOYMENT_TARGET}
- NOTE
- This file was generated by Qt/QMake.
- NSBluetoothAlwaysUsageDescription
- WatchFlower connects to Bluetooth Low Energy sensors.
- NSBluetoothPeripheralUsageDescription
- WatchFlower connects to Bluetooth Low Energy sensors.
- ITSAppUsesNonExemptEncryption
-
+
+ CFBundleShortVersionString
+ 6.0
+
+ CFBundleIconFile
+ AppIcon
+
UILaunchStoryboardName
- AppLaunchScreen
+ LaunchScreen
+
UISupportedInterfaceOrientations
UIInterfaceOrientationPortrait
@@ -43,5 +39,26 @@
UIInterfaceOrientationLandscapeLeft
UIInterfaceOrientationLandscapeRight
+
+ LSApplicationCategoryType
+ public.app-category.utilities
+
+ LSRequiresIPhoneOS
+
+
+ MinimumOSVersion
+ 14.0
+
+ ITSAppUsesNonExemptEncryption
+
+
+ NSHighResolutionCapable
+
+
+ NSBluetoothAlwaysUsageDescription
+ WatchFlower connects to Bluetooth Low Energy sensors.
+
+ NSBluetoothPeripheralUsageDescription
+ WatchFlower connects to Bluetooth Low Energy sensors.
diff --git a/assets/ios/AppLaunchScreen.storyboard b/assets/ios/LaunchScreen.storyboard
similarity index 100%
rename from assets/ios/AppLaunchScreen.storyboard
rename to assets/ios/LaunchScreen.storyboard
diff --git a/assets/linux/watchflower.appdata.xml b/assets/linux/watchflower.appdata.xml
index e5d395e2a..e21ab9da7 100644
--- a/assets/linux/watchflower.appdata.xml
+++ b/assets/linux/watchflower.appdata.xml
@@ -28,7 +28,7 @@
- https://github.com/emericg/WatchFlower/releases/tag/v6.0
+ https://github.com/emericg/WatchFlower/releases/tag/v6.0
diff --git a/assets/macos/Info.plist b/assets/macos/Info.plist
index 3318807fd..fa240c43d 100644
--- a/assets/macos/Info.plist
+++ b/assets/macos/Info.plist
@@ -2,34 +2,54 @@
- CFBundleExecutable
- WatchFlower
- CFBundleIconFile
- WatchFlower.icns
- CFBundleGetInfoString
- Created by Qt/QMake
- CFBundleIdentifier
- com.emeric.WatchFlower
+ CFBundleInfoDictionaryVersion
+ 6.0
+
CFBundlePackageType
APPL
- CFBundleShortVersionString
- 6.0
- CFBundleSignature
- ${QMAKE_PKGINFO_TYPEINFO}
+
+ CFBundleName
+ QmlAppTemplate
+
+ CFBundleDisplayName
+ QmlAppTemplate
+
+ CFBundleExecutable
+ $(EXECUTABLE_NAME)
+
+ CFBundleIdentifier
+ $(PRODUCT_BUNDLE_IDENTIFIER)
+
CFBundleVersion
0600001
+
+ CFBundleShortVersionString
+ 6.0
+
+ CFBundleIconFile
+ WatchFlower.icns
+
+ LSMinimumSystemVersion
+ 11.0
+
LSApplicationCategoryType
public.app-category.utilities
- LSMinimumSystemVersion
- ${MACOSX_DEPLOYMENT_TARGET}
- NOTE
- This file was generated by Qt/QMake.
+
NSPrincipalClass
NSApplication
+
+ NSHumanReadableCopyright
+ Copyright Emeric Grange 2024
+
+ NSHighResolutionCapable
+
+
NSSupportsAutomaticGraphicsSwitching
+
NSBluetoothAlwaysUsageDescription
WatchFlower connects to Bluetooth Low Energy sensors.
+
NSBluetoothPeripheralUsageDescription
WatchFlower connects to Bluetooth Low Energy sensors.
diff --git a/deploy_linux.sh b/deploy_linux.sh
index 9f3a245b8..d2f4b7932 100755
--- a/deploy_linux.sh
+++ b/deploy_linux.sh
@@ -100,6 +100,18 @@ export QML_SOURCES_PATHS="$(pwd)/qml/"
## PACKAGE (AppImage) ##########################################################
if [[ $create_package = true ]] ; then
+ echo '---- Format appdir'
+ mkdir -p bin/usr/bin/
+ mkdir -p bin/usr/share/appdata/
+ mkdir -p bin/usr/share/applications/
+ mkdir -p bin/usr/share/pixmaps/
+ mkdir -p bin/usr/share/icons/hicolor/scalable/apps/
+ mv bin/$APP_NAME bin/usr/bin/$APP_NAME
+ cp assets/linux/$APP_NAME.appdata.xml bin/usr/share/appdata/$APP_NAME.appdata.xml
+ cp assets/linux/$APP_NAME.desktop bin/usr/share/applications/$APP_NAME.desktop
+ cp assets/linux/$APP_NAME.svg bin/usr/share/pixmaps/$APP_NAME.svg
+ cp assets/linux/$APP_NAME.svg bin/usr/share/icons/hicolor/scalable/apps/$APP_NAME.svg
+
echo '---- Running AppImage packager'
./contribs/deploy/linuxdeploy-x86_64.AppImage --appdir bin --plugin qt --output appimage
mv $APP_NAME-x86_64.AppImage $APP_NAME-$APP_VERSION-linux64.AppImage
@@ -115,20 +127,21 @@ if [[ $create_package = true ]] ; then
#export APP_NAME_LOWERCASE=$APP_NAME
echo '---- Reorganize appdir into a regular directory'
- mkdir $APP_NAME/
- mv bin/usr/bin/* $APP_NAME/
- mv bin/usr/lib/* $APP_NAME/
- mv bin/usr/plugins $APP_NAME/
- mv bin/usr/qml $APP_NAME/
- mv bin/usr/share/appdata/$APP_NAME_LOWERCASE.appdata.xml $APP_NAME/
- mv bin/usr/share/applications/$APP_NAME_LOWERCASE.desktop $APP_NAME/
- mv bin/usr/share/pixmaps/$APP_NAME_LOWERCASE.svg $APP_NAME/
- printf '[Paths]\nPrefix = .\nPlugins = plugins\nImports = qml\n' > $APP_NAME/qt.conf
- printf '#!/bin/sh\nappname=`basename $0 | sed s,\.sh$,,`\ndirname=`dirname $0`\nexport LD_LIBRARY_PATH=$dirname\n$dirname/$appname' > $APP_NAME/$APP_NAME_LOWERCASE.sh
- chmod +x $APP_NAME/$APP_NAME_LOWERCASE.sh
+ mkdir bin/$APP_NAME/
+ mv bin/usr/bin/* bin/$APP_NAME/
+ mv bin/usr/lib/* bin/$APP_NAME/
+ mv bin/usr/plugins bin/$APP_NAME/
+ mv bin/usr/qml bin/$APP_NAME/
+ mv bin/usr/share/appdata/$APP_NAME_LOWERCASE.appdata.xml bin/$APP_NAME/
+ mv bin/usr/share/applications/$APP_NAME_LOWERCASE.desktop bin/$APP_NAME/
+ mv bin/usr/share/pixmaps/$APP_NAME_LOWERCASE.svg bin/$APP_NAME/
+ printf '[Paths]\nPrefix = .\nPlugins = plugins\nImports = qml\n' > bin/$APP_NAME/qt.conf
+ printf '#!/bin/sh\nappname=`basename $0 | sed s,\.sh$,,`\ndirname=`dirname $0`\nexport LD_LIBRARY_PATH=$dirname\n$dirname/$appname' > bin/$APP_NAME/$APP_NAME_LOWERCASE.sh
+ chmod +x bin/$APP_NAME/$APP_NAME_LOWERCASE.sh
echo '---- Compressing package'
- tar zcvf $APP_NAME-$APP_VERSION-linux64.tar.gz $APP_NAME/
+ cd bin
+ tar zcvf ../$APP_NAME-$APP_VERSION-linux64.tar.gz $APP_NAME/
fi
## UPLOAD ######################################################################
diff --git a/i18n/watchflower_ca.ts b/i18n/WatchFlower_ca.ts
similarity index 100%
rename from i18n/watchflower_ca.ts
rename to i18n/WatchFlower_ca.ts
diff --git a/i18n/watchflower_da.ts b/i18n/WatchFlower_da.ts
similarity index 100%
rename from i18n/watchflower_da.ts
rename to i18n/WatchFlower_da.ts
diff --git a/i18n/watchflower_de.ts b/i18n/WatchFlower_de.ts
similarity index 100%
rename from i18n/watchflower_de.ts
rename to i18n/WatchFlower_de.ts
diff --git a/i18n/watchflower_en.ts b/i18n/WatchFlower_en.ts
similarity index 100%
rename from i18n/watchflower_en.ts
rename to i18n/WatchFlower_en.ts
diff --git a/i18n/watchflower_es.ts b/i18n/WatchFlower_es.ts
similarity index 100%
rename from i18n/watchflower_es.ts
rename to i18n/WatchFlower_es.ts
diff --git a/i18n/watchflower_fr.ts b/i18n/WatchFlower_fr.ts
similarity index 100%
rename from i18n/watchflower_fr.ts
rename to i18n/WatchFlower_fr.ts
diff --git a/i18n/watchflower_fy.ts b/i18n/WatchFlower_fy.ts
similarity index 100%
rename from i18n/watchflower_fy.ts
rename to i18n/WatchFlower_fy.ts
diff --git a/i18n/watchflower_hu.ts b/i18n/WatchFlower_hu.ts
similarity index 100%
rename from i18n/watchflower_hu.ts
rename to i18n/WatchFlower_hu.ts
diff --git a/i18n/watchflower_nb.ts b/i18n/WatchFlower_nb.ts
similarity index 100%
rename from i18n/watchflower_nb.ts
rename to i18n/WatchFlower_nb.ts
diff --git a/i18n/watchflower_nl.ts b/i18n/WatchFlower_nl.ts
similarity index 100%
rename from i18n/watchflower_nl.ts
rename to i18n/WatchFlower_nl.ts
diff --git a/i18n/watchflower_nn.ts b/i18n/WatchFlower_nn.ts
similarity index 100%
rename from i18n/watchflower_nn.ts
rename to i18n/WatchFlower_nn.ts
diff --git a/i18n/watchflower_pt.ts b/i18n/WatchFlower_pt.ts
similarity index 100%
rename from i18n/watchflower_pt.ts
rename to i18n/WatchFlower_pt.ts
diff --git a/i18n/watchflower_pt_BR.ts b/i18n/WatchFlower_pt_BR.ts
similarity index 100%
rename from i18n/watchflower_pt_BR.ts
rename to i18n/WatchFlower_pt_BR.ts
diff --git a/i18n/watchflower_ru.ts b/i18n/WatchFlower_ru.ts
similarity index 100%
rename from i18n/watchflower_ru.ts
rename to i18n/WatchFlower_ru.ts
diff --git a/i18n/watchflower_zh_CN.ts b/i18n/WatchFlower_zh_CN.ts
similarity index 100%
rename from i18n/watchflower_zh_CN.ts
rename to i18n/WatchFlower_zh_CN.ts
diff --git a/i18n/watchflower_zh_TW.ts b/i18n/WatchFlower_zh_TW.ts
similarity index 100%
rename from i18n/watchflower_zh_TW.ts
rename to i18n/WatchFlower_zh_TW.ts
diff --git a/i18n/i18n.qrc b/i18n/i18n.qrc
deleted file mode 100644
index a88dbb09b..000000000
--- a/i18n/i18n.qrc
+++ /dev/null
@@ -1,65 +0,0 @@
-
-
- watchflower_ca.qm
- watchflower_da.qm
- watchflower_de.qm
- watchflower_en.qm
- watchflower_es.qm
- watchflower_fr.qm
- watchflower_fy.qm
- watchflower_hu.qm
- watchflower_nb.qm
- watchflower_nl.qm
- watchflower_nn.qm
- watchflower_pt_BR.qm
- watchflower_ru.qm
- watchflower_zh_CN.qm
- watchflower_zh_TW.qm
-
-
-
- watchflower_ca.qm
-
-
- watchflower_da.qm
-
-
- watchflower_de.qm
-
-
- watchflower_en.qm
-
-
- watchflower_es.qm
-
-
- watchflower_fr.qm
-
-
- watchflower_fy.qm
-
-
- watchflower_hu.qm
-
-
- watchflower_nb.qm
-
-
- watchflower_nl.qm
-
-
- watchflower_nn.qm
-
-
- watchflower_pt_BR.qm
-
-
- watchflower_ru.qm
-
-
- watchflower_zh_CN.qm
-
-
- watchflower_zh_TW.qm
-
-
diff --git a/i18n/watchflower_ca.qm b/i18n/watchflower_ca.qm
deleted file mode 100644
index 0db9f392b..000000000
Binary files a/i18n/watchflower_ca.qm and /dev/null differ
diff --git a/i18n/watchflower_da.qm b/i18n/watchflower_da.qm
deleted file mode 100644
index dd75c7604..000000000
Binary files a/i18n/watchflower_da.qm and /dev/null differ
diff --git a/i18n/watchflower_de.qm b/i18n/watchflower_de.qm
deleted file mode 100644
index ac3609a15..000000000
Binary files a/i18n/watchflower_de.qm and /dev/null differ
diff --git a/i18n/watchflower_en.qm b/i18n/watchflower_en.qm
deleted file mode 100644
index 8dcb2cdc8..000000000
Binary files a/i18n/watchflower_en.qm and /dev/null differ
diff --git a/i18n/watchflower_es.qm b/i18n/watchflower_es.qm
deleted file mode 100644
index 8e1405b16..000000000
Binary files a/i18n/watchflower_es.qm and /dev/null differ
diff --git a/i18n/watchflower_fr.qm b/i18n/watchflower_fr.qm
deleted file mode 100644
index e4c8fc430..000000000
Binary files a/i18n/watchflower_fr.qm and /dev/null differ
diff --git a/i18n/watchflower_fy.qm b/i18n/watchflower_fy.qm
deleted file mode 100644
index 3b07f2821..000000000
Binary files a/i18n/watchflower_fy.qm and /dev/null differ
diff --git a/i18n/watchflower_hu.qm b/i18n/watchflower_hu.qm
deleted file mode 100644
index 6201c2a72..000000000
Binary files a/i18n/watchflower_hu.qm and /dev/null differ
diff --git a/i18n/watchflower_nb.qm b/i18n/watchflower_nb.qm
deleted file mode 100644
index 0c3df64dd..000000000
Binary files a/i18n/watchflower_nb.qm and /dev/null differ
diff --git a/i18n/watchflower_nl.qm b/i18n/watchflower_nl.qm
deleted file mode 100644
index c3501cb36..000000000
Binary files a/i18n/watchflower_nl.qm and /dev/null differ
diff --git a/i18n/watchflower_nn.qm b/i18n/watchflower_nn.qm
deleted file mode 100644
index 288c64cb3..000000000
Binary files a/i18n/watchflower_nn.qm and /dev/null differ
diff --git a/i18n/watchflower_pt.qm b/i18n/watchflower_pt.qm
deleted file mode 100644
index 18ca3fe5e..000000000
Binary files a/i18n/watchflower_pt.qm and /dev/null differ
diff --git a/i18n/watchflower_pt_BR.qm b/i18n/watchflower_pt_BR.qm
deleted file mode 100644
index be651eede..000000000
--- a/i18n/watchflower_pt_BR.qm
+++ /dev/null
@@ -1 +0,0 @@
-
#include
diff --git a/src/devices/device_ropot.cpp b/src/devices/device_ropot.cpp
index aa043588b..1efedb97a 100644
--- a/src/devices/device_ropot.cpp
+++ b/src/devices/device_ropot.cpp
@@ -22,7 +22,7 @@
#include "device_ropot.h"
#include "device_firmwares.h"
#include "utils_versionchecker.h"
-#include "thirdparty/RC4/rc4.h"
+#include "RC4/rc4.h"
#include
#include
diff --git a/src/main.cpp b/src/main.cpp
index 0a6efa936..6d2aa70b8 100644
--- a/src/main.cpp
+++ b/src/main.cpp
@@ -141,7 +141,7 @@ int main(int argc, char *argv[])
// GUI application /////////////////////////////////////////////////////////
- SingleApplication app(argc, argv, true);
+ SingleApplication app(argc, argv, false);
// Application name
app.setApplicationName("WatchFlower");
diff --git a/src/thirdparty/AppUtils/AppUtils.pri b/src/thirdparty/AppUtils/AppUtils.pri
deleted file mode 100644
index 940040b78..000000000
--- a/src/thirdparty/AppUtils/AppUtils.pri
+++ /dev/null
@@ -1,107 +0,0 @@
-
-# Optional stuff (for macOS)
-#CONFIG += UTILS_DOCK_ENABLED
-
-# Optional stuff (for iOS)
-#CONFIG += UTILS_NOTIFICATIONS_ENABLED
-#CONFIG += UTILS_WIFI_ENABLED
-
-# Generic utils
-SOURCES += $${PWD}/utils_app.cpp \
- $${PWD}/utils_bits.cpp \
- $${PWD}/utils_clipboard.cpp \
- $${PWD}/utils_fpsmonitor.cpp \
- $${PWD}/utils_language.cpp \
- $${PWD}/utils_log.cpp \
- $${PWD}/utils_maths.cpp \
- $${PWD}/utils_screen.cpp \
- $${PWD}/utils_sysinfo.cpp \
- $${PWD}/utils_wifi.cpp
-
-HEADERS += $${PWD}/utils_app.h \
- $${PWD}/utils_bits.h \
- $${PWD}/utils_clipboard.h \
- $${PWD}/utils_fpsmonitor.h \
- $${PWD}/utils_language.h \
- $${PWD}/utils_log.h \
- $${PWD}/utils_maths.h \
- $${PWD}/utils_screen.h \
- $${PWD}/utils_sysinfo.h \
- $${PWD}/utils_versionchecker.h \
- $${PWD}/utils_wifi.h
-
-INCLUDEPATH += $${PWD}
-
-versionAtLeast(QT_VERSION, 6.6) {
- QT += gui-private # to get RHI info
-}
-
-# Linux OS utils
-linux:!android {
- QT += dbus
-
- SOURCES += $${PWD}/utils_os_linux.cpp
- HEADERS += $${PWD}/utils_os_linux.h
-}
-
-# macOS utils
-macx {
- LIBS += -framework IOKit
- SOURCES += $${PWD}/utils_os_macos.mm
- HEADERS += $${PWD}/utils_os_macos.h
-
- # macOS dock click handler (optional)
- UTILS_DOCK_ENABLED {
- DEFINES += UTILS_DOCK_ENABLED
- LIBS += -framework AppKit
- SOURCES += $${PWD}/utils_os_macos_dock.mm
- HEADERS += $${PWD}/utils_os_macos_dock.h
- }
-}
-
-# Windows OS utils
-win32 {
- DEFINES += _USE_MATH_DEFINES
- SOURCES += $${PWD}/utils_os_windows.cpp
- HEADERS += $${PWD}/utils_os_windows.h
-}
-
-# Android OS utils
-android {
- DEFINES += UTILS_NOTIFICATIONS_ENABLED UTILS_WIFI_ENABLED
-
- versionAtLeast(QT_VERSION, 6.0) {
- QT += core-private
-
- SOURCES += $${PWD}/utils_os_android_qt6.cpp
- HEADERS += $${PWD}/utils_os_android.h
- } else {
- QT += androidextras
-
- SOURCES += $${PWD}/utils_os_android_qt5.cpp
- HEADERS += $${PWD}/utils_os_android.h
- }
-}
-
-# iOS utils
-ios {
- LIBS += -framework UIKit
- SOURCES += $${PWD}/utils_os_ios.mm
- HEADERS += $${PWD}/utils_os_ios.h
-
- # iOS notifications (optional)
- UTILS_NOTIFICATIONS_ENABLED {
- DEFINES += UTILS_NOTIFICATIONS_ENABLED
- LIBS += -framework UserNotifications
- SOURCES += $${PWD}/utils_os_ios_notif.mm
- HEADERS += $${PWD}/utils_os_ios_notif.h
- }
-
- # iOS WiFi SSID (optional)
- UTILS_WIFI_ENABLED {
- DEFINES += UTILS_WIFI_ENABLED
- LIBS += -framework SystemConfiguration
- SOURCES += $${PWD}/utils_os_ios_wifi.mm
- HEADERS += $${PWD}/utils_os_ios_wifi.h
- }
-}
diff --git a/src/thirdparty/AppUtils/utils_os_android_qt5.cpp b/src/thirdparty/AppUtils/utils_os_android_qt5.cpp
deleted file mode 100644
index 792d37c74..000000000
--- a/src/thirdparty/AppUtils/utils_os_android_qt5.cpp
+++ /dev/null
@@ -1,769 +0,0 @@
-/*!
- * Copyright (c) 2019 Emeric Grange
- *
- * Permission is hereby granted, free of charge, to any person obtaining a copy
- * of this software and associated documentation files (the "Software"), to deal
- * in the Software without restriction, including without limitation the rights
- * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
- * copies of the Software, and to permit persons to whom the Software is
- * furnished to do so, subject to the following conditions:
- *
- * The above copyright notice and this permission notice shall be included in all
- * copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
- * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
- * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
- * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
- * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
- * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
- * SOFTWARE.
- */
-
-#include "utils_os_android.h"
-
-#if defined(Q_OS_ANDROID)
-
-#include
-#include
-#include
-#include
-
-/* ************************************************************************** */
-
-int UtilsAndroid::getSdkVersion()
-{
- return QtAndroid::androidSdkVersion();
-}
-
-/* ************************************************************************** */
-
-bool UtilsAndroid::checkPermissions_storage()
-{
- QtAndroid::PermissionResult r = QtAndroid::checkPermission("android.permission.READ_EXTERNAL_STORAGE");
- QtAndroid::PermissionResult w = QtAndroid::checkPermission("android.permission.WRITE_EXTERNAL_STORAGE");
- return (r == QtAndroid::PermissionResult::Granted && w == QtAndroid::PermissionResult::Granted);
-}
-
-bool UtilsAndroid::checkPermission_storage_read()
-{
- QtAndroid::PermissionResult r = QtAndroid::checkPermission("android.permission.READ_EXTERNAL_STORAGE");
- return (r == QtAndroid::PermissionResult::Granted);
-}
-
-bool UtilsAndroid::checkPermission_storage_write()
-{
- QtAndroid::PermissionResult w = QtAndroid::checkPermission("android.permission.WRITE_EXTERNAL_STORAGE");
- return (w == QtAndroid::PermissionResult::Granted);
-}
-
-bool UtilsAndroid::getPermissions_storage()
-{
- return (UtilsAndroid::getPermission_storage_read() && UtilsAndroid::getPermission_storage_write());
-}
-
-bool UtilsAndroid::getPermission_storage_read()
-{
- bool status = true;
-
- QtAndroid::PermissionResult r = QtAndroid::checkPermission("android.permission.READ_EXTERNAL_STORAGE");
- if (r == QtAndroid::PermissionResult::Denied)
- {
- QtAndroid::requestPermissionsSync(QStringList() << "android.permission.READ_EXTERNAL_STORAGE");
- r = QtAndroid::checkPermission("android.permission.READ_EXTERNAL_STORAGE");
- if (r == QtAndroid::PermissionResult::Denied)
- {
- qWarning() << "STORAGE READ PERMISSION DENIED";
- status = false;
- }
- }
-
- return status;
-}
-
-bool UtilsAndroid::getPermission_storage_write()
-{
- bool status = true;
-
- QtAndroid::PermissionResult w = QtAndroid::checkPermission("android.permission.WRITE_EXTERNAL_STORAGE");
- if (w == QtAndroid::PermissionResult::Denied)
- {
- QtAndroid::requestPermissionsSync(QStringList() << "android.permission.WRITE_EXTERNAL_STORAGE");
- w = QtAndroid::checkPermission("android.permission.WRITE_EXTERNAL_STORAGE");
- if (w == QtAndroid::PermissionResult::Denied)
- {
- qWarning() << "STORAGE WRITE PERMISSION DENIED";
- status = false;
- }
- }
-
- return status;
-}
-
-/* ************************************************************************** */
-
-bool UtilsAndroid::checkPermission_storage_filesystem()
-{
- if (QtAndroid::androidSdkVersion() >= 30)
- {
- return QAndroidJniObject::callStaticMethod("android/os/Environment", "isExternalStorageManager");
- }
-
- return false;
-}
-
-bool UtilsAndroid::getPermission_storage_filesystem(const QString &packageName)
-{
- //qDebug() << "> getPermission_storage_filesystem(" << packageName << ")";
-
- bool status = false;
-
- if (QtAndroid::androidSdkVersion() >= 30)
- {
- if (!checkPermission_storage_filesystem())
- {
- openStorageSettings(packageName);
- }
-
- status = checkPermission_storage_filesystem();
- }
- else
- {
- qWarning() << "ACTION_MANAGE_APP_ALL_FILES_ACCESS_PERMISSION is not available";
- }
-
- return status;
-}
-
-/* ************************************************************************** */
-
-bool UtilsAndroid::checkPermission_camera()
-{
- QtAndroid::PermissionResult cam = QtAndroid::checkPermission("android.permission.CAMERA");
- return (cam == QtAndroid::PermissionResult::Granted);
-}
-
-bool UtilsAndroid::getPermission_camera()
-{
- bool status = true;
-
- QtAndroid::PermissionResult cam = QtAndroid::checkPermission("android.permission.CAMERA");
- if (cam == QtAndroid::PermissionResult::Denied)
- {
- QtAndroid::requestPermissionsSync(QStringList() << "android.permission.CAMERA");
- cam = QtAndroid::checkPermission("android.permission.CAMERA");
- if (cam == QtAndroid::PermissionResult::Denied)
- {
- qWarning() << "CAMERA PERMISSION DENIED";
- status = false;
- }
- }
-
- return status;
-}
-
-/* ************************************************************************** */
-
-bool UtilsAndroid::checkPermission_notification()
-{
- return false; // TODO
-}
-
-bool UtilsAndroid::getPermission_notification()
-{
- return false; // TODO
-}
-
-/* ************************************************************************** */
-
-bool UtilsAndroid::checkPermission_bluetooth()
-{
- return false; // TODO
-}
-
-bool UtilsAndroid::getPermission_bluetooth()
-{
- return false; // TODO
-}
-
-/* ************************************************************************** */
-
-bool UtilsAndroid::checkPermission_location()
-{
- QtAndroid::PermissionResult loc = QtAndroid::checkPermission("android.permission.ACCESS_FINE_LOCATION");
- return (loc == QtAndroid::PermissionResult::Granted);
-}
-
-bool UtilsAndroid::getPermission_location()
-{
- bool status = true;
-
- QtAndroid::PermissionResult loc = QtAndroid::checkPermission("android.permission.ACCESS_FINE_LOCATION");
- if (loc == QtAndroid::PermissionResult::Denied)
- {
- QtAndroid::requestPermissionsSync(QStringList() << "android.permission.ACCESS_FINE_LOCATION");
- loc = QtAndroid::checkPermission("android.permission.ACCESS_FINE_LOCATION");
- if (loc == QtAndroid::PermissionResult::Denied)
- {
- qWarning() << "LOCATION READ PERMISSION DENIED";
- status = false;
- }
- }
-
- return status;
-}
-
-bool UtilsAndroid::checkPermission_location_ble()
-{
- QtAndroid::PermissionResult loc;
-
- if (QtAndroid::androidSdkVersion() >= 29)
- loc = QtAndroid::checkPermission("android.permission.ACCESS_FINE_LOCATION");
- else
- loc = QtAndroid::checkPermission("android.permission.ACCESS_COARSE_LOCATION");
-
- return (loc == QtAndroid::PermissionResult::Granted);
-}
-
-bool UtilsAndroid::getPermission_location_ble()
-{
- bool status = true;
-
- if (!UtilsAndroid::checkPermission_location_ble())
- {
- if (QtAndroid::androidSdkVersion() >= 29)
- QtAndroid::requestPermissionsSync(QStringList() << "android.permission.ACCESS_FINE_LOCATION");
- else
- QtAndroid::requestPermissionsSync(QStringList() << "android.permission.ACCESS_COARSE_LOCATION");
-
- if (!UtilsAndroid::checkPermission_location_ble())
- {
- qWarning() << "LOCATION READ PERMISSION DENIED";
- status = false;
- }
- }
-
- return status;
-}
-
-bool UtilsAndroid::checkPermission_location_background()
-{
- return false;
-}
-
-bool UtilsAndroid::getPermission_location_background()
-{
- return false;
-}
-
-/* ************************************************************************** */
-
-bool UtilsAndroid::checkPermission_phonestate()
-{
- QtAndroid::PermissionResult ps = QtAndroid::checkPermission("android.permission.READ_PHONE_STATE");
- return (ps == QtAndroid::PermissionResult::Granted);
-}
-
-bool UtilsAndroid::getPermission_phonestate()
-{
- bool status = true;
-
- QtAndroid::PermissionResult ps = QtAndroid::checkPermission("android.permission.READ_PHONE_STATE");
- if (ps == QtAndroid::PermissionResult::Denied)
- {
- QtAndroid::requestPermissionsSync(QStringList() << "android.permission.READ_PHONE_STATE");
- ps = QtAndroid::checkPermission("android.permission.READ_PHONE_STATE");
- if (ps == QtAndroid::PermissionResult::Denied)
- {
- qWarning() << "READ_PHONE_STATE PERMISSION DENIED";
- status = false;
- }
- }
-
- return status;
-}
-
-/* ************************************************************************** */
-
-bool UtilsAndroid::isGpsEnabled()
-{
- bool status = false;
-
- QAndroidJniObject activity = QtAndroid::androidActivity();
- if (activity.isValid())
- {
- QAndroidJniObject appCtx = activity.callObjectMethod("getApplicationContext", "()Landroid/content/Context;");
- if (appCtx.isValid())
- {
- QAndroidJniObject locationString = QAndroidJniObject::fromString("location");
- QAndroidJniObject locationService = appCtx.callObjectMethod("getSystemService",
- "(Ljava/lang/String;)Ljava/lang/Object;",
- locationString.object());
- if (locationService.callMethod("isLocationEnabled", "()Z"))
- {
- status = true;
- }
- }
- }
-
- return status;
-}
-
-bool UtilsAndroid::gpsutils_isGpsEnabled()
-{
- bool status = false;
-
- QAndroidJniObject activity = QtAndroid::androidActivity();
- if (activity.isValid())
- {
- QAndroidJniObject appCtx = activity.callObjectMethod("getApplicationContext", "()Landroid/content/Context;");
- if (appCtx.isValid())
- {
- jboolean verified = QAndroidJniObject::callStaticMethod(
- "io/emeric/utils/QGpsUtils",
- "checkGpsEnabled",
- "(Landroid/content/Context;)Z",
- appCtx.object());
-
- if (verified)
- {
- status = true;
- }
- }
- }
-
- return status;
-}
-
-bool UtilsAndroid::gpsutils_forceGpsEnabled()
-{
- bool status = false;
-
- QAndroidJniObject activity = QtAndroid::androidActivity();
- if (activity.isValid())
- {
- QAndroidJniObject appCtx = activity.callObjectMethod("getApplicationContext", "()Landroid/content/Context;");
- if (appCtx.isValid())
- {
- jboolean verified = QAndroidJniObject::callStaticMethod(
- "io/emeric/utils/QGpsUtils",
- "forceGpsEnabled",
- "(Landroid/content/Context;)Z",
- appCtx.object());
-
- if (verified)
- {
- status = true;
- }
- }
- }
-
- return status;
-}
-
-void UtilsAndroid::gpsutils_openLocationSettings()
-{
- QAndroidJniObject activity = QtAndroid::androidActivity();
- if (activity.isValid())
- {
- QAndroidJniObject appCtx = activity.callObjectMethod("getApplicationContext", "()Landroid/content/Context;");
- if (appCtx.isValid())
- {
- QAndroidJniObject intent = QAndroidJniObject::callStaticObjectMethod(
- "io/emeric/utils/QGpsUtils",
- "openLocationSettings",
- "()Landroid/content/Intent;",
- appCtx.object());
-
- QtAndroid::startActivity(intent, 0);
- }
- }
-}
-
-/* ************************************************************************** */
-/* ************************************************************************** */
-
-QString UtilsAndroid::getAppInternalStorage()
-{
- return QString();
-}
-
-QString UtilsAndroid::getAppExternalStorage()
-{
- QString storage;
-
- QAndroidJniObject context = QtAndroid::androidContext();
-
- if (context.isValid())
- {
- QAndroidJniObject dir = QAndroidJniObject::fromString(QStringLiteral(""));
- QAndroidJniObject path = context.callObjectMethod("getExternalFilesDir",
- "(Ljava/lang/String;)Ljava/io/File;",
- dir.object());
- storage = path.toString();
- }
-
- return storage;
-}
-
-QStringList UtilsAndroid::get_storages_by_api() // DEPRECATED
-{
- QStringList storages;
-
- QAndroidJniObject activity = QtAndroid::androidActivity();
- if (activity.isValid())
- {
- QAndroidJniObject dirs = activity.callObjectMethod("getExternalFilesDirs",
- "(Ljava/lang/String;)[Ljava/io/File;",
- NULL);
- if (dirs.isValid())
- {
- QAndroidJniEnvironment env;
- jsize l = env->GetArrayLength(dirs.object());
- for (int i = 0; i < l; i++)
- {
- QAndroidJniObject dir = env->GetObjectArrayElement(dirs.object(), i);
- QString storage = dir.toString();
-
- storage.truncate(storage.indexOf("/Android/data"));
- if (!storage.isEmpty())
- storages += storage;
- }
- //qDebug() << "> android_get_storages_by_api()" << storages;
- }
- }
-
- return storages;
-}
-
-QString UtilsAndroid::get_external_storage() // DEPRECATED
-{
- QAndroidJniObject mediaDir = QAndroidJniObject::callStaticObjectMethod("android/os/Environment",
- "getExternalStorageDirectory",
- "()Ljava/io/File;");
- QAndroidJniObject mediaPath = mediaDir.callObjectMethod("getAbsolutePath", "()Ljava/lang/String;");
-
- QString external_storage = mediaPath.toString();
- //qDebug() << "> get_external_storage()" << external_storage;
-
- return external_storage;
-}
-
-/* ************************************************************************** */
-
-QString UtilsAndroid::getDeviceModel()
-{
- QAndroidJniObject manufacturerField = QAndroidJniObject::getStaticObjectField("android/os/Build", "MANUFACTURER");
- QAndroidJniObject modelField = QAndroidJniObject::getStaticObjectField("android/os/Build", "MODEL");
-
- QString device_model = manufacturerField.toString() + " " + modelField.toString();
- //qDebug() << "> getDeviceModel()" << device_model;
- return device_model;
-}
-
-QString UtilsAndroid::getDeviceSerial()
-{
- QString device_serial;
-
- if (QtAndroid::androidSdkVersion() >= 29)
- {
- QAndroidJniObject activity = QtAndroid::androidActivity();
- QAndroidJniObject appctx = activity.callObjectMethod("getApplicationContext", "()Landroid/content/Context;");
- QAndroidJniObject contentR = appctx.callObjectMethod("getContentResolver", "()Landroid/content/ContentResolver;");
-
- QAndroidJniObject aidString = QAndroidJniObject::fromString("android_id");
- QAndroidJniObject aidService = QAndroidJniObject::callStaticObjectMethod("android/provider/Settings$Secure", "getString",
- "(Landroid/content/ContentResolver;Ljava/lang/String;)Ljava/lang/String;",
- contentR.object(),
- aidString.object());
- device_serial = aidService.toString();
- }
- else
- {
- // Deprecated method
- //QAndroidJniObject serialField = QAndroidJniObject::getStaticObjectField("android/os/Build", "SERIAL");
- //device_serial = serialField.toString();
-
- QAndroidJniObject serialField = QAndroidJniObject::callStaticObjectMethod("android/os/Build",
- "getSerial",
- "()Ljava/lang/String;");
- device_serial = serialField.toString();
- }
-
- //qDebug() << "> getDeviceSerial()" << device_serial;
- return device_serial;
-}
-
-/* ************************************************************************** */
-
-void UtilsAndroid::screenKeepOn(bool on)
-{
- //qDebug() << "> screenKeepOn(" << on << ")";
-
- QtAndroid::runOnAndroidThread([=]() {
- QAndroidJniObject activity = QtAndroid::androidActivity();
- if (activity.isValid())
- {
- QAndroidJniObject window = activity.callObjectMethod("getWindow", "()Landroid/view/Window;");
- if (window.isValid())
- {
- const int FLAG_KEEP_SCREEN_ON = 128;
- if (on)
- window.callMethod("addFlags", "(I)V", FLAG_KEEP_SCREEN_ON);
- else
- window.callMethod("clearFlags", "(I)V", FLAG_KEEP_SCREEN_ON);
- }
- }
- QAndroidJniEnvironment env;
- if (env->ExceptionCheck())
- {
- env->ExceptionClear();
- }
- });
-}
-
-/*
- enum ScreenOrientation_android {
- SCREEN_ORIENTATION_UNSPECIFIED = -1,
- SCREEN_ORIENTATION_LANDSCAPE = 0,
- SCREEN_ORIENTATION_PORTRAIT = 1,
- SCREEN_ORIENTATION_SENSOR_LANDSCAPE = 6,
- SCREEN_ORIENTATION_SENSOR_PORTRAIT = 7,
- SCREEN_ORIENTATION_REVERSE_LANDSCAPE = 8,
- SCREEN_ORIENTATION_REVERSE_PORTRAIT = 9,
- };
-*/
-
-void UtilsAndroid::screenLockOrientation(int orientation)
-{
- //qDebug() << "> screenLockOrientation(" << orientation << ")";
-
- int value = 1;
- if (orientation != 0) value = 0;
-
- QAndroidJniObject activity = QtAndroid::androidActivity();
- if (activity.isValid())
- {
- activity.callMethod("setRequestedOrientation", "(I)V", value);
- }
-}
-
-void UtilsAndroid::screenLockOrientation(int orientation, bool autoRotate)
-{
- //qDebug() << "> screenLockOrientation(" << orientation << "-" << autoRotate << ")";
-
- int value = -1;
-
- if (orientation)
- {
- if (autoRotate)
- {
- if (orientation == 1 || orientation == 2) value = 7;
- else if (orientation == 4 || orientation == 8) value = 6;
- }
- else
- {
- if (orientation == 1) value = 1;
- else if (orientation == 2) value = 9;
- else if (orientation == 4) value = 0;
- else if (orientation == 8) value = 8;
- }
- }
-
- QAndroidJniObject activity = QtAndroid::androidActivity();
- if (activity.isValid())
- {
- activity.callMethod("setRequestedOrientation", "(I)V", value);
- }
-}
-
-/* ************************************************************************** */
-
-void UtilsAndroid::vibrate(int milliseconds)
-{
- if (milliseconds > 100) milliseconds = 100;
-
- QtAndroid::runOnAndroidThread([=]() {
- QAndroidJniObject activity = QtAndroid::androidActivity();
- if (activity.isValid())
- {
- QAndroidJniObject appCtx = activity.callObjectMethod("getApplicationContext", "()Landroid/content/Context;");
- if (appCtx.isValid())
- {
- QAndroidJniObject vibratorString = QAndroidJniObject::fromString("vibrator");
- QAndroidJniObject vibratorService = appCtx.callObjectMethod("getSystemService",
- "(Ljava/lang/String;)Ljava/lang/Object;",
- vibratorString.object());
- if (vibratorService.callMethod("hasVibrator", "()Z"))
- {
- if (QtAndroid::androidSdkVersion() < 26)
- {
- // vibrate (long milliseconds) // Deprecated in API level 26
-
- jlong ms = milliseconds;
- vibratorService.callMethod("vibrate", "(J)V", ms);
- }
- else
- {
- // vibrate(VibrationEffect vibe) // Added in API level 26
-
- jint effect = 0x00000002;
- QAndroidJniObject vibrationEffect = QAndroidJniObject::callStaticObjectMethod("android/os/VibrationEffect",
- "createPredefined",
- "(I)Landroid/os/VibrationEffect;",
- effect);
-
- vibratorService.callMethod("vibrate",
- "(Landroid/os/VibrationEffect;)V",
- vibrationEffect.object());
- }
- }
- }
- }
- QAndroidJniEnvironment env;
- if (env->ExceptionCheck())
- {
- env->ExceptionClear();
- }
- });
-}
-
-/* ************************************************************************** */
-
-void getWifiSSID()
-{
- QAndroidJniObject activity = QtAndroid::androidActivity();
- if (activity.isValid())
- {
- QAndroidJniObject wifiManager = activity.callObjectMethod("getSystemService",
- "(Ljava/lang/String;)Ljava/lang/Object;",
- QAndroidJniObject::fromString("wifi").object());
-
- if (wifiManager.isValid())
- {
- QAndroidJniObject wifiInfo = wifiManager.callObjectMethod("getConnectionInfo",
- "()Landroid/net/wifi/WifiInfo;");
-
- if (wifiInfo.isValid())
- {
- QString ssid = wifiInfo.callObjectMethod("getSSID", "()Ljava/lang/String;").toString();
-
- if (ssid.startsWith("\"")) ssid.removeFirst();
- if (ssid.endsWith("\"")) ssid.removeLast();
-
- return ssid;
- }
- else
- {
- qDebug() << "Failed to get WiFi Info";
- }
- }
- else
- {
- qDebug() << "Failed to get WifiManager";
- }
- }
- else
- {
- qDebug() << "Invalid Activity";
- }
-
- return QString();
-}
-
-/* ************************************************************************** */
-
-void UtilsAndroid::openApplicationInfo(const QString &packageName)
-{
- //qDebug() << "> openApplicationInfo(" << packageName << ")";
-
- QAndroidJniObject jpackageName = QAndroidJniObject::fromString("package:" + packageName);
- QAndroidJniObject jintentName = QAndroidJniObject::fromString("android.settings.APPLICATION_DETAILS_SETTINGS");
-
- QAndroidJniObject juri = QAndroidJniObject::callStaticObjectMethod("android/net/Uri", "parse",
- "(Ljava/lang/String;)Landroid/net/Uri;",
- jpackageName.object());
- if (!juri.isValid())
- {
- qWarning("Unable to create Uri object for APPLICATION_DETAILS_SETTINGS");
- return;
- }
-
- QAndroidJniObject intent("android/content/Intent", "(Ljava/lang/String;)V",
- jintentName.object());
- if (!intent.isValid())
- {
- qWarning("Unable to create Intent object for APPLICATION_DETAILS_SETTINGS");
- return;
- }
-
- intent.callObjectMethod("addCategory", "(Ljava/lang/String;)Landroid/content/Intent;",
- QAndroidJniObject::fromString("android.intent.category.DEFAULT").object());
-
- intent.callObjectMethod("setData", "(Landroid/net/Uri;)Landroid/content/Intent;",
- juri.object());
-
- QtAndroid::startActivity(intent, 0);
-}
-
-/* ************************************************************************** */
-
-void UtilsAndroid::openStorageSettings(const QString &packageName)
-{
- //qDebug() << "> openStorageSettings(" << packageName << ")";
-
- if (QtAndroid::androidSdkVersion() >= 30)
- {
- QAndroidJniObject jpackageName = QAndroidJniObject::fromString("package:" + packageName);
- QAndroidJniObject jintentObject = QAndroidJniObject::getStaticObjectField("android/provider/Settings",
- "ACTION_MANAGE_APP_ALL_FILES_ACCESS_PERMISSION",
- "Ljava/lang/String;");
-
- QAndroidJniObject juri = QAndroidJniObject::callStaticObjectMethod("android/net/Uri", "parse",
- "(Ljava/lang/String;)Landroid/net/Uri;",
- jpackageName.object());
- if (!juri.isValid())
- {
- qWarning("Unable to create Uri object for ACTION_MANAGE_APP_ALL_FILES_ACCESS_PERMISSION");
- return;
- }
-
- QAndroidJniObject intent("android/content/Intent", "(Ljava/lang/String;)V", jintentObject.object());
- if (!intent.isValid())
- {
- qWarning("Unable to create Intent object for ACTION_MANAGE_APP_ALL_FILES_ACCESS_PERMISSION");
- return;
- }
-
- intent.callObjectMethod("setData", "(Landroid/net/Uri;)Landroid/content/Intent;",
- juri.object());
-
- QtAndroid::startActivity(intent, 0);
- }
-}
-
-/* ************************************************************************** */
-
-void UtilsAndroid::openLocationSettings()
-{
- //qDebug() << "> openLocationSettings()";
-
- QAndroidJniObject jintentObject = QAndroidJniObject::getStaticObjectField("android/provider/Settings",
- "ACTION_LOCATION_SOURCE_SETTINGS",
- "Ljava/lang/String;");
-
- QAndroidJniObject intent("android/content/Intent", "(Ljava/lang/String;)V", jintentObject.object());
- if (!intent.isValid())
- {
- qWarning("Unable to create Intent object for ACTION_LOCATION_SOURCE_SETTINGS");
- return;
- }
-
- jint jflag = QAndroidJniObject::getStaticField("android/content/Intent", "FLAG_ACTIVITY_NEW_TASK");
- intent.callObjectMethod("setFlags", "(I)Landroid/content/Intent;", jflag);
-
- QtAndroid::startActivity(intent, 0);
-}
-
-/* ************************************************************************** */
-#endif // Q_OS_ANDROID
diff --git a/src/thirdparty/MobileUI/MobileUI_android_qt5.cpp b/src/thirdparty/MobileUI/MobileUI_android_qt5.cpp
deleted file mode 100644
index 58d1afeee..000000000
--- a/src/thirdparty/MobileUI/MobileUI_android_qt5.cpp
+++ /dev/null
@@ -1,527 +0,0 @@
-/*!
- * Copyright (c) 2016 J-P Nurmi
- * Copyright (c) 2023 Emeric Grange
- *
- * Permission is hereby granted, free of charge, to any person obtaining a copy
- * of this software and associated documentation files (the "Software"), to deal
- * in the Software without restriction, including without limitation the rights
- * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
- * copies of the Software, and to permit persons to whom the Software is
- * furnished to do so, subject to the following conditions:
- *
- * The above copyright notice and this permission notice shall be included in all
- * copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
- * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
- * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
- * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
- * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
- * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
- * SOFTWARE.
- */
-
-#include "MobileUI_private.h"
-
-#include
-#include
-#include
-#include
-
-#include
-#include
-
-/* ************************************************************************** */
-
-// WindowManager.LayoutParams
-#define FLAG_KEEP_SCREEN_ON 0x00000080
-#define FLAG_TRANSLUCENT_STATUS 0x04000000
-#define FLAG_TRANSLUCENT_NAVIGATION 0x08000000
-#define FLAG_DRAWS_SYSTEM_BAR_BACKGROUNDS 0x80000000
-
-// View
-#define SYSTEM_UI_FLAG_LAYOUT_STABLE 0x00000100
-#define SYSTEM_UI_FLAG_LAYOUT_HIDE_NAVIGATION 0x00000200
-#define SYSTEM_UI_FLAG_LAYOUT_FULLSCREEN 0x00000400
-#define SYSTEM_UI_FLAG_LIGHT_STATUS_BAR 0x00002000
-#define SYSTEM_UI_FLAG_LIGHT_NAVIGATION_BAR 0x00000010
-
-// UI modes
-#define UI_MODE_NIGHT_UNDEFINED 0x00000000
-#define UI_MODE_NIGHT_NO 0x00000010
-#define UI_MODE_NIGHT_YES 0x00000020
-#define UI_MODE_NIGHT_MASK 0x00000030
-
-// WindowInsetsController
-#define APPEARANCE_OPAQUE_STATUS_BARS 0x00000001
-#define APPEARANCE_OPAQUE_NAVIGATION_BARS 0x00000002
-#define APPEARANCE_LOW_PROFILE_BARS 0x00000004
-#define APPEARANCE_LIGHT_STATUS_BARS 0x00000008
-#define APPEARANCE_LIGHT_NAVIGATION_BARS 0x00000010
-#define APPEARANCE_SEMI_TRANSPARENT_STATUS_BARS 0x00000020
-#define APPEARANCE_SEMI_TRANSPARENT_NAVIGATION_BARS 0x0030
-
-#define BEHAVIOR_SHOW_BARS_BY_TOUCH 0x00000000
-#define BEHAVIOR_SHOW_BARS_BY_SWIPE 0x00000001
-#define BEHAVIOR_DEFAULT 0x00000001
-#define BEHAVIOR_SHOW_TRANSIENT_BARS_BY_SWIPE 0x00000002
-
-// VibrationEffect
-#define DEFAULT_AMPLITUDE 0xffffffff
-#define EFFECT_CLICK 0x00000000
-#define EFFECT_DOUBLE_CLICK 0x00000001
-#define EFFECT_HEAVY_CLICK 0x00000005
-#define EFFECT_TICK 0x00000002
-
-/* ************************************************************************** */
-
-static bool isQColorLight(const QColor color)
-{
- double darkness = 1.0 - (0.299 * color.red() + 0.587 * color.green() + 0.114 * color.blue()) / 255.0;
- return (darkness < 0.2);
-}
-
-static QAndroidJniObject getAndroidWindow()
-{
- QAndroidJniObject activity = QtAndroid::androidActivity();
- QAndroidJniObject window = activity.callObjectMethod("getWindow", "()Landroid/view/Window;");
-
- return window;
-}
-
-static QAndroidJniObject getAndroidDecorView()
-{
- QAndroidJniObject activity = QtAndroid::androidActivity();
- QAndroidJniObject window = activity.callObjectMethod("getWindow", "()Landroid/view/Window;");
- QAndroidJniObject view = window.callObjectMethod("getDecorView", "()Landroid/view/View;");
-
- return view;
-}
-
-static QAndroidJniObject getDisplayCutout()
-{
- if (QtAndroid::androidSdkVersion() >= 28)
- {
- // DisplayCutout has been added in API level 28
- QAndroidJniObject activity = QtAndroid::androidActivity();
- QAndroidJniObject window = activity.callObjectMethod("getWindow", "()Landroid/view/Window;");
- QAndroidJniObject decorview = window.callObjectMethod("getDecorView", "()Landroid/view/View;");
- QAndroidJniObject insets = decorview.callObjectMethod("getRootWindowInsets", "()Landroid/view/WindowInsets;");
- QAndroidJniObject cutout = insets.callObjectMethod("getDisplayCutout", "()Landroid/view/DisplayCutout;");
-
- return cutout;
- }
-
- return QAndroidJniObject();
-}
-
-/* ************************************************************************** */
-
-int MobileUIPrivate::getDeviceTheme()
-{
- QAndroidJniObject activity = QtAndroid::androidActivity();
- QAndroidJniObject resources = activity.callObjectMethod("getResources", "()Landroid/content/res/Resources;");
- QAndroidJniObject conf = resources.callObjectMethod("getConfiguration", "()Landroid/content/res/Configuration;");
-
- int uiMode = (conf.getField("uiMode") & UI_MODE_NIGHT_MASK);
-
- return (uiMode == UI_MODE_NIGHT_YES) ? MobileUI::Theme::Dark : MobileUI::Theme::Light;
-}
-
-void MobileUIPrivate::refreshUI_async()
-{
- MobileUIPrivate::setTheme_statusbar(MobileUIPrivate::statusbarTheme);
- MobileUIPrivate::setTheme_navbar(MobileUIPrivate::navbarTheme);
-}
-
-/* ************************************************************************** */
-
-void MobileUIPrivate::setColor_statusbar(const QColor &color)
-{
- QtAndroid::runOnAndroidThread([=]() {
- // set color
- QAndroidJniObject window = getAndroidWindow();
- window.callMethod("addFlags", "(I)V", FLAG_DRAWS_SYSTEM_BAR_BACKGROUNDS);
- window.callMethod("clearFlags", "(I)V", FLAG_TRANSLUCENT_STATUS);
- window.callMethod("setStatusBarColor", "(I)V", color.rgba());
-
- if (color != "transparent")
- {
- // derive the theme from the color, if possible
- MobileUIPrivate::statusbarTheme = static_cast(!isQColorLight(color));
- setTheme_statusbar(MobileUIPrivate::statusbarTheme);
- }
- });
-}
-
-void MobileUIPrivate::setTheme_statusbar(const MobileUI::Theme theme)
-{
- if (QtAndroid::androidSdkVersion() < 23) return;
-
- QtAndroid::runOnAndroidThread([=]() {
- if (QtAndroid::androidSdkVersion() < 30)
- {
- // Added in API level 23 // Deprecated in API level 30
-
- QAndroidJniObject view = getAndroidDecorView();
-
- int visibility = view.callMethod("getSystemUiVisibility", "()I");
- if (theme == MobileUI::Theme::Light)
- visibility |= SYSTEM_UI_FLAG_LIGHT_STATUS_BAR;
- else
- visibility &= ~SYSTEM_UI_FLAG_LIGHT_STATUS_BAR;
-
- view.callMethod("setSystemUiVisibility", "(I)V", visibility);
- }
- else if (QtAndroid::androidSdkVersion() >= 30)
- {
- // Added in API level 30
-
- QAndroidJniObject window = getAndroidWindow();
- QAndroidJniObject inset = window.callObjectMethod("getInsetsController",
- "()Landroid/view/WindowInsetsController;");
-
- int visibility = inset.callMethod("getSystemBarsAppearance", "()I");
- if (theme == MobileUI::Theme::Light)
- visibility |= APPEARANCE_LIGHT_STATUS_BARS;
- else
- visibility &= ~APPEARANCE_LIGHT_STATUS_BARS;
-
- inset.callMethod("setSystemBarsAppearance", "(II)V",
- visibility, APPEARANCE_LIGHT_STATUS_BARS);
-
- if (!MobileUIPrivate::areRefreshSlotsConnected)
- {
- QScreen *screen = qApp->primaryScreen();
- if (screen)
- {
- QObject::connect(screen, &QScreen::orientationChanged,
- qApp, [](Qt::ScreenOrientation) { refreshUI_async(); });
- }
-
- QWindowList windows = qApp->allWindows();
- if (windows.size() && windows.at(0))
- {
- QWindow *window_qt = windows.at(0);
- QObject::connect(window_qt, &QWindow::visibilityChanged,
- qApp, [](QWindow::Visibility) { refreshUI_async(); });
- }
-
- MobileUIPrivate::areRefreshSlotsConnected = true;
- }
- }
- });
-}
-
-/* ************************************************************************** */
-
-void MobileUIPrivate::setColor_navbar(const QColor &color)
-{
- QtAndroid::runOnAndroidThread([=]() {
- QAndroidJniObject window_android = getAndroidWindow();
- QWindow *window_qt = (qApp->allWindows().size() && qApp->allWindows().at(0)) ? qApp->allWindows().at(0) : nullptr;
-
- // set color
- QAndroidJniObject window = getAndroidWindow();
- window.callMethod("addFlags", "(I)V", FLAG_DRAWS_SYSTEM_BAR_BACKGROUNDS);
- window.callMethod("clearFlags", "(I)V", FLAG_TRANSLUCENT_NAVIGATION);
- window.callMethod("setNavigationBarColor", "(I)V", color.rgba());
-
- if (window_qt && window_qt->flags() & Qt::MaximizeUsingFullscreenGeometryHint)
- {
- // if we try to set the FLAG_DRAWS_SYSTEM_BAR_BACKGROUNDS flag while in fullscreen mode, it will mess everything up
- window_android.callMethod("addFlags", "(I)V", FLAG_TRANSLUCENT_NAVIGATION);
- window_android.callMethod("addFlags", "(I)V", FLAG_TRANSLUCENT_NAVIGATION);
- }
- else
- {
- // set color
- window_android.callMethod("addFlags", "(I)V", FLAG_DRAWS_SYSTEM_BAR_BACKGROUNDS);
- window_android.callMethod("clearFlags", "(I)V", FLAG_TRANSLUCENT_NAVIGATION);
- window_android.callMethod("setNavigationBarColor", "(I)V", color.rgba());
- }
-
- if (color != "transparent")
- {
- // derive the theme from the color, if possible
- MobileUIPrivate::navbarTheme = static_cast(!isQColorLight(color));
- setTheme_navbar(MobileUIPrivate::navbarTheme);
- }
- });
-}
-
-void MobileUIPrivate::setTheme_navbar(const MobileUI::Theme theme)
-{
- if (QtAndroid::androidSdkVersion() < 23) return;
-
- QtAndroid::runOnAndroidThread([=]() {
- if (QtAndroid::androidSdkVersion() < 30)
- {
- // Added in API level 23 // Deprecated in API level 30
-
- QAndroidJniObject view = getAndroidDecorView();
-
- int visibility = view.callMethod("getSystemUiVisibility", "()I");
- if (theme == MobileUI::Theme::Light)
- visibility |= SYSTEM_UI_FLAG_LIGHT_NAVIGATION_BAR;
- else
- visibility &= ~SYSTEM_UI_FLAG_LIGHT_NAVIGATION_BAR;
-
- view.callMethod("setSystemUiVisibility", "(I)V", visibility);
- }
- else if (QtAndroid::androidSdkVersion() >= 30)
- {
- // Added in API level 30
-
- QAndroidJniObject window = getAndroidWindow();
- QAndroidJniObject inset = window.callObjectMethod("getInsetsController",
- "()Landroid/view/WindowInsetsController;");
-
- int visibility = inset.callMethod("getSystemBarsAppearance", "()I");
- if (theme == MobileUI::Theme::Light)
- visibility |= APPEARANCE_LIGHT_NAVIGATION_BARS;
- else
- visibility &= ~APPEARANCE_LIGHT_NAVIGATION_BARS;
-
- inset.callMethod("setSystemBarsAppearance", "(II)V",
- visibility, APPEARANCE_LIGHT_NAVIGATION_BARS);
-
- if (!MobileUIPrivate::areRefreshSlotsConnected)
- {
- QScreen *screen = qApp->primaryScreen();
- if (screen)
- {
- QObject::connect(screen, &QScreen::orientationChanged,
- qApp, [](Qt::ScreenOrientation) { refreshUI_async(); });
- }
-
- QWindowList windows = qApp->allWindows();
- if (windows.size() && windows.at(0))
- {
- QWindow *window_qt = windows.at(0);
- QObject::connect(window_qt, &QWindow::visibilityChanged,
- qApp, [](QWindow::Visibility) { refreshUI_async(); });
- }
-
- MobileUIPrivate::areRefreshSlotsConnected = true;
- }
- }
- });
-}
-
-/* ************************************************************************** */
-
-int MobileUIPrivate::getStatusbarHeight()
-{
- QAndroidJniObject activity = QtAndroid::androidActivity();
- QAndroidJniObject resources = activity.callObjectMethod("getResources", "()Landroid/content/res/Resources;");
-
- QAndroidJniObject jName = QAndroidJniObject::fromString("status_bar_height");
- QAndroidJniObject jDefType = QAndroidJniObject::fromString("dimen");
- QAndroidJniObject jDefPackage = QAndroidJniObject::fromString("android");
-
- jint identifier = resources.callMethod("getIdentifier",
- "(Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;)I",
- jName.object(),
- jDefType.object(),
- jDefPackage.object());
-
- if (identifier > 0)
- {
- return resources.callMethod("getDimensionPixelSize", "(I)I",
- identifier) / qApp->devicePixelRatio();
- }
-
- return 24; // default
-}
-
-int MobileUIPrivate::getNavbarHeight()
-{
- QAndroidJniObject activity = QtAndroid::androidActivity();
- QAndroidJniObject resources = activity.callObjectMethod("getResources", "()Landroid/content/res/Resources;");
-
- QAndroidJniObject name = QAndroidJniObject::fromString("navigation_bar_height");
- QAndroidJniObject jDefType = QAndroidJniObject::fromString("dimen");
- QAndroidJniObject jDefPackage = QAndroidJniObject::fromString("android");
-
- int identifier = resources.callMethod("getIdentifier",
- "(Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;)I",
- name.object(),
- defType.object(),
- defPackage.object());
-
- if (identifier > 0)
- {
- return resources.callMethod("getDimensionPixelSize",
- "(I)I", identifier) / qApp->devicePixelRatio();
- }
-
- return 48; // default
-}
-
-int MobileUIPrivate::getSafeAreaTop()
-{
- QAndroidJniObject cutout = getDisplayCutout();
- if (cutout.isValid())
- {
- return cutout.callMethod("getSafeInsetTop", "()I") / qApp->devicePixelRatio();
- }
-
- return 0;
-}
-
-int MobileUIPrivate::getSafeAreaLeft()
-{
- QAndroidJniObject cutout = getDisplayCutout();
- if (cutout.isValid())
- {
- return cutout.callMethod("getSafeInsetLeft", "()I") / qApp->devicePixelRatio();
- }
-
- return 0;
-}
-
-int MobileUIPrivate::getSafeAreaRight()
-{
- QAndroidJniObject cutout = getDisplayCutout();
- if (cutout.isValid())
- {
- return cutout.callMethod("getSafeInsetRight", "()I") / qApp->devicePixelRatio();
- }
-
- return 0;
-}
-
-int MobileUIPrivate::getSafeAreaBottom()
-{
- QAndroidJniObject cutout = getDisplayCutout();
- if (cutout.isValid())
- {
- return cutout.callMethod("getSafeInsetBottom", "()I") / qApp->devicePixelRatio();
- }
-
- return 0;
-}
-
-/* ************************************************************************** */
-
-void MobileUIPrivate::setScreenAlwaysOn(const bool on)
-{
- QtAndroid::runOnAndroidThread([=]() {
- QAndroidJniObject window = getAndroidWindow();
-
- if (on)
- window.callMethod("addFlags", "(I)V", FLAG_KEEP_SCREEN_ON);
- else
- window.callMethod("clearFlags", "(I)V", FLAG_KEEP_SCREEN_ON);
- });
-}
-
-void MobileUIPrivate::setScreenOrientation(const MobileUI::ScreenOrientation orientation)
-{
- int value = -1; // SCREEN_ORIENTATION_UNSPECIFIED
-
- if (orientation == MobileUI::Portrait) value = 1; // SCREEN_ORIENTATION_PORTRAIT
- else if (orientation == MobileUI::Portrait_upsidedown) value = 9; // SCREEN_ORIENTATION_REVERSE_PORTRAIT
- else if (orientation == MobileUI::Portrait_sensor) value = 7; // SCREEN_ORIENTATION_SENSOR_PORTRAIT
- else if (orientation == MobileUI::Landscape_left) value = 0; // SCREEN_ORIENTATION_LANDSCAPE
- else if (orientation == MobileUI::Landscape_right) value = 8; // SCREEN_ORIENTATION_REVERSE_LANDSCAPE
- else if (orientation == MobileUI::Landscape_sensor) value = 6; // SCREEN_ORIENTATION_SENSOR_LANDSCAPE
-
- QAndroidJniObject activity = QtAndroid::androidActivity();
- if (activity.isValid())
- {
- activity.callMethod("setRequestedOrientation", "(I)V", value);
- }
-}
-
-/* ************************************************************************** */
-
-int MobileUIPrivate::getScreenBrightness()
-{
- QAndroidJniObject activity = QtAndroid::androidActivity();
- QAndroidJniObject window = activity.callObjectMethod("getWindow", "()Landroid/view/Window;");
-
- // If we have set a brightness value for the current application
- QAndroidJniObject layoutParams = window.callObjectMethod("getAttributes", "()Landroid/view/WindowManager$LayoutParams;");
- float brightnessApp = layoutParams.getField("screenBrightness");
- if (brightnessApp >= 0.f) return static_cast(brightnessApp * 100.f);
-
- // Otherwise, we try to read the system wide brightness value
- // TODO
-
- return -1;
-}
-
-void MobileUIPrivate::setScreenBrightness(const int value)
-{
- QtAndroid::runOnAndroidThread([=]() {
- QAndroidJniObject window = getAndroidWindow();
- QAndroidJniObject layoutParams = window.callObjectMethod("getAttributes", "()Landroid/view/WindowManager$LayoutParams;");
-
- float brightness = value / 100.f; // screenBrightness is 0.0 to 1.0
- if (brightness < 0.0f) brightness = 0.0f;
- if (brightness > 1.0f) brightness = 1.0f;
-
- layoutParams.setField("screenBrightness", brightness);
- window.callMethod("setAttributes", "(Landroid/view/WindowManager$LayoutParams;)V", layoutParams.object());
- });
-}
-
-/* ************************************************************************** */
-
-void MobileUIPrivate::vibrate()
-{
- QtAndroid::runOnAndroidThread([=]() {
- QAndroidJniObject activity = QtAndroid::androidActivity();
- if (activity.isValid())
- {
- QAndroidJniObject vibratorString = QAndroidJniObject::fromString("vibrator");
- QAndroidJniObject vibratorService = activity.callObjectMethod("getSystemService",
- "(Ljava/lang/String;)Ljava/lang/Object;",
- vibratorString.object());
- if (vibratorService.callMethod("hasVibrator", "()Z"))
- {
- if (QtAndroid::androidSdkVersion() >= 26)
- {
- // vibrate(VibrationEffect vibe) // Added in API level 26
-
- jint effect = EFFECT_TICK;
- QAndroidJniObject vibrationEffect = QAndroidJniObject::callStaticObjectMethod("android/os/VibrationEffect",
- "createPredefined",
- "(I)Landroid/os/VibrationEffect;",
- effect);
-
- vibratorService.callMethod("vibrate",
- "(Landroid/os/VibrationEffect;)V",
- vibrationEffect.object());
- }
- else
- {
- // vibrate(long milliseconds) // Deprecated in API level 26
-
- jlong ms = 25;
- vibratorService.callMethod("vibrate", "(J)V", ms);
- }
- }
- }
- QAndroidJniEnvironment env;
- if (env->ExceptionCheck())
- {
- env->ExceptionClear();
- }
- });
-}
-
-/* ************************************************************************** */
-
-void MobileUIPrivate::backToHomeScreen()
-{
- QAndroidJniObject activity = QtAndroid::androidActivity();
- if (activity.isValid())
- {
- activity.callMethod("moveTaskToBack", "(Z)Z", true);
- }
-}
-
-/* ************************************************************************** */
diff --git a/src/thirdparty/MobileUI/qmldir b/src/thirdparty/MobileUI/qmldir
deleted file mode 100644
index e69de29bb..000000000
diff --git a/src/thirdparty/AppUtils/CMakeLists.txt b/thirdparty/AppUtils/CMakeLists.txt
similarity index 76%
rename from src/thirdparty/AppUtils/CMakeLists.txt
rename to thirdparty/AppUtils/CMakeLists.txt
index c1a29fe44..ae9b2f457 100644
--- a/src/thirdparty/AppUtils/CMakeLists.txt
+++ b/thirdparty/AppUtils/CMakeLists.txt
@@ -1,24 +1,18 @@
-cmake_minimum_required(VERSION 3.20)
-
project(AppUtils LANGUAGES CXX)
-set(CMAKE_CXX_STANDARD 14)
-set(CMAKE_CXX_STANDARD_REQUIRED ON)
+set(CMAKE_CXX_STANDARD 17)
set(CMAKE_AUTOMOC ON)
+################################################################################
+
#set(UTILS_DOCK_ENABLED true)
#set(UTILS_WIFI_ENABLED true)
#set(UTILS_NOTIFICATIONS_ENABLED true)
################################################################################
-if(NOT QT_DEFAULT_MAJOR_VERSION)
- set(QT_DEFAULT_MAJOR_VERSION 6 CACHE STRING "Qt version to use (5 or 6), defaults to 6")
-endif()
-
# Generic dependencies
-set(CORE_COMPONENTS Core Gui Qml Quick)
-find_package(Qt${QT_DEFAULT_MAJOR_VERSION} REQUIRED COMPONENTS ${CORE_COMPONENTS})
+find_package(Qt6 6.6 REQUIRED COMPONENTS Core Gui Qml Quick)
set(CORE_LIBRARIES
Qt::Core
@@ -57,26 +51,17 @@ if(NOT ANDROID)
utils_os_linux.cpp
utils_os_linux.h)
- find_package(Qt${QT_DEFAULT_MAJOR_VERSION} REQUIRED COMPONENTS DBus)
+ find_package(Qt6 REQUIRED COMPONENTS DBus)
set(PLATFORM_LIBRARIES Qt::DBus m)
endif()
endif()
if(ANDROID)
-if(QT_DEFAULT_MAJOR_VERSION EQUAL 6)
set(PLATFORM_SOURCES
- utils_os_android_qt6.cpp
+ utils_os_android.cpp
utils_os_android.h)
set(PLATFORM_LIBRARIES Qt::CorePrivate m)
-elseif(QT_DEFAULT_MAJOR_VERSION EQUAL 5)
- set(PLATFORM_SOURCES
- utils_os_android_qt5.cpp
- utils_os_android.h)
-
- find_package(Qt${QT_DEFAULT_MAJOR_VERSION} REQUIRED COMPONENTS AndroidExtra)
- set(PLATFORM_LIBRARIES Qt::AndroidExtra m)
-endif()
endif()
if(WIN32)
@@ -99,7 +84,7 @@ if(APPLE AND NOT IOS)
endif()
if(IOS)
- find_package(Qt${QT_DEFAULT_MAJOR_VERSION} REQUIRED COMPONENTS Quick)
+ find_package(Qt6 REQUIRED COMPONENTS Quick)
set(PLATFORM_LIBRARIES Qt::Quick)
set(PLATFORM_LIBRARIES "-framework UIKit" m)
diff --git a/src/thirdparty/AppUtils/LICENSE b/thirdparty/AppUtils/LICENSE
similarity index 100%
rename from src/thirdparty/AppUtils/LICENSE
rename to thirdparty/AppUtils/LICENSE
diff --git a/src/thirdparty/AppUtils/README.md b/thirdparty/AppUtils/README.md
similarity index 78%
rename from src/thirdparty/AppUtils/README.md
rename to thirdparty/AppUtils/README.md
index fef9f9822..ccd05865f 100644
--- a/src/thirdparty/AppUtils/README.md
+++ b/thirdparty/AppUtils/README.md
@@ -1,17 +1,13 @@
# AppUtils
-A collection of C++ helpers for (my) QML applications. Works with Qt5 and Qt6.
+A collection of C++ helpers for (my) QML applications.
## Quick start
### Build
-Copy the AppUtils directory into your project, then include the library files with
-either the `AppUtils.pro` QMake project file or the `CMakeLists.txt` CMake project file.
-
-```qmake
-include(src/thirdparty/AppUtils/AppUtils.pri)
-```
+Copy the AppUtils directory into your project, then include the library files
+using the `CMakeLists.txt` CMake project file.
```cmake
add_subdirectory(src/thirdparty/AppUtils)
diff --git a/src/thirdparty/AppUtils/utils_app.cpp b/thirdparty/AppUtils/utils_app.cpp
similarity index 94%
rename from src/thirdparty/AppUtils/utils_app.cpp
rename to thirdparty/AppUtils/utils_app.cpp
index 4ab04c4e3..be59f1411 100644
--- a/src/thirdparty/AppUtils/utils_app.cpp
+++ b/thirdparty/AppUtils/utils_app.cpp
@@ -41,16 +41,12 @@
#include
#include
-#if (QT_VERSION >= QT_VERSION_CHECK(6, 6, 0))
#include
#include // // ?
-#endif // Qt 6.6
-#if (QT_VERSION >= QT_VERSION_CHECK(6, 5, 0))
#include
#include
#include
-#endif // Qt 6.5
/* ************************************************************************** */
@@ -165,42 +161,30 @@ bool UtilsApp::qtIsRelease()
bool UtilsApp::qtIsStatic()
{
-#if (QT_VERSION >= QT_VERSION_CHECK(6, 0, 0))
return !QLibraryInfo::isSharedBuild();
-#endif
-
- return false;
}
bool UtilsApp::qtIsShared()
{
-#if (QT_VERSION >= QT_VERSION_CHECK(6, 0, 0))
return QLibraryInfo::isSharedBuild();
-#endif
-
- return false;
}
QString UtilsApp::qtRhiBackend() const
{
-#if (QT_VERSION >= QT_VERSION_CHECK(6, 6, 0))
if (m_quickwindow && m_quickwindow->rhi())
{
return m_quickwindow->rhi()->backendName();
}
-#endif
return QString();
}
void UtilsApp::setQuickWindow(QQuickWindow *window)
{
-#if (QT_VERSION >= QT_VERSION_CHECK(6, 6, 0))
if (window)
{
m_quickwindow = window;
}
-#endif
}
/* ************************************************************************** */
@@ -286,22 +270,8 @@ bool UtilsApp::isQColorLight(const QColor &color)
bool UtilsApp::isOsThemeDark()
{
- bool isDark = false;
-
-#if (QT_VERSION >= QT_VERSION_CHECK(6, 5, 0))
-
const QStyleHints *styleHints = static_castqApp->styleHints();
- isDark = (styleHints && styleHints->colorScheme() == Qt::ColorScheme::Dark);
-
-#elif (QT_VERSION >= QT_VERSION_CHECK(6, 0, 0))
-
- const QPalette defaultPalette = static_castqApp->palette();
- isDark = (defaultPalette.color(QPalette::WindowText).lightness() >
- defaultPalette.color(QPalette::Window).lightness());
-
-#endif
-
- return isDark;
+ return (styleHints && styleHints->colorScheme() == Qt::ColorScheme::Dark);
}
/* ************************************************************************** */
diff --git a/src/thirdparty/AppUtils/utils_app.h b/thirdparty/AppUtils/utils_app.h
similarity index 100%
rename from src/thirdparty/AppUtils/utils_app.h
rename to thirdparty/AppUtils/utils_app.h
diff --git a/src/thirdparty/AppUtils/utils_bits.cpp b/thirdparty/AppUtils/utils_bits.cpp
similarity index 100%
rename from src/thirdparty/AppUtils/utils_bits.cpp
rename to thirdparty/AppUtils/utils_bits.cpp
diff --git a/src/thirdparty/AppUtils/utils_bits.h b/thirdparty/AppUtils/utils_bits.h
similarity index 100%
rename from src/thirdparty/AppUtils/utils_bits.h
rename to thirdparty/AppUtils/utils_bits.h
diff --git a/src/thirdparty/AppUtils/utils_clipboard.cpp b/thirdparty/AppUtils/utils_clipboard.cpp
similarity index 100%
rename from src/thirdparty/AppUtils/utils_clipboard.cpp
rename to thirdparty/AppUtils/utils_clipboard.cpp
diff --git a/src/thirdparty/AppUtils/utils_clipboard.h b/thirdparty/AppUtils/utils_clipboard.h
similarity index 100%
rename from src/thirdparty/AppUtils/utils_clipboard.h
rename to thirdparty/AppUtils/utils_clipboard.h
diff --git a/src/thirdparty/AppUtils/utils_fpsmonitor.cpp b/thirdparty/AppUtils/utils_fpsmonitor.cpp
similarity index 100%
rename from src/thirdparty/AppUtils/utils_fpsmonitor.cpp
rename to thirdparty/AppUtils/utils_fpsmonitor.cpp
diff --git a/src/thirdparty/AppUtils/utils_fpsmonitor.h b/thirdparty/AppUtils/utils_fpsmonitor.h
similarity index 100%
rename from src/thirdparty/AppUtils/utils_fpsmonitor.h
rename to thirdparty/AppUtils/utils_fpsmonitor.h
diff --git a/src/thirdparty/AppUtils/utils_language.cpp b/thirdparty/AppUtils/utils_language.cpp
similarity index 59%
rename from src/thirdparty/AppUtils/utils_language.cpp
rename to thirdparty/AppUtils/utils_language.cpp
index b73692426..da9b9a6ce 100644
--- a/src/thirdparty/AppUtils/utils_language.cpp
+++ b/thirdparty/AppUtils/utils_language.cpp
@@ -44,8 +44,8 @@ UtilsLanguage *UtilsLanguage::getInstance()
UtilsLanguage::UtilsLanguage()
{
- // Set a default application name and instance
- m_appName = QCoreApplication::applicationName().toLower();
+ // Set a default application name and Qt application instance
+ m_appName = QCoreApplication::applicationName();
m_qt_app = QCoreApplication::instance();
}
@@ -54,12 +54,12 @@ UtilsLanguage::~UtilsLanguage()
//
}
-/* ************************************************************************** */
/* ************************************************************************** */
-void UtilsLanguage::setAppName(const QString &name)
+void UtilsLanguage::setAppName(const QString &name, const bool forceLowerCase)
{
- m_appName = name;
+ if (forceLowerCase) m_appName = name.toLower();
+ else m_appName = name;
}
void UtilsLanguage::setAppInstance(QCoreApplication *app)
@@ -76,10 +76,13 @@ void UtilsLanguage::setQmlEngine(QQmlApplicationEngine *engine)
void UtilsLanguage::loadLanguage(const QString &lng)
{
- //qDebug() << "UtilsLanguage::loadLanguage(" << lng << ")";
+ if (!m_qt_app || m_appLanguage == lng)
+ {
+ qWarning() << "UtilsLanguage::loadLanguage(" << lng << ") ERROR !";
+ return;
+ }
- if (!m_qt_app) return;
- if (m_appLanguage == lng) return;
+ //qDebug() << "UtilsLanguage::loadLanguage(" << lng << ")";
// Remove old language
if (m_qtTranslator)
@@ -93,50 +96,55 @@ void UtilsLanguage::loadLanguage(const QString &lng)
delete m_appTranslator;
}
- QString locale_str_full;
- QString locale_str_short;
-
m_appLanguage = lng;
- if (m_appLanguage == "Chinese (traditional)") locale_str_full = "zh_TW";
- else if (m_appLanguage == "Chinese (simplified)") locale_str_full = "zh_CN";
- else if (m_appLanguage == "Dansk") locale_str_full = "da_DK";
- else if (m_appLanguage == "Deutsch") locale_str_full = "de_DE";
- else if (m_appLanguage == "English") locale_str_full = "en_EN";
- else if (m_appLanguage == "Español") locale_str_full = "es_ES";
- else if (m_appLanguage == "Français") locale_str_full = "fr_FR";
- else if (m_appLanguage == "Frysk") locale_str_full = "fy_NL";
- else if (m_appLanguage == "Hungarian") locale_str_full = "hu_HU";
- else if (m_appLanguage == "Nederlands") locale_str_full = "nl_NL";
- else if (m_appLanguage == "Norsk (Bokmål)") locale_str_full = "nb_NO";
- else if (m_appLanguage == "Norsk (Nynorsk)") locale_str_full = "nn_NO";
- else if (m_appLanguage == "Pусский") locale_str_full = "ru_RU";
+ if (m_appLanguage == "Chinese (traditional)") m_locale_str_full = "zh_TW";
+ else if (m_appLanguage == "Chinese (simplified)") m_locale_str_full = "zh_CN";
+ else if (m_appLanguage == "Dansk") m_locale_str_full = "da_DK";
+ else if (m_appLanguage == "Deutsch") m_locale_str_full = "de_DE";
+ else if (m_appLanguage == "English") m_locale_str_full = "en_EN";
+ else if (m_appLanguage == "Español") m_locale_str_full = "es_ES";
+ else if (m_appLanguage == "Italiano") m_locale_str_full = "it_IT";
+ else if (m_appLanguage == "Français") m_locale_str_full = "fr_FR";
+ else if (m_appLanguage == "Frysk") m_locale_str_full = "fy_NL";
+ else if (m_appLanguage == "Hungarian") m_locale_str_full = "hu_HU";
+ else if (m_appLanguage == "Nederlands") m_locale_str_full = "nl_NL";
+ else if (m_appLanguage == "Norsk (Bokmål)") m_locale_str_full = "nb_NO";
+ else if (m_appLanguage == "Norsk (Nynorsk)") m_locale_str_full = "nn_NO";
+ else if (m_appLanguage == "Polski") m_locale_str_full = "pl_PL";
+ else if (m_appLanguage == "Pусский") m_locale_str_full = "ru_RU";
else
{
- locale_str_full = QLocale::system().name();
+ m_locale_str_full = QLocale::system().name();
m_appLanguage = "auto";
}
- locale_str_short = locale_str_full;
- locale_str_short.truncate(locale_str_full.lastIndexOf('_'));
+ m_locale_str_short = m_locale_str_full;
+ m_locale_str_short.truncate(m_locale_str_full.lastIndexOf('_'));
- QLocale locale(locale_str_full);
+ QLocale locale(m_locale_str_full);
QLocale::setDefault(locale);
-#if (QT_VERSION >= QT_VERSION_CHECK(6, 0, 0))
QString translationpath = QLibraryInfo::path(QLibraryInfo::TranslationsPath);
-#else
- QString translationpath = QLibraryInfo::location(QLibraryInfo::TranslationsPath);
-#endif
m_qtTranslator = new QTranslator;
if (m_qtTranslator)
- if (m_qtTranslator->load("qt_" + locale_str_full, translationpath))
+ {
+ if (m_qtTranslator->load("qt_" + m_locale_str_full, translationpath)) {
m_qt_app->installTranslator(m_qtTranslator);
+ } else {
+ qWarning() << "qtTranslator ERROR !";
+ }
+ }
m_appTranslator = new QTranslator;
- if (m_qtTranslator)
- if (m_appTranslator->load(":/i18n/" + m_appName + "_" + locale_str_full + ".qm"))
+ if (m_appTranslator)
+ {
+ if (m_appTranslator->load(":/i18n/" + m_appName + "_" + m_locale_str_short + ".qm")) {
m_qt_app->installTranslator(m_appTranslator);
+ } else {
+ qWarning() << "appTranslator ERROR !" << m_appName << m_locale_str_full;
+ }
+ }
// Install new language
if (m_qml_engine) m_qml_engine->retranslate();
diff --git a/src/thirdparty/AppUtils/utils_language.h b/thirdparty/AppUtils/utils_language.h
similarity index 84%
rename from src/thirdparty/AppUtils/utils_language.h
rename to thirdparty/AppUtils/utils_language.h
index 700feb928..b9e68776b 100644
--- a/src/thirdparty/AppUtils/utils_language.h
+++ b/thirdparty/AppUtils/utils_language.h
@@ -39,6 +39,9 @@ class UtilsLanguage : public QObject
QString m_appName;
QString m_appLanguage;
+ QString m_locale_str_full;
+ QString m_locale_str_short;
+
QCoreApplication *m_qt_app = nullptr;
QQmlApplicationEngine *m_qml_engine = nullptr;
@@ -53,12 +56,15 @@ class UtilsLanguage : public QObject
public:
static UtilsLanguage *getInstance();
- void setAppName(const QString &name);
+ void setAppName(const QString &name, const bool forceLowerCase = false);
void setAppInstance(QCoreApplication *app);
void setQmlEngine(QQmlApplicationEngine *engine);
- QString getCurrentLanguage() const { return m_appLanguage; }
Q_INVOKABLE void loadLanguage(const QString &lng);
+
+ Q_INVOKABLE QString getCurrentLanguage() const { return m_appLanguage; }
+ Q_INVOKABLE QString getCurrentLanguageCode_full() const { return m_locale_str_full; }
+ Q_INVOKABLE QString getCurrentLanguageCode_short() const { return m_locale_str_short; }
};
/* ************************************************************************** */
diff --git a/src/thirdparty/AppUtils/utils_log.cpp b/thirdparty/AppUtils/utils_log.cpp
similarity index 100%
rename from src/thirdparty/AppUtils/utils_log.cpp
rename to thirdparty/AppUtils/utils_log.cpp
diff --git a/src/thirdparty/AppUtils/utils_log.h b/thirdparty/AppUtils/utils_log.h
similarity index 100%
rename from src/thirdparty/AppUtils/utils_log.h
rename to thirdparty/AppUtils/utils_log.h
diff --git a/src/thirdparty/AppUtils/utils_maths.cpp b/thirdparty/AppUtils/utils_maths.cpp
similarity index 100%
rename from src/thirdparty/AppUtils/utils_maths.cpp
rename to thirdparty/AppUtils/utils_maths.cpp
diff --git a/src/thirdparty/AppUtils/utils_maths.h b/thirdparty/AppUtils/utils_maths.h
similarity index 100%
rename from src/thirdparty/AppUtils/utils_maths.h
rename to thirdparty/AppUtils/utils_maths.h
diff --git a/src/thirdparty/AppUtils/utils_os_android_qt6.cpp b/thirdparty/AppUtils/utils_os_android.cpp
similarity index 100%
rename from src/thirdparty/AppUtils/utils_os_android_qt6.cpp
rename to thirdparty/AppUtils/utils_os_android.cpp
diff --git a/src/thirdparty/AppUtils/utils_os_android.h b/thirdparty/AppUtils/utils_os_android.h
similarity index 100%
rename from src/thirdparty/AppUtils/utils_os_android.h
rename to thirdparty/AppUtils/utils_os_android.h
diff --git a/src/thirdparty/AppUtils/utils_os_ios.h b/thirdparty/AppUtils/utils_os_ios.h
similarity index 100%
rename from src/thirdparty/AppUtils/utils_os_ios.h
rename to thirdparty/AppUtils/utils_os_ios.h
diff --git a/src/thirdparty/AppUtils/utils_os_ios.mm b/thirdparty/AppUtils/utils_os_ios.mm
similarity index 100%
rename from src/thirdparty/AppUtils/utils_os_ios.mm
rename to thirdparty/AppUtils/utils_os_ios.mm
diff --git a/src/thirdparty/AppUtils/utils_os_ios_notif.h b/thirdparty/AppUtils/utils_os_ios_notif.h
similarity index 100%
rename from src/thirdparty/AppUtils/utils_os_ios_notif.h
rename to thirdparty/AppUtils/utils_os_ios_notif.h
diff --git a/src/thirdparty/AppUtils/utils_os_ios_notif.mm b/thirdparty/AppUtils/utils_os_ios_notif.mm
similarity index 100%
rename from src/thirdparty/AppUtils/utils_os_ios_notif.mm
rename to thirdparty/AppUtils/utils_os_ios_notif.mm
diff --git a/src/thirdparty/AppUtils/utils_os_ios_wifi.h b/thirdparty/AppUtils/utils_os_ios_wifi.h
similarity index 100%
rename from src/thirdparty/AppUtils/utils_os_ios_wifi.h
rename to thirdparty/AppUtils/utils_os_ios_wifi.h
diff --git a/src/thirdparty/AppUtils/utils_os_ios_wifi.mm b/thirdparty/AppUtils/utils_os_ios_wifi.mm
similarity index 100%
rename from src/thirdparty/AppUtils/utils_os_ios_wifi.mm
rename to thirdparty/AppUtils/utils_os_ios_wifi.mm
diff --git a/src/thirdparty/AppUtils/utils_os_linux.cpp b/thirdparty/AppUtils/utils_os_linux.cpp
similarity index 100%
rename from src/thirdparty/AppUtils/utils_os_linux.cpp
rename to thirdparty/AppUtils/utils_os_linux.cpp
diff --git a/src/thirdparty/AppUtils/utils_os_linux.h b/thirdparty/AppUtils/utils_os_linux.h
similarity index 100%
rename from src/thirdparty/AppUtils/utils_os_linux.h
rename to thirdparty/AppUtils/utils_os_linux.h
diff --git a/src/thirdparty/AppUtils/utils_os_macos.h b/thirdparty/AppUtils/utils_os_macos.h
similarity index 100%
rename from src/thirdparty/AppUtils/utils_os_macos.h
rename to thirdparty/AppUtils/utils_os_macos.h
diff --git a/src/thirdparty/AppUtils/utils_os_macos.mm b/thirdparty/AppUtils/utils_os_macos.mm
similarity index 100%
rename from src/thirdparty/AppUtils/utils_os_macos.mm
rename to thirdparty/AppUtils/utils_os_macos.mm
diff --git a/src/thirdparty/AppUtils/utils_os_macos_dock.h b/thirdparty/AppUtils/utils_os_macos_dock.h
similarity index 100%
rename from src/thirdparty/AppUtils/utils_os_macos_dock.h
rename to thirdparty/AppUtils/utils_os_macos_dock.h
diff --git a/src/thirdparty/AppUtils/utils_os_macos_dock.mm b/thirdparty/AppUtils/utils_os_macos_dock.mm
similarity index 100%
rename from src/thirdparty/AppUtils/utils_os_macos_dock.mm
rename to thirdparty/AppUtils/utils_os_macos_dock.mm
diff --git a/src/thirdparty/AppUtils/utils_os_windows.cpp b/thirdparty/AppUtils/utils_os_windows.cpp
similarity index 100%
rename from src/thirdparty/AppUtils/utils_os_windows.cpp
rename to thirdparty/AppUtils/utils_os_windows.cpp
diff --git a/src/thirdparty/AppUtils/utils_os_windows.h b/thirdparty/AppUtils/utils_os_windows.h
similarity index 100%
rename from src/thirdparty/AppUtils/utils_os_windows.h
rename to thirdparty/AppUtils/utils_os_windows.h
diff --git a/src/thirdparty/AppUtils/utils_screen.cpp b/thirdparty/AppUtils/utils_screen.cpp
similarity index 100%
rename from src/thirdparty/AppUtils/utils_screen.cpp
rename to thirdparty/AppUtils/utils_screen.cpp
diff --git a/src/thirdparty/AppUtils/utils_screen.h b/thirdparty/AppUtils/utils_screen.h
similarity index 100%
rename from src/thirdparty/AppUtils/utils_screen.h
rename to thirdparty/AppUtils/utils_screen.h
diff --git a/src/thirdparty/AppUtils/utils_sysinfo.cpp b/thirdparty/AppUtils/utils_sysinfo.cpp
similarity index 100%
rename from src/thirdparty/AppUtils/utils_sysinfo.cpp
rename to thirdparty/AppUtils/utils_sysinfo.cpp
diff --git a/src/thirdparty/AppUtils/utils_sysinfo.h b/thirdparty/AppUtils/utils_sysinfo.h
similarity index 100%
rename from src/thirdparty/AppUtils/utils_sysinfo.h
rename to thirdparty/AppUtils/utils_sysinfo.h
diff --git a/src/thirdparty/AppUtils/utils_versionchecker.h b/thirdparty/AppUtils/utils_versionchecker.h
similarity index 100%
rename from src/thirdparty/AppUtils/utils_versionchecker.h
rename to thirdparty/AppUtils/utils_versionchecker.h
diff --git a/src/thirdparty/AppUtils/utils_wifi.cpp b/thirdparty/AppUtils/utils_wifi.cpp
similarity index 100%
rename from src/thirdparty/AppUtils/utils_wifi.cpp
rename to thirdparty/AppUtils/utils_wifi.cpp
diff --git a/src/thirdparty/AppUtils/utils_wifi.h b/thirdparty/AppUtils/utils_wifi.h
similarity index 100%
rename from src/thirdparty/AppUtils/utils_wifi.h
rename to thirdparty/AppUtils/utils_wifi.h
diff --git a/src/thirdparty/MobileSharing/CMakeLists.txt b/thirdparty/MobileSharing/CMakeLists.txt
similarity index 100%
rename from src/thirdparty/MobileSharing/CMakeLists.txt
rename to thirdparty/MobileSharing/CMakeLists.txt
diff --git a/src/thirdparty/MobileSharing/LICENSE b/thirdparty/MobileSharing/LICENSE
similarity index 100%
rename from src/thirdparty/MobileSharing/LICENSE
rename to thirdparty/MobileSharing/LICENSE
diff --git a/src/thirdparty/MobileSharing/MobileSharing b/thirdparty/MobileSharing/MobileSharing
similarity index 100%
rename from src/thirdparty/MobileSharing/MobileSharing
rename to thirdparty/MobileSharing/MobileSharing
diff --git a/src/thirdparty/MobileSharing/MobileSharing.h b/thirdparty/MobileSharing/MobileSharing.h
similarity index 100%
rename from src/thirdparty/MobileSharing/MobileSharing.h
rename to thirdparty/MobileSharing/MobileSharing.h
diff --git a/src/thirdparty/MobileSharing/MobileSharing.pri b/thirdparty/MobileSharing/MobileSharing.pri
similarity index 100%
rename from src/thirdparty/MobileSharing/MobileSharing.pri
rename to thirdparty/MobileSharing/MobileSharing.pri
diff --git a/src/thirdparty/MobileSharing/QShareActivity.java b/thirdparty/MobileSharing/QShareActivity.java
similarity index 100%
rename from src/thirdparty/MobileSharing/QShareActivity.java
rename to thirdparty/MobileSharing/QShareActivity.java
diff --git a/src/thirdparty/MobileSharing/README.md b/thirdparty/MobileSharing/README.md
similarity index 100%
rename from src/thirdparty/MobileSharing/README.md
rename to thirdparty/MobileSharing/README.md
diff --git a/src/thirdparty/MobileSharing/SharingApplication.cpp b/thirdparty/MobileSharing/SharingApplication.cpp
similarity index 100%
rename from src/thirdparty/MobileSharing/SharingApplication.cpp
rename to thirdparty/MobileSharing/SharingApplication.cpp
diff --git a/src/thirdparty/MobileSharing/SharingApplication.h b/thirdparty/MobileSharing/SharingApplication.h
similarity index 100%
rename from src/thirdparty/MobileSharing/SharingApplication.h
rename to thirdparty/MobileSharing/SharingApplication.h
diff --git a/src/thirdparty/MobileSharing/SharingUtils.cpp b/thirdparty/MobileSharing/SharingUtils.cpp
similarity index 100%
rename from src/thirdparty/MobileSharing/SharingUtils.cpp
rename to thirdparty/MobileSharing/SharingUtils.cpp
diff --git a/src/thirdparty/MobileSharing/SharingUtils.h b/thirdparty/MobileSharing/SharingUtils.h
similarity index 100%
rename from src/thirdparty/MobileSharing/SharingUtils.h
rename to thirdparty/MobileSharing/SharingUtils.h
diff --git a/src/thirdparty/MobileSharing/SharingUtils_android.h b/thirdparty/MobileSharing/SharingUtils_android.h
similarity index 100%
rename from src/thirdparty/MobileSharing/SharingUtils_android.h
rename to thirdparty/MobileSharing/SharingUtils_android.h
diff --git a/src/thirdparty/MobileSharing/SharingUtils_android_qt5.cpp b/thirdparty/MobileSharing/SharingUtils_android_qt5.cpp
similarity index 100%
rename from src/thirdparty/MobileSharing/SharingUtils_android_qt5.cpp
rename to thirdparty/MobileSharing/SharingUtils_android_qt5.cpp
diff --git a/src/thirdparty/MobileSharing/SharingUtils_android_qt6.cpp b/thirdparty/MobileSharing/SharingUtils_android_qt6.cpp
similarity index 100%
rename from src/thirdparty/MobileSharing/SharingUtils_android_qt6.cpp
rename to thirdparty/MobileSharing/SharingUtils_android_qt6.cpp
diff --git a/src/thirdparty/MobileSharing/SharingUtils_ios.h b/thirdparty/MobileSharing/SharingUtils_ios.h
similarity index 100%
rename from src/thirdparty/MobileSharing/SharingUtils_ios.h
rename to thirdparty/MobileSharing/SharingUtils_ios.h
diff --git a/src/thirdparty/MobileSharing/SharingUtils_ios.mm b/thirdparty/MobileSharing/SharingUtils_ios.mm
similarity index 100%
rename from src/thirdparty/MobileSharing/SharingUtils_ios.mm
rename to thirdparty/MobileSharing/SharingUtils_ios.mm
diff --git a/src/thirdparty/MobileSharing/docviewcontroller_ios.h b/thirdparty/MobileSharing/docviewcontroller_ios.h
similarity index 100%
rename from src/thirdparty/MobileSharing/docviewcontroller_ios.h
rename to thirdparty/MobileSharing/docviewcontroller_ios.h
diff --git a/src/thirdparty/MobileSharing/docviewcontroller_ios.mm b/thirdparty/MobileSharing/docviewcontroller_ios.mm
similarity index 100%
rename from src/thirdparty/MobileSharing/docviewcontroller_ios.mm
rename to thirdparty/MobileSharing/docviewcontroller_ios.mm
diff --git a/src/thirdparty/MobileUI/CMakeLists.txt b/thirdparty/MobileUI/CMakeLists.txt
similarity index 58%
rename from src/thirdparty/MobileUI/CMakeLists.txt
rename to thirdparty/MobileUI/CMakeLists.txt
index add431873..ee8d0ec1a 100644
--- a/src/thirdparty/MobileUI/CMakeLists.txt
+++ b/thirdparty/MobileUI/CMakeLists.txt
@@ -1,19 +1,13 @@
-cmake_minimum_required(VERSION 3.12)
-
project(MobileUI LANGUAGES CXX)
-set(CMAKE_CXX_STANDARD 14)
+set(CMAKE_CXX_STANDARD 17)
set(CMAKE_AUTOMOC ON)
################################################################################
-if(NOT QT_DEFAULT_MAJOR_VERSION)
- set(QT_DEFAULT_MAJOR_VERSION 6 CACHE STRING "Qt version to use (5 or 6), defaults to 6")
-endif()
-
# Generic dependencies
set(CORE_COMPONENTS Core Gui Qml)
-find_package(Qt${QT_DEFAULT_MAJOR_VERSION} REQUIRED COMPONENTS ${CORE_COMPONENTS})
+find_package(Qt6 6.7 REQUIRED COMPONENTS ${CORE_COMPONENTS})
set(CORE_LIBRARIES Qt::Core Qt::Gui Qt::Qml)
@@ -24,13 +18,7 @@ set(CORE_SOURCES
# OS specific sources & dependencies
if(ANDROID)
- if(QT_DEFAULT_MAJOR_VERSION EQUAL 6)
- set(PLATFORM_SOURCES MobileUI_android_qt6.cpp)
- elseif(QT_DEFAULT_MAJOR_VERSION EQUAL 5)
- find_package(Qt${QT_DEFAULT_MAJOR_VERSION} REQUIRED COMPONENTS AndroidExtras)
- set(PLATFORM_LIBRARIES Qt::AndroidExtras)
- set(PLATFORM_SOURCES MobileUI_android_qt5.cpp)
- endif()
+ set(PLATFORM_SOURCES MobileUI_android.cpp)
elseif(IOS)
set(PLATFORM_SOURCES MobileUI_ios.mm)
set(PLATFORM_LIBRARIES "-framework UIKit")
diff --git a/src/thirdparty/MobileUI/LICENSE b/thirdparty/MobileUI/LICENSE
similarity index 100%
rename from src/thirdparty/MobileUI/LICENSE
rename to thirdparty/MobileUI/LICENSE
diff --git a/src/thirdparty/MobileUI/MobileUI b/thirdparty/MobileUI/MobileUI
similarity index 100%
rename from src/thirdparty/MobileUI/MobileUI
rename to thirdparty/MobileUI/MobileUI
diff --git a/src/thirdparty/MobileUI/MobileUI.cpp b/thirdparty/MobileUI/MobileUI.cpp
similarity index 100%
rename from src/thirdparty/MobileUI/MobileUI.cpp
rename to thirdparty/MobileUI/MobileUI.cpp
diff --git a/src/thirdparty/MobileUI/MobileUI.h b/thirdparty/MobileUI/MobileUI.h
similarity index 100%
rename from src/thirdparty/MobileUI/MobileUI.h
rename to thirdparty/MobileUI/MobileUI.h
diff --git a/src/thirdparty/MobileUI/MobileUI.pri b/thirdparty/MobileUI/MobileUI.pri
similarity index 100%
rename from src/thirdparty/MobileUI/MobileUI.pri
rename to thirdparty/MobileUI/MobileUI.pri
diff --git a/src/thirdparty/MobileUI/MobileUI_android_qt6.cpp b/thirdparty/MobileUI/MobileUI_android.cpp
similarity index 70%
rename from src/thirdparty/MobileUI/MobileUI_android_qt6.cpp
rename to thirdparty/MobileUI/MobileUI_android.cpp
index 650d6bede..fa1e6d0f5 100644
--- a/src/thirdparty/MobileUI/MobileUI_android_qt6.cpp
+++ b/thirdparty/MobileUI/MobileUI_android.cpp
@@ -83,18 +83,12 @@ static bool isQColorLight(const QColor color)
static QJniObject getAndroidWindow()
{
QJniObject activity = QNativeInterface::QAndroidApplication::context();
- QJniObject window = activity.callObjectMethod("getWindow", "()Landroid/view/Window;");
-
- return window;
+ return activity.callObjectMethod("getWindow", "()Landroid/view/Window;");
}
static QJniObject getAndroidDecorView()
{
- QJniObject activity = QNativeInterface::QAndroidApplication::context();
- QJniObject window = activity.callObjectMethod("getWindow", "()Landroid/view/Window;");
- QJniObject view = window.callObjectMethod("getDecorView", "()Landroid/view/View;");
-
- return view;
+ return getAndroidWindow().callObjectMethod("getDecorView", "()Landroid/view/View;");
}
static QJniObject getDisplayCutout()
@@ -102,11 +96,10 @@ static QJniObject getDisplayCutout()
if (QNativeInterface::QAndroidApplication::sdkVersion() >= 28)
{
// DisplayCutout has been added in API level 28
- QJniObject activity = QNativeInterface::QAndroidApplication::context();
- QJniObject window = activity.callObjectMethod("getWindow", "()Landroid/view/Window;");
- QJniObject decorview = window.callObjectMethod("getDecorView", "()Landroid/view/View;");
- QJniObject insets = decorview.callObjectMethod("getRootWindowInsets", "()Landroid/view/WindowInsets;");
- QJniObject cutout = insets.callObjectMethod("getDisplayCutout", "()Landroid/view/DisplayCutout;");
+ QJniObject insets = getAndroidDecorView().callObjectMethod("getRootWindowInsets",
+ "()Landroid/view/WindowInsets;");
+ QJniObject cutout = insets.callObjectMethod("getDisplayCutout",
+ "()Landroid/view/DisplayCutout;");
return cutout;
}
@@ -118,13 +111,18 @@ static QJniObject getDisplayCutout()
int MobileUIPrivate::getDeviceTheme()
{
- QJniObject activity = QNativeInterface::QAndroidApplication::context();
- QJniObject resources = activity.callObjectMethod("getResources", "()Landroid/content/res/Resources;");
- QJniObject conf = resources.callObjectMethod("getConfiguration", "()Landroid/content/res/Configuration;");
-
- int uiMode = (conf.getField("uiMode") & UI_MODE_NIGHT_MASK);
-
- return (uiMode == UI_MODE_NIGHT_YES) ? MobileUI::Theme::Dark : MobileUI::Theme::Light;
+ return QNativeInterface::QAndroidApplication::runOnAndroidMainThread([] {
+ QJniObject activity = QNativeInterface::QAndroidApplication::context();
+ QJniObject resources = activity.callObjectMethod("getResources", "()Landroid/content/res/Resources;");
+ QJniObject conf = resources.callObjectMethod("getConfiguration", "()Landroid/content/res/Configuration;");
+
+ int uiMode = (conf.getField("uiMode") & UI_MODE_NIGHT_MASK);
+
+ return (uiMode == UI_MODE_NIGHT_YES) ? MobileUI::Theme::Dark
+ : MobileUI::Theme::Light;
+ })
+ .result()
+ .toInt();
}
void MobileUIPrivate::refreshUI_async()
@@ -303,92 +301,120 @@ void MobileUIPrivate::setTheme_navbar(const MobileUI::Theme theme)
int MobileUIPrivate::getStatusbarHeight()
{
- QJniObject activity = QNativeInterface::QAndroidApplication::context();
- QJniObject resources = activity.callObjectMethod("getResources", "()Landroid/content/res/Resources;");
-
- QJniObject name = QJniObject::fromString("status_bar_height");
- QJniObject defType = QJniObject::fromString("dimen");
- QJniObject defPackage = QJniObject::fromString("android");
-
- int identifier = resources.callMethod("getIdentifier",
- "(Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;)I",
- name.object(),
- defType.object(),
- defPackage.object());
-
- if (identifier > 0)
- {
- return resources.callMethod("getDimensionPixelSize", "(I)I", identifier) / qApp->devicePixelRatio();
- }
-
- return 24; // default
+ return QNativeInterface::QAndroidApplication::runOnAndroidMainThread([]() -> int {
+ QJniObject activity = QNativeInterface::QAndroidApplication::context();
+ QJniObject resources
+ = activity.callObjectMethod("getResources", "()Landroid/content/res/Resources;");
+
+ QJniObject name = QJniObject::fromString("status_bar_height");
+ QJniObject defType = QJniObject::fromString("dimen");
+ QJniObject defPackage = QJniObject::fromString("android");
+
+ int identifier = resources.callMethod(
+ "getIdentifier",
+ "(Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;)I",
+ name.object(),
+ defType.object(),
+ defPackage.object());
+
+ if (identifier > 0) {
+ return resources.callMethod("getDimensionPixelSize", "(I)I", identifier)
+ / qApp->devicePixelRatio();
+ }
+
+ return 24; // default
+ })
+ .result()
+ .toInt();
}
int MobileUIPrivate::getNavbarHeight()
{
- QJniObject activity = QNativeInterface::QAndroidApplication::context();
- QJniObject resources = activity.callObjectMethod("getResources", "()Landroid/content/res/Resources;");
-
- QJniObject name = QJniObject::fromString("navigation_bar_height");
- QJniObject defType = QJniObject::fromString("dimen");
- QJniObject defPackage = QJniObject::fromString("android");
-
- int identifier = resources.callMethod("getIdentifier",
- "(Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;)I",
- name.object(),
- defType.object(),
- defPackage.object());
-
- if (identifier > 0)
- {
- return resources.callMethod("getDimensionPixelSize", "(I)I", identifier) / qApp->devicePixelRatio();
- }
-
- return 48; // default
+ return QNativeInterface::QAndroidApplication::runOnAndroidMainThread([]() -> int {
+ QJniObject activity = QNativeInterface::QAndroidApplication::context();
+ QJniObject resources
+ = activity.callObjectMethod("getResources", "()Landroid/content/res/Resources;");
+
+ QJniObject name = QJniObject::fromString("navigation_bar_height");
+ QJniObject defType = QJniObject::fromString("dimen");
+ QJniObject defPackage = QJniObject::fromString("android");
+
+ int identifier = resources.callMethod(
+ "getIdentifier",
+ "(Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;)I",
+ name.object(),
+ defType.object(),
+ defPackage.object());
+
+ if (identifier > 0) {
+ return resources.callMethod("getDimensionPixelSize", "(I)I", identifier)
+ / qApp->devicePixelRatio();
+ }
+
+ return 48; // default
+ })
+ .result()
+ .toInt();
}
int MobileUIPrivate::getSafeAreaTop()
{
- QJniObject cutout = getDisplayCutout();
- if (cutout.isValid())
- {
- return cutout.callMethod("getSafeInsetTop", "()I") / qApp->devicePixelRatio();
- }
-
- return 0;
+ return QNativeInterface::QAndroidApplication::runOnAndroidMainThread([]() -> int {
+ QJniObject cutout = getDisplayCutout();
+ if (cutout.isValid()) {
+ return cutout.callMethod("getSafeInsetTop", "()I")
+ / qApp->devicePixelRatio();
+ }
+
+ return 0;
+ })
+ .result()
+ .toInt();
}
int MobileUIPrivate::getSafeAreaLeft()
{
- QJniObject cutout = getDisplayCutout();
- if (cutout.isValid())
- {
- return cutout.callMethod("getSafeInsetLeft", "()I") / qApp->devicePixelRatio();
- }
-
- return 0;
+ return QNativeInterface::QAndroidApplication::runOnAndroidMainThread([]() -> int {
+ QJniObject cutout = getDisplayCutout();
+ if (cutout.isValid()) {
+ return cutout.callMethod("getSafeInsetLeft", "()I")
+ / qApp->devicePixelRatio();
+ }
+
+ return 0;
+ })
+ .result()
+ .toInt();
}
int MobileUIPrivate::getSafeAreaRight()
{
- QJniObject cutout = getDisplayCutout();
- if (cutout.isValid())
- {
- return cutout.callMethod("getSafeInsetRight", "()I") / qApp->devicePixelRatio();
- }
-
- return 0;
+ return QNativeInterface::QAndroidApplication::runOnAndroidMainThread([]() -> int {
+ QJniObject cutout = getDisplayCutout();
+ if (cutout.isValid()) {
+ return cutout.callMethod("getSafeInsetRight", "()I")
+ / qApp->devicePixelRatio();
+ }
+
+ return 0;
+ })
+ .result()
+ .toInt();
}
int MobileUIPrivate::getSafeAreaBottom()
{
- QJniObject cutout = getDisplayCutout();
- if (cutout.isValid())
- {
- return cutout.callMethod("getSafeInsetBottom", "()I") / qApp->devicePixelRatio();
- }
-
- return 0;
+ return QNativeInterface::QAndroidApplication::runOnAndroidMainThread([]() -> int {
+ QJniObject cutout = getDisplayCutout();
+ if (cutout.isValid()) {
+ return cutout.callMethod("getSafeInsetBottom", "()I")
+ / qApp->devicePixelRatio();
+ }
+
+ return 0;
+ })
+ .result()
+ .toInt();
}
/* ************************************************************************** */
@@ -427,23 +453,35 @@ void MobileUIPrivate::setScreenOrientation(const MobileUI::ScreenOrientation ori
int MobileUIPrivate::getScreenBrightness()
{
- QJniObject activity = QNativeInterface::QAndroidApplication::context();
- QJniObject window = activity.callObjectMethod("getWindow", "()Landroid/view/Window;");
-
- // If we have set a brightness value for the current application
- QJniObject layoutParams = window.callObjectMethod("getAttributes", "()Landroid/view/WindowManager$LayoutParams;");
- float brightnessApp = layoutParams.getField("screenBrightness");
- if (brightnessApp >= 0.f) return static_cast(brightnessApp * 100.f);
-
- // Otherwise, we try to read the system wide brightness value
- QJniObject contentResolver = activity.callObjectMethod("getContentResolver", "()Landroid/content/ContentResolver;");
- QJniObject SCREEN_BRIGHTNESS = QJniObject::getStaticObjectField("android/provider/Settings$System",
- "SCREEN_BRIGHTNESS", "Ljava/lang/String;");
- jint brightnessOS = QJniObject::callStaticMethod("android/provider/Settings$System",
- "getInt", "(Landroid/content/ContentResolver;Ljava/lang/String;)I",
- contentResolver.object(), SCREEN_BRIGHTNESS.object());
-
- return static_cast((brightnessOS / 255.f) * 100.f); // SCREEN_BRIGHTNESS is 0 to ???
+ return QNativeInterface::QAndroidApplication::runOnAndroidMainThread([] {
+ // If we have set a brightness value for the current application
+ QJniObject layoutParams = getAndroidWindow().callObjectMethod(
+ "getAttributes", "()Landroid/view/WindowManager$LayoutParams;");
+ float brightnessApp = layoutParams.getField("screenBrightness");
+ if (brightnessApp >= 0.f)
+ return static_cast(brightnessApp * 100.f);
+
+ // Otherwise, we try to read the system wide brightness value
+ QJniObject activity = QNativeInterface::QAndroidApplication::context();
+ QJniObject contentResolver
+ = activity.callObjectMethod("getContentResolver",
+ "()Landroid/content/ContentResolver;");
+ QJniObject SCREEN_BRIGHTNESS
+ = QJniObject::getStaticObjectField("android/provider/Settings$System",
+ "SCREEN_BRIGHTNESS",
+ "Ljava/lang/String;");
+ jint brightnessOS = QJniObject::callStaticMethod(
+ "android/provider/Settings$System",
+ "getInt",
+ "(Landroid/content/ContentResolver;Ljava/lang/String;)I",
+ contentResolver.object(),
+ SCREEN_BRIGHTNESS.object());
+
+ return static_cast((brightnessOS / 255.f)
+ * 100.f); // SCREEN_BRIGHTNESS is 0 to ???
+ })
+ .result()
+ .toInt();
}
void MobileUIPrivate::setScreenBrightness(const int value)
@@ -507,12 +545,14 @@ void MobileUIPrivate::vibrate()
void MobileUIPrivate::backToHomeScreen()
{
- QJniObject activity = QNativeInterface::QAndroidApplication::context();
- if (activity.isValid())
- {
- // Sends the application to the background
- activity.callMethod("moveTaskToBack", "(Z)Z", true);
- }
+ QNativeInterface::QAndroidApplication::runOnAndroidMainThread([=]() {
+ QJniObject activity = QNativeInterface::QAndroidApplication::context();
+ if (activity.isValid())
+ {
+ // Sends the application to the background
+ activity.callMethod("moveTaskToBack", "(Z)Z", true);
+ }
+ });
}
/* ************************************************************************** */
diff --git a/src/thirdparty/MobileUI/MobileUI_dummy.cpp b/thirdparty/MobileUI/MobileUI_dummy.cpp
similarity index 100%
rename from src/thirdparty/MobileUI/MobileUI_dummy.cpp
rename to thirdparty/MobileUI/MobileUI_dummy.cpp
diff --git a/src/thirdparty/MobileUI/MobileUI_ios.mm b/thirdparty/MobileUI/MobileUI_ios.mm
similarity index 100%
rename from src/thirdparty/MobileUI/MobileUI_ios.mm
rename to thirdparty/MobileUI/MobileUI_ios.mm
diff --git a/src/thirdparty/MobileUI/MobileUI_private.h b/thirdparty/MobileUI/MobileUI_private.h
similarity index 100%
rename from src/thirdparty/MobileUI/MobileUI_private.h
rename to thirdparty/MobileUI/MobileUI_private.h
diff --git a/src/thirdparty/MobileUI/README.md b/thirdparty/MobileUI/README.md
similarity index 97%
rename from src/thirdparty/MobileUI/README.md
rename to thirdparty/MobileUI/README.md
index cfb5db07f..7ae19d73c 100644
--- a/src/thirdparty/MobileUI/README.md
+++ b/thirdparty/MobileUI/README.md
@@ -4,7 +4,7 @@ MobileUI allows QML applications to interact with Mobile specific features, like
You can see it in action in the [MobileUI demo](https://github.com/emericg/MobileUI_demo).
-> Supports Qt6 and Qt5. QMake and CMake.
+> Supports Qt6 with CMake.
> Supports iOS 11+ (tested up to iOS 17.5 devices).
@@ -30,13 +30,9 @@ You can see it in action in the [MobileUI demo](https://github.com/emericg/Mobil
### Build
-To get started, simply checkout the MobileUI repository as a submodule, or copy the
-MobileUI directory into your project, then include the library files with either
-the `MobileUI.pro` QMake project file or the `CMakeLists.txt` CMake project file.
-
-```qmake
-include(MobileUI/MobileUI.pri)
-```
+To get started, simply checkout the MobileUI repository as a submodule, or copy
+the MobileUI directory into your project, then include the library files using
+the `CMakeLists.txt` CMake project file.
```cmake
add_subdirectory(MobileUI/)
diff --git a/src/thirdparty/RC4/rc4.cpp b/thirdparty/RC4/rc4.cpp
similarity index 100%
rename from src/thirdparty/RC4/rc4.cpp
rename to thirdparty/RC4/rc4.cpp
diff --git a/src/thirdparty/RC4/rc4.h b/thirdparty/RC4/rc4.h
similarity index 100%
rename from src/thirdparty/RC4/rc4.h
rename to thirdparty/RC4/rc4.h
diff --git a/src/thirdparty/SingleApplication/CMakeLists.txt b/thirdparty/SingleApplication/CMakeLists.txt
similarity index 100%
rename from src/thirdparty/SingleApplication/CMakeLists.txt
rename to thirdparty/SingleApplication/CMakeLists.txt
diff --git a/src/thirdparty/SingleApplication/LICENSE b/thirdparty/SingleApplication/LICENSE
similarity index 100%
rename from src/thirdparty/SingleApplication/LICENSE
rename to thirdparty/SingleApplication/LICENSE
diff --git a/src/thirdparty/SingleApplication/README.md b/thirdparty/SingleApplication/README.md
similarity index 100%
rename from src/thirdparty/SingleApplication/README.md
rename to thirdparty/SingleApplication/README.md
diff --git a/src/thirdparty/SingleApplication/SingleApplication b/thirdparty/SingleApplication/SingleApplication
similarity index 100%
rename from src/thirdparty/SingleApplication/SingleApplication
rename to thirdparty/SingleApplication/SingleApplication
diff --git a/src/thirdparty/SingleApplication/SingleApplication.cpp b/thirdparty/SingleApplication/SingleApplication.cpp
similarity index 100%
rename from src/thirdparty/SingleApplication/SingleApplication.cpp
rename to thirdparty/SingleApplication/SingleApplication.cpp
diff --git a/src/thirdparty/SingleApplication/SingleApplication.h b/thirdparty/SingleApplication/SingleApplication.h
similarity index 100%
rename from src/thirdparty/SingleApplication/SingleApplication.h
rename to thirdparty/SingleApplication/SingleApplication.h
diff --git a/src/thirdparty/SingleApplication/SingleApplication.pri b/thirdparty/SingleApplication/SingleApplication.pri
similarity index 100%
rename from src/thirdparty/SingleApplication/SingleApplication.pri
rename to thirdparty/SingleApplication/SingleApplication.pri
diff --git a/src/thirdparty/SingleApplication/SingleApplication_private.cpp b/thirdparty/SingleApplication/SingleApplication_private.cpp
similarity index 100%
rename from src/thirdparty/SingleApplication/SingleApplication_private.cpp
rename to thirdparty/SingleApplication/SingleApplication_private.cpp
diff --git a/src/thirdparty/SingleApplication/SingleApplication_private.h b/thirdparty/SingleApplication/SingleApplication_private.h
similarity index 100%
rename from src/thirdparty/SingleApplication/SingleApplication_private.h
rename to thirdparty/SingleApplication/SingleApplication_private.h
diff --git a/src/thirdparty/SunAndMoon/CMakeLists.txt b/thirdparty/SunAndMoon/CMakeLists.txt
similarity index 100%
rename from src/thirdparty/SunAndMoon/CMakeLists.txt
rename to thirdparty/SunAndMoon/CMakeLists.txt
diff --git a/src/thirdparty/SunAndMoon/LICENSE b/thirdparty/SunAndMoon/LICENSE
similarity index 100%
rename from src/thirdparty/SunAndMoon/LICENSE
rename to thirdparty/SunAndMoon/LICENSE
diff --git a/src/thirdparty/SunAndMoon/MoonPhase/LICENSE b/thirdparty/SunAndMoon/MoonPhase/LICENSE
similarity index 100%
rename from src/thirdparty/SunAndMoon/MoonPhase/LICENSE
rename to thirdparty/SunAndMoon/MoonPhase/LICENSE
diff --git a/src/thirdparty/SunAndMoon/MoonPhase/MoonPhase.cpp b/thirdparty/SunAndMoon/MoonPhase/MoonPhase.cpp
similarity index 100%
rename from src/thirdparty/SunAndMoon/MoonPhase/MoonPhase.cpp
rename to thirdparty/SunAndMoon/MoonPhase/MoonPhase.cpp
diff --git a/src/thirdparty/SunAndMoon/MoonPhase/MoonPhase.h b/thirdparty/SunAndMoon/MoonPhase/MoonPhase.h
similarity index 100%
rename from src/thirdparty/SunAndMoon/MoonPhase/MoonPhase.h
rename to thirdparty/SunAndMoon/MoonPhase/MoonPhase.h
diff --git a/src/thirdparty/SunAndMoon/MoonPhase/README.md b/thirdparty/SunAndMoon/MoonPhase/README.md
similarity index 100%
rename from src/thirdparty/SunAndMoon/MoonPhase/README.md
rename to thirdparty/SunAndMoon/MoonPhase/README.md
diff --git a/src/thirdparty/SunAndMoon/MoonRise/LICENSE b/thirdparty/SunAndMoon/MoonRise/LICENSE
similarity index 100%
rename from src/thirdparty/SunAndMoon/MoonRise/LICENSE
rename to thirdparty/SunAndMoon/MoonRise/LICENSE
diff --git a/src/thirdparty/SunAndMoon/MoonRise/MoonRise.cpp b/thirdparty/SunAndMoon/MoonRise/MoonRise.cpp
similarity index 100%
rename from src/thirdparty/SunAndMoon/MoonRise/MoonRise.cpp
rename to thirdparty/SunAndMoon/MoonRise/MoonRise.cpp
diff --git a/src/thirdparty/SunAndMoon/MoonRise/MoonRise.h b/thirdparty/SunAndMoon/MoonRise/MoonRise.h
similarity index 100%
rename from src/thirdparty/SunAndMoon/MoonRise/MoonRise.h
rename to thirdparty/SunAndMoon/MoonRise/MoonRise.h
diff --git a/src/thirdparty/SunAndMoon/MoonRise/README.md b/thirdparty/SunAndMoon/MoonRise/README.md
similarity index 100%
rename from src/thirdparty/SunAndMoon/MoonRise/README.md
rename to thirdparty/SunAndMoon/MoonRise/README.md
diff --git a/src/thirdparty/SunAndMoon/README.md b/thirdparty/SunAndMoon/README.md
similarity index 100%
rename from src/thirdparty/SunAndMoon/README.md
rename to thirdparty/SunAndMoon/README.md
diff --git a/src/thirdparty/SunAndMoon/SunAndMoon b/thirdparty/SunAndMoon/SunAndMoon
similarity index 100%
rename from src/thirdparty/SunAndMoon/SunAndMoon
rename to thirdparty/SunAndMoon/SunAndMoon
diff --git a/src/thirdparty/SunAndMoon/SunAndMoon.cpp b/thirdparty/SunAndMoon/SunAndMoon.cpp
similarity index 100%
rename from src/thirdparty/SunAndMoon/SunAndMoon.cpp
rename to thirdparty/SunAndMoon/SunAndMoon.cpp
diff --git a/src/thirdparty/SunAndMoon/SunAndMoon.h b/thirdparty/SunAndMoon/SunAndMoon.h
similarity index 100%
rename from src/thirdparty/SunAndMoon/SunAndMoon.h
rename to thirdparty/SunAndMoon/SunAndMoon.h
diff --git a/src/thirdparty/SunAndMoon/SunAndMoon.pri b/thirdparty/SunAndMoon/SunAndMoon.pri
similarity index 100%
rename from src/thirdparty/SunAndMoon/SunAndMoon.pri
rename to thirdparty/SunAndMoon/SunAndMoon.pri
diff --git a/src/thirdparty/SunAndMoon/SunRise/LICENSE b/thirdparty/SunAndMoon/SunRise/LICENSE
similarity index 100%
rename from src/thirdparty/SunAndMoon/SunRise/LICENSE
rename to thirdparty/SunAndMoon/SunRise/LICENSE
diff --git a/src/thirdparty/SunAndMoon/SunRise/README.md b/thirdparty/SunAndMoon/SunRise/README.md
similarity index 100%
rename from src/thirdparty/SunAndMoon/SunRise/README.md
rename to thirdparty/SunAndMoon/SunRise/README.md
diff --git a/src/thirdparty/SunAndMoon/SunRise/SunRise.cpp b/thirdparty/SunAndMoon/SunRise/SunRise.cpp
similarity index 100%
rename from src/thirdparty/SunAndMoon/SunRise/SunRise.cpp
rename to thirdparty/SunAndMoon/SunRise/SunRise.cpp
diff --git a/src/thirdparty/SunAndMoon/SunRise/SunRise.h b/thirdparty/SunAndMoon/SunRise/SunRise.h
similarity index 100%
rename from src/thirdparty/SunAndMoon/SunRise/SunRise.h
rename to thirdparty/SunAndMoon/SunRise/SunRise.h