mirror of
https://github.com/swift-project/pilotclient.git
synced 2026-03-22 14:55:36 +08:00
refactor: Port to Qt 6
This commit is contained in:
9
.github/workflows/build.yml
vendored
9
.github/workflows/build.yml
vendored
@@ -17,7 +17,7 @@ concurrency:
|
||||
env:
|
||||
do_vatsim_key: ${{ github.event_name == 'push' }}
|
||||
do_symbols: ${{ github.event_name == 'push' && github.ref == 'refs/heads/main' }}
|
||||
qt_version: 5.15.2
|
||||
qt_version: 6.8.0
|
||||
bitrock_version: qt-professional-24.7.0
|
||||
bitrock_url: https://releases.installbuilder.com/installbuilder
|
||||
externals: swift-project/externals
|
||||
@@ -94,6 +94,7 @@ jobs:
|
||||
uses: jurplel/install-qt-action@v4
|
||||
with:
|
||||
version: ${{ env.qt_version }}
|
||||
modules: 'qtmultimedia qt5compat'
|
||||
cache: true
|
||||
- name: Cache InstallBuilder
|
||||
id: cache-bitrock
|
||||
@@ -186,13 +187,14 @@ jobs:
|
||||
uses: jurplel/install-qt-action@v4
|
||||
with:
|
||||
version: ${{ env.qt_version }}
|
||||
arch: win64_msvc2019_64
|
||||
modules: 'qtmultimedia qt5compat'
|
||||
arch: win64_msvc2022_64
|
||||
cache: true
|
||||
- name: Install Qt debug info
|
||||
uses: jurplel/install-qt-action@v4
|
||||
with:
|
||||
version: ${{ env.qt_version }}
|
||||
arch: win64_msvc2019_64
|
||||
arch: win64_msvc2022_64
|
||||
cache: true
|
||||
modules: debug_info
|
||||
extra: --archives qtbase
|
||||
@@ -283,6 +285,7 @@ jobs:
|
||||
uses: jurplel/install-qt-action@v4
|
||||
with:
|
||||
version: ${{ env.qt_version }}
|
||||
modules: 'qtmultimedia qt5compat'
|
||||
cache: true
|
||||
- name: Cache InstallBuilder
|
||||
id: cache-bitrock
|
||||
|
||||
@@ -91,7 +91,7 @@ if(MSVC)
|
||||
endif()
|
||||
|
||||
# Find dependencies
|
||||
find_package(Qt5 REQUIRED COMPONENTS Core DBus Gui Multimedia Network OpenGL Concurrent Xml Qml Widgets Svg Test)
|
||||
find_package(Qt6 REQUIRED COMPONENTS Core DBus Gui Multimedia Network OpenGL Concurrent Xml Qml Widgets Svg Test Core5Compat)
|
||||
|
||||
# Global compiler options
|
||||
if(MSVC)
|
||||
@@ -147,7 +147,6 @@ add_subdirectory(cmake/msgpack)
|
||||
add_subdirectory(cmake/rapidjson)
|
||||
add_subdirectory(cmake/opus)
|
||||
add_subdirectory(cmake/crashpad)
|
||||
add_subdirectory(cmake/tls)
|
||||
add_subdirectory(cmake/simconnect)
|
||||
add_subdirectory(cmake/dplay)
|
||||
add_subdirectory(third_party)
|
||||
|
||||
@@ -37,8 +37,8 @@ endif()
|
||||
|
||||
# Workaround to get Qt paths for deployment (until switching to Qt6 deployment tool)
|
||||
if(UNIX AND NOT APPLE)
|
||||
execute_process(COMMAND qmake -query QT_INSTALL_LIBS OUTPUT_VARIABLE QT_INSTALL_LIBS)
|
||||
execute_process(COMMAND qmake -query QT_INSTALL_PLUGINS OUTPUT_VARIABLE QT_INSTALL_PLUGINS)
|
||||
execute_process(COMMAND qmake6 -query QT_INSTALL_LIBS OUTPUT_VARIABLE QT_INSTALL_LIBS)
|
||||
execute_process(COMMAND qmake6 -query QT_INSTALL_PLUGINS OUTPUT_VARIABLE QT_INSTALL_PLUGINS)
|
||||
|
||||
# Avoid line breaks
|
||||
string(STRIP ${QT_INSTALL_LIBS} QT_INSTALL_LIBS)
|
||||
@@ -51,19 +51,19 @@ if(UNIX AND NOT APPLE)
|
||||
endfunction()
|
||||
|
||||
|
||||
installLib(${QT_INSTALL_LIBS} libQt5Core.so.5)
|
||||
installLib(${QT_INSTALL_LIBS} libQt5DBus.so.5)
|
||||
installLib(${QT_INSTALL_LIBS} libQt5Gui.so.5)
|
||||
installLib(${QT_INSTALL_LIBS} libQt5Multimedia.so.5)
|
||||
installLib(${QT_INSTALL_LIBS} libQt5MultimediaWidgets.so.5)
|
||||
installLib(${QT_INSTALL_LIBS} libQt5Network.so.5)
|
||||
installLib(${QT_INSTALL_LIBS} libQt5OpenGL.so.5)
|
||||
installLib(${QT_INSTALL_LIBS} libQt5Qml.so.5)
|
||||
installLib(${QT_INSTALL_LIBS} libQt5Svg.so.5)
|
||||
installLib(${QT_INSTALL_LIBS} libQt5Widgets.so.5)
|
||||
installLib(${QT_INSTALL_LIBS} libQt5XcbQpa.so.5)
|
||||
installLib(${QT_INSTALL_LIBS} libQt5Xml.so.5)
|
||||
installLib(${QT_INSTALL_LIBS} libQt5MultimediaGstTools.so.5)
|
||||
installLib(${QT_INSTALL_LIBS} libQt6Core.so.6)
|
||||
installLib(${QT_INSTALL_LIBS} libQt6Core5Compat.so.6)
|
||||
installLib(${QT_INSTALL_LIBS} libQt6DBus.so.6)
|
||||
installLib(${QT_INSTALL_LIBS} libQt6Gui.so.6)
|
||||
installLib(${QT_INSTALL_LIBS} libQt6Multimedia.so.6)
|
||||
installLib(${QT_INSTALL_LIBS} libQt6MultimediaWidgets.so.6)
|
||||
installLib(${QT_INSTALL_LIBS} libQt6Network.so.6)
|
||||
installLib(${QT_INSTALL_LIBS} libQt6OpenGL.so.6)
|
||||
installLib(${QT_INSTALL_LIBS} libQt6Qml.so.6)
|
||||
installLib(${QT_INSTALL_LIBS} libQt6Svg.so.6)
|
||||
installLib(${QT_INSTALL_LIBS} libQt6Widgets.so.6)
|
||||
installLib(${QT_INSTALL_LIBS} libQt6XcbQpa.so.6)
|
||||
installLib(${QT_INSTALL_LIBS} libQt6Xml.so.6)
|
||||
|
||||
macro(resolve_symlink lib_name)
|
||||
# Adapted from CMake file() documentation
|
||||
@@ -76,12 +76,12 @@ if(UNIX AND NOT APPLE)
|
||||
endmacro()
|
||||
|
||||
|
||||
if(EXISTS ${QT_INSTALL_LIBS}/libicui18n.so.56 AND EXISTS ${QT_INSTALL_LIBS}/libicuuc.so.56 AND EXISTS ${QT_INSTALL_LIBS}/libicudata.so.56)
|
||||
if(EXISTS ${QT_INSTALL_LIBS}/libicui18n.so.73 AND EXISTS ${QT_INSTALL_LIBS}/libicuuc.so.73 AND EXISTS ${QT_INSTALL_LIBS}/libicudata.so.73)
|
||||
# Use specific requested version that is found in the Qt library dir (at least in the Github Actions environment)
|
||||
message(STATUS "Install specific libicu version from Qt dir")
|
||||
installLib(${QT_INSTALL_LIBS} libicui18n.so.56)
|
||||
installLib(${QT_INSTALL_LIBS} libicuuc.so.56)
|
||||
installLib(${QT_INSTALL_LIBS} libicudata.so.56)
|
||||
installLib(${QT_INSTALL_LIBS} libicui18n.so.73)
|
||||
installLib(${QT_INSTALL_LIBS} libicuuc.so.73)
|
||||
installLib(${QT_INSTALL_LIBS} libicudata.so.73)
|
||||
else()
|
||||
message(STATUS "Using systems libicu library")
|
||||
# This might not work for creating the installer as the version can differ
|
||||
@@ -92,21 +92,12 @@ if(UNIX AND NOT APPLE)
|
||||
install(FILES ${ICU_I18N_ABS} ${ICU_UC_ABS} ${ICU_DATA_ABS} TYPE LIB)
|
||||
endif()
|
||||
|
||||
file(GLOB audioPlugins ${QT_INSTALL_PLUGINS}/audio/*.so)
|
||||
install(FILES ${audioPlugins} DESTINATION ${CMAKE_INSTALL_PREFIX}/bin/audio)
|
||||
|
||||
file(GLOB bearerPlugins ${QT_INSTALL_PLUGINS}/bearer/*.so)
|
||||
install(FILES ${bearerPlugins} DESTINATION ${CMAKE_INSTALL_PREFIX}/bin/bearer)
|
||||
|
||||
file(GLOB iconEnginePlugins ${QT_INSTALL_PLUGINS}/iconengines/*.so)
|
||||
install(FILES ${iconEnginePlugins} DESTINATION ${CMAKE_INSTALL_PREFIX}/bin/iconengines)
|
||||
|
||||
file(GLOB imageformatsPlugins ${QT_INSTALL_PLUGINS}/imageformats/*.so)
|
||||
install(FILES ${imageformatsPlugins} DESTINATION ${CMAKE_INSTALL_PREFIX}/bin/imageformats)
|
||||
|
||||
file(GLOB mediaservicePlugins ${QT_INSTALL_PLUGINS}/mediaservice/*.so)
|
||||
install(FILES ${mediaservicePlugins} DESTINATION ${CMAKE_INSTALL_PREFIX}/bin/mediaservice)
|
||||
|
||||
install(FILES ${QT_INSTALL_PLUGINS}/platforms/libqxcb.so DESTINATION ${CMAKE_INSTALL_PREFIX}/bin/platforms)
|
||||
|
||||
file(GLOB platforminputcontextsPlugins ${QT_INSTALL_PLUGINS}/platforminputcontexts/*.so)
|
||||
@@ -115,6 +106,9 @@ if(UNIX AND NOT APPLE)
|
||||
file(GLOB platformthemesPlugins ${QT_INSTALL_PLUGINS}/platformthemes/*.so)
|
||||
install(FILES ${platformthemesPlugins} DESTINATION ${CMAKE_INSTALL_PREFIX}/bin/platformthemes)
|
||||
|
||||
file(GLOB tlsPlugins ${QT_INSTALL_PLUGINS}/tls/*.so)
|
||||
install(FILES ${tlsPlugins} DESTINATION ${CMAKE_INSTALL_PREFIX}/bin/tls)
|
||||
|
||||
file(GLOB xcbglintegrationsPlugins ${QT_INSTALL_PLUGINS}/xcbglintegrations/*.so)
|
||||
install(FILES ${xcbglintegrationsPlugins} DESTINATION ${CMAKE_INSTALL_PREFIX}/bin/xcbglintegrations)
|
||||
|
||||
@@ -124,15 +118,14 @@ elseif(APPLE)
|
||||
install(SCRIPT ${PROJECT_SOURCE_DIR}/cmake/qt_deploy_mac.cmake)
|
||||
|
||||
# Install plugins
|
||||
execute_process(COMMAND qmake -query QT_INSTALL_PLUGINS OUTPUT_VARIABLE QT_INSTALL_PLUGINS)
|
||||
execute_process(COMMAND qmake6 -query QT_INSTALL_PLUGINS OUTPUT_VARIABLE QT_INSTALL_PLUGINS)
|
||||
string(STRIP ${QT_INSTALL_PLUGINS} QT_INSTALL_PLUGINS)
|
||||
|
||||
install(DIRECTORY ${QT_INSTALL_PLUGINS}/audio DESTINATION bin FILES_MATCHING PATTERN "*.dylib")
|
||||
install(DIRECTORY ${QT_INSTALL_PLUGINS}/bearer DESTINATION bin FILES_MATCHING PATTERN "*.dylib")
|
||||
install(DIRECTORY ${QT_INSTALL_PLUGINS}/iconengines DESTINATION bin FILES_MATCHING PATTERN "*.dylib")
|
||||
install(DIRECTORY ${QT_INSTALL_PLUGINS}/imageformats DESTINATION bin FILES_MATCHING PATTERN "*.dylib")
|
||||
install(DIRECTORY ${QT_INSTALL_PLUGINS}/mediaservice DESTINATION bin FILES_MATCHING PATTERN "*.dylib")
|
||||
install(FILES ${QT_INSTALL_PLUGINS}/platforms/libqcocoa.dylib DESTINATION bin/platforms)
|
||||
install(DIRECTORY ${QT_INSTALL_PLUGINS}/platforminputcontexts DESTINATION bin FILES_MATCHING PATTERN "*.dylib")
|
||||
install(DIRECTORY ${QT_INSTALL_PLUGINS}/platformthemes DESTINATION bin FILES_MATCHING PATTERN "*.dylib")
|
||||
install(DIRECTORY ${QT_INSTALL_PLUGINS}/tls DESTINATION bin FILES_MATCHING PATTERN "*.dylib")
|
||||
|
||||
endif()
|
||||
|
||||
@@ -6,6 +6,7 @@
|
||||
# For example "core" uses the same PCH as "misc" but with additional headers included.
|
||||
|
||||
set(SWIFT_MISC_PCH
|
||||
<QAudioDevice>
|
||||
[["blackmisc/collection.h"]]
|
||||
[["blackmisc/containerbase.h"]]
|
||||
[["blackmisc/dbus.h"]]
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
# SPDX-FileCopyrightText: Copyright (C) swift Project Community / Contributors
|
||||
# SPDX-License-Identifier: GPL-3.0-or-later OR LicenseRef-swift-pilot-client-1
|
||||
|
||||
execute_process(COMMAND qmake -query QT_INSTALL_LIBS OUTPUT_VARIABLE QT_INSTALL_LIBS)
|
||||
execute_process(COMMAND qmake6 -query QT_INSTALL_LIBS OUTPUT_VARIABLE QT_INSTALL_LIBS)
|
||||
|
||||
string(STRIP ${QT_INSTALL_LIBS} QT_INSTALL_LIBS)
|
||||
|
||||
@@ -12,6 +12,7 @@ endfunction()
|
||||
|
||||
copy_framework(QtConcurrent)
|
||||
copy_framework(QtCore)
|
||||
copy_framework(QtCore5Compat)
|
||||
copy_framework(QtDBus)
|
||||
copy_framework(QtGui)
|
||||
copy_framework(QtMultimedia)
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
# SPDX-License-Identifier: GPL-3.0-or-later OR LicenseRef-swift-pilot-client-1
|
||||
|
||||
message(STATUS "Running windeployqt")
|
||||
execute_process(COMMAND qmake -query QT_INSTALL_BINS OUTPUT_VARIABLE QT_INSTALL_BINS)
|
||||
execute_process(COMMAND qmake6 -query QT_INSTALL_BINS OUTPUT_VARIABLE QT_INSTALL_BINS)
|
||||
|
||||
string(STRIP ${QT_INSTALL_BINS} QT_INSTALL_BINS)
|
||||
|
||||
@@ -19,11 +19,8 @@ execute_process(COMMAND ${QT_INSTALL_BINS}/windeployqt.exe
|
||||
--no-translations
|
||||
--no-compiler-runtime
|
||||
--no-system-d3d-compiler
|
||||
--no-system-dxc-compiler
|
||||
--no-opengl-sw
|
||||
--no-webkit2
|
||||
--no-virtualkeyboard
|
||||
-opengl # not detected automatically
|
||||
--skip-plugin-types generic,multimedia,networkinformation,qmltooling
|
||||
WORKING_DIRECTORY ${CMAKE_INSTALL_PREFIX}/bin)
|
||||
|
||||
# Remove unused files
|
||||
file(REMOVE_RECURSE ${CMAKE_INSTALL_PREFIX}/bin/playlistformats ${CMAKE_INSTALL_PREFIX}/bin/styles)
|
||||
|
||||
@@ -1,21 +0,0 @@
|
||||
# SPDX-FileCopyrightText: Copyright (C) swift Project Community / Contributors
|
||||
# SPDX-License-Identifier: GPL-3.0-or-later OR LicenseRef-swift-pilot-client-1
|
||||
|
||||
if(WIN32)
|
||||
add_library(externals_ssl SHARED IMPORTED GLOBAL)
|
||||
if(SWIFT_WIN32)
|
||||
set_target_properties(externals_ssl PROPERTIES IMPORTED_LOCATION ${PROJECT_SOURCE_DIR}/third_party/externals/win32-msvc/32/lib/libssl-1_1.dll)
|
||||
elseif(SWIFT_WIN64)
|
||||
set_target_properties(externals_ssl PROPERTIES IMPORTED_LOCATION ${PROJECT_SOURCE_DIR}/third_party/externals/win32-msvc/64/lib/libssl-1_1-x64.dll)
|
||||
endif()
|
||||
install(IMPORTED_RUNTIME_ARTIFACTS externals_ssl)
|
||||
|
||||
add_library(externals_crypto SHARED IMPORTED GLOBAL)
|
||||
if(SWIFT_WIN32)
|
||||
set_target_properties(externals_crypto PROPERTIES IMPORTED_LOCATION ${PROJECT_SOURCE_DIR}/third_party/externals/win32-msvc/32/lib/libcrypto-1_1.dll)
|
||||
elseif(SWIFT_WIN64)
|
||||
set_target_properties(externals_crypto PROPERTIES IMPORTED_LOCATION ${PROJECT_SOURCE_DIR}/third_party/externals/win32-msvc/64/lib/libcrypto-1_1-x64.dll)
|
||||
endif()
|
||||
install(IMPORTED_RUNTIME_ARTIFACTS externals_crypto)
|
||||
|
||||
endif()
|
||||
@@ -19,7 +19,7 @@
|
||||
<file>swift.xml</file>
|
||||
</include>
|
||||
<include>
|
||||
<file>qt5-binaries.xml</file>
|
||||
<file>qt6-binaries.xml</file>
|
||||
</include>
|
||||
<include>
|
||||
<file>vcredist-x86.xml</file>
|
||||
|
||||
@@ -3,10 +3,10 @@
|
||||
SPDX-License-Identifier: GPL-3.0-or-later OR LicenseRef-swift-pilot-client-1
|
||||
-->
|
||||
<componentGroup>
|
||||
<name>qt5binaries</name>
|
||||
<description>Qt5 binaries</description>
|
||||
<name>qt6binaries</name>
|
||||
<description>Qt6 binaries</description>
|
||||
<canBeEdited>1</canBeEdited>
|
||||
<detailedDescription>Qt5 runtime binaries</detailedDescription>
|
||||
<detailedDescription>Qt6 runtime binaries</detailedDescription>
|
||||
<selected>1</selected>
|
||||
<show>1</show>
|
||||
<folderList>
|
||||
@@ -17,44 +17,37 @@
|
||||
<platforms>windows</platforms>
|
||||
<distributionFileList>
|
||||
<distributionFile>
|
||||
<allowWildcards>1</allowWildcards>
|
||||
<origin>../../dist/bin/Qt5Core*.dll</origin>
|
||||
<origin>../../dist/bin/Qt6Core.dll</origin>
|
||||
</distributionFile>
|
||||
<distributionFile>
|
||||
<allowWildcards>1</allowWildcards>
|
||||
<origin>../../dist/bin/Qt5DBus*.dll</origin>
|
||||
<origin>../../dist/bin/Qt6Core5Compat.dll</origin>
|
||||
</distributionFile>
|
||||
<distributionFile>
|
||||
<allowWildcards>1</allowWildcards>
|
||||
<origin>../../dist/bin/Qt5Gui*.dll</origin>
|
||||
<origin>../../dist/bin/Qt6DBus.dll</origin>
|
||||
</distributionFile>
|
||||
<distributionFile>
|
||||
<allowWildcards>1</allowWildcards>
|
||||
<origin>../../dist/bin/Qt5Multimedia*.dll</origin>
|
||||
<origin>../../dist/bin/Qt6Gui.dll</origin>
|
||||
</distributionFile>
|
||||
<distributionFile>
|
||||
<allowWildcards>1</allowWildcards>
|
||||
<origin>../../dist/bin/Qt5Network*.dll</origin>
|
||||
<origin>../../dist/bin/Qt6Multimedia.dll</origin>
|
||||
</distributionFile>
|
||||
<distributionFile>
|
||||
<allowWildcards>1</allowWildcards>
|
||||
<origin>../../dist/bin/Qt5OpenGL*.dll</origin>
|
||||
<origin>../../dist/bin/Qt6Network.dll</origin>
|
||||
</distributionFile>
|
||||
<distributionFile>
|
||||
<allowWildcards>1</allowWildcards>
|
||||
<origin>../../dist/bin/Qt5Qml*.dll</origin>
|
||||
<origin>../../dist/bin/Qt6OpenGL.dll</origin>
|
||||
</distributionFile>
|
||||
<distributionFile>
|
||||
<allowWildcards>1</allowWildcards>
|
||||
<origin>../../dist/bin/Qt5Svg*.dll</origin>
|
||||
<origin>../../dist/bin/Qt6Qml.dll</origin>
|
||||
</distributionFile>
|
||||
<distributionFile>
|
||||
<allowWildcards>1</allowWildcards>
|
||||
<origin>../../dist/bin/Qt5Widgets*.dll</origin>
|
||||
<origin>../../dist/bin/Qt6Svg.dll</origin>
|
||||
</distributionFile>
|
||||
<distributionFile>
|
||||
<allowWildcards>1</allowWildcards>
|
||||
<origin>../../dist/bin/Qt5Xml*.dll</origin>
|
||||
<origin>../../dist/bin/Qt6Widgets.dll</origin>
|
||||
</distributionFile>
|
||||
<distributionFile>
|
||||
<origin>../../dist/bin/Qt6Xml.dll</origin>
|
||||
</distributionFile>
|
||||
<distributionFile>
|
||||
<origin>../../dist/bin/dbus-1-3.dll</origin>
|
||||
@@ -62,14 +55,6 @@
|
||||
<distributionFile>
|
||||
<origin>../../dist/bin/dbus-daemon.exe</origin>
|
||||
</distributionFile>
|
||||
<distributionFile>
|
||||
<allowWildcards>1</allowWildcards>
|
||||
<origin>../../dist/bin/libcrypto-1_1*.dll</origin>
|
||||
</distributionFile>
|
||||
<distributionFile>
|
||||
<allowWildcards>1</allowWildcards>
|
||||
<origin>../../dist/bin/libssl-1_1*.dll</origin>
|
||||
</distributionFile>
|
||||
</distributionFileList>
|
||||
</folder>
|
||||
<folder>
|
||||
@@ -79,52 +64,52 @@
|
||||
<platforms>linux linux-x64</platforms>
|
||||
<distributionFileList>
|
||||
<distributionFile>
|
||||
<origin>../../dist/lib/libicudata.so.56</origin>
|
||||
<origin>../../dist/lib/libicudata.so.73</origin>
|
||||
</distributionFile>
|
||||
<distributionFile>
|
||||
<origin>../../dist/lib/libicui18n.so.56</origin>
|
||||
<origin>../../dist/lib/libicui18n.so.73</origin>
|
||||
</distributionFile>
|
||||
<distributionFile>
|
||||
<origin>../../dist/lib/libicuuc.so.56</origin>
|
||||
<origin>../../dist/lib/libicuuc.so.73</origin>
|
||||
</distributionFile>
|
||||
<distributionFile>
|
||||
<origin>../../dist/lib/libQt5Core.so.5</origin>
|
||||
<origin>../../dist/lib/libQt6Core.so.6</origin>
|
||||
</distributionFile>
|
||||
<distributionFile>
|
||||
<origin>../../dist/lib/libQt5DBus.so.5</origin>
|
||||
<origin>../../dist/lib/libQt6Core5Compat.so.6</origin>
|
||||
</distributionFile>
|
||||
<distributionFile>
|
||||
<origin>../../dist/lib/libQt5Gui.so.5</origin>
|
||||
<origin>../../dist/lib/libQt6DBus.so.6</origin>
|
||||
</distributionFile>
|
||||
<distributionFile>
|
||||
<origin>../../dist/lib/libQt5Multimedia.so.5</origin>
|
||||
<origin>../../dist/lib/libQt6Gui.so.6</origin>
|
||||
</distributionFile>
|
||||
<distributionFile>
|
||||
<origin>../../dist/lib/libQt5MultimediaGstTools.so.5</origin>
|
||||
<origin>../../dist/lib/libQt6Multimedia.so.6</origin>
|
||||
</distributionFile>
|
||||
<distributionFile>
|
||||
<origin>../../dist/lib/libQt5MultimediaWidgets.so.5</origin>
|
||||
<origin>../../dist/lib/libQt6MultimediaWidgets.so.6</origin>
|
||||
</distributionFile>
|
||||
<distributionFile>
|
||||
<origin>../../dist/lib/libQt5Network.so.5</origin>
|
||||
<origin>../../dist/lib/libQt6Network.so.6</origin>
|
||||
</distributionFile>
|
||||
<distributionFile>
|
||||
<origin>../../dist/lib/libQt5OpenGL.so.5</origin>
|
||||
<origin>../../dist/lib/libQt6OpenGL.so.6</origin>
|
||||
</distributionFile>
|
||||
<distributionFile>
|
||||
<origin>../../dist/lib/libQt5Qml.so.5</origin>
|
||||
<origin>../../dist/lib/libQt6Qml.so.6</origin>
|
||||
</distributionFile>
|
||||
<distributionFile>
|
||||
<origin>../../dist/lib/libQt5Svg.so.5</origin>
|
||||
<origin>../../dist/lib/libQt6Svg.so.6</origin>
|
||||
</distributionFile>
|
||||
<distributionFile>
|
||||
<origin>../../dist/lib/libQt5Widgets.so.5</origin>
|
||||
<origin>../../dist/lib/libQt6Widgets.so.6</origin>
|
||||
</distributionFile>
|
||||
<distributionFile>
|
||||
<origin>../../dist/lib/libQt5XcbQpa.so.5</origin>
|
||||
<origin>../../dist/lib/libQt6XcbQpa.so.6</origin>
|
||||
</distributionFile>
|
||||
<distributionFile>
|
||||
<origin>../../dist/lib/libQt5Xml.so.5</origin>
|
||||
<origin>../../dist/lib/libQt6Xml.so.6</origin>
|
||||
</distributionFile>
|
||||
</distributionFileList>
|
||||
</folder>
|
||||
@@ -143,6 +128,9 @@
|
||||
<distributionDirectory>
|
||||
<origin>../../dist/lib/QtCore.framework</origin>
|
||||
</distributionDirectory>
|
||||
<distributionDirectory>
|
||||
<origin>../../dist/lib/QtCore5Compat.framework</origin>
|
||||
</distributionDirectory>
|
||||
<distributionDirectory>
|
||||
<origin>../../dist/lib/QtDBus.framework</origin>
|
||||
</distributionDirectory>
|
||||
@@ -196,23 +184,12 @@
|
||||
<platforms>all</platforms>
|
||||
<distributionFileList>
|
||||
<distributionDirectory>
|
||||
<origin>../../dist/bin/audio</origin>
|
||||
<onPackingFilterList>
|
||||
<fileNameFilter pattern="*wasapi*.dll" logic="does_not_match" patternType="glob"/>
|
||||
</onPackingFilterList>
|
||||
</distributionDirectory>
|
||||
<distributionDirectory>
|
||||
<origin>../../dist/bin/bearer</origin>
|
||||
</distributionDirectory>
|
||||
<distributionDirectory>
|
||||
<origin>../../dist/bin/iconengines</origin>
|
||||
<allowWildcards>1</allowWildcards>
|
||||
<origin>../../dist/bin/iconengines*</origin>
|
||||
</distributionDirectory>
|
||||
<distributionDirectory>
|
||||
<origin>../../dist/bin/imageformats</origin>
|
||||
</distributionDirectory>
|
||||
<distributionDirectory>
|
||||
<origin>../../dist/bin/mediaservice</origin>
|
||||
</distributionDirectory>
|
||||
<distributionDirectory>
|
||||
<origin>../../dist/bin/platforms</origin>
|
||||
</distributionDirectory>
|
||||
@@ -224,6 +201,13 @@
|
||||
<allowWildcards>1</allowWildcards>
|
||||
<origin>../../dist/bin/platformthemes*</origin>
|
||||
</distributionDirectory>
|
||||
<distributionDirectory>
|
||||
<allowWildcards>1</allowWildcards>
|
||||
<origin>../../dist/bin/styles*</origin>
|
||||
</distributionDirectory>
|
||||
<distributionDirectory>
|
||||
<origin>../../dist/bin/tls</origin>
|
||||
</distributionDirectory>
|
||||
<distributionDirectory>
|
||||
<allowWildcards>1</allowWildcards>
|
||||
<origin>../../dist/bin/xcbglintegrations*</origin>
|
||||
@@ -231,15 +215,4 @@
|
||||
</distributionFileList>
|
||||
</folder>
|
||||
</folderList>
|
||||
<postInstallationActionList>
|
||||
<deleteFile>
|
||||
<path>${installdir}/bin/audio/*wasapi*.dll</path>
|
||||
<progressText>Delete old version of Qt audio plugin</progressText>
|
||||
<ruleList>
|
||||
<platformTest>
|
||||
<type>windows</type>
|
||||
</platformTest>
|
||||
</ruleList>
|
||||
</deleteFile>
|
||||
</postInstallationActionList>
|
||||
</componentGroup>
|
||||
@@ -4,7 +4,7 @@
|
||||
-->
|
||||
<component>
|
||||
<name>vcruntime64</name>
|
||||
<description>Visual Studio 2019 x64 Redistributables</description>
|
||||
<description>Visual Studio 2022 x64 Redistributables</description>
|
||||
<canBeEdited>0</canBeEdited>
|
||||
<selected>1</selected>
|
||||
<show>1</show>
|
||||
@@ -19,7 +19,7 @@
|
||||
<abortOnError>0</abortOnError>
|
||||
<program>${installdir}/vcredist/vc_redist.x64.exe</program>
|
||||
<programArguments>/install /quiet /norestart</programArguments>
|
||||
<progressText>Installing Visual Studio 2019 x64 Redistributables</progressText>
|
||||
<progressText>Installing Visual Studio 2022 x64 Redistributables</progressText>
|
||||
<showMessageOnError>0</showMessageOnError>
|
||||
<ruleList>
|
||||
<platformTest>
|
||||
@@ -33,7 +33,7 @@
|
||||
</ruleList>
|
||||
</runProgram>
|
||||
<showWarning>
|
||||
<text>Installation of MS Visual Studio 2019 x64 Redistributables failed!
|
||||
<text>Installation of MS Visual Studio 2022 x64 Redistributables failed!
|
||||
Error Code: ${program_exit_code}
|
||||
Check if another version was already installed and if not, try to run the installer manually from
|
||||
${installdir}\vcredist\
|
||||
|
||||
@@ -6,8 +6,9 @@
|
||||
#ifndef BLACKSAMPLE_SAMPLEUTILS_H
|
||||
#define BLACKSAMPLE_SAMPLEUTILS_H
|
||||
|
||||
#include <QStringList>
|
||||
|
||||
class QString;
|
||||
class QStringList;
|
||||
class QTextStream;
|
||||
|
||||
namespace BlackMisc
|
||||
|
||||
@@ -11,7 +11,7 @@
|
||||
#include <QtGlobal>
|
||||
#include <QStringBuilder>
|
||||
#include <QDebug>
|
||||
#include <QAudioDeviceInfo>
|
||||
#include <QAudioDevice>
|
||||
#include <cmath>
|
||||
|
||||
using namespace BlackMisc;
|
||||
@@ -101,14 +101,11 @@ namespace BlackCore::Afv::Audio
|
||||
QAudioFormat inputFormat;
|
||||
inputFormat.setSampleRate(m_sampleRate); // normally 48000
|
||||
inputFormat.setChannelCount(1);
|
||||
inputFormat.setSampleSize(16);
|
||||
inputFormat.setSampleType(QAudioFormat::SignedInt);
|
||||
inputFormat.setByteOrder(QAudioFormat::LittleEndian);
|
||||
inputFormat.setCodec("audio/pcm");
|
||||
inputFormat.setSampleFormat(QAudioFormat::Int16);
|
||||
|
||||
QAudioDeviceInfo selectedDevice = getLowestLatencyDevice(inputDevice, inputFormat);
|
||||
QAudioDevice selectedDevice = getLowestLatencyDevice(inputDevice, inputFormat);
|
||||
m_inputFormat = inputFormat;
|
||||
m_audioInput.reset(new QAudioInput(selectedDevice, m_inputFormat));
|
||||
m_audioInput.reset(new QAudioSource(selectedDevice, m_inputFormat));
|
||||
if (!m_audioInputBuffer) { m_audioInputBuffer = new CAudioInputBuffer(this); }
|
||||
else { m_audioInputBuffer->disconnect(); } // make sure disconnected in any case
|
||||
m_audioInputBuffer->start(m_inputFormat);
|
||||
@@ -139,7 +136,7 @@ namespace BlackCore::Afv::Audio
|
||||
m_started = true;
|
||||
#endif
|
||||
const QString format = toQString(m_inputFormat);
|
||||
CLogMessage(this).info(u"Starting: '%1' with: %2") << selectedDevice.deviceName() << format;
|
||||
CLogMessage(this).info(u"Starting: '%1' with: %2") << selectedDevice.description() << format;
|
||||
}
|
||||
|
||||
void CInput::stop()
|
||||
@@ -158,6 +155,7 @@ namespace BlackCore::Afv::Audio
|
||||
|
||||
void CInput::audioInDataAvailable(const QByteArray &frame)
|
||||
{
|
||||
static_assert(Q_BYTE_ORDER == Q_LITTLE_ENDIAN);
|
||||
QVector<qint16> samples = convertBytesTo16BitPCM(frame);
|
||||
|
||||
if (m_inputFormat.channelCount() == 2)
|
||||
|
||||
@@ -14,7 +14,7 @@
|
||||
# include "blackmisc/macos/microphoneaccess.h"
|
||||
#endif
|
||||
|
||||
#include <QAudioInput>
|
||||
#include <QAudioSource>
|
||||
#include <QString>
|
||||
#include <QDateTime>
|
||||
#include <QSharedPointer>
|
||||
@@ -138,7 +138,7 @@ namespace BlackCore::Afv::Audio
|
||||
int m_sampleRate = 0;
|
||||
|
||||
BlackSound::Codecs::COpusEncoder m_encoder;
|
||||
QScopedPointer<QAudioInput> m_audioInput;
|
||||
QScopedPointer<QAudioSource> m_audioInput;
|
||||
BlackMisc::Audio::CAudioDeviceInfo m_device;
|
||||
QAudioFormat m_inputFormat;
|
||||
|
||||
|
||||
@@ -26,9 +26,22 @@ namespace BlackCore::Afv::Audio
|
||||
this->setObjectName(on);
|
||||
}
|
||||
|
||||
#ifdef Q_OS_WIN
|
||||
qint64 CAudioOutputBuffer::bytesAvailable() const
|
||||
{
|
||||
// Workaround to mimic the pre-Qt6 behavior.
|
||||
// With Qt6, the QAudioSink on Windows uses the bytesAvailable function to trigger
|
||||
// a call to readData() only when data is available. Other platforms still use a
|
||||
// pull procedure that automatically calls readData() afer a specific period. Until
|
||||
// a proper solution for the bytesAvailable() is implemented, this uses a fixed number.
|
||||
// readData() will handle it itself if actually no data is available.
|
||||
return 3840 + QIODevice::bytesAvailable();
|
||||
}
|
||||
#endif
|
||||
|
||||
qint64 CAudioOutputBuffer::readData(char *data, qint64 maxlen)
|
||||
{
|
||||
const int sampleBytes = m_outputFormat.sampleSize() / 8;
|
||||
const int sampleBytes = m_outputFormat.bytesPerSample();
|
||||
const int channelCount = m_outputFormat.channelCount();
|
||||
const qint64 count = maxlen / (sampleBytes * channelCount);
|
||||
QVector<float> buffer;
|
||||
@@ -92,16 +105,14 @@ namespace BlackCore::Afv::Audio
|
||||
QAudioFormat outputFormat;
|
||||
outputFormat.setSampleRate(48000);
|
||||
outputFormat.setChannelCount(1);
|
||||
outputFormat.setSampleSize(32);
|
||||
outputFormat.setSampleType(QAudioFormat::Float);
|
||||
outputFormat.setByteOrder(QAudioFormat::LittleEndian);
|
||||
outputFormat.setCodec("audio/pcm");
|
||||
outputFormat.setSampleFormat(QAudioFormat::Float);
|
||||
static_assert(Q_BYTE_ORDER == Q_LITTLE_ENDIAN);
|
||||
|
||||
const QString format = toQString(outputFormat);
|
||||
const QAudioDeviceInfo selectedDevice = getLowestLatencyDevice(outputDevice, outputFormat);
|
||||
CLogMessage(this).info(u"Starting: '%1' with: %2") << selectedDevice.deviceName() << format;
|
||||
const QAudioDevice selectedDevice = getLowestLatencyDevice(outputDevice, outputFormat);
|
||||
CLogMessage(this).info(u"Starting: '%1' with: %2") << selectedDevice.description() << format;
|
||||
|
||||
m_audioOutput.reset(new QAudioOutput(selectedDevice, outputFormat));
|
||||
m_audioOutput.reset(new QAudioSink(selectedDevice, outputFormat));
|
||||
m_audioOutputBuffer->open(QIODevice::ReadWrite | QIODevice::Unbuffered);
|
||||
m_audioOutputBuffer->setAudioFormat(outputFormat);
|
||||
m_audioOutput->start(m_audioOutputBuffer);
|
||||
|
||||
@@ -10,7 +10,7 @@
|
||||
#include "blackmisc/audio/audiodeviceinfo.h"
|
||||
|
||||
#include <QObject>
|
||||
#include <QAudioOutput>
|
||||
#include <QAudioSink>
|
||||
|
||||
namespace BlackCore::Afv::Audio
|
||||
{
|
||||
@@ -39,6 +39,11 @@ namespace BlackCore::Afv::Audio
|
||||
void outputVolumeStream(const OutputVolumeStreamArgs &args);
|
||||
|
||||
protected:
|
||||
#ifdef Q_OS_WIN
|
||||
//! \copydoc QIODevice::bytesAvailable
|
||||
qint64 bytesAvailable() const override;
|
||||
#endif
|
||||
|
||||
//! \copydoc QIODevice::readData
|
||||
virtual qint64 readData(char *data, qint64 maxlen) override;
|
||||
|
||||
@@ -95,7 +100,7 @@ namespace BlackCore::Afv::Audio
|
||||
private:
|
||||
bool m_started = false;
|
||||
BlackMisc::Audio::CAudioDeviceInfo m_device;
|
||||
QScopedPointer<QAudioOutput> m_audioOutput;
|
||||
QScopedPointer<QAudioSink> m_audioOutput;
|
||||
CAudioOutputBuffer *m_audioOutputBuffer = nullptr;
|
||||
};
|
||||
} // ns
|
||||
|
||||
@@ -19,10 +19,8 @@ namespace BlackCore::Afv::Audio
|
||||
|
||||
m_waveFormat.setSampleRate(sampleRate);
|
||||
m_waveFormat.setChannelCount(1);
|
||||
m_waveFormat.setSampleSize(16);
|
||||
m_waveFormat.setSampleType(QAudioFormat::SignedInt);
|
||||
m_waveFormat.setByteOrder(QAudioFormat::LittleEndian);
|
||||
m_waveFormat.setCodec("audio/pcm");
|
||||
m_waveFormat.setSampleFormat(QAudioFormat::Int16);
|
||||
static_assert(Q_BYTE_ORDER == Q_LITTLE_ENDIAN);
|
||||
|
||||
m_mixer = new CMixingSampleProvider(this);
|
||||
m_receiverIDs = transceiverIDs;
|
||||
@@ -148,7 +146,7 @@ namespace BlackCore::Afv::Audio
|
||||
return p->getId() == radioTransceiver.id;
|
||||
});
|
||||
|
||||
if (it)
|
||||
if (it != m_receiverInputs.end())
|
||||
{
|
||||
(*it)->setFrequency(radioTransceiver.frequencyHz);
|
||||
}
|
||||
|
||||
@@ -1025,23 +1025,6 @@ namespace BlackCore::Afv::Clients
|
||||
|
||||
void CAfvClient::initialize()
|
||||
{
|
||||
#ifdef Q_OS_WIN
|
||||
if (!m_winCoInitialized)
|
||||
{
|
||||
HRESULT hr = CoInitializeEx(nullptr, COINIT_MULTITHREADED);
|
||||
|
||||
// RPC_E_CHANGED_MODE: CoInitializeEx was already called by someone else in this thread with a different mode.
|
||||
if (hr == RPC_E_CHANGED_MODE)
|
||||
{
|
||||
CLogMessage(this).debug(u"CoInitializeEx was already called with a different mode. Trying again.");
|
||||
hr = CoInitializeEx(nullptr, COINIT_APARTMENTTHREADED);
|
||||
}
|
||||
|
||||
// S_OK: The COM library was initialized successfully on this thread.
|
||||
// S_FALSE: The COM library is already initialized on this thread. Reference count was incremented. This is not an error.
|
||||
if (hr == S_OK || hr == S_FALSE) { m_winCoInitialized = true; }
|
||||
}
|
||||
#endif
|
||||
CLogMessage(this).info(u"Initialize AFV client in thread %1") << CThreadUtils::currentThreadInfo();
|
||||
}
|
||||
|
||||
|
||||
@@ -168,7 +168,7 @@ namespace BlackCore::Afv
|
||||
static StationDto fromJson(const QJsonObject &json)
|
||||
{
|
||||
StationDto dto;
|
||||
dto.id = json.value("id").toString();
|
||||
dto.id = QUuid(json.value("id").toString());
|
||||
dto.name = json.value("name").toString();
|
||||
dto.frequencyHz = static_cast<quint32>(json.value("frequency").toInt());
|
||||
dto.frequencyAliasHz = static_cast<quint32>(json.value("frequencyAlias").toInt());
|
||||
|
||||
@@ -1963,7 +1963,7 @@ namespace BlackCore
|
||||
QString CAircraftMatcher::scoresToString(const ScoredModels &scores, int lastElements)
|
||||
{
|
||||
if (scores.isEmpty()) { return {}; }
|
||||
QMapIterator<int, CAircraftModel> i(scores);
|
||||
QMultiMapIterator<int, CAircraftModel> i(scores);
|
||||
i.toBack();
|
||||
int c = 0;
|
||||
QString str;
|
||||
|
||||
@@ -392,7 +392,7 @@ namespace BlackCore
|
||||
bool CApplication::hasWebDataServices() const
|
||||
{
|
||||
if (this->isShuttingDown()) { return false; } // service will not survive for long
|
||||
return m_webDataServices;
|
||||
return !m_webDataServices.isNull();
|
||||
}
|
||||
|
||||
CWebDataServices *CApplication::getWebDataServices() const
|
||||
@@ -1300,7 +1300,7 @@ namespace BlackCore
|
||||
|
||||
bool CApplication::hasSetupReader() const
|
||||
{
|
||||
return m_setupReader;
|
||||
return !m_setupReader.isNull();
|
||||
}
|
||||
|
||||
CSetupReader *CApplication::getSetupReader() const
|
||||
|
||||
@@ -40,9 +40,6 @@ namespace BlackCore
|
||||
qDBusRegisterMetaType<BlackCore::ISimulator::SimulatorStatusFlag>();
|
||||
qDBusRegisterMetaType<BlackCore::ISimulator::SimulatorStatus>();
|
||||
|
||||
qRegisterMetaTypeStreamOperators<Context::CSettingsDictionary>();
|
||||
qRegisterMetaTypeStreamOperators<BlackMisc::Network::CLoginMode>();
|
||||
|
||||
Db::CDatabaseReaderConfig::registerMetadata();
|
||||
Db::CDatabaseReaderConfigList::registerMetadata();
|
||||
Data::CGlobalSetup::registerMetadata();
|
||||
|
||||
@@ -86,12 +86,12 @@ namespace BlackCore
|
||||
|
||||
bool CThreadedReader::didContentChange(const QString &content, int startPosition)
|
||||
{
|
||||
uint oldHash = 0;
|
||||
size_t oldHash = 0;
|
||||
{
|
||||
QReadLocker rl(&m_lock);
|
||||
oldHash = m_contentHash;
|
||||
}
|
||||
uint newHash = qHash(startPosition < 0 ? content : content.mid(startPosition));
|
||||
size_t newHash = qHash(startPosition < 0 ? content : content.mid(startPosition));
|
||||
if (oldHash == newHash) { return false; }
|
||||
{
|
||||
QWriteLocker wl(&m_lock);
|
||||
|
||||
@@ -144,7 +144,7 @@ namespace BlackCore
|
||||
int m_initialTime = -1; //!< Initial start delay
|
||||
int m_periodicTime = -1; //!< Periodic time after which the task is repeated
|
||||
QDateTime m_updateTimestamp; //!< when file/resource was read
|
||||
uint m_contentHash = 0; //!< has of the content given
|
||||
size_t m_contentHash = 0; //!< has of the content given
|
||||
std::atomic_bool m_markedAsFailed { false }; //!< marker if reading failed
|
||||
bool m_unitTest { false }; //!< mark as unit test
|
||||
BlackMisc::Network::CUrlLogList m_urlReadLog; //!< URL based reading can be logged
|
||||
|
||||
@@ -121,7 +121,7 @@ namespace BlackGui::Components
|
||||
}
|
||||
}
|
||||
|
||||
const uint hash = qHash(html);
|
||||
const size_t hash = qHash(html);
|
||||
if (hash == m_htmlHash) { return; } // avoid to always scroll to the end when there is no update
|
||||
m_htmlHash = hash;
|
||||
m_text.setHtml(html);
|
||||
|
||||
@@ -36,7 +36,7 @@ namespace BlackGui::Components
|
||||
QScopedPointer<Ui::CAircraftPartsHistory> ui;
|
||||
QTimer m_timerUpdateHistory;
|
||||
QTextDocument m_text { this };
|
||||
uint m_htmlHash = 0;
|
||||
size_t m_htmlHash = 0;
|
||||
|
||||
//! Init
|
||||
void initGui();
|
||||
|
||||
@@ -52,7 +52,6 @@ namespace BlackGui::Components
|
||||
|
||||
layout->setObjectName("gl_CAtcButtonComponent");
|
||||
layout->setSpacing(4);
|
||||
layout->setMargin(0);
|
||||
layout->setContentsMargins(0, 0, 0, 0);
|
||||
|
||||
int row = 0;
|
||||
|
||||
@@ -78,7 +78,7 @@ namespace BlackGui::Components
|
||||
if (horizontal) { ledLayout = new QHBoxLayout(this); }
|
||||
else { ledLayout = new QVBoxLayout(this); }
|
||||
|
||||
ledLayout->setMargin(0);
|
||||
ledLayout->setContentsMargins(0, 0, 0, 0);
|
||||
ledLayout->addWidget(m_ledStandby.data());
|
||||
ledLayout->addWidget(m_ledModes.data());
|
||||
ledLayout->addWidget(m_ledIdent.data());
|
||||
|
||||
@@ -86,7 +86,6 @@ namespace BlackGui::Components
|
||||
QGridLayout *gridLayout = new QGridLayout(ui->fr_NavigatorDialogInner);
|
||||
gridLayout->setObjectName("gl_CNavigatorDialog");
|
||||
gridLayout->setSpacing(0);
|
||||
gridLayout->setMargin(0);
|
||||
gridLayout->setContentsMargins(0, 0, 0, 0);
|
||||
ui->fr_NavigatorDialogInner->setLayout(gridLayout);
|
||||
int r = 0;
|
||||
@@ -257,7 +256,7 @@ namespace BlackGui::Components
|
||||
QDialog::paintEvent(event);
|
||||
}
|
||||
|
||||
void CNavigatorDialog::enterEvent(QEvent *event)
|
||||
void CNavigatorDialog::enterEvent(QEnterEvent *event)
|
||||
{
|
||||
// event called when mouse is over, acts as auto-focus
|
||||
QApplication::setActiveWindow(this);
|
||||
|
||||
@@ -99,7 +99,7 @@ namespace BlackGui::Components
|
||||
virtual void paintEvent(QPaintEvent *event) override;
|
||||
|
||||
//! \copydoc QDialog::enterEvent
|
||||
virtual void enterEvent(QEvent *event) override;
|
||||
virtual void enterEvent(QEnterEvent *event) override;
|
||||
//! @}
|
||||
|
||||
private:
|
||||
|
||||
@@ -5,7 +5,6 @@
|
||||
#include "ui_scalescreenfactor.h"
|
||||
#include "blackgui/guiutility.h"
|
||||
|
||||
#include <QDesktopWidget>
|
||||
#include <QScreen>
|
||||
#include <QIntValidator>
|
||||
|
||||
@@ -20,23 +19,7 @@ namespace BlackGui::Components
|
||||
connect(ui->hs_Factor, &QSlider::valueChanged, this, &CScaleScreenFactor::onSliderChanged);
|
||||
connect(ui->le_Factor, &QLineEdit::editingFinished, this, &CScaleScreenFactor::onEditFinished);
|
||||
|
||||
const QDesktopWidget *w = qApp->desktop();
|
||||
const QString tt = QStringLiteral(
|
||||
"Scaling only works on High DPI screens\n"
|
||||
"Width/height: %1/%2 Ratio: %3\n"
|
||||
"Logical DPI x/y: %4/%5\n"
|
||||
"Physical DPI x/y: %6/%7\n"
|
||||
"width/height MM: %8/%9")
|
||||
.arg(w->width())
|
||||
.arg(w->height())
|
||||
.arg(QString::number(CGuiUtility::mainApplicationWidgetPixelRatio(), 'f', 2))
|
||||
.arg(w->logicalDpiX())
|
||||
.arg(w->logicalDpiY())
|
||||
.arg(w->physicalDpiX())
|
||||
.arg(w->physicalDpiY())
|
||||
.arg(w->widthMM())
|
||||
.arg(w->heightMM());
|
||||
|
||||
const QString tt = QStringLiteral("Scaling only works on High DPI screens");
|
||||
this->setToolTip(tt);
|
||||
}
|
||||
|
||||
|
||||
@@ -14,8 +14,6 @@
|
||||
#include <QString>
|
||||
#include <QTimer>
|
||||
|
||||
class QStringList;
|
||||
|
||||
namespace BlackGui::Components
|
||||
{
|
||||
//! Selector for the transponder mode
|
||||
|
||||
@@ -29,7 +29,6 @@
|
||||
#include <QAction>
|
||||
#include <QCloseEvent>
|
||||
#include <QApplication>
|
||||
#include <QDesktopWidget>
|
||||
#include <QCommandLineParser>
|
||||
#include <QDesktopServices>
|
||||
#include <QDir>
|
||||
@@ -305,9 +304,6 @@ namespace BlackGui
|
||||
|
||||
sf = cleanNumber(sf);
|
||||
|
||||
QApplication::setAttribute(Qt::AA_EnableHighDpiScaling); // DPI support
|
||||
QCoreApplication::setAttribute(Qt::AA_UseHighDpiPixmaps); // HiDPI pixmaps
|
||||
|
||||
// qputenv("QT_ENABLE_HIGHDPI_SCALING", "1");
|
||||
QGuiApplication::setHighDpiScaleFactorRoundingPolicy(Qt::HighDpiScaleFactorRoundingPolicy::Floor);
|
||||
|
||||
@@ -323,9 +319,15 @@ namespace BlackGui
|
||||
QScreen *CGuiApplication::currentScreen()
|
||||
{
|
||||
const QWidget *w = CGuiApplication::mainApplicationWidget();
|
||||
const int s = QApplication::desktop()->screenNumber(w);
|
||||
if (s >= 0 && s < QGuiApplication::screens().size()) { return QGuiApplication::screens().at(s); }
|
||||
return QGuiApplication::primaryScreen();
|
||||
if (!w) return QGuiApplication::primaryScreen();
|
||||
|
||||
const QWindow *win = w->windowHandle();
|
||||
|
||||
if (!win) return QGuiApplication::primaryScreen();
|
||||
|
||||
QScreen *screen = win->screen();
|
||||
|
||||
return screen ? screen : QGuiApplication::primaryScreen();
|
||||
}
|
||||
|
||||
QRect CGuiApplication::currentScreenGeometry()
|
||||
@@ -352,7 +354,7 @@ namespace BlackGui
|
||||
|
||||
int CGuiApplication::hashForStateSettingsSchema(const QMainWindow *window)
|
||||
{
|
||||
unsigned int hash = 0;
|
||||
size_t hash = 0;
|
||||
for (auto obj : window->findChildren<QToolBar *>(QString(), Qt::FindDirectChildrenOnly))
|
||||
{
|
||||
hash ^= qHash(obj->objectName());
|
||||
|
||||
@@ -36,7 +36,6 @@
|
||||
#include <QStringBuilder>
|
||||
#include <QGraphicsOpacityEffect>
|
||||
#include <QPropertyAnimation>
|
||||
#include <QDesktopWidget>
|
||||
|
||||
// for the screen size
|
||||
|
||||
@@ -110,10 +109,12 @@ namespace BlackGui
|
||||
QSize CGuiUtility::desktopSize()
|
||||
{
|
||||
const QWidget *mw = CGuiUtility::mainApplicationWidget();
|
||||
if (mw) { return QApplication::desktop()->screenGeometry(mw).size(); }
|
||||
if (!mw) return QGuiApplication::primaryScreen()->size();
|
||||
|
||||
// main screen
|
||||
return QApplication::desktop()->screenGeometry(QApplication::desktop()).size();
|
||||
const QWindow *win = mw->windowHandle();
|
||||
if (!win) return QGuiApplication::primaryScreen()->size();
|
||||
|
||||
return win->size();
|
||||
}
|
||||
|
||||
namespace Private
|
||||
@@ -742,9 +743,8 @@ namespace BlackGui
|
||||
static const QString s("01234567890123456789012345678901234567890123456789012345678901234567890123456789");
|
||||
const QFontMetricsF fm = CGuiUtility::currentFontMetricsF();
|
||||
const qreal scale = withRatio ? CGuiUtility::mainApplicationWidgetPixelRatio() : 1.0;
|
||||
const qreal w = fm.width(s) * scale;
|
||||
const qreal h = fm.height() * scale;
|
||||
return QSizeF(w, h);
|
||||
const QSizeF size = fm.size(Qt::TextSingleLine, s);
|
||||
return size * scale;
|
||||
}
|
||||
|
||||
QSizeF CGuiUtility::fontMetricsLazyDog43Chars(bool withRatio)
|
||||
@@ -753,9 +753,8 @@ namespace BlackGui
|
||||
static const QString s("The quick brown fox jumps over the lazy dog");
|
||||
const QFontMetricsF fm = CGuiUtility::currentFontMetrics();
|
||||
const qreal scale = withRatio ? CGuiUtility::mainApplicationWidgetPixelRatio() : 1.0;
|
||||
const qreal w = fm.width(s) * scale;
|
||||
const qreal h = fm.height() * scale;
|
||||
return QSizeF(w, h);
|
||||
const QSizeF size = fm.size(Qt::TextSingleLine, s);
|
||||
return size * scale;
|
||||
}
|
||||
|
||||
QSizeF CGuiUtility::fontMetricsEstimateSize(int xCharacters, int yCharacters, bool withRatio)
|
||||
@@ -773,8 +772,8 @@ namespace BlackGui
|
||||
|
||||
void CGuiUtility::centerWidget(QWidget *widget)
|
||||
{
|
||||
// const QRect screenGeometry = QApplication::desktop()->screenGeometry();
|
||||
const QScreen *pScreen = QGuiApplication::screenAt(widget->mapToGlobal({ widget->width() / 2, 0 }));
|
||||
const QPoint point(widget->width() / 2.0, 0);
|
||||
const QScreen *pScreen = QGuiApplication::screenAt(widget->mapToGlobal(point));
|
||||
const QRect screenGeometry = pScreen->availableGeometry();
|
||||
const int x = (screenGeometry.width() - widget->width()) / 2;
|
||||
const int y = (screenGeometry.height() - widget->height()) / 2;
|
||||
@@ -808,8 +807,7 @@ namespace BlackGui
|
||||
const QWidget *mainWidget = CGuiUtility::mainApplicationWidget();
|
||||
if (mainWidget)
|
||||
{
|
||||
// const QSize sd = QApplication::desktop()->screenGeometry().size();
|
||||
const QSize sd = QApplication::desktop()->screenGeometry(mainWidget).size();
|
||||
const QSize sd = QGuiApplication::primaryScreen()->geometry().size();
|
||||
desktop = QStringLiteral("Desktop w%1 w%2").arg(sd.width()).arg(sd.height());
|
||||
ratio = QStringLiteral("ratio: %1").arg(mainWidget->devicePixelRatioF());
|
||||
}
|
||||
|
||||
@@ -278,7 +278,7 @@ namespace BlackGui
|
||||
{
|
||||
// init style sheets with this widget
|
||||
QStyleOption opt;
|
||||
opt.init(this);
|
||||
opt.initFrom(this);
|
||||
|
||||
// paint
|
||||
QPainter painter(this);
|
||||
|
||||
@@ -19,7 +19,6 @@
|
||||
|
||||
class QMouseEvent;
|
||||
class QPaintEvent;
|
||||
class QStringList;
|
||||
class QSvgRenderer;
|
||||
|
||||
namespace BlackGui
|
||||
|
||||
@@ -58,7 +58,7 @@ namespace BlackGui::Models
|
||||
bool CStatusMessageListModel::sortedByTimestampOrOrder(const CPropertyIndex &p)
|
||||
{
|
||||
if (p.isEmpty()) { return false; }
|
||||
const int last = p.indexVector().last();
|
||||
const int last = p.indexList().last();
|
||||
return IOrderable::isAnyOrderIndex(last) || ITimestampBased::isAnyTimestampIndex(last);
|
||||
}
|
||||
|
||||
|
||||
@@ -4,7 +4,6 @@
|
||||
#include "blackgui/pluginconfigwindow.h"
|
||||
|
||||
#include <QApplication>
|
||||
#include <QDesktopWidget>
|
||||
#include <QStyle>
|
||||
#include <Qt>
|
||||
#include <QtGlobal>
|
||||
@@ -15,16 +14,4 @@ namespace BlackGui
|
||||
{
|
||||
this->setWindowModality(Qt::WindowModal);
|
||||
}
|
||||
|
||||
void CPluginConfigWindow::showEvent(QShowEvent *event)
|
||||
{
|
||||
this->setGeometry(
|
||||
QStyle::alignedRect(
|
||||
Qt::LeftToRight,
|
||||
Qt::AlignCenter,
|
||||
this->size(),
|
||||
QDesktopWidget().screenGeometry(qApp->activeWindow())));
|
||||
|
||||
Q_UNUSED(event);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -22,10 +22,6 @@ namespace BlackGui
|
||||
public:
|
||||
//! No parent
|
||||
explicit CPluginConfigWindow(QWidget *parent);
|
||||
|
||||
protected:
|
||||
//! \copydoc QWidget::showEvent()
|
||||
virtual void showEvent(QShowEvent *event) override;
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
@@ -5,7 +5,6 @@
|
||||
#include "ui_plugindetailswindow.h"
|
||||
|
||||
#include <QApplication>
|
||||
#include <QDesktopWidget>
|
||||
#include <QFont>
|
||||
#include <QLabel>
|
||||
#include <QPushButton>
|
||||
@@ -52,15 +51,4 @@ namespace BlackGui
|
||||
{
|
||||
ui->lbl_Authors->setText(authors);
|
||||
}
|
||||
|
||||
void CPluginDetailsWindow::showEvent(QShowEvent *event)
|
||||
{
|
||||
this->setGeometry(
|
||||
QStyle::alignedRect(
|
||||
Qt::LeftToRight,
|
||||
Qt::AlignCenter,
|
||||
this->size(),
|
||||
QDesktopWidget().screenGeometry(qApp->activeWindow())));
|
||||
Q_UNUSED(event);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -47,10 +47,6 @@ namespace BlackGui
|
||||
//! Sets the plugin authors
|
||||
void setPluginAuthors(const QString &authors);
|
||||
|
||||
protected:
|
||||
//! \copydoc QWidget::showEvent()
|
||||
virtual void showEvent(QShowEvent *event) override;
|
||||
|
||||
private:
|
||||
QScopedPointer<Ui::CPluginDetailsWindow> ui;
|
||||
};
|
||||
|
||||
@@ -54,7 +54,7 @@ namespace BlackGui::Settings
|
||||
s.append(boolToTrueFalse(this->m_frameless));
|
||||
s.append(separator);
|
||||
s.append("columns: ");
|
||||
s.append(this->m_columns);
|
||||
s.append(QString::number(this->m_columns));
|
||||
return s;
|
||||
}
|
||||
|
||||
|
||||
@@ -232,7 +232,7 @@ namespace BlackGui
|
||||
QString fs;
|
||||
if (font.pixelSize() >= 0)
|
||||
{
|
||||
fs.append(font.pixelSize()).append("px");
|
||||
fs.append(QString::number(font.pixelSize())).append("px");
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
@@ -148,7 +148,7 @@ namespace BlackGui::Views
|
||||
{
|
||||
m_frame = new QFrame(this);
|
||||
QHBoxLayout *layout = new QHBoxLayout(m_frame);
|
||||
layout->setMargin(2);
|
||||
layout->setContentsMargins(2, 2, 2, 2);
|
||||
m_frame->setLayout(layout);
|
||||
m_leOrder = new QLineEdit(m_frame);
|
||||
QLabel *icon = new QLabel(m_frame);
|
||||
|
||||
@@ -41,11 +41,6 @@ namespace BlackInput
|
||||
void buttonChanged(const BlackMisc::Input::CJoystickButton &joystickButton, bool isPressed);
|
||||
|
||||
private:
|
||||
friend bool operator==(const CJoystickDevice &lhs, const CJoystickDevice &rhs);
|
||||
|
||||
//! Poll the device buttons
|
||||
void pollDeviceState();
|
||||
|
||||
void processButtonEvent(IOHIDValueRef value);
|
||||
|
||||
static void valueCallback(void *context, IOReturn result, void *sender, IOHIDValueRef value);
|
||||
|
||||
@@ -200,7 +200,6 @@ add_library(misc SHARED
|
||||
crashinfo.h
|
||||
datacache.cpp
|
||||
datacache.h
|
||||
datastream.h
|
||||
dbus.cpp
|
||||
dbus.h
|
||||
dbusserver.cpp
|
||||
@@ -702,6 +701,7 @@ target_link_libraries(misc
|
||||
Qt::Network
|
||||
Qt::Multimedia
|
||||
externals_rapidjson # used by xswiftbussettingsqtfree.inc
|
||||
Qt::Core5Compat # for QStringRef
|
||||
PRIVATE
|
||||
Qt::Xml
|
||||
SimpleCrypt
|
||||
|
||||
@@ -9,7 +9,8 @@
|
||||
#include <QStringBuilder>
|
||||
#include <QHostInfo>
|
||||
#include <QtGlobal>
|
||||
#include <QAudioDeviceInfo>
|
||||
#include <QAudioDevice>
|
||||
#include <QMediaDevices>
|
||||
|
||||
BLACK_DEFINE_VALUEOBJECT_MIXINS(BlackMisc::Audio, CAudioDeviceInfo)
|
||||
|
||||
@@ -26,8 +27,8 @@ namespace BlackMisc::Audio
|
||||
{
|
||||
if (m_deviceName.isEmpty()) { return false; }
|
||||
if (m_deviceName == "default") { return true; }
|
||||
if (this->isInputDevice() && m_deviceName == QAudioDeviceInfo::defaultInputDevice().deviceName()) { return true; }
|
||||
if (this->isOutputDevice() && m_deviceName == QAudioDeviceInfo::defaultOutputDevice().deviceName()) { return true; }
|
||||
if (this->isInputDevice() && m_deviceName == QMediaDevices::defaultAudioInput().description()) { return true; }
|
||||
if (this->isOutputDevice() && m_deviceName == QMediaDevices::defaultAudioOutput().description()) { return true; }
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -48,12 +49,12 @@ namespace BlackMisc::Audio
|
||||
|
||||
CAudioDeviceInfo CAudioDeviceInfo::getDefaultOutputDevice()
|
||||
{
|
||||
return CAudioDeviceInfo(OutputDevice, QAudioDeviceInfo::defaultOutputDevice().deviceName());
|
||||
return CAudioDeviceInfo(OutputDevice, QMediaDevices::defaultAudioOutput().description());
|
||||
}
|
||||
|
||||
CAudioDeviceInfo CAudioDeviceInfo::getDefaultInputDevice()
|
||||
{
|
||||
return CAudioDeviceInfo(InputDevice, QAudioDeviceInfo::defaultInputDevice().deviceName());
|
||||
return CAudioDeviceInfo(InputDevice, QMediaDevices::defaultAudioInput().description());
|
||||
}
|
||||
|
||||
QVariant CAudioDeviceInfo::propertyByIndex(CPropertyIndexRef index) const
|
||||
|
||||
@@ -5,7 +5,7 @@
|
||||
#include "blackmisc/stringutils.h"
|
||||
|
||||
#include <QString>
|
||||
#include <QAudioDeviceInfo>
|
||||
#include <QMediaDevices>
|
||||
#include <algorithm>
|
||||
|
||||
BLACK_DEFINE_SEQUENCE_MIXINS(BlackMisc::Audio, CAudioDeviceInfo, CAudioDeviceInfoList)
|
||||
@@ -147,9 +147,9 @@ namespace BlackMisc::Audio
|
||||
CAudioDeviceInfoList CAudioDeviceInfoList::allInputDevices()
|
||||
{
|
||||
CAudioDeviceInfoList devices;
|
||||
for (const QAudioDeviceInfo &inputDevice : allQtInputDevices())
|
||||
for (const QAudioDevice &inputDevice : allQtInputDevices())
|
||||
{
|
||||
const CAudioDeviceInfo d(CAudioDeviceInfo::InputDevice, inputDevice.deviceName());
|
||||
const CAudioDeviceInfo d(CAudioDeviceInfo::InputDevice, inputDevice.description());
|
||||
if (!devices.contains(d)) { devices.push_back(d); }
|
||||
}
|
||||
return devices;
|
||||
@@ -158,9 +158,9 @@ namespace BlackMisc::Audio
|
||||
CAudioDeviceInfoList CAudioDeviceInfoList::allOutputDevices()
|
||||
{
|
||||
CAudioDeviceInfoList devices;
|
||||
for (const QAudioDeviceInfo &outputDevice : allQtOutputDevices())
|
||||
for (const QAudioDevice &outputDevice : allQtOutputDevices())
|
||||
{
|
||||
const CAudioDeviceInfo d(CAudioDeviceInfo::OutputDevice, outputDevice.deviceName());
|
||||
const CAudioDeviceInfo d(CAudioDeviceInfo::OutputDevice, outputDevice.description());
|
||||
if (!devices.contains(d)) { devices.push_back(d); }
|
||||
}
|
||||
return devices;
|
||||
@@ -194,36 +194,36 @@ namespace BlackMisc::Audio
|
||||
return i;
|
||||
}
|
||||
|
||||
QList<QAudioDeviceInfo> CAudioDeviceInfoList::allQtInputDevices()
|
||||
QList<QAudioDevice> CAudioDeviceInfoList::allQtInputDevices()
|
||||
{
|
||||
const QList<QAudioDeviceInfo> devices = QAudioDeviceInfo::availableDevices(QAudio::AudioInput);
|
||||
const QList<QAudioDevice> devices = QMediaDevices::audioInputs();
|
||||
return devices;
|
||||
}
|
||||
|
||||
QList<QAudioDeviceInfo> CAudioDeviceInfoList::allQtOutputDevices()
|
||||
QList<QAudioDevice> CAudioDeviceInfoList::allQtOutputDevices()
|
||||
{
|
||||
const QList<QAudioDeviceInfo> devices = QAudioDeviceInfo::availableDevices(QAudio::AudioOutput);
|
||||
const QList<QAudioDevice> devices = QMediaDevices::audioOutputs();
|
||||
return devices;
|
||||
}
|
||||
|
||||
QAudioDeviceInfo CAudioDeviceInfoList::defaultQtInputDevice()
|
||||
QAudioDevice CAudioDeviceInfoList::defaultQtInputDevice()
|
||||
{
|
||||
return QAudioDeviceInfo::defaultInputDevice();
|
||||
return QMediaDevices::defaultAudioInput();
|
||||
}
|
||||
|
||||
QAudioDeviceInfo CAudioDeviceInfoList::defaultQtOutputDevice()
|
||||
QAudioDevice CAudioDeviceInfoList::defaultQtOutputDevice()
|
||||
{
|
||||
return QAudioDeviceInfo::defaultOutputDevice();
|
||||
return QMediaDevices::defaultAudioOutput();
|
||||
}
|
||||
|
||||
CAudioDeviceInfo CAudioDeviceInfoList::defaultInputDevice()
|
||||
{
|
||||
return CAudioDeviceInfo(CAudioDeviceInfo::InputDevice, defaultQtInputDevice().deviceName());
|
||||
return CAudioDeviceInfo(CAudioDeviceInfo::InputDevice, defaultQtInputDevice().description());
|
||||
}
|
||||
|
||||
CAudioDeviceInfo CAudioDeviceInfoList::defaultOutputDevice()
|
||||
{
|
||||
return CAudioDeviceInfo(CAudioDeviceInfo::OutputDevice, defaultQtOutputDevice().deviceName());
|
||||
return CAudioDeviceInfo(CAudioDeviceInfo::OutputDevice, defaultQtOutputDevice().description());
|
||||
}
|
||||
|
||||
} // namespace
|
||||
|
||||
@@ -13,7 +13,7 @@
|
||||
#include "blackmisc/blackmiscexport.h"
|
||||
|
||||
#include <QMetaType>
|
||||
#include <QAudioDeviceInfo>
|
||||
#include <QAudioDevice>
|
||||
#include <QStringList>
|
||||
|
||||
BLACK_DECLARE_SEQUENCE_MIXINS(BlackMisc::Audio, CAudioDeviceInfo, CAudioDeviceInfoList)
|
||||
@@ -88,10 +88,10 @@ namespace BlackMisc::Audio
|
||||
static CAudioDeviceInfoList allInputDevicesPlusDefault();
|
||||
static CAudioDeviceInfoList allOutputDevicesPlusDefault();
|
||||
static CAudioDeviceInfoList allDevicesPlusDefault();
|
||||
static QList<QAudioDeviceInfo> allQtInputDevices();
|
||||
static QList<QAudioDeviceInfo> allQtOutputDevices();
|
||||
static QAudioDeviceInfo defaultQtInputDevice();
|
||||
static QAudioDeviceInfo defaultQtOutputDevice();
|
||||
static QList<QAudioDevice> allQtInputDevices();
|
||||
static QList<QAudioDevice> allQtOutputDevices();
|
||||
static QAudioDevice defaultQtInputDevice();
|
||||
static QAudioDevice defaultQtOutputDevice();
|
||||
static CAudioDeviceInfo defaultInputDevice();
|
||||
static CAudioDeviceInfo defaultOutputDevice();
|
||||
//! @}
|
||||
|
||||
@@ -5,7 +5,7 @@
|
||||
#include "blackmisc/audio/audioutils.h"
|
||||
|
||||
#include <QProcess>
|
||||
#include <QAudioDeviceInfo>
|
||||
#include <QMediaDevices>
|
||||
|
||||
using namespace BlackConfig;
|
||||
|
||||
@@ -23,8 +23,9 @@ namespace BlackMisc::Audio
|
||||
|
||||
// force init of device lists
|
||||
// see https://discordapp.com/channels/539048679160676382/539925070550794240/676418182038421534
|
||||
QAudioDeviceInfo::availableDevices(QAudio::AudioInput);
|
||||
QAudioDeviceInfo::availableDevices(QAudio::AudioOutput);
|
||||
// TODO Is this still required with Qt 6?
|
||||
QMediaDevices::audioInputs();
|
||||
QMediaDevices::audioOutputs();
|
||||
}
|
||||
|
||||
} // ns
|
||||
|
||||
@@ -24,7 +24,6 @@ namespace BlackMisc
|
||||
// ENUMs
|
||||
qDBusRegisterMetaType<CNotificationSounds::NotificationFlag>();
|
||||
qDBusRegisterMetaType<CAudioDeviceInfo::DeviceType>();
|
||||
qRegisterMetaTypeStreamOperators<CNotificationSounds::NotificationFlag>();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -822,10 +822,10 @@ namespace BlackMisc::Aviation
|
||||
}
|
||||
|
||||
// turn E to P engine
|
||||
if (combinedCode.endsWith("E")) { return QStringList({ combinedCode.leftRef(2) % u'P' }); }
|
||||
if (combinedCode.endsWith("E")) { return QStringList({ QStringView { combinedCode }.left(2) % u'P' }); }
|
||||
|
||||
// turn T to H plane (tilt wing to helicopter
|
||||
if (combinedCode.startsWith("T")) { return QStringList({ u'H' % combinedCode.rightRef(2) }); }
|
||||
if (combinedCode.startsWith("T")) { return QStringList({ u'H' % QStringView { combinedCode }.right(2) }); }
|
||||
|
||||
// based on engine count
|
||||
QStringList codes;
|
||||
|
||||
@@ -511,7 +511,7 @@ namespace BlackMisc::Aviation
|
||||
bool ok = fn.size() > 5;
|
||||
if (!ok) { continue; }
|
||||
BLACK_VERIFY_X(ok, Q_FUNC_INFO, "wrong file name");
|
||||
const int id = fn.leftRef(5).toInt(&ok);
|
||||
const int id = QStringView { fn }.left(5).toInt(&ok);
|
||||
BLACK_VERIFY_X(ok, Q_FUNC_INFO, "wrong id format");
|
||||
if (!ok) { continue; }
|
||||
ids.insert(id);
|
||||
|
||||
@@ -15,8 +15,6 @@
|
||||
#include <QString>
|
||||
#include <tuple>
|
||||
|
||||
class QStringList;
|
||||
|
||||
BLACK_DECLARE_VALUEOBJECT_MIXINS(BlackMisc::Aviation, CCallsign)
|
||||
|
||||
namespace BlackMisc
|
||||
|
||||
@@ -58,13 +58,10 @@ namespace BlackMisc::Aviation
|
||||
{
|
||||
qRegisterMetaType<BlackMisc::CSequence<CCallsign>>();
|
||||
qDBusRegisterMetaType<BlackMisc::CSequence<CCallsign>>();
|
||||
qRegisterMetaTypeStreamOperators<BlackMisc::CSequence<CCallsign>>();
|
||||
qRegisterMetaType<BlackMisc::CCollection<CCallsign>>();
|
||||
qDBusRegisterMetaType<BlackMisc::CCollection<CCallsign>>();
|
||||
qRegisterMetaTypeStreamOperators<BlackMisc::CCollection<CCallsign>>();
|
||||
qRegisterMetaType<CCallsignSet>();
|
||||
qDBusRegisterMetaType<CCallsignSet>();
|
||||
qRegisterMetaTypeStreamOperators<CCallsignSet>();
|
||||
registerMetaValueType<CCallsignSet>();
|
||||
}
|
||||
} // namespace
|
||||
|
||||
@@ -19,8 +19,6 @@ namespace BlackMisc::Aviation
|
||||
Mixin::MetaType<CComSystem>::registerMetadata();
|
||||
qDBusRegisterMetaType<ChannelSpacing>();
|
||||
qDBusRegisterMetaType<ComUnit>();
|
||||
qRegisterMetaTypeStreamOperators<ChannelSpacing>();
|
||||
qRegisterMetaTypeStreamOperators<ComUnit>();
|
||||
}
|
||||
|
||||
void CComSystem::setFrequencyActiveMHz(double frequencyMHz)
|
||||
|
||||
@@ -15,8 +15,6 @@
|
||||
#include <QMetaType>
|
||||
#include <QString>
|
||||
|
||||
class QStringList;
|
||||
|
||||
BLACK_DECLARE_VALUEOBJECT_MIXINS(BlackMisc::Aviation, CSelcal)
|
||||
namespace BlackMisc::PhysicalQuantities
|
||||
{
|
||||
|
||||
@@ -280,15 +280,13 @@ namespace BlackMisc
|
||||
|
||||
//! Remove the element pointed to by the given iterator.
|
||||
//! \return An iterator to the position of the next element after the one removed.
|
||||
//! \fixme Relying on implementation detail of QMap to reinterpret_cast to the necessary iterator type.
|
||||
iterator erase(iterator pos)
|
||||
{
|
||||
return m_impl.erase(const_cast<QMapNode<T, T> *&>(reinterpret_cast<const QMapNode<T, T> *&>(pos)));
|
||||
return m_impl.erase(pos);
|
||||
}
|
||||
|
||||
//! Remove the range of elements between two iterators.
|
||||
//! \return An iterator to the position of the next element after the one removed.
|
||||
//! \fixme Relying on implementation detail of QMap to reinterpret_cast to the necessary iterator type.
|
||||
iterator erase(iterator it1, iterator it2)
|
||||
{
|
||||
while (it1 != it2) { it1 = erase(it1); }
|
||||
|
||||
@@ -105,7 +105,7 @@ namespace BlackMisc
|
||||
}
|
||||
|
||||
//! Simplifies composition, returns 0 for performance
|
||||
friend uint qHash(const Derived &) { return 0; } // clazy:exclude=qhash-namespace
|
||||
friend size_t qHash(const Derived &) { return 0; } // clazy:exclude=qhash-namespace
|
||||
|
||||
//! \copydoc BlackMisc::Mixin::JsonByMetaClass::toJson
|
||||
QJsonObject toJson() const
|
||||
|
||||
@@ -1,30 +0,0 @@
|
||||
// SPDX-FileCopyrightText: Copyright (C) 2019 swift Project Community / Contributors
|
||||
// SPDX-License-Identifier: GPL-3.0-or-later OR LicenseRef-swift-pilot-client-1
|
||||
|
||||
//! \file
|
||||
|
||||
#ifndef BLACKMISC_DATASTREAM_H
|
||||
#define BLACKMISC_DATASTREAM_H
|
||||
|
||||
#include <QDataStream>
|
||||
#include <utility>
|
||||
|
||||
/*!
|
||||
* Operator for marshalling pairs with QDataStream.
|
||||
*/
|
||||
template <typename T, typename U>
|
||||
QDataStream &operator<<(QDataStream &stream, const std::pair<T, U> &pair)
|
||||
{
|
||||
return stream << pair.first << pair.second;
|
||||
}
|
||||
|
||||
/*!
|
||||
* Operator for unmarshalling pairs with QDataStream.
|
||||
*/
|
||||
template <typename T, typename U>
|
||||
QDataStream &operator>>(QDataStream &stream, std::pair<T, U> &pair)
|
||||
{
|
||||
return stream >> pair.first >> pair.second;
|
||||
}
|
||||
|
||||
#endif
|
||||
@@ -77,29 +77,6 @@ const QDBusArgument &operator>>(const QDBusArgument &arg, QFlags<T> &value)
|
||||
return arg;
|
||||
}
|
||||
|
||||
/*!
|
||||
* Operator for streaming pairs to QDBusArgument.
|
||||
*/
|
||||
template <class A, class B>
|
||||
QDBusArgument &operator<<(QDBusArgument &arg, const std::pair<A, B> &pair)
|
||||
{
|
||||
arg.beginStructure();
|
||||
arg << pair.first << pair.second;
|
||||
arg.endStructure();
|
||||
return arg;
|
||||
}
|
||||
|
||||
/*!
|
||||
* Operator for streaming pairs from QDBusArgument.
|
||||
*/
|
||||
template <class A, class B>
|
||||
const QDBusArgument &operator>>(const QDBusArgument &arg, std::pair<A, B> &pair)
|
||||
{
|
||||
arg.beginStructure();
|
||||
arg >> pair.first >> pair.second;
|
||||
arg.endStructure();
|
||||
return arg;
|
||||
}
|
||||
// *INDENT-ON*
|
||||
|
||||
//! Windows: prevents unloading of QtDBus shared library until the process is terminated.
|
||||
|
||||
@@ -9,7 +9,6 @@
|
||||
#include "blackmisc/containerbase.h"
|
||||
#include "blackmisc/mixin/mixindbus.h"
|
||||
#include "blackmisc/mixin/mixindatastream.h"
|
||||
#include "blackmisc/datastream.h"
|
||||
#include "blackmisc/inheritancetraits.h"
|
||||
#include "blackmisc/iterator.h"
|
||||
#include "blackmisc/mixin/mixinjson.h"
|
||||
|
||||
@@ -46,7 +46,7 @@ namespace BlackMisc
|
||||
m_logFile.setFileName(getLogFilePath());
|
||||
m_logFile.open(QIODevice::WriteOnly | QIODevice::Append | QIODevice::Text);
|
||||
m_stream.setDevice(&m_logFile);
|
||||
m_stream.setCodec("UTF-8");
|
||||
m_stream.setEncoding(QStringConverter::Utf8);
|
||||
writeHeaderToFile();
|
||||
}
|
||||
|
||||
|
||||
@@ -366,7 +366,7 @@ namespace BlackMisc
|
||||
|
||||
QFileInfo CFileUtils::findLastModified(const QDir &dir, bool recursive, const QStringList &nameFilters, const QStringList &excludeDirectories)
|
||||
{
|
||||
if (isExcludedDirectory(dir, excludeDirectories)) { return QString(); }
|
||||
if (isExcludedDirectory(dir, excludeDirectories)) { return {}; }
|
||||
const QFileInfoList files = enumerateFiles(dir, recursive, nameFilters, excludeDirectories);
|
||||
if (files.isEmpty()) { return {}; }
|
||||
|
||||
@@ -378,7 +378,7 @@ namespace BlackMisc
|
||||
|
||||
QFileInfo CFileUtils::findLastCreated(const QDir &dir, bool recursive, const QStringList &nameFilters, const QStringList &excludeDirectories)
|
||||
{
|
||||
if (isExcludedDirectory(dir, excludeDirectories)) { return QString(); }
|
||||
if (isExcludedDirectory(dir, excludeDirectories)) { return {}; }
|
||||
const QFileInfoList files = enumerateFiles(dir, recursive, nameFilters, excludeDirectories);
|
||||
if (files.isEmpty()) { return {}; }
|
||||
|
||||
|
||||
@@ -21,13 +21,10 @@ namespace BlackMisc
|
||||
{
|
||||
qRegisterMetaType<BlackMisc::CSequence<CIcon>>();
|
||||
qDBusRegisterMetaType<BlackMisc::CSequence<CIcon>>();
|
||||
qRegisterMetaTypeStreamOperators<BlackMisc::CSequence<CIcon>>();
|
||||
qRegisterMetaType<BlackMisc::CCollection<CIcon>>();
|
||||
qDBusRegisterMetaType<BlackMisc::CCollection<CIcon>>();
|
||||
qRegisterMetaTypeStreamOperators<BlackMisc::CCollection<CIcon>>();
|
||||
qRegisterMetaType<CIconList>();
|
||||
qDBusRegisterMetaType<CIconList>();
|
||||
qRegisterMetaTypeStreamOperators<CIconList>();
|
||||
registerMetaValueType<CIconList>();
|
||||
}
|
||||
} // ns
|
||||
|
||||
@@ -23,7 +23,6 @@ namespace BlackMisc::Input
|
||||
CKeyboardKey::registerMetadata();
|
||||
CKeyboardKeyList::registerMetadata();
|
||||
qDBusRegisterMetaType<KeyCode>();
|
||||
qRegisterMetaTypeStreamOperators<KeyCode>();
|
||||
}
|
||||
|
||||
} // ns
|
||||
|
||||
@@ -25,7 +25,6 @@
|
||||
|
||||
class QDateTime;
|
||||
class QPixmap;
|
||||
class QStringList;
|
||||
|
||||
/*!
|
||||
* \defgroup JSON Streaming operators for JSON
|
||||
|
||||
@@ -64,7 +64,6 @@ namespace BlackMisc
|
||||
{
|
||||
qRegisterMetaType<CLogCategoryList>();
|
||||
qDBusRegisterMetaType<CLogCategoryList>();
|
||||
qRegisterMetaTypeStreamOperators<CLogCategoryList>();
|
||||
registerMetaValueType<CLogCategoryList>();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -54,7 +54,7 @@ namespace BlackMisc
|
||||
struct EventFilter : public QAbstractNativeEventFilter
|
||||
{
|
||||
// Prevent Qt from handling Windows Messages while the messagebox is open
|
||||
virtual bool nativeEventFilter(const QByteArray &, void *message, long *result) override
|
||||
virtual bool nativeEventFilter(const QByteArray &, void *message, qintptr *result) override
|
||||
{
|
||||
auto msg = static_cast<MSG *>(message);
|
||||
*result = DefWindowProc(msg->hwnd, msg->message, msg->wParam, msg->lParam);
|
||||
|
||||
@@ -87,10 +87,10 @@
|
||||
// *INDENT-ON*
|
||||
|
||||
//! std::string qHash
|
||||
inline uint qHash(const std::string &key, uint seed) { return qHash(QString::fromStdString(key), seed); }
|
||||
inline size_t qHash(const std::string &key, uint seed) { return qHash(QString::fromStdString(key), seed); }
|
||||
|
||||
//! std::string qHash
|
||||
inline uint qHash(const std::string &key) { return qHash(QString::fromStdString(key)); }
|
||||
inline size_t qHash(const std::string &key) { return qHash(QString::fromStdString(key)); }
|
||||
|
||||
namespace BlackMisc
|
||||
{
|
||||
|
||||
@@ -46,27 +46,27 @@ namespace BlackMisc
|
||||
{
|
||||
public:
|
||||
//! qHash overload, needed for storing value in a QSet.
|
||||
friend uint qHash(const Derived &value, uint seed = 0) // clazy:exclude=qhash-namespace
|
||||
friend size_t qHash(const Derived &value, size_t seed = 0) // clazy:exclude=qhash-namespace
|
||||
{
|
||||
return ::qHash(hashImpl(value), seed);
|
||||
}
|
||||
|
||||
private:
|
||||
static uint hashImpl(const Derived &value);
|
||||
static size_t hashImpl(const Derived &value);
|
||||
|
||||
template <typename T>
|
||||
static uint baseHash(const T *base)
|
||||
static size_t baseHash(const T *base)
|
||||
{
|
||||
return qHash(*base);
|
||||
}
|
||||
static uint baseHash(const void *);
|
||||
static uint baseHash(const CEmpty *);
|
||||
static size_t baseHash(const void *);
|
||||
static size_t baseHash(const CEmpty *);
|
||||
};
|
||||
|
||||
template <class Derived>
|
||||
uint HashByMetaClass<Derived>::hashImpl(const Derived &value)
|
||||
size_t HashByMetaClass<Derived>::hashImpl(const Derived &value)
|
||||
{
|
||||
uint hash = baseHash(static_cast<const TBaseOfT<Derived> *>(&value));
|
||||
size_t hash = baseHash(static_cast<const TBaseOfT<Derived> *>(&value));
|
||||
introspect<Derived>().forEachMember([&](auto member) {
|
||||
if constexpr (!decltype(member)::has(MetaFlags<DisabledForHashing>()))
|
||||
{
|
||||
@@ -77,13 +77,13 @@ namespace BlackMisc
|
||||
}
|
||||
|
||||
template <class Derived>
|
||||
uint HashByMetaClass<Derived>::baseHash(const void *)
|
||||
size_t HashByMetaClass<Derived>::baseHash(const void *)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
template <class Derived>
|
||||
uint HashByMetaClass<Derived>::baseHash(const CEmpty *)
|
||||
size_t HashByMetaClass<Derived>::baseHash(const CEmpty *)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -41,9 +41,7 @@ namespace BlackMisc
|
||||
CConnectionStatus::registerMetadata();
|
||||
CClient::registerMetadata();
|
||||
qDBusRegisterMetaType<BlackMisc::Network::CClient::Capability>();
|
||||
qRegisterMetaTypeStreamOperators<BlackMisc::Network::CClient::Capability>();
|
||||
qDBusRegisterMetaType<BlackMisc::Network::CClient::Capabilities>();
|
||||
qRegisterMetaTypeStreamOperators<BlackMisc::Network::CClient::Capabilities>();
|
||||
CClientList::registerMetadata();
|
||||
CEcosystem::registerMetadata();
|
||||
CEcosystemList::registerMetadata();
|
||||
|
||||
@@ -124,7 +124,7 @@ namespace BlackMisc::Network
|
||||
{
|
||||
const int pos = match.capturedStart(0);
|
||||
const QString icao = match.captured(0).trimmed().right(4);
|
||||
rn = rn.leftRef(pos).trimmed().toString();
|
||||
rn = QStringView { rn }.left(pos).trimmed().toString();
|
||||
this->setHomeBase(CAirportIcaoCode(icao));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -65,13 +65,10 @@ namespace BlackMisc
|
||||
{
|
||||
qRegisterMetaType<BlackMisc::CSequence<CPlatform>>();
|
||||
qDBusRegisterMetaType<BlackMisc::CSequence<CPlatform>>();
|
||||
qRegisterMetaTypeStreamOperators<BlackMisc::CSequence<CPlatform>>();
|
||||
qRegisterMetaType<BlackMisc::CCollection<CPlatform>>();
|
||||
qDBusRegisterMetaType<BlackMisc::CCollection<CPlatform>>();
|
||||
qRegisterMetaTypeStreamOperators<BlackMisc::CCollection<CPlatform>>();
|
||||
qRegisterMetaType<CPlatformSet>();
|
||||
qDBusRegisterMetaType<CPlatformSet>();
|
||||
qRegisterMetaTypeStreamOperators<CPlatformSet>();
|
||||
registerMetaValueType<CPlatformSet>();
|
||||
}
|
||||
} // namespace
|
||||
|
||||
@@ -65,10 +65,10 @@ namespace BlackMisc::PhysicalQuantities
|
||||
}
|
||||
|
||||
QString str = QStringLiteral("%1").arg(dms, 14, 'f', 10, '0'); // 000.0000000000
|
||||
values.deg = str.midRef(0, 3).toInt();
|
||||
values.min = str.midRef(4, 2).toInt();
|
||||
values.sec = str.midRef(6, 2).toInt();
|
||||
values.fractionalSec = str.midRef(8, 6).toInt() / 1000000.0;
|
||||
values.deg = QStringView { str }.mid(0, 3).toInt();
|
||||
values.min = QStringView { str }.mid(4, 2).toInt();
|
||||
values.sec = QStringView { str }.mid(6, 2).toInt();
|
||||
values.fractionalSec = QStringView { str }.mid(8, 6).toInt() / 1000000.0;
|
||||
return values;
|
||||
}
|
||||
|
||||
|
||||
@@ -291,7 +291,7 @@ namespace BlackMisc::PhysicalQuantities
|
||||
}
|
||||
|
||||
//! \copydoc CValueObject::qHash
|
||||
friend uint qHash(const CMeasurementUnit &unit)
|
||||
friend size_t qHash(const CMeasurementUnit &unit)
|
||||
{
|
||||
return ::qHash(unit.getName());
|
||||
}
|
||||
|
||||
@@ -423,7 +423,7 @@ namespace BlackMisc::PhysicalQuantities
|
||||
}
|
||||
|
||||
template <class MU, class PQ>
|
||||
uint CPhysicalQuantity<MU, PQ>::getValueHash() const
|
||||
size_t CPhysicalQuantity<MU, PQ>::getValueHash() const
|
||||
{
|
||||
// there is no double qHash
|
||||
// also unit and rounding has to be considered
|
||||
|
||||
@@ -301,10 +301,10 @@ namespace BlackMisc::PhysicalQuantities
|
||||
void unmarshalFromDataStream(QDataStream &stream);
|
||||
|
||||
//! \copydoc BlackMisc::Mixin::HashByMetaClass::qHash
|
||||
uint getValueHash() const;
|
||||
size_t getValueHash() const;
|
||||
|
||||
//! \copydoc CValueObject::qHash
|
||||
friend uint qHash(const PQ &pq) { return pq.getValueHash(); } // clazy:exclude=qhash-namespace
|
||||
friend size_t qHash(const PQ &pq) { return pq.getValueHash(); } // clazy:exclude=qhash-namespace
|
||||
|
||||
//! \copydoc BlackMisc::Mixin::JsonByMetaClass::toJson
|
||||
QJsonObject toJson() const;
|
||||
|
||||
@@ -60,10 +60,10 @@ namespace BlackMisc::PhysicalQuantities
|
||||
|
||||
if (ts.contains(":") && (ts.length() == 8 || ts.length() == 5))
|
||||
{
|
||||
const int hour = ts.midRef(0, 2).toInt();
|
||||
const int minute = ts.midRef(3, 2).toInt();
|
||||
const int hour = QStringView { ts }.mid(0, 2).toInt();
|
||||
const int minute = QStringView { ts }.mid(3, 2).toInt();
|
||||
int second = 0;
|
||||
if (ts.length() == 8) second = ts.midRef(6, 2).toInt();
|
||||
if (ts.length() == 8) second = QStringView { ts }.mid(6, 2).toInt();
|
||||
(*this) = CTime(hour, minute, second);
|
||||
|
||||
// fix sign if required
|
||||
|
||||
@@ -16,10 +16,7 @@ namespace BlackMisc
|
||||
CPropertyIndex::CPropertyIndex(std::initializer_list<int> il) : m_indexes(il)
|
||||
{}
|
||||
|
||||
CPropertyIndex::CPropertyIndex(const QVector<int> &indexes) : m_indexes(indexes)
|
||||
{}
|
||||
|
||||
CPropertyIndex::CPropertyIndex(const QList<int> &indexes) : m_indexes(indexes.toVector())
|
||||
CPropertyIndex::CPropertyIndex(const QList<int> &indexes) : m_indexes(indexes)
|
||||
{}
|
||||
|
||||
CPropertyIndex::CPropertyIndex(const QString &indexes)
|
||||
@@ -73,7 +70,7 @@ namespace BlackMisc
|
||||
{
|
||||
m_indexes.clear();
|
||||
if (indexes.isEmpty()) { return; }
|
||||
for (const QStringRef &index : indexes.splitRef(';'))
|
||||
for (const auto &index : QStringView { indexes }.split(';'))
|
||||
{
|
||||
if (index.isEmpty()) { continue; }
|
||||
bool ok;
|
||||
@@ -98,14 +95,9 @@ namespace BlackMisc
|
||||
this->parseFromString(value.toString());
|
||||
}
|
||||
|
||||
QVector<int> CPropertyIndex::indexVector() const
|
||||
{
|
||||
return m_indexes;
|
||||
}
|
||||
|
||||
QList<int> CPropertyIndex::indexList() const
|
||||
{
|
||||
return m_indexes.toList();
|
||||
return m_indexes;
|
||||
}
|
||||
|
||||
void CPropertyIndex::prepend(int newLeftIndex)
|
||||
|
||||
@@ -54,9 +54,6 @@ namespace BlackMisc
|
||||
//! Initializer list constructor
|
||||
CPropertyIndex(std::initializer_list<int> il);
|
||||
|
||||
//! Construct from a vector of indexes.
|
||||
CPropertyIndex(const QVector<int> &indexes);
|
||||
|
||||
//! Construct from a list of indexes.
|
||||
CPropertyIndex(const QList<int> &indexes);
|
||||
|
||||
@@ -78,9 +75,6 @@ namespace BlackMisc
|
||||
//! Empty?
|
||||
bool isEmpty() const;
|
||||
|
||||
//! Index vector
|
||||
QVector<int> indexVector() const;
|
||||
|
||||
//! Index list
|
||||
QList<int> indexList() const;
|
||||
|
||||
@@ -162,7 +156,7 @@ namespace BlackMisc
|
||||
void parseFromString(const QString &indexes);
|
||||
|
||||
private:
|
||||
QVector<int> m_indexes;
|
||||
QList<int> m_indexes;
|
||||
|
||||
BLACK_METACLASS(
|
||||
CPropertyIndex,
|
||||
|
||||
@@ -140,7 +140,7 @@ namespace BlackMisc
|
||||
return m_values.size();
|
||||
}
|
||||
|
||||
uint CPropertyIndexVariantMap::getValueHash() const
|
||||
size_t CPropertyIndexVariantMap::getValueHash() const
|
||||
{
|
||||
// there is no hash for map, so I use this workaround here
|
||||
return qHash(this->toQString(false));
|
||||
|
||||
@@ -117,10 +117,10 @@ namespace BlackMisc
|
||||
const QMap<CPropertyIndex, CVariant> &map() const { return m_values; }
|
||||
|
||||
//! Hash value
|
||||
uint getValueHash() const;
|
||||
size_t getValueHash() const;
|
||||
|
||||
//! \copydoc CValueObject::qHash
|
||||
friend uint qHash(const CPropertyIndexVariantMap &vm) { return vm.getValueHash(); }
|
||||
friend size_t qHash(const CPropertyIndexVariantMap &vm) { return vm.getValueHash(); }
|
||||
|
||||
//! \copydoc BlackMisc::Mixin::String::toQString
|
||||
QString convertToQString(bool i18n = false) const;
|
||||
|
||||
@@ -96,7 +96,6 @@ namespace BlackMisc
|
||||
|
||||
// needed by xswiftbus proxy class
|
||||
qDBusRegisterMetaType<CSequence<double>>();
|
||||
qRegisterMetaTypeStreamOperators<CSequence<double>>();
|
||||
}
|
||||
|
||||
} // ns
|
||||
|
||||
@@ -125,14 +125,11 @@ namespace BlackMisc
|
||||
//! Initializer list constructor.
|
||||
CSequence(std::initializer_list<T> il) : m_impl(il) {}
|
||||
|
||||
//! By QVector of type T.
|
||||
CSequence(const QVector<T> &vector) : m_impl(vector) {}
|
||||
|
||||
//! By QVector of type T.
|
||||
CSequence(QVector<T> &&vector) : m_impl(std::move(vector)) {}
|
||||
//! By QList of type T.
|
||||
CSequence(QList<T> &&list) : m_impl(std::move(list)) {}
|
||||
|
||||
//! By QList of type T.
|
||||
CSequence(const QList<T> &list) : m_impl(list.toVector()) {}
|
||||
CSequence(const QList<T> &list) : m_impl(list) {}
|
||||
|
||||
//! Range constructor.
|
||||
template <typename It>
|
||||
@@ -702,7 +699,7 @@ namespace BlackMisc
|
||||
void unmarshalFromDataStream(QDataStream &stream) { stream >> m_impl; }
|
||||
|
||||
private:
|
||||
QVector<T> m_impl;
|
||||
QList<T> m_impl;
|
||||
};
|
||||
} // namespace BlackMisc
|
||||
|
||||
|
||||
@@ -42,8 +42,6 @@ namespace BlackMisc
|
||||
operator QSet<T>() && { return convertTo<QSet>(sortAndDeduplicate(std::move(m_list))); }
|
||||
operator std::set<T>() const & { return convertTo<std::set>(sortAndDeduplicate(m_list)); }
|
||||
operator std::set<T>() && { return convertTo<std::set>(sortAndDeduplicate(std::move(m_list))); }
|
||||
operator QVector<T>() const & { return convertTo<QVector>(sortAndDeduplicate(m_list)); }
|
||||
operator QVector<T>() && { return convertTo<QVector>(sortAndDeduplicate(std::move(m_list))); }
|
||||
operator std::vector<T>() const & { return convertTo<std::vector>(sortAndDeduplicate(m_list)); }
|
||||
operator std::vector<T>() && { return convertTo<std::vector>(sortAndDeduplicate(std::move(m_list))); }
|
||||
template <typename U = T, typename = std::enable_if_t<std::is_same_v<U, QString>>>
|
||||
|
||||
@@ -18,9 +18,9 @@ namespace BlackMisc::SharedState
|
||||
{
|
||||
CPromise<CVariant> promise;
|
||||
emit requestPosted(param, promise);
|
||||
doAfter(promise.future(), this, [callback = std::move(callback), weakRef = weakRef()](const CVariant &reply) {
|
||||
doAfter(promise.future(), this, [callback = std::move(callback), weakRef = weakRef()](const QFuture<CVariant> &reply) {
|
||||
const auto lock = weakRef.lock();
|
||||
if (lock) { callback(reply); }
|
||||
if (lock) { callback(reply.result()); }
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
@@ -29,7 +29,7 @@ namespace BlackMisc::SharedState::DBus
|
||||
{
|
||||
const auto token = getToken();
|
||||
auto future = m_receivedRequests.insert(token, {})->future();
|
||||
emit requestReceived(channel, param, token, {});
|
||||
emit requestReceived(channel, param, token, QPrivateSignal {});
|
||||
return future;
|
||||
}
|
||||
|
||||
|
||||
@@ -430,13 +430,13 @@ namespace BlackMisc::Simulation::FsCommon
|
||||
|
||||
// Remove inline comments starting with ;
|
||||
const int indexComment = line.indexOf(';');
|
||||
QString content = line.leftRef(indexComment - 1).trimmed().toString();
|
||||
QString content = QStringView { line }.left(indexComment - 1).trimmed().toString();
|
||||
|
||||
const int index = line.indexOf('=');
|
||||
if (index < 0) { return {}; }
|
||||
if (line.length() < index + 1) { return {}; }
|
||||
|
||||
content = content.midRef(index + 1).trimmed().toString();
|
||||
content = QStringView { content }.mid(index + 1).trimmed().toString();
|
||||
|
||||
// fix "" strings, some are malformed and just contain " at beginning, not at the end
|
||||
if (hasBalancedQuotes(content, '"'))
|
||||
|
||||
@@ -457,7 +457,7 @@ namespace BlackMisc::Simulation::FsCommon
|
||||
if (!correctPath) { continue; }
|
||||
|
||||
// absolute or relative path
|
||||
const QString fp = pathValue.leftRef(3).contains(':') ?
|
||||
const QString fp = QStringView { pathValue }.left(3).contains(':') ?
|
||||
pathValue :
|
||||
CFileUtils::appendFilePaths(addOnPath, pathValue);
|
||||
if (CFsDirectories::logConfigPathReading()) { CLogMessage(static_cast<CFsDirectories *>(nullptr)).info(u"Testing '%1' as addon path: '%2'") << fp << addOnPath; }
|
||||
@@ -542,7 +542,7 @@ namespace BlackMisc::Simulation::FsCommon
|
||||
if (containsAny(soPath, CFsDirectories::fsxSimObjectsExcludeDirectoryPatterns(), Qt::CaseInsensitive)) { continue; }
|
||||
|
||||
// make absolute
|
||||
if (!soPath.leftRef(3).contains(':')) { soPath = CFileUtils::appendFilePaths(relPath, soPath); }
|
||||
if (!QStringView { soPath }.left(3).contains(':')) { soPath = CFileUtils::appendFilePaths(relPath, soPath); }
|
||||
|
||||
const QDir dir(soPath); // always absolute path now
|
||||
if (checked && !dir.exists())
|
||||
|
||||
@@ -61,7 +61,7 @@ namespace BlackMisc::Simulation
|
||||
CInterpolationLogger *logger = nullptr);
|
||||
|
||||
//! Has interpolator initialized?
|
||||
bool hasInterpolator() const { return m_interpolator; }
|
||||
bool hasInterpolator() const { return !m_interpolator.isNull(); }
|
||||
|
||||
//! Interpolator
|
||||
CInterpolatorMulti *interpolator() const { return m_interpolator.data(); }
|
||||
|
||||
@@ -92,16 +92,6 @@ namespace BlackMisc::Simulation
|
||||
qDBusRegisterMetaType<MatchingLog>();
|
||||
qDBusRegisterMetaType<ReverseLookupLoggingFlag>();
|
||||
qDBusRegisterMetaType<ReverseLookupLogging>();
|
||||
|
||||
qRegisterMetaTypeStreamOperators<CSimulatorSettings::CGSource>();
|
||||
qRegisterMetaTypeStreamOperators<CInterpolationAndRenderingSetupBase::InterpolatorMode>();
|
||||
qRegisterMetaTypeStreamOperators<CAircraftMatcherSetup::MatchingAlgorithm>();
|
||||
qRegisterMetaTypeStreamOperators<CAircraftMatcherSetup::MatchingModeFlag>();
|
||||
qRegisterMetaTypeStreamOperators<MatchingLogFlag>();
|
||||
qRegisterMetaTypeStreamOperators<MatchingLog>();
|
||||
qRegisterMetaTypeStreamOperators<CAircraftMatcherSetup::PickSimilarStrategy>();
|
||||
qRegisterMetaTypeStreamOperators<ReverseLookupLoggingFlag>();
|
||||
qRegisterMetaTypeStreamOperators<ReverseLookupLogging>();
|
||||
}
|
||||
|
||||
} // ns
|
||||
|
||||
@@ -80,7 +80,6 @@ namespace BlackMisc::Simulation
|
||||
{
|
||||
qRegisterMetaType<BlackMisc::Simulation::CSimulatorInternals>();
|
||||
qDBusRegisterMetaType<BlackMisc::Simulation::CSimulatorInternals>();
|
||||
qRegisterMetaTypeStreamOperators<BlackMisc::Simulation::CSimulatorInternals>();
|
||||
registerMetaValueType<BlackMisc::Simulation::CSimulatorInternals>();
|
||||
}
|
||||
|
||||
|
||||
@@ -30,7 +30,7 @@ namespace BlackMisc
|
||||
QString &temp = t_tempBuffer.localData();
|
||||
temp.resize(0); // unlike clear(), resize(0) doesn't release the capacity if there are no implicitly shared copies
|
||||
|
||||
quint64 unusedArgs = (1ULL << std::min(63, args.size())) - 1;
|
||||
quint64 unusedArgs = (1ULL << std::min(qsizetype(63), args.size())) - 1;
|
||||
for (auto it = format.begin();;)
|
||||
{
|
||||
const auto pc = std::find(it, format.end(), u'%');
|
||||
@@ -321,7 +321,6 @@ namespace BlackMisc
|
||||
CValueObject<CStatusMessage>::registerMetadata();
|
||||
qRegisterMetaType<CStatusMessage::StatusSeverity>();
|
||||
qDBusRegisterMetaType<CStatusMessage::StatusSeverity>();
|
||||
qRegisterMetaTypeStreamOperators<CStatusMessage::StatusSeverity>();
|
||||
}
|
||||
|
||||
CStatusMessage::StatusSeverity CStatusMessage::stringToSeverity(const QString &severity)
|
||||
|
||||
@@ -110,7 +110,7 @@ namespace BlackMisc
|
||||
friend int compare(const CStrongStringView &a, const CStrongStringView &b) { return a.m_view.compare(b.m_view); }
|
||||
|
||||
//! Hash value.
|
||||
friend uint qHash(const CStrongStringView &obj, uint seed = 0) { return ::qHash(obj.m_view, seed); }
|
||||
friend size_t qHash(const CStrongStringView &obj, uint seed = 0) { return ::qHash(obj.m_view, seed); }
|
||||
|
||||
//! @{
|
||||
//! DBus marshalling.
|
||||
|
||||
@@ -382,9 +382,9 @@ namespace BlackMisc
|
||||
|
||||
// yyyyMMddHHmmsszzz
|
||||
// 01234567890123456
|
||||
int year(dateTimeString.leftRef(4).toInt());
|
||||
int month(dateTimeString.midRef(4, 2).toInt());
|
||||
int day(dateTimeString.midRef(6, 2).toInt());
|
||||
int year(QStringView { dateTimeString }.left(4).toInt());
|
||||
int month(QStringView { dateTimeString }.mid(4, 2).toInt());
|
||||
int day(QStringView { dateTimeString }.mid(6, 2).toInt());
|
||||
QDate date;
|
||||
date.setDate(year, month, day);
|
||||
QDateTime dt;
|
||||
@@ -393,10 +393,10 @@ namespace BlackMisc
|
||||
if (dateTimeString.length() < 12) { return dt; }
|
||||
|
||||
QTime t;
|
||||
const int hour(dateTimeString.midRef(8, 2).toInt());
|
||||
const int minute(dateTimeString.midRef(10, 2).toInt());
|
||||
const int second(dateTimeString.length() < 14 ? 0 : dateTimeString.midRef(12, 2).toInt());
|
||||
const int ms(dateTimeString.length() < 17 ? 0 : dateTimeString.rightRef(3).toInt());
|
||||
const int hour(QStringView { dateTimeString }.mid(8, 2).toInt());
|
||||
const int minute(QStringView { dateTimeString }.mid(10, 2).toInt());
|
||||
const int second(dateTimeString.length() < 14 ? 0 : QStringView { dateTimeString }.mid(12, 2).toInt());
|
||||
const int ms(dateTimeString.length() < 17 ? 0 : QStringView { dateTimeString }.right(3).toInt());
|
||||
|
||||
t.setHMS(hour, minute, second, ms);
|
||||
dt.setTime(t);
|
||||
|
||||
@@ -140,7 +140,6 @@ namespace BlackMisc
|
||||
{
|
||||
MetaType::registerMetadata();
|
||||
qDBusRegisterMetaType<value_type>();
|
||||
qRegisterMetaTypeStreamOperators<value_type>();
|
||||
}
|
||||
|
||||
////////////////////////////////
|
||||
|
||||
@@ -21,6 +21,7 @@
|
||||
#include <QTime>
|
||||
#include <Qt>
|
||||
#include <QtDebug>
|
||||
#include <QDataStream>
|
||||
|
||||
namespace BlackMisc
|
||||
{
|
||||
@@ -29,7 +30,7 @@ namespace BlackMisc
|
||||
|
||||
Private::IValueObjectMetaInfo *Private::getValueObjectMetaInfo(int typeId)
|
||||
{
|
||||
return getValueObjectMetaInfo(QVariant(typeId, nullptr));
|
||||
return getValueObjectMetaInfo(QVariant(QMetaType(typeId), nullptr));
|
||||
}
|
||||
|
||||
Private::IValueObjectMetaInfo *Private::getValueObjectMetaInfo(const QVariant &v)
|
||||
@@ -49,7 +50,7 @@ namespace BlackMisc
|
||||
}
|
||||
if (userType() == qMetaTypeId_CVariantList)
|
||||
{
|
||||
return QVariant::fromValue(QVector<CVariant>()).canConvert(typeId) || QVariant(typeId, nullptr).canConvert<QVariantList>();
|
||||
return QVariant::fromValue(QVector<CVariant>()).canConvert(typeId) || QVariant(QMetaType(typeId), nullptr).canConvert<QVariantList>();
|
||||
}
|
||||
return false;
|
||||
}
|
||||
@@ -167,9 +168,10 @@ namespace BlackMisc
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
if (a.m_v < b.m_v) { return -1; }
|
||||
if (a.m_v > b.m_v) { return 1; }
|
||||
return 0;
|
||||
const QPartialOrdering order = QVariant::compare(a.m_v, b.m_v);
|
||||
if (order == QPartialOrdering::Less) { return -1; }
|
||||
if (order == QPartialOrdering::Greater) { return 1; }
|
||||
return 0; // for "Equivalent" and "Unordered"
|
||||
}
|
||||
|
||||
QJsonObject CVariant::toJson() const
|
||||
@@ -264,12 +266,12 @@ namespace BlackMisc
|
||||
{
|
||||
CJsonScope scope("value"); // tracker
|
||||
Q_UNUSED(scope);
|
||||
m_v = QVariant(typeId, nullptr);
|
||||
m_v = QVariant(QMetaType(typeId), nullptr);
|
||||
|
||||
// this will call convertFromJson if there is no MemoizedJson
|
||||
meta->convertFromMemoizedJson(value.toObject(), data(), true);
|
||||
}
|
||||
else if (QMetaType::hasRegisteredConverterFunction(qMetaTypeId<QString>(), typeId))
|
||||
else if (QMetaType::hasRegisteredConverterFunction(QMetaType(qMetaTypeId<QString>()), QMetaType(typeId)))
|
||||
{
|
||||
m_v.setValue(value.toString());
|
||||
if (!m_v.convert(typeId))
|
||||
@@ -347,7 +349,7 @@ namespace BlackMisc
|
||||
if (value.isUndefined()) { throw CJsonException("Missing 'value'"); }
|
||||
|
||||
CJsonScope scope("value");
|
||||
m_v = QVariant(typeId, nullptr);
|
||||
m_v = QVariant(QMetaType(typeId), nullptr);
|
||||
meta->convertFromMemoizedJson(value.toObject(), data(), allowFallbackToJson);
|
||||
}
|
||||
catch (const Private::CVariantException &ex)
|
||||
@@ -374,7 +376,7 @@ namespace BlackMisc
|
||||
return {};
|
||||
}
|
||||
|
||||
uint CVariant::getValueHash() const
|
||||
size_t CVariant::getValueHash() const
|
||||
{
|
||||
switch (m_v.type())
|
||||
{
|
||||
@@ -607,7 +609,7 @@ namespace BlackMisc
|
||||
}
|
||||
else
|
||||
{
|
||||
QVariant valueVariant(localUserType, nullptr);
|
||||
QVariant valueVariant(QMetaType(localUserType), nullptr);
|
||||
auto *meta = Private::getValueObjectMetaInfo(valueVariant);
|
||||
if (meta)
|
||||
{
|
||||
|
||||
@@ -95,10 +95,10 @@ namespace BlackMisc
|
||||
CVariant(const char *string) : m_v(string) {}
|
||||
|
||||
//! Construct a variant from the given type and opaque pointer.
|
||||
CVariant(int typeId, const void *copy) : m_v(typeId, copy) {}
|
||||
CVariant(int typeId, const void *copy) : m_v(QMetaType(typeId), copy) {}
|
||||
|
||||
//! \copydoc CValueObject::qHash
|
||||
friend uint qHash(const CVariant &var) { return var.getValueHash(); }
|
||||
friend size_t qHash(const CVariant &var) { return var.getValueHash(); }
|
||||
|
||||
//! Change the internal QVariant.
|
||||
void reset(const QVariant &var) { m_v = var; }
|
||||
@@ -335,7 +335,7 @@ namespace BlackMisc
|
||||
const void *data() const { return m_v.data(); }
|
||||
|
||||
static int compareImpl(const CVariant &, const CVariant &);
|
||||
uint getValueHash() const;
|
||||
size_t getValueHash() const;
|
||||
|
||||
template <typename T>
|
||||
T to(tag<T>) const
|
||||
@@ -350,11 +350,6 @@ namespace BlackMisc
|
||||
return toImpl<QList<T>>();
|
||||
}
|
||||
template <typename T>
|
||||
QVector<T> to(tag<QVector<T>>) const
|
||||
{
|
||||
return toImpl<QVector<T>>();
|
||||
}
|
||||
template <typename T>
|
||||
CSequence<T> to(tag<CSequence<T>>) const
|
||||
{
|
||||
return toImpl<CSequence<T>>();
|
||||
@@ -388,7 +383,7 @@ namespace BlackMisc::Private
|
||||
{
|
||||
if constexpr (canConvertVariantList<T>(0))
|
||||
{
|
||||
if (QMetaType::hasRegisteredConverterFunction(qMetaTypeId<T>(), qMetaTypeId<QVector<CVariant>>())) { return; }
|
||||
if (QMetaType::hasRegisteredConverterFunction(QMetaType(qMetaTypeId<T>()), QMetaType(qMetaTypeId<QVector<CVariant>>()))) { return; }
|
||||
|
||||
QMetaType::registerConverter<T, QVector<CVariant>>([](const T &list) -> QVector<CVariant> {
|
||||
return list.transform([](const typename T::value_type &v) { return CVariant::from(v); });
|
||||
|
||||
@@ -41,7 +41,7 @@ namespace BlackMisc
|
||||
virtual QJsonObject toMemoizedJson(const void *object) const = 0;
|
||||
virtual void convertFromMemoizedJson(const QJsonObject &json, void *object, bool allowFallbackToJson) const = 0;
|
||||
virtual void unmarshall(const QDBusArgument &arg, void *object) const = 0;
|
||||
virtual uint getValueHash(const void *object) const = 0;
|
||||
virtual size_t getValueHash(const void *object) const = 0;
|
||||
virtual int getMetaTypeId() const = 0;
|
||||
virtual const void *upCastTo(const void *object, int metaTypeId) const = 0;
|
||||
virtual int compareImpl(const void *lhs, const void *rhs) const = 0;
|
||||
@@ -124,12 +124,12 @@ namespace BlackMisc
|
||||
}
|
||||
|
||||
template <typename T>
|
||||
static uint getValueHash(const T &object, decltype(static_cast<void>(qHash(object)), 0))
|
||||
static size_t getValueHash(const T &object, decltype(static_cast<void>(qHash(object)), 0))
|
||||
{
|
||||
return qHash(object);
|
||||
}
|
||||
template <typename T>
|
||||
static uint getValueHash(const T &object, ...)
|
||||
static size_t getValueHash(const T &object, ...)
|
||||
{
|
||||
throw CVariantException(object, "getValueHash");
|
||||
}
|
||||
@@ -218,7 +218,7 @@ namespace BlackMisc
|
||||
virtual QJsonObject toMemoizedJson(const void *object) const override;
|
||||
virtual void convertFromMemoizedJson(const QJsonObject &json, void *object, bool allowFallbackToJson) const override;
|
||||
virtual void unmarshall(const QDBusArgument &arg, void *object) const override;
|
||||
virtual uint getValueHash(const void *object) const override;
|
||||
virtual size_t getValueHash(const void *object) const override;
|
||||
virtual int getMetaTypeId() const override;
|
||||
virtual const void *upCastTo(const void *object, int metaTypeId) const override;
|
||||
virtual int compareImpl(const void *lhs, const void *rhs) const override;
|
||||
@@ -275,7 +275,7 @@ namespace BlackMisc
|
||||
arg >> cast(object);
|
||||
}
|
||||
template <typename T>
|
||||
uint CValueObjectMetaInfo<T>::getValueHash(const void *object) const
|
||||
size_t CValueObjectMetaInfo<T>::getValueHash(const void *object) const
|
||||
{
|
||||
return CValueObjectMetaInfoHelper::getValueHash(cast(object), 0);
|
||||
}
|
||||
@@ -384,7 +384,6 @@ namespace BlackMisc
|
||||
{
|
||||
qRegisterMetaType<T>();
|
||||
qDBusRegisterMetaType<T>();
|
||||
qRegisterMetaTypeStreamOperators<T>();
|
||||
registerMetaValueType<T>();
|
||||
maybeRegisterMetaList();
|
||||
}
|
||||
|
||||
@@ -68,7 +68,7 @@ namespace BlackMisc
|
||||
worker->setStarted();
|
||||
auto *thread = new CRegularThread(owner);
|
||||
|
||||
if (typeId != QMetaType::Void) { worker->m_result = QVariant(typeId, nullptr); }
|
||||
if (typeId != QMetaType::Void) { worker->m_result = QVariant(QMetaType(typeId), nullptr); }
|
||||
|
||||
const QString ownerName = owner->objectName().isEmpty() ? owner->metaObject()->className() : owner->objectName();
|
||||
thread->setObjectName(ownerName + ":" + name);
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user