Compare commits

...

32 Commits

Author SHA1 Message Date
Dirk Hohndel
da4668da40 macOS: fix broken .pc file for libmtp
This has bugged me forever. The existing file creates a warning on every single
compiler invocation. I really need to figure out if I can get this fixed
upstream. But while I'm at it, I submitted it here to make it easier to spot
warnings in the build output.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2022-02-10 18:09:33 -08:00
Dirk Hohndel
e92d19ac4f macOS: warn about harmless but annoying errors on M1 Macs
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2022-02-10 17:03:47 -08:00
Dirk Hohndel
f0e4f78b5e Qt6: more QtLocation dependent parts in the CMakeLists.txt
These didn't really cause errors, but they were simply wrong to have there.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2022-02-10 17:03:47 -08:00
Dirk Hohndel
aaebb69ddb Qt6: more CMakeLists.txt cleanup
We used yet another version dependent variable. This one is even weirder as it is
an undocumented one.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2022-02-10 17:03:47 -08:00
Dirk Hohndel
75fca8c090 Qt6: fully define dive structure
With Qt the forward declaration fails as the export to QML for the statistics requires
the MOC code to be able to determine the sizeof(struct dive).

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2022-02-10 17:03:47 -08:00
Dirk Hohndel
2af3da96a7 Qt6: small API changes
A member function had a minute name change.

The SceneGraphBackend is now set via a string argument, not a magic constant.
Thankfully that appears to be backwards compatible.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2022-02-10 17:03:47 -08:00
Dirk Hohndel
da44db1a7e Qt6: add include files to keep QVectorIterator working
The QVectorIterator is only available in Qt6 when you explicitly add the
include files.

Suggested-by: Thiago Macieira <thiago@macieira.org>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2022-02-10 17:03:47 -08:00
Dirk Hohndel
7034d8bd54 Qt6: if we want the QString argument we need the TextChanged slot
I'm surprised this worked correctly in Qt5.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2022-02-10 17:03:47 -08:00
Dirk Hohndel
5654b3fd2e Qt6: move connection into C++ source
This no longer compiles when defined in the .ui file. But functionally this
should be the same and it should work on Qt5 and Qt6.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2022-02-10 17:03:47 -08:00
Dirk Hohndel
4f08d643b9 Qt6: add required QFile header
This worked without that include in Qt5, but having it there doesn't hurt,
either, so instead of yet another conditional compile, let's just include it
everywhere.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2022-02-10 17:03:47 -08:00
Dirk Hohndel
5a023c953b Qt6: the help button is now opt in instead of opt out
This seems much more reasonable.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2022-02-10 17:03:47 -08:00
Dirk Hohndel
214cd63836 Qt6: add missing includes
This class is only available via Qt5 compatibility and for that we need the
explicit include.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2022-02-10 17:03:47 -08:00
Dirk Hohndel
cabc33a689 Qt6: deal with changed QtConcurrent::run API
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2022-02-10 17:03:47 -08:00
Dirk Hohndel
e5f62bcd62 Qt6: adjust for changed argument types
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2022-02-10 17:03:46 -08:00
Dirk Hohndel
7574d8c04a Qt6: deal with changes to window and layout geometry APIs
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2022-02-10 17:03:46 -08:00
Dirk Hohndel
a9777f2980 Qt6: update to newer APIs for QDateTime
Fortunately, these were already available in Qt5.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2022-02-10 17:03:46 -08:00
Dirk Hohndel
55992bc975 Qt6: Bluetooth API changes
Use the explicit QBluetoothUuid instead of just QUuid and deal with new
constants and signal names.
At least with Qt6 we no longer need the ugly QOverload hack.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2022-02-10 17:03:46 -08:00
Dirk Hohndel
04b26d31c8 Qt6: deal with changes from QStringRef to QStringView
QStringRef is gone in Qt6 and mostly replaced by QStringView.  The one major
difference is that direct comparisons with string literals are no longer
possible.

Thanks to Thiago Macieira for helping me avoid more conditional compilation
here.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2022-02-10 17:03:46 -08:00
Dirk Hohndel
14362c2f55 Qt6: don't build MapWidget
Since Qt6 doesn't include QtLocation anymore, we can't build MapWidget.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2022-02-10 09:00:40 -08:00
Dirk Hohndel
caf06f9ae7 cleanup: fix incorrect QFuture return value
I'm a abit confused why that didn't cause an error with Qt5.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2022-02-10 09:00:35 -08:00
Dirk Hohndel
fd38204b81 cleanup: don't add QKeySequence values
These should be handled as logical OR operations as they are bits.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2022-02-10 09:00:30 -08:00
Dirk Hohndel
3f3da0cf75 cleanup: remove duplicate connections in .ui files
These no longer compile with Qt6 - but they are already duplicated in C++ code,
anyway. So we can simply remove them.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2022-02-10 08:58:29 -08:00
Dirk Hohndel
82d52b28f8 cleanup: remove unused argument and private member
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2022-02-10 08:58:29 -08:00
Dirk Hohndel
baa0e99285 build-system: update cmake to allow Qt5 and Qt6
Qt6 builds of course still fail, but now they are at least possible.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2022-02-10 08:58:29 -08:00
Dirk Hohndel
82c6843092 build-system: small cleanups for the CMakeLists.txt
Simply removing outdated things that will be in the way.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2022-02-10 08:58:29 -08:00
Dirk Hohndel
e6996ce366 build-system: Qt6 so far is missing Qt Location
So don't try to find the private headers and don't try to build the googlemaps
map plugin.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2022-02-10 08:58:16 -08:00
Dirk Hohndel
5cbee7710d build-system: take Qt6 into account
We should find qmake - but in case there's only a qmake-qt6 binary,
try to use that.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2022-02-10 08:58:16 -08:00
Dirk Hohndel
fe7fd65f74 build-system: correctly build OpenSSL on ARM Macs
The OpenSSL configure script requires us to pass in the correct build spec.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2022-02-10 08:58:16 -08:00
Dirk Hohndel
b753eba40b build-system: update to current OpenSSL version
This is required to compile it on ARM64 Macs (and of course also is
the right thing to do overall).

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2022-02-10 08:58:12 -08:00
Dirk Hohndel
6a3618395f build-system: update libusb version
If we are building our own version of libusb, let's build a current one
(because current libmtp relies on that).

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2022-02-10 08:57:54 -08:00
Dirk Hohndel
2480431b65 cleanup: use already defined constant
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2022-02-10 08:51:57 -08:00
Dirk Hohndel
5e7a121c1f macOS: remove unused Info.plist
This was confusing - the file in packaging macos hasn't been used since we
switched to building with cmake something like seven years ago.
Also add missing keys to the actual Info.plist skeleton.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
2022-02-10 08:51:57 -08:00
54 changed files with 333 additions and 184 deletions

View File

@ -49,7 +49,7 @@ option(NO_PRINTING "disable the printing support" OFF)
option(NO_USERMANUAL "don't include a viewer for the user manual" OFF) option(NO_USERMANUAL "don't include a viewer for the user manual" OFF)
#Options regarding enabling parts of subsurface #Options regarding enabling parts of subsurface
option(BTSUPPORT "enable support for QtBluetooth (requires Qt5.4 or newer)" ON) option(BTSUPPORT "enable support for QtBluetooth" ON)
option(FTDISUPPORT "enable support for libftdi based serial" OFF) option(FTDISUPPORT "enable support for libftdi based serial" OFF)
# Options regarding What should we build on subsurface # Options regarding What should we build on subsurface
@ -173,6 +173,30 @@ include_directories(.
${CMAKE_BINARY_DIR}/desktop-widgets ${CMAKE_BINARY_DIR}/desktop-widgets
) )
# figure out which version of Qt we are building against
find_package(QT NAMES Qt6 Qt5 COMPONENTS Widgets REQUIRED)
# right now there are a few things that don't work with Qt6
# let's disable them right here and remember our Qt version
if(QT_VERSION_MAJOR STREQUAL "6")
set(USINGQT6 ON)
set(QT5OR6 "")
# for Qt6 we want the Qt5 compatibility package
LIST(APPEND QT_EXTRA_COMPONENTS Core5Compat)
LIST(APPEND QT_TEST_LIBRARIES Qt::Core5Compat)
# QtWebKit doesn't work with Qt6, so no printing, no manual
set(NO_PRINTING ON)
set(NO_USERMANUAL ON)
else()
set(USINGQT6 OFF)
set(QT5OR6 "5")
set(QT_VERSION ${Qt5_VERSION})
# for Qt5 we want the Location component (which is missing so far in Qt6)
LIST(APPEND QT_EXTRA_COMPONENTS Location)
endif()
message(STATUS "building with Qt ${QT_VERSION}")
# Project Target specific configuration should go here, # Project Target specific configuration should go here,
# if the configuration is too big or would disrupt the normal code flux, # if the configuration is too big or would disrupt the normal code flux,
# move it somewhere else (another file) and include it. # move it somewhere else (another file) and include it.
@ -284,39 +308,38 @@ if(ANDROID)
# our Qt installation. This is ugly, but it works. # our Qt installation. This is ugly, but it works.
set(CMAKE_FIND_ROOT_PATH "/;${CMAKE_FIND_ROOT_PATH}") set(CMAKE_FIND_ROOT_PATH "/;${CMAKE_FIND_ROOT_PATH}")
endif() endif()
set(QT_FIND_COMPONENTS Core Concurrent Widgets Network Svg Positioning Quick Location ${QT_EXTRA_COMPONENTS}) set(QT_FIND_COMPONENTS Core Concurrent Widgets Network Svg Positioning Quick ${QT_EXTRA_COMPONENTS})
if (SUBSURFACE_TARGET_EXECUTABLE MATCHES "DesktopExecutable") if (SUBSURFACE_TARGET_EXECUTABLE MATCHES "DesktopExecutable")
find_package(Qt5 5.9.1 REQUIRED COMPONENTS ${QT_FIND_COMPONENTS} LinguistTools Test QuickTest) find_package(Qt${QT_VERSION_MAJOR} REQUIRED COMPONENTS ${QT_FIND_COMPONENTS} LinguistTools Test QuickTest)
elseif (SUBSURFACE_TARGET_EXECUTABLE MATCHES "MobileExecutable") elseif (SUBSURFACE_TARGET_EXECUTABLE MATCHES "MobileExecutable")
# Kirigami 5.62 and newer require at least Qt 5.12 # Kirigami 5.62 and newer require at least Qt 5.12
if(ANDROID) if(ANDROID)
find_package(Qt5 5.12 REQUIRED COMPONENTS ${QT_FIND_COMPONENTS} LinguistTools) find_package(Qt${QT_VERSION_MAJOR} 5.12 REQUIRED COMPONENTS ${QT_FIND_COMPONENTS} LinguistTools)
else() else()
find_package(Qt5 5.12 REQUIRED COMPONENTS ${QT_FIND_COMPONENTS} LinguistTools Test QuickTest) find_package(Qt${QT_VERSION_MAJOR} 5.12 REQUIRED COMPONENTS ${QT_FIND_COMPONENTS} LinguistTools Test QuickTest)
endif() endif()
elseif (SUBSURFACE_TARGET_EXECUTABLE MATCHES "DownloaderExecutable") elseif (SUBSURFACE_TARGET_EXECUTABLE MATCHES "DownloaderExecutable")
# let's pick a version that's not ancient # let's pick a version that's not ancient
find_package(Qt5 5.11 REQUIRED COMPONENTS ${QT_FIND_COMPONENTS}) find_package(Qt${QT_VERSION_MAJOR} 5.11 REQUIRED COMPONENTS ${QT_FIND_COMPONENTS})
set(MAKE_TESTS OFF) set(MAKE_TESTS OFF)
endif() endif()
# we don't support Qt6
# the comparison with an invalid version of 5.15 ensures that this will keep working even if
# there are newer Qt 5.15 versions over time (which is unfortunately doubtful)
if (Qt5Core_VERSION VERSION_GREATER 5.15.15)
message(FATAL_ERROR "Subsurface cannot be built against Qt 6 or later")
endif()
foreach(_QT_COMPONENT ${QT_FIND_COMPONENTS}) foreach(_QT_COMPONENT ${QT_FIND_COMPONENTS})
list(APPEND QT_LIBRARIES Qt5::${_QT_COMPONENT}) list(APPEND QT_LIBRARIES Qt${QT5OR6}::${_QT_COMPONENT})
endforeach() endforeach()
if(NOT ANDROID) if(NOT ANDROID)
set(QT_TEST_LIBRARIES ${QT_LIBRARIES} Qt5::Test Qt5::QuickTest) LIST(APPEND QT_TEST_LIBRARIES ${QT_LIBRARIES} Qt${QT5OR6}::Test Qt${QT5OR6}::QuickTest)
endif() endif()
#set up the subsurface_link_libraries variable #set up the subsurface_link_libraries variable
set(SUBSURFACE_LINK_LIBRARIES ${SUBSURFACE_LINK_LIBRARIES} ${LIBDIVECOMPUTER_LIBRARIES} ${LIBGIT2_LIBRARIES} ${LIBUSB_LIBRARIES} ${LIBMTP_LIBRARIES}) set(SUBSURFACE_LINK_LIBRARIES ${SUBSURFACE_LINK_LIBRARIES} ${LIBDIVECOMPUTER_LIBRARIES} ${LIBGIT2_LIBRARIES} ${LIBUSB_LIBRARIES} ${LIBMTP_LIBRARIES})
if (NOT SUBSURFACE_TARGET_EXECUTABLE MATCHES "DownloaderExecutable") if (NOT SUBSURFACE_TARGET_EXECUTABLE MATCHES "DownloaderExecutable")
qt5_add_resources(SUBSURFACE_RESOURCES subsurface.qrc stats/statsicons.qrc map-widget/qml/map-widget.qrc desktop-widgets/qml/statsview2.qrc) if(USINGQT6)
qt_add_resources(SUBSURFACE_RESOURCES subsurface.qrc stats/statsicons.qrc desktop-widgets/qml/statsview2.qrc)
else()
qt5_add_resources(SUBSURFACE_RESOURCES subsurface.qrc stats/statsicons.qrc map-widget/qml/map-widget.qrc desktop-widgets/qml/statsview2.qrc)
set(SUBSURFACE_MAPWIDGET subsurface_mapwidget)
endif()
endif() endif()
# hack to build successfully on LGTM # hack to build successfully on LGTM
@ -333,7 +356,9 @@ add_subdirectory(qt-models)
add_subdirectory(commands) add_subdirectory(commands)
if (NOT SUBSURFACE_TARGET_EXECUTABLE MATCHES "DownloaderExecutable") if (NOT SUBSURFACE_TARGET_EXECUTABLE MATCHES "DownloaderExecutable")
add_subdirectory(profile-widget) add_subdirectory(profile-widget)
if(NOT USINGQT6)
add_subdirectory(map-widget) add_subdirectory(map-widget)
endif()
add_subdirectory(mobile-widgets) add_subdirectory(mobile-widgets)
add_subdirectory(stats) add_subdirectory(stats)
endif() endif()
@ -361,9 +386,15 @@ if (SUBSURFACE_TARGET_EXECUTABLE MATCHES "MobileExecutable")
subsurface-mobile-main.cpp subsurface-mobile-main.cpp
subsurface-helper.cpp subsurface-helper.cpp
) )
qt5_add_resources(MOBILE_RESOURCES mobile-widgets/qml/mobile-resources.qrc) if(USINGQT6)
qt5_add_resources(MOBILE_RESOURCES mobile-widgets/3rdparty/icons.qrc) qt_add_resources(MOBILE_RESOURCES mobile-widgets/qml/mobile-resources.qrc)
qt5_add_resources(MOBILE_RESOURCES mobile-widgets/3rdparty/kirigami/src/scenegraph/shaders/shaders.qrc) qt_add_resources(MOBILE_RESOURCES mobile-widgets/3rdparty/icons.qrc)
qt_add_resources(MOBILE_RESOURCES mobile-widgets/3rdparty/kirigami/src/scenegraph/shaders/shaders.qrc)
else()
qt5_add_resources(MOBILE_RESOURCES mobile-widgets/qml/mobile-resources.qrc)
qt5_add_resources(MOBILE_RESOURCES mobile-widgets/3rdparty/icons.qrc)
qt5_add_resources(MOBILE_RESOURCES mobile-widgets/3rdparty/kirigami/src/scenegraph/shaders/shaders.qrc)
endif()
# the following is split across two commands since in cmake 3.12 this would result # the following is split across two commands since in cmake 3.12 this would result
# in a non-sensical "no sources given to target" error if done all as one set of # in a non-sensical "no sources given to target" error if done all as one set of
@ -374,7 +405,7 @@ if (SUBSURFACE_TARGET_EXECUTABLE MATCHES "MobileExecutable")
${SUBSURFACE_TARGET} ${SUBSURFACE_TARGET}
subsurface_mobile subsurface_mobile
subsurface_profile subsurface_profile
subsurface_mapwidget ${SUBSURFACE_MAPWIDGET}
subsurface_backend_shared subsurface_backend_shared
subsurface_models_mobile subsurface_models_mobile
subsurface_commands subsurface_commands
@ -401,7 +432,7 @@ elseif (SUBSURFACE_TARGET_EXECUTABLE MATCHES "DesktopExecutable")
subsurface_interface subsurface_interface
subsurface_profile subsurface_profile
subsurface_statistics subsurface_statistics
subsurface_mapwidget ${SUBSURFACE_MAPWIDGET}
subsurface_backend_shared subsurface_backend_shared
subsurface_models_desktop subsurface_models_desktop
subsurface_commands subsurface_commands
@ -461,7 +492,11 @@ set(DOCFILES
FILE(STRINGS "subsurface_enabled_translations" QTTRANSLATIONS_BASE) FILE(STRINGS "subsurface_enabled_translations" QTTRANSLATIONS_BASE)
if(NOT DEFINED QT_TRANSLATION_DIR OR QT_TRANSLATION_DIR STREQUAL "") if(NOT DEFINED QT_TRANSLATION_DIR OR QT_TRANSLATION_DIR STREQUAL "")
set(QT_TRANSLATION_DIR ${Qt5Core_DIR}/../../../translations) if(USINGQT6)
set(QT_TRANSLATION_DIR ${QtCore_DIR}/../../../translations)
else()
set(QT_TRANSLATION_DIR ${Qt5Core_DIR}/../../../translations)
endif()
endif() endif()
set(QTTRANSLATIONS "") set(QTTRANSLATIONS "")
foreach(QTTRANSLATION ${QTTRANSLATIONS_BASE}) foreach(QTTRANSLATION ${QTTRANSLATIONS_BASE})
@ -502,34 +537,44 @@ elseif(CMAKE_SYSTEM_NAME STREQUAL "Darwin")
install(FILES ${QTTRANSLATIONS} DESTINATION ${RESOURCEDIR}/translations) install(FILES ${QTTRANSLATIONS} DESTINATION ${RESOURCEDIR}/translations)
install(FILES ${CMAKE_SOURCE_DIR}/gpl-2.0.txt DESTINATION ${RESOURCEDIR}) install(FILES ${CMAKE_SOURCE_DIR}/gpl-2.0.txt DESTINATION ${RESOURCEDIR})
install(CODE "execute_process(COMMAND mkdir -p ${RESOURCEDIR}/qml)") install(CODE "execute_process(COMMAND mkdir -p ${RESOURCEDIR}/qml)")
install(CODE "execute_process(COMMAND mkdir -p ${PLUGINDIR}/geoservices)") if(QT_VERSION VERSION_LESS 6.0.0)
install(CODE "execute_process(COMMAND cp ${_qt5Core_install_prefix}/plugins/geoservices/libqtgeoservices_googlemaps.dylib ${PLUGINDIR}/geoservices ERROR_QUIET)") set(QT_INSTALL_PREFIX ${_qt5Core_install_prefix})
install(CODE "execute_process(COMMAND cp ${CMAKE_SOURCE_DIR}/../install-root/${_qt5Core_install_prefix}/plugins/geoservices/libqtgeoservices_googlemaps.dylib ${PLUGINDIR}/geoservices ERROR_QUIET)") install(CODE "execute_process(COMMAND mkdir -p ${PLUGINDIR}/geoservices)")
# this is a hack - but I don't know how else to find the macdeployqt program if it's not in the PATH install(CODE "execute_process(COMMAND cp ${QT_INSTALL_PREFIX}/plugins/geoservices/libqtgeoservices_googlemaps.dylib ${PLUGINDIR}/geoservices ERROR_QUIET)")
string(REPLACE moc macdeployqt MACDEPLOYQT ${QT_MOC_EXECUTABLE}) install(CODE "execute_process(COMMAND cp ${CMAKE_SOURCE_DIR}/../install-root/${QT_INSTALL_PREFIX}/plugins/geoservices/libqtgeoservices_googlemaps.dylib ${PLUGINDIR}/geoservices ERROR_QUIET)")
install(CODE "execute_process(COMMAND ${MACDEPLOYQT} ${APP_BUNDLE_DIR} -no-strip ${MACDEPLOY_ARGS})") else()
set(QT_INSTALL_PREFIX ${QT6_INSTALL_PREFIX})
endif()
# this will fail is macdeployqt isn't in the PATH - that seemed to happen in the past, but not recently
# also, on M1 macOS systems macdeployqt throws a ton of (apparently harmless) errors. Warn the unsuspecting developer
if(CMAKE_SYSTEM_PROCESSOR STREQUAL "arm64")
install(CODE "execute_process(COMMAND echo the following macdeployqt command will spew out a ton of harmless otool output parsing errors)")
endif()
install(CODE "execute_process(COMMAND macdeployqt ${APP_BUNDLE_DIR} -no-strip ${MACDEPLOY_ARGS})")
# the next hack is here to delete the sqlite plugin that get's installed even though it isn't needed # the next hack is here to delete the sqlite plugin that get's installed even though it isn't needed
install(CODE "execute_process(COMMAND rm -rf ${CMAKE_BINARY_DIR}/${APP_BUNDLE_DIR}/Contents/PlugIns/sqldrivers)") install(CODE "execute_process(COMMAND rm -rf ${CMAKE_BINARY_DIR}/${APP_BUNDLE_DIR}/Contents/PlugIns/sqldrivers)")
# and another hack to get the QML Components in the right place # and another hack to get the QML Components in the right place
install(CODE "execute_process(COMMAND rm -rf ${CMAKE_BINARY_DIR}/${APP_BUNDLE_DIR}/Contents/Resources/qml/{QtQuick.2,QtLocation,QtPositioning})") if(QT_VERSION VERSION_LESS 6.0.0)
install(CODE "execute_process(COMMAND cp -a ${_qt5Core_install_prefix}/qml/QtQuick.2 ${CMAKE_BINARY_DIR}/${APP_BUNDLE_DIR}/Contents/Resources/qml)") install(CODE "execute_process(COMMAND rm -rf ${CMAKE_BINARY_DIR}/${APP_BUNDLE_DIR}/Contents/Resources/qml/{QtQuick.2,QtLocation,QtPositioning})")
install(CODE "execute_process(COMMAND cp -a ${_qt5Core_install_prefix}/qml/QtLocation ${CMAKE_BINARY_DIR}/${APP_BUNDLE_DIR}/Contents/Resources/qml)") install(CODE "execute_process(COMMAND cp -a ${QT_INSTALL_PREFIX}/qml/QtQuick.2 ${CMAKE_BINARY_DIR}/${APP_BUNDLE_DIR}/Contents/Resources/qml)")
install(CODE "execute_process(COMMAND cp -a ${_qt5Core_install_prefix}/qml/QtPositioning ${CMAKE_BINARY_DIR}/${APP_BUNDLE_DIR}/Contents/Resources/qml)") install(CODE "execute_process(COMMAND cp -a ${QT_INSTALL_PREFIX}/qml/QtLocation ${CMAKE_BINARY_DIR}/${APP_BUNDLE_DIR}/Contents/Resources/qml)")
if(NOT Qt5Core_VERSION VERSION_LESS 5.11.0) endif()
install(CODE "execute_process(COMMAND cp -a ${QT_INSTALL_PREFIX}/qml/QtPositioning ${CMAKE_BINARY_DIR}/${APP_BUNDLE_DIR}/Contents/Resources/qml)")
if(NOT QT_VERSION VERSION_LESS 5.11.0)
# and with Qt 5.11 we need another library that isn't copied by macdeployqt # and with Qt 5.11 we need another library that isn't copied by macdeployqt
install(CODE "execute_process(COMMAND rm -rf ${CMAKE_BINARY_DIR}/${APP_BUNDLE_DIR}/Contents/Frameworks/QtPositioningQuick.framework)") install(CODE "execute_process(COMMAND rm -rf ${CMAKE_BINARY_DIR}/${APP_BUNDLE_DIR}/Contents/Frameworks/QtPositioningQuick.framework)")
install(CODE "execute_process(COMMAND cp -a ${_qt5Core_install_prefix}/lib/QtPositioningQuick.framework ${CMAKE_BINARY_DIR}/${APP_BUNDLE_DIR}/Contents/Frameworks)") install(CODE "execute_process(COMMAND cp -a ${QT_INSTALL_PREFIX}/lib/QtPositioningQuick.framework ${CMAKE_BINARY_DIR}/${APP_BUNDLE_DIR}/Contents/Frameworks)")
endif() endif()
if(NOT Qt5Core_VERSION VERSION_LESS 5.14.0) if(NOT QT_VERSION VERSION_LESS 5.14.0)
# and with Qt 5.14 we need another library that isn't always copied by macdeployqt # and with Qt 5.14 we need another library that isn't always copied by macdeployqt
install(CODE "execute_process(COMMAND rm -rf ${CMAKE_BINARY_DIR}/${APP_BUNDLE_DIR}/Contents/Frameworks/QtQmlWorkerScript.framework)") install(CODE "execute_process(COMMAND rm -rf ${CMAKE_BINARY_DIR}/${APP_BUNDLE_DIR}/Contents/Frameworks/QtQmlWorkerScript.framework)")
install(CODE "execute_process(COMMAND cp -a ${_qt5Core_install_prefix}/lib/QtQmlWorkerScript.framework ${CMAKE_BINARY_DIR}/${APP_BUNDLE_DIR}/Contents/Frameworks)") install(CODE "execute_process(COMMAND cp -a ${QT_INSTALL_PREFIX}/lib/QtQmlWorkerScript.framework ${CMAKE_BINARY_DIR}/${APP_BUNDLE_DIR}/Contents/Frameworks)")
endif() endif()
if (SUBSURFACE_TARGET_EXECUTABLE MATCHES "MobileExecutable") if (SUBSURFACE_TARGET_EXECUTABLE MATCHES "MobileExecutable")
install(CODE "execute_process(COMMAND cp -a ${_qt5Core_install_prefix}/qml/QtQuick ${CMAKE_BINARY_DIR}/${APP_BUNDLE_DIR}/Contents/Resources/qml)") install(CODE "execute_process(COMMAND cp -a ${QT_INSTALL_PREFIX}/qml/QtQuick ${CMAKE_BINARY_DIR}/${APP_BUNDLE_DIR}/Contents/Resources/qml)")
install(CODE "execute_process(COMMAND cp -a ${_qt5Core_install_prefix}/qml/QtGraphicalEffects ${CMAKE_BINARY_DIR}/${APP_BUNDLE_DIR}/Contents/Resources/qml)") install(CODE "execute_process(COMMAND cp -a ${QT_INSTALL_PREFIX}/qml/QtGraphicalEffects ${CMAKE_BINARY_DIR}/${APP_BUNDLE_DIR}/Contents/Resources/qml)")
install(CODE "execute_process(COMMAND cp -a ${_qt5Core_install_prefix}/qml/QtQml ${CMAKE_BINARY_DIR}/${APP_BUNDLE_DIR}/Contents/Resources/qml)") install(CODE "execute_process(COMMAND cp -a ${QT_INSTALL_PREFIX}/qml/QtQml ${CMAKE_BINARY_DIR}/${APP_BUNDLE_DIR}/Contents/Resources/qml)")
install(CODE "execute_process(COMMAND cp -a ${_qt5Core_install_prefix}/qml/QtPositioning ${CMAKE_BINARY_DIR}/${APP_BUNDLE_DIR}/Contents/Resources/qml)") install(CODE "execute_process(COMMAND cp -a ${QT_INSTALL_PREFIX}/qml/QtPositioning ${CMAKE_BINARY_DIR}/${APP_BUNDLE_DIR}/Contents/Resources/qml)")
endif() endif()
elseif(CMAKE_SYSTEM_NAME STREQUAL "Windows") elseif(CMAKE_SYSTEM_NAME STREQUAL "Windows")
if (CMAKE_BUILD_TYPE STREQUAL "RelWithDebInfo") if (CMAKE_BUILD_TYPE STREQUAL "RelWithDebInfo")
@ -563,10 +608,10 @@ elseif(CMAKE_SYSTEM_NAME STREQUAL "Windows")
install(TARGETS ${SUBSURFACE_TARGET} DESTINATION ${WINDOWSSTAGING}) install(TARGETS ${SUBSURFACE_TARGET} DESTINATION ${WINDOWSSTAGING})
install(FILES ${CMAKE_BINARY_DIR}/qt.conf DESTINATION ${WINDOWSSTAGING}) install(FILES ${CMAKE_BINARY_DIR}/qt.conf DESTINATION ${WINDOWSSTAGING})
if(NOT Qt5Core_VERSION VERSION_LESS 5.11.0) if(NOT QT_VERSION VERSION_LESS 5.11.0)
# hack to work around the fact that we don't process the dependencies of plugins # hack to work around the fact that we don't process the dependencies of plugins
# as of Qt 5.11 this additional DLL is needed and it's only referenced in the qml DLLs # as of Qt 5.11 this additional DLL is needed and it's only referenced in the qml DLLs
install(FILES ${_qt5Core_install_prefix}/bin/Qt5PositioningQuick.dll DESTINATION ${WINDOWSSTAGING}) install(FILES ${QT_INSTALL_PREFIX}/bin/QtPositioningQuick.dll DESTINATION ${WINDOWSSTAGING})
endif() endif()
if(NOT DEFINED MAKENSIS) if(NOT DEFINED MAKENSIS)

View File

@ -34,5 +34,9 @@
<string>${MACOSX_BUNDLE_COPYRIGHT}</string> <string>${MACOSX_BUNDLE_COPYRIGHT}</string>
<key>NSHighResolutionCapable</key> <key>NSHighResolutionCapable</key>
<true/> <true/>
<key>NSSupportsAutomaticGraphicsSwitching</key>
<true/>
<key>NSBluetoothAlwaysUsageDescription</key>
<string>Subsurface needs access to your Bluetooth peripherals in order to download dive information directly from BLE enabled dive computers.</string>
</dict> </dict>
</plist> </plist>

View File

@ -192,7 +192,11 @@ void BTDiscovery::BTDiscoveryReDiscover()
connect(discoveryAgent, &QBluetoothDeviceDiscoveryAgent::deviceDiscovered, this, &BTDiscovery::btDeviceDiscovered); connect(discoveryAgent, &QBluetoothDeviceDiscoveryAgent::deviceDiscovered, this, &BTDiscovery::btDeviceDiscovered);
connect(discoveryAgent, &QBluetoothDeviceDiscoveryAgent::finished, this, &BTDiscovery::btDeviceDiscoveryFinished); connect(discoveryAgent, &QBluetoothDeviceDiscoveryAgent::finished, this, &BTDiscovery::btDeviceDiscoveryFinished);
connect(discoveryAgent, &QBluetoothDeviceDiscoveryAgent::canceled, this, &BTDiscovery::btDeviceDiscoveryFinished); connect(discoveryAgent, &QBluetoothDeviceDiscoveryAgent::canceled, this, &BTDiscovery::btDeviceDiscoveryFinished);
#if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0)
connect(discoveryAgent, &QBluetoothDeviceDiscoveryAgent::errorOccurred,
#else
connect(discoveryAgent, QOverload<QBluetoothDeviceDiscoveryAgent::Error>::of(&QBluetoothDeviceDiscoveryAgent::error), connect(discoveryAgent, QOverload<QBluetoothDeviceDiscoveryAgent::Error>::of(&QBluetoothDeviceDiscoveryAgent::error),
#endif
[this](QBluetoothDeviceDiscoveryAgent::Error error){ [this](QBluetoothDeviceDiscoveryAgent::Error error){
qDebug() << "device discovery received error" << discoveryAgent->errorString(); qDebug() << "device discovery received error" << discoveryAgent->errorString();
}); });

View File

@ -148,7 +148,9 @@ void DiveFilter::startFilterDiveSites(QVector<dive_site *> ds)
dive_sites = ds; dive_sites = ds;
// When switching into dive site mode, reload the dive sites. // When switching into dive site mode, reload the dive sites.
// TODO: why here? why not catch the filterReset signal in the map widget // TODO: why here? why not catch the filterReset signal in the map widget
#if QT_VERSION < QT_VERSION_CHECK(6, 0, 0)
MapWidget::instance()->reload(); MapWidget::instance()->reload();
#endif
emit diveListNotifier.filterReset(); emit diveListNotifier.filterReset();
} }
} }
@ -159,7 +161,9 @@ void DiveFilter::stopFilterDiveSites()
return; return;
dive_sites.clear(); dive_sites.clear();
emit diveListNotifier.filterReset(); emit diveListNotifier.filterReset();
#if QT_VERSION < QT_VERSION_CHECK(6, 0, 0)
MapWidget::instance()->reload(); MapWidget::instance()->reload();
#endif
} }
void DiveFilter::setFilterDiveSite(QVector<dive_site *> ds) void DiveFilter::setFilterDiveSite(QVector<dive_site *> ds)
@ -172,8 +176,10 @@ void DiveFilter::setFilterDiveSite(QVector<dive_site *> ds)
dive_sites = ds; dive_sites = ds;
emit diveListNotifier.filterReset(); emit diveListNotifier.filterReset();
#if QT_VERSION < QT_VERSION_CHECK(6, 0, 0)
MapWidget::instance()->setSelected(dive_sites); MapWidget::instance()->setSelected(dive_sites);
MapWidget::instance()->selectionChanged(); MapWidget::instance()->selectionChanged();
#endif
MainWindow::instance()->diveList->expandAll(); MainWindow::instance()->diveList->expandAll();
} }

View File

@ -1,6 +1,7 @@
// SPDX-License-Identifier: GPL-2.0 // SPDX-License-Identifier: GPL-2.0
#include "core/parse-gpx.h" #include "core/parse-gpx.h"
#include "core/subsurface-time.h" #include "core/subsurface-time.h"
#include "core/qthelper.h"
#include <QFile> #include <QFile>
#include <QXmlStreamReader> #include <QXmlStreamReader>
@ -43,7 +44,7 @@ int getCoordsFromGPXFile(struct dive_coords *coords, QString fileName)
while (!gpxReader.atEnd()) { while (!gpxReader.atEnd()) {
gpxReader.readNext(); gpxReader.readNext();
if (gpxReader.isStartElement()) { if (gpxReader.isStartElement()) {
if (gpxReader.name() == "trkpt") { if (nameCmp(gpxReader, "trkpt") == 0) {
trkpt_found = true; trkpt_found = true;
line++; line++;
foreach (const QXmlStreamAttribute &attr, gpxReader.attributes()) { foreach (const QXmlStreamAttribute &attr, gpxReader.attributes()) {
@ -53,7 +54,7 @@ int getCoordsFromGPXFile(struct dive_coords *coords, QString fileName)
lon = attr.value().toString().toDouble(); lon = attr.value().toString().toDouble();
} }
} }
if (gpxReader.name() == "time" && trkpt_found) { // Ignore the <time> element in the GPX file header if (nameCmp(gpxReader, "time") == 0 && trkpt_found) { // Ignore the <time> element in the GPX file header
QString dateTimeString = gpxReader.readElementText(); QString dateTimeString = gpxReader.readElementText();
bool ok; bool ok;
tm1.tm_year = dateTimeString.left(4).toInt(&ok, 10); // Extract the date/time components: tm1.tm_year = dateTimeString.left(4).toInt(&ok, 10); // Extract the date/time components:

View File

@ -110,7 +110,7 @@ static const char *match_uuid_list(const QBluetoothUuid &match, const struct uui
const char *uuid; const char *uuid;
while ((uuid = array->uuid) != NULL) { while ((uuid = array->uuid) != NULL) {
if (match == QUuid(uuid)) if (match == QBluetoothUuid(QUuid(uuid)))
return array->details; return array->details;
array++; array++;
} }
@ -220,7 +220,11 @@ void BLEObject::addService(const QBluetoothUuid &newService)
service->connect(service, &QLowEnergyService::stateChanged,[=](QLowEnergyService::ServiceState newState) { service->connect(service, &QLowEnergyService::stateChanged,[=](QLowEnergyService::ServiceState newState) {
qDebug() << " .. service state changed to" << newState; qDebug() << " .. service state changed to" << newState;
}); });
#if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0)
service->connect(service, &QLowEnergyService::errorOccurred,
#else
service->connect(service, QOverload<QLowEnergyService::ServiceError>::of(&QLowEnergyService::error), service->connect(service, QOverload<QLowEnergyService::ServiceError>::of(&QLowEnergyService::error),
#endif
[=](QLowEnergyService::ServiceError newError) { [=](QLowEnergyService::ServiceError newError) {
qDebug() << "error discovering service details" << newError; qDebug() << "error discovering service details" << newError;
}); });
@ -393,8 +397,13 @@ dc_status_t BLEObject::select_preferred_service(void)
{ {
// Wait for each service to finish discovering // Wait for each service to finish discovering
foreach (const QLowEnergyService *s, services) { foreach (const QLowEnergyService *s, services) {
#if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0)
WAITFOR(s->state() != QLowEnergyService::RemoteServiceDiscovering, BLE_TIMEOUT);
if (s->state() == QLowEnergyService::RemoteServiceDiscovering)
#else
WAITFOR(s->state() != QLowEnergyService::DiscoveringServices, BLE_TIMEOUT); WAITFOR(s->state() != QLowEnergyService::DiscoveringServices, BLE_TIMEOUT);
if (s->state() == QLowEnergyService::DiscoveringServices) if (s->state() == QLowEnergyService::DiscoveringServices)
#endif
qDebug() << " .. service " << s->serviceUuid() << "still hasn't completed discovery - trouble ahead"; qDebug() << " .. service " << s->serviceUuid() << "still hasn't completed discovery - trouble ahead";
} }
@ -412,7 +421,11 @@ dc_status_t BLEObject::select_preferred_service(void)
// Pick the preferred one // Pick the preferred one
foreach (QLowEnergyService *s, services) { foreach (QLowEnergyService *s, services) {
#if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0)
if (s->state() != QLowEnergyService::RemoteServiceDiscovered)
#else
if (s->state() != QLowEnergyService::ServiceDiscovered) if (s->state() != QLowEnergyService::ServiceDiscovered)
#endif
continue; continue;
bool hasread = false; bool hasread = false;
@ -604,7 +617,11 @@ dc_status_t qt_ble_open(void **io, dc_context_t *, const char *devaddr, device_d
ble->addService(s); ble->addService(s);
} }
}); });
#if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0)
ble->connect(controller, &QLowEnergyController::errorOccurred, [=](QLowEnergyController::Error newError) {
#else
ble->connect(controller, QOverload<QLowEnergyController::Error>::of(&QLowEnergyController::error), [=](QLowEnergyController::Error newError) { ble->connect(controller, QOverload<QLowEnergyController::Error>::of(&QLowEnergyController::error), [=](QLowEnergyController::Error newError) {
#endif
qDebug() << "controler discovery error" << controller->errorString() << newError; qDebug() << "controler discovery error" << controller->errorString() << newError;
}); });

View File

@ -60,16 +60,16 @@ private:
unsigned int desc_written = 0; unsigned int desc_written = 0;
int timeout; int timeout;
QList<QUuid> telit = { QList<QBluetoothUuid> telit = {
"{00000001-0000-1000-8000-008025000000}", // TELIT_DATA_RX QBluetoothUuid(QUuid("{00000001-0000-1000-8000-008025000000}")), // TELIT_DATA_RX
"{00000002-0000-1000-8000-008025000000}", // TELIT_DATA_TX QBluetoothUuid(QUuid("{00000002-0000-1000-8000-008025000000}")), // TELIT_DATA_TX
"{00000003-0000-1000-8000-008025000000}", // TELIT_CREDITS_RX QBluetoothUuid(QUuid("{00000003-0000-1000-8000-008025000000}")), // TELIT_CREDITS_RX
"{00000004-0000-1000-8000-008025000000}" // TELIT_CREDITS_TX QBluetoothUuid(QUuid("{00000004-0000-1000-8000-008025000000}")) // TELIT_CREDITS_TX
}; };
QList<QUuid> ublox = { QList<QBluetoothUuid> ublox = {
"{2456e1b9-26e2-8f83-e744-f34f01e9d703}", // UBLOX_DATA_RX, UBLOX_DATA_TX QBluetoothUuid(QUuid("{2456e1b9-26e2-8f83-e744-f34f01e9d703}")), // UBLOX_DATA_RX, UBLOX_DATA_TX
"{2456e1b9-26e2-8f83-e744-f34f01e9d704}" // UBLOX_CREDITS_RX, UBLOX_CREDITS_TX QBluetoothUuid(QUuid("{2456e1b9-26e2-8f83-e744-f34f01e9d704}")) // UBLOX_CREDITS_RX, UBLOX_CREDITS_TX
}; };
}; };

View File

@ -1,3 +1,4 @@
// SPDX-License-Identifier: GPL-2.0 // SPDX-License-Identifier: GPL-2.0
#include <QApplication> #include <QApplication>
#include <Qt> #include <Qt>
@ -50,7 +51,7 @@ void init_qt_late()
} }
// Disables the WindowContextHelpButtonHint by default on Qt::Sheet and Qt::Dialog widgets. // Disables the WindowContextHelpButtonHint by default on Qt::Sheet and Qt::Dialog widgets.
// This hides the ? button on Windows, which only makes sense if you use QWhatsThis functionality. // This hides the ? button on Windows, which only makes sense if you use QWhatsThis functionality.
#if QT_VERSION >= QT_VERSION_CHECK(5, 10, 0) #if QT_VERSION >= QT_VERSION_CHECK(5, 10, 0) && QT_VERSION < QT_VERSION_CHECK(6, 0, 0)
QCoreApplication::setAttribute(Qt::AA_DisableWindowContextHelpButton); QCoreApplication::setAttribute(Qt::AA_DisableWindowContextHelpButton);
#endif #endif
qPref::load(); qPref::load();

View File

@ -753,9 +753,9 @@ timestamp_t dateTimeToTimestamp(const QDateTime &t)
QString render_seconds_to_string(int seconds) QString render_seconds_to_string(int seconds)
{ {
if (seconds % 60 == 0) if (seconds % 60 == 0)
return QDateTime::fromTime_t(seconds).toUTC().toString("h:mm"); return QDateTime::fromSecsSinceEpoch(seconds, Qt::UTC).toUTC().toString("h:mm");
else else
return QDateTime::fromTime_t(seconds).toUTC().toString("h:mm:ss"); return QDateTime::fromSecsSinceEpoch(seconds, Qt::UTC).toUTC().toString("h:mm:ss");
} }
int parseDurationToSeconds(const QString &text) int parseDurationToSeconds(const QString &text)

View File

@ -20,6 +20,7 @@ enum watertypes {FRESHWATER, BRACKISHWATER, EN13319WATER, SALTWATER, DC_WATERTYP
#ifdef __cplusplus #ifdef __cplusplus
#include <QString> #include <QString>
#include <QXmlStreamReader>
#include "core/gettextfromc.h" #include "core/gettextfromc.h"
class QImage; class QImage;
@ -29,6 +30,12 @@ class QImage;
#define SKIP_EMPTY QString::SkipEmptyParts #define SKIP_EMPTY QString::SkipEmptyParts
#endif #endif
// this is annoying Qt5 / Qt6 incompatibility where we can't compare against string literals anymore
static inline int nameCmp(QXmlStreamReader &r, const char * cs)
{
return r.name().compare(QLatin1String(cs));
}
QString weight_string(int weight_in_grams); QString weight_string(int weight_in_grams);
QString distance_string(int distanceInMeters); QString distance_string(int distanceInMeters);
bool gpsHasChanged(struct dive *dive, struct dive *master, const QString &gps_text, bool *parsed_out = 0); bool gpsHasChanged(struct dive *dive, struct dive *master, const QString &gps_text, bool *parsed_out = 0);

View File

@ -1,6 +1,10 @@
# create the libraries # create the libraries
file(GLOB SUBSURFACE_UI *.ui) file(GLOB SUBSURFACE_UI *.ui)
qt5_wrap_ui(SUBSURFACE_UI_HDRS ${SUBSURFACE_UI}) if(NOT USINGQT6)
qt5_wrap_ui(SUBSURFACE_UI_HDRS ${SUBSURFACE_UI})
else()
qt_wrap_ui(SUBSURFACE_UI_HDRS ${SUBSURFACE_UI})
endif()
source_group("Subsurface Interface Files" FILES ${SUBSURFACE_UI}) source_group("Subsurface Interface Files" FILES ${SUBSURFACE_UI})
if(BTSUPPORT) if(BTSUPPORT)
@ -94,8 +98,6 @@ set(SUBSURFACE_INTERFACE
locationinformation.h locationinformation.h
mainwindow.cpp mainwindow.cpp
mainwindow.h mainwindow.h
mapwidget.cpp
mapwidget.h
modeldelegates.cpp modeldelegates.cpp
modeldelegates.h modeldelegates.h
notificationwidget.cpp notificationwidget.cpp
@ -139,6 +141,12 @@ set(SUBSURFACE_INTERFACE
updatemanager.cpp updatemanager.cpp
updatemanager.h updatemanager.h
) )
if(NOT USINGQT6)
LIST(APPEND SUBSURFACE_INTERFACE
mapwidget.cpp
mapwidget.h
)
endif()
if(NOT NO_USERMANUAL) if(NOT NO_USERMANUAL)
set(SUBSURFACE_INTERFACE ${SUBSURFACE_INTERFACE} set(SUBSURFACE_INTERFACE ${SUBSURFACE_INTERFACE}
@ -178,7 +186,11 @@ set(SUBSURFACE_STATISTICS_LIB_SRCS
) )
source_group("Subsurface Statistics" FILES ${SUBSURFACE_STATISTICS_LIB_SRCS}) source_group("Subsurface Statistics" FILES ${SUBSURFACE_STATISTICS_LIB_SRCS})
qt5_wrap_ui(SUBSURFACE_UI_SRCS ${SUBSURFACE_UI}) if(NOT USINGQT6)
qt5_wrap_ui(SUBSURFACE_UI_SRCS ${SUBSURFACE_UI})
else()
qt_wrap_ui(SUBSURFACE_UI_SRCS ${SUBSURFACE_UI})
endif()
add_library(subsurface_statistics STATIC ${SUBSURFACE_STATISTICS_LIB_SRCS}) add_library(subsurface_statistics STATIC ${SUBSURFACE_STATISTICS_LIB_SRCS})
target_link_libraries(subsurface_statistics ${QT_LIBRARIES}) target_link_libraries(subsurface_statistics ${QT_LIBRARIES})

View File

@ -19,9 +19,9 @@ SubsurfaceAbout::SubsurfaceAbout(QWidget *parent) : QDialog(parent, QFlag(0))
"Linus Torvalds, Dirk Hohndel, Tomaz Canabrava, Berthold Stoeger, and others, 2011-2022" "Linus Torvalds, Dirk Hohndel, Tomaz Canabrava, Berthold Stoeger, and others, 2011-2022"
"</span>").arg(versionString)); "</span>").arg(versionString));
QShortcut *close = new QShortcut(QKeySequence(Qt::CTRL + Qt::Key_W), this); QShortcut *close = new QShortcut(QKeySequence(Qt::CTRL | Qt::Key_W), this);
connect(close, SIGNAL(activated()), this, SLOT(close())); connect(close, SIGNAL(activated()), this, SLOT(close()));
QShortcut *quit = new QShortcut(QKeySequence(Qt::CTRL + Qt::Key_Q), this); QShortcut *quit = new QShortcut(QKeySequence(Qt::CTRL | Qt::Key_Q), this);
connect(quit, SIGNAL(activated()), parent, SLOT(close())); connect(quit, SIGNAL(activated()), parent, SLOT(close()));
} }

View File

@ -18,7 +18,7 @@ BtDeviceSelectionDialog::BtDeviceSelectionDialog(QWidget *parent) :
ui->setupUi(this); ui->setupUi(this);
// Quit button callbacks // Quit button callbacks
QShortcut *quit = new QShortcut(QKeySequence(Qt::CTRL + Qt::Key_Q), this); QShortcut *quit = new QShortcut(QKeySequence(Qt::CTRL | Qt::Key_Q), this);
connect(quit, SIGNAL(activated()), this, SLOT(reject())); connect(quit, SIGNAL(activated()), this, SLOT(reject()));
connect(ui->quit, SIGNAL(clicked()), this, SLOT(reject())); connect(ui->quit, SIGNAL(clicked()), this, SLOT(reject()));
@ -473,11 +473,16 @@ void BtDeviceSelectionDialog::updateLocalDeviceInformation()
ui->discoveredDevicesList->setContextMenuPolicy(Qt::CustomContextMenu); ui->discoveredDevicesList->setContextMenuPolicy(Qt::CustomContextMenu);
connect(ui->discoveredDevicesList, SIGNAL(customContextMenuRequested(QPoint)), connect(ui->discoveredDevicesList, SIGNAL(customContextMenuRequested(QPoint)),
this, SLOT(displayPairingMenu(QPoint))); this, SLOT(displayPairingMenu(QPoint)));
#if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0)
connect(localDevice, &QBluetoothLocalDevice::pairingFinished, this, &BtDeviceSelectionDialog::pairingFinished);
connect(localDevice, &QBluetoothLocalDevice::errorOccurred, this, &BtDeviceSelectionDialog::error);
#else
connect(localDevice, SIGNAL(pairingFinished(QBluetoothAddress, QBluetoothLocalDevice::Pairing)), connect(localDevice, SIGNAL(pairingFinished(QBluetoothAddress, QBluetoothLocalDevice::Pairing)),
this, SLOT(pairingFinished(QBluetoothAddress, QBluetoothLocalDevice::Pairing))); this, SLOT(pairingFinished(QBluetoothAddress, QBluetoothLocalDevice::Pairing)));
connect(localDevice, SIGNAL(error(QBluetoothLocalDevice::Error)), connect(localDevice, SIGNAL(error(QBluetoothLocalDevice::Error)),
this, SLOT(error(QBluetoothLocalDevice::Error))); this, SLOT(error(QBluetoothLocalDevice::Error)));
#endif
} }
void BtDeviceSelectionDialog::initializeDeviceDiscoveryAgent() void BtDeviceSelectionDialog::initializeDeviceDiscoveryAgent()
@ -494,10 +499,19 @@ void BtDeviceSelectionDialog::initializeDeviceDiscoveryAgent()
ui->clear->setEnabled(false); ui->clear->setEnabled(false);
return; return;
} }
#if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0)
connect(remoteDeviceDiscoveryAgent, &QBluetoothDeviceDiscoveryAgent::deviceDiscovered,
this, &BtDeviceSelectionDialog::addRemoteDevice);
connect(remoteDeviceDiscoveryAgent, &QBluetoothDeviceDiscoveryAgent::finished,
this, &BtDeviceSelectionDialog::remoteDeviceScanFinished);
connect(remoteDeviceDiscoveryAgent, &QBluetoothDeviceDiscoveryAgent::errorOccurred,
this, &BtDeviceSelectionDialog::deviceDiscoveryError);
#else
connect(remoteDeviceDiscoveryAgent, SIGNAL(deviceDiscovered(QBluetoothDeviceInfo)), connect(remoteDeviceDiscoveryAgent, SIGNAL(deviceDiscovered(QBluetoothDeviceInfo)),
this, SLOT(addRemoteDevice(QBluetoothDeviceInfo))); this, SLOT(addRemoteDevice(QBluetoothDeviceInfo)));
connect(remoteDeviceDiscoveryAgent, SIGNAL(finished()), connect(remoteDeviceDiscoveryAgent, SIGNAL(finished()),
this, SLOT(remoteDeviceScanFinished())); this, SLOT(remoteDeviceScanFinished()));
connect(remoteDeviceDiscoveryAgent, SIGNAL(error(QBluetoothDeviceDiscoveryAgent::Error)), connect(remoteDeviceDiscoveryAgent, SIGNAL(error(QBluetoothDeviceDiscoveryAgent::Error)),
this, SLOT(deviceDiscoveryError(QBluetoothDeviceDiscoveryAgent::Error))); this, SLOT(deviceDiscoveryError(QBluetoothDeviceDiscoveryAgent::Error)));
#endif
} }

View File

@ -523,7 +523,9 @@ void DiveListView::selectionChangeDone()
if (d->selected && !d->hidden_by_filter && d->dive_site && !selectedSites.contains(d->dive_site)) if (d->selected && !d->hidden_by_filter && d->dive_site && !selectedSites.contains(d->dive_site))
selectedSites.push_back(d->dive_site); selectedSites.push_back(d->dive_site);
} }
#if QT_VERSION < QT_VERSION_CHECK(6, 0, 0)
MapWidget::instance()->setSelected(selectedSites); MapWidget::instance()->setSelected(selectedSites);
#endif
} }
emit divesSelected(); emit divesSelected();
} }

View File

@ -37,9 +37,9 @@ DiveLogExportDialog::DiveLogExportDialog(QWidget *parent) : QDialog(parent),
{ {
ui->setupUi(this); ui->setupUi(this);
showExplanation(); showExplanation();
QShortcut *quit = new QShortcut(QKeySequence(Qt::CTRL + Qt::Key_Q), this); QShortcut *quit = new QShortcut(QKeySequence(Qt::CTRL | Qt::Key_Q), this);
connect(quit, SIGNAL(activated()), MainWindow::instance(), SLOT(close())); connect(quit, SIGNAL(activated()), MainWindow::instance(), SLOT(close()));
QShortcut *close = new QShortcut(QKeySequence(Qt::CTRL + Qt::Key_W), this); QShortcut *close = new QShortcut(QKeySequence(Qt::CTRL | Qt::Key_W), this);
connect(close, SIGNAL(activated()), this, SLOT(close())); connect(close, SIGNAL(activated()), this, SLOT(close()));
/* the names are not the actual values exported to the json files,The font-family property should hold several /* the names are not the actual values exported to the json files,The font-family property should hold several
@ -246,7 +246,7 @@ void DiveLogExportDialog::on_buttonBox_accepted()
qPrefDisplay::set_lastDir(fileInfo.dir().path()); qPrefDisplay::set_lastDir(fileInfo.dir().path());
// the non XSLT exports are called directly above, the XSLT based ons are called here // the non XSLT exports are called directly above, the XSLT based ons are called here
if (!stylesheet.isEmpty()) { if (!stylesheet.isEmpty()) {
QFuture<void> future = exportUsingStyleSheet(filename, ui->exportSelected->isChecked(), QFuture<int> future = exportUsingStyleSheet(filename, ui->exportSelected->isChecked(),
ui->CSVUnits_2->currentIndex(), stylesheet.toUtf8(), ui->anonymize->isChecked()); ui->CSVUnits_2->currentIndex(), stylesheet.toUtf8(), ui->anonymize->isChecked());
MainWindow::instance()->getNotificationWidget()->showNotification(tr("Please wait, exporting..."), KMessageWidget::Information); MainWindow::instance()->getNotificationWidget()->showNotification(tr("Please wait, exporting..."), KMessageWidget::Information);
MainWindow::instance()->getNotificationWidget()->setFuture(future); MainWindow::instance()->getNotificationWidget()->setFuture(future);

View File

@ -10,6 +10,7 @@
#include <QRegularExpression> #include <QRegularExpression>
#include <QUndoStack> #include <QUndoStack>
#include <QPainter> #include <QPainter>
#include <QFile>
#include "core/filterpreset.h" #include "core/filterpreset.h"
#include "core/qthelper.h" #include "core/qthelper.h"
#include "core/divesite.h" #include "core/divesite.h"
@ -380,9 +381,9 @@ DiveLogImportDialog::DiveLogImportDialog(QStringList fn, QWidget *parent) : QDia
loadFileContents(-1, INITIAL); loadFileContents(-1, INITIAL);
/* manually import CSV file */ /* manually import CSV file */
QShortcut *close = new QShortcut(QKeySequence(Qt::CTRL + Qt::Key_W), this); QShortcut *close = new QShortcut(QKeySequence(Qt::CTRL | Qt::Key_W), this);
connect(close, SIGNAL(activated()), this, SLOT(close())); connect(close, SIGNAL(activated()), this, SLOT(close()));
QShortcut *quit = new QShortcut(QKeySequence(Qt::CTRL + Qt::Key_Q), this); QShortcut *quit = new QShortcut(QKeySequence(Qt::CTRL | Qt::Key_Q), this);
connect(quit, SIGNAL(activated()), parent, SLOT(close())); connect(quit, SIGNAL(activated()), parent, SLOT(close()));
connect(ui->CSVSeparator, SIGNAL(currentIndexChanged(int)), this, SLOT(loadFileContentsSeperatorSelected(int))); connect(ui->CSVSeparator, SIGNAL(currentIndexChanged(int)), this, SLOT(loadFileContentsSeperatorSelected(int)));

View File

@ -18,6 +18,8 @@ DiveShareExportDialog::DiveShareExportDialog(QWidget *parent) :
exportSelected(false) exportSelected(false)
{ {
ui->setupUi(this); ui->setupUi(this);
// creating this connection in the .ui file appears to fail with Qt6
connect(ui->getUIDbutton, &QPushButton::clicked, this, &DiveShareExportDialog::UIDFromBrowser);
} }
DiveShareExportDialog::~DiveShareExportDialog() DiveShareExportDialog::~DiveShareExportDialog()

View File

@ -235,22 +235,6 @@ p, li { white-space: pre-wrap; }
</hint> </hint>
</hints> </hints>
</connection> </connection>
<connection>
<sender>getUIDbutton</sender>
<signal>clicked()</signal>
<receiver>DiveShareExportDialog</receiver>
<slot>UIDFromBrowser()</slot>
<hints>
<hint type="sourcelabel">
<x>223</x>
<y>29</y>
</hint>
<hint type="destinationlabel">
<x>159</x>
<y>215</y>
</hint>
</hints>
</connection>
<connection> <connection>
<sender>doUploadButton</sender> <sender>doUploadButton</sender>
<signal>clicked()</signal> <signal>clicked()</signal>

View File

@ -16,8 +16,8 @@
DivesiteImportDialog::DivesiteImportDialog(struct dive_site_table &imported, QString source, QWidget *parent) : QDialog(parent), DivesiteImportDialog::DivesiteImportDialog(struct dive_site_table &imported, QString source, QWidget *parent) : QDialog(parent),
importedSource(source) importedSource(source)
{ {
QShortcut *close = new QShortcut(QKeySequence(Qt::CTRL + Qt::Key_W), this); QShortcut *close = new QShortcut(QKeySequence(Qt::CTRL | Qt::Key_W), this);
QShortcut *quit = new QShortcut(QKeySequence(Qt::CTRL + Qt::Key_Q), this); QShortcut *quit = new QShortcut(QKeySequence(Qt::CTRL | Qt::Key_Q), this);
divesiteImportedModel = new DivesiteImportedModel(this); divesiteImportedModel = new DivesiteImportedModel(this);

View File

@ -31,8 +31,8 @@ DownloadFromDCWidget::DownloadFromDCWidget(QWidget *parent) : QDialog(parent, QF
{ {
diveImportedModel = new DiveImportedModel(this); diveImportedModel = new DiveImportedModel(this);
vendorModel.setStringList(vendorList); vendorModel.setStringList(vendorList);
QShortcut *close = new QShortcut(QKeySequence(Qt::CTRL + Qt::Key_W), this); QShortcut *close = new QShortcut(QKeySequence(Qt::CTRL | Qt::Key_W), this);
QShortcut *quit = new QShortcut(QKeySequence(Qt::CTRL + Qt::Key_Q), this); QShortcut *quit = new QShortcut(QKeySequence(Qt::CTRL | Qt::Key_Q), this);
int startingWidth = defaultModelFont().pointSize(); int startingWidth = defaultModelFont().pointSize();
@ -311,7 +311,7 @@ void DownloadFromDCWidget::updateState(states state)
currentState = state; currentState = state;
} }
void DownloadFromDCWidget::on_vendor_currentIndexChanged(const QString &vendor) void DownloadFromDCWidget::on_vendor_currentTextChanged(const QString &vendor)
{ {
unsigned int transport; unsigned int transport;
dc_descriptor_t *descriptor; dc_descriptor_t *descriptor;
@ -323,7 +323,7 @@ void DownloadFromDCWidget::on_vendor_currentIndexChanged(const QString &vendor)
fill_device_list(transport); fill_device_list(transport);
} }
void DownloadFromDCWidget::on_product_currentIndexChanged(const QString &) void DownloadFromDCWidget::on_product_currentTextChanged(const QString &)
{ {
updateDeviceEnabled(); updateDeviceEnabled();
} }

View File

@ -42,8 +42,8 @@ slots:
void on_ok_clicked(); void on_ok_clicked();
void on_cancel_clicked(); void on_cancel_clicked();
void on_search_clicked(); void on_search_clicked();
void on_vendor_currentIndexChanged(const QString &vendor); void on_vendor_currentTextChanged(const QString &vendor);
void on_product_currentIndexChanged(const QString &product); void on_product_currentTextChanged(const QString &product);
void on_device_currentTextChanged(const QString &device); void on_device_currentTextChanged(const QString &device);
void onDownloadThreadFinished(); void onDownloadThreadFinished();

View File

@ -37,6 +37,8 @@
#include <QStyle> #include <QStyle>
#include <QStyleOptionFocusRect> #include <QStyleOptionFocusRect>
#include <QDebug> #include <QDebug>
#include <QList>
#include <QVector>
#include <cmath> #include <cmath>
struct GroupedLineEdit::Private { struct GroupedLineEdit::Private {

View File

@ -20,7 +20,9 @@
#include <QItemSelectionModel> #include <QItemSelectionModel>
#include <qmessagebox.h> #include <qmessagebox.h>
#include <cstdlib> #include <cstdlib>
#if QT_VERSION < QT_VERSION_CHECK(6, 0, 0)
#include <QDesktopWidget> #include <QDesktopWidget>
#endif
#include <QFileDialog> #include <QFileDialog>
#include <QScrollBar> #include <QScrollBar>
@ -587,7 +589,11 @@ void DiveLocationLineEdit::keyPressEvent(QKeyEvent *ev)
void DiveLocationLineEdit::fixPopupPosition() void DiveLocationLineEdit::fixPopupPosition()
{ {
#if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0)
const QRect screen = this->screen()->availableGeometry();
#else
const QRect screen = QApplication::desktop()->availableGeometry(this); const QRect screen = QApplication::desktop()->availableGeometry(this);
#endif
const int maxVisibleItems = 5; const int maxVisibleItems = 5;
QPoint pos; QPoint pos;
int rh, w; int rh, w;

View File

@ -8,7 +8,9 @@
#include <QFileDialog> #include <QFileDialog>
#include <QMessageBox> #include <QMessageBox>
#if QT_VERSION < QT_VERSION_CHECK(6, 0, 0)
#include <QDesktopWidget> #include <QDesktopWidget>
#endif
#include <QSettings> #include <QSettings>
#include <QShortcut> #include <QShortcut>
#include <QStatusBar> #include <QStatusBar>
@ -132,7 +134,9 @@ MainWindow::MainWindow() : QMainWindow(),
// for the "default" mode // for the "default" mode
mainTab.reset(new MainTab); mainTab.reset(new MainTab);
diveList.reset(new DiveListView); diveList.reset(new DiveListView);
#if QT_VERSION < QT_VERSION_CHECK(6, 0, 0)
mapWidget.reset(MapWidget::instance()); // Yes, this is ominous see comment in mapwidget.cpp. mapWidget.reset(MapWidget::instance()); // Yes, this is ominous see comment in mapwidget.cpp.
#endif
plannerWidgets.reset(new PlannerWidgets); plannerWidgets.reset(new PlannerWidgets);
statistics.reset(new StatsWidget); statistics.reset(new StatsWidget);
profile.reset(new ProfileWidget); profile.reset(new ProfileWidget);
@ -198,7 +202,9 @@ MainWindow::MainWindow() : QMainWindow(),
initialUiSetup(); initialUiSetup();
readSettings(); readSettings();
diveList->setFocus(); diveList->setFocus();
#if QT_VERSION < QT_VERSION_CHECK(6, 0, 0)
MapWidget::instance()->reload(); MapWidget::instance()->reload();
#endif
diveList->expand(diveList->model()->index(0, 0)); diveList->expand(diveList->model()->index(0, 0));
diveList->scrollTo(diveList->model()->index(0, 0), QAbstractItemView::PositionAtCenter); diveList->scrollTo(diveList->model()->index(0, 0), QAbstractItemView::PositionAtCenter);
#ifdef NO_USERMANUAL #ifdef NO_USERMANUAL
@ -210,8 +216,8 @@ MainWindow::MainWindow() : QMainWindow(),
updateManager = new UpdateManager(this); updateManager = new UpdateManager(this);
undoAction = Command::undoAction(this); undoAction = Command::undoAction(this);
redoAction = Command::redoAction(this); redoAction = Command::redoAction(this);
undoAction->setShortcut(QKeySequence(Qt::CTRL + Qt::Key_Z)); undoAction->setShortcut(QKeySequence(Qt::CTRL | Qt::Key_Z));
redoAction->setShortcut(QKeySequence(Qt::CTRL + Qt::SHIFT + Qt::Key_Z)); redoAction->setShortcut(QKeySequence(Qt::CTRL | Qt::SHIFT | Qt::Key_Z));
ui.menu_Edit->addActions({ undoAction, redoAction }); ui.menu_Edit->addActions({ undoAction, redoAction });
#ifndef NO_PRINTING #ifndef NO_PRINTING
@ -327,7 +333,9 @@ void MainWindow::selectionChanged()
if (current_dive) if (current_dive)
enableDisableOtherDCsActions(); enableDisableOtherDCsActions();
profile->plotCurrentDive(); profile->plotCurrentDive();
#if QT_VERSION < QT_VERSION_CHECK(6, 0, 0)
MapWidget::instance()->selectionChanged(); MapWidget::instance()->selectionChanged();
#endif
} }
void MainWindow::on_actionNew_triggered() void MainWindow::on_actionNew_triggered()
@ -508,7 +516,9 @@ void MainWindow::closeCurrentFile()
clear_dive_file_data(); // this clears all the core data structures and resets the models clear_dive_file_data(); // this clears all the core data structures and resets the models
setCurrentFile(nullptr); setCurrentFile(nullptr);
diveList->setSortOrder(DiveTripModelBase::NR, Qt::DescendingOrder); diveList->setSortOrder(DiveTripModelBase::NR, Qt::DescendingOrder);
#if QT_VERSION < QT_VERSION_CHECK(6, 0, 0)
MapWidget::instance()->reload(); MapWidget::instance()->reload();
#endif
if (!existing_filename) if (!existing_filename)
setTitle(); setTitle();
disableShortcuts(); disableShortcuts();
@ -570,8 +580,8 @@ void MainWindow::enableShortcuts()
redoAction->setEnabled(true); redoAction->setEnabled(true);
ui.actionPreviousDC->setShortcut(Qt::Key_Left); ui.actionPreviousDC->setShortcut(Qt::Key_Left);
ui.actionNextDC->setShortcut(Qt::Key_Right); ui.actionNextDC->setShortcut(Qt::Key_Right);
ui.copy->setShortcut(QKeySequence(Qt::CTRL + Qt::Key_C)); ui.copy->setShortcut(QKeySequence(Qt::CTRL | Qt::Key_C));
ui.paste->setShortcut(QKeySequence(Qt::CTRL + Qt::Key_V)); ui.paste->setShortcut(QKeySequence(Qt::CTRL | Qt::Key_V));
} }
void MainWindow::showProfile() void MainWindow::showProfile()
@ -724,9 +734,9 @@ void MainWindow::on_actionYearlyStatistics_triggered()
l->addWidget(view); l->addWidget(view);
d.resize(lrint(width() * .8), height() / 2); d.resize(lrint(width() * .8), height() / 2);
d.move(lrint(width() * .1), height() / 4); d.move(lrint(width() * .1), height() / 4);
QShortcut *close = new QShortcut(QKeySequence(Qt::CTRL + Qt::Key_W), &d); QShortcut *close = new QShortcut(QKeySequence(Qt::CTRL | Qt::Key_W), &d);
connect(close, SIGNAL(activated()), &d, SLOT(close())); connect(close, SIGNAL(activated()), &d, SLOT(close()));
QShortcut *quit = new QShortcut(QKeySequence(Qt::CTRL + Qt::Key_Q), &d); QShortcut *quit = new QShortcut(QKeySequence(Qt::CTRL | Qt::Key_Q), &d);
connect(quit, SIGNAL(activated()), this, SLOT(close())); connect(quit, SIGNAL(activated()), this, SLOT(close()));
d.setWindowFlags(Qt::Window | Qt::CustomizeWindowHint d.setWindowFlags(Qt::Window | Qt::CustomizeWindowHint
| Qt::WindowCloseButtonHint | Qt::WindowTitleHint | Qt::WindowMaximizeButtonHint); | Qt::WindowCloseButtonHint | Qt::WindowTitleHint | Qt::WindowMaximizeButtonHint);
@ -799,9 +809,13 @@ void MainWindow::restoreSplitterSizes()
topSplitter->restoreState(settings.value("topSplitter").toByteArray()); topSplitter->restoreState(settings.value("topSplitter").toByteArray());
bottomSplitter->restoreState(settings.value("bottomSplitter").toByteArray()); bottomSplitter->restoreState(settings.value("bottomSplitter").toByteArray());
} else { } else {
#if QT_VERSION < QT_VERSION_CHECK(6, 0, 0)
const int appH = qApp->desktop()->size().height(); const int appH = qApp->desktop()->size().height();
const int appW = qApp->desktop()->size().width(); const int appW = qApp->desktop()->size().width();
#else
const int appH = screen()->size().height();
const int appW = screen()->size().width();
#endif
ui.mainSplitter->setSizes({ appH * 3 / 5, appH * 2 / 5 }); ui.mainSplitter->setSizes({ appH * 3 / 5, appH * 2 / 5 });
topSplitter->setSizes({ appW / 2, appW / 2 }); topSplitter->setSizes({ appW / 2, appW / 2 });
bottomSplitter->setSizes({ appW * 3 / 5, appW * 2 / 5 }); bottomSplitter->setSizes({ appW * 3 / 5, appW * 2 / 5 });

View File

@ -31,7 +31,7 @@ QString NotificationWidget::getNotificationText()
return text(); return text();
} }
void NotificationWidget::setFuture(const QFuture<void> &future) void NotificationWidget::setFuture(const QFuture<int> &future)
{ {
future_watcher.setFuture(future); future_watcher.setFuture(future);
} }

View File

@ -16,7 +16,7 @@ class NotificationWidget : public KMessageWidget {
public: public:
explicit NotificationWidget(QWidget *parent = 0); explicit NotificationWidget(QWidget *parent = 0);
void setFuture(const QFuture<void> &future); void setFuture(const QFuture<int> &future);
void showNotification(QString message, KMessageWidget::MessageType type); void showNotification(QString message, KMessageWidget::MessageType type);
void hideNotification(); void hideNotification();
QString getNotificationText(); QString getNotificationText();
@ -25,7 +25,7 @@ public
slots: slots:
void showError(QString message); void showError(QString message);
private: private:
QFutureWatcher<void> future_watcher; QFutureWatcher<int> future_watcher;
private private
slots: slots:

View File

@ -19,7 +19,11 @@ set(SUBSURFACE_PREFERENCES_UI
preferences_units.ui preferences_units.ui
) )
qt5_wrap_ui(SUBSURFACE_PREFERENCES_UI_HDRS ${SUBSURFACE_PREFERENCES_UI}) if(NOT USINGQT6)
qt5_wrap_ui(SUBSURFACE_PREFERENCES_UI_HDRS ${SUBSURFACE_PREFERENCES_UI})
else()
qt_wrap_ui(SUBSURFACE_PREFERENCES_UI_HDRS ${SUBSURFACE_PREFERENCES_UI})
endif()
source_group("Subsurface Interface Files" FILES ${SUBSURFACE_PREFERENCES_UI}) source_group("Subsurface Interface Files" FILES ${SUBSURFACE_PREFERENCES_UI})

View File

@ -81,7 +81,9 @@ ProfileWidget::ProfileWidget()
QHBoxLayout *layout = new QHBoxLayout(this); QHBoxLayout *layout = new QHBoxLayout(this);
layout->setSpacing(0); layout->setSpacing(0);
#if QT_VERSION < QT_VERSION_CHECK(6, 0, 0)
layout->setMargin(0); layout->setMargin(0);
#endif
layout->setContentsMargins(0, 0, 0, 0); layout->setContentsMargins(0, 0, 0, 0);
layout->addWidget(toolBar); layout->addWidget(toolBar);
layout->addWidget(stack); layout->addWidget(stack);

View File

@ -198,17 +198,5 @@
</hint> </hint>
</hints> </hints>
</connection> </connection>
<connection>
<sender>timeEdit</sender>
<signal>timeChanged(const QTime)</signal>
<receiver>ShiftTimesDialog</receiver>
<slot>changeTime()</slot>
</connection>
<connection>
<sender>backwards</sender>
<signal>toggled(bool)</signal>
<receiver>ShiftTimesDialog</receiver>
<slot>changeTime()</slot>
</connection>
</connections> </connections>
</ui> </ui>

View File

@ -45,9 +45,9 @@ RenumberDialog::RenumberDialog(bool selectedOnlyIn, QWidget *parent) : QDialog(p
{ {
ui.setupUi(this); ui.setupUi(this);
connect(ui.buttonBox, SIGNAL(clicked(QAbstractButton *)), this, SLOT(buttonClicked(QAbstractButton *))); connect(ui.buttonBox, SIGNAL(clicked(QAbstractButton *)), this, SLOT(buttonClicked(QAbstractButton *)));
QShortcut *close = new QShortcut(QKeySequence(Qt::CTRL + Qt::Key_W), this); QShortcut *close = new QShortcut(QKeySequence(Qt::CTRL | Qt::Key_W), this);
connect(close, SIGNAL(activated()), this, SLOT(close())); connect(close, SIGNAL(activated()), this, SLOT(close()));
QShortcut *quit = new QShortcut(QKeySequence(Qt::CTRL + Qt::Key_Q), this); QShortcut *quit = new QShortcut(QKeySequence(Qt::CTRL | Qt::Key_Q), this);
connect(quit, SIGNAL(activated()), parent, SLOT(close())); connect(quit, SIGNAL(activated()), parent, SLOT(close()));
if (selectedOnly && amount_selected == 1) if (selectedOnly && amount_selected == 1)
@ -72,9 +72,9 @@ SetpointDialog::SetpointDialog(struct dive *dIn, int dcNrIn, int seconds) : QDia
{ {
ui.setupUi(this); ui.setupUi(this);
connect(ui.buttonBox, &QDialogButtonBox::clicked, this, &SetpointDialog::buttonClicked); connect(ui.buttonBox, &QDialogButtonBox::clicked, this, &SetpointDialog::buttonClicked);
QShortcut *close = new QShortcut(QKeySequence(Qt::CTRL + Qt::Key_W), this); QShortcut *close = new QShortcut(QKeySequence(Qt::CTRL | Qt::Key_W), this);
connect(close, &QShortcut::activated, this, &QDialog::close); connect(close, &QShortcut::activated, this, &QDialog::close);
QShortcut *quit = new QShortcut(QKeySequence(Qt::CTRL + Qt::Key_Q), this); QShortcut *quit = new QShortcut(QKeySequence(Qt::CTRL | Qt::Key_Q), this);
connect(quit, &QShortcut::activated, MainWindow::instance(), &QWidget::close); connect(quit, &QShortcut::activated, MainWindow::instance(), &QWidget::close);
} }
@ -116,9 +116,9 @@ ShiftTimesDialog::ShiftTimesDialog(QWidget *parent) : QDialog(parent),
connect(ui.buttonBox, SIGNAL(clicked(QAbstractButton *)), this, SLOT(buttonClicked(QAbstractButton *))); connect(ui.buttonBox, SIGNAL(clicked(QAbstractButton *)), this, SLOT(buttonClicked(QAbstractButton *)));
connect(ui.timeEdit, SIGNAL(timeChanged(const QTime)), this, SLOT(changeTime())); connect(ui.timeEdit, SIGNAL(timeChanged(const QTime)), this, SLOT(changeTime()));
connect(ui.backwards, SIGNAL(toggled(bool)), this, SLOT(changeTime())); connect(ui.backwards, SIGNAL(toggled(bool)), this, SLOT(changeTime()));
QShortcut *close = new QShortcut(QKeySequence(Qt::CTRL + Qt::Key_W), this); QShortcut *close = new QShortcut(QKeySequence(Qt::CTRL | Qt::Key_W), this);
connect(close, SIGNAL(activated()), this, SLOT(close())); connect(close, SIGNAL(activated()), this, SLOT(close()));
QShortcut *quit = new QShortcut(QKeySequence(Qt::CTRL + Qt::Key_Q), this); QShortcut *quit = new QShortcut(QKeySequence(Qt::CTRL | Qt::Key_Q), this);
connect(quit, SIGNAL(activated()), parent, SLOT(close())); connect(quit, SIGNAL(activated()), parent, SLOT(close()));
} }
@ -144,7 +144,7 @@ void ShiftImageTimesDialog::syncCameraClicked()
ui.DCImage->setScene(scene); ui.DCImage->setScene(scene);
dcImageEpoch = picture_get_timestamp(qPrintable(fileNames.at(0))); dcImageEpoch = picture_get_timestamp(qPrintable(fileNames.at(0)));
QDateTime dcDateTime = QDateTime::fromTime_t(dcImageEpoch, Qt::UTC); QDateTime dcDateTime = QDateTime::fromSecsSinceEpoch(dcImageEpoch, Qt::UTC);
ui.dcTime->setDateTime(dcDateTime); ui.dcTime->setDateTime(dcDateTime);
connect(ui.dcTime, SIGNAL(dateTimeChanged(const QDateTime &)), this, SLOT(dcDateTimeChanged(const QDateTime &))); connect(ui.dcTime, SIGNAL(dateTimeChanged(const QDateTime &)), this, SLOT(dcDateTimeChanged(const QDateTime &)));
} }
@ -213,8 +213,8 @@ void ShiftImageTimesDialog::updateInvalid()
bool allValid = true; bool allValid = true;
ui.warningLabel->hide(); ui.warningLabel->hide();
ui.invalidFilesText->hide(); ui.invalidFilesText->hide();
QDateTime time_first = QDateTime::fromTime_t(first_selected_dive()->when, Qt::UTC); QDateTime time_first = QDateTime::fromSecsSinceEpoch(first_selected_dive()->when, Qt::UTC);
QDateTime time_last = QDateTime::fromTime_t(last_selected_dive()->when, Qt::UTC); QDateTime time_last = QDateTime::fromSecsSinceEpoch(last_selected_dive()->when, Qt::UTC);
if (first_selected_dive() == last_selected_dive()) { if (first_selected_dive() == last_selected_dive()) {
ui.invalidFilesText->setPlainText(tr("Selected dive date/time") + ": " + time_first.toString()); ui.invalidFilesText->setPlainText(tr("Selected dive date/time") + ": " + time_first.toString());
} else { } else {
@ -229,7 +229,7 @@ void ShiftImageTimesDialog::updateInvalid()
continue; continue;
// We've found an invalid image // We've found an invalid image
time_first.setTime_t(timestamps[i] + m_amount); time_first.setSecsSinceEpoch(timestamps[i] + m_amount);
if (timestamps[i] == 0) if (timestamps[i] == 0)
ui.invalidFilesText->append(fileNames[i] + " - " + tr("No Exif date/time found")); ui.invalidFilesText->append(fileNames[i] + " - " + tr("No Exif date/time found"));
else else
@ -271,9 +271,9 @@ void ShiftImageTimesDialog::backwardsChanged(bool)
URLDialog::URLDialog(QWidget *parent) : QDialog(parent) URLDialog::URLDialog(QWidget *parent) : QDialog(parent)
{ {
ui.setupUi(this); ui.setupUi(this);
QShortcut *close = new QShortcut(QKeySequence(Qt::CTRL + Qt::Key_W), this); QShortcut *close = new QShortcut(QKeySequence(Qt::CTRL | Qt::Key_W), this);
connect(close, SIGNAL(activated()), this, SLOT(close())); connect(close, SIGNAL(activated()), this, SLOT(close()));
QShortcut *quit = new QShortcut(QKeySequence(Qt::CTRL + Qt::Key_Q), this); QShortcut *quit = new QShortcut(QKeySequence(Qt::CTRL | Qt::Key_Q), this);
connect(quit, SIGNAL(activated()), parent, SLOT(close())); connect(quit, SIGNAL(activated()), parent, SLOT(close()));
} }
@ -317,9 +317,9 @@ DiveComponentSelection::DiveComponentSelection(QWidget *parent, struct dive *tar
UI_FROM_COMPONENT(number); UI_FROM_COMPONENT(number);
UI_FROM_COMPONENT(when); UI_FROM_COMPONENT(when);
connect(ui.buttonBox, SIGNAL(clicked(QAbstractButton *)), this, SLOT(buttonClicked(QAbstractButton *))); connect(ui.buttonBox, SIGNAL(clicked(QAbstractButton *)), this, SLOT(buttonClicked(QAbstractButton *)));
QShortcut *close = new QShortcut(QKeySequence(Qt::CTRL + Qt::Key_W), this); QShortcut *close = new QShortcut(QKeySequence(Qt::CTRL | Qt::Key_W), this);
connect(close, SIGNAL(activated()), this, SLOT(close())); connect(close, SIGNAL(activated()), this, SLOT(close()));
QShortcut *quit = new QShortcut(QKeySequence(Qt::CTRL + Qt::Key_Q), this); QShortcut *quit = new QShortcut(QKeySequence(Qt::CTRL | Qt::Key_Q), this);
connect(quit, SIGNAL(activated()), parent, SLOT(close())); connect(quit, SIGNAL(activated()), parent, SLOT(close()));
} }

View File

@ -157,7 +157,7 @@ static DiveListResult parseDiveLogsDeDiveList(const QByteArray &xmlData)
DiveListResult result; DiveListResult result;
result.idCount = 0; result.idCount = 0;
if (reader.readNextStartElement() && reader.name() != "DiveDateReader") { if (reader.readNextStartElement() && nameCmp(reader, "DiveDateReader") != 0) {
result.errorCondition = invalidXmlError; result.errorCondition = invalidXmlError;
result.errorDetails = result.errorDetails =
gettextFromC::tr("Expected XML tag 'DiveDateReader', got instead '%1") gettextFromC::tr("Expected XML tag 'DiveDateReader', got instead '%1")
@ -166,8 +166,8 @@ static DiveListResult parseDiveLogsDeDiveList(const QByteArray &xmlData)
} }
while (reader.readNextStartElement()) { while (reader.readNextStartElement()) {
if (reader.name() != "DiveDates") { if (nameCmp(reader, "DiveDates") != 0) {
if (reader.name() == "Login") { if (nameCmp(reader, "Login") == 0) {
QString status = reader.readElementText(); QString status = reader.readElementText();
// qDebug() << "Login status:" << status; // qDebug() << "Login status:" << status;
@ -185,11 +185,11 @@ static DiveListResult parseDiveLogsDeDiveList(const QByteArray &xmlData)
// process <DiveDates> // process <DiveDates>
seenDiveDates = true; seenDiveDates = true;
while (reader.readNextStartElement()) { while (reader.readNextStartElement()) {
if (reader.name() != "date") { if (nameCmp(reader, "date") != 0) {
// qDebug() << "Skipping" << reader.name(); // qDebug() << "Skipping" << reader.name();
continue; continue;
} }
QStringRef id = reader.attributes().value("divelogsId"); auto id = reader.attributes().value("divelogsId");
// qDebug() << "Found" << reader.name() << "with id =" << id; // qDebug() << "Found" << reader.name() << "with id =" << id;
if (!id.isEmpty()) { if (!id.isEmpty()) {
result.idList += id.toLatin1(); result.idList += id.toLatin1();
@ -259,9 +259,9 @@ DivelogsDeWebServices::DivelogsDeWebServices(QWidget *parent) : WebServices(pare
ui.password->setText(qPrefCloudStorage::divelogde_pass()); ui.password->setText(qPrefCloudStorage::divelogde_pass());
ui.saveUidLocal->hide(); ui.saveUidLocal->hide();
hideUpload(); hideUpload();
QShortcut *close = new QShortcut(QKeySequence(Qt::CTRL + Qt::Key_W), this); QShortcut *close = new QShortcut(QKeySequence(Qt::CTRL | Qt::Key_W), this);
connect(close, SIGNAL(activated()), this, SLOT(close())); connect(close, SIGNAL(activated()), this, SLOT(close()));
QShortcut *quit = new QShortcut(QKeySequence(Qt::CTRL + Qt::Key_Q), this); QShortcut *quit = new QShortcut(QKeySequence(Qt::CTRL | Qt::Key_Q), this);
connect(quit, SIGNAL(activated()), parent, SLOT(close())); connect(quit, SIGNAL(activated()), parent, SLOT(close()));
} }

View File

@ -89,8 +89,10 @@ MainTab::MainTab(QWidget *parent) : QTabWidget(parent),
connect(&diveListNotifier, &DiveListNotifier::settingsChanged, this, &MainTab::updateDiveInfo); connect(&diveListNotifier, &DiveListNotifier::settingsChanged, this, &MainTab::updateDiveInfo);
connect(ui.editDiveSiteButton, &QToolButton::clicked, MainWindow::instance(), &MainWindow::startDiveSiteEdit); connect(ui.editDiveSiteButton, &QToolButton::clicked, MainWindow::instance(), &MainWindow::startDiveSiteEdit);
#if QT_VERSION < QT_VERSION_CHECK(6, 0, 0)
connect(ui.location, &DiveLocationLineEdit::entered, MapWidget::instance(), &MapWidget::centerOnIndex); connect(ui.location, &DiveLocationLineEdit::entered, MapWidget::instance(), &MapWidget::centerOnIndex);
connect(ui.location, &DiveLocationLineEdit::currentChanged, MapWidget::instance(), &MapWidget::centerOnIndex); connect(ui.location, &DiveLocationLineEdit::currentChanged, MapWidget::instance(), &MapWidget::centerOnIndex);
#endif
connect(ui.location, &DiveLocationLineEdit::editingFinished, this, &MainTab::on_location_diveSiteSelected); connect(ui.location, &DiveLocationLineEdit::editingFinished, this, &MainTab::on_location_diveSiteSelected);
// One might think that we could listen to the precise property-changed signals of the preferences system. // One might think that we could listen to the precise property-changed signals of the preferences system.

View File

@ -11,7 +11,11 @@ TagWidget::TagWidget(QWidget *parent) : GroupedLineEdit(parent), m_completer(NUL
connect(this, SIGNAL(textChanged()), this, SLOT(reparse())); connect(this, SIGNAL(textChanged()), this, SLOT(reparse()));
QColor textColor = palette().color(QPalette::Text); QColor textColor = palette().color(QPalette::Text);
#if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0)
float h, s, l, a;
#else
qreal h, s, l, a; qreal h, s, l, a;
#endif
textColor.getHslF(&h, &s, &l, &a); textColor.getHslF(&h, &s, &l, &a);
// I use dark themes // I use dark themes
if (l <= 0.3) { // very dark text. get a brigth background if (l <= 0.3) { // very dark text. get a brigth background

View File

@ -10,9 +10,9 @@ TripSelectionDialog::TripSelectionDialog(QWidget *parent) : QDialog(parent)
ui.setupUi(this); ui.setupUi(this);
connect(ui.trips, &QListWidget::itemSelectionChanged, this, &TripSelectionDialog::selectionChanged); connect(ui.trips, &QListWidget::itemSelectionChanged, this, &TripSelectionDialog::selectionChanged);
QShortcut *close = new QShortcut(QKeySequence(Qt::CTRL + Qt::Key_W), this); QShortcut *close = new QShortcut(QKeySequence(Qt::CTRL | Qt::Key_W), this);
connect(close, &QShortcut::activated, this, &QDialog::close); connect(close, &QShortcut::activated, this, &QDialog::close);
QShortcut *quit = new QShortcut(QKeySequence(Qt::CTRL + Qt::Key_Q), this); QShortcut *quit = new QShortcut(QKeySequence(Qt::CTRL | Qt::Key_Q), this);
connect(quit, &QShortcut::activated, parent, &QWidget::close); connect(quit, &QShortcut::activated, parent, &QWidget::close);
// We could use a model, but it seems barely worth the hassle. // We could use a model, but it seems barely worth the hassle.

View File

@ -11,4 +11,4 @@ ANDROID_PLATFORMS=android-29
ANDROID_NDK=ndk/${NDK_VERSION} ANDROID_NDK=ndk/${NDK_VERSION}
# OpenSSL also has an entry in get-dep-lib.sh line 103 # OpenSSL also has an entry in get-dep-lib.sh line 103
# that needs to be updated as well. # that needs to be updated as well.
OPENSSL_VERSION=1.1.1h OPENSSL_VERSION=1.1.1m

View File

@ -1,23 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>NSPrincipalClass</key>
<string>NSApplication</string>
<key>CFBundleIconFile</key>
<string>Subsurface.icns</string>
<key>CFBundleName</key>
<string>Subsurface</string>
<key>CFBundlePackageType</key>
<string>APPL</string>
<key>CFBundleExecutable</key>
<string>subsurface</string>
<key>CFBundleIdentifier</key>
<string>org.hohndel.subsurface</string>
<key>CFBundleInfoDictionaryVersion</key>
<string>6.0</string>
<key>CFBundleVersion</key>
<string>@SHORT_VERSION@</string>
<key>NSSupportsAutomaticGraphicsSwitching</key><true/>
</dict>
</plist>

View File

@ -6,8 +6,8 @@
#include <array> #include <array>
DivePercentageItem::DivePercentageItem(const DiveCartesianAxis &hAxis, const DiveCartesianAxis &vAxis, double dpr) : DivePercentageItem::DivePercentageItem(const DiveCartesianAxis &hAxis, const DiveCartesianAxis &vAxis) :
hAxis(hAxis), vAxis(vAxis), dpr(dpr) hAxis(hAxis), vAxis(vAxis)
{ {
} }

View File

@ -10,12 +10,11 @@ class DiveCartesianAxis;
class DivePercentageItem : public QGraphicsPixmapItem { class DivePercentageItem : public QGraphicsPixmapItem {
public: public:
DivePercentageItem(const DiveCartesianAxis &hAxis, const DiveCartesianAxis &vAxis, double dpr); DivePercentageItem(const DiveCartesianAxis &hAxis, const DiveCartesianAxis &vAxis);
void replot(const dive *d, const divecomputer *dc, const plot_info &pi); void replot(const dive *d, const divecomputer *dc, const plot_info &pi);
private: private:
const DiveCartesianAxis &hAxis; const DiveCartesianAxis &hAxis;
const DiveCartesianAxis &vAxis; const DiveCartesianAxis &vAxis;
double dpr;
}; };
#endif #endif

View File

@ -144,7 +144,7 @@ ProfileScene::ProfileScene(double dpr, bool printMode, bool isGrayscale) :
heartBeatItem(createItem<DiveHeartrateItem>(*heartBeatAxis, heartBeatItem(createItem<DiveHeartrateItem>(*heartBeatAxis,
[](const plot_data &item) { return (double)item.heartbeat; }, [](const plot_data &item) { return (double)item.heartbeat; },
1, dpr)), 1, dpr)),
percentageItem(new DivePercentageItem(*timeAxis, *percentageAxis, dpr)), percentageItem(new DivePercentageItem(*timeAxis, *percentageAxis)),
tankItem(new TankItem(*timeAxis, dpr)), tankItem(new TankItem(*timeAxis, dpr)),
pixmaps(getDivePixmaps(dpr)) pixmaps(getDivePixmaps(dpr))
{ {

View File

@ -21,8 +21,6 @@ set(SUBSURFACE_GENERIC_MODELS_LIB_SRCS
filterconstraintmodel.h filterconstraintmodel.h
filterpresetmodel.cpp filterpresetmodel.cpp
filterpresetmodel.h filterpresetmodel.h
maplocationmodel.cpp
maplocationmodel.h
models.cpp models.cpp
models.h models.h
tankinfomodel.cpp tankinfomodel.cpp
@ -31,6 +29,13 @@ set(SUBSURFACE_GENERIC_MODELS_LIB_SRCS
weightsysteminfomodel.h weightsysteminfomodel.h
) )
if(NOT USINGQT6)
LIST(APPEND SUBSURFACE_GENERIC_MODELS_LIB_SRCS
maplocationmodel.cpp
maplocationmodel.h
)
endif()
# models exclusively used in desktop builds # models exclusively used in desktop builds
set(SUBSURFACE_DESKTOP_MODELS_LIB_SRCS set(SUBSURFACE_DESKTOP_MODELS_LIB_SRCS
divecomputerextradatamodel.cpp divecomputerextradatamodel.cpp

View File

@ -1086,7 +1086,11 @@ void DivePlannerPointsModel::updateDiveProfile()
// Since we're calling computeVariations asynchronously and plan_deco_state is allocated // Since we're calling computeVariations asynchronously and plan_deco_state is allocated
// on the stack, it must be copied and freed by the worker-thread. // on the stack, it must be copied and freed by the worker-thread.
struct deco_state *plan_deco_state_copy = new deco_state(plan_deco_state); struct deco_state *plan_deco_state_copy = new deco_state(plan_deco_state);
#if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0)
QtConcurrent::run(&DivePlannerPointsModel::computeVariationsFreeDeco, this, plan_copy, plan_deco_state_copy);
#else
QtConcurrent::run(this, &DivePlannerPointsModel::computeVariationsFreeDeco, plan_copy, plan_deco_state_copy); QtConcurrent::run(this, &DivePlannerPointsModel::computeVariationsFreeDeco, plan_copy, plan_deco_state_copy);
#endif
#else #else
computeVariations(plan_copy, &plan_deco_state); computeVariations(plan_copy, &plan_deco_state);
#endif #endif

View File

@ -224,9 +224,13 @@ if [ -n "$CMAKE_PREFIX_PATH" ] ; then
else else
hash qmake > /dev/null 2> /dev/null && QMAKE=qmake hash qmake > /dev/null 2> /dev/null && QMAKE=qmake
[ -z $QMAKE ] && hash qmake-qt5 > /dev/null 2> /dev/null && QMAKE=qmake-qt5 [ -z $QMAKE ] && hash qmake-qt5 > /dev/null 2> /dev/null && QMAKE=qmake-qt5
[ -z $QMAKE ] && echo "cannot find qmake or qmake-qt5" && exit 1 [ -z $QMAKE ] && hash qmake-qt6 > /dev/null 2> /dev/null && QMAKE=qmake-qt6
[ -z $QMAKE ] && echo "cannot find qmake, qmake-qt5, or qmake-qt6" && exit 1
fi fi
# grab the Qt version
QT_VERSION=$($QMAKE -query QT_VERSION)
# it's not entirely clear why we only set this on macOS, but this appears to be what works # it's not entirely clear why we only set this on macOS, but this appears to be what works
if [ "$PLATFORM" = Darwin ] ; then if [ "$PLATFORM" = Darwin ] ; then
if [ -z "$CMAKE_PREFIX_PATH" ] ; then if [ -z "$CMAKE_PREFIX_PATH" ] ; then
@ -244,9 +248,8 @@ fi
# on Debian and Ubuntu based systems, the private QtLocation and # on Debian and Ubuntu based systems, the private QtLocation and
# QtPositioning headers aren't bundled. Download them if necessary. # QtPositioning headers aren't bundled. Download them if necessary.
if [ "$PLATFORM" = Linux ] ; then if [ "$PLATFORM" = Linux ] && [[ $QT_VERSION == 5* ]] ; then
QT_HEADERS_PATH=$($QMAKE -query QT_INSTALL_HEADERS) QT_HEADERS_PATH=$($QMAKE -query QT_INSTALL_HEADERS)
QT_VERSION=$($QMAKE -query QT_VERSION)
if [ ! -d "$QT_HEADERS_PATH/QtLocation/$QT_VERSION/QtLocation/private" ] && if [ ! -d "$QT_HEADERS_PATH/QtLocation/$QT_VERSION/QtLocation/private" ] &&
[ ! -d "$INSTALL_ROOT"/include/QtLocation/private ] ; then [ ! -d "$INSTALL_ROOT"/include/QtLocation/private ] ; then
@ -348,7 +351,8 @@ if [[ $PLATFORM = Darwin && "$BUILD_DEPS" == "1" ]] ; then
pushd openssl pushd openssl
mkdir -p build mkdir -p build
cd build cd build
../Configure --prefix="$INSTALL_ROOT" --openssldir="$INSTALL_ROOT" "$OLDER_MAC" darwin64-x86_64-cc if [ $(arch) == "arm64" ] ; then OS_ARCH=darwin64-arm64-cc ; else OS_ARCH=darwin64-x86_64-cc; fi
../Configure --prefix="$INSTALL_ROOT" --openssldir="$INSTALL_ROOT" "$OLDER_MAC" $OS_ARCH
make depend make depend
# all the tests fail because the assume that openssl is already installed. Odd? Still thinks work # all the tests fail because the assume that openssl is already installed. Odd? Still thinks work
make -j4 -k make -j4 -k
@ -436,6 +440,7 @@ if [[ $PLATFORM = Darwin && "$BUILD_DEPS" == "1" ]] ; then
./${SRC_DIR}/scripts/get-dep-lib.sh single . libmtp ./${SRC_DIR}/scripts/get-dep-lib.sh single . libmtp
pushd libmtp pushd libmtp
patch -p1 < ../${SRC_DIR}/scripts/libmtp.patch
echo 'N' | NOCONFIGURE="1" bash ./autogen.sh echo 'N' | NOCONFIGURE="1" bash ./autogen.sh
mkdir -p build mkdir -p build
cd build cd build
@ -504,7 +509,7 @@ STATIC_LIBDC="$INSTALL_ROOT/$(grep ^libdir Makefile | cut -d/ -f2)/libdivecomput
cd "$SRC" cd "$SRC"
if [ "$QUICK" != "1" ] && [ "$BUILD_DESKTOP$BUILD_MOBILE" != "" ] ; then if [ "$QUICK" != "1" ] && [ "$BUILD_DESKTOP$BUILD_MOBILE" != "" ] && [[ $QT_VERSION == 5* ]] ; then
# build the googlemaps map plugin # build the googlemaps map plugin
cd "$SRC" cd "$SRC"

View File

@ -6,8 +6,8 @@ CURRENT_LIBZ="v1.2.11"
CURRENT_LIBZIP="rel-1-5-1" CURRENT_LIBZIP="rel-1-5-1"
CURRENT_LIBGIT2="v1.0.1" CURRENT_LIBGIT2="v1.0.1"
CURRENT_LIBCURL="curl-7_54_1" CURRENT_LIBCURL="curl-7_54_1"
CURRENT_LIBUSB="v1.0.21" CURRENT_LIBUSB="v1.0.25"
CURRENT_OPENSSL="OpenSSL_1_1_1h" CURRENT_OPENSSL="OpenSSL_1_1_1m"
CURRENT_LIBSSH2="libssh2-1.8.0" CURRENT_LIBSSH2="libssh2-1.8.0"
CURRENT_XSLT="v1.1.34" CURRENT_XSLT="v1.1.34"
CURRENT_SQLITE="3190200" CURRENT_SQLITE="3190200"
@ -103,7 +103,7 @@ fi
# FIX FOR ANDROID, # FIX FOR ANDROID,
if [ "$PLATFORM" == "singleAndroid" ] ; then if [ "$PLATFORM" == "singleAndroid" ] ; then
CURRENT_OPENSSL="OpenSSL_1_1_1h" CURRENT_OPENSSL="OpenSSL_1_1_1m"
# If changing the openSSL version here, make sure to change it in packaging/android/variables.sh also. # If changing the openSSL version here, make sure to change it in packaging/android/variables.sh also.
fi fi
# no curl and old libs (never version breaks) # no curl and old libs (never version breaks)

13
scripts/libmtp.patch Normal file
View File

@ -0,0 +1,13 @@
diff --git a/libmtp.pc.in b/libmtp.pc.in
index 93c7bbf..ff817e1 100644
--- a/libmtp.pc.in
+++ b/libmtp.pc.in
@@ -10,6 +10,6 @@ Description: libmtp is a library for accessing Media Transfer Protocol devices
Version: @VERSION@
Requires.private: @LIBUSB_REQUIRES@
Conflicts:
-Libs: -L${libdir} -lmtp
+Libs: -L${libdir} -lmtp @OSFLAGS@
Libs.private: @LIBS@
-Cflags: -I${includedir} @OSFLAGS@
+Cflags: -I${includedir}

View File

@ -8,8 +8,7 @@
#include <vector> #include <vector>
#include <QPointF> #include <QPointF>
#include <QSGNode> #include <QSGNode>
#include "core/dive.h"
struct dive;
// Round positions to integer values to avoid ugly artifacts // Round positions to integer values to avoid ugly artifacts
QPointF roundPos(const QPointF &p); QPointF roundPos(const QPointF &p);

View File

@ -113,7 +113,7 @@ template<> int invalid_value<int>()
} }
template<> double invalid_value<double>() template<> double invalid_value<double>()
{ {
return std::numeric_limits<double>::quiet_NaN(); return NaN;
} }
template<> QString invalid_value<QString>() template<> QString invalid_value<QString>()
{ {
@ -121,7 +121,6 @@ template<> QString invalid_value<QString>()
} }
template<> StatsQuartiles invalid_value<StatsQuartiles>() template<> StatsQuartiles invalid_value<StatsQuartiles>()
{ {
double NaN = std::numeric_limits<double>::quiet_NaN();
return { std::vector<dive *>(), NaN, NaN, NaN, NaN, NaN }; return { std::vector<dive *>(), NaN, NaN, NaN, NaN, NaN };
} }

View File

@ -309,14 +309,22 @@ QRectF StatsView::plotArea() const
return plotRect; return plotRect;
} }
#if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0)
void StatsView::geometryChange(const QRectF &newGeometry, const QRectF &oldGeometry)
#else
void StatsView::geometryChanged(const QRectF &newGeometry, const QRectF &oldGeometry) void StatsView::geometryChanged(const QRectF &newGeometry, const QRectF &oldGeometry)
#endif
{ {
plotRect = QRectF(QPointF(0.0, 0.0), newGeometry.size()); plotRect = QRectF(QPointF(0.0, 0.0), newGeometry.size());
backgroundDirty = true; backgroundDirty = true;
plotAreaChanged(plotRect.size()); plotAreaChanged(plotRect.size());
// Do we need to call the base-class' version of geometryChanged? Probably for QML? // Do we need to call the base-class' version of geometryChanged? Probably for QML?
#if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0)
QQuickItem::geometryChange(newGeometry, oldGeometry);
#else
QQuickItem::geometryChanged(newGeometry, oldGeometry); QQuickItem::geometryChanged(newGeometry, oldGeometry);
#endif
} }
void StatsView::plotAreaChanged(const QSizeF &s) void StatsView::plotAreaChanged(const QSizeF &s)

View File

@ -77,7 +77,11 @@ private:
QRectF plotRect; QRectF plotRect;
QSGNode *updatePaintNode(QSGNode *oldNode, QQuickItem::UpdatePaintNodeData *updatePaintNodeData) override; QSGNode *updatePaintNode(QSGNode *oldNode, QQuickItem::UpdatePaintNodeData *updatePaintNodeData) override;
#if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0)
void geometryChange(const QRectF &newGeometry, const QRectF &oldGeometry) override;
#else
void geometryChanged(const QRectF &newGeometry, const QRectF &oldGeometry) override; void geometryChanged(const QRectF &newGeometry, const QRectF &oldGeometry) override;
#endif
void plotAreaChanged(const QSizeF &size); void plotAreaChanged(const QSizeF &size);
void reset(); // clears all series and axes void reset(); // clears all series and axes
void setAxes(StatsAxis *x, StatsAxis *y); void setAxes(StatsAxis *x, StatsAxis *y);

View File

@ -204,7 +204,7 @@ exit:
surface.destroy(); surface.destroy();
if (glError) { if (glError) {
qWarning() << QStringLiteral(VALIDATE_GL_PREFIX "WARNING: %1. Using a software renderer!").arg(glError); qWarning() << QStringLiteral(VALIDATE_GL_PREFIX "WARNING: %1. Using a software renderer!").arg(glError);
QQuickWindow::setSceneGraphBackend(QSGRendererInterface::Software); QQuickWindow::setSceneGraphBackend("software");
} }
} }

View File

@ -2,8 +2,11 @@
#include <QQmlEngine> #include <QQmlEngine>
#include <QQuickItem> #include <QQuickItem>
#if QT_VERSION < QT_VERSION_CHECK(6, 0, 0)
#include "map-widget/qmlmapwidgethelper.h" #include "map-widget/qmlmapwidgethelper.h"
#include "qt-models/maplocationmodel.h" #include "qt-models/maplocationmodel.h"
#endif
#include "stats/statsview.h" #include "stats/statsview.h"
#include "core/qt-gui.h" #include "core/qt-gui.h"
#include "core/settings/qPref.h" #include "core/settings/qPref.h"
@ -222,7 +225,9 @@ static void register_qml_types(QQmlEngine *engine)
register_qml_type<ChartListModel>("ChartListModel"); register_qml_type<ChartListModel>("ChartListModel");
#endif // not SUBSURFACE_MOBILE #endif // not SUBSURFACE_MOBILE
#if QT_VERSION < QT_VERSION_CHECK(6, 0, 0)
register_qml_type<MapWidgetHelper>("MapWidgetHelper"); register_qml_type<MapWidgetHelper>("MapWidgetHelper");
register_qml_type<MapLocationModel>("MapLocationModel"); register_qml_type<MapLocationModel>("MapLocationModel");
#endif
register_qml_type<StatsView>("StatsView"); register_qml_type<StatsView>("StatsView");
} }

View File

@ -1,5 +1,9 @@
# QTest based tests # QTest based tests
qt5_add_resources(SUBSURFACE_TEST_RESOURCES ../subsurface.qrc) if(NOT USINGQT6)
qt5_add_resources(SUBSURFACE_TEST_RESOURCES ../subsurface.qrc)
else()
qt_add_resources(SUBSURFACE_TEST_RESOURCES ../subsurface.qrc)
endif()
# Access test data (dive folder) from SUBSURFACE_SOURCE by default. # Access test data (dive folder) from SUBSURFACE_SOURCE by default.
# In cross compilation cases or when test will not be executed at build time # In cross compilation cases or when test will not be executed at build time

View File

@ -10,6 +10,7 @@
#include <QFile> #include <QFile>
#include <QDebug> #include <QDebug>
#include <QNetworkProxy> #include <QNetworkProxy>
#include "QTextCodec"
#define LARGE_TEST_REPO "https://github.com/Subsurface/large-anonymous-sample-data" #define LARGE_TEST_REPO "https://github.com/Subsurface/large-anonymous-sample-data"

View File

@ -6,6 +6,7 @@
#include "core/file.h" #include "core/file.h"
#include "core/save-profiledata.h" #include "core/save-profiledata.h"
#include "core/pref.h" #include "core/pref.h"
#include "QTextCodec"
// This test compares the content of struct profile against a known reference version for a list // This test compares the content of struct profile against a known reference version for a list
// of dives to prevent accidental regressions. Thus is you change anything in the profile this // of dives to prevent accidental regressions. Thus is you change anything in the profile this
@ -18,7 +19,6 @@ void TestProfile::init()
{ {
// Set UTF8 text codec as in real applications // Set UTF8 text codec as in real applications
QTextCodec::setCodecForLocale(QTextCodec::codecForMib(106)); QTextCodec::setCodecForLocale(QTextCodec::codecForMib(106));
// first, setup the preferences // first, setup the preferences
// normally we should be able to do this - but it makes this test fail because the reference data // normally we should be able to do this - but it makes this test fail because the reference data

View File

@ -53,8 +53,12 @@ set(US_EN_PLURALS subsurface_en_US.ts)
# subsurface_vi.ts # subsurface_vi.ts
# subsurface_zh_CN.ts # subsurface_zh_CN.ts
if(NOT USINGQT6)
qt5_add_translation(TRANSLATIONS ${TRANSLATION_FILES} ${US_EN_PLURALS})
else()
qt_add_translation(TRANSLATIONS ${TRANSLATION_FILES} ${US_EN_PLURALS})
endif()
qt5_add_translation(TRANSLATIONS ${TRANSLATION_FILES} ${US_EN_PLURALS})
set(TRANSLATIONS ${TRANSLATIONS} PARENT_SCOPE) set(TRANSLATIONS ${TRANSLATIONS} PARENT_SCOPE)
add_custom_target (translations ALL DEPENDS ${TRANSLATIONS}) add_custom_target (translations ALL DEPENDS ${TRANSLATIONS})