diff --git a/.reuse/dep5 b/.reuse/dep5 index daed211..76446de 100644 --- a/.reuse/dep5 +++ b/.reuse/dep5 @@ -49,7 +49,7 @@ Copyright: 2020 Zhang Yu License: MIT # udfclient -Files: src/dfm-burn/3rdparty/UDFclient.0.8.20/* +Files: src/dfm-burn/3rdparty/udfclient/* Copyright: Reinoud Zandijk License: ClArtistic diff --git a/CMakeLists.txt b/CMakeLists.txt index 0bacb44..0bdfdc0 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -12,7 +12,10 @@ set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -g -Wall") set(QT_MINIMUM_VERSION "5.6.3") include(GNUInstallDirs) -find_package(Qt5 ${QT_MINIMUM_VERSION} CONFIG REQUIRED Core) +find_package(QT NAMES Qt6 Qt5 ${QT_MINIMUM_VERSION} CONFIG REQUIRED Core) +find_package(Qt${QT_VERSION_MAJOR} REQUIRED COMPONENTS Core) +message("Using Qt version: ${QT_VERSION}") + find_package(PkgConfig REQUIRED) # Install settings diff --git a/misc/dfm-burn/dfm-burn.pc.in b/misc/dfm-burn/dfm-burn.pc.in index 6d798f0..82d6f53 100644 --- a/misc/dfm-burn/dfm-burn.pc.in +++ b/misc/dfm-burn/dfm-burn.pc.in @@ -2,7 +2,7 @@ Name: @BIN_NAME@ Description: @CMAKE_PROJECT_DESCRIPTION@ URL: @CMAKE_PROJECT_HOMEPAGE_URL@ Version: @PROJECT_VERSION@ -Requires: libisoburn-1, Qt5Core +Requires: libisoburn-1, Qt@QT_VERSION_MAJOR@core Cflags: -I"@CMAKE_INSTALL_FULL_INCLUDEDIR@/@BIN_NAME@" Libs: -L"@CMAKE_INSTALL_FULL_LIBDIR@" -l@BIN_NAME@ Libs.private: -L"@CMAKE_INSTALL_FULL_LIBDIR@" -l@BIN_NAME@ diff --git a/src/dfm-burn/dfm-burn-client/CMakeLists.txt b/src/dfm-burn/dfm-burn-client/CMakeLists.txt index b29ed2a..54fd2bf 100644 --- a/src/dfm-burn/dfm-burn-client/CMakeLists.txt +++ b/src/dfm-burn/dfm-burn-client/CMakeLists.txt @@ -6,7 +6,7 @@ set(SRCS main.cpp ) -find_package(Qt5Core REQUIRED) +find_package(Qt${QT_VERSION_MAJOR}Core REQUIRED) add_executable(${PROJECT_NAME} ${SRCS}) @@ -16,6 +16,6 @@ include_directories( target_link_libraries( ${PROJECT_NAME} - Qt5::Core + Qt${QT_VERSION_MAJOR}::Core dfm-burn ) diff --git a/src/dfm-burn/dfm-burn-lib/CMakeLists.txt b/src/dfm-burn/dfm-burn-lib/CMakeLists.txt index f31096d..dc1d50b 100644 --- a/src/dfm-burn/dfm-burn-lib/CMakeLists.txt +++ b/src/dfm-burn/dfm-burn-lib/CMakeLists.txt @@ -12,7 +12,7 @@ if (NOT PROJECT_VERSION_MAJOR) endif() # Setup the environment -find_package(Qt5 COMPONENTS Core REQUIRED) +find_package(Qt${QT_VERSION_MAJOR} COMPONENTS Core REQUIRED) find_package(PkgConfig REQUIRED) pkg_check_modules(isoburn REQUIRED libisoburn-1 IMPORTED_TARGET) @@ -41,7 +41,7 @@ add_library(${BIN_NAME} SHARED target_link_libraries(${BIN_NAME} - Qt5::Core + Qt${QT_VERSION_MAJOR}::Core PkgConfig::isoburn ) diff --git a/src/dfm-io/dfm-io/CMakeLists.txt b/src/dfm-io/dfm-io/CMakeLists.txt index 81348f2..2ab6a39 100644 --- a/src/dfm-io/dfm-io/CMakeLists.txt +++ b/src/dfm-io/dfm-io/CMakeLists.txt @@ -12,8 +12,8 @@ if (NOT PROJECT_VERSION_MAJOR) endif() # Setup the environment -find_package(Qt5 COMPONENTS Core REQUIRED) -find_package(Qt5 COMPONENTS Concurrent REQUIRED) +find_package(Qt${QT_VERSION_MAJOR} COMPONENTS Core REQUIRED) +find_package(Qt${QT_VERSION_MAJOR} COMPONENTS Concurrent REQUIRED) find_package(PkgConfig REQUIRED) pkg_check_modules(GLIB glib-2.0 gobject-2.0 gio-2.0) @@ -46,8 +46,8 @@ set_target_properties( ) target_link_libraries(${BIN_NAME} - Qt5::Core - Qt5::Concurrent + Qt${QT_VERSION_MAJOR}::Core + Qt${QT_VERSION_MAJOR}::Concurrent PkgConfig::mediainfoVal ${mediainfos} ${GLIB_LIBRARIES} diff --git a/src/dfm-io/dfm-io/utils/dlocalhelper.cpp b/src/dfm-io/dfm-io/utils/dlocalhelper.cpp index 584e69d..b87216a 100644 --- a/src/dfm-io/dfm-io/utils/dlocalhelper.cpp +++ b/src/dfm-io/dfm-io/utils/dlocalhelper.cpp @@ -689,7 +689,13 @@ QSet DLocalHelper::hideListFromUrl(const QUrl &url) if (succ) { if (contents && len > 0) { QString dataStr(contents); - return QSet::fromList(dataStr.split('\n', QString::SkipEmptyParts)); +#if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0) + const QStringList strs { dataStr.split('\n', Qt::SkipEmptyParts) }; + return QSet { strs.begin(), strs.end() }; +#else + const QStringList strs { dataStr.split('\n', QString::SkipEmptyParts) }; + return QSet::fromList(strs); +#endif } } return {}; @@ -745,12 +751,14 @@ class DCollator : public QCollator bool DLocalHelper::isNumOrChar(const QChar ch) { - return (ch >= 48 && ch <= 57) || (ch >= 65 && ch <= 90) || (ch >= 97 && ch <= 122); + int chValue = ch.unicode(); + return (chValue >= 48 && chValue <= 57) || (chValue >= 65 && chValue <= 90) || (chValue >= 97 && chValue <= 122); } bool DLocalHelper::isNumber(const QChar ch) { - return (ch >= 48 && ch <= 57); + int chValue = ch.unicode(); + return (chValue >= 48 && chValue <= 57); } bool DLocalHelper::isSymbol(const QChar ch) diff --git a/src/dfm-io/tools/CMakeLists.txt b/src/dfm-io/tools/CMakeLists.txt index faff16f..563ac0d 100644 --- a/src/dfm-io/tools/CMakeLists.txt +++ b/src/dfm-io/tools/CMakeLists.txt @@ -2,17 +2,21 @@ add_definitions(-DQT_NO_KEYWORDS) set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -g -Wall") # set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -g -Wall -fsanitize=address") -if (CMAKE_BUILD_TYPE STREQUAL "Debug") - set (CMAKE_VERBOSE_MAKEFILE ON) - message("debug type open sanitize check") - set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fsanitize=undefined,address,leak -fno-omit-frame-pointer") - set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -fsanitize=undefined,address,leak -fno-omit-frame-pointer") - set(CMAKE_L_FLAGS "${CMAKE_L_FLAGS} -fsanitize=undefined,address,leak -fno-omit-frame-pointer") - - #set(CMAKE_CXX_FLAGS "-fsanitize=thread") - +find_package(Qt${QT_VERSION_MAJOR} REQUIRED COMPONENTS Core) + +if (QT_VERSION_MAJOR EQUAL "5") + if (CMAKE_BUILD_TYPE STREQUAL "Debug") + set (CMAKE_VERBOSE_MAKEFILE ON) + message("debug type open sanitize check") + set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fsanitize=undefined,address,leak -fno-omit-frame-pointer") + set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -fsanitize=undefined,address,leak -fno-omit-frame-pointer") + set(CMAKE_L_FLAGS "${CMAKE_L_FLAGS} -fsanitize=undefined,address,leak -fno-omit-frame-pointer") + + #set(CMAKE_CXX_FLAGS "-fsanitize=thread") + endif() endif() + # include include_directories( ${PROJECT_SOURCE_DIR}/../dfm-io/inlcude diff --git a/src/dfm-mount/CMakeLists.txt b/src/dfm-mount/CMakeLists.txt index 93f1117..bdcbd18 100644 --- a/src/dfm-mount/CMakeLists.txt +++ b/src/dfm-mount/CMakeLists.txt @@ -18,10 +18,10 @@ add_compile_definitions(QT_NO_SIGNALS_SLOTS_KEYWORDS) add_definitions(-DQT_NO_KEYWORDS) find_package(PkgConfig REQUIRED) -find_package(Qt5 COMPONENTS Core REQUIRED) -find_package(Qt5 COMPONENTS Concurrent REQUIRED) -find_package(Qt5 COMPONENTS DBus REQUIRED) -find_package(Qt5 COMPONENTS Widgets REQUIRED) +find_package(Qt${QT_VERSION_MAJOR} COMPONENTS Core REQUIRED) +find_package(Qt${QT_VERSION_MAJOR} COMPONENTS Concurrent REQUIRED) +find_package(Qt${QT_VERSION_MAJOR} COMPONENTS DBus REQUIRED) +find_package(Qt${QT_VERSION_MAJOR} COMPONENTS Widgets REQUIRED) pkg_check_modules(udisks2 REQUIRED udisks2 IMPORTED_TARGET) pkg_check_modules(glib REQUIRED glib-2.0 IMPORTED_TARGET) @@ -51,10 +51,10 @@ set_target_properties( ) target_link_libraries(${BIN_NAME} - Qt5::Core - Qt5::Concurrent - Qt5::DBus - Qt5::Widgets + Qt${QT_VERSION_MAJOR}::Core + Qt${QT_VERSION_MAJOR}::Concurrent + Qt${QT_VERSION_MAJOR}::DBus + Qt${QT_VERSION_MAJOR}::Widgets PkgConfig::udisks2 PkgConfig::glib PkgConfig::gio @@ -96,7 +96,7 @@ set(EXAMPLE_SRCS example/main.cpp) add_executable(${BIN_NAME}_example ${EXAMPLE_SRCS}) target_link_libraries(${BIN_NAME}_example ${BIN_NAME}) -target_link_libraries(${BIN_NAME}_example Qt5::Widgets) +target_link_libraries(${BIN_NAME}_example Qt${QT_VERSION_MAJOR}::Widgets) #set(CMAKE_CXX_FLAGS "-fsanitize=undefined,address,leak -fno-omit-frame-pointer") #set(CMAKE_C_FLAGS "-fsanitize=undefined,address,leak -fno-omit-frame-pointer") diff --git a/src/dfm-mount/lib/dprotocoldevice.cpp b/src/dfm-mount/lib/dprotocoldevice.cpp index 04db8fc..44075dd 100644 --- a/src/dfm-mount/lib/dprotocoldevice.cpp +++ b/src/dfm-mount/lib/dprotocoldevice.cpp @@ -128,7 +128,11 @@ QStringList DProtocolDevice::deviceIcons() const // iconName: . GThemedIcon drive-removable-media drive-removable drive drive-removable-media-symbolic drive-removable-symbolic drive-symbolic QString iconNames(cname); iconNames.remove(". GThemedIcon"); +#if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0) + auto iconLst = iconNames.split(" ", Qt::SkipEmptyParts); +#else auto iconLst = iconNames.split(" ", QString::SkipEmptyParts); +#endif dp->deviceIcons = iconLst; return iconLst; } diff --git a/src/dfm-mount/private/dnetworkmounter.cpp b/src/dfm-mount/private/dnetworkmounter.cpp index b1b3934..d23cd77 100644 --- a/src/dfm-mount/private/dnetworkmounter.cpp +++ b/src/dfm-mount/private/dnetworkmounter.cpp @@ -103,7 +103,8 @@ QList DNetworkMounter::loginPasswd(const QString &address) auto info = static_cast(vm); if (!info) return; - info->insert(static_cast(k), static_cast(v)); + QVariant vVariant = QVariant::fromValue((void *)v); + info->insert(static_cast(k), vVariant); qInfo() << "found saved login info:" << *info; }, &attr);