From 94f7edf3712b735219eb31eda71b7e188d718bdd Mon Sep 17 00:00:00 2001 From: Andreas Sturmlechner Date: Tue, 21 Jan 2025 19:35:21 +0100 Subject: [PATCH 1/2] CMake: UI: Drop bogus Qt5WebKit/Qt5WebEngineWidgets dependency Signed-off-by: Andreas Sturmlechner --- src/UI/CMakeLists.txt | 10 +--------- 1 file changed, 1 insertion(+), 9 deletions(-) diff --git a/src/UI/CMakeLists.txt b/src/UI/CMakeLists.txt index 96df52b4..4f6cb53e 100644 --- a/src/UI/CMakeLists.txt +++ b/src/UI/CMakeLists.txt @@ -50,14 +50,6 @@ QT5_WRAP_CPP(FILES_MOC ${FILES_H}) QT5_WRAP_UI(FILES_UI_H ${FILES_UI}) ADD_LIBRARY(ui STATIC ${FILES_H} ${FILES_CPP} ${FILES_MOC} ${FILES_UI_H}) -IF(MINGW) - TARGET_LINK_LIBRARIES(ui Qt5::Core Qt5::Concurrent Qt5::Gui Qt5::Widgets Qt5::WebKitWidgets Qt5::Sql) -ELSE() - IF(Qt5WebEngineCore_FOUND) - TARGET_LINK_LIBRARIES(ui Qt5::Core Qt5::Concurrent Qt5::Gui Qt5::Widgets Qt5::WebEngineWidgets Qt5::Sql) - ELSE() - TARGET_LINK_LIBRARIES(ui Qt5::Core Qt5::Concurrent Qt5::Gui Qt5::Widgets Qt5::WebKitWidgets Qt5::Sql) - ENDIF() -ENDIF() +TARGET_LINK_LIBRARIES(ui Qt5::Core Qt5::Concurrent Qt5::Gui Qt5::Widgets Qt5::Sql) SET(FILES_TO_TRANSLATE ${FILES_TO_TRANSLATE} ${FILES_CPP} ${FILES_H} ${FILES_UI} PARENT_SCOPE) SET(LUMINANCE_MODULES_GUI ${LUMINANCE_MODULES_GUI} ui PARENT_SCOPE) -- 2.45.3 From d3e354dba3e1e20d5bcf3d97222d951b857bcb23 Mon Sep 17 00:00:00 2001 From: Andreas Sturmlechner Date: Mon, 20 Jan 2025 18:18:16 +0100 Subject: [PATCH 2/2] CMake: Hard-disable helpbrowser (with it Qt5WebEngine) Gentoo-bug: https://bugs.gentoo.org/926664 Signed-off-by: Andreas Sturmlechner --- CMakeLists.txt | 32 +++++++++++++++++++------------- src/CMakeLists.txt | 4 +++- src/MainWindow/MainWindow.cpp | 8 ++++++++ src/MainWindow/MainWindow.h | 4 ++++ src/MainWindow/MainWindow.ui | 1 + 5 files changed, 35 insertions(+), 14 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 3c8b093f..5f0aaa6d 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -59,6 +59,8 @@ else( HAS_BRANCH_PREDICTION ) set( BRANCH_PREDICTION 0 ) endif( HAS_BRANCH_PREDICTION ) +option(WITH_HELPBROWSER "Build help browser" ON) + # find and setup Qt5 for this project find_package(Qt5Core REQUIRED) @@ -69,13 +71,15 @@ find_package(Qt5Gui REQUIRED) # https://wiki.qt.io/New-Features-in-Qt-5.5#Deprecated_Functionality. Unfortunately, # some Qt distributions still provide QtWebKit instead of QtWebEngine. So first we # try to find QtWebEngine and if not found, we fall back to QtWebKit. -find_package(Qt5WebEngineCore QUIET) -if(Qt5WebEngineCore_FOUND) - find_package(Qt5WebEngineWidgets REQUIRED) -else() - find_package(Qt5WebKit REQUIRED) - find_package(Qt5WebKitWidgets REQUIRED) - add_definitions(-DUSE_DEPRECATED_QTWEBKIT) +if(WITH_HELPBROWSER) + find_package(Qt5WebEngineCore QUIET) + if(Qt5WebEngineCore_FOUND) + find_package(Qt5WebEngineWidgets REQUIRED) + else() + find_package(Qt5WebKit REQUIRED) + find_package(Qt5WebKitWidgets REQUIRED) + add_definitions(-DUSE_DEPRECATED_QTWEBKIT) + endif() endif() find_package(Qt5Xml REQUIRED) find_package(Qt5Sql REQUIRED) @@ -96,12 +100,14 @@ set(LIBS ${LIBS} ${QT_QTCORE_LIBRARIES} ${QT_QTGUI_LIBRARIES} ${QT_QTNETWORK_LIBRARIES} ${QT_QTXML_LIBRARIES} ${QT_QTSQL_LIBRARIES}) -if(Qt5WebEngineCore_FOUND) - message(STATUS "Building with QtWebEngine") - set(LIBS ${LIBS} ${QT_QTWEBENGINE_LIBRARIES}) -else() - message(STATUS "Building with QtWebKit") - set(LIBS ${LIBS} ${QT_QTWEBKIT_LIBRARIES}) +if(WITH_HELPBROWSER) + if(Qt5WebEngineCore_FOUND) + message(STATUS "Building with QtWebEngine") + set(LIBS ${LIBS} ${QT_QTWEBENGINE_LIBRARIES}) + else() + message(STATUS "Building with QtWebKit") + set(LIBS ${LIBS} ${QT_QTWEBKIT_LIBRARIES}) + endif() endif() FIND_PACKAGE(Git) diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index a5757bb9..8221c7ec 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -22,7 +22,9 @@ ADD_SUBDIRECTORY(Exif) ADD_SUBDIRECTORY(Fileformat) ADD_SUBDIRECTORY(Alignment) ADD_SUBDIRECTORY(HdrWizard) -ADD_SUBDIRECTORY(HelpBrowser) +if(WITH_HELPBROWSER) + ADD_SUBDIRECTORY(HelpBrowser) +endif() ADD_SUBDIRECTORY(Preferences) ADD_SUBDIRECTORY(Projection) ADD_SUBDIRECTORY(Resize) diff --git a/src/MainWindow/MainWindow.cpp b/src/MainWindow/MainWindow.cpp index 6459229a..b49d3d14 100644 --- a/src/MainWindow/MainWindow.cpp +++ b/src/MainWindow/MainWindow.cpp @@ -98,7 +98,9 @@ #include #include #include +#ifdef WITH_HELPBROWSER #include +#endif #include #include #include @@ -208,7 +210,9 @@ int MainWindow::sm_counter = 0; QMap MainWindow::sm_mainWindowMap = QMap(); QScopedPointer MainWindow::sm_updateChecker; +#ifdef WITH_HELPBROWSER HelpBrowser *MainWindow::sm_helpBrowser = nullptr; +#endif MainWindow::MainWindow(QWidget *parent) : QMainWindow(parent), @@ -1059,6 +1063,7 @@ void MainWindow::on_normalSizeAct_triggered() { } // Zoom = Viewers (END) +#ifdef WITH_HELPBROWSER void MainWindow::on_documentationAction_triggered() { if (sm_helpBrowser == nullptr) { sm_helpBrowser = @@ -1079,6 +1084,7 @@ void MainWindow::on_documentationAction_triggered() { void MainWindow::helpBrowserClosed() { sm_helpBrowser = nullptr; } +#endif void MainWindow::enterWhatsThis() { QWhatsThis::enterWhatsThisMode(); } @@ -1451,9 +1457,11 @@ void MainWindow::closeEvent(QCloseEvent *event) { } sm_NumMainWindows--; if (sm_NumMainWindows == 0) { +#ifdef WITH_HELPBROWSER if (sm_helpBrowser) { sm_helpBrowser->close(); } +#endif } if (sm_NumMainWindows == 0) { diff --git a/src/MainWindow/MainWindow.h b/src/MainWindow/MainWindow.h index 029cf813..68aa2fd4 100644 --- a/src/MainWindow/MainWindow.h +++ b/src/MainWindow/MainWindow.h @@ -146,7 +146,9 @@ class MainWindow : public QMainWindow { void on_normalSizeAct_triggered(); void updateMagnificationButtons(GenericViewer *); +#ifdef WITH_HELPBROWSER void on_documentationAction_triggered(); +#endif void enterWhatsThis(); void on_OptionsAction_triggered(); @@ -180,7 +182,9 @@ class MainWindow : public QMainWindow { void enableCrop(bool); void disableCrop(); +#ifdef WITH_HELPBROWSER void helpBrowserClosed(); +#endif void on_actionDonate_triggered(); void onUpdateAvailable(); diff --git a/src/MainWindow/MainWindow.ui b/src/MainWindow/MainWindow.ui index 775bfb2c..e4734a43 100644 --- a/src/MainWindow/MainWindow.ui +++ b/src/MainWindow/MainWindow.ui @@ -423,6 +423,7 @@ + false .. -- 2.45.3