Compare commits
8 Commits
1.1.0
...
b73df5ea1a
Author | SHA1 | Date | |
---|---|---|---|
b73df5ea1a | |||
4375fe1c2d | |||
4654cb21a0 | |||
ba23208a7a | |||
ed5a602332 | |||
347681e604 | |||
505ab9e2a6 | |||
c787e14a69 |
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
|
6
.github/workflows/windows.yml
vendored
6
.github/workflows/windows.yml
vendored
@ -72,9 +72,9 @@ jobs:
|
||||
set CMAKE_PREFIX_PATH=%PWD%/dependencies_bin
|
||||
mkdir dependencies_src
|
||||
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
|
||||
ren .\exiv2-0.28.3-2019msvc64 dependencies_bin
|
||||
ren .\exiv2-0.28.5-2022msvc-AMD64 dependencies_bin
|
||||
echo ::endgroup::
|
||||
echo ::group::===== zlib =====
|
||||
curl -fsSL -o zlib_src.zip https://zlib.net/zlib131.zip
|
||||
@ -109,7 +109,7 @@ jobs:
|
||||
echo ::endgroup::
|
||||
echo ::group::===== 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
|
||||
echo ::endgroup::
|
||||
echo ::group::===== KImageFormats =====
|
||||
|
@ -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
|
||||
|
||||
- Debian (since bullseye) or Ubuntu (since 21.04): `sudo apt install pineapple-pictures`
|
||||
- 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)
|
||||
[](https://repology.org/project/pineapple-pictures/versions)
|
||||
|
||||
## Help Translation!
|
||||
|
||||
|
@ -24,8 +24,7 @@
|
||||
|
||||
### 由贡献者/对应发行版的打包人员维护
|
||||
|
||||
- Debian (自 bullseye 起) 或 Ubuntu (自 21.04 起): `sudo apt install pineapple-pictures`
|
||||
- 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) 维护)
|
||||
[](https://repology.org/project/pineapple-pictures/versions)
|
||||
|
||||
## 帮助翻译!
|
||||
|
||||
|
@ -3,7 +3,7 @@ SPDX-PackageName = "Pineapple Pictures"
|
||||
SPDX-PackageDownloadLocation = "https://github.com/BLumia/pineapple-pictures"
|
||||
|
||||
[[annotations]]
|
||||
path = [".gitignore", "appveyor.yml", ".github/**"]
|
||||
path = [".gitattributes", ".git-blame-ignore-revs", ".gitignore", "appveyor.yml", ".github/**"]
|
||||
precedence = "aggregate"
|
||||
SPDX-FileCopyrightText = "None"
|
||||
SPDX-License-Identifier = "CC0-1.0"
|
||||
|
@ -171,21 +171,90 @@ void GraphicsView::fitByOrientation(Qt::Orientation ori, bool scaleDownOnly)
|
||||
{
|
||||
resetScale();
|
||||
|
||||
QRectF viewRect = this->viewport()->rect().adjusted(2, 2, -2, -2);
|
||||
QRectF viewRect = this->viewport()->rect();
|
||||
QRectF imageRect = transform().mapRect(sceneRect());
|
||||
QSize viewSize = viewRect.size().toSize();
|
||||
|
||||
qreal ratio;
|
||||
|
||||
if (ori == Qt::Horizontal) {
|
||||
// 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 {
|
||||
// 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);
|
||||
centerOn(imageRect.top(), 0);
|
||||
}
|
||||
|
||||
// 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);
|
||||
}
|
||||
|
||||
m_enableFitInView = false;
|
||||
|
||||
applyTransformationModeByScaleFactor();
|
||||
|
12
app/main.cpp
12
app/main.cpp
@ -76,6 +76,18 @@ int main(int argc, char *argv[])
|
||||
w.showUrls({url});
|
||||
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
|
||||
|
||||
QStringList urlStrList = parser.positionalArguments();
|
||||
|
@ -188,6 +188,7 @@ void MainWindow::showUrls(const QList<QUrl> &urls)
|
||||
m_pm->loadPlaylist(urls);
|
||||
} else {
|
||||
m_graphicsView->showText(tr("File url list is empty"));
|
||||
m_pm->setPlaylist(urls);
|
||||
return;
|
||||
}
|
||||
|
||||
@ -221,7 +222,7 @@ void MainWindow::adjustWindowSizeBySceneRect()
|
||||
|
||||
if (m_graphicsView->scaleFactor() < 1 || size().expandedTo(sceneSizeWithMargins) != size()) {
|
||||
// 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) {
|
||||
// we can show the picture by increase the window size.
|
||||
QSize finalSize = (screenSize.expandedTo(sceneSizeWithMargins) == screenSize) ?
|
||||
@ -583,7 +584,7 @@ void MainWindow::centerWindow()
|
||||
Qt::LeftToRight,
|
||||
Qt::AlignCenter,
|
||||
this->size(),
|
||||
qApp->screenAt(QCursor::pos())->availableGeometry()
|
||||
window()->screen()->availableGeometry()
|
||||
)
|
||||
);
|
||||
}
|
||||
|
@ -90,7 +90,7 @@ build_script:
|
||||
- cd karchive
|
||||
- mkdir 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 --target install/strip
|
||||
- cd %APPVEYOR_BUILD_FOLDER%
|
||||
|
Reference in New Issue
Block a user