Skip to content

Commit

Permalink
chore: adjust qt6
Browse files Browse the repository at this point in the history
adjust qt6

Log: adjust qt6
  • Loading branch information
Lighto-Ku committed Jun 12, 2024
1 parent f13e1e6 commit a9747e3
Show file tree
Hide file tree
Showing 10 changed files with 52 additions and 32 deletions.
5 changes: 4 additions & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion misc/dfm-burn/dfm-burn.pc.in
Original file line number Diff line number Diff line change
Expand Up @@ -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@
4 changes: 2 additions & 2 deletions src/dfm-burn/dfm-burn-client/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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})

Expand All @@ -16,6 +16,6 @@ include_directories(

target_link_libraries(
${PROJECT_NAME}
Qt5::Core
Qt${QT_VERSION_MAJOR}::Core
dfm-burn
)
4 changes: 2 additions & 2 deletions src/dfm-burn/dfm-burn-lib/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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)

Expand Down Expand Up @@ -41,7 +41,7 @@ add_library(${BIN_NAME} SHARED


target_link_libraries(${BIN_NAME}
Qt5::Core
Qt${QT_VERSION_MAJOR}::Core
PkgConfig::isoburn
)

Expand Down
8 changes: 4 additions & 4 deletions src/dfm-io/dfm-io/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down Expand Up @@ -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}
Expand Down
14 changes: 11 additions & 3 deletions src/dfm-io/dfm-io/utils/dlocalhelper.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -689,7 +689,13 @@ QSet<QString> DLocalHelper::hideListFromUrl(const QUrl &url)
if (succ) {
if (contents && len > 0) {
QString dataStr(contents);
return QSet<QString>::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<QString> { strs.begin(), strs.end() };
#else
const QStringList strs { dataStr.split('\n', QString::SkipEmptyParts) };
return QSet<QString>::fromList(strs);
#endif
}
}
return {};
Expand Down Expand Up @@ -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)
Expand Down
22 changes: 13 additions & 9 deletions src/dfm-io/tools/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
18 changes: 9 additions & 9 deletions src/dfm-mount/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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")
Expand Down
4 changes: 4 additions & 0 deletions src/dfm-mount/lib/dprotocoldevice.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
Expand Down
3 changes: 2 additions & 1 deletion src/dfm-mount/private/dnetworkmounter.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,8 @@ QList<QVariantMap> DNetworkMounter::loginPasswd(const QString &address)
auto info = static_cast<QVariantMap *>(vm);
if (!info)
return;
info->insert(static_cast<char *>(k), static_cast<char *>(v));
QVariant vVariant = QVariant::fromValue((void *)v);
info->insert(static_cast<char *>(k), vVariant);
qInfo() << "found saved login info:" << *info;
},
&attr);
Expand Down

0 comments on commit a9747e3

Please sign in to comment.