Compare commits
32 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
da4668da40 | ||
|
|
e92d19ac4f | ||
|
|
f0e4f78b5e | ||
|
|
aaebb69ddb | ||
|
|
75fca8c090 | ||
|
|
2af3da96a7 | ||
|
|
da44db1a7e | ||
|
|
7034d8bd54 | ||
|
|
5654b3fd2e | ||
|
|
4f08d643b9 | ||
|
|
5a023c953b | ||
|
|
214cd63836 | ||
|
|
cabc33a689 | ||
|
|
e5f62bcd62 | ||
|
|
7574d8c04a | ||
|
|
a9777f2980 | ||
|
|
55992bc975 | ||
|
|
04b26d31c8 | ||
|
|
14362c2f55 | ||
|
|
caf06f9ae7 | ||
|
|
fd38204b81 | ||
|
|
3f3da0cf75 | ||
|
|
82d52b28f8 | ||
|
|
baa0e99285 | ||
|
|
82c6843092 | ||
|
|
e6996ce366 | ||
|
|
5cbee7710d | ||
|
|
fe7fd65f74 | ||
|
|
b753eba40b | ||
|
|
6a3618395f | ||
|
|
2480431b65 | ||
|
|
5e7a121c1f |
127
CMakeLists.txt
127
CMakeLists.txt
@ -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)
|
||||
|
||||
#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)
|
||||
|
||||
# Options regarding What should we build on subsurface
|
||||
@ -173,6 +173,30 @@ include_directories(.
|
||||
${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,
|
||||
# if the configuration is too big or would disrupt the normal code flux,
|
||||
# move it somewhere else (another file) and include it.
|
||||
@ -284,39 +308,38 @@ if(ANDROID)
|
||||
# our Qt installation. This is ugly, but it works.
|
||||
set(CMAKE_FIND_ROOT_PATH "/;${CMAKE_FIND_ROOT_PATH}")
|
||||
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")
|
||||
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")
|
||||
# Kirigami 5.62 and newer require at least Qt 5.12
|
||||
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()
|
||||
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()
|
||||
elseif (SUBSURFACE_TARGET_EXECUTABLE MATCHES "DownloaderExecutable")
|
||||
# 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)
|
||||
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})
|
||||
list(APPEND QT_LIBRARIES Qt5::${_QT_COMPONENT})
|
||||
list(APPEND QT_LIBRARIES Qt${QT5OR6}::${_QT_COMPONENT})
|
||||
endforeach()
|
||||
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()
|
||||
|
||||
#set up the subsurface_link_libraries variable
|
||||
set(SUBSURFACE_LINK_LIBRARIES ${SUBSURFACE_LINK_LIBRARIES} ${LIBDIVECOMPUTER_LIBRARIES} ${LIBGIT2_LIBRARIES} ${LIBUSB_LIBRARIES} ${LIBMTP_LIBRARIES})
|
||||
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()
|
||||
|
||||
# hack to build successfully on LGTM
|
||||
@ -333,7 +356,9 @@ add_subdirectory(qt-models)
|
||||
add_subdirectory(commands)
|
||||
if (NOT SUBSURFACE_TARGET_EXECUTABLE MATCHES "DownloaderExecutable")
|
||||
add_subdirectory(profile-widget)
|
||||
if(NOT USINGQT6)
|
||||
add_subdirectory(map-widget)
|
||||
endif()
|
||||
add_subdirectory(mobile-widgets)
|
||||
add_subdirectory(stats)
|
||||
endif()
|
||||
@ -361,9 +386,15 @@ if (SUBSURFACE_TARGET_EXECUTABLE MATCHES "MobileExecutable")
|
||||
subsurface-mobile-main.cpp
|
||||
subsurface-helper.cpp
|
||||
)
|
||||
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)
|
||||
if(USINGQT6)
|
||||
qt_add_resources(MOBILE_RESOURCES mobile-widgets/qml/mobile-resources.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
|
||||
# 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_mobile
|
||||
subsurface_profile
|
||||
subsurface_mapwidget
|
||||
${SUBSURFACE_MAPWIDGET}
|
||||
subsurface_backend_shared
|
||||
subsurface_models_mobile
|
||||
subsurface_commands
|
||||
@ -401,7 +432,7 @@ elseif (SUBSURFACE_TARGET_EXECUTABLE MATCHES "DesktopExecutable")
|
||||
subsurface_interface
|
||||
subsurface_profile
|
||||
subsurface_statistics
|
||||
subsurface_mapwidget
|
||||
${SUBSURFACE_MAPWIDGET}
|
||||
subsurface_backend_shared
|
||||
subsurface_models_desktop
|
||||
subsurface_commands
|
||||
@ -461,7 +492,11 @@ set(DOCFILES
|
||||
FILE(STRINGS "subsurface_enabled_translations" QTTRANSLATIONS_BASE)
|
||||
|
||||
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()
|
||||
set(QTTRANSLATIONS "")
|
||||
foreach(QTTRANSLATION ${QTTRANSLATIONS_BASE})
|
||||
@ -502,34 +537,44 @@ elseif(CMAKE_SYSTEM_NAME STREQUAL "Darwin")
|
||||
install(FILES ${QTTRANSLATIONS} DESTINATION ${RESOURCEDIR}/translations)
|
||||
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 ${PLUGINDIR}/geoservices)")
|
||||
install(CODE "execute_process(COMMAND cp ${_qt5Core_install_prefix}/plugins/geoservices/libqtgeoservices_googlemaps.dylib ${PLUGINDIR}/geoservices ERROR_QUIET)")
|
||||
install(CODE "execute_process(COMMAND cp ${CMAKE_SOURCE_DIR}/../install-root/${_qt5Core_install_prefix}/plugins/geoservices/libqtgeoservices_googlemaps.dylib ${PLUGINDIR}/geoservices ERROR_QUIET)")
|
||||
# this is a hack - but I don't know how else to find the macdeployqt program if it's not in the PATH
|
||||
string(REPLACE moc macdeployqt MACDEPLOYQT ${QT_MOC_EXECUTABLE})
|
||||
install(CODE "execute_process(COMMAND ${MACDEPLOYQT} ${APP_BUNDLE_DIR} -no-strip ${MACDEPLOY_ARGS})")
|
||||
if(QT_VERSION VERSION_LESS 6.0.0)
|
||||
set(QT_INSTALL_PREFIX ${_qt5Core_install_prefix})
|
||||
install(CODE "execute_process(COMMAND mkdir -p ${PLUGINDIR}/geoservices)")
|
||||
install(CODE "execute_process(COMMAND cp ${QT_INSTALL_PREFIX}/plugins/geoservices/libqtgeoservices_googlemaps.dylib ${PLUGINDIR}/geoservices ERROR_QUIET)")
|
||||
install(CODE "execute_process(COMMAND cp ${CMAKE_SOURCE_DIR}/../install-root/${QT_INSTALL_PREFIX}/plugins/geoservices/libqtgeoservices_googlemaps.dylib ${PLUGINDIR}/geoservices ERROR_QUIET)")
|
||||
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
|
||||
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
|
||||
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/QtQuick.2 ${CMAKE_BINARY_DIR}/${APP_BUNDLE_DIR}/Contents/Resources/qml)")
|
||||
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 ${_qt5Core_install_prefix}/qml/QtPositioning ${CMAKE_BINARY_DIR}/${APP_BUNDLE_DIR}/Contents/Resources/qml)")
|
||||
if(NOT Qt5Core_VERSION VERSION_LESS 5.11.0)
|
||||
if(QT_VERSION VERSION_LESS 6.0.0)
|
||||
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 ${QT_INSTALL_PREFIX}/qml/QtQuick.2 ${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)")
|
||||
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
|
||||
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()
|
||||
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
|
||||
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()
|
||||
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 ${_qt5Core_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 ${_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/QtQuick ${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 ${QT_INSTALL_PREFIX}/qml/QtQml ${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()
|
||||
elseif(CMAKE_SYSTEM_NAME STREQUAL "Windows")
|
||||
if (CMAKE_BUILD_TYPE STREQUAL "RelWithDebInfo")
|
||||
@ -563,10 +608,10 @@ elseif(CMAKE_SYSTEM_NAME STREQUAL "Windows")
|
||||
install(TARGETS ${SUBSURFACE_TARGET} 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
|
||||
# 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()
|
||||
|
||||
if(NOT DEFINED MAKENSIS)
|
||||
|
||||
@ -34,5 +34,9 @@
|
||||
<string>${MACOSX_BUNDLE_COPYRIGHT}</string>
|
||||
<key>NSHighResolutionCapable</key>
|
||||
<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>
|
||||
</plist>
|
||||
|
||||
@ -192,7 +192,11 @@ void BTDiscovery::BTDiscoveryReDiscover()
|
||||
connect(discoveryAgent, &QBluetoothDeviceDiscoveryAgent::deviceDiscovered, this, &BTDiscovery::btDeviceDiscovered);
|
||||
connect(discoveryAgent, &QBluetoothDeviceDiscoveryAgent::finished, 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),
|
||||
#endif
|
||||
[this](QBluetoothDeviceDiscoveryAgent::Error error){
|
||||
qDebug() << "device discovery received error" << discoveryAgent->errorString();
|
||||
});
|
||||
|
||||
@ -148,7 +148,9 @@ void DiveFilter::startFilterDiveSites(QVector<dive_site *> ds)
|
||||
dive_sites = ds;
|
||||
// When switching into dive site mode, reload the dive sites.
|
||||
// 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();
|
||||
#endif
|
||||
emit diveListNotifier.filterReset();
|
||||
}
|
||||
}
|
||||
@ -159,7 +161,9 @@ void DiveFilter::stopFilterDiveSites()
|
||||
return;
|
||||
dive_sites.clear();
|
||||
emit diveListNotifier.filterReset();
|
||||
#if QT_VERSION < QT_VERSION_CHECK(6, 0, 0)
|
||||
MapWidget::instance()->reload();
|
||||
#endif
|
||||
}
|
||||
|
||||
void DiveFilter::setFilterDiveSite(QVector<dive_site *> ds)
|
||||
@ -172,8 +176,10 @@ void DiveFilter::setFilterDiveSite(QVector<dive_site *> ds)
|
||||
dive_sites = ds;
|
||||
|
||||
emit diveListNotifier.filterReset();
|
||||
#if QT_VERSION < QT_VERSION_CHECK(6, 0, 0)
|
||||
MapWidget::instance()->setSelected(dive_sites);
|
||||
MapWidget::instance()->selectionChanged();
|
||||
#endif
|
||||
MainWindow::instance()->diveList->expandAll();
|
||||
}
|
||||
|
||||
|
||||
@ -1,6 +1,7 @@
|
||||
// SPDX-License-Identifier: GPL-2.0
|
||||
#include "core/parse-gpx.h"
|
||||
#include "core/subsurface-time.h"
|
||||
#include "core/qthelper.h"
|
||||
#include <QFile>
|
||||
#include <QXmlStreamReader>
|
||||
|
||||
@ -43,7 +44,7 @@ int getCoordsFromGPXFile(struct dive_coords *coords, QString fileName)
|
||||
while (!gpxReader.atEnd()) {
|
||||
gpxReader.readNext();
|
||||
if (gpxReader.isStartElement()) {
|
||||
if (gpxReader.name() == "trkpt") {
|
||||
if (nameCmp(gpxReader, "trkpt") == 0) {
|
||||
trkpt_found = true;
|
||||
line++;
|
||||
foreach (const QXmlStreamAttribute &attr, gpxReader.attributes()) {
|
||||
@ -53,7 +54,7 @@ int getCoordsFromGPXFile(struct dive_coords *coords, QString fileName)
|
||||
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();
|
||||
bool ok;
|
||||
tm1.tm_year = dateTimeString.left(4).toInt(&ok, 10); // Extract the date/time components:
|
||||
|
||||
@ -110,7 +110,7 @@ static const char *match_uuid_list(const QBluetoothUuid &match, const struct uui
|
||||
const char *uuid;
|
||||
|
||||
while ((uuid = array->uuid) != NULL) {
|
||||
if (match == QUuid(uuid))
|
||||
if (match == QBluetoothUuid(QUuid(uuid)))
|
||||
return array->details;
|
||||
array++;
|
||||
}
|
||||
@ -220,7 +220,11 @@ void BLEObject::addService(const QBluetoothUuid &newService)
|
||||
service->connect(service, &QLowEnergyService::stateChanged,[=](QLowEnergyService::ServiceState 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),
|
||||
#endif
|
||||
[=](QLowEnergyService::ServiceError 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
|
||||
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);
|
||||
if (s->state() == QLowEnergyService::DiscoveringServices)
|
||||
#endif
|
||||
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
|
||||
foreach (QLowEnergyService *s, services) {
|
||||
#if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0)
|
||||
if (s->state() != QLowEnergyService::RemoteServiceDiscovered)
|
||||
#else
|
||||
if (s->state() != QLowEnergyService::ServiceDiscovered)
|
||||
#endif
|
||||
continue;
|
||||
|
||||
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);
|
||||
}
|
||||
});
|
||||
#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) {
|
||||
#endif
|
||||
qDebug() << "controler discovery error" << controller->errorString() << newError;
|
||||
});
|
||||
|
||||
|
||||
@ -60,16 +60,16 @@ private:
|
||||
unsigned int desc_written = 0;
|
||||
int timeout;
|
||||
|
||||
QList<QUuid> telit = {
|
||||
"{00000001-0000-1000-8000-008025000000}", // TELIT_DATA_RX
|
||||
"{00000002-0000-1000-8000-008025000000}", // TELIT_DATA_TX
|
||||
"{00000003-0000-1000-8000-008025000000}", // TELIT_CREDITS_RX
|
||||
"{00000004-0000-1000-8000-008025000000}" // TELIT_CREDITS_TX
|
||||
QList<QBluetoothUuid> telit = {
|
||||
QBluetoothUuid(QUuid("{00000001-0000-1000-8000-008025000000}")), // TELIT_DATA_RX
|
||||
QBluetoothUuid(QUuid("{00000002-0000-1000-8000-008025000000}")), // TELIT_DATA_TX
|
||||
QBluetoothUuid(QUuid("{00000003-0000-1000-8000-008025000000}")), // TELIT_CREDITS_RX
|
||||
QBluetoothUuid(QUuid("{00000004-0000-1000-8000-008025000000}")) // TELIT_CREDITS_TX
|
||||
};
|
||||
|
||||
QList<QUuid> ublox = {
|
||||
"{2456e1b9-26e2-8f83-e744-f34f01e9d703}", // UBLOX_DATA_RX, UBLOX_DATA_TX
|
||||
"{2456e1b9-26e2-8f83-e744-f34f01e9d704}" // UBLOX_CREDITS_RX, UBLOX_CREDITS_TX
|
||||
QList<QBluetoothUuid> ublox = {
|
||||
QBluetoothUuid(QUuid("{2456e1b9-26e2-8f83-e744-f34f01e9d703}")), // UBLOX_DATA_RX, UBLOX_DATA_TX
|
||||
QBluetoothUuid(QUuid("{2456e1b9-26e2-8f83-e744-f34f01e9d704}")) // UBLOX_CREDITS_RX, UBLOX_CREDITS_TX
|
||||
};
|
||||
};
|
||||
|
||||
|
||||
@ -1,3 +1,4 @@
|
||||
|
||||
// SPDX-License-Identifier: GPL-2.0
|
||||
#include <QApplication>
|
||||
#include <Qt>
|
||||
@ -50,7 +51,7 @@ void init_qt_late()
|
||||
}
|
||||
// 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.
|
||||
#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);
|
||||
#endif
|
||||
qPref::load();
|
||||
|
||||
@ -753,9 +753,9 @@ timestamp_t dateTimeToTimestamp(const QDateTime &t)
|
||||
QString render_seconds_to_string(int seconds)
|
||||
{
|
||||
if (seconds % 60 == 0)
|
||||
return QDateTime::fromTime_t(seconds).toUTC().toString("h:mm");
|
||||
return QDateTime::fromSecsSinceEpoch(seconds, Qt::UTC).toUTC().toString("h:mm");
|
||||
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)
|
||||
|
||||
@ -20,6 +20,7 @@ enum watertypes {FRESHWATER, BRACKISHWATER, EN13319WATER, SALTWATER, DC_WATERTYP
|
||||
#ifdef __cplusplus
|
||||
|
||||
#include <QString>
|
||||
#include <QXmlStreamReader>
|
||||
#include "core/gettextfromc.h"
|
||||
class QImage;
|
||||
|
||||
@ -29,6 +30,12 @@ class QImage;
|
||||
#define SKIP_EMPTY QString::SkipEmptyParts
|
||||
#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 distance_string(int distanceInMeters);
|
||||
bool gpsHasChanged(struct dive *dive, struct dive *master, const QString &gps_text, bool *parsed_out = 0);
|
||||
|
||||
@ -1,6 +1,10 @@
|
||||
# create the libraries
|
||||
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})
|
||||
|
||||
if(BTSUPPORT)
|
||||
@ -94,8 +98,6 @@ set(SUBSURFACE_INTERFACE
|
||||
locationinformation.h
|
||||
mainwindow.cpp
|
||||
mainwindow.h
|
||||
mapwidget.cpp
|
||||
mapwidget.h
|
||||
modeldelegates.cpp
|
||||
modeldelegates.h
|
||||
notificationwidget.cpp
|
||||
@ -139,6 +141,12 @@ set(SUBSURFACE_INTERFACE
|
||||
updatemanager.cpp
|
||||
updatemanager.h
|
||||
)
|
||||
if(NOT USINGQT6)
|
||||
LIST(APPEND SUBSURFACE_INTERFACE
|
||||
mapwidget.cpp
|
||||
mapwidget.h
|
||||
)
|
||||
endif()
|
||||
|
||||
if(NOT NO_USERMANUAL)
|
||||
set(SUBSURFACE_INTERFACE ${SUBSURFACE_INTERFACE}
|
||||
@ -178,7 +186,11 @@ set(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})
|
||||
target_link_libraries(subsurface_statistics ${QT_LIBRARIES})
|
||||
|
||||
@ -19,9 +19,9 @@ SubsurfaceAbout::SubsurfaceAbout(QWidget *parent) : QDialog(parent, QFlag(0))
|
||||
"Linus Torvalds, Dirk Hohndel, Tomaz Canabrava, Berthold Stoeger, and others, 2011-2022"
|
||||
"</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()));
|
||||
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()));
|
||||
}
|
||||
|
||||
|
||||
@ -18,7 +18,7 @@ BtDeviceSelectionDialog::BtDeviceSelectionDialog(QWidget *parent) :
|
||||
ui->setupUi(this);
|
||||
|
||||
// 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(ui->quit, SIGNAL(clicked()), this, SLOT(reject()));
|
||||
|
||||
@ -473,11 +473,16 @@ void BtDeviceSelectionDialog::updateLocalDeviceInformation()
|
||||
ui->discoveredDevicesList->setContextMenuPolicy(Qt::CustomContextMenu);
|
||||
connect(ui->discoveredDevicesList, SIGNAL(customContextMenuRequested(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)),
|
||||
this, SLOT(pairingFinished(QBluetoothAddress, QBluetoothLocalDevice::Pairing)));
|
||||
|
||||
connect(localDevice, SIGNAL(error(QBluetoothLocalDevice::Error)),
|
||||
this, SLOT(error(QBluetoothLocalDevice::Error)));
|
||||
#endif
|
||||
}
|
||||
|
||||
void BtDeviceSelectionDialog::initializeDeviceDiscoveryAgent()
|
||||
@ -494,10 +499,19 @@ void BtDeviceSelectionDialog::initializeDeviceDiscoveryAgent()
|
||||
ui->clear->setEnabled(false);
|
||||
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)),
|
||||
this, SLOT(addRemoteDevice(QBluetoothDeviceInfo)));
|
||||
connect(remoteDeviceDiscoveryAgent, SIGNAL(finished()),
|
||||
this, SLOT(remoteDeviceScanFinished()));
|
||||
connect(remoteDeviceDiscoveryAgent, SIGNAL(error(QBluetoothDeviceDiscoveryAgent::Error)),
|
||||
this, SLOT(deviceDiscoveryError(QBluetoothDeviceDiscoveryAgent::Error)));
|
||||
#endif
|
||||
}
|
||||
|
||||
@ -523,7 +523,9 @@ void DiveListView::selectionChangeDone()
|
||||
if (d->selected && !d->hidden_by_filter && d->dive_site && !selectedSites.contains(d->dive_site))
|
||||
selectedSites.push_back(d->dive_site);
|
||||
}
|
||||
#if QT_VERSION < QT_VERSION_CHECK(6, 0, 0)
|
||||
MapWidget::instance()->setSelected(selectedSites);
|
||||
#endif
|
||||
}
|
||||
emit divesSelected();
|
||||
}
|
||||
|
||||
@ -37,9 +37,9 @@ DiveLogExportDialog::DiveLogExportDialog(QWidget *parent) : QDialog(parent),
|
||||
{
|
||||
ui->setupUi(this);
|
||||
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()));
|
||||
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()));
|
||||
|
||||
/* 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());
|
||||
// the non XSLT exports are called directly above, the XSLT based ons are called here
|
||||
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());
|
||||
MainWindow::instance()->getNotificationWidget()->showNotification(tr("Please wait, exporting..."), KMessageWidget::Information);
|
||||
MainWindow::instance()->getNotificationWidget()->setFuture(future);
|
||||
|
||||
@ -10,6 +10,7 @@
|
||||
#include <QRegularExpression>
|
||||
#include <QUndoStack>
|
||||
#include <QPainter>
|
||||
#include <QFile>
|
||||
#include "core/filterpreset.h"
|
||||
#include "core/qthelper.h"
|
||||
#include "core/divesite.h"
|
||||
@ -380,9 +381,9 @@ DiveLogImportDialog::DiveLogImportDialog(QStringList fn, QWidget *parent) : QDia
|
||||
loadFileContents(-1, INITIAL);
|
||||
|
||||
/* 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()));
|
||||
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(ui->CSVSeparator, SIGNAL(currentIndexChanged(int)), this, SLOT(loadFileContentsSeperatorSelected(int)));
|
||||
|
||||
@ -18,6 +18,8 @@ DiveShareExportDialog::DiveShareExportDialog(QWidget *parent) :
|
||||
exportSelected(false)
|
||||
{
|
||||
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()
|
||||
|
||||
@ -235,22 +235,6 @@ p, li { white-space: pre-wrap; }
|
||||
</hint>
|
||||
</hints>
|
||||
</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>
|
||||
<sender>doUploadButton</sender>
|
||||
<signal>clicked()</signal>
|
||||
|
||||
@ -16,8 +16,8 @@
|
||||
DivesiteImportDialog::DivesiteImportDialog(struct dive_site_table &imported, QString source, QWidget *parent) : QDialog(parent),
|
||||
importedSource(source)
|
||||
{
|
||||
QShortcut *close = new QShortcut(QKeySequence(Qt::CTRL + Qt::Key_W), this);
|
||||
QShortcut *quit = new QShortcut(QKeySequence(Qt::CTRL + Qt::Key_Q), this);
|
||||
QShortcut *close = new QShortcut(QKeySequence(Qt::CTRL | Qt::Key_W), this);
|
||||
QShortcut *quit = new QShortcut(QKeySequence(Qt::CTRL | Qt::Key_Q), this);
|
||||
|
||||
divesiteImportedModel = new DivesiteImportedModel(this);
|
||||
|
||||
|
||||
@ -31,8 +31,8 @@ DownloadFromDCWidget::DownloadFromDCWidget(QWidget *parent) : QDialog(parent, QF
|
||||
{
|
||||
diveImportedModel = new DiveImportedModel(this);
|
||||
vendorModel.setStringList(vendorList);
|
||||
QShortcut *close = new QShortcut(QKeySequence(Qt::CTRL + Qt::Key_W), this);
|
||||
QShortcut *quit = new QShortcut(QKeySequence(Qt::CTRL + Qt::Key_Q), this);
|
||||
QShortcut *close = new QShortcut(QKeySequence(Qt::CTRL | Qt::Key_W), this);
|
||||
QShortcut *quit = new QShortcut(QKeySequence(Qt::CTRL | Qt::Key_Q), this);
|
||||
|
||||
int startingWidth = defaultModelFont().pointSize();
|
||||
|
||||
@ -311,7 +311,7 @@ void DownloadFromDCWidget::updateState(states state)
|
||||
currentState = state;
|
||||
}
|
||||
|
||||
void DownloadFromDCWidget::on_vendor_currentIndexChanged(const QString &vendor)
|
||||
void DownloadFromDCWidget::on_vendor_currentTextChanged(const QString &vendor)
|
||||
{
|
||||
unsigned int transport;
|
||||
dc_descriptor_t *descriptor;
|
||||
@ -323,7 +323,7 @@ void DownloadFromDCWidget::on_vendor_currentIndexChanged(const QString &vendor)
|
||||
fill_device_list(transport);
|
||||
}
|
||||
|
||||
void DownloadFromDCWidget::on_product_currentIndexChanged(const QString &)
|
||||
void DownloadFromDCWidget::on_product_currentTextChanged(const QString &)
|
||||
{
|
||||
updateDeviceEnabled();
|
||||
}
|
||||
|
||||
@ -42,8 +42,8 @@ slots:
|
||||
void on_ok_clicked();
|
||||
void on_cancel_clicked();
|
||||
void on_search_clicked();
|
||||
void on_vendor_currentIndexChanged(const QString &vendor);
|
||||
void on_product_currentIndexChanged(const QString &product);
|
||||
void on_vendor_currentTextChanged(const QString &vendor);
|
||||
void on_product_currentTextChanged(const QString &product);
|
||||
void on_device_currentTextChanged(const QString &device);
|
||||
|
||||
void onDownloadThreadFinished();
|
||||
|
||||
@ -37,6 +37,8 @@
|
||||
#include <QStyle>
|
||||
#include <QStyleOptionFocusRect>
|
||||
#include <QDebug>
|
||||
#include <QList>
|
||||
#include <QVector>
|
||||
#include <cmath>
|
||||
|
||||
struct GroupedLineEdit::Private {
|
||||
|
||||
@ -20,7 +20,9 @@
|
||||
#include <QItemSelectionModel>
|
||||
#include <qmessagebox.h>
|
||||
#include <cstdlib>
|
||||
#if QT_VERSION < QT_VERSION_CHECK(6, 0, 0)
|
||||
#include <QDesktopWidget>
|
||||
#endif
|
||||
#include <QFileDialog>
|
||||
#include <QScrollBar>
|
||||
|
||||
@ -587,7 +589,11 @@ void DiveLocationLineEdit::keyPressEvent(QKeyEvent *ev)
|
||||
|
||||
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);
|
||||
#endif
|
||||
const int maxVisibleItems = 5;
|
||||
QPoint pos;
|
||||
int rh, w;
|
||||
|
||||
@ -8,7 +8,9 @@
|
||||
|
||||
#include <QFileDialog>
|
||||
#include <QMessageBox>
|
||||
#if QT_VERSION < QT_VERSION_CHECK(6, 0, 0)
|
||||
#include <QDesktopWidget>
|
||||
#endif
|
||||
#include <QSettings>
|
||||
#include <QShortcut>
|
||||
#include <QStatusBar>
|
||||
@ -132,7 +134,9 @@ MainWindow::MainWindow() : QMainWindow(),
|
||||
// for the "default" mode
|
||||
mainTab.reset(new MainTab);
|
||||
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.
|
||||
#endif
|
||||
plannerWidgets.reset(new PlannerWidgets);
|
||||
statistics.reset(new StatsWidget);
|
||||
profile.reset(new ProfileWidget);
|
||||
@ -198,7 +202,9 @@ MainWindow::MainWindow() : QMainWindow(),
|
||||
initialUiSetup();
|
||||
readSettings();
|
||||
diveList->setFocus();
|
||||
#if QT_VERSION < QT_VERSION_CHECK(6, 0, 0)
|
||||
MapWidget::instance()->reload();
|
||||
#endif
|
||||
diveList->expand(diveList->model()->index(0, 0));
|
||||
diveList->scrollTo(diveList->model()->index(0, 0), QAbstractItemView::PositionAtCenter);
|
||||
#ifdef NO_USERMANUAL
|
||||
@ -210,8 +216,8 @@ MainWindow::MainWindow() : QMainWindow(),
|
||||
updateManager = new UpdateManager(this);
|
||||
undoAction = Command::undoAction(this);
|
||||
redoAction = Command::redoAction(this);
|
||||
undoAction->setShortcut(QKeySequence(Qt::CTRL + Qt::Key_Z));
|
||||
redoAction->setShortcut(QKeySequence(Qt::CTRL + Qt::SHIFT + Qt::Key_Z));
|
||||
undoAction->setShortcut(QKeySequence(Qt::CTRL | Qt::Key_Z));
|
||||
redoAction->setShortcut(QKeySequence(Qt::CTRL | Qt::SHIFT | Qt::Key_Z));
|
||||
ui.menu_Edit->addActions({ undoAction, redoAction });
|
||||
|
||||
#ifndef NO_PRINTING
|
||||
@ -327,7 +333,9 @@ void MainWindow::selectionChanged()
|
||||
if (current_dive)
|
||||
enableDisableOtherDCsActions();
|
||||
profile->plotCurrentDive();
|
||||
#if QT_VERSION < QT_VERSION_CHECK(6, 0, 0)
|
||||
MapWidget::instance()->selectionChanged();
|
||||
#endif
|
||||
}
|
||||
|
||||
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
|
||||
setCurrentFile(nullptr);
|
||||
diveList->setSortOrder(DiveTripModelBase::NR, Qt::DescendingOrder);
|
||||
#if QT_VERSION < QT_VERSION_CHECK(6, 0, 0)
|
||||
MapWidget::instance()->reload();
|
||||
#endif
|
||||
if (!existing_filename)
|
||||
setTitle();
|
||||
disableShortcuts();
|
||||
@ -570,8 +580,8 @@ void MainWindow::enableShortcuts()
|
||||
redoAction->setEnabled(true);
|
||||
ui.actionPreviousDC->setShortcut(Qt::Key_Left);
|
||||
ui.actionNextDC->setShortcut(Qt::Key_Right);
|
||||
ui.copy->setShortcut(QKeySequence(Qt::CTRL + Qt::Key_C));
|
||||
ui.paste->setShortcut(QKeySequence(Qt::CTRL + Qt::Key_V));
|
||||
ui.copy->setShortcut(QKeySequence(Qt::CTRL | Qt::Key_C));
|
||||
ui.paste->setShortcut(QKeySequence(Qt::CTRL | Qt::Key_V));
|
||||
}
|
||||
|
||||
void MainWindow::showProfile()
|
||||
@ -724,9 +734,9 @@ void MainWindow::on_actionYearlyStatistics_triggered()
|
||||
l->addWidget(view);
|
||||
d.resize(lrint(width() * .8), height() / 2);
|
||||
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()));
|
||||
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()));
|
||||
d.setWindowFlags(Qt::Window | Qt::CustomizeWindowHint
|
||||
| Qt::WindowCloseButtonHint | Qt::WindowTitleHint | Qt::WindowMaximizeButtonHint);
|
||||
@ -799,9 +809,13 @@ void MainWindow::restoreSplitterSizes()
|
||||
topSplitter->restoreState(settings.value("topSplitter").toByteArray());
|
||||
bottomSplitter->restoreState(settings.value("bottomSplitter").toByteArray());
|
||||
} else {
|
||||
#if QT_VERSION < QT_VERSION_CHECK(6, 0, 0)
|
||||
const int appH = qApp->desktop()->size().height();
|
||||
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 });
|
||||
topSplitter->setSizes({ appW / 2, appW / 2 });
|
||||
bottomSplitter->setSizes({ appW * 3 / 5, appW * 2 / 5 });
|
||||
|
||||
@ -31,7 +31,7 @@ QString NotificationWidget::getNotificationText()
|
||||
return text();
|
||||
}
|
||||
|
||||
void NotificationWidget::setFuture(const QFuture<void> &future)
|
||||
void NotificationWidget::setFuture(const QFuture<int> &future)
|
||||
{
|
||||
future_watcher.setFuture(future);
|
||||
}
|
||||
|
||||
@ -16,7 +16,7 @@ class NotificationWidget : public KMessageWidget {
|
||||
|
||||
public:
|
||||
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 hideNotification();
|
||||
QString getNotificationText();
|
||||
@ -25,7 +25,7 @@ public
|
||||
slots:
|
||||
void showError(QString message);
|
||||
private:
|
||||
QFutureWatcher<void> future_watcher;
|
||||
QFutureWatcher<int> future_watcher;
|
||||
|
||||
private
|
||||
slots:
|
||||
|
||||
@ -19,7 +19,11 @@ set(SUBSURFACE_PREFERENCES_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})
|
||||
|
||||
|
||||
@ -81,7 +81,9 @@ ProfileWidget::ProfileWidget()
|
||||
|
||||
QHBoxLayout *layout = new QHBoxLayout(this);
|
||||
layout->setSpacing(0);
|
||||
#if QT_VERSION < QT_VERSION_CHECK(6, 0, 0)
|
||||
layout->setMargin(0);
|
||||
#endif
|
||||
layout->setContentsMargins(0, 0, 0, 0);
|
||||
layout->addWidget(toolBar);
|
||||
layout->addWidget(stack);
|
||||
|
||||
@ -198,17 +198,5 @@
|
||||
</hint>
|
||||
</hints>
|
||||
</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>
|
||||
</ui>
|
||||
|
||||
@ -45,9 +45,9 @@ RenumberDialog::RenumberDialog(bool selectedOnlyIn, QWidget *parent) : QDialog(p
|
||||
{
|
||||
ui.setupUi(this);
|
||||
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()));
|
||||
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()));
|
||||
|
||||
if (selectedOnly && amount_selected == 1)
|
||||
@ -72,9 +72,9 @@ SetpointDialog::SetpointDialog(struct dive *dIn, int dcNrIn, int seconds) : QDia
|
||||
{
|
||||
ui.setupUi(this);
|
||||
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);
|
||||
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);
|
||||
}
|
||||
|
||||
@ -116,9 +116,9 @@ ShiftTimesDialog::ShiftTimesDialog(QWidget *parent) : QDialog(parent),
|
||||
connect(ui.buttonBox, SIGNAL(clicked(QAbstractButton *)), this, SLOT(buttonClicked(QAbstractButton *)));
|
||||
connect(ui.timeEdit, SIGNAL(timeChanged(const QTime)), 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()));
|
||||
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()));
|
||||
}
|
||||
|
||||
@ -144,7 +144,7 @@ void ShiftImageTimesDialog::syncCameraClicked()
|
||||
ui.DCImage->setScene(scene);
|
||||
|
||||
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);
|
||||
connect(ui.dcTime, SIGNAL(dateTimeChanged(const QDateTime &)), this, SLOT(dcDateTimeChanged(const QDateTime &)));
|
||||
}
|
||||
@ -213,8 +213,8 @@ void ShiftImageTimesDialog::updateInvalid()
|
||||
bool allValid = true;
|
||||
ui.warningLabel->hide();
|
||||
ui.invalidFilesText->hide();
|
||||
QDateTime time_first = QDateTime::fromTime_t(first_selected_dive()->when, Qt::UTC);
|
||||
QDateTime time_last = QDateTime::fromTime_t(last_selected_dive()->when, Qt::UTC);
|
||||
QDateTime time_first = QDateTime::fromSecsSinceEpoch(first_selected_dive()->when, Qt::UTC);
|
||||
QDateTime time_last = QDateTime::fromSecsSinceEpoch(last_selected_dive()->when, Qt::UTC);
|
||||
if (first_selected_dive() == last_selected_dive()) {
|
||||
ui.invalidFilesText->setPlainText(tr("Selected dive date/time") + ": " + time_first.toString());
|
||||
} else {
|
||||
@ -229,7 +229,7 @@ void ShiftImageTimesDialog::updateInvalid()
|
||||
continue;
|
||||
|
||||
// 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)
|
||||
ui.invalidFilesText->append(fileNames[i] + " - " + tr("No Exif date/time found"));
|
||||
else
|
||||
@ -271,9 +271,9 @@ void ShiftImageTimesDialog::backwardsChanged(bool)
|
||||
URLDialog::URLDialog(QWidget *parent) : QDialog(parent)
|
||||
{
|
||||
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()));
|
||||
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()));
|
||||
}
|
||||
|
||||
@ -317,9 +317,9 @@ DiveComponentSelection::DiveComponentSelection(QWidget *parent, struct dive *tar
|
||||
UI_FROM_COMPONENT(number);
|
||||
UI_FROM_COMPONENT(when);
|
||||
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()));
|
||||
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()));
|
||||
}
|
||||
|
||||
|
||||
@ -157,7 +157,7 @@ static DiveListResult parseDiveLogsDeDiveList(const QByteArray &xmlData)
|
||||
DiveListResult result;
|
||||
result.idCount = 0;
|
||||
|
||||
if (reader.readNextStartElement() && reader.name() != "DiveDateReader") {
|
||||
if (reader.readNextStartElement() && nameCmp(reader, "DiveDateReader") != 0) {
|
||||
result.errorCondition = invalidXmlError;
|
||||
result.errorDetails =
|
||||
gettextFromC::tr("Expected XML tag 'DiveDateReader', got instead '%1")
|
||||
@ -166,8 +166,8 @@ static DiveListResult parseDiveLogsDeDiveList(const QByteArray &xmlData)
|
||||
}
|
||||
|
||||
while (reader.readNextStartElement()) {
|
||||
if (reader.name() != "DiveDates") {
|
||||
if (reader.name() == "Login") {
|
||||
if (nameCmp(reader, "DiveDates") != 0) {
|
||||
if (nameCmp(reader, "Login") == 0) {
|
||||
QString status = reader.readElementText();
|
||||
// qDebug() << "Login status:" << status;
|
||||
|
||||
@ -185,11 +185,11 @@ static DiveListResult parseDiveLogsDeDiveList(const QByteArray &xmlData)
|
||||
// process <DiveDates>
|
||||
seenDiveDates = true;
|
||||
while (reader.readNextStartElement()) {
|
||||
if (reader.name() != "date") {
|
||||
if (nameCmp(reader, "date") != 0) {
|
||||
// qDebug() << "Skipping" << reader.name();
|
||||
continue;
|
||||
}
|
||||
QStringRef id = reader.attributes().value("divelogsId");
|
||||
auto id = reader.attributes().value("divelogsId");
|
||||
// qDebug() << "Found" << reader.name() << "with id =" << id;
|
||||
if (!id.isEmpty()) {
|
||||
result.idList += id.toLatin1();
|
||||
@ -259,9 +259,9 @@ DivelogsDeWebServices::DivelogsDeWebServices(QWidget *parent) : WebServices(pare
|
||||
ui.password->setText(qPrefCloudStorage::divelogde_pass());
|
||||
ui.saveUidLocal->hide();
|
||||
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()));
|
||||
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()));
|
||||
}
|
||||
|
||||
|
||||
@ -89,8 +89,10 @@ MainTab::MainTab(QWidget *parent) : QTabWidget(parent),
|
||||
connect(&diveListNotifier, &DiveListNotifier::settingsChanged, this, &MainTab::updateDiveInfo);
|
||||
|
||||
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::currentChanged, MapWidget::instance(), &MapWidget::centerOnIndex);
|
||||
#endif
|
||||
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.
|
||||
|
||||
@ -11,7 +11,11 @@ TagWidget::TagWidget(QWidget *parent) : GroupedLineEdit(parent), m_completer(NUL
|
||||
connect(this, SIGNAL(textChanged()), this, SLOT(reparse()));
|
||||
|
||||
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;
|
||||
#endif
|
||||
textColor.getHslF(&h, &s, &l, &a);
|
||||
// I use dark themes
|
||||
if (l <= 0.3) { // very dark text. get a brigth background
|
||||
|
||||
@ -10,9 +10,9 @@ TripSelectionDialog::TripSelectionDialog(QWidget *parent) : QDialog(parent)
|
||||
ui.setupUi(this);
|
||||
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);
|
||||
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);
|
||||
|
||||
// We could use a model, but it seems barely worth the hassle.
|
||||
|
||||
@ -11,4 +11,4 @@ ANDROID_PLATFORMS=android-29
|
||||
ANDROID_NDK=ndk/${NDK_VERSION}
|
||||
# OpenSSL also has an entry in get-dep-lib.sh line 103
|
||||
# that needs to be updated as well.
|
||||
OPENSSL_VERSION=1.1.1h
|
||||
OPENSSL_VERSION=1.1.1m
|
||||
|
||||
@ -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>
|
||||
@ -6,8 +6,8 @@
|
||||
|
||||
#include <array>
|
||||
|
||||
DivePercentageItem::DivePercentageItem(const DiveCartesianAxis &hAxis, const DiveCartesianAxis &vAxis, double dpr) :
|
||||
hAxis(hAxis), vAxis(vAxis), dpr(dpr)
|
||||
DivePercentageItem::DivePercentageItem(const DiveCartesianAxis &hAxis, const DiveCartesianAxis &vAxis) :
|
||||
hAxis(hAxis), vAxis(vAxis)
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
@ -10,12 +10,11 @@ class DiveCartesianAxis;
|
||||
|
||||
class DivePercentageItem : public QGraphicsPixmapItem {
|
||||
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);
|
||||
private:
|
||||
const DiveCartesianAxis &hAxis;
|
||||
const DiveCartesianAxis &vAxis;
|
||||
double dpr;
|
||||
};
|
||||
|
||||
#endif
|
||||
|
||||
@ -144,7 +144,7 @@ ProfileScene::ProfileScene(double dpr, bool printMode, bool isGrayscale) :
|
||||
heartBeatItem(createItem<DiveHeartrateItem>(*heartBeatAxis,
|
||||
[](const plot_data &item) { return (double)item.heartbeat; },
|
||||
1, dpr)),
|
||||
percentageItem(new DivePercentageItem(*timeAxis, *percentageAxis, dpr)),
|
||||
percentageItem(new DivePercentageItem(*timeAxis, *percentageAxis)),
|
||||
tankItem(new TankItem(*timeAxis, dpr)),
|
||||
pixmaps(getDivePixmaps(dpr))
|
||||
{
|
||||
|
||||
@ -21,8 +21,6 @@ set(SUBSURFACE_GENERIC_MODELS_LIB_SRCS
|
||||
filterconstraintmodel.h
|
||||
filterpresetmodel.cpp
|
||||
filterpresetmodel.h
|
||||
maplocationmodel.cpp
|
||||
maplocationmodel.h
|
||||
models.cpp
|
||||
models.h
|
||||
tankinfomodel.cpp
|
||||
@ -31,6 +29,13 @@ set(SUBSURFACE_GENERIC_MODELS_LIB_SRCS
|
||||
weightsysteminfomodel.h
|
||||
)
|
||||
|
||||
if(NOT USINGQT6)
|
||||
LIST(APPEND SUBSURFACE_GENERIC_MODELS_LIB_SRCS
|
||||
maplocationmodel.cpp
|
||||
maplocationmodel.h
|
||||
)
|
||||
endif()
|
||||
|
||||
# models exclusively used in desktop builds
|
||||
set(SUBSURFACE_DESKTOP_MODELS_LIB_SRCS
|
||||
divecomputerextradatamodel.cpp
|
||||
|
||||
@ -1086,7 +1086,11 @@ void DivePlannerPointsModel::updateDiveProfile()
|
||||
// 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.
|
||||
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);
|
||||
#endif
|
||||
#else
|
||||
computeVariations(plan_copy, &plan_deco_state);
|
||||
#endif
|
||||
|
||||
@ -224,9 +224,13 @@ if [ -n "$CMAKE_PREFIX_PATH" ] ; then
|
||||
else
|
||||
hash qmake > /dev/null 2> /dev/null && QMAKE=qmake
|
||||
[ -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
|
||||
|
||||
# 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
|
||||
if [ "$PLATFORM" = Darwin ] ; then
|
||||
if [ -z "$CMAKE_PREFIX_PATH" ] ; then
|
||||
@ -244,9 +248,8 @@ fi
|
||||
|
||||
# on Debian and Ubuntu based systems, the private QtLocation and
|
||||
# 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_VERSION=$($QMAKE -query QT_VERSION)
|
||||
|
||||
if [ ! -d "$QT_HEADERS_PATH/QtLocation/$QT_VERSION/QtLocation/private" ] &&
|
||||
[ ! -d "$INSTALL_ROOT"/include/QtLocation/private ] ; then
|
||||
@ -348,7 +351,8 @@ if [[ $PLATFORM = Darwin && "$BUILD_DEPS" == "1" ]] ; then
|
||||
pushd openssl
|
||||
mkdir -p 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
|
||||
# all the tests fail because the assume that openssl is already installed. Odd? Still thinks work
|
||||
make -j4 -k
|
||||
@ -436,6 +440,7 @@ if [[ $PLATFORM = Darwin && "$BUILD_DEPS" == "1" ]] ; then
|
||||
|
||||
./${SRC_DIR}/scripts/get-dep-lib.sh single . libmtp
|
||||
pushd libmtp
|
||||
patch -p1 < ../${SRC_DIR}/scripts/libmtp.patch
|
||||
echo 'N' | NOCONFIGURE="1" bash ./autogen.sh
|
||||
mkdir -p build
|
||||
cd build
|
||||
@ -504,7 +509,7 @@ STATIC_LIBDC="$INSTALL_ROOT/$(grep ^libdir Makefile | cut -d/ -f2)/libdivecomput
|
||||
|
||||
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
|
||||
|
||||
cd "$SRC"
|
||||
|
||||
@ -6,8 +6,8 @@ CURRENT_LIBZ="v1.2.11"
|
||||
CURRENT_LIBZIP="rel-1-5-1"
|
||||
CURRENT_LIBGIT2="v1.0.1"
|
||||
CURRENT_LIBCURL="curl-7_54_1"
|
||||
CURRENT_LIBUSB="v1.0.21"
|
||||
CURRENT_OPENSSL="OpenSSL_1_1_1h"
|
||||
CURRENT_LIBUSB="v1.0.25"
|
||||
CURRENT_OPENSSL="OpenSSL_1_1_1m"
|
||||
CURRENT_LIBSSH2="libssh2-1.8.0"
|
||||
CURRENT_XSLT="v1.1.34"
|
||||
CURRENT_SQLITE="3190200"
|
||||
@ -103,7 +103,7 @@ fi
|
||||
|
||||
# FIX FOR ANDROID,
|
||||
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.
|
||||
fi
|
||||
# no curl and old libs (never version breaks)
|
||||
|
||||
13
scripts/libmtp.patch
Normal file
13
scripts/libmtp.patch
Normal 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}
|
||||
@ -8,8 +8,7 @@
|
||||
#include <vector>
|
||||
#include <QPointF>
|
||||
#include <QSGNode>
|
||||
|
||||
struct dive;
|
||||
#include "core/dive.h"
|
||||
|
||||
// Round positions to integer values to avoid ugly artifacts
|
||||
QPointF roundPos(const QPointF &p);
|
||||
|
||||
@ -113,7 +113,7 @@ template<> int invalid_value<int>()
|
||||
}
|
||||
template<> double invalid_value<double>()
|
||||
{
|
||||
return std::numeric_limits<double>::quiet_NaN();
|
||||
return NaN;
|
||||
}
|
||||
template<> QString invalid_value<QString>()
|
||||
{
|
||||
@ -121,7 +121,6 @@ template<> QString invalid_value<QString>()
|
||||
}
|
||||
template<> StatsQuartiles invalid_value<StatsQuartiles>()
|
||||
{
|
||||
double NaN = std::numeric_limits<double>::quiet_NaN();
|
||||
return { std::vector<dive *>(), NaN, NaN, NaN, NaN, NaN };
|
||||
}
|
||||
|
||||
|
||||
@ -309,14 +309,22 @@ QRectF StatsView::plotArea() const
|
||||
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)
|
||||
#endif
|
||||
{
|
||||
plotRect = QRectF(QPointF(0.0, 0.0), newGeometry.size());
|
||||
backgroundDirty = true;
|
||||
plotAreaChanged(plotRect.size());
|
||||
|
||||
// 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);
|
||||
#endif
|
||||
}
|
||||
|
||||
void StatsView::plotAreaChanged(const QSizeF &s)
|
||||
|
||||
@ -77,7 +77,11 @@ private:
|
||||
QRectF plotRect;
|
||||
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;
|
||||
#endif
|
||||
void plotAreaChanged(const QSizeF &size);
|
||||
void reset(); // clears all series and axes
|
||||
void setAxes(StatsAxis *x, StatsAxis *y);
|
||||
|
||||
@ -204,7 +204,7 @@ exit:
|
||||
surface.destroy();
|
||||
if (glError) {
|
||||
qWarning() << QStringLiteral(VALIDATE_GL_PREFIX "WARNING: %1. Using a software renderer!").arg(glError);
|
||||
QQuickWindow::setSceneGraphBackend(QSGRendererInterface::Software);
|
||||
QQuickWindow::setSceneGraphBackend("software");
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -2,8 +2,11 @@
|
||||
#include <QQmlEngine>
|
||||
#include <QQuickItem>
|
||||
|
||||
#if QT_VERSION < QT_VERSION_CHECK(6, 0, 0)
|
||||
#include "map-widget/qmlmapwidgethelper.h"
|
||||
#include "qt-models/maplocationmodel.h"
|
||||
#endif
|
||||
|
||||
#include "stats/statsview.h"
|
||||
#include "core/qt-gui.h"
|
||||
#include "core/settings/qPref.h"
|
||||
@ -222,7 +225,9 @@ static void register_qml_types(QQmlEngine *engine)
|
||||
register_qml_type<ChartListModel>("ChartListModel");
|
||||
#endif // not SUBSURFACE_MOBILE
|
||||
|
||||
#if QT_VERSION < QT_VERSION_CHECK(6, 0, 0)
|
||||
register_qml_type<MapWidgetHelper>("MapWidgetHelper");
|
||||
register_qml_type<MapLocationModel>("MapLocationModel");
|
||||
#endif
|
||||
register_qml_type<StatsView>("StatsView");
|
||||
}
|
||||
|
||||
@ -1,5 +1,9 @@
|
||||
# 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.
|
||||
# In cross compilation cases or when test will not be executed at build time
|
||||
|
||||
@ -10,6 +10,7 @@
|
||||
#include <QFile>
|
||||
#include <QDebug>
|
||||
#include <QNetworkProxy>
|
||||
#include "QTextCodec"
|
||||
|
||||
#define LARGE_TEST_REPO "https://github.com/Subsurface/large-anonymous-sample-data"
|
||||
|
||||
|
||||
@ -6,6 +6,7 @@
|
||||
#include "core/file.h"
|
||||
#include "core/save-profiledata.h"
|
||||
#include "core/pref.h"
|
||||
#include "QTextCodec"
|
||||
|
||||
// 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
|
||||
@ -18,7 +19,6 @@ void TestProfile::init()
|
||||
{
|
||||
// Set UTF8 text codec as in real applications
|
||||
QTextCodec::setCodecForLocale(QTextCodec::codecForMib(106));
|
||||
|
||||
// first, setup the preferences
|
||||
|
||||
// normally we should be able to do this - but it makes this test fail because the reference data
|
||||
|
||||
@ -53,8 +53,12 @@ set(US_EN_PLURALS subsurface_en_US.ts)
|
||||
# subsurface_vi.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)
|
||||
add_custom_target (translations ALL DEPENDS ${TRANSLATIONS})
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user