Commit 8bfe7af2 authored by Laurent Montel's avatar Laurent Montel 😁
Browse files

Prepare to port to qt6

parent 9c35b9ed
......@@ -8,7 +8,7 @@ set (RELEASE_SERVICE_VERSION "${RELEASE_SERVICE_VERSION_MAJOR}.${RELEASE_SERVICE
project(baloo-widgets VERSION ${RELEASE_SERVICE_VERSION})
set(QT_MIN_VERSION "5.15.0")
set(KF5_MIN_VERSION "5.87.0")
set(KF5_MIN_VERSION "5.90.0")
find_package(ECM ${KF5_MIN_VERSION} REQUIRED NO_MODULE)
set(CMAKE_MODULE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/cmake/modules" ${ECM_MODULE_PATH})
......@@ -30,7 +30,7 @@ include(ECMAddTests)
include(ECMQtDeclareLoggingCategory)
include(CMakePackageConfigHelpers)
find_package(Qt5 ${QT_MIN_VERSION} REQUIRED NO_MODULE COMPONENTS Core Widgets Test)
find_package(Qt${QT_MAJOR_VERSION} ${QT_MIN_VERSION} REQUIRED NO_MODULE COMPONENTS Core Widgets Test)
find_package(KF5 ${KF5_MIN_VERSION} REQUIRED COMPONENTS Config KIO I18n FileMetaData Baloo)
ecm_setup_version(PROJECT
......
......@@ -2,7 +2,7 @@ include(ECMMarkAsTest)
ecm_add_test(extractortest.cpp
TEST_NAME "extractortest"
LINK_LIBRARIES Qt5::Test
LINK_LIBRARIES Qt${QT_MAJOR_VERSION}::Test
KF5::FileMetaData
)
ecm_add_tests(
......@@ -15,8 +15,8 @@ ecm_add_tests(
KF5::ConfigCore
KF5::BalooWidgets
KF5::FileMetaData
Qt5::Test
Qt5::Widgets
Qt${QT_MAJOR_VERSION}::Test
Qt${QT_MAJOR_VERSION}::Widgets
)
target_include_directories(extractortest
......
......@@ -39,8 +39,8 @@ ecm_qt_declare_logging_category(KF5BalooWidgets
target_link_libraries(KF5BalooWidgets
PUBLIC
Qt5::Widgets
Qt5::Core
Qt${QT_MAJOR_VERSION}::Widgets
Qt${QT_MAJOR_VERSION}::Core
KF5::KIOCore # KFileItem
KF5::CoreAddons # KProcess, KJob
......@@ -53,7 +53,7 @@ target_link_libraries(KF5BalooWidgets
KF5::ConfigGui
)
target_include_directories(KF5BalooWidgets INTERFACE "$<INSTALL_INTERFACE:${KDE_INSTALL_INCLUDEDIR_KF5}/BalooWidgets>")
target_include_directories(KF5BalooWidgets INTERFACE "$<INSTALL_INTERFACE:${KDE_INSTALL_INCLUDEDIR_KF}/BalooWidgets>")
generate_export_header(KF5BalooWidgets BASE_NAME BALOO_WIDGETS EXPORT_FILE_NAME widgets_export.h)
......@@ -71,14 +71,14 @@ ecm_generate_headers(KF5BalooWidgets_CamelCase_HEADERS
install(FILES
${KF5BalooWidgets_CamelCase_HEADERS}
DESTINATION ${KDE_INSTALL_INCLUDEDIR_KF5}/BalooWidgets/Baloo
DESTINATION ${KDE_INSTALL_INCLUDEDIR_KF}/BalooWidgets/Baloo
COMPONENT Devel
)
install(FILES
${CMAKE_CURRENT_BINARY_DIR}/widgets_export.h
${KF5BalooWidgets_HEADERS}
DESTINATION ${KDE_INSTALL_INCLUDEDIR_KF5}/BalooWidgets/baloo
DESTINATION ${KDE_INSTALL_INCLUDEDIR_KF}/BalooWidgets/baloo
COMPONENT Devel
)
......@@ -87,7 +87,7 @@ install(FILES
#
add_executable(baloo_filemetadata_temp_extractor extractor.cpp filemetadatautil.cpp)
target_link_libraries(baloo_filemetadata_temp_extractor
Qt5::Core
Qt${QT_MAJOR_VERSION}::Core
KF5::I18n
KF5::FileMetaData
)
......
......@@ -61,8 +61,8 @@ QVariant intersect(const QVariant &v1, const QVariant &v2)
// List and List
if (v1.type() == QVariant::StringList && v2.type() == QVariant::StringList) {
QSet<QString> s1 = v1.toStringList().toSet();
QSet<QString> s2 = v2.toStringList().toSet();
QSet<QString> s1(v1.toStringList().cbegin(), v1.toStringList().cend());
QSet<QString> s2(v2.toStringList().cbegin(), v2.toStringList().cend());
return QVariant(s1.intersect(s2).values());
}
......@@ -448,7 +448,11 @@ QString FileMetaDataProvider::label(const QString &metaDataLabel) const
if (value.isEmpty()) {
static const auto extraPrefix = QStringLiteral("kfileitem#extra_");
if (metaDataLabel.startsWith(extraPrefix)) {
#if QT_VERSION < QT_VERSION_CHECK(6, 0, 0)
const auto parts = metaDataLabel.splitRef(QLatin1Char('_'));
#else
const auto parts = metaDataLabel.split(QLatin1Char('_'));
#endif
Q_ASSERT(parts.count() == 3);
const auto protocol = parts.at(1);
const int extraNumber = parts.at(2).toInt() - 1;
......
......@@ -2,22 +2,22 @@ add_executable(tagwidgetapp tagwidgetapp.cpp tagwidgettest.cpp)
target_link_libraries(tagwidgetapp
KF5::Baloo
KF5::BalooWidgets
Qt5::Widgets
Qt5::Core
Qt${QT_MAJOR_VERSION}::Widgets
Qt${QT_MAJOR_VERSION}::Core
)
add_executable(metadatawidgetapp metadatawidgetapp.cpp)
target_link_libraries(metadatawidgetapp
KF5::Baloo
KF5::BalooWidgets
Qt5::Widgets
Qt5::Core
Qt${QT_MAJOR_VERSION}::Widgets
Qt${QT_MAJOR_VERSION}::Core
)
add_executable(metadataconfigwidgetapp metadataconfigwidgetapp.cpp)
target_link_libraries(metadataconfigwidgetapp
KF5::Baloo
KF5::BalooWidgets
Qt5::Widgets
Qt5::Core
Qt${QT_MAJOR_VERSION}::Widgets
Qt${QT_MAJOR_VERSION}::Core
)
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment