From e263b35b076f9abb6232269b4dd56e9b1c2d6d66 Mon Sep 17 00:00:00 2001 From: David Korth Date: Fri, 1 Nov 2024 20:42:32 -0400 Subject: [PATCH] [kde] stub-export.cpp: Set up KAboutData. TODO: Setting up KCrash would be useful, but DrKonqi shows a button to report bugs to bugs.kde.org, which doesn't help us. FIXME: Fix up the KLocalizedString versions for KDE4. (Or remove KDE4...) [cmake/libs] RP_FindQt?andKF?.cmake: Find KCrash. --- cmake/libs/RP_FindQt5andKF5.cmake | 6 ++--- cmake/libs/RP_FindQt6andKF6.cmake | 6 ++--- src/kde/config/stub-export.cpp | 41 +++++++++++++++++++++++++++++++ src/kde/kde4/CMakeLists.txt | 4 +-- src/kde/kf5/CMakeLists.txt | 2 +- src/kde/kf6/CMakeLists.txt | 2 +- 6 files changed, 51 insertions(+), 10 deletions(-) diff --git a/cmake/libs/RP_FindQt5andKF5.cmake b/cmake/libs/RP_FindQt5andKF5.cmake index 4c7a3fb32e..b2f127014f 100644 --- a/cmake/libs/RP_FindQt5andKF5.cmake +++ b/cmake/libs/RP_FindQt5andKF5.cmake @@ -72,11 +72,11 @@ MACRO(FIND_QT5_AND_KF5) SET(QT_PLUGIN_INSTALL_DIR "${KF5_PLUGIN_INSTALL_DIR}") # Find KF5. (TODO: Version?) - FIND_PACKAGE(KF5 ${REQUIRE_KF5} COMPONENTS CoreAddons KIO WidgetsAddons FileMetaData) - IF(NOT KF5CoreAddons_FOUND OR NOT KF5KIO_FOUND OR NOT KF5WidgetsAddons_FOUND OR NOT KF5FileMetaData_FOUND) + FIND_PACKAGE(KF5 ${REQUIRE_KF5} COMPONENTS CoreAddons KIO WidgetsAddons FileMetaData Crash) + IF(NOT KF5CoreAddons_FOUND OR NOT KF5KIO_FOUND OR NOT KF5WidgetsAddons_FOUND OR NOT KF5FileMetaData_FOUND OR NOT KF5Crash_FOUND) # KF5 not found. SET(BUILD_KF5 OFF CACHE INTERNAL "Build the KDE Frameworks 5 plugin." FORCE) - ENDIF(NOT KF5CoreAddons_FOUND OR NOT KF5KIO_FOUND OR NOT KF5WidgetsAddons_FOUND OR NOT KF5FileMetaData_FOUND) + ENDIF(NOT KF5CoreAddons_FOUND OR NOT KF5KIO_FOUND OR NOT KF5WidgetsAddons_FOUND OR NOT KF5FileMetaData_FOUND OR NOT KF5Crash_FOUND) # CoreAddons: If earlier than 5.85, install service menus in ${SERVICES_INSTALL_DIR}. IF(TARGET KF5::CoreAddons AND KF5CoreAddons_VERSION VERSION_LESS 5.84.79) diff --git a/cmake/libs/RP_FindQt6andKF6.cmake b/cmake/libs/RP_FindQt6andKF6.cmake index 59569eaa6e..ca500840cb 100644 --- a/cmake/libs/RP_FindQt6andKF6.cmake +++ b/cmake/libs/RP_FindQt6andKF6.cmake @@ -73,11 +73,11 @@ MACRO(FIND_QT6_AND_KF6) SET(QT_PLUGIN_INSTALL_DIR "${KF6_PLUGIN_INSTALL_DIR}") # Find KF6. - FIND_PACKAGE(KF6 ${REQUIRE_KF6} ${KF6_MIN} COMPONENTS KIO WidgetsAddons FileMetaData) - IF(NOT KF6KIO_FOUND OR NOT KF6WidgetsAddons_FOUND OR NOT KF6FileMetaData_FOUND) + FIND_PACKAGE(KF6 ${REQUIRE_KF6} ${KF6_MIN} COMPONENTS KIO WidgetsAddons FileMetaData Crash) + IF(NOT KF6KIO_FOUND OR NOT KF6WidgetsAddons_FOUND OR NOT KF6FileMetaData_FOUND OR NOT KF6Crash_FOUND) # KF6 not found. SET(BUILD_KF6 OFF CACHE INTERNAL "Build the KDE Frameworks 6 plugin." FORCE) - ENDIF(NOT KF6KIO_FOUND OR NOT KF6WidgetsAddons_FOUND OR NOT KF6FileMetaData_FOUND) + ENDIF(NOT KF6KIO_FOUND OR NOT KF6WidgetsAddons_FOUND OR NOT KF6FileMetaData_FOUND OR NOT KF6Crash_FOUND) # KIO::ThumbnailCreator is always available in KF6. SET(HAVE_KIOGUI_KIO_THUMBNAILCREATOR_H 1) diff --git a/src/kde/config/stub-export.cpp b/src/kde/config/stub-export.cpp index 509069e0ce..046a822672 100644 --- a/src/kde/config/stub-export.cpp +++ b/src/kde/config/stub-export.cpp @@ -33,6 +33,10 @@ using namespace LibRpTexture; # include "../GettextTranslator.hpp" #endif +// KCrash +#include +#include + // C++ STL classes using std::string; @@ -117,6 +121,43 @@ Q_DECL_EXPORT int RP_C_API rp_show_config_dialog(int argc, char *argv[]) "ConfigDialog", "ROM Properties Page configuration", nullptr); QApplication *const app = initQApp(argc, argv, applicationDisplayName); + // Set up KAboutData. + const QString displayName = ConfigDialog::tr("ROM Properties Page configuration"); + const char *const copyrightString = + AboutTabText::getProgramInfoString(AboutTabText::ProgramInfoStringID::Copyright); + assert(copyrightString != nullptr); +#if QT_VERSION >= QT_VERSION_CHECK(5, 0, 0) + KAboutData aboutData( + QLatin1String("rp-config"), // componentName + displayName, // displayName + app->applicationVersion(), // version + displayName, // shortDescription (TODO: Better value?) + KAboutLicense::GPL_V2, // licenseType + QString::fromUtf8(copyrightString), // copyrightStatement + QString(), // otherText + QLatin1String("https://github.com/GerbilSoft/rom-properties"), // homePageAddress + QLatin1String("https://github.com/GerbilSoft/rom-properties/issues") // bugAddress + ); +#else /* QT_VERSION < QT_VERSION_CHECK(5, 0, 0) */ + KAboutData aboutData( + QByteArray("rp-config"), // appName + QByteArray("rom-properties"), // catalogName + KLocalizedString() /*displayName*/, // programName + app->applicationVersion().toUtf8(), // version + KLocalizedString() /*displayName*/, // shortDescription (TODO: Better value?) + KAboutData::License_GPL_V2, // licenseType + KLocalizeString(), /*QString::fromUtf8(copyrightString)*/ // copyrightStatement + KLocalizedString(), // otherText + QByteArray("https://github.com/GerbilSoft/rom-properties"), // homePageAddress + QByteArray("https://github.com/GerbilSoft/rom-properties/issues") // bugAddress + ); +#endif /* QT_VERSION >= QT_VERSION_CHECK(5, 0, 0) */ + KAboutData::setApplicationData(aboutData); + + // Initialize KCrash. + // FIXME: It shows bugs.kde.org as the bug reporting address, which isn't wanted... + //KCrash::initialize(); + // Create and run the ConfigDialog. // TODO: Get the return value? ConfigDialog *const configDialog = new ConfigDialog(); diff --git a/src/kde/kde4/CMakeLists.txt b/src/kde/kde4/CMakeLists.txt index bbcd1f37cd..dffae38f72 100644 --- a/src/kde/kde4/CMakeLists.txt +++ b/src/kde/kde4/CMakeLists.txt @@ -100,9 +100,9 @@ IF(BUILD_KDE4) $ # src ) TARGET_LINK_LIBRARIES(${PROJECT_NAME} PRIVATE romdata) - TARGET_LINK_LIBRARIES(${PROJECT_NAME} PUBLIC ${KDE4_KFILE_LIBRARY} ${KDE4_KDEUI_LIBRARY}) + TARGET_LINK_LIBRARIES(${PROJECT_NAME} PUBLIC ${KDE4_KFILE_LIBRARY} ${KDE4_KDEUI_LIBRARY} ${KDE4_KDECORE_LIBRARY}) TARGET_LINK_LIBRARIES(${PROJECT_NAME} PUBLIC Qt4::QtGui Qt4::QtCore) - TARGET_INCLUDE_DIRECTORIES(rom-properties-kde4 PUBLIC ${KDE4_INCLUDE_DIR}) + TARGET_INCLUDE_DIRECTORIES(rom-properties-kde4 PUBLIC ${KDE4_INCLUDE_DIR} ${KDE4_INCLUDE_DIR}/KDE) IF(HAVE_QtDBus) TARGET_LINK_LIBRARIES(rom-properties-kde4 PUBLIC Qt4::QtDBus) ENDIF(HAVE_QtDBus) diff --git a/src/kde/kf5/CMakeLists.txt b/src/kde/kf5/CMakeLists.txt index 482967bd74..6bf9e209e6 100644 --- a/src/kde/kf5/CMakeLists.txt +++ b/src/kde/kf5/CMakeLists.txt @@ -118,7 +118,7 @@ IF(BUILD_KF5) $ # src ) TARGET_LINK_LIBRARIES(${PROJECT_NAME} PRIVATE romdata) - TARGET_LINK_LIBRARIES(${PROJECT_NAME} PRIVATE KF5::CoreAddons KF5::KIOWidgets KF5::KIOCore KF5::WidgetsAddons KF5::FileMetaData) + TARGET_LINK_LIBRARIES(${PROJECT_NAME} PRIVATE KF5::CoreAddons KF5::KIOWidgets KF5::KIOCore KF5::WidgetsAddons KF5::FileMetaData KF5::Crash) TARGET_LINK_LIBRARIES(${PROJECT_NAME} PUBLIC Qt5::Widgets Qt5::Gui Qt5::Core) IF(HAVE_QtDBus) TARGET_LINK_LIBRARIES(${PROJECT_NAME} PUBLIC Qt5::DBus) diff --git a/src/kde/kf6/CMakeLists.txt b/src/kde/kf6/CMakeLists.txt index 61cfa6691d..2024d68e7a 100644 --- a/src/kde/kf6/CMakeLists.txt +++ b/src/kde/kf6/CMakeLists.txt @@ -105,7 +105,7 @@ IF(BUILD_KF6) $ # src ) TARGET_LINK_LIBRARIES(${PROJECT_NAME} PRIVATE romdata) - TARGET_LINK_LIBRARIES(${PROJECT_NAME} PUBLIC KF6::KIOWidgets KF6::KIOGui KF6::KIOCore KF6::WidgetsAddons KF6::FileMetaData) + TARGET_LINK_LIBRARIES(${PROJECT_NAME} PUBLIC KF6::KIOWidgets KF6::KIOGui KF6::KIOCore KF6::WidgetsAddons KF6::FileMetaData KF6::Crash) TARGET_LINK_LIBRARIES(${PROJECT_NAME} PUBLIC Qt6::Network Qt6::Widgets Qt6::Gui Qt6::Core) IF(HAVE_QtDBus) TARGET_LINK_LIBRARIES(${PROJECT_NAME} PUBLIC Qt6::DBus)