Compare commits

..

No commits in common. "291a98ea9765c3b04659aebf9f21f8c8f29ceda3" and "b964fdc77f8408ba89d23385c8da9a647615ee12" have entirely different histories.

12 changed files with 104 additions and 21 deletions

View File

@ -3,6 +3,30 @@ name: Ubuntu CI
on: [push, pull_request] on: [push, pull_request]
jobs: 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: ubuntu-24-04-build:
runs-on: ubuntu-24.04 runs-on: ubuntu-24.04
steps: steps:
@ -15,7 +39,7 @@ jobs:
run: | run: |
mkdir build mkdir build
cd build cd build
cmake ../ cmake ../ -DPREFER_QT_5=OFF
make make
cpack -G DEB cpack -G DEB
- name: Try install it - name: Try install it

View File

@ -10,6 +10,7 @@ include(GNUInstallDirs)
include(FeatureSummary) include(FeatureSummary)
option (EXIV2_METADATA_SUPPORT "Better image metadata support via libexiv2" ON) 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) option (TRANSLATION_RESOURCE_EMBEDDING "Embedding .qm translation files inside resource" OFF)
set (CMAKE_CXX_STANDARD 17) set (CMAKE_CXX_STANDARD 17)
@ -17,15 +18,27 @@ set (CMAKE_CXX_STANDARD_REQUIRED ON)
set (CMAKE_AUTOMOC ON) set (CMAKE_AUTOMOC ON)
set (CMAKE_AUTORCC ON) set (CMAKE_AUTORCC ON)
find_package(QT NAMES Qt6 REQUIRED COMPONENTS Core) if (PREFER_QT_5)
find_package(QT NAMES Qt5 REQUIRED COMPONENTS Core)
else ()
find_package(QT NAMES Qt6 REQUIRED COMPONENTS Core)
endif ()
set (QT_MINIMUM_VERSION "6.4") if (${QT_VERSION_MAJOR} EQUAL "5")
set (QT_MINIMUM_VERSION "5.15.2")
else ()
set (QT_MINIMUM_VERSION "6.4")
endif ()
find_package(Qt${QT_VERSION_MAJOR} ${QT_MINIMUM_VERSION} REQUIRED find_package(Qt${QT_VERSION_MAJOR} ${QT_MINIMUM_VERSION} REQUIRED
COMPONENTS Widgets Svg SvgWidgets LinguistTools COMPONENTS Widgets Svg LinguistTools
OPTIONAL_COMPONENTS DBus 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) if (EXIV2_METADATA_SUPPORT)
find_package(exiv2) find_package(exiv2)
set_package_properties(exiv2 PROPERTIES set_package_properties(exiv2 PROPERTIES
@ -104,25 +117,32 @@ add_executable (${EXE_NAME}
${PPIC_RC_FILES} ${PPIC_RC_FILES}
) )
set(ADD_TRANSLATIONS_ADDITIONAL_ARGS) if (${QT_VERSION_MAJOR} EQUAL "6")
set(ADD_TRANSLATIONS_ADDITIONAL_ARGS)
if (Qt6_VERSION VERSION_GREATER_EQUAL "6.9.0") if (Qt6_VERSION VERSION_GREATER_EQUAL "6.9.0")
set(ADD_TRANSLATIONS_ADDITIONAL_ARGS MERGE_QT_TRANSLATIONS) set(ADD_TRANSLATIONS_ADDITIONAL_ARGS MERGE_QT_TRANSLATIONS)
endif() endif()
if (TRANSLATION_RESOURCE_EMBEDDING) if (TRANSLATION_RESOURCE_EMBEDDING)
qt_add_translations(${EXE_NAME} ${ADD_TRANSLATIONS_ADDITIONAL_ARGS} TS_FILES ${PPIC_TS_FILES}) qt_add_translations(${EXE_NAME} ${ADD_TRANSLATIONS_ADDITIONAL_ARGS} TS_FILES ${PPIC_TS_FILES})
else() else()
qt_add_translations(${EXE_NAME} ${ADD_TRANSLATIONS_ADDITIONAL_ARGS} TS_FILES ${PPIC_TS_FILES} QM_FILES_OUTPUT_VARIABLE PPIC_QM_FILES) qt_add_translations(${EXE_NAME} ${ADD_TRANSLATIONS_ADDITIONAL_ARGS} TS_FILES ${PPIC_TS_FILES} QM_FILES_OUTPUT_VARIABLE PPIC_QM_FILES)
endif()
else()
qt_create_translation(PPIC_QM_FILES ${PPIC_CPP_FILES_FOR_I18N} ${PPIC_TS_FILES})
endif() endif()
target_sources(${EXE_NAME} PRIVATE ${PPIC_QM_FILES}) target_sources(${EXE_NAME} PRIVATE ${PPIC_QM_FILES})
target_link_libraries (${EXE_NAME} Qt${QT_VERSION_MAJOR}::Widgets Qt${QT_VERSION_MAJOR}::Svg Qt${QT_VERSION_MAJOR}::SvgWidgets) 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 ()
if (exiv2_FOUND) if (exiv2_FOUND)
if(NOT TARGET Exiv2::exiv2lib AND TARGET exiv2lib) if(NOT TARGET Exiv2::exiv2lib AND TARGET exiv2lib)
# for exiv2 0.27.x and (macOS?) conan build # for exiv2 0.27.x
add_library(Exiv2::exiv2lib ALIAS exiv2lib) add_library(Exiv2::exiv2lib ALIAS exiv2lib)
endif() endif()
target_link_libraries (${EXE_NAME} target_link_libraries (${EXE_NAME}
@ -133,7 +153,7 @@ if (exiv2_FOUND)
) )
endif () endif ()
if (TARGET Qt6::DBus) if (TARGET Qt5::DBus OR TARGET Qt6::DBus)
target_link_libraries (${EXE_NAME} target_link_libraries (${EXE_NAME}
Qt${QT_VERSION_MAJOR}::DBus Qt${QT_VERSION_MAJOR}::DBus
) )

3
NEWS
View File

@ -3,10 +3,11 @@ Version 1.0.0
Released: 2025-05-03 Released: 2025-05-03
Features: Features:
* Support enforces windowed mode on start-up * Support enforce windowed mode on start-up
* Reload image automatically when current image gets updated * Reload image automatically when current image gets updated
Bugfixes: Bugfixes:
* Refer to the right exiv2 CMake module so it can be found on Linux
* Display correct text language on macOS * Display correct text language on macOS
Miscellaneous: Miscellaneous:

View File

@ -17,7 +17,14 @@ FramelessWindow::FramelessWindow(QWidget *parent)
, m_oldCursorShape(Qt::ArrowCursor) , m_oldCursorShape(Qt::ArrowCursor)
, m_oldEdges() , m_oldEdges()
{ {
#if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0)
this->setWindowFlags(Qt::Window | Qt::FramelessWindowHint | Qt::WindowMinMaxButtonsHint); 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->setMouseTracking(true);
this->setAttribute(Qt::WA_Hover, true); this->setAttribute(Qt::WA_Hover, true);
this->installEventFilter(this); this->installEventFilter(this);
@ -90,7 +97,11 @@ bool FramelessWindow::mousePress(QMouseEvent* event)
{ {
if (event->buttons() & Qt::LeftButton && !isMaximized() && !isFullScreen()) { if (event->buttons() & Qt::LeftButton && !isMaximized() && !isFullScreen()) {
QWindow* win = window()->windowHandle(); QWindow* win = window()->windowHandle();
#if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0)
Qt::Edges edges = this->getEdgesByPos(event->globalPosition().toPoint(), win->frameGeometry()); 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) { if (edges) {
win->startSystemResize(edges); win->startSystemResize(edges);
return true; return true;

View File

@ -41,7 +41,9 @@ void GraphicsView::showFileFromPath(const QString &filePath)
QImageReader imageReader(filePath); QImageReader imageReader(filePath);
imageReader.setAutoTransform(true); imageReader.setAutoTransform(true);
imageReader.setDecideFormatFromContent(true); imageReader.setDecideFormatFromContent(true);
#if QT_VERSION > QT_VERSION_CHECK(6, 0, 0)
imageReader.setAllocationLimit(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. // 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. // So we cannot use imageFormat() and check if it returns QImage::Format_Invalid to detect if we support the file.

View File

@ -24,6 +24,9 @@ int main(int argc, char *argv[])
QGuiApplication::setHighDpiScaleFactorRoundingPolicy(Settings::instance()->hiDpiScaleFactorBehavior()); QGuiApplication::setHighDpiScaleFactorRoundingPolicy(Settings::instance()->hiDpiScaleFactorBehavior());
QApplication a(argc, argv); QApplication a(argc, argv);
#if QT_VERSION < QT_VERSION_CHECK(6, 0, 0)
a.setAttribute(Qt::ApplicationAttribute::AA_UseHighDpiPixmaps);
#endif
QTranslator translator; QTranslator translator;
#if defined(TRANSLATION_RESOURCE_EMBEDDING) #if defined(TRANSLATION_RESOURCE_EMBEDDING)

View File

@ -304,7 +304,7 @@ void MainWindow::showEvent(QShowEvent *event)
return FramelessWindow::showEvent(event); return FramelessWindow::showEvent(event);
} }
void MainWindow::enterEvent(QEnterEvent *event) void MainWindow::enterEvent(QT_ENTER_EVENT *event)
{ {
m_bottomButtonGroup->setOpacity(1); m_bottomButtonGroup->setOpacity(1);
m_gv->setOpacity(1); m_gv->setOpacity(1);
@ -345,7 +345,11 @@ void MainWindow::mouseMoveEvent(QMouseEvent *event)
{ {
if (event->buttons() & Qt::LeftButton && m_clickedOnWindow && !isMaximized() && !isFullScreen()) { if (event->buttons() & Qt::LeftButton && m_clickedOnWindow && !isMaximized() && !isFullScreen()) {
if (!window()->windowHandle()->startSystemMove()) { if (!window()->windowHandle()->startSystemMove()) {
#if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0)
move(event->globalPosition().toPoint() - m_oldMousePos); move(event->globalPosition().toPoint() - m_oldMousePos);
#else
move(event->globalPos() - m_oldMousePos);
#endif // QT_VERSION >= QT_VERSION_CHECK(6, 0, 0)
} }
event->accept(); event->accept();
} }

View File

@ -11,6 +11,12 @@
#include <QPropertyAnimation> #include <QPropertyAnimation>
#include <QPushButton> #include <QPushButton>
#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 QT_BEGIN_NAMESPACE
class QGraphicsOpacityEffect; class QGraphicsOpacityEffect;
class QGraphicsView; class QGraphicsView;
@ -45,7 +51,7 @@ public:
protected slots: protected slots:
void showEvent(QShowEvent *event) override; void showEvent(QShowEvent *event) override;
void enterEvent(QEnterEvent *event) override; void enterEvent(QT_ENTER_EVENT *event) override;
void leaveEvent(QEvent *event) override; void leaveEvent(QEvent *event) override;
void mousePressEvent(QMouseEvent *event) override; void mousePressEvent(QMouseEvent *event) override;
void mouseMoveEvent(QMouseEvent *event) override; void mouseMoveEvent(QMouseEvent *event) override;

View File

@ -63,7 +63,9 @@ void ShortcutEditor::reloadShortcuts()
shortcuts.append(QKeySequence()); shortcuts.append(QKeySequence());
for (const QKeySequence & shortcut : shortcuts) { for (const QKeySequence & shortcut : shortcuts) {
QKeySequenceEdit * keyseqEdit = new QKeySequenceEdit(this); QKeySequenceEdit * keyseqEdit = new QKeySequenceEdit(this);
#if QT_VERSION >= QT_VERSION_CHECK(6, 4, 0)
keyseqEdit->setClearButtonEnabled(true); keyseqEdit->setClearButtonEnabled(true);
#endif // QT_VERSION >= QT_VERSION_CHECK(6, 4, 0)
#if QT_VERSION >= QT_VERSION_CHECK(6, 5, 0) #if QT_VERSION >= QT_VERSION_CHECK(6, 5, 0)
keyseqEdit->setMaximumSequenceLength(1); keyseqEdit->setMaximumSequenceLength(1);
#endif // QT_VERSION >= QT_VERSION_CHECK(6, 5, 0) #endif // QT_VERSION >= QT_VERSION_CHECK(6, 5, 0)

View File

@ -12,10 +12,18 @@ environment:
QTDIR: C:\Qt\6.8\mingw_64 QTDIR: C:\Qt\6.8\mingw_64
MINGW64: C:\Qt\Tools\mingw1310_64 MINGW64: C:\Qt\Tools\mingw1310_64
KF_BRANCH: master KF_BRANCH: master
EXIV2_VERSION: "0.28.5" EXIV2_VERSION: "0.28.3"
EXIV2_CMAKE_OPTIONS: "-DEXIV2_ENABLE_BROTLI=OFF -DEXIV2_ENABLE_INIH=OFF -DEXIV2_BUILD_EXIV2_COMMAND=OFF" EXIV2_CMAKE_OPTIONS: "-DEXIV2_ENABLE_BROTLI=OFF -DEXIV2_ENABLE_INIH=OFF -DEXIV2_BUILD_EXIV2_COMMAND=OFF"
PPIC_CMAKE_OPTIONS: "-DPREFER_QT_5=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" 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: install:
- mkdir %CMAKE_INSTALL_PREFIX% - mkdir %CMAKE_INSTALL_PREFIX%

View File

@ -84,11 +84,12 @@
<description> <description>
<p>This release adds the following features:</p> <p>This release adds the following features:</p>
<ul> <ul>
<li>Support enforces windowed mode on start-up</li> <li>Support enforce windowed mode on start-up</li>
<li>Reload image automatically when current image gets updated</li> <li>Reload image automatically when current image gets updated</li>
</ul> </ul>
<p>This release fixes the following bugs:</p> <p>This release fixes the following bugs:</p>
<ul> <ul>
<li>Refer to the right exiv2 CMake module so it can be found on Linux</li>
<li>Display correct text language on macOS</li> <li>Display correct text language on macOS</li>
</ul> </ul>
<p>This release includes the following changes:</p> <p>This release includes the following changes:</p>

View File

@ -1,8 +1,9 @@
# SPDX-FileCopyrightText: 2025 Gary Wang <git@blumia.net> # SPDX-FileCopyrightText: 2024 Gary Wang <git@blumia.net>
# #
# SPDX-License-Identifier: MIT # SPDX-License-Identifier: MIT
QT += core widgets gui svg svgwidgets QT += core widgets gui svg
greaterThan(QT_MAJOR_VERSION, 5): QT += svgwidgets
TARGET = ppic TARGET = ppic
TEMPLATE = app TEMPLATE = app