Compare commits
30 Commits
1.0.0
...
73b15da182
Author | SHA1 | Date | |
---|---|---|---|
73b15da182 | |||
f4f7d93e38 | |||
591b01a83a | |||
f8d3dcc899 | |||
f0ed9d0ca1 | |||
13227cfac9 | |||
b73df5ea1a | |||
4375fe1c2d | |||
4654cb21a0 | |||
ba23208a7a | |||
ed5a602332 | |||
347681e604 | |||
505ab9e2a6 | |||
c787e14a69 | |||
29c5783a66 | |||
ddc75f7cd0 | |||
f976fea418 | |||
2846e4907b | |||
c828f86b74 | |||
040e2a7b5f | |||
b566096b1f | |||
2bee79c064 | |||
91696963ae | |||
1623ca315a | |||
3cfb25db9a | |||
36854d19f4 | |||
3f7ebd2f6c | |||
291a98ea97 | |||
24a0b581f3 | |||
369aa13be3 |
3
.git-blame-ignore-revs
Normal file
3
.git-blame-ignore-revs
Normal file
@ -0,0 +1,3 @@
|
|||||||
|
# .git-blame-ignore-revs
|
||||||
|
# CR LF to LF
|
||||||
|
ed5a6023326fd2ab420ded76976501be33e0b389
|
5
.gitattributes
vendored
Normal file
5
.gitattributes
vendored
Normal file
@ -0,0 +1,5 @@
|
|||||||
|
*.txt text eol=lf
|
||||||
|
*.cpp text eol=lf
|
||||||
|
*.h text eol=lf
|
||||||
|
*.ui text eol=lf
|
||||||
|
*.qml text eol=lf
|
2
.github/workflows/macos.yml
vendored
2
.github/workflows/macos.yml
vendored
@ -12,7 +12,7 @@ jobs:
|
|||||||
- name: Install Qt
|
- name: Install Qt
|
||||||
uses: jurplel/install-qt-action@v4
|
uses: jurplel/install-qt-action@v4
|
||||||
with:
|
with:
|
||||||
version: '6.9.0'
|
version: '6.9.1'
|
||||||
modules: 'qtimageformats'
|
modules: 'qtimageformats'
|
||||||
- name: Install Conan and Dependencies
|
- name: Install Conan and Dependencies
|
||||||
id: conan
|
id: conan
|
||||||
|
26
.github/workflows/ubuntu.yml
vendored
26
.github/workflows/ubuntu.yml
vendored
@ -3,30 +3,6 @@ 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:
|
||||||
@ -39,7 +15,7 @@ jobs:
|
|||||||
run: |
|
run: |
|
||||||
mkdir build
|
mkdir build
|
||||||
cd build
|
cd build
|
||||||
cmake ../ -DPREFER_QT_5=OFF
|
cmake ../
|
||||||
make
|
make
|
||||||
cpack -G DEB
|
cpack -G DEB
|
||||||
- name: Try install it
|
- name: Try install it
|
||||||
|
10
.github/workflows/windows.yml
vendored
10
.github/workflows/windows.yml
vendored
@ -8,7 +8,7 @@ jobs:
|
|||||||
strategy:
|
strategy:
|
||||||
matrix:
|
matrix:
|
||||||
include:
|
include:
|
||||||
- qt_ver: '6.9.0'
|
- qt_ver: '6.9.1'
|
||||||
vs: '2022'
|
vs: '2022'
|
||||||
aqt_arch: 'win64_msvc2022_64'
|
aqt_arch: 'win64_msvc2022_64'
|
||||||
msvc_arch: 'x64'
|
msvc_arch: 'x64'
|
||||||
@ -44,7 +44,7 @@ jobs:
|
|||||||
strategy:
|
strategy:
|
||||||
matrix:
|
matrix:
|
||||||
include:
|
include:
|
||||||
- qt_ver: '6.9.0'
|
- qt_ver: '6.9.1'
|
||||||
vs: '2022'
|
vs: '2022'
|
||||||
aqt_arch: 'win64_msvc2022_64'
|
aqt_arch: 'win64_msvc2022_64'
|
||||||
msvc_arch: 'x64'
|
msvc_arch: 'x64'
|
||||||
@ -72,9 +72,9 @@ jobs:
|
|||||||
set CMAKE_PREFIX_PATH=%PWD%/dependencies_bin
|
set CMAKE_PREFIX_PATH=%PWD%/dependencies_bin
|
||||||
mkdir dependencies_src
|
mkdir dependencies_src
|
||||||
echo ::group::===== exiv2 =====
|
echo ::group::===== exiv2 =====
|
||||||
curl -fsSL -o exiv2_bin.zip https://github.com/Exiv2/exiv2/releases/download/v0.28.3/exiv2-0.28.3-2019msvc64.zip
|
curl -fsSL -o exiv2_bin.zip https://github.com/Exiv2/exiv2/releases/download/v0.28.5/exiv2-0.28.5-2022msvc-AMD64.zip
|
||||||
7z x exiv2_bin.zip -y
|
7z x exiv2_bin.zip -y
|
||||||
ren .\exiv2-0.28.3-2019msvc64 dependencies_bin
|
ren .\exiv2-0.28.5-2022msvc-AMD64 dependencies_bin
|
||||||
echo ::endgroup::
|
echo ::endgroup::
|
||||||
echo ::group::===== zlib =====
|
echo ::group::===== zlib =====
|
||||||
curl -fsSL -o zlib_src.zip https://zlib.net/zlib131.zip
|
curl -fsSL -o zlib_src.zip https://zlib.net/zlib131.zip
|
||||||
@ -109,7 +109,7 @@ jobs:
|
|||||||
echo ::endgroup::
|
echo ::endgroup::
|
||||||
echo ::group::===== KArchive =====
|
echo ::group::===== KArchive =====
|
||||||
git clone -q https://invent.kde.org/frameworks/karchive.git dependencies_src/karchive
|
git clone -q https://invent.kde.org/frameworks/karchive.git dependencies_src/karchive
|
||||||
cmake .\dependencies_src\karchive -Bbuild_dependencies/karchive -DWITH_LIBZSTD=OFF -DWITH_BZIP2=OFF -DWITH_LIBLZMA=OFF -DCMAKE_INSTALL_PREFIX="dependencies_bin" || goto :error
|
cmake .\dependencies_src\karchive -Bbuild_dependencies/karchive -DBUILD_TESTING=OFF -DWITH_LIBZSTD=OFF -DWITH_BZIP2=OFF -DWITH_LIBLZMA=OFF -DCMAKE_INSTALL_PREFIX="dependencies_bin" || goto :error
|
||||||
cmake --build build_dependencies/karchive --config Release --target=install || goto :error
|
cmake --build build_dependencies/karchive --config Release --target=install || goto :error
|
||||||
echo ::endgroup::
|
echo ::endgroup::
|
||||||
echo ::group::===== KImageFormats =====
|
echo ::group::===== KImageFormats =====
|
||||||
|
2
.gitignore
vendored
2
.gitignore
vendored
@ -11,6 +11,8 @@
|
|||||||
|
|
||||||
# Generic Build Dir
|
# Generic Build Dir
|
||||||
[Bb]uild/
|
[Bb]uild/
|
||||||
|
cmake-build-*/
|
||||||
|
|
||||||
# IDE/Editor config folders
|
# IDE/Editor config folders
|
||||||
.vscode/
|
.vscode/
|
||||||
|
.idea/
|
||||||
|
@ -4,13 +4,12 @@
|
|||||||
|
|
||||||
cmake_minimum_required(VERSION 3.16)
|
cmake_minimum_required(VERSION 3.16)
|
||||||
|
|
||||||
project(pineapple-pictures VERSION 1.0.0) # don't forget to update NEWS file and AppStream metadata.
|
project(pineapple-pictures VERSION 1.1.1) # don't forget to update NEWS file and AppStream metadata.
|
||||||
|
|
||||||
include(GNUInstallDirs)
|
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)
|
||||||
@ -18,27 +17,15 @@ set (CMAKE_CXX_STANDARD_REQUIRED ON)
|
|||||||
set (CMAKE_AUTOMOC ON)
|
set (CMAKE_AUTOMOC ON)
|
||||||
set (CMAKE_AUTORCC ON)
|
set (CMAKE_AUTORCC ON)
|
||||||
|
|
||||||
if (PREFER_QT_5)
|
find_package(QT NAMES Qt6 REQUIRED COMPONENTS Core)
|
||||||
find_package(QT NAMES Qt5 REQUIRED COMPONENTS Core)
|
|
||||||
else ()
|
|
||||||
find_package(QT NAMES Qt6 REQUIRED COMPONENTS Core)
|
|
||||||
endif ()
|
|
||||||
|
|
||||||
if (${QT_VERSION_MAJOR} EQUAL "5")
|
set (QT_MINIMUM_VERSION "6.4")
|
||||||
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 LinguistTools
|
COMPONENTS Widgets Svg SvgWidgets 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
|
||||||
@ -117,32 +104,25 @@ add_executable (${EXE_NAME}
|
|||||||
${PPIC_RC_FILES}
|
${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")
|
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()
|
|
||||||
qt_add_translations(${EXE_NAME} ${ADD_TRANSLATIONS_ADDITIONAL_ARGS} TS_FILES ${PPIC_TS_FILES} QM_FILES_OUTPUT_VARIABLE PPIC_QM_FILES)
|
|
||||||
endif()
|
|
||||||
else()
|
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()
|
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)
|
target_link_libraries (${EXE_NAME} Qt${QT_VERSION_MAJOR}::Widgets Qt${QT_VERSION_MAJOR}::Svg Qt${QT_VERSION_MAJOR}::SvgWidgets)
|
||||||
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
|
# for exiv2 0.27.x and (macOS?) conan build
|
||||||
add_library(Exiv2::exiv2lib ALIAS exiv2lib)
|
add_library(Exiv2::exiv2lib ALIAS exiv2lib)
|
||||||
endif()
|
endif()
|
||||||
target_link_libraries (${EXE_NAME}
|
target_link_libraries (${EXE_NAME}
|
||||||
@ -153,7 +133,7 @@ if (exiv2_FOUND)
|
|||||||
)
|
)
|
||||||
endif ()
|
endif ()
|
||||||
|
|
||||||
if (TARGET Qt5::DBus OR TARGET Qt6::DBus)
|
if (TARGET Qt6::DBus)
|
||||||
target_link_libraries (${EXE_NAME}
|
target_link_libraries (${EXE_NAME}
|
||||||
Qt${QT_VERSION_MAJOR}::DBus
|
Qt${QT_VERSION_MAJOR}::DBus
|
||||||
)
|
)
|
||||||
|
35
NEWS
35
NEWS
@ -1,13 +1,44 @@
|
|||||||
|
Version 1.1.1
|
||||||
|
~~~~~~~~~~~~~
|
||||||
|
Released: 2025-08-02
|
||||||
|
|
||||||
|
Features:
|
||||||
|
* Click dock icon should show window when it's hidden on macOS
|
||||||
|
|
||||||
|
Bugfixes:
|
||||||
|
* Ensure "Fit by Width" position the view to the beginning of the image
|
||||||
|
|
||||||
|
Miscellaneous:
|
||||||
|
* Update translations
|
||||||
|
* Update Exiv2 version for Windows binary build
|
||||||
|
|
||||||
|
Contributors:
|
||||||
|
Heimen Stoffels, VenusGirl, தமிழ்நேரம்
|
||||||
|
|
||||||
|
Version 1.1.0
|
||||||
|
~~~~~~~~~~~~~
|
||||||
|
Released: 2025-07-06
|
||||||
|
|
||||||
|
Features:
|
||||||
|
* New option to disable built-in close window animation
|
||||||
|
* New option to disable gallery looping
|
||||||
|
* Support load m3u8 as image gallery playlist
|
||||||
|
|
||||||
|
Miscellaneous:
|
||||||
|
* Drop Qt 5 support
|
||||||
|
|
||||||
|
Contributors:
|
||||||
|
Heimen Stoffels, albanobattistella, தமிழ்நேரம்
|
||||||
|
|
||||||
Version 1.0.0
|
Version 1.0.0
|
||||||
~~~~~~~~~~~~~
|
~~~~~~~~~~~~~
|
||||||
Released: 2025-05-03
|
Released: 2025-05-03
|
||||||
|
|
||||||
Features:
|
Features:
|
||||||
* Support enforce windowed mode on start-up
|
* Support enforces 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:
|
||||||
|
@ -23,8 +23,7 @@ Pineapple Pictures is a lightweight image viewer that allows you view JPEG, PNG,
|
|||||||
|
|
||||||
### Maintained by contributors / certain distro's package maintainers
|
### Maintained by contributors / certain distro's package maintainers
|
||||||
|
|
||||||
- Debian (since bullseye) or Ubuntu (since 21.04): `sudo apt install pineapple-pictures`
|
[](https://repology.org/project/pineapple-pictures/versions)
|
||||||
- Nix / NixOS: [pineapple-pictures](https://search.nixos.org/packages?channel=unstable&show=pineapple-pictures&from=0&size=50&sort=relevance&type=packages&query=pineapple-pictures) (maintained by @wineee)
|
|
||||||
|
|
||||||
## Help Translation!
|
## Help Translation!
|
||||||
|
|
||||||
|
@ -16,7 +16,7 @@
|
|||||||
|
|
||||||
### 由原作者维护
|
### 由原作者维护
|
||||||
|
|
||||||
- [GitHub Release 页面](https://github.com/BLumia/pineapple-pictures/releases) | [gitee 发布页面](https://gitee.com/blumia/pineapple-pictures/releases)
|
- [GitHub Release 页面](https://github.com/BLumia/pineapple-pictures/releases)
|
||||||
- [SourceForge](https://sourceforge.net/projects/pineapple-pictures/)
|
- [SourceForge](https://sourceforge.net/projects/pineapple-pictures/)
|
||||||
- Archlinux AUR: [pineapple-pictures](https://aur.archlinux.org/packages/pineapple-pictures/) | [pineapple-pictures-git](https://aur.archlinux.org/packages/pineapple-pictures-git/)
|
- Archlinux AUR: [pineapple-pictures](https://aur.archlinux.org/packages/pineapple-pictures/) | [pineapple-pictures-git](https://aur.archlinux.org/packages/pineapple-pictures-git/)
|
||||||
- [Itch.io 商店](https://blumia.itch.io/pineapple-pictures)
|
- [Itch.io 商店](https://blumia.itch.io/pineapple-pictures)
|
||||||
@ -24,8 +24,7 @@
|
|||||||
|
|
||||||
### 由贡献者/对应发行版的打包人员维护
|
### 由贡献者/对应发行版的打包人员维护
|
||||||
|
|
||||||
- Debian (自 bullseye 起) 或 Ubuntu (自 21.04 起): `sudo apt install pineapple-pictures`
|
[](https://repology.org/project/pineapple-pictures/versions)
|
||||||
- Nix / NixOS: [pineapple-pictures](https://search.nixos.org/packages?channel=unstable&show=pineapple-pictures&from=0&size=50&sort=relevance&type=packages&query=pineapple-pictures) (由 [@wineee](https://github.com/wineee) 维护)
|
|
||||||
|
|
||||||
## 帮助翻译!
|
## 帮助翻译!
|
||||||
|
|
||||||
|
@ -3,7 +3,7 @@ SPDX-PackageName = "Pineapple Pictures"
|
|||||||
SPDX-PackageDownloadLocation = "https://github.com/BLumia/pineapple-pictures"
|
SPDX-PackageDownloadLocation = "https://github.com/BLumia/pineapple-pictures"
|
||||||
|
|
||||||
[[annotations]]
|
[[annotations]]
|
||||||
path = [".gitignore", "appveyor.yml", ".github/**"]
|
path = [".gitattributes", ".git-blame-ignore-revs", ".gitignore", "appveyor.yml", ".github/**"]
|
||||||
precedence = "aggregate"
|
precedence = "aggregate"
|
||||||
SPDX-FileCopyrightText = "None"
|
SPDX-FileCopyrightText = "None"
|
||||||
SPDX-License-Identifier = "CC0-1.0"
|
SPDX-License-Identifier = "CC0-1.0"
|
||||||
|
@ -14,6 +14,8 @@
|
|||||||
#include <QPushButton>
|
#include <QPushButton>
|
||||||
#include <QFile>
|
#include <QFile>
|
||||||
|
|
||||||
|
using namespace Qt::Literals::StringLiterals;
|
||||||
|
|
||||||
AboutDialog::AboutDialog(QWidget *parent)
|
AboutDialog::AboutDialog(QWidget *parent)
|
||||||
: QDialog(parent)
|
: QDialog(parent)
|
||||||
, m_tabWidget(new QTabWidget)
|
, m_tabWidget(new QTabWidget)
|
||||||
@ -27,60 +29,60 @@ AboutDialog::AboutDialog(QWidget *parent)
|
|||||||
this->setWindowTitle(tr("About"));
|
this->setWindowTitle(tr("About"));
|
||||||
|
|
||||||
const QStringList helpStr {
|
const QStringList helpStr {
|
||||||
QStringLiteral("<p>%1</p>").arg(tr("Launch application with image file path as argument to load the file.")),
|
u"<p>%1</p>"_s.arg(tr("Launch application with image file path as argument to load the file.")),
|
||||||
QStringLiteral("<p>%1</p>").arg(tr("Drag and drop image file onto the window is also supported.")),
|
u"<p>%1</p>"_s.arg(tr("Drag and drop image file onto the window is also supported.")),
|
||||||
QStringLiteral("<p>%1</p>").arg(tr("None of the operations in this application will alter the pictures on disk.")),
|
u"<p>%1</p>"_s.arg(tr("None of the operations in this application will alter the pictures on disk.")),
|
||||||
QStringLiteral("<p>%1</p>").arg(tr("Context menu option explanation:")),
|
u"<p>%1</p>"_s.arg(tr("Context menu option explanation:")),
|
||||||
QStringLiteral("<ul>"),
|
u"<ul>"_s,
|
||||||
// blumia: Chain two arg() here since it seems lupdate will remove one of them if we use
|
// blumia: Chain two arg() here since it seems lupdate will remove one of them if we use
|
||||||
// the old `arg(QCoreApp::translate(), tr())` way, but it's worth to mention
|
// the old `arg(QCoreApp::translate(), tr())` way, but it's worth to mention
|
||||||
// `arg(QCoreApp::translate(), this->tr())` works, but lupdate will complain about the usage.
|
// `arg(QCoreApp::translate(), this->tr())` works, but lupdate will complain about the usage.
|
||||||
QStringLiteral("<li><b>%1</b>:<br/>%2</li>")
|
u"<li><b>%1</b>:<br/>%2</li>"_s
|
||||||
.arg(QCoreApplication::translate("MainWindow", "Stay on top"))
|
.arg(QCoreApplication::translate("MainWindow", "Stay on top"))
|
||||||
.arg(tr("Make window stay on top of all other windows.")),
|
.arg(tr("Make window stay on top of all other windows.")),
|
||||||
QStringLiteral("<li><b>%1</b>:<br/>%2</li>")
|
u"<li><b>%1</b>:<br/>%2</li>"_s
|
||||||
.arg(QCoreApplication::translate("MainWindow", "Protected mode"))
|
.arg(QCoreApplication::translate("MainWindow", "Protected mode"))
|
||||||
.arg(tr("Avoid close window accidentally. (eg. by double clicking the window)")),
|
.arg(tr("Avoid close window accidentally. (eg. by double clicking the window)")),
|
||||||
QStringLiteral("<li><b>%1</b>:<br/>%2</li>")
|
u"<li><b>%1</b>:<br/>%2</li>"_s
|
||||||
.arg(QCoreApplication::translate("MainWindow", "Keep transformation", "The 'transformation' means the flip/rotation status that currently applied to the image view"))
|
.arg(QCoreApplication::translate("MainWindow", "Keep transformation", "The 'transformation' means the flip/rotation status that currently applied to the image view"))
|
||||||
.arg(tr("Avoid resetting the zoom/rotation/flip state that was applied to the image view when switching between images.")),
|
.arg(tr("Avoid resetting the zoom/rotation/flip state that was applied to the image view when switching between images.")),
|
||||||
QStringLiteral("</ul>")
|
u"</ul>"_s
|
||||||
};
|
};
|
||||||
|
|
||||||
const QStringList aboutStr {
|
const QStringList aboutStr {
|
||||||
QStringLiteral("<center><img width='128' height='128' src=':/icons/app-icon.svg'/><br/>"),
|
u"<center><img width='128' height='128' src=':/icons/app-icon.svg'/><br/>"_s,
|
||||||
qApp->applicationDisplayName(),
|
qApp->applicationDisplayName(),
|
||||||
(QStringLiteral("<br/>") + tr("Version: %1").arg(
|
(u"<br/>"_s + tr("Version: %1").arg(
|
||||||
#ifdef GIT_DESCRIBE_VERSION_STRING
|
#ifdef GIT_DESCRIBE_VERSION_STRING
|
||||||
GIT_DESCRIBE_VERSION_STRING
|
GIT_DESCRIBE_VERSION_STRING
|
||||||
#else
|
#else
|
||||||
qApp->applicationVersion()
|
qApp->applicationVersion()
|
||||||
#endif // GIT_DESCRIBE_VERSION_STRING
|
#endif // GIT_DESCRIBE_VERSION_STRING
|
||||||
)),
|
)),
|
||||||
QStringLiteral("<hr/>"),
|
u"<hr/>"_s,
|
||||||
tr("Copyright (c) %1 %2", "%1 is year, %2 is the name of copyright holder(s)")
|
tr("Copyright (c) %1 %2", "%1 is year, %2 is the name of copyright holder(s)")
|
||||||
.arg(QStringLiteral("2025"), QStringLiteral("<a href='https://github.com/BLumia'>@BLumia</a>")),
|
.arg(u"2025"_s, u"<a href='https://github.com/BLumia'>@BLumia</a>"_s),
|
||||||
QStringLiteral("<br/>"),
|
u"<br/>"_s,
|
||||||
tr("Logo designed by %1").arg(QStringLiteral("<a href='https://github.com/Lovelyblack'>@Lovelyblack</a>")),
|
tr("Logo designed by %1").arg(u"<a href='https://github.com/Lovelyblack'>@Lovelyblack</a>"_s),
|
||||||
QStringLiteral("<hr/>"),
|
u"<hr/>"_s,
|
||||||
tr("Built with Qt %1 (%2)").arg(QT_VERSION_STR, QSysInfo::buildCpuArchitecture()),
|
tr("Built with Qt %1 (%2)").arg(QT_VERSION_STR, QSysInfo::buildCpuArchitecture()),
|
||||||
QStringLiteral("<br/><a href='%1'>%2</a>").arg("https://github.com/BLumia/pineapple-pictures", tr("Source code")),
|
QStringLiteral("<br/><a href='%1'>%2</a>").arg("https://github.com/BLumia/pineapple-pictures", tr("Source code")),
|
||||||
QStringLiteral("</center>")
|
u"</center>"_s
|
||||||
};
|
};
|
||||||
|
|
||||||
QFile translaterHtml(":/plain/translators.html");
|
QFile translaterHtml(u":/plain/translators.html"_s);
|
||||||
bool canOpenFile = translaterHtml.open(QIODevice::ReadOnly);
|
bool canOpenFile = translaterHtml.open(QIODevice::ReadOnly);
|
||||||
const QByteArray & translatorList = canOpenFile ? translaterHtml.readAll() : QByteArrayLiteral("");
|
const QByteArray & translatorList = canOpenFile ? translaterHtml.readAll() : QByteArrayLiteral("");
|
||||||
|
|
||||||
const QStringList specialThanksStr {
|
const QStringList specialThanksStr {
|
||||||
QStringLiteral("<h1 align='center'>%1</h1><a href='%2'>%3</a><p>%4</p>").arg(
|
u"<h1 align='center'>%1</h1><a href='%2'>%3</a><p>%4</p>"_s.arg(
|
||||||
tr("Contributors"),
|
tr("Contributors"),
|
||||||
QStringLiteral("https://github.com/BLumia/pineapple-pictures/graphs/contributors"),
|
u"https://github.com/BLumia/pineapple-pictures/graphs/contributors"_s,
|
||||||
tr("List of contributors on GitHub"),
|
tr("List of contributors on GitHub"),
|
||||||
tr("Thanks to all people who contributed to this project.")
|
tr("Thanks to all people who contributed to this project.")
|
||||||
),
|
),
|
||||||
|
|
||||||
QStringLiteral("<h1 align='center'>%1</h1><p>%2</p>%3").arg(
|
u"<h1 align='center'>%1</h1><p>%2</p>%3"_s.arg(
|
||||||
tr("Translators"),
|
tr("Translators"),
|
||||||
tr("I would like to thank the following people who volunteered to translate this application."),
|
tr("I would like to thank the following people who volunteered to translate this application."),
|
||||||
translatorList
|
translatorList
|
||||||
@ -88,17 +90,17 @@ AboutDialog::AboutDialog(QWidget *parent)
|
|||||||
};
|
};
|
||||||
|
|
||||||
const QStringList licenseStr {
|
const QStringList licenseStr {
|
||||||
QStringLiteral("<h1 align='center'><b>%1</b></h1>").arg(tr("Your Rights")),
|
u"<h1 align='center'><b>%1</b></h1>"_s.arg(tr("Your Rights")),
|
||||||
QStringLiteral("<p>%1</p><p>%2</p><ul><li>%3</li><li>%4</li><li>%5</li><li>%6</li></ul>").arg(
|
u"<p>%1</p><p>%2</p><ul><li>%3</li><li>%4</li><li>%5</li><li>%6</li></ul>"_s.arg(
|
||||||
tr("%1 is released under the MIT License."), // %1
|
tr("%1 is released under the MIT License."), // %1
|
||||||
tr("This license grants people a number of freedoms:"), // %2
|
tr("This license grants people a number of freedoms:"), // %2
|
||||||
tr("You are free to use %1, for any purpose"), // %3
|
tr("You are free to use %1, for any purpose"), // %3
|
||||||
tr("You are free to distribute %1"), // %4
|
tr("You are free to distribute %1"), // %4
|
||||||
tr("You can study how %1 works and change it"), // %5
|
tr("You can study how %1 works and change it"), // %5
|
||||||
tr("You can distribute changed versions of %1") // %6
|
tr("You can distribute changed versions of %1") // %6
|
||||||
).arg(QStringLiteral("<i>%1</i>")),
|
).arg(u"<i>%1</i>"_s),
|
||||||
QStringLiteral("<p>%1</p>").arg(tr("The MIT license guarantees you this freedom. Nobody is ever permitted to take it away.")),
|
u"<p>%1</p>"_s.arg(tr("The MIT license guarantees you this freedom. Nobody is ever permitted to take it away.")),
|
||||||
QStringLiteral("<hr/><pre>%2</pre>")
|
u"<hr/><pre>%2</pre>"_s
|
||||||
};
|
};
|
||||||
|
|
||||||
const QString mitLicense(QStringLiteral(R"(Expat/MIT License
|
const QString mitLicense(QStringLiteral(R"(Expat/MIT License
|
||||||
@ -125,14 +127,14 @@ SOFTWARE.
|
|||||||
)"));
|
)"));
|
||||||
|
|
||||||
const QStringList thirdPartyLibsStr {
|
const QStringList thirdPartyLibsStr {
|
||||||
QStringLiteral("<h1 align='center'><b>%1</b></h1>").arg(tr("Third-party Libraries used by %1")),
|
u"<h1 align='center'><b>%1</b></h1>"_s.arg(tr("Third-party Libraries used by %1")),
|
||||||
tr("%1 is built on the following free software libraries:", "Free as in freedom"),
|
tr("%1 is built on the following free software libraries:", "Free as in freedom"),
|
||||||
QStringLiteral("<ul>"),
|
u"<ul>"_s,
|
||||||
#ifdef HAVE_EXIV2_VERSION
|
#ifdef HAVE_EXIV2_VERSION
|
||||||
QStringLiteral("<li><a href='%1'>%2</a>: %3</li>").arg("https://www.exiv2.org/", "Exiv2", "GPLv2"),
|
u"<li><a href='%1'>%2</a>: %3</li>"_s.arg("https://www.exiv2.org/", "Exiv2", "GPLv2"),
|
||||||
#endif // EXIV2_VERSION
|
#endif // EXIV2_VERSION
|
||||||
QStringLiteral("<li><a href='%1'>%2</a>: %3</li>").arg("https://www.qt.io/", "Qt", "GPLv2 + GPLv3 + LGPLv2.1 + LGPLv3"),
|
u"<li><a href='%1'>%2</a>: %3</li>"_s.arg("https://www.qt.io/", "Qt", "GPLv2 + GPLv3 + LGPLv2.1 + LGPLv3"),
|
||||||
QStringLiteral("</ul>")
|
u"</ul>"_s
|
||||||
};
|
};
|
||||||
|
|
||||||
m_helpTextEdit->setText(helpStr.join('\n'));
|
m_helpTextEdit->setText(helpStr.join('\n'));
|
||||||
@ -145,7 +147,7 @@ SOFTWARE.
|
|||||||
|
|
||||||
m_licenseTextEdit->setText(licenseStr.join('\n').arg(qApp->applicationDisplayName(), mitLicense));
|
m_licenseTextEdit->setText(licenseStr.join('\n').arg(qApp->applicationDisplayName(), mitLicense));
|
||||||
|
|
||||||
m_3rdPartyLibsTextEdit->setText(thirdPartyLibsStr.join('\n').arg(QStringLiteral("<i>%1</i>").arg(qApp->applicationDisplayName())));
|
m_3rdPartyLibsTextEdit->setText(thirdPartyLibsStr.join('\n').arg(u"<i>%1</i>"_s).arg(qApp->applicationDisplayName()));
|
||||||
m_3rdPartyLibsTextEdit->setOpenExternalLinks(true);
|
m_3rdPartyLibsTextEdit->setOpenExternalLinks(true);
|
||||||
|
|
||||||
m_tabWidget->addTab(m_helpTextEdit, tr("&Help"));
|
m_tabWidget->addTab(m_helpTextEdit, tr("&Help"));
|
||||||
|
@ -16,16 +16,6 @@
|
|||||||
#define ACTION_NAME(s) QStringLiteral(STRIFY(s))
|
#define ACTION_NAME(s) QStringLiteral(STRIFY(s))
|
||||||
#define STRIFY(s) #s
|
#define STRIFY(s) #s
|
||||||
|
|
||||||
ActionManager::ActionManager()
|
|
||||||
{
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
ActionManager::~ActionManager()
|
|
||||||
{
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
QIcon ActionManager::loadHidpiIcon(const QString &resp, QSize sz)
|
QIcon ActionManager::loadHidpiIcon(const QString &resp, QSize sz)
|
||||||
{
|
{
|
||||||
QSvgRenderer r(resp);
|
QSvgRenderer r(resp);
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
// SPDX-FileCopyrightText: 2022 Gary Wang <wzc782970009@gmail.com>
|
// SPDX-FileCopyrightText: 2025 Gary Wang <git@blumia.net>
|
||||||
//
|
//
|
||||||
// SPDX-License-Identifier: MIT
|
// SPDX-License-Identifier: MIT
|
||||||
|
|
||||||
@ -12,8 +12,8 @@ class MainWindow;
|
|||||||
class ActionManager
|
class ActionManager
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
ActionManager();
|
explicit ActionManager() = default;
|
||||||
~ActionManager();
|
~ActionManager() = default;
|
||||||
|
|
||||||
void setupAction(MainWindow * mainWindow);
|
void setupAction(MainWindow * mainWindow);
|
||||||
void retranslateUi(MainWindow *MainWindow);
|
void retranslateUi(MainWindow *MainWindow);
|
||||||
|
@ -6,8 +6,6 @@
|
|||||||
|
|
||||||
#include "opacityhelper.h"
|
#include "opacityhelper.h"
|
||||||
|
|
||||||
#include <functional>
|
|
||||||
|
|
||||||
#include <QToolButton>
|
#include <QToolButton>
|
||||||
#include <QVBoxLayout>
|
#include <QVBoxLayout>
|
||||||
#include <QDebug>
|
#include <QDebug>
|
||||||
|
@ -17,14 +17,7 @@ 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);
|
||||||
@ -97,11 +90,7 @@ 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;
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
// SPDX-FileCopyrightText: 2022 Gary Wang <wzc782970009@gmail.com>
|
// SPDX-FileCopyrightText: 2025 Gary Wang <git@blumia.net>
|
||||||
//
|
//
|
||||||
// SPDX-License-Identifier: MIT
|
// SPDX-License-Identifier: MIT
|
||||||
|
|
||||||
@ -41,9 +41,7 @@ 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.
|
||||||
@ -126,6 +124,7 @@ void GraphicsView::resetTransform()
|
|||||||
void GraphicsView::zoomView(qreal scaleFactor)
|
void GraphicsView::zoomView(qreal scaleFactor)
|
||||||
{
|
{
|
||||||
m_enableFitInView = false;
|
m_enableFitInView = false;
|
||||||
|
m_longImageMode = false;
|
||||||
scale(scaleFactor, scaleFactor);
|
scale(scaleFactor, scaleFactor);
|
||||||
applyTransformationModeByScaleFactor();
|
applyTransformationModeByScaleFactor();
|
||||||
emit navigatorViewRequired(!isThingSmallerThanWindowWith(transform()), transform());
|
emit navigatorViewRequired(!isThingSmallerThanWindowWith(transform()), transform());
|
||||||
@ -142,6 +141,10 @@ void GraphicsView::rotateView(bool clockwise)
|
|||||||
0, 0, 1);
|
0, 0, 1);
|
||||||
tf = transform() * tf;
|
tf = transform() * tf;
|
||||||
setTransform(tf);
|
setTransform(tf);
|
||||||
|
|
||||||
|
// Apply transformation mode but don't emit navigator signal here
|
||||||
|
// Let displayScene() handle the navigator visibility correctly
|
||||||
|
applyTransformationModeByScaleFactor();
|
||||||
}
|
}
|
||||||
|
|
||||||
void GraphicsView::flipView(bool horizontal)
|
void GraphicsView::flipView(bool horizontal)
|
||||||
@ -173,27 +176,128 @@ void GraphicsView::fitByOrientation(Qt::Orientation ori, bool scaleDownOnly)
|
|||||||
{
|
{
|
||||||
resetScale();
|
resetScale();
|
||||||
|
|
||||||
QRectF viewRect = this->viewport()->rect().adjusted(2, 2, -2, -2);
|
QRectF viewRect = this->viewport()->rect();
|
||||||
QRectF imageRect = transform().mapRect(sceneRect());
|
QRectF imageRect = transform().mapRect(sceneRect());
|
||||||
|
QSize viewSize = viewRect.size().toSize();
|
||||||
|
|
||||||
qreal ratio;
|
qreal ratio;
|
||||||
|
|
||||||
if (ori == Qt::Horizontal) {
|
if (ori == Qt::Horizontal) {
|
||||||
ratio = viewRect.width() / imageRect.width();
|
// Horizontal fit means fit by width
|
||||||
|
if (scaleDownOnly && imageRect.width() <= viewSize.width()) {
|
||||||
|
// Image width already fits, no scaling needed
|
||||||
|
ratio = 1;
|
||||||
|
} else {
|
||||||
|
ratio = viewRect.width() / imageRect.width();
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
ratio = viewRect.height() / imageRect.height();
|
// Vertical fit means fit by height
|
||||||
|
if (scaleDownOnly && imageRect.height() <= viewSize.height()) {
|
||||||
|
// Image height already fits, no scaling needed
|
||||||
|
ratio = 1;
|
||||||
|
} else {
|
||||||
|
ratio = viewRect.height() / imageRect.height();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (scaleDownOnly && ratio > 1) ratio = 1;
|
if (ratio != 1) {
|
||||||
|
scale(ratio, ratio);
|
||||||
|
}
|
||||||
|
|
||||||
|
// Position the image correctly based on orientation with rotation consideration
|
||||||
|
QRectF originalScene = sceneRect();
|
||||||
|
QTransform currentTransform = transform();
|
||||||
|
|
||||||
|
if (ori == Qt::Horizontal) {
|
||||||
|
// For horizontal fit (fit by width), position at top (for tall images)
|
||||||
|
// Find the scene point that corresponds to the top-center of the transformed image
|
||||||
|
QPointF sceneTopCenter;
|
||||||
|
|
||||||
|
if (qFuzzyIsNull(currentTransform.m12()) && qFuzzyIsNull(currentTransform.m21())) {
|
||||||
|
// 0° or 180° rotation
|
||||||
|
if (currentTransform.m11() > 0 && currentTransform.m22() > 0) {
|
||||||
|
// 0° rotation: use original top-center
|
||||||
|
sceneTopCenter = QPointF(originalScene.center().x(), originalScene.top());
|
||||||
|
} else {
|
||||||
|
// 180° rotation: the visual "top" is now at the scene bottom
|
||||||
|
sceneTopCenter = QPointF(originalScene.center().x(), originalScene.bottom());
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
// 90/270 degree rotation: the "top" in view corresponds to left/right in scene
|
||||||
|
if (currentTransform.m12() > 0) {
|
||||||
|
// 90 degree: top in view = left in scene
|
||||||
|
sceneTopCenter = QPointF(originalScene.left(), originalScene.center().y());
|
||||||
|
} else {
|
||||||
|
// 270 degree: top in view = right in scene
|
||||||
|
sceneTopCenter = QPointF(originalScene.right(), originalScene.center().y());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
centerOn(sceneTopCenter);
|
||||||
|
} else {
|
||||||
|
// For vertical fit (fit by height), position at left (for wide images)
|
||||||
|
// Find the scene point that corresponds to the left-center of the transformed image
|
||||||
|
QPointF sceneLeftCenter;
|
||||||
|
|
||||||
|
if (qFuzzyIsNull(currentTransform.m12()) && qFuzzyIsNull(currentTransform.m21())) {
|
||||||
|
// 0° or 180° rotation
|
||||||
|
if (currentTransform.m11() > 0 && currentTransform.m22() > 0) {
|
||||||
|
// 0° rotation: use original left-center
|
||||||
|
sceneLeftCenter = QPointF(originalScene.left(), originalScene.center().y());
|
||||||
|
} else {
|
||||||
|
// 180° rotation: the visual "left" is now at the scene right
|
||||||
|
sceneLeftCenter = QPointF(originalScene.right(), originalScene.center().y());
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
// 90/270 degree rotation: the "left" in view corresponds to top/bottom in scene
|
||||||
|
if (currentTransform.m21() > 0) {
|
||||||
|
// 90 degree: left in view = top in scene
|
||||||
|
sceneLeftCenter = QPointF(originalScene.center().x(), originalScene.top());
|
||||||
|
} else {
|
||||||
|
// 270 degree: left in view = bottom in scene
|
||||||
|
sceneLeftCenter = QPointF(originalScene.center().x(), originalScene.bottom());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
centerOn(sceneLeftCenter);
|
||||||
|
}
|
||||||
|
|
||||||
scale(ratio, ratio);
|
|
||||||
centerOn(imageRect.top(), 0);
|
|
||||||
m_enableFitInView = false;
|
m_enableFitInView = false;
|
||||||
|
|
||||||
applyTransformationModeByScaleFactor();
|
applyTransformationModeByScaleFactor();
|
||||||
emit navigatorViewRequired(!isThingSmallerThanWindowWith(transform()), transform());
|
emit navigatorViewRequired(!isThingSmallerThanWindowWith(transform()), transform());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool GraphicsView::isLongImage() const
|
||||||
|
{
|
||||||
|
// Get the transformed image size (considering rotation and other transforms)
|
||||||
|
QRectF transformedRect = transform().mapRect(sceneRect());
|
||||||
|
QSizeF imageSize = transformedRect.size();
|
||||||
|
|
||||||
|
if (imageSize.isEmpty()) return false;
|
||||||
|
|
||||||
|
qreal aspectRatio = imageSize.width() / imageSize.height();
|
||||||
|
|
||||||
|
// Check if aspect ratio exceeds 5:2 (wide) or 2:5 (tall)
|
||||||
|
return aspectRatio > 2.5 || aspectRatio < 0.4;
|
||||||
|
}
|
||||||
|
|
||||||
|
void GraphicsView::fitLongImage()
|
||||||
|
{
|
||||||
|
// Determine image orientation based on current transform
|
||||||
|
QRectF transformedRect = transform().mapRect(sceneRect());
|
||||||
|
qreal aspectRatio = transformedRect.width() / transformedRect.height();
|
||||||
|
bool isTallImage = aspectRatio < 0.4;
|
||||||
|
bool isWideImage = aspectRatio > 2.5;
|
||||||
|
|
||||||
|
// Use fitByOrientation with the migrated logic
|
||||||
|
if (isTallImage) {
|
||||||
|
// Tall image (height >> width): fit by width
|
||||||
|
fitByOrientation(Qt::Horizontal, true); // scaleDownOnly = true
|
||||||
|
} else if (isWideImage) {
|
||||||
|
// Wide image (width >> height): fit by height
|
||||||
|
fitByOrientation(Qt::Vertical, true); // scaleDownOnly = true
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
void GraphicsView::displayScene()
|
void GraphicsView::displayScene()
|
||||||
{
|
{
|
||||||
if (shouldAvoidTransform()) {
|
if (shouldAvoidTransform()) {
|
||||||
@ -201,10 +305,25 @@ void GraphicsView::displayScene()
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (isSceneBiggerThanView()) {
|
// Check if should apply long image mode
|
||||||
fitInView(sceneRect(), Qt::KeepAspectRatio);
|
if (Settings::instance()->autoLongImageMode() && isLongImage()) {
|
||||||
|
m_longImageMode = true;
|
||||||
|
m_firstUserMediaLoaded = true;
|
||||||
|
if (isSceneBiggerThanView()) fitLongImage();
|
||||||
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (isSceneBiggerThanView()) {
|
||||||
|
// Do fit-in-view
|
||||||
|
fitInView(sceneRect(), Qt::KeepAspectRatio);
|
||||||
|
// After fitInView, the image should fit the window, so hide navigator
|
||||||
|
emit navigatorViewRequired(false, transform());
|
||||||
|
} else {
|
||||||
|
// Image is already smaller than window, no navigator needed
|
||||||
|
emit navigatorViewRequired(false, transform());
|
||||||
|
}
|
||||||
|
|
||||||
|
m_longImageMode = false;
|
||||||
m_enableFitInView = true;
|
m_enableFitInView = true;
|
||||||
m_firstUserMediaLoaded = true;
|
m_firstUserMediaLoaded = true;
|
||||||
}
|
}
|
||||||
@ -224,6 +343,11 @@ void GraphicsView::setEnableAutoFitInView(bool enable)
|
|||||||
m_enableFitInView = enable;
|
m_enableFitInView = enable;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void GraphicsView::setLongImageMode(bool enable)
|
||||||
|
{
|
||||||
|
m_longImageMode = enable;
|
||||||
|
}
|
||||||
|
|
||||||
bool GraphicsView::avoidResetTransform() const
|
bool GraphicsView::avoidResetTransform() const
|
||||||
{
|
{
|
||||||
return m_avoidResetTransform;
|
return m_avoidResetTransform;
|
||||||
@ -296,7 +420,12 @@ void GraphicsView::wheelEvent(QWheelEvent *event)
|
|||||||
|
|
||||||
void GraphicsView::resizeEvent(QResizeEvent *event)
|
void GraphicsView::resizeEvent(QResizeEvent *event)
|
||||||
{
|
{
|
||||||
if (m_enableFitInView) {
|
if (m_longImageMode) {
|
||||||
|
// In long image mode, reapply long image logic on resize
|
||||||
|
// We directly apply the long image mode logic without rechecking
|
||||||
|
// if we should enter long image mode, as the mode is already active
|
||||||
|
fitLongImage();
|
||||||
|
} else if (m_enableFitInView) {
|
||||||
bool originalSizeSmallerThanWindow = isThingSmallerThanWindowWith(resetScale(transform()));
|
bool originalSizeSmallerThanWindow = isThingSmallerThanWindowWith(resetScale(transform()));
|
||||||
if (originalSizeSmallerThanWindow && scaleFactor() >= 1) {
|
if (originalSizeSmallerThanWindow && scaleFactor() >= 1) {
|
||||||
// no longer need to do fitInView()
|
// no longer need to do fitInView()
|
||||||
|
@ -39,12 +39,17 @@ public:
|
|||||||
void displayScene();
|
void displayScene();
|
||||||
bool isSceneBiggerThanView() const;
|
bool isSceneBiggerThanView() const;
|
||||||
void setEnableAutoFitInView(bool enable = true);
|
void setEnableAutoFitInView(bool enable = true);
|
||||||
|
void setLongImageMode(bool enable = true);
|
||||||
|
|
||||||
bool avoidResetTransform() const;
|
bool avoidResetTransform() const;
|
||||||
void setAvoidResetTransform(bool avoidReset);
|
void setAvoidResetTransform(bool avoidReset);
|
||||||
|
|
||||||
static QTransform resetScale(const QTransform & orig);
|
static QTransform resetScale(const QTransform & orig);
|
||||||
|
|
||||||
|
// Long image mode support
|
||||||
|
bool isLongImage() const;
|
||||||
|
void fitLongImage();
|
||||||
|
|
||||||
signals:
|
signals:
|
||||||
void navigatorViewRequired(bool required, QTransform transform);
|
void navigatorViewRequired(bool required, QTransform transform);
|
||||||
void viewportRectChanged();
|
void viewportRectChanged();
|
||||||
@ -70,6 +75,7 @@ private:
|
|||||||
// ... or even more? e.g. "fit/snap width" things...
|
// ... or even more? e.g. "fit/snap width" things...
|
||||||
// Currently it's "no fit" when it's false and "fit when view is smaller" when it's true.
|
// Currently it's "no fit" when it's false and "fit when view is smaller" when it's true.
|
||||||
bool m_enableFitInView = false;
|
bool m_enableFitInView = false;
|
||||||
|
bool m_longImageMode = false;
|
||||||
bool m_avoidResetTransform = false;
|
bool m_avoidResetTransform = false;
|
||||||
bool m_checkerboardEnabled = false;
|
bool m_checkerboardEnabled = false;
|
||||||
bool m_useLightCheckerboard = false;
|
bool m_useLightCheckerboard = false;
|
||||||
|
25
app/main.cpp
25
app/main.cpp
@ -17,33 +17,32 @@
|
|||||||
#include <QTranslator>
|
#include <QTranslator>
|
||||||
#include <QUrl>
|
#include <QUrl>
|
||||||
|
|
||||||
|
using namespace Qt::Literals::StringLiterals;
|
||||||
|
|
||||||
int main(int argc, char *argv[])
|
int main(int argc, char *argv[])
|
||||||
{
|
{
|
||||||
QCoreApplication::setApplicationName("Pineapple Pictures");
|
QCoreApplication::setApplicationName(u"Pineapple Pictures"_s);
|
||||||
QCoreApplication::setApplicationVersion(PPIC_VERSION_STRING);
|
QCoreApplication::setApplicationVersion(PPIC_VERSION_STRING);
|
||||||
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)
|
||||||
const QString qmDir = QLatin1String(":/i18n/");
|
const QString qmDir = u":/i18n/"_s;
|
||||||
#elif defined(QM_FILE_INSTALL_ABSOLUTE_DIR)
|
#elif defined(QM_FILE_INSTALL_ABSOLUTE_DIR)
|
||||||
const QString qmDir = QT_STRINGIFY(QM_FILE_INSTALL_ABSOLUTE_DIR);
|
const QString qmDir = QT_STRINGIFY(QM_FILE_INSTALL_ABSOLUTE_DIR);
|
||||||
#else
|
#else
|
||||||
const QString qmDir = QDir(QCoreApplication::applicationDirPath()).absoluteFilePath("translations");
|
const QString qmDir = QDir(QCoreApplication::applicationDirPath()).absoluteFilePath("translations");
|
||||||
#endif
|
#endif
|
||||||
if (translator.load(QLocale(), QLatin1String("PineapplePictures"), QLatin1String("_"), qmDir)) {
|
if (translator.load(QLocale(), u"PineapplePictures"_s, u"_"_s, qmDir)) {
|
||||||
QCoreApplication::installTranslator(&translator);
|
QCoreApplication::installTranslator(&translator);
|
||||||
}
|
}
|
||||||
|
|
||||||
QGuiApplication::setApplicationDisplayName(QCoreApplication::translate("main", "Pineapple Pictures"));
|
QGuiApplication::setApplicationDisplayName(QCoreApplication::translate("main", "Pineapple Pictures"));
|
||||||
|
|
||||||
// commandline options
|
// commandline options
|
||||||
QCommandLineOption supportedImageFormats(QStringLiteral("supported-image-formats"), QCoreApplication::translate("main", "List supported image format suffixes, and quit program."));
|
QCommandLineOption supportedImageFormats(u"supported-image-formats"_s, QCoreApplication::translate("main", "List supported image format suffixes, and quit program."));
|
||||||
// parse commandline arguments
|
// parse commandline arguments
|
||||||
QCommandLineParser parser;
|
QCommandLineParser parser;
|
||||||
parser.addOption(supportedImageFormats);
|
parser.addOption(supportedImageFormats);
|
||||||
@ -77,6 +76,18 @@ int main(int argc, char *argv[])
|
|||||||
w.showUrls({url});
|
w.showUrls({url});
|
||||||
w.initWindowSize();
|
w.initWindowSize();
|
||||||
});
|
});
|
||||||
|
|
||||||
|
// Handle dock icon clicks to show hidden window
|
||||||
|
a.connect(&a, &QApplication::applicationStateChanged, [&w](Qt::ApplicationState state) {
|
||||||
|
if (state == Qt::ApplicationActive && w.isHidden()) {
|
||||||
|
w.showUrls({});
|
||||||
|
w.galleryCurrent(true, true);
|
||||||
|
w.setWindowOpacity(1);
|
||||||
|
w.showNormal();
|
||||||
|
w.raise();
|
||||||
|
w.activateWindow();
|
||||||
|
}
|
||||||
|
});
|
||||||
#endif // Q_OS_MACOS
|
#endif // Q_OS_MACOS
|
||||||
|
|
||||||
QStringList urlStrList = parser.positionalArguments();
|
QStringList urlStrList = parser.positionalArguments();
|
||||||
|
@ -44,6 +44,8 @@
|
|||||||
#include <QDBusConnectionInterface>
|
#include <QDBusConnectionInterface>
|
||||||
#endif // HAVE_QTDBUS
|
#endif // HAVE_QTDBUS
|
||||||
|
|
||||||
|
using namespace Qt::Literals::StringLiterals;
|
||||||
|
|
||||||
MainWindow::MainWindow(QWidget *parent)
|
MainWindow::MainWindow(QWidget *parent)
|
||||||
: FramelessWindow(parent)
|
: FramelessWindow(parent)
|
||||||
, m_am(new ActionManager)
|
, m_am(new ActionManager)
|
||||||
@ -56,28 +58,24 @@ MainWindow::MainWindow(QWidget *parent)
|
|||||||
|
|
||||||
this->setAttribute(Qt::WA_TranslucentBackground, true);
|
this->setAttribute(Qt::WA_TranslucentBackground, true);
|
||||||
this->setMinimumSize(350, 330);
|
this->setMinimumSize(350, 330);
|
||||||
this->setWindowIcon(QIcon(":/icons/app-icon.svg"));
|
this->setWindowIcon(QIcon(u":/icons/app-icon.svg"_s));
|
||||||
this->setMouseTracking(true);
|
this->setMouseTracking(true);
|
||||||
this->setAcceptDrops(true);
|
this->setAcceptDrops(true);
|
||||||
|
|
||||||
m_pm->setAutoLoadFilterSuffixes(supportedImageFormats());
|
m_pm->setAutoLoadFilterSuffixes(supportedImageFormats());
|
||||||
|
|
||||||
m_fadeOutAnimation = new QPropertyAnimation(this, "windowOpacity");
|
m_fadeOutAnimation = new QPropertyAnimation(this, "windowOpacity"_ba);
|
||||||
m_fadeOutAnimation->setDuration(300);
|
m_fadeOutAnimation->setDuration(300);
|
||||||
m_fadeOutAnimation->setStartValue(1);
|
m_fadeOutAnimation->setStartValue(1);
|
||||||
m_fadeOutAnimation->setEndValue(0);
|
m_fadeOutAnimation->setEndValue(0);
|
||||||
m_floatUpAnimation = new QPropertyAnimation(this, "geometry");
|
m_floatUpAnimation = new QPropertyAnimation(this, "geometry"_ba);
|
||||||
m_floatUpAnimation->setDuration(300);
|
m_floatUpAnimation->setDuration(300);
|
||||||
m_floatUpAnimation->setEasingCurve(QEasingCurve::OutCirc);
|
m_floatUpAnimation->setEasingCurve(QEasingCurve::OutCirc);
|
||||||
m_exitAnimationGroup = new QParallelAnimationGroup(this);
|
m_exitAnimationGroup = new QParallelAnimationGroup(this);
|
||||||
m_exitAnimationGroup->addAnimation(m_fadeOutAnimation);
|
m_exitAnimationGroup->addAnimation(m_fadeOutAnimation);
|
||||||
m_exitAnimationGroup->addAnimation(m_floatUpAnimation);
|
m_exitAnimationGroup->addAnimation(m_floatUpAnimation);
|
||||||
connect(m_exitAnimationGroup, &QParallelAnimationGroup::finished,
|
connect(m_exitAnimationGroup, &QParallelAnimationGroup::finished,
|
||||||
#ifdef Q_OS_MAC
|
this, &MainWindow::doCloseWindow);
|
||||||
this, &QWidget::hide);
|
|
||||||
#else
|
|
||||||
this, &QWidget::close);
|
|
||||||
#endif
|
|
||||||
|
|
||||||
GraphicsScene * scene = new GraphicsScene(this);
|
GraphicsScene * scene = new GraphicsScene(this);
|
||||||
|
|
||||||
@ -92,7 +90,7 @@ MainWindow::MainWindow(QWidget *parent)
|
|||||||
m_gv->fitInView(m_gv->sceneRect(), Qt::KeepAspectRatio);
|
m_gv->fitInView(m_gv->sceneRect(), Qt::KeepAspectRatio);
|
||||||
|
|
||||||
connect(m_graphicsView, &GraphicsView::navigatorViewRequired,
|
connect(m_graphicsView, &GraphicsView::navigatorViewRequired,
|
||||||
this, [ = ](bool required, const QTransform & tf){
|
this, [this](bool required, const QTransform & tf){
|
||||||
m_gv->setTransform(GraphicsView::resetScale(tf));
|
m_gv->setTransform(GraphicsView::resetScale(tf));
|
||||||
m_gv->fitInView(m_gv->sceneRect(), Qt::KeepAspectRatio);
|
m_gv->fitInView(m_gv->sceneRect(), Qt::KeepAspectRatio);
|
||||||
m_gv->setVisible(required);
|
m_gv->setVisible(required);
|
||||||
@ -141,10 +139,7 @@ MainWindow::MainWindow(QWidget *parent)
|
|||||||
m_gv->setOpacity(0, false);
|
m_gv->setOpacity(0, false);
|
||||||
m_closeButton->setOpacity(0, false);
|
m_closeButton->setOpacity(0, false);
|
||||||
|
|
||||||
connect(m_pm, &PlaylistManager::totalCountChanged, this, [this](int galleryFileCount) {
|
connect(m_pm, &PlaylistManager::totalCountChanged, this, &MainWindow::updateGalleryButtonsVisibility);
|
||||||
m_prevButton->setVisible(galleryFileCount > 1);
|
|
||||||
m_nextButton->setVisible(galleryFileCount > 1);
|
|
||||||
});
|
|
||||||
|
|
||||||
connect(m_pm->model(), &PlaylistModel::modelReset, this, std::bind(&MainWindow::galleryCurrent, this, false, false));
|
connect(m_pm->model(), &PlaylistModel::modelReset, this, std::bind(&MainWindow::galleryCurrent, this, false, false));
|
||||||
connect(m_pm, &PlaylistManager::currentIndexChanged, this, std::bind(&MainWindow::galleryCurrent, this, true, false));
|
connect(m_pm, &PlaylistManager::currentIndexChanged, this, std::bind(&MainWindow::galleryCurrent, this, true, false));
|
||||||
@ -180,10 +175,20 @@ MainWindow::~MainWindow()
|
|||||||
void MainWindow::showUrls(const QList<QUrl> &urls)
|
void MainWindow::showUrls(const QList<QUrl> &urls)
|
||||||
{
|
{
|
||||||
if (!urls.isEmpty()) {
|
if (!urls.isEmpty()) {
|
||||||
m_graphicsView->showFileFromPath(urls.first().toLocalFile());
|
const QUrl & firstUrl = urls.first();
|
||||||
|
if (urls.count() == 1) {
|
||||||
|
const QString lowerCaseUrlPath(firstUrl.path().toLower());
|
||||||
|
if (lowerCaseUrlPath.endsWith(".m3u8") || lowerCaseUrlPath.endsWith(".m3u")) {
|
||||||
|
m_pm->loadM3U8Playlist(firstUrl);
|
||||||
|
galleryCurrent(true, true);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
m_graphicsView->showFileFromPath(firstUrl.toLocalFile());
|
||||||
m_pm->loadPlaylist(urls);
|
m_pm->loadPlaylist(urls);
|
||||||
} else {
|
} else {
|
||||||
m_graphicsView->showText(tr("File url list is empty"));
|
m_graphicsView->showText(tr("File url list is empty"));
|
||||||
|
m_pm->setPlaylist(urls);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -217,7 +222,7 @@ void MainWindow::adjustWindowSizeBySceneRect()
|
|||||||
|
|
||||||
if (m_graphicsView->scaleFactor() < 1 || size().expandedTo(sceneSizeWithMargins) != size()) {
|
if (m_graphicsView->scaleFactor() < 1 || size().expandedTo(sceneSizeWithMargins) != size()) {
|
||||||
// if it scaled down by the resize policy:
|
// if it scaled down by the resize policy:
|
||||||
QSize screenSize = qApp->screenAt(QCursor::pos())->availableSize();
|
QSize screenSize = window()->screen()->availableSize();
|
||||||
if (screenSize.expandedTo(sceneSize) == screenSize) {
|
if (screenSize.expandedTo(sceneSize) == screenSize) {
|
||||||
// we can show the picture by increase the window size.
|
// we can show the picture by increase the window size.
|
||||||
QSize finalSize = (screenSize.expandedTo(sceneSizeWithMargins) == screenSize) ?
|
QSize finalSize = (screenSize.expandedTo(sceneSizeWithMargins) == screenSize) ?
|
||||||
@ -251,6 +256,9 @@ void MainWindow::clearGallery()
|
|||||||
|
|
||||||
void MainWindow::galleryPrev()
|
void MainWindow::galleryPrev()
|
||||||
{
|
{
|
||||||
|
const bool loopGallery = Settings::instance()->loopGallery();
|
||||||
|
if (!loopGallery && m_pm->isFirstIndex()) return;
|
||||||
|
|
||||||
QModelIndex index = m_pm->previousIndex();
|
QModelIndex index = m_pm->previousIndex();
|
||||||
if (index.isValid()) {
|
if (index.isValid()) {
|
||||||
m_pm->setCurrentIndex(index);
|
m_pm->setCurrentIndex(index);
|
||||||
@ -260,6 +268,9 @@ void MainWindow::galleryPrev()
|
|||||||
|
|
||||||
void MainWindow::galleryNext()
|
void MainWindow::galleryNext()
|
||||||
{
|
{
|
||||||
|
const bool loopGallery = Settings::instance()->loopGallery();
|
||||||
|
if (!loopGallery && m_pm->isLastIndex()) return;
|
||||||
|
|
||||||
QModelIndex index = m_pm->nextIndex();
|
QModelIndex index = m_pm->nextIndex();
|
||||||
if (index.isValid()) {
|
if (index.isValid()) {
|
||||||
m_pm->setCurrentIndex(index);
|
m_pm->setCurrentIndex(index);
|
||||||
@ -281,6 +292,8 @@ void MainWindow::galleryCurrent(bool showLoadImageHintWhenEmpty, bool reloadImag
|
|||||||
m_graphicsView->showText(QCoreApplication::translate("GraphicsScene", "Drag image here"));
|
m_graphicsView->showText(QCoreApplication::translate("GraphicsScene", "Drag image here"));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
updateGalleryButtonsVisibility();
|
||||||
|
|
||||||
if (shouldResetfileWatcher) updateFileWatcher();
|
if (shouldResetfileWatcher) updateFileWatcher();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -304,7 +317,7 @@ void MainWindow::showEvent(QShowEvent *event)
|
|||||||
return FramelessWindow::showEvent(event);
|
return FramelessWindow::showEvent(event);
|
||||||
}
|
}
|
||||||
|
|
||||||
void MainWindow::enterEvent(QT_ENTER_EVENT *event)
|
void MainWindow::enterEvent(QEnterEvent *event)
|
||||||
{
|
{
|
||||||
m_bottomButtonGroup->setOpacity(1);
|
m_bottomButtonGroup->setOpacity(1);
|
||||||
m_gv->setOpacity(1);
|
m_gv->setOpacity(1);
|
||||||
@ -345,11 +358,7 @@ 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();
|
||||||
}
|
}
|
||||||
@ -451,13 +460,11 @@ void MainWindow::contextMenuEvent(QContextMenuEvent *event)
|
|||||||
QMenu * menu = new QMenu;
|
QMenu * menu = new QMenu;
|
||||||
QMenu * copyMenu = new QMenu(tr("&Copy"));
|
QMenu * copyMenu = new QMenu(tr("&Copy"));
|
||||||
QUrl currentFileUrl = currentImageFileUrl();
|
QUrl currentFileUrl = currentImageFileUrl();
|
||||||
QImage clipboardImage;
|
|
||||||
QUrl clipboardFileUrl;
|
|
||||||
|
|
||||||
QAction * copyPixmap = m_am->actionCopyPixmap;
|
QAction * copyPixmap = m_am->actionCopyPixmap;
|
||||||
QAction * copyFilePath = m_am->actionCopyFilePath;
|
QAction * copyFilePath = m_am->actionCopyFilePath;
|
||||||
|
|
||||||
copyMenu->setIcon(QIcon::fromTheme(QLatin1String("edit-copy")));
|
copyMenu->setIcon(QIcon::fromTheme(u"edit-copy"_s));
|
||||||
copyMenu->addAction(copyPixmap);
|
copyMenu->addAction(copyPixmap);
|
||||||
if (currentFileUrl.isValid()) {
|
if (currentFileUrl.isValid()) {
|
||||||
copyMenu->addAction(copyFilePath);
|
copyMenu->addAction(copyFilePath);
|
||||||
@ -577,19 +584,23 @@ void MainWindow::centerWindow()
|
|||||||
Qt::LeftToRight,
|
Qt::LeftToRight,
|
||||||
Qt::AlignCenter,
|
Qt::AlignCenter,
|
||||||
this->size(),
|
this->size(),
|
||||||
qApp->screenAt(QCursor::pos())->availableGeometry()
|
window()->screen()->availableGeometry()
|
||||||
)
|
)
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
void MainWindow::closeWindow()
|
void MainWindow::closeWindow()
|
||||||
{
|
{
|
||||||
QRect windowRect(this->geometry());
|
if (Settings::instance()->useBuiltInCloseAnimation()) {
|
||||||
m_floatUpAnimation->setStartValue(windowRect);
|
QRect windowRect(this->geometry());
|
||||||
m_floatUpAnimation->setEndValue(windowRect.adjusted(0, -80, 0, 0));
|
m_floatUpAnimation->setStartValue(windowRect);
|
||||||
m_floatUpAnimation->setStartValue(QRect(this->geometry().x(), this->geometry().y(), this->geometry().width(), this->geometry().height()));
|
m_floatUpAnimation->setEndValue(windowRect.adjusted(0, -80, 0, 0));
|
||||||
m_floatUpAnimation->setEndValue(QRect(this->geometry().x(), this->geometry().y()-80, this->geometry().width(), this->geometry().height()));
|
m_floatUpAnimation->setStartValue(QRect(this->geometry().x(), this->geometry().y(), this->geometry().width(), this->geometry().height()));
|
||||||
m_exitAnimationGroup->start();
|
m_floatUpAnimation->setEndValue(QRect(this->geometry().x(), this->geometry().y()-80, this->geometry().width(), this->geometry().height()));
|
||||||
|
m_exitAnimationGroup->start();
|
||||||
|
} else {
|
||||||
|
doCloseWindow();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void MainWindow::updateWidgetsPosition()
|
void MainWindow::updateWidgetsPosition()
|
||||||
@ -607,8 +618,7 @@ void MainWindow::toggleProtectedMode()
|
|||||||
{
|
{
|
||||||
m_protectedMode = !m_protectedMode;
|
m_protectedMode = !m_protectedMode;
|
||||||
m_closeButton->setVisible(!m_protectedMode);
|
m_closeButton->setVisible(!m_protectedMode);
|
||||||
m_prevButton->setVisible(!m_protectedMode);
|
updateGalleryButtonsVisibility();
|
||||||
m_nextButton->setVisible(!m_protectedMode);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void MainWindow::toggleStayOnTop()
|
void MainWindow::toggleStayOnTop()
|
||||||
@ -690,6 +700,7 @@ void MainWindow::on_actionActualSize_triggered()
|
|||||||
{
|
{
|
||||||
m_graphicsView->resetScale();
|
m_graphicsView->resetScale();
|
||||||
m_graphicsView->setEnableAutoFitInView(false);
|
m_graphicsView->setEnableAutoFitInView(false);
|
||||||
|
m_graphicsView->setLongImageMode(false);
|
||||||
}
|
}
|
||||||
|
|
||||||
void MainWindow::on_actionToggleMaximize_triggered()
|
void MainWindow::on_actionToggleMaximize_triggered()
|
||||||
@ -718,6 +729,7 @@ void MainWindow::on_actionFitInView_triggered()
|
|||||||
{
|
{
|
||||||
m_graphicsView->fitInView(m_gv->sceneRect(), Qt::KeepAspectRatio);
|
m_graphicsView->fitInView(m_gv->sceneRect(), Qt::KeepAspectRatio);
|
||||||
m_graphicsView->setEnableAutoFitInView(m_graphicsView->scaleFactor() <= 1);
|
m_graphicsView->setEnableAutoFitInView(m_graphicsView->scaleFactor() <= 1);
|
||||||
|
m_graphicsView->setLongImageMode(false);
|
||||||
}
|
}
|
||||||
|
|
||||||
void MainWindow::on_actionFitByWidth_triggered()
|
void MainWindow::on_actionFitByWidth_triggered()
|
||||||
@ -784,7 +796,7 @@ void MainWindow::on_actionTrash_triggered()
|
|||||||
if (result == QMessageBox::Yes) {
|
if (result == QMessageBox::Yes) {
|
||||||
bool succ = file.moveToTrash();
|
bool succ = file.moveToTrash();
|
||||||
if (!succ) {
|
if (!succ) {
|
||||||
QMessageBox::warning(this, "Failed to move file to trash",
|
QMessageBox::warning(this, tr("Failed to move file to trash"),
|
||||||
tr("Move to trash failed, it might caused by file permission issue, file system limitation, or platform limitation."));
|
tr("Move to trash failed, it might caused by file permission issue, file system limitation, or platform limitation."));
|
||||||
} else {
|
} else {
|
||||||
m_pm->removeAt(index);
|
m_pm->removeAt(index);
|
||||||
@ -803,14 +815,12 @@ void MainWindow::on_actionRotateClockwise_triggered()
|
|||||||
{
|
{
|
||||||
m_graphicsView->rotateView();
|
m_graphicsView->rotateView();
|
||||||
m_graphicsView->displayScene();
|
m_graphicsView->displayScene();
|
||||||
m_gv->setVisible(false);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void MainWindow::on_actionRotateCounterClockwise_triggered()
|
void MainWindow::on_actionRotateCounterClockwise_triggered()
|
||||||
{
|
{
|
||||||
m_graphicsView->rotateView(false);
|
m_graphicsView->rotateView(false);
|
||||||
m_graphicsView->displayScene();
|
m_graphicsView->displayScene();
|
||||||
m_gv->setVisible(false);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void MainWindow::on_actionPrevPicture_triggered()
|
void MainWindow::on_actionPrevPicture_triggered()
|
||||||
@ -895,9 +905,9 @@ void MainWindow::on_actionLocateInFileManager_triggered()
|
|||||||
QDesktopServices::openUrl(folderUrl);
|
QDesktopServices::openUrl(folderUrl);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
QDBusInterface fm1Iface(QStringLiteral("org.freedesktop.FileManager1"),
|
QDBusInterface fm1Iface(u"org.freedesktop.FileManager1"_s,
|
||||||
QStringLiteral("/org/freedesktop/FileManager1"),
|
u"/org/freedesktop/FileManager1"_s,
|
||||||
QStringLiteral("org.freedesktop.FileManager1"));
|
u"org.freedesktop.FileManager1"_s);
|
||||||
fm1Iface.setTimeout(1000);
|
fm1Iface.setTimeout(1000);
|
||||||
fm1Iface.callWithArgumentList(QDBus::Block, "ShowItems", {
|
fm1Iface.callWithArgumentList(QDBus::Block, "ShowItems", {
|
||||||
QStringList{currentFileUrl.toString()},
|
QStringList{currentFileUrl.toString()},
|
||||||
@ -916,9 +926,28 @@ void MainWindow::on_actionQuitApp_triggered()
|
|||||||
quitAppAction(false);
|
quitAppAction(false);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void MainWindow::doCloseWindow()
|
||||||
|
{
|
||||||
|
#ifdef Q_OS_MAC
|
||||||
|
this->hide();
|
||||||
|
#else
|
||||||
|
this->close();
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
|
||||||
bool MainWindow::updateFileWatcher(const QString &basePath)
|
bool MainWindow::updateFileWatcher(const QString &basePath)
|
||||||
{
|
{
|
||||||
m_fileSystemWatcher->removePaths(m_fileSystemWatcher->files());
|
m_fileSystemWatcher->removePaths(m_fileSystemWatcher->files());
|
||||||
if (!basePath.isEmpty()) return m_fileSystemWatcher->addPath(basePath);
|
if (!basePath.isEmpty()) return m_fileSystemWatcher->addPath(basePath);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void MainWindow::updateGalleryButtonsVisibility()
|
||||||
|
{
|
||||||
|
const int galleryFileCount = m_pm->totalCount();
|
||||||
|
const bool loopGallery = Settings::instance()->loopGallery();
|
||||||
|
m_prevButton->setVisible(!m_protectedMode && galleryFileCount > 1);
|
||||||
|
m_nextButton->setVisible(!m_protectedMode && galleryFileCount > 1);
|
||||||
|
m_prevButton->setEnabled(loopGallery || !m_pm->isFirstIndex());
|
||||||
|
m_nextButton->setEnabled(loopGallery || !m_pm->isLastIndex());
|
||||||
|
}
|
||||||
|
@ -11,12 +11,6 @@
|
|||||||
#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;
|
||||||
@ -51,7 +45,7 @@ public:
|
|||||||
|
|
||||||
protected slots:
|
protected slots:
|
||||||
void showEvent(QShowEvent *event) override;
|
void showEvent(QShowEvent *event) override;
|
||||||
void enterEvent(QT_ENTER_EVENT *event) override;
|
void enterEvent(QEnterEvent *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;
|
||||||
@ -112,8 +106,11 @@ private slots:
|
|||||||
void on_actionLocateInFileManager_triggered();
|
void on_actionLocateInFileManager_triggered();
|
||||||
void on_actionQuitApp_triggered();
|
void on_actionQuitApp_triggered();
|
||||||
|
|
||||||
|
void doCloseWindow();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
bool updateFileWatcher(const QString & basePath = QString());
|
bool updateFileWatcher(const QString & basePath = QString());
|
||||||
|
void updateGalleryButtonsVisibility();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
ActionManager *m_am;
|
ActionManager *m_am;
|
||||||
|
@ -11,6 +11,8 @@
|
|||||||
#include <QFileInfo>
|
#include <QFileInfo>
|
||||||
#include <QImageReader>
|
#include <QImageReader>
|
||||||
|
|
||||||
|
using namespace Qt::Literals::StringLiterals;
|
||||||
|
|
||||||
MetadataModel::MetadataModel(QObject *parent)
|
MetadataModel::MetadataModel(QObject *parent)
|
||||||
: QAbstractItemModel(parent)
|
: QAbstractItemModel(parent)
|
||||||
{
|
{
|
||||||
@ -37,131 +39,131 @@ void MetadataModel::setFile(const QString &imageFilePath)
|
|||||||
const QString & imageDimensionsString = imageSize(imgReader.size());
|
const QString & imageDimensionsString = imageSize(imgReader.size());
|
||||||
const QString & imageRatioString = imageSizeRatio(imgReader.size());
|
const QString & imageRatioString = imageSizeRatio(imgReader.size());
|
||||||
|
|
||||||
appendSection(QStringLiteral("Description"), tr("Description", "Section name."));
|
appendSection(u"Description"_s, tr("Description", "Section name."));
|
||||||
appendSection(QStringLiteral("Origin"), tr("Origin", "Section name."));
|
appendSection(u"Origin"_s, tr("Origin", "Section name."));
|
||||||
appendSection(QStringLiteral("Image"), tr("Image", "Section name."));
|
appendSection(u"Image"_s, tr("Image", "Section name."));
|
||||||
appendSection(QStringLiteral("Camera"), tr("Camera", "Section name."));
|
appendSection(u"Camera"_s, tr("Camera", "Section name."));
|
||||||
appendSection(QStringLiteral("AdvancedPhoto"), tr("Advanced photo", "Section name."));
|
appendSection(u"AdvancedPhoto"_s, tr("Advanced photo", "Section name."));
|
||||||
appendSection(QStringLiteral("GPS"), tr("GPS", "Section name."));
|
appendSection(u"GPS"_s, tr("GPS", "Section name."));
|
||||||
appendSection(QStringLiteral("File"), tr("File", "Section name."));
|
appendSection(u"File"_s, tr("File", "Section name."));
|
||||||
|
|
||||||
if (imgReader.supportsOption(QImageIOHandler::Size)) {
|
if (imgReader.supportsOption(QImageIOHandler::Size)) {
|
||||||
appendProperty(QStringLiteral("Image"), QStringLiteral("Image.Dimensions"),
|
appendProperty(u"Image"_s, u"Image.Dimensions"_s,
|
||||||
tr("Dimensions"), imageDimensionsString);
|
tr("Dimensions"), imageDimensionsString);
|
||||||
appendProperty(QStringLiteral("Image"), QStringLiteral("Image.SizeRatio"),
|
appendProperty(u"Image"_s, u"Image.SizeRatio"_s,
|
||||||
tr("Aspect ratio"), imageRatioString);
|
tr("Aspect ratio"), imageRatioString);
|
||||||
}
|
}
|
||||||
if (imgReader.supportsAnimation() && imgReader.imageCount() > 1) {
|
if (imgReader.supportsAnimation() && imgReader.imageCount() > 1) {
|
||||||
appendProperty(QStringLiteral("Image"), QStringLiteral("Image.FrameCount"),
|
appendProperty(u"Image"_s, u"Image.FrameCount"_s,
|
||||||
tr("Frame count"), QString::number(imgReader.imageCount()));
|
tr("Frame count"), QString::number(imgReader.imageCount()));
|
||||||
}
|
}
|
||||||
|
|
||||||
appendProperty(QStringLiteral("File"), QStringLiteral("File.Name"),
|
appendProperty(u"File"_s, u"File.Name"_s,
|
||||||
tr("Name"), fileInfo.fileName());
|
tr("Name"), fileInfo.fileName());
|
||||||
appendProperty(QStringLiteral("File"), QStringLiteral("File.ItemType"),
|
appendProperty(u"File"_s, u"File.ItemType"_s,
|
||||||
tr("Item type"), itemTypeString);
|
tr("Item type"), itemTypeString);
|
||||||
appendProperty(QStringLiteral("File"), QStringLiteral("File.Path"),
|
appendProperty(u"File"_s, u"File.Path"_s,
|
||||||
tr("Folder path"), QDir::toNativeSeparators(fileInfo.path()));
|
tr("Folder path"), QDir::toNativeSeparators(fileInfo.path()));
|
||||||
appendProperty(QStringLiteral("File"), QStringLiteral("File.Size"),
|
appendProperty(u"File"_s, u"File.Size"_s,
|
||||||
tr("Size"), sizeString);
|
tr("Size"), sizeString);
|
||||||
appendProperty(QStringLiteral("File"), QStringLiteral("File.CreatedTime"),
|
appendProperty(u"File"_s, u"File.CreatedTime"_s,
|
||||||
tr("Date created"), birthTimeString);
|
tr("Date created"), birthTimeString);
|
||||||
appendProperty(QStringLiteral("File"), QStringLiteral("File.LastModified"),
|
appendProperty(u"File"_s, u"File.LastModified"_s,
|
||||||
tr("Date modified"), lastModifiedTimeString);
|
tr("Date modified"), lastModifiedTimeString);
|
||||||
|
|
||||||
Exiv2Wrapper wrapper;
|
Exiv2Wrapper wrapper;
|
||||||
if (wrapper.load(imageFilePath)) {
|
if (wrapper.load(imageFilePath)) {
|
||||||
wrapper.cacheSections();
|
wrapper.cacheSections();
|
||||||
|
|
||||||
appendExivPropertyIfExist(wrapper, QStringLiteral("Description"),
|
appendExivPropertyIfExist(wrapper, u"Description"_s,
|
||||||
QStringLiteral("Xmp.dc.title"), tr("Title"), true);
|
u"Xmp.dc.title"_s, tr("Title"), true);
|
||||||
appendExivPropertyIfExist(wrapper, QStringLiteral("Description"),
|
appendExivPropertyIfExist(wrapper, u"Description"_s,
|
||||||
QStringLiteral("Exif.Image.ImageDescription"), tr("Subject"), true);
|
u"Exif.Image.ImageDescription"_s, tr("Subject"), true);
|
||||||
appendExivPropertyIfExist(wrapper, QStringLiteral("Description"),
|
appendExivPropertyIfExist(wrapper, u"Description"_s,
|
||||||
QStringLiteral("Exif.Image.Rating"), tr("Rating"));
|
u"Exif.Image.Rating"_s, tr("Rating"));
|
||||||
appendExivPropertyIfExist(wrapper, QStringLiteral("Description"),
|
appendExivPropertyIfExist(wrapper, u"Description"_s,
|
||||||
QStringLiteral("Xmp.dc.subject"), tr("Tags"));
|
u"Xmp.dc.subject"_s, tr("Tags"));
|
||||||
appendPropertyIfNotEmpty(QStringLiteral("Description"), QStringLiteral("Description.Comments"),
|
appendPropertyIfNotEmpty(u"Description"_s, u"Description.Comments"_s,
|
||||||
tr("Comments"), wrapper.comment());
|
tr("Comments"), wrapper.comment());
|
||||||
|
|
||||||
appendExivPropertyIfExist(wrapper, QStringLiteral("Origin"),
|
appendExivPropertyIfExist(wrapper, u"Origin"_s,
|
||||||
QStringLiteral("Exif.Image.Artist"), tr("Authors"));
|
u"Exif.Image.Artist"_s, tr("Authors"));
|
||||||
appendExivPropertyIfExist(wrapper, QStringLiteral("Origin"),
|
appendExivPropertyIfExist(wrapper, u"Origin"_s,
|
||||||
QStringLiteral("Exif.Photo.DateTimeOriginal"), tr("Date taken"));
|
u"Exif.Photo.DateTimeOriginal"_s, tr("Date taken"));
|
||||||
// FIXME: We may fetch the same type of metadata from different metadata collection.
|
// FIXME: We may fetch the same type of metadata from different metadata collection.
|
||||||
// Current implementation is not pretty and may need to do a rework...
|
// Current implementation is not pretty and may need to do a rework...
|
||||||
// appendExivPropertyIfExist(wrapper, QStringLiteral("Origin"),
|
// appendExivPropertyIfExist(wrapper, QStringLiteral("Origin"),
|
||||||
// QStringLiteral("Xmp.xmp.CreatorTool"), tr("Program name"));
|
// QStringLiteral("Xmp.xmp.CreatorTool"), tr("Program name"));
|
||||||
appendExivPropertyIfExist(wrapper, QStringLiteral("Origin"),
|
appendExivPropertyIfExist(wrapper, u"Origin"_s,
|
||||||
QStringLiteral("Exif.Image.Software"), tr("Program name"));
|
u"Exif.Image.Software"_s, tr("Program name"));
|
||||||
appendExivPropertyIfExist(wrapper, QStringLiteral("Origin"),
|
appendExivPropertyIfExist(wrapper, u"Origin"_s,
|
||||||
QStringLiteral("Exif.Image.Copyright"), tr("Copyright"));
|
u"Exif.Image.Copyright"_s, tr("Copyright"));
|
||||||
|
|
||||||
appendExivPropertyIfExist(wrapper, QStringLiteral("Image"),
|
appendExivPropertyIfExist(wrapper, u"Image"_s,
|
||||||
QStringLiteral("Exif.Image.XResolution"), tr("Horizontal resolution"));
|
u"Exif.Image.XResolution"_s, tr("Horizontal resolution"));
|
||||||
appendExivPropertyIfExist(wrapper, QStringLiteral("Image"),
|
appendExivPropertyIfExist(wrapper, u"Image"_s,
|
||||||
QStringLiteral("Exif.Image.YResolution"), tr("Vertical resolution"));
|
u"Exif.Image.YResolution"_s, tr("Vertical resolution"));
|
||||||
appendExivPropertyIfExist(wrapper, QStringLiteral("Image"),
|
appendExivPropertyIfExist(wrapper, u"Image"_s,
|
||||||
QStringLiteral("Exif.Image.ResolutionUnit"), tr("Resolution unit"));
|
u"Exif.Image.ResolutionUnit"_s, tr("Resolution unit"));
|
||||||
appendExivPropertyIfExist(wrapper, QStringLiteral("Image"),
|
appendExivPropertyIfExist(wrapper, u"Image"_s,
|
||||||
QStringLiteral("Exif.Photo.ColorSpace"), tr("Colour representation"));
|
u"Exif.Photo.ColorSpace"_s, tr("Colour representation"));
|
||||||
|
|
||||||
appendExivPropertyIfExist(wrapper, QStringLiteral("Camera"),
|
appendExivPropertyIfExist(wrapper, u"Camera"_s,
|
||||||
QStringLiteral("Exif.Image.Make"), tr("Camera maker"));
|
u"Exif.Image.Make"_s, tr("Camera maker"));
|
||||||
appendExivPropertyIfExist(wrapper, QStringLiteral("Camera"),
|
appendExivPropertyIfExist(wrapper, u"Camera"_s,
|
||||||
QStringLiteral("Exif.Image.Model"), tr("Camera model"));
|
u"Exif.Image.Model"_s, tr("Camera model"));
|
||||||
appendExivPropertyIfExist(wrapper, QStringLiteral("Camera"),
|
appendExivPropertyIfExist(wrapper, u"Camera"_s,
|
||||||
QStringLiteral("Exif.Photo.FNumber"), tr("F-stop"));
|
u"Exif.Photo.FNumber"_s, tr("F-stop"));
|
||||||
appendExivPropertyIfExist(wrapper, QStringLiteral("Camera"),
|
appendExivPropertyIfExist(wrapper, u"Camera"_s,
|
||||||
QStringLiteral("Exif.Photo.ExposureTime"), tr("Exposure time"));
|
u"Exif.Photo.ExposureTime"_s, tr("Exposure time"));
|
||||||
appendExivPropertyIfExist(wrapper, QStringLiteral("Camera"),
|
appendExivPropertyIfExist(wrapper, u"Camera"_s,
|
||||||
QStringLiteral("Exif.Photo.ISOSpeedRatings"), tr("ISO speed"));
|
u"Exif.Photo.ISOSpeedRatings"_s, tr("ISO speed"));
|
||||||
appendExivPropertyIfExist(wrapper, QStringLiteral("Camera"),
|
appendExivPropertyIfExist(wrapper, u"Camera"_s,
|
||||||
QStringLiteral("Exif.Photo.ExposureBiasValue"), tr("Exposure bias"));
|
u"Exif.Photo.ExposureBiasValue"_s, tr("Exposure bias"));
|
||||||
appendExivPropertyIfExist(wrapper, QStringLiteral("Camera"),
|
appendExivPropertyIfExist(wrapper, u"Camera"_s,
|
||||||
QStringLiteral("Exif.Photo.FocalLength"), tr("Focal length"));
|
u"Exif.Photo.FocalLength"_s, tr("Focal length"));
|
||||||
appendExivPropertyIfExist(wrapper, QStringLiteral("Camera"),
|
appendExivPropertyIfExist(wrapper, u"Camera"_s,
|
||||||
QStringLiteral("Exif.Photo.MaxApertureValue"), tr("Max aperture"));
|
u"Exif.Photo.MaxApertureValue"_s, tr("Max aperture"));
|
||||||
appendExivPropertyIfExist(wrapper, QStringLiteral("Camera"),
|
appendExivPropertyIfExist(wrapper, u"Camera"_s,
|
||||||
QStringLiteral("Exif.Photo.MeteringMode"), tr("Metering mode"));
|
u"Exif.Photo.MeteringMode"_s, tr("Metering mode"));
|
||||||
appendExivPropertyIfExist(wrapper, QStringLiteral("Camera"),
|
appendExivPropertyIfExist(wrapper, u"Camera"_s,
|
||||||
QStringLiteral("Exif.Photo.SubjectDistance"), tr("Subject distance"));
|
u"Exif.Photo.SubjectDistance"_s, tr("Subject distance"));
|
||||||
appendExivPropertyIfExist(wrapper, QStringLiteral("Camera"),
|
appendExivPropertyIfExist(wrapper, u"Camera"_s,
|
||||||
QStringLiteral("Exif.Photo.Flash"), tr("Flash mode"));
|
u"Exif.Photo.Flash"_s, tr("Flash mode"));
|
||||||
appendExivPropertyIfExist(wrapper, QStringLiteral("Camera"),
|
appendExivPropertyIfExist(wrapper, u"Camera"_s,
|
||||||
QStringLiteral("Exif.Photo.FocalLengthIn35mmFilm"), tr("35mm focal length"));
|
u"Exif.Photo.FocalLengthIn35mmFilm"_s, tr("35mm focal length"));
|
||||||
|
|
||||||
appendExivPropertyIfExist(wrapper, QStringLiteral("AdvancedPhoto"),
|
appendExivPropertyIfExist(wrapper, u"AdvancedPhoto"_s,
|
||||||
QStringLiteral("Exif.Photo.LensModel"), tr("Lens model"));
|
u"Exif.Photo.LensModel"_s, tr("Lens model"));
|
||||||
appendExivPropertyIfExist(wrapper, QStringLiteral("AdvancedPhoto"),
|
appendExivPropertyIfExist(wrapper, u"AdvancedPhoto"_s,
|
||||||
QStringLiteral("Exif.Photo.Contrast"), tr("Contrast"));
|
u"Exif.Photo.Contrast"_s, tr("Contrast"));
|
||||||
appendExivPropertyIfExist(wrapper, QStringLiteral("AdvancedPhoto"),
|
appendExivPropertyIfExist(wrapper, u"AdvancedPhoto"_s,
|
||||||
QStringLiteral("Exif.Photo.BrightnessValue"), tr("Brightness"));
|
u"Exif.Photo.BrightnessValue"_s, tr("Brightness"));
|
||||||
appendExivPropertyIfExist(wrapper, QStringLiteral("AdvancedPhoto"),
|
appendExivPropertyIfExist(wrapper, u"AdvancedPhoto"_s,
|
||||||
QStringLiteral("Exif.Photo.ExposureProgram"), tr("Exposure program"));
|
u"Exif.Photo.ExposureProgram"_s, tr("Exposure program"));
|
||||||
appendExivPropertyIfExist(wrapper, QStringLiteral("AdvancedPhoto"),
|
appendExivPropertyIfExist(wrapper, u"AdvancedPhoto"_s,
|
||||||
QStringLiteral("Exif.Photo.Saturation"), tr("Saturation"));
|
u"Exif.Photo.Saturation"_s, tr("Saturation"));
|
||||||
appendExivPropertyIfExist(wrapper, QStringLiteral("AdvancedPhoto"),
|
appendExivPropertyIfExist(wrapper, u"AdvancedPhoto"_s,
|
||||||
QStringLiteral("Exif.Photo.Sharpness"), tr("Sharpness"));
|
u"Exif.Photo.Sharpness"_s, tr("Sharpness"));
|
||||||
appendExivPropertyIfExist(wrapper, QStringLiteral("AdvancedPhoto"),
|
appendExivPropertyIfExist(wrapper, u"AdvancedPhoto"_s,
|
||||||
QStringLiteral("Exif.Photo.WhiteBalance"), tr("White balance"));
|
u"Exif.Photo.WhiteBalance"_s, tr("White balance"));
|
||||||
appendExivPropertyIfExist(wrapper, QStringLiteral("AdvancedPhoto"),
|
appendExivPropertyIfExist(wrapper, u"AdvancedPhoto"_s,
|
||||||
QStringLiteral("Exif.Photo.DigitalZoomRatio"), tr("Digital zoom"));
|
u"Exif.Photo.DigitalZoomRatio"_s, tr("Digital zoom"));
|
||||||
appendExivPropertyIfExist(wrapper, QStringLiteral("AdvancedPhoto"),
|
appendExivPropertyIfExist(wrapper, u"AdvancedPhoto"_s,
|
||||||
QStringLiteral("Exif.Photo.ExifVersion"), tr("EXIF version"));
|
u"Exif.Photo.ExifVersion"_s, tr("EXIF version"));
|
||||||
|
|
||||||
appendExivPropertyIfExist(wrapper, QStringLiteral("GPS"),
|
appendExivPropertyIfExist(wrapper, u"GPS"_s,
|
||||||
QStringLiteral("Exif.GPSInfo.GPSLatitudeRef"), tr("Latitude reference"));
|
u"Exif.GPSInfo.GPSLatitudeRef"_s, tr("Latitude reference"));
|
||||||
appendExivPropertyIfExist(wrapper, QStringLiteral("GPS"),
|
appendExivPropertyIfExist(wrapper, u"GPS"_s,
|
||||||
QStringLiteral("Exif.GPSInfo.GPSLatitude"), tr("Latitude"));
|
u"Exif.GPSInfo.GPSLatitude"_s, tr("Latitude"));
|
||||||
appendExivPropertyIfExist(wrapper, QStringLiteral("GPS"),
|
appendExivPropertyIfExist(wrapper, u"GPS"_s,
|
||||||
QStringLiteral("Exif.GPSInfo.GPSLongitudeRef"), tr("Longitude reference"));
|
u"Exif.GPSInfo.GPSLongitudeRef"_s, tr("Longitude reference"));
|
||||||
appendExivPropertyIfExist(wrapper, QStringLiteral("GPS"),
|
appendExivPropertyIfExist(wrapper, u"GPS"_s,
|
||||||
QStringLiteral("Exif.GPSInfo.GPSLongitude"), tr("Longitude"));
|
u"Exif.GPSInfo.GPSLongitude"_s, tr("Longitude"));
|
||||||
appendExivPropertyIfExist(wrapper, QStringLiteral("GPS"),
|
appendExivPropertyIfExist(wrapper, u"GPS"_s,
|
||||||
QStringLiteral("Exif.GPSInfo.GPSAltitudeRef"), tr("Altitude reference"));
|
u"Exif.GPSInfo.GPSAltitudeRef"_s, tr("Altitude reference"));
|
||||||
appendExivPropertyIfExist(wrapper, QStringLiteral("GPS"),
|
appendExivPropertyIfExist(wrapper, u"GPS"_s,
|
||||||
QStringLiteral("Exif.GPSInfo.GPSAltitude"), tr("Altitude"));
|
u"Exif.GPSInfo.GPSAltitude"_s, tr("Altitude"));
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -9,6 +9,7 @@
|
|||||||
|
|
||||||
#include <QMouseEvent>
|
#include <QMouseEvent>
|
||||||
#include <QDebug>
|
#include <QDebug>
|
||||||
|
#include <QTimer>
|
||||||
|
|
||||||
NavigatorView::NavigatorView(QWidget *parent)
|
NavigatorView::NavigatorView(QWidget *parent)
|
||||||
: QGraphicsView (parent)
|
: QGraphicsView (parent)
|
||||||
@ -34,10 +35,14 @@ void NavigatorView::setOpacity(qreal opacity, bool animated)
|
|||||||
|
|
||||||
void NavigatorView::updateMainViewportRegion()
|
void NavigatorView::updateMainViewportRegion()
|
||||||
{
|
{
|
||||||
if (m_mainView != nullptr) {
|
// Use QTimer::singleShot with lambda to delay the update
|
||||||
m_viewportRegion = mapFromScene(m_mainView->mapToScene(m_mainView->rect()));
|
// This ensures all geometry updates are complete before calculating viewport region
|
||||||
update();
|
QTimer::singleShot(0, [this]() {
|
||||||
}
|
if (m_mainView != nullptr) {
|
||||||
|
m_viewportRegion = mapFromScene(m_mainView->mapToScene(m_mainView->rect()));
|
||||||
|
update();
|
||||||
|
}
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
void NavigatorView::mousePressEvent(QMouseEvent *event)
|
void NavigatorView::mousePressEvent(QMouseEvent *event)
|
||||||
|
@ -186,6 +186,26 @@ QModelIndex PlaylistManager::loadPlaylist(const QUrl &url)
|
|||||||
return idx;
|
return idx;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
QModelIndex PlaylistManager::loadM3U8Playlist(const QUrl &url)
|
||||||
|
{
|
||||||
|
QFile file(url.toLocalFile());
|
||||||
|
if (file.open(QIODevice::ReadOnly | QIODevice::Text)) {
|
||||||
|
QList<QUrl> urls;
|
||||||
|
while (!file.atEnd()) {
|
||||||
|
QString line = file.readLine();
|
||||||
|
if (line.startsWith('#')) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
QFileInfo fileInfo(file);
|
||||||
|
QUrl item = QUrl::fromUserInput(line, fileInfo.absolutePath());
|
||||||
|
urls.append(item);
|
||||||
|
}
|
||||||
|
return loadPlaylist(urls);
|
||||||
|
} else {
|
||||||
|
return {};
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
int PlaylistManager::totalCount() const
|
int PlaylistManager::totalCount() const
|
||||||
{
|
{
|
||||||
return m_model.rowCount();
|
return m_model.rowCount();
|
||||||
@ -196,7 +216,7 @@ QModelIndex PlaylistManager::previousIndex() const
|
|||||||
int count = totalCount();
|
int count = totalCount();
|
||||||
if (count == 0) return {};
|
if (count == 0) return {};
|
||||||
|
|
||||||
return m_model.index(m_currentIndex - 1 < 0 ? count - 1 : m_currentIndex - 1);
|
return m_model.index(isFirstIndex() ? count - 1 : m_currentIndex - 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
QModelIndex PlaylistManager::nextIndex() const
|
QModelIndex PlaylistManager::nextIndex() const
|
||||||
@ -204,7 +224,7 @@ QModelIndex PlaylistManager::nextIndex() const
|
|||||||
int count = totalCount();
|
int count = totalCount();
|
||||||
if (count == 0) return {};
|
if (count == 0) return {};
|
||||||
|
|
||||||
return m_model.index(m_currentIndex + 1 == count ? 0 : m_currentIndex + 1);
|
return m_model.index(isLastIndex() ? 0 : m_currentIndex + 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
QModelIndex PlaylistManager::curIndex() const
|
QModelIndex PlaylistManager::curIndex() const
|
||||||
@ -212,6 +232,16 @@ QModelIndex PlaylistManager::curIndex() const
|
|||||||
return m_model.index(m_currentIndex);
|
return m_model.index(m_currentIndex);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool PlaylistManager::isFirstIndex() const
|
||||||
|
{
|
||||||
|
return m_currentIndex == 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
bool PlaylistManager::isLastIndex() const
|
||||||
|
{
|
||||||
|
return m_currentIndex + 1 == totalCount();
|
||||||
|
}
|
||||||
|
|
||||||
void PlaylistManager::setCurrentIndex(const QModelIndex &index)
|
void PlaylistManager::setCurrentIndex(const QModelIndex &index)
|
||||||
{
|
{
|
||||||
if (index.isValid() && index.row() >= 0 && index.row() < totalCount()) {
|
if (index.isValid() && index.row() >= 0 && index.row() < totalCount()) {
|
||||||
|
@ -61,11 +61,14 @@ public:
|
|||||||
void setPlaylist(const QList<QUrl> & url);
|
void setPlaylist(const QList<QUrl> & url);
|
||||||
Q_INVOKABLE QModelIndex loadPlaylist(const QList<QUrl> & urls);
|
Q_INVOKABLE QModelIndex loadPlaylist(const QList<QUrl> & urls);
|
||||||
Q_INVOKABLE QModelIndex loadPlaylist(const QUrl & url);
|
Q_INVOKABLE QModelIndex loadPlaylist(const QUrl & url);
|
||||||
|
Q_INVOKABLE QModelIndex loadM3U8Playlist(const QUrl & url);
|
||||||
|
|
||||||
int totalCount() const;
|
int totalCount() const;
|
||||||
QModelIndex previousIndex() const;
|
QModelIndex previousIndex() const;
|
||||||
QModelIndex nextIndex() const;
|
QModelIndex nextIndex() const;
|
||||||
QModelIndex curIndex() const;
|
QModelIndex curIndex() const;
|
||||||
|
bool isFirstIndex() const;
|
||||||
|
bool isLastIndex() const;
|
||||||
void setCurrentIndex(const QModelIndex & index);
|
void setCurrentIndex(const QModelIndex & index);
|
||||||
QUrl urlByIndex(const QModelIndex & index);
|
QUrl urlByIndex(const QModelIndex & index);
|
||||||
QString localFileByIndex(const QModelIndex & index);
|
QString localFileByIndex(const QModelIndex & index);
|
||||||
|
@ -45,16 +45,31 @@ Settings *Settings::instance()
|
|||||||
return m_settings_instance;
|
return m_settings_instance;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool Settings::stayOnTop()
|
bool Settings::stayOnTop() const
|
||||||
{
|
{
|
||||||
return m_qsettings->value("stay_on_top", true).toBool();
|
return m_qsettings->value("stay_on_top", true).toBool();
|
||||||
}
|
}
|
||||||
|
|
||||||
bool Settings::useLightCheckerboard()
|
bool Settings::useBuiltInCloseAnimation() const
|
||||||
|
{
|
||||||
|
return m_qsettings->value("use_built_in_close_animation", true).toBool();
|
||||||
|
}
|
||||||
|
|
||||||
|
bool Settings::useLightCheckerboard() const
|
||||||
{
|
{
|
||||||
return m_qsettings->value("use_light_checkerboard", false).toBool();
|
return m_qsettings->value("use_light_checkerboard", false).toBool();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool Settings::loopGallery() const
|
||||||
|
{
|
||||||
|
return m_qsettings->value("loop_gallery", true).toBool();
|
||||||
|
}
|
||||||
|
|
||||||
|
bool Settings::autoLongImageMode() const
|
||||||
|
{
|
||||||
|
return m_qsettings->value("auto_long_image_mode", true).toBool();
|
||||||
|
}
|
||||||
|
|
||||||
Settings::DoubleClickBehavior Settings::doubleClickBehavior() const
|
Settings::DoubleClickBehavior Settings::doubleClickBehavior() const
|
||||||
{
|
{
|
||||||
QString result = m_qsettings->value("double_click_behavior", "Close").toString();
|
QString result = m_qsettings->value("double_click_behavior", "Close").toString();
|
||||||
@ -89,12 +104,30 @@ void Settings::setStayOnTop(bool on)
|
|||||||
m_qsettings->sync();
|
m_qsettings->sync();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void Settings::setUseBuiltInCloseAnimation(bool on)
|
||||||
|
{
|
||||||
|
m_qsettings->setValue("use_built_in_close_animation", on);
|
||||||
|
m_qsettings->sync();
|
||||||
|
}
|
||||||
|
|
||||||
void Settings::setUseLightCheckerboard(bool light)
|
void Settings::setUseLightCheckerboard(bool light)
|
||||||
{
|
{
|
||||||
m_qsettings->setValue("use_light_checkerboard", light);
|
m_qsettings->setValue("use_light_checkerboard", light);
|
||||||
m_qsettings->sync();
|
m_qsettings->sync();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void Settings::setLoopGallery(bool on)
|
||||||
|
{
|
||||||
|
m_qsettings->setValue("loop_gallery", on);
|
||||||
|
m_qsettings->sync();
|
||||||
|
}
|
||||||
|
|
||||||
|
void Settings::setAutoLongImageMode(bool on)
|
||||||
|
{
|
||||||
|
m_qsettings->setValue("auto_long_image_mode", on);
|
||||||
|
m_qsettings->sync();
|
||||||
|
}
|
||||||
|
|
||||||
void Settings::setDoubleClickBehavior(DoubleClickBehavior dcb)
|
void Settings::setDoubleClickBehavior(DoubleClickBehavior dcb)
|
||||||
{
|
{
|
||||||
m_qsettings->setValue("double_click_behavior", QEnumHelper::toString(dcb));
|
m_qsettings->setValue("double_click_behavior", QEnumHelper::toString(dcb));
|
||||||
|
@ -34,15 +34,21 @@ public:
|
|||||||
|
|
||||||
static Settings *instance();
|
static Settings *instance();
|
||||||
|
|
||||||
bool stayOnTop();
|
bool stayOnTop() const;
|
||||||
bool useLightCheckerboard();
|
bool useBuiltInCloseAnimation() const;
|
||||||
|
bool useLightCheckerboard() const;
|
||||||
|
bool loopGallery() const;
|
||||||
|
bool autoLongImageMode() const;
|
||||||
DoubleClickBehavior doubleClickBehavior() const;
|
DoubleClickBehavior doubleClickBehavior() const;
|
||||||
MouseWheelBehavior mouseWheelBehavior() const;
|
MouseWheelBehavior mouseWheelBehavior() const;
|
||||||
WindowSizeBehavior initWindowSizeBehavior() const;
|
WindowSizeBehavior initWindowSizeBehavior() const;
|
||||||
Qt::HighDpiScaleFactorRoundingPolicy hiDpiScaleFactorBehavior() const;
|
Qt::HighDpiScaleFactorRoundingPolicy hiDpiScaleFactorBehavior() const;
|
||||||
|
|
||||||
void setStayOnTop(bool on);
|
void setStayOnTop(bool on);
|
||||||
|
void setUseBuiltInCloseAnimation(bool on);
|
||||||
void setUseLightCheckerboard(bool light);
|
void setUseLightCheckerboard(bool light);
|
||||||
|
void setLoopGallery(bool on);
|
||||||
|
void setAutoLongImageMode(bool on);
|
||||||
void setDoubleClickBehavior(DoubleClickBehavior dcb);
|
void setDoubleClickBehavior(DoubleClickBehavior dcb);
|
||||||
void setMouseWheelBehavior(MouseWheelBehavior mwb);
|
void setMouseWheelBehavior(MouseWheelBehavior mwb);
|
||||||
void setInitWindowSizeBehavior(WindowSizeBehavior wsb);
|
void setInitWindowSizeBehavior(WindowSizeBehavior wsb);
|
||||||
|
@ -20,7 +20,10 @@
|
|||||||
SettingsDialog::SettingsDialog(QWidget *parent)
|
SettingsDialog::SettingsDialog(QWidget *parent)
|
||||||
: QDialog(parent)
|
: QDialog(parent)
|
||||||
, m_stayOnTop(new QCheckBox)
|
, m_stayOnTop(new QCheckBox)
|
||||||
|
, m_useBuiltInCloseAnimation(new QCheckBox)
|
||||||
, m_useLightCheckerboard(new QCheckBox)
|
, m_useLightCheckerboard(new QCheckBox)
|
||||||
|
, m_loopGallery(new QCheckBox)
|
||||||
|
, m_autoLongImageMode(new QCheckBox)
|
||||||
, m_doubleClickBehavior(new QComboBox)
|
, m_doubleClickBehavior(new QComboBox)
|
||||||
, m_mouseWheelBehavior(new QComboBox)
|
, m_mouseWheelBehavior(new QComboBox)
|
||||||
, m_initWindowSizeBehavior(new QComboBox)
|
, m_initWindowSizeBehavior(new QComboBox)
|
||||||
@ -118,14 +121,20 @@ SettingsDialog::SettingsDialog(QWidget *parent)
|
|||||||
}
|
}
|
||||||
|
|
||||||
settingsForm->addRow(tr("Stay on top when start-up"), m_stayOnTop);
|
settingsForm->addRow(tr("Stay on top when start-up"), m_stayOnTop);
|
||||||
|
settingsForm->addRow(tr("Use built-in close window animation"), m_useBuiltInCloseAnimation);
|
||||||
settingsForm->addRow(tr("Use light-color checkerboard"), m_useLightCheckerboard);
|
settingsForm->addRow(tr("Use light-color checkerboard"), m_useLightCheckerboard);
|
||||||
|
settingsForm->addRow(tr("Loop the loaded gallery"), m_loopGallery);
|
||||||
|
settingsForm->addRow(tr("Auto long image mode"), m_autoLongImageMode);
|
||||||
settingsForm->addRow(tr("Double-click behavior"), m_doubleClickBehavior);
|
settingsForm->addRow(tr("Double-click behavior"), m_doubleClickBehavior);
|
||||||
settingsForm->addRow(tr("Mouse wheel behavior"), m_mouseWheelBehavior);
|
settingsForm->addRow(tr("Mouse wheel behavior"), m_mouseWheelBehavior);
|
||||||
settingsForm->addRow(tr("Default window size"), m_initWindowSizeBehavior);
|
settingsForm->addRow(tr("Default window size"), m_initWindowSizeBehavior);
|
||||||
settingsForm->addRow(tr("HiDPI scale factor rounding policy"), m_hiDpiRoundingPolicyBehavior);
|
settingsForm->addRow(tr("HiDPI scale factor rounding policy"), m_hiDpiRoundingPolicyBehavior);
|
||||||
|
|
||||||
m_stayOnTop->setChecked(Settings::instance()->stayOnTop());
|
m_stayOnTop->setChecked(Settings::instance()->stayOnTop());
|
||||||
|
m_useBuiltInCloseAnimation->setChecked(Settings::instance()->useBuiltInCloseAnimation());
|
||||||
m_useLightCheckerboard->setChecked(Settings::instance()->useLightCheckerboard());
|
m_useLightCheckerboard->setChecked(Settings::instance()->useLightCheckerboard());
|
||||||
|
m_loopGallery->setChecked(Settings::instance()->loopGallery());
|
||||||
|
m_autoLongImageMode->setChecked(Settings::instance()->autoLongImageMode());
|
||||||
m_doubleClickBehavior->setModel(new QStringListModel(dcbDropDown));
|
m_doubleClickBehavior->setModel(new QStringListModel(dcbDropDown));
|
||||||
Settings::DoubleClickBehavior dcb = Settings::instance()->doubleClickBehavior();
|
Settings::DoubleClickBehavior dcb = Settings::instance()->doubleClickBehavior();
|
||||||
m_doubleClickBehavior->setCurrentIndex(static_cast<int>(dcb));
|
m_doubleClickBehavior->setCurrentIndex(static_cast<int>(dcb));
|
||||||
@ -144,14 +153,34 @@ SettingsDialog::SettingsDialog(QWidget *parent)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
connect(m_stayOnTop, &QCheckBox::stateChanged, this, [ = ](int state){
|
#if QT_VERSION >= QT_VERSION_CHECK(6, 7, 0)
|
||||||
|
# define QCHECKBOX_CHECKSTATECHANGED QCheckBox::checkStateChanged
|
||||||
|
# define QT_CHECKSTATE Qt::CheckState
|
||||||
|
#else
|
||||||
|
# define QCHECKBOX_CHECKSTATECHANGED QCheckBox::stateChanged
|
||||||
|
# define QT_CHECKSTATE int
|
||||||
|
#endif // QT_VERSION >= QT_VERSION_CHECK(6, 7, 0)
|
||||||
|
|
||||||
|
connect(m_stayOnTop, &QCHECKBOX_CHECKSTATECHANGED, this, [ = ](QT_CHECKSTATE state){
|
||||||
Settings::instance()->setStayOnTop(state == Qt::Checked);
|
Settings::instance()->setStayOnTop(state == Qt::Checked);
|
||||||
});
|
});
|
||||||
|
|
||||||
connect(m_useLightCheckerboard, &QCheckBox::stateChanged, this, [ = ](int state){
|
connect(m_useBuiltInCloseAnimation, &QCHECKBOX_CHECKSTATECHANGED, this, [ = ](QT_CHECKSTATE state){
|
||||||
|
Settings::instance()->setUseBuiltInCloseAnimation(state == Qt::Checked);
|
||||||
|
});
|
||||||
|
|
||||||
|
connect(m_useLightCheckerboard, &QCHECKBOX_CHECKSTATECHANGED, this, [ = ](QT_CHECKSTATE state){
|
||||||
Settings::instance()->setUseLightCheckerboard(state == Qt::Checked);
|
Settings::instance()->setUseLightCheckerboard(state == Qt::Checked);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
connect(m_loopGallery, &QCHECKBOX_CHECKSTATECHANGED, this, [ = ](QT_CHECKSTATE state){
|
||||||
|
Settings::instance()->setLoopGallery(state == Qt::Checked);
|
||||||
|
});
|
||||||
|
|
||||||
|
connect(m_autoLongImageMode, &QCHECKBOX_CHECKSTATECHANGED, this, [ = ](QT_CHECKSTATE state){
|
||||||
|
Settings::instance()->setAutoLongImageMode(state == Qt::Checked);
|
||||||
|
});
|
||||||
|
|
||||||
connect(m_doubleClickBehavior, QOverload<int>::of(&QComboBox::currentIndexChanged), this, [ = ](int index){
|
connect(m_doubleClickBehavior, QOverload<int>::of(&QComboBox::currentIndexChanged), this, [ = ](int index){
|
||||||
Settings::instance()->setDoubleClickBehavior(_dc_options.at(index).first);
|
Settings::instance()->setDoubleClickBehavior(_dc_options.at(index).first);
|
||||||
});
|
});
|
||||||
|
@ -23,7 +23,10 @@ public slots:
|
|||||||
|
|
||||||
private:
|
private:
|
||||||
QCheckBox * m_stayOnTop = nullptr;
|
QCheckBox * m_stayOnTop = nullptr;
|
||||||
|
QCheckBox * m_useBuiltInCloseAnimation = nullptr;
|
||||||
QCheckBox * m_useLightCheckerboard = nullptr;
|
QCheckBox * m_useLightCheckerboard = nullptr;
|
||||||
|
QCheckBox * m_loopGallery = nullptr;
|
||||||
|
QCheckBox * m_autoLongImageMode = nullptr;
|
||||||
QComboBox * m_doubleClickBehavior = nullptr;
|
QComboBox * m_doubleClickBehavior = nullptr;
|
||||||
QComboBox * m_mouseWheelBehavior = nullptr;
|
QComboBox * m_mouseWheelBehavior = nullptr;
|
||||||
QComboBox * m_initWindowSizeBehavior = nullptr;
|
QComboBox * m_initWindowSizeBehavior = nullptr;
|
||||||
|
@ -40,11 +40,6 @@ ShortcutEditor::ShortcutEditor(ShortcutEdit * shortcutEdit, QWidget * parent)
|
|||||||
reloadShortcuts();
|
reloadShortcuts();
|
||||||
}
|
}
|
||||||
|
|
||||||
ShortcutEditor::~ShortcutEditor()
|
|
||||||
{
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
void ShortcutEditor::setDescription(const QString &desc)
|
void ShortcutEditor::setDescription(const QString &desc)
|
||||||
{
|
{
|
||||||
m_descriptionLabel->setText(desc);
|
m_descriptionLabel->setText(desc);
|
||||||
@ -63,9 +58,7 @@ 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)
|
||||||
|
@ -18,7 +18,7 @@ class ShortcutEditor : public QWidget
|
|||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
public:
|
public:
|
||||||
explicit ShortcutEditor(ShortcutEdit * shortcutEdit, QWidget * parent = nullptr);
|
explicit ShortcutEditor(ShortcutEdit * shortcutEdit, QWidget * parent = nullptr);
|
||||||
~ShortcutEditor();
|
~ShortcutEditor() = default;
|
||||||
|
|
||||||
void setDescription(const QString & desc);
|
void setDescription(const QString & desc);
|
||||||
|
|
||||||
|
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
12
appveyor.yml
12
appveyor.yml
@ -12,18 +12,10 @@ 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.3"
|
EXIV2_VERSION: "0.28.5"
|
||||||
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%
|
||||||
@ -98,7 +90,7 @@ build_script:
|
|||||||
- cd karchive
|
- cd karchive
|
||||||
- mkdir build
|
- mkdir build
|
||||||
- cd build
|
- cd build
|
||||||
- cmake .. -G "Ninja" -DWITH_LIBZSTD=OFF -DWITH_BZIP2=OFF -DWITH_LIBLZMA=OFF -DWITH_OPENSSL=OFF -DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_PREFIX=%CMAKE_INSTALL_PREFIX%
|
- cmake .. -G "Ninja" -DBUILD_TESTING=OFF -DWITH_LIBZSTD=OFF -DWITH_BZIP2=OFF -DWITH_LIBLZMA=OFF -DWITH_OPENSSL=OFF -DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_PREFIX=%CMAKE_INSTALL_PREFIX%
|
||||||
- cmake --build . --config Release
|
- cmake --build . --config Release
|
||||||
- cmake --build . --config Release --target install/strip
|
- cmake --build . --config Release --target install/strip
|
||||||
- cd %APPVEYOR_BUILD_FOLDER%
|
- cd %APPVEYOR_BUILD_FOLDER%
|
||||||
|
@ -80,16 +80,50 @@
|
|||||||
</screenshot>
|
</screenshot>
|
||||||
</screenshots>
|
</screenshots>
|
||||||
<releases>
|
<releases>
|
||||||
|
<release type="stable" version="1.1.1" date="2025-08-02T00:00:00Z">
|
||||||
|
<description>
|
||||||
|
<p>This release adds the following feature:</p>
|
||||||
|
<ul>
|
||||||
|
<li>Click dock icon should show window when it's hidden on macOS</li>
|
||||||
|
</ul>
|
||||||
|
<p>This release fixes the following bug:</p>
|
||||||
|
<ul>
|
||||||
|
<li>Ensure "Fit by Width" position the view to the beginning of the image</li>
|
||||||
|
</ul>
|
||||||
|
<p>This release includes the following changes:</p>
|
||||||
|
<ul>
|
||||||
|
<li>Update translations</li>
|
||||||
|
<li>Update Exiv2 version for Windows binary build</li>
|
||||||
|
</ul>
|
||||||
|
<p>With contributions from:</p>
|
||||||
|
<p>Heimen Stoffels, VenusGirl, தமிழ்நேரம்</p>
|
||||||
|
</description>
|
||||||
|
</release>
|
||||||
|
<release type="stable" version="1.1.0" date="2025-07-06T00:00:00Z">
|
||||||
|
<description>
|
||||||
|
<p>This release adds the following features:</p>
|
||||||
|
<ul>
|
||||||
|
<li>New option to disable built-in close window animation</li>
|
||||||
|
<li>New option to disable gallery looping</li>
|
||||||
|
<li>Support load m3u8 as image gallery playlist</li>
|
||||||
|
</ul>
|
||||||
|
<p>This release includes the following change:</p>
|
||||||
|
<ul>
|
||||||
|
<li>Drop Qt 5 support</li>
|
||||||
|
</ul>
|
||||||
|
<p>With contributions from:</p>
|
||||||
|
<p>Heimen Stoffels, albanobattistella, தமிழ்நேரம்</p>
|
||||||
|
</description>
|
||||||
|
</release>
|
||||||
<release type="stable" version="1.0.0" date="2025-05-03T00:00:00Z">
|
<release type="stable" version="1.0.0" date="2025-05-03T00:00:00Z">
|
||||||
<description>
|
<description>
|
||||||
<p>This release adds the following features:</p>
|
<p>This release adds the following features:</p>
|
||||||
<ul>
|
<ul>
|
||||||
<li>Support enforce windowed mode on start-up</li>
|
<li>Support enforces 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 bug:</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>
|
||||||
|
@ -1,9 +1,8 @@
|
|||||||
# SPDX-FileCopyrightText: 2024 Gary Wang <git@blumia.net>
|
# SPDX-FileCopyrightText: 2025 Gary Wang <git@blumia.net>
|
||||||
#
|
#
|
||||||
# SPDX-License-Identifier: MIT
|
# SPDX-License-Identifier: MIT
|
||||||
|
|
||||||
QT += core widgets gui svg
|
QT += core widgets gui svg svgwidgets
|
||||||
greaterThan(QT_MAJOR_VERSION, 5): QT += svgwidgets
|
|
||||||
|
|
||||||
TARGET = ppic
|
TARGET = ppic
|
||||||
TEMPLATE = app
|
TEMPLATE = app
|
||||||
|
Reference in New Issue
Block a user