Skip to content

Commit

Permalink
[kde] stub-export.cpp: Set up KAboutData.
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
GerbilSoft committed Nov 2, 2024
1 parent 8c7e792 commit e263b35
Show file tree
Hide file tree
Showing 6 changed files with 51 additions and 10 deletions.
6 changes: 3 additions & 3 deletions cmake/libs/RP_FindQt5andKF5.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
6 changes: 3 additions & 3 deletions cmake/libs/RP_FindQt6andKF6.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
41 changes: 41 additions & 0 deletions src/kde/config/stub-export.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,10 @@ using namespace LibRpTexture;
# include "../GettextTranslator.hpp"
#endif

// KCrash
#include <KAboutData>
#include <KCrash>

// C++ STL classes
using std::string;

Expand Down Expand Up @@ -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();
Expand Down
4 changes: 2 additions & 2 deletions src/kde/kde4/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -100,9 +100,9 @@ IF(BUILD_KDE4)
$<BUILD_INTERFACE:${CMAKE_CURRENT_BINARY_DIR}/../..> # 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)
Expand Down
2 changes: 1 addition & 1 deletion src/kde/kf5/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -118,7 +118,7 @@ IF(BUILD_KF5)
$<BUILD_INTERFACE:${CMAKE_CURRENT_BINARY_DIR}/../..> # 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)
Expand Down
2 changes: 1 addition & 1 deletion src/kde/kf6/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,7 @@ IF(BUILD_KF6)
$<BUILD_INTERFACE:${CMAKE_CURRENT_BINARY_DIR}/../..> # 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)
Expand Down

0 comments on commit e263b35

Please sign in to comment.