diff --git a/.github/workflows/ubuntu.yml b/.github/workflows/ubuntu.yml index f3feb6a..2828371 100644 --- a/.github/workflows/ubuntu.yml +++ b/.github/workflows/ubuntu.yml @@ -3,30 +3,6 @@ name: Ubuntu CI on: [push, pull_request] jobs: - ubuntu-22-04-build: - runs-on: ubuntu-22.04 - steps: - - uses: actions/checkout@v4 - - name: Get build dept. - run: | - sudo apt update - sudo apt install cmake qtbase5-dev libqt5svg5-dev qttools5-dev libexiv2-dev - - name: Build it - run: | - mkdir build - cd build - cmake ../ -DPREFER_QT_5=ON - make - cpack -G DEB - - name: Try install it - run: | - cd build - sudo apt install ./*.deb - - uses: actions/upload-artifact@v4 - with: - name: ubuntu-22.04-deb-package - path: build/*.deb - ubuntu-24-04-build: runs-on: ubuntu-24.04 steps: diff --git a/CMakeLists.txt b/CMakeLists.txt index ae2fe86..6defccb 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -10,7 +10,6 @@ include(GNUInstallDirs) include(FeatureSummary) option (EXIV2_METADATA_SUPPORT "Better image metadata support via libexiv2" ON) -option (PREFER_QT_5 "Prefer to use Qt 5" OFF) option (TRANSLATION_RESOURCE_EMBEDDING "Embedding .qm translation files inside resource" OFF) set (CMAKE_CXX_STANDARD 17) @@ -18,27 +17,15 @@ set (CMAKE_CXX_STANDARD_REQUIRED ON) set (CMAKE_AUTOMOC ON) set (CMAKE_AUTORCC ON) -if (PREFER_QT_5) - find_package(QT NAMES Qt5 REQUIRED COMPONENTS Core) -else () - find_package(QT NAMES Qt6 REQUIRED COMPONENTS Core) -endif () +find_package(QT NAMES Qt6 REQUIRED COMPONENTS Core) -if (${QT_VERSION_MAJOR} EQUAL "5") - set (QT_MINIMUM_VERSION "5.15.2") -else () - set (QT_MINIMUM_VERSION "6.4") -endif () +set (QT_MINIMUM_VERSION "6.4") find_package(Qt${QT_VERSION_MAJOR} ${QT_MINIMUM_VERSION} REQUIRED - COMPONENTS Widgets Svg LinguistTools + COMPONENTS Widgets Svg SvgWidgets LinguistTools OPTIONAL_COMPONENTS DBus ) -if (${QT_VERSION_MAJOR} EQUAL "6") - find_package(Qt${QT_DEFAULT_MAJOR_VERSION} ${QT_MINIMUM_VERSION} CONFIG REQUIRED SvgWidgets) -endif () - if (EXIV2_METADATA_SUPPORT) find_package(exiv2) set_package_properties(exiv2 PROPERTIES @@ -117,34 +104,23 @@ add_executable (${EXE_NAME} ${PPIC_RC_FILES} ) -if (${QT_VERSION_MAJOR} EQUAL "6") - set(ADD_TRANSLATIONS_ADDITIONAL_ARGS) +set(ADD_TRANSLATIONS_ADDITIONAL_ARGS) - if (Qt6_VERSION VERSION_GREATER_EQUAL "6.9.0") - set(ADD_TRANSLATIONS_ADDITIONAL_ARGS MERGE_QT_TRANSLATIONS) - endif() +if (Qt6_VERSION VERSION_GREATER_EQUAL "6.9.0") + set(ADD_TRANSLATIONS_ADDITIONAL_ARGS MERGE_QT_TRANSLATIONS) +endif() - if (TRANSLATION_RESOURCE_EMBEDDING) - qt_add_translations(${EXE_NAME} ${ADD_TRANSLATIONS_ADDITIONAL_ARGS} TS_FILES ${PPIC_TS_FILES}) - else() - qt_add_translations(${EXE_NAME} ${ADD_TRANSLATIONS_ADDITIONAL_ARGS} TS_FILES ${PPIC_TS_FILES} QM_FILES_OUTPUT_VARIABLE PPIC_QM_FILES) - endif() +if (TRANSLATION_RESOURCE_EMBEDDING) + qt_add_translations(${EXE_NAME} ${ADD_TRANSLATIONS_ADDITIONAL_ARGS} TS_FILES ${PPIC_TS_FILES}) else() - qt_create_translation(PPIC_QM_FILES ${PPIC_CPP_FILES_FOR_I18N} ${PPIC_TS_FILES}) + qt_add_translations(${EXE_NAME} ${ADD_TRANSLATIONS_ADDITIONAL_ARGS} TS_FILES ${PPIC_TS_FILES} QM_FILES_OUTPUT_VARIABLE PPIC_QM_FILES) endif() target_sources(${EXE_NAME} PRIVATE ${PPIC_QM_FILES}) -target_link_libraries (${EXE_NAME} Qt${QT_VERSION_MAJOR}::Widgets Qt${QT_VERSION_MAJOR}::Svg) -if (${QT_VERSION_MAJOR} EQUAL "6") - target_link_libraries (${EXE_NAME} Qt::SvgWidgets) -endif () +target_link_libraries (${EXE_NAME} Qt${QT_VERSION_MAJOR}::Widgets Qt${QT_VERSION_MAJOR}::Svg Qt${QT_VERSION_MAJOR}::SvgWidgets) if (exiv2_FOUND) - if(NOT TARGET Exiv2::exiv2lib AND TARGET exiv2lib) - # for exiv2 0.27.x - add_library(Exiv2::exiv2lib ALIAS exiv2lib) - endif() target_link_libraries (${EXE_NAME} Exiv2::exiv2lib ) @@ -153,7 +129,7 @@ if (exiv2_FOUND) ) endif () -if (TARGET Qt5::DBus OR TARGET Qt6::DBus) +if (TARGET Qt6::DBus) target_link_libraries (${EXE_NAME} Qt${QT_VERSION_MAJOR}::DBus ) diff --git a/app/framelesswindow.cpp b/app/framelesswindow.cpp index d5c0a39..4183713 100644 --- a/app/framelesswindow.cpp +++ b/app/framelesswindow.cpp @@ -17,14 +17,7 @@ FramelessWindow::FramelessWindow(QWidget *parent) , m_oldCursorShape(Qt::ArrowCursor) , m_oldEdges() { -#if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0) this->setWindowFlags(Qt::Window | Qt::FramelessWindowHint | Qt::WindowMinMaxButtonsHint); -#else - // There is a bug in Qt 5 that will make pressing Meta+Up cause the app - // fullscreen under Windows, see QTBUG-91226 to learn more. - // The bug seems no longer exists in Qt 6 (I only tested it under Qt 6.3.0). - this->setWindowFlags(Qt::Window | Qt::FramelessWindowHint | Qt::WindowMinimizeButtonHint); -#endif // QT_VERSION >= QT_VERSION_CHECK(6, 0, 0) this->setMouseTracking(true); this->setAttribute(Qt::WA_Hover, true); this->installEventFilter(this); @@ -97,11 +90,7 @@ bool FramelessWindow::mousePress(QMouseEvent* event) { if (event->buttons() & Qt::LeftButton && !isMaximized() && !isFullScreen()) { QWindow* win = window()->windowHandle(); -#if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0) Qt::Edges edges = this->getEdgesByPos(event->globalPosition().toPoint(), win->frameGeometry()); -#else - Qt::Edges edges = this->getEdgesByPos(event->globalPos(), win->frameGeometry()); -#endif // QT_VERSION >= QT_VERSION_CHECK(6, 0, 0) if (edges) { win->startSystemResize(edges); return true; diff --git a/app/graphicsview.cpp b/app/graphicsview.cpp index f5b7555..a36d4d7 100644 --- a/app/graphicsview.cpp +++ b/app/graphicsview.cpp @@ -41,9 +41,7 @@ void GraphicsView::showFileFromPath(const QString &filePath) QImageReader imageReader(filePath); imageReader.setAutoTransform(true); imageReader.setDecideFormatFromContent(true); -#if QT_VERSION > QT_VERSION_CHECK(6, 0, 0) imageReader.setAllocationLimit(0); -#endif //QT_VERSION > QT_VERSION_CHECK(6, 0, 0) // Since if the image format / plugin does not support this feature, imageFormat() will returns an invalid format. // So we cannot use imageFormat() and check if it returns QImage::Format_Invalid to detect if we support the file. diff --git a/app/main.cpp b/app/main.cpp index 81e4381..5c7554d 100644 --- a/app/main.cpp +++ b/app/main.cpp @@ -24,9 +24,6 @@ int main(int argc, char *argv[]) QGuiApplication::setHighDpiScaleFactorRoundingPolicy(Settings::instance()->hiDpiScaleFactorBehavior()); QApplication a(argc, argv); -#if QT_VERSION < QT_VERSION_CHECK(6, 0, 0) - a.setAttribute(Qt::ApplicationAttribute::AA_UseHighDpiPixmaps); -#endif QTranslator translator; #if defined(TRANSLATION_RESOURCE_EMBEDDING) diff --git a/app/mainwindow.cpp b/app/mainwindow.cpp index 5dbf2b9..cc0d6ac 100644 --- a/app/mainwindow.cpp +++ b/app/mainwindow.cpp @@ -304,7 +304,7 @@ void MainWindow::showEvent(QShowEvent *event) return FramelessWindow::showEvent(event); } -void MainWindow::enterEvent(QT_ENTER_EVENT *event) +void MainWindow::enterEvent(QEnterEvent *event) { m_bottomButtonGroup->setOpacity(1); m_gv->setOpacity(1); @@ -345,11 +345,7 @@ void MainWindow::mouseMoveEvent(QMouseEvent *event) { if (event->buttons() & Qt::LeftButton && m_clickedOnWindow && !isMaximized() && !isFullScreen()) { if (!window()->windowHandle()->startSystemMove()) { -#if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0) move(event->globalPosition().toPoint() - m_oldMousePos); -#else - move(event->globalPos() - m_oldMousePos); -#endif // QT_VERSION >= QT_VERSION_CHECK(6, 0, 0) } event->accept(); } diff --git a/app/mainwindow.h b/app/mainwindow.h index c9b5a38..45b238a 100644 --- a/app/mainwindow.h +++ b/app/mainwindow.h @@ -11,12 +11,6 @@ #include #include -#if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0) - typedef QEnterEvent QT_ENTER_EVENT; -#else - typedef QEvent QT_ENTER_EVENT; -#endif // QT_VERSION_CHECK(6, 0, 0) - QT_BEGIN_NAMESPACE class QGraphicsOpacityEffect; class QGraphicsView; @@ -51,7 +45,7 @@ public: protected slots: void showEvent(QShowEvent *event) override; - void enterEvent(QT_ENTER_EVENT *event) override; + void enterEvent(QEnterEvent *event) override; void leaveEvent(QEvent *event) override; void mousePressEvent(QMouseEvent *event) override; void mouseMoveEvent(QMouseEvent *event) override; diff --git a/app/shortcutedit.cpp b/app/shortcutedit.cpp index c86e98f..20486e2 100644 --- a/app/shortcutedit.cpp +++ b/app/shortcutedit.cpp @@ -63,9 +63,7 @@ void ShortcutEditor::reloadShortcuts() shortcuts.append(QKeySequence()); for (const QKeySequence & shortcut : shortcuts) { QKeySequenceEdit * keyseqEdit = new QKeySequenceEdit(this); -#if QT_VERSION >= QT_VERSION_CHECK(6, 4, 0) keyseqEdit->setClearButtonEnabled(true); -#endif // QT_VERSION >= QT_VERSION_CHECK(6, 4, 0) #if QT_VERSION >= QT_VERSION_CHECK(6, 5, 0) keyseqEdit->setMaximumSequenceLength(1); #endif // QT_VERSION >= QT_VERSION_CHECK(6, 5, 0) diff --git a/appveyor.yml b/appveyor.yml index 571945d..126e3fb 100644 --- a/appveyor.yml +++ b/appveyor.yml @@ -12,18 +12,10 @@ environment: QTDIR: C:\Qt\6.8\mingw_64 MINGW64: C:\Qt\Tools\mingw1310_64 KF_BRANCH: master - EXIV2_VERSION: "0.28.3" + EXIV2_VERSION: "0.28.5" EXIV2_CMAKE_OPTIONS: "-DEXIV2_ENABLE_BROTLI=OFF -DEXIV2_ENABLE_INIH=OFF -DEXIV2_BUILD_EXIV2_COMMAND=OFF" PPIC_CMAKE_OPTIONS: "-DPREFER_QT_5=OFF" WINDEPLOYQT_ARGS: "--verbose=2 --no-quick-import --no-translations --no-opengl-sw --no-system-d3d-compiler --skip-plugin-types tls,networkinformation" - - job_name: mingw81_64_qt5_15_2 - QTDIR: C:\Qt\5.15.2\mingw81_64 - MINGW64: C:\Qt\Tools\mingw810_64 - KF_BRANCH: kf5 - EXIV2_VERSION: "0.27.7" - EXIV2_CMAKE_OPTIONS: "-DEXIV2_BUILD_SAMPLES=OFF -DEXIV2_ENABLE_WIN_UNICODE=ON -DEXIV2_BUILD_EXIV2_COMMAND=OFF" - PPIC_CMAKE_OPTIONS: "-DPREFER_QT_5=ON" - WINDEPLOYQT_ARGS: "--verbose=2 --no-quick-import --no-translations --no-opengl-sw --no-angle --no-system-d3d-compiler" install: - mkdir %CMAKE_INSTALL_PREFIX% diff --git a/pineapple-pictures.pro b/pineapple-pictures.pro index 299ae66..d088f0b 100644 --- a/pineapple-pictures.pro +++ b/pineapple-pictures.pro @@ -1,9 +1,8 @@ -# SPDX-FileCopyrightText: 2024 Gary Wang +# SPDX-FileCopyrightText: 2025 Gary Wang # # SPDX-License-Identifier: MIT -QT += core widgets gui svg -greaterThan(QT_MAJOR_VERSION, 5): QT += svgwidgets +QT += core widgets gui svg svgwidgets TARGET = ppic TEMPLATE = app