Compare commits
26 Commits
Author | SHA1 | Date | |
---|---|---|---|
fb24e54579 | |||
3b1af64397 | |||
4dbfb2f881 | |||
fe0b36dc34 | |||
1864ff5b7f | |||
fb1ad2ba06 | |||
e3dfc9c673 | |||
eb648e3112 | |||
5495fa06d3 | |||
41e75f10b5 | |||
6b0e4b6767 | |||
f49ed645fc | |||
8fe860e4bf | |||
2d07290fbe | |||
5cbcbfecba | |||
03bb25c3ae | |||
a41f2af021 | |||
a694c2b037 | |||
3a6a4cbc68 | |||
a6cfd1a714 | |||
11ea4c9063 | |||
c51a603ec9 | |||
4a5fe4c289 | |||
6074a00b33 | |||
b5dc020795 | |||
3f91d8271b |
17
.github/workflows/macos.yml
vendored
Normal file
17
.github/workflows/macos.yml
vendored
Normal file
@ -0,0 +1,17 @@
|
|||||||
|
name: macOS CI
|
||||||
|
|
||||||
|
on: [push]
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
build:
|
||||||
|
|
||||||
|
runs-on: macos-latest
|
||||||
|
|
||||||
|
steps:
|
||||||
|
- uses: actions/checkout@v1
|
||||||
|
- name: Install Qt
|
||||||
|
uses: jurplel/install-qt-action@v2.2.1
|
||||||
|
- name: Run a qt project
|
||||||
|
run: |
|
||||||
|
cmake ./
|
||||||
|
make
|
20
.github/workflows/ubuntu.yml
vendored
Normal file
20
.github/workflows/ubuntu.yml
vendored
Normal file
@ -0,0 +1,20 @@
|
|||||||
|
name: Ubuntu 20.04 CI
|
||||||
|
|
||||||
|
on: [push]
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
build:
|
||||||
|
|
||||||
|
runs-on: ubuntu-20.04
|
||||||
|
|
||||||
|
steps:
|
||||||
|
- uses: actions/checkout@v1
|
||||||
|
- name: Get build dept.
|
||||||
|
run: sudo apt install cmake qtbase5-dev libqt5svg5-dev qttools5-dev
|
||||||
|
- name: Build it
|
||||||
|
run: |
|
||||||
|
mkdir build
|
||||||
|
cd build
|
||||||
|
cmake ../
|
||||||
|
make
|
||||||
|
sudo cpack
|
3
.gitignore
vendored
3
.gitignore
vendored
@ -3,3 +3,6 @@
|
|||||||
|
|
||||||
# Translation files
|
# Translation files
|
||||||
*.qm
|
*.qm
|
||||||
|
|
||||||
|
# Generic Build Dir
|
||||||
|
[Bb]uild/
|
||||||
|
150
CMakeLists.txt
Normal file
150
CMakeLists.txt
Normal file
@ -0,0 +1,150 @@
|
|||||||
|
project (pineapple-pictures)
|
||||||
|
|
||||||
|
cmake_minimum_required (VERSION 3.9.5)
|
||||||
|
|
||||||
|
include (GNUInstallDirs)
|
||||||
|
|
||||||
|
set (CMAKE_AUTOMOC ON)
|
||||||
|
set (CMAKE_AUTORCC ON)
|
||||||
|
set (QT_MINIMUM_VERSION "5.10")
|
||||||
|
|
||||||
|
find_package(Qt5 ${QT_MINIMUM_VERSION} CONFIG REQUIRED Widgets Svg LinguistTools)
|
||||||
|
|
||||||
|
set (PPIC_CPP_FILES
|
||||||
|
main.cpp
|
||||||
|
mainwindow.cpp
|
||||||
|
graphicsview.cpp
|
||||||
|
graphicsscene.cpp
|
||||||
|
bottombuttongroup.cpp
|
||||||
|
navigatorview.cpp
|
||||||
|
opacityhelper.cpp
|
||||||
|
toolbutton.cpp
|
||||||
|
)
|
||||||
|
|
||||||
|
set (PPIC_HEADER_FILES
|
||||||
|
mainwindow.h
|
||||||
|
graphicsview.h
|
||||||
|
graphicsscene.h
|
||||||
|
bottombuttongroup.h
|
||||||
|
navigatorview.h
|
||||||
|
opacityhelper.h
|
||||||
|
toolbutton.h
|
||||||
|
)
|
||||||
|
|
||||||
|
set (PPIC_QRC_FILES
|
||||||
|
resources.qrc
|
||||||
|
)
|
||||||
|
|
||||||
|
set (PPIC_RC_FILES
|
||||||
|
# yeah, it's empty.
|
||||||
|
)
|
||||||
|
|
||||||
|
set (EXE_NAME ppic)
|
||||||
|
|
||||||
|
# Translation
|
||||||
|
file (GLOB PPIC_TS_FILES languages/*.ts)
|
||||||
|
set (PPIC_CPP_FILES_FOR_I18N ${PPIC_CPP_FILES})
|
||||||
|
|
||||||
|
qt5_create_translation(PPIC_QM_FILES ${PPIC_CPP_FILES_FOR_I18N} ${PPIC_TS_FILES})
|
||||||
|
|
||||||
|
if (WIN32)
|
||||||
|
list(APPEND PPIC_RC_FILES pineapple-pictures.rc)
|
||||||
|
endif ()
|
||||||
|
|
||||||
|
add_executable (${EXE_NAME}
|
||||||
|
${PPIC_HEADER_FILES}
|
||||||
|
${PPIC_CPP_FILES}
|
||||||
|
${PPIC_QRC_FILES}
|
||||||
|
${PPIC_RC_FILES}
|
||||||
|
${PPIC_QM_FILES}
|
||||||
|
)
|
||||||
|
|
||||||
|
target_link_libraries (${EXE_NAME} Qt5::Widgets Qt5::Svg)
|
||||||
|
|
||||||
|
# Extra build settings
|
||||||
|
if (WIN32)
|
||||||
|
set_property (
|
||||||
|
TARGET ${EXE_NAME}
|
||||||
|
PROPERTY WIN32_EXECUTABLE true
|
||||||
|
)
|
||||||
|
endif ()
|
||||||
|
|
||||||
|
# Helper macros for install settings
|
||||||
|
macro (ppic_convert_to_relative_path _var)
|
||||||
|
# Make sure _var is a relative path
|
||||||
|
if (IS_ABSOLUTE "${${_var}}")
|
||||||
|
file (RELATIVE_PATH ${_var} "${CMAKE_INSTALL_PREFIX}" "${${_var}}")
|
||||||
|
endif ()
|
||||||
|
endmacro ()
|
||||||
|
|
||||||
|
# Install settings
|
||||||
|
if (WIN32)
|
||||||
|
# FIXME: try to avoid install to a "bin" subfolder under windows...
|
||||||
|
# when fixed, don't forget to update the CI config file...
|
||||||
|
set (BIN_INSTALL_DIR "") # seems useless, don't know why...
|
||||||
|
elseif (UNIX)
|
||||||
|
if (CMAKE_INSTALL_PREFIX_INITIALIZED_TO_DEFAULT)
|
||||||
|
set(CMAKE_INSTALL_PREFIX /usr)
|
||||||
|
endif ()
|
||||||
|
|
||||||
|
set (BIN_INSTALL_DIR "${CMAKE_INSTALL_BINDIR}") # relative, usually "bin"
|
||||||
|
ppic_convert_to_relative_path(BIN_INSTALL_DIR)
|
||||||
|
set (LIB_INSTALL_DIR "${CMAKE_INSTALL_LIBDIR}") # "lib" or "lib64"
|
||||||
|
ppic_convert_to_relative_path(LIB_INSTALL_DIR)
|
||||||
|
|
||||||
|
# install icon
|
||||||
|
install (
|
||||||
|
FILES icons/app-icon.svg
|
||||||
|
DESTINATION "${CMAKE_INSTALL_DATADIR}/icons/hicolor/48x48/apps"
|
||||||
|
RENAME pineapple-pictures.svg
|
||||||
|
)
|
||||||
|
|
||||||
|
# install shortcut
|
||||||
|
install (
|
||||||
|
FILES pineapple-pictures.desktop
|
||||||
|
DESTINATION "${CMAKE_INSTALL_DATAROOTDIR}/applications"
|
||||||
|
)
|
||||||
|
endif()
|
||||||
|
|
||||||
|
set (INSTALL_TARGETS_DEFAULT_ARGS
|
||||||
|
RUNTIME DESTINATION ${BIN_INSTALL_DIR}
|
||||||
|
LIBRARY DESTINATION ${LIB_INSTALL_DIR}
|
||||||
|
ARCHIVE DESTINATION ${LIB_INSTALL_DIR} COMPONENT Devel
|
||||||
|
)
|
||||||
|
|
||||||
|
install (
|
||||||
|
TARGETS ${EXE_NAME}
|
||||||
|
${INSTALL_TARGETS_DEFAULT_ARGS}
|
||||||
|
)
|
||||||
|
|
||||||
|
if (WIN32)
|
||||||
|
set (QM_FILE_INSTALL_DIR "${CMAKE_INSTALL_BINDIR}/translations")
|
||||||
|
else ()
|
||||||
|
set (QM_FILE_INSTALL_DIR "${CMAKE_INSTALL_FULL_DATADIR}/pineapple-pictures/translations")
|
||||||
|
target_compile_definitions(${EXE_NAME}
|
||||||
|
PRIVATE QM_FILE_INSTALL_DIR=${QM_FILE_INSTALL_DIR}
|
||||||
|
)
|
||||||
|
endif ()
|
||||||
|
|
||||||
|
install (
|
||||||
|
FILES ${PPIC_QM_FILES}
|
||||||
|
DESTINATION ${QM_FILE_INSTALL_DIR}
|
||||||
|
)
|
||||||
|
|
||||||
|
# CPACK: General Settings
|
||||||
|
set (CPACK_GENERATOR "TBZ2")
|
||||||
|
set (CPACK_PACKAGE_NAME "pineapple-pictures")
|
||||||
|
set (CPACK_PACKAGE_DESCRIPTION_SUMMARY "Yet another image viewer")
|
||||||
|
set (CPACK_PACKAGE_VENDOR "Gary Wang")
|
||||||
|
set (CPACK_PACKAGE_CONTACT "https://github.com/BLumia/PineapplePictures/issues/")
|
||||||
|
if (WIN32)
|
||||||
|
# ...
|
||||||
|
elseif (APPLE)
|
||||||
|
# ...
|
||||||
|
elseif (UNIX)
|
||||||
|
set (CPACK_SYSTEM_NAME "${CMAKE_SYSTEM_NAME}-${CMAKE_SYSTEM_PROCESSOR}")
|
||||||
|
set (CPACK_DEBIAN_PACKAGE_DEPENDS "libqt5svg5")
|
||||||
|
set (CPACK_DEBIAN_PACKAGE_RECOMMENDS "kimageformat-plugins")
|
||||||
|
endif()
|
||||||
|
|
||||||
|
include(CPack)
|
20
README.md
20
README.md
@ -1,9 +1,29 @@
|
|||||||
Yet another image viewer.
|
Yet another image viewer.
|
||||||
|
|
||||||
|
|CI|Build Status|
|
||||||
|
|---|---|
|
||||||
|
|Windows Build|[](https://ci.appveyor.com/project/BLumia/pineapplepictures/branch/master)|
|
||||||
|
|macOS Build||
|
||||||
|
|Ubuntu 20.04 Build||
|
||||||
|
|
||||||
|

|
||||||
|
|
||||||
|
## Get it!
|
||||||
|
|
||||||
|
- [GitHub Release Page](https://github.com/BLumia/PineapplePictures/releases)
|
||||||
|
- Archlinux AUR: [pineapple-pictures-git](https://aur.archlinux.org/packages/pineapple-pictures-git/)
|
||||||
|
|
||||||
|
## Help Translation!
|
||||||
|
|
||||||
|
[Translate this project on Transifex!](https://www.transifex.com/blumia/pineapple-pictures/)
|
||||||
|
|
||||||
|
Feel free to open up an issue to request an new language to translate.
|
||||||
|
|
||||||
## Uncleaned shits inside(TM):
|
## Uncleaned shits inside(TM):
|
||||||
|
|
||||||
- Mixed `CR LF` and `LF`.
|
- Mixed `CR LF` and `LF`.
|
||||||
- Ugly action icons.
|
- Ugly action icons.
|
||||||
|
- Ugly implementations.
|
||||||
- For windows build, win32 APIs are used.
|
- For windows build, win32 APIs are used.
|
||||||
- No drag-window-border-to-resize support under non-windows platforms (I use <kbd>Meta+Drag</kbd> to resize window under my x11 desktop).
|
- No drag-window-border-to-resize support under non-windows platforms (I use <kbd>Meta+Drag</kbd> to resize window under my x11 desktop).
|
||||||
|
|
||||||
|
46
appveyor.yml
46
appveyor.yml
@ -1,25 +1,49 @@
|
|||||||
environment:
|
environment:
|
||||||
|
CMAKE_INSTALL_ROOT: C:\projects\cmake
|
||||||
matrix:
|
matrix:
|
||||||
- build_name: mingw73_32_qt5_12_5
|
- build_name: mingw73_32_qt5_12_6
|
||||||
QTPATH: C:\Qt\5.12.5\mingw73_32
|
QTPATH: C:\Qt\5.12.6\mingw73_32
|
||||||
MINGW32: C:\Qt\Tools\mingw730_32
|
MINGW32: C:\Qt\Tools\mingw730_32
|
||||||
# - build_name: msvc2017_64
|
|
||||||
# QTPATH: C:\Qt\5.11.2\msvc2017_64
|
|
||||||
# MINGW32: C:\Qt\Tools\mingw530_32
|
|
||||||
|
|
||||||
install:
|
install:
|
||||||
|
- mkdir %CMAKE_INSTALL_ROOT%
|
||||||
- cd %APPVEYOR_BUILD_FOLDER%
|
- cd %APPVEYOR_BUILD_FOLDER%
|
||||||
- git submodule update --init --recursive
|
- git submodule update --init --recursive
|
||||||
- set PATH=%PATH%;%QTPATH%\bin;%MINGW32%\bin
|
- set PATH=%PATH%;%CMAKE_INSTALL_ROOT%;%QTPATH%\bin;%MINGW32%\bin
|
||||||
|
|
||||||
build_script:
|
build_script:
|
||||||
|
# prepare
|
||||||
|
- mkdir 3rdparty
|
||||||
|
- cinst ninja
|
||||||
|
# install ECM so we can build KImageFormats
|
||||||
|
- cd 3rdparty
|
||||||
|
- git clone -q https://invent.kde.org/frameworks/extra-cmake-modules.git
|
||||||
|
- cd extra-cmake-modules
|
||||||
|
- cmake -G "Ninja" . -DCMAKE_INSTALL_PREFIX=%CMAKE_INSTALL_ROOT%
|
||||||
|
- cmake --build .
|
||||||
|
- cmake --build . --target install
|
||||||
|
- cd %APPVEYOR_BUILD_FOLDER%
|
||||||
|
# install KImageFormats
|
||||||
|
- cd 3rdparty
|
||||||
|
- git clone -q https://invent.kde.org/frameworks/kimageformats.git
|
||||||
|
- cd kimageformats
|
||||||
- mkdir build
|
- mkdir build
|
||||||
- cd build
|
- cd build
|
||||||
- qmake ..\PineapplePictures.pro
|
- cmake .. -G "Unix Makefiles" -DCMAKE_BUILD_TYPE=Release -DCMAKE_CXX_FLAGS_RELEASE="-s" -DCMAKE_MAKE_PROGRAM=mingw32-make -DQT_PLUGIN_INSTALL_DIR=%QTPATH%\plugins
|
||||||
|
- cmake --build . --config Release
|
||||||
|
- cmake --build . --config Release --target install
|
||||||
|
- cd %APPVEYOR_BUILD_FOLDER%
|
||||||
|
# finally...
|
||||||
|
- mkdir build
|
||||||
|
- cd build
|
||||||
|
- cmake .. -G "Unix Makefiles" -DCMAKE_BUILD_TYPE=Release -DCMAKE_MAKE_PROGRAM=mingw32-make -DCMAKE_INSTALL_PREFIX='%cd%'
|
||||||
- mingw32-make
|
- mingw32-make
|
||||||
- cd release
|
- mingw32-make install
|
||||||
- del /a /f /q "*.o" "*.cpp" "*.h"
|
# fixme: I don't know how to NOT make the binary installed to the ./bin/ folder...
|
||||||
- windeployqt --no-quick-import --no-translations --no-opengl-sw --no-angle --no-system-d3d-compiler --release .\PineapplePictures.exe
|
- cd bin
|
||||||
|
- windeployqt --verbose=2 --no-quick-import --no-translations --no-opengl-sw --no-angle --no-system-d3d-compiler --release .\ppic.exe
|
||||||
|
# for debug..
|
||||||
|
- tree /f
|
||||||
|
|
||||||
artifacts:
|
artifacts:
|
||||||
- path: build\release
|
- path: build\bin
|
||||||
|
@ -8,6 +8,7 @@
|
|||||||
#include <QGraphicsSvgItem>
|
#include <QGraphicsSvgItem>
|
||||||
#include <QMovie>
|
#include <QMovie>
|
||||||
#include <QLabel>
|
#include <QLabel>
|
||||||
|
#include <QPainter>
|
||||||
|
|
||||||
GraphicsScene::GraphicsScene(QObject *parent)
|
GraphicsScene::GraphicsScene(QObject *parent)
|
||||||
: QGraphicsScene(parent)
|
: QGraphicsScene(parent)
|
||||||
@ -58,3 +59,24 @@ void GraphicsScene::showGif(const QString &filepath)
|
|||||||
QPen(Qt::transparent));
|
QPen(Qt::transparent));
|
||||||
this->setSceneRect(m_theThing->boundingRect());
|
this->setSceneRect(m_theThing->boundingRect());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool GraphicsScene::trySetTransformationMode(Qt::TransformationMode mode)
|
||||||
|
{
|
||||||
|
QGraphicsPixmapItem * pixmapItem = qgraphicsitem_cast<QGraphicsPixmapItem *>(m_theThing);
|
||||||
|
if (pixmapItem) {
|
||||||
|
pixmapItem->setTransformationMode(mode);
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
QPixmap GraphicsScene::renderToPixmap()
|
||||||
|
{
|
||||||
|
QPixmap pixmap(sceneRect().toRect().size());
|
||||||
|
pixmap.fill(Qt::transparent);
|
||||||
|
QPainter p(&pixmap);
|
||||||
|
render(&p, sceneRect());
|
||||||
|
|
||||||
|
return pixmap;
|
||||||
|
}
|
||||||
|
@ -15,6 +15,10 @@ public:
|
|||||||
void showSvg(const QString &filepath);
|
void showSvg(const QString &filepath);
|
||||||
void showGif(const QString &filepath);
|
void showGif(const QString &filepath);
|
||||||
|
|
||||||
|
bool trySetTransformationMode(Qt::TransformationMode mode);
|
||||||
|
|
||||||
|
QPixmap renderToPixmap();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
QGraphicsItem * m_theThing;
|
QGraphicsItem * m_theThing;
|
||||||
};
|
};
|
||||||
|
@ -39,8 +39,10 @@ void GraphicsView::showFileFromUrl(const QUrl &url, bool doRequestGallery)
|
|||||||
QImageReader imageReader(filePath);
|
QImageReader imageReader(filePath);
|
||||||
imageReader.setAutoTransform(true);
|
imageReader.setAutoTransform(true);
|
||||||
imageReader.setDecideFormatFromContent(true);
|
imageReader.setDecideFormatFromContent(true);
|
||||||
QImage::Format imageFormat = imageReader.imageFormat();
|
// Since if the image format / plugin does not support this feature, imageFormat() will returns an invalid format.
|
||||||
if (imageFormat == QImage::Format_Invalid) {
|
// So we cannot use imageFormat() and check if it returns QImage::Format_Invalid to detect if we support the file.
|
||||||
|
// QImage::Format imageFormat = imageReader.imageFormat();
|
||||||
|
if (imageReader.format().isEmpty()) {
|
||||||
showText(tr("File is not a valid image"));
|
showText(tr("File is not a valid image"));
|
||||||
} else {
|
} else {
|
||||||
showImage(QPixmap::fromImageReader(&imageReader));
|
showImage(QPixmap::fromImageReader(&imageReader));
|
||||||
@ -59,6 +61,13 @@ void GraphicsView::showImage(const QPixmap &pixmap)
|
|||||||
checkAndDoFitInView();
|
checkAndDoFitInView();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void GraphicsView::showImage(const QImage &image)
|
||||||
|
{
|
||||||
|
resetTransform();
|
||||||
|
scene()->showImage(QPixmap::fromImage(image));
|
||||||
|
checkAndDoFitInView();
|
||||||
|
}
|
||||||
|
|
||||||
void GraphicsView::showText(const QString &text)
|
void GraphicsView::showText(const QString &text)
|
||||||
{
|
{
|
||||||
resetTransform();
|
resetTransform();
|
||||||
@ -110,6 +119,7 @@ void GraphicsView::zoomView(qreal scaleFactor)
|
|||||||
{
|
{
|
||||||
m_enableFitInView = false;
|
m_enableFitInView = false;
|
||||||
scale(scaleFactor, scaleFactor);
|
scale(scaleFactor, scaleFactor);
|
||||||
|
applyTransformationModeByScaleFactor();
|
||||||
emit navigatorViewRequired(!isThingSmallerThanWindowWith(transform()), m_rotateAngle);
|
emit navigatorViewRequired(!isThingSmallerThanWindowWith(transform()), m_rotateAngle);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -129,6 +139,7 @@ void GraphicsView::rotateView(qreal rotateAngel)
|
|||||||
void GraphicsView::fitInView(const QRectF &rect, Qt::AspectRatioMode aspectRadioMode)
|
void GraphicsView::fitInView(const QRectF &rect, Qt::AspectRatioMode aspectRadioMode)
|
||||||
{
|
{
|
||||||
QGraphicsView::fitInView(rect, aspectRadioMode);
|
QGraphicsView::fitInView(rect, aspectRadioMode);
|
||||||
|
applyTransformationModeByScaleFactor();
|
||||||
}
|
}
|
||||||
|
|
||||||
void GraphicsView::checkAndDoFitInView()
|
void GraphicsView::checkAndDoFitInView()
|
||||||
@ -206,9 +217,9 @@ void GraphicsView::dragEnterEvent(QDragEnterEvent *event)
|
|||||||
} else {
|
} else {
|
||||||
event->ignore();
|
event->ignore();
|
||||||
}
|
}
|
||||||
qDebug() << event->mimeData() << "Drag Enter Event"
|
// qDebug() << event->mimeData() << "Drag Enter Event"
|
||||||
<< event->mimeData()->hasUrls() << event->mimeData()->hasImage()
|
// << event->mimeData()->hasUrls() << event->mimeData()->hasImage()
|
||||||
<< event->mimeData()->formats() << event->mimeData()->hasFormat("text/uri-list");
|
// << event->mimeData()->formats() << event->mimeData()->hasFormat("text/uri-list");
|
||||||
|
|
||||||
return QGraphicsView::dragEnterEvent(event);
|
return QGraphicsView::dragEnterEvent(event);
|
||||||
}
|
}
|
||||||
@ -231,7 +242,7 @@ void GraphicsView::dropEvent(QDropEvent *event)
|
|||||||
if (urls.isEmpty()) {
|
if (urls.isEmpty()) {
|
||||||
showText(tr("File url list is empty"));
|
showText(tr("File url list is empty"));
|
||||||
} else {
|
} else {
|
||||||
showFileFromUrl(urls.first());
|
showFileFromUrl(urls.first(), true);
|
||||||
}
|
}
|
||||||
} else if (mimeData->hasImage()) {
|
} else if (mimeData->hasImage()) {
|
||||||
QImage img = qvariant_cast<QImage>(mimeData->imageData());
|
QImage img = qvariant_cast<QImage>(mimeData->imageData());
|
||||||
@ -278,9 +289,9 @@ void GraphicsView::setCheckerboardEnabled(bool enabled)
|
|||||||
if (m_checkerboardEnabled) {
|
if (m_checkerboardEnabled) {
|
||||||
// Prepare background check-board pattern
|
// Prepare background check-board pattern
|
||||||
QPixmap tilePixmap(0x20, 0x20);
|
QPixmap tilePixmap(0x20, 0x20);
|
||||||
tilePixmap.fill(QColor(35, 35, 35, 110));
|
tilePixmap.fill(QColor(35, 35, 35, 170));
|
||||||
QPainter tilePainter(&tilePixmap);
|
QPainter tilePainter(&tilePixmap);
|
||||||
QColor color(40, 40, 40, 110);
|
QColor color(45, 45, 45, 170);
|
||||||
tilePainter.fillRect(0, 0, 0x10, 0x10, color);
|
tilePainter.fillRect(0, 0, 0x10, 0x10, color);
|
||||||
tilePainter.fillRect(0x10, 0x10, 0x10, 0x10, color);
|
tilePainter.fillRect(0x10, 0x10, 0x10, 0x10, color);
|
||||||
tilePainter.end();
|
tilePainter.end();
|
||||||
@ -291,6 +302,15 @@ void GraphicsView::setCheckerboardEnabled(bool enabled)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void GraphicsView::applyTransformationModeByScaleFactor()
|
||||||
|
{
|
||||||
|
if (this->scaleFactor() < 1) {
|
||||||
|
scene()->trySetTransformationMode(Qt::SmoothTransformation);
|
||||||
|
} else {
|
||||||
|
scene()->trySetTransformationMode(Qt::FastTransformation);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
void GraphicsView::resetWithScaleAndRotate(qreal scaleFactor, qreal rotateAngle)
|
void GraphicsView::resetWithScaleAndRotate(qreal scaleFactor, qreal rotateAngle)
|
||||||
{
|
{
|
||||||
QGraphicsView::resetTransform();
|
QGraphicsView::resetTransform();
|
||||||
|
@ -14,6 +14,7 @@ public:
|
|||||||
void showFileFromUrl(const QUrl &url, bool requestGallery = false);
|
void showFileFromUrl(const QUrl &url, bool requestGallery = false);
|
||||||
|
|
||||||
void showImage(const QPixmap &pixmap);
|
void showImage(const QPixmap &pixmap);
|
||||||
|
void showImage(const QImage &image);
|
||||||
void showText(const QString &text);
|
void showText(const QString &text);
|
||||||
void showSvg(const QString &filepath);
|
void showSvg(const QString &filepath);
|
||||||
void showGif(const QString &filepath);
|
void showGif(const QString &filepath);
|
||||||
@ -53,6 +54,7 @@ private:
|
|||||||
bool isThingSmallerThanWindowWith(const QTransform &transform) const;
|
bool isThingSmallerThanWindowWith(const QTransform &transform) const;
|
||||||
bool shouldIgnoreMousePressMoveEvent(const QMouseEvent *event) const;
|
bool shouldIgnoreMousePressMoveEvent(const QMouseEvent *event) const;
|
||||||
void setCheckerboardEnabled(bool enabled);
|
void setCheckerboardEnabled(bool enabled);
|
||||||
|
void applyTransformationModeByScaleFactor();
|
||||||
|
|
||||||
void resetWithScaleAndRotate(qreal scaleFactor, qreal rotateAngle);
|
void resetWithScaleAndRotate(qreal scaleFactor, qreal rotateAngle);
|
||||||
|
|
||||||
|
79
icons/go-next.svg
Normal file
79
icons/go-next.svg
Normal file
@ -0,0 +1,79 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
|
||||||
|
<svg
|
||||||
|
xmlns:dc="http://purl.org/dc/elements/1.1/"
|
||||||
|
xmlns:cc="http://creativecommons.org/ns#"
|
||||||
|
xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
|
||||||
|
xmlns:svg="http://www.w3.org/2000/svg"
|
||||||
|
xmlns="http://www.w3.org/2000/svg"
|
||||||
|
xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
|
||||||
|
xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
|
||||||
|
width="75"
|
||||||
|
height="75"
|
||||||
|
viewBox="0 0 19.84375 19.843751"
|
||||||
|
version="1.1"
|
||||||
|
id="svg8"
|
||||||
|
inkscape:version="1.0 (4035a4fb49, 2020-05-01)"
|
||||||
|
sodipodi:docname="go-next.svg">
|
||||||
|
<defs
|
||||||
|
id="defs2" />
|
||||||
|
<sodipodi:namedview
|
||||||
|
id="base"
|
||||||
|
pagecolor="#282929"
|
||||||
|
bordercolor="#666666"
|
||||||
|
borderopacity="1.0"
|
||||||
|
inkscape:pageopacity="0.76862745"
|
||||||
|
inkscape:pageshadow="2"
|
||||||
|
inkscape:zoom="16.000001"
|
||||||
|
inkscape:cx="35.333099"
|
||||||
|
inkscape:cy="37.582065"
|
||||||
|
inkscape:document-units="px"
|
||||||
|
inkscape:current-layer="layer1"
|
||||||
|
inkscape:document-rotation="0"
|
||||||
|
showgrid="false"
|
||||||
|
units="px"
|
||||||
|
inkscape:pagecheckerboard="false"
|
||||||
|
showguides="true"
|
||||||
|
inkscape:guide-bbox="true"
|
||||||
|
inkscape:window-width="1920"
|
||||||
|
inkscape:window-height="1001"
|
||||||
|
inkscape:window-x="-9"
|
||||||
|
inkscape:window-y="-9"
|
||||||
|
inkscape:window-maximized="1">
|
||||||
|
<sodipodi:guide
|
||||||
|
position="11.453565,9.9198082"
|
||||||
|
orientation="0,-1"
|
||||||
|
id="guide857" />
|
||||||
|
<sodipodi:guide
|
||||||
|
position="9.9229088,19.564698"
|
||||||
|
orientation="1,0"
|
||||||
|
id="guide837" />
|
||||||
|
</sodipodi:namedview>
|
||||||
|
<metadata
|
||||||
|
id="metadata5">
|
||||||
|
<rdf:RDF>
|
||||||
|
<cc:Work
|
||||||
|
rdf:about="">
|
||||||
|
<dc:format>image/svg+xml</dc:format>
|
||||||
|
<dc:type
|
||||||
|
rdf:resource="http://purl.org/dc/dcmitype/StillImage" />
|
||||||
|
<dc:title />
|
||||||
|
</cc:Work>
|
||||||
|
</rdf:RDF>
|
||||||
|
</metadata>
|
||||||
|
<g
|
||||||
|
inkscape:label="图层 1"
|
||||||
|
inkscape:groupmode="layer"
|
||||||
|
id="layer1">
|
||||||
|
<ellipse
|
||||||
|
style="opacity:1;fill:#000000;fill-opacity:0.15678;stroke:#ffffff;stroke-width:0.396875;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1"
|
||||||
|
id="path849"
|
||||||
|
cx="9.9368067"
|
||||||
|
cy="9.915391"
|
||||||
|
rx="8.6764698"
|
||||||
|
ry="8.9158831" />
|
||||||
|
<path
|
||||||
|
style="fill:none;stroke:#ffffff;stroke-width:0.396875;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1"
|
||||||
|
d="M 8.3550725,6.9255115 11.353504,9.9239423 8.3550725,12.91402"
|
||||||
|
id="path867" />
|
||||||
|
</g>
|
||||||
|
</svg>
|
After Width: | Height: | Size: 2.4 KiB |
79
icons/go-previous.svg
Normal file
79
icons/go-previous.svg
Normal file
@ -0,0 +1,79 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
|
||||||
|
<svg
|
||||||
|
xmlns:dc="http://purl.org/dc/elements/1.1/"
|
||||||
|
xmlns:cc="http://creativecommons.org/ns#"
|
||||||
|
xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
|
||||||
|
xmlns:svg="http://www.w3.org/2000/svg"
|
||||||
|
xmlns="http://www.w3.org/2000/svg"
|
||||||
|
xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
|
||||||
|
xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
|
||||||
|
sodipodi:docname="go-previous.svg"
|
||||||
|
inkscape:version="1.0 (4035a4fb49, 2020-05-01)"
|
||||||
|
id="svg8"
|
||||||
|
version="1.1"
|
||||||
|
viewBox="0 0 19.84375 19.843751"
|
||||||
|
height="75"
|
||||||
|
width="75">
|
||||||
|
<defs
|
||||||
|
id="defs2" />
|
||||||
|
<sodipodi:namedview
|
||||||
|
inkscape:window-maximized="1"
|
||||||
|
inkscape:window-y="-9"
|
||||||
|
inkscape:window-x="-9"
|
||||||
|
inkscape:window-height="1001"
|
||||||
|
inkscape:window-width="1920"
|
||||||
|
inkscape:guide-bbox="true"
|
||||||
|
showguides="true"
|
||||||
|
inkscape:pagecheckerboard="false"
|
||||||
|
units="px"
|
||||||
|
showgrid="false"
|
||||||
|
inkscape:document-rotation="0"
|
||||||
|
inkscape:current-layer="layer1"
|
||||||
|
inkscape:document-units="px"
|
||||||
|
inkscape:cy="45.995918"
|
||||||
|
inkscape:cx="29.794477"
|
||||||
|
inkscape:zoom="11.313709"
|
||||||
|
inkscape:pageshadow="2"
|
||||||
|
inkscape:pageopacity="0.76862745"
|
||||||
|
borderopacity="1.0"
|
||||||
|
bordercolor="#666666"
|
||||||
|
pagecolor="#282929"
|
||||||
|
id="base">
|
||||||
|
<sodipodi:guide
|
||||||
|
id="guide857"
|
||||||
|
orientation="0,-1"
|
||||||
|
position="11.453565,9.9198082" />
|
||||||
|
<sodipodi:guide
|
||||||
|
id="guide837"
|
||||||
|
orientation="1,0"
|
||||||
|
position="9.9229088,19.564698" />
|
||||||
|
</sodipodi:namedview>
|
||||||
|
<metadata
|
||||||
|
id="metadata5">
|
||||||
|
<rdf:RDF>
|
||||||
|
<cc:Work
|
||||||
|
rdf:about="">
|
||||||
|
<dc:format>image/svg+xml</dc:format>
|
||||||
|
<dc:type
|
||||||
|
rdf:resource="http://purl.org/dc/dcmitype/StillImage" />
|
||||||
|
<dc:title></dc:title>
|
||||||
|
</cc:Work>
|
||||||
|
</rdf:RDF>
|
||||||
|
</metadata>
|
||||||
|
<g
|
||||||
|
id="layer1"
|
||||||
|
inkscape:groupmode="layer"
|
||||||
|
inkscape:label="图层 1">
|
||||||
|
<ellipse
|
||||||
|
ry="8.9158831"
|
||||||
|
rx="8.6764698"
|
||||||
|
cy="9.915391"
|
||||||
|
cx="9.9368067"
|
||||||
|
id="path849"
|
||||||
|
style="opacity:1;fill:#000000;fill-opacity:0.15678;stroke:#ffffff;stroke-width:0.396875;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1" />
|
||||||
|
<path
|
||||||
|
id="path867"
|
||||||
|
d="M 11.494016,6.9255115 8.4955849,9.9239423 11.494016,12.91402"
|
||||||
|
style="fill:none;stroke:#ffffff;stroke-width:0.396875;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1" />
|
||||||
|
</g>
|
||||||
|
</svg>
|
After Width: | Height: | Size: 2.4 KiB |
@ -4,7 +4,7 @@
|
|||||||
<context>
|
<context>
|
||||||
<name>GraphicsScene</name>
|
<name>GraphicsScene</name>
|
||||||
<message>
|
<message>
|
||||||
<location filename="../graphicsscene.cpp" line="15"/>
|
<location filename="../graphicsscene.cpp" line="16"/>
|
||||||
<source>Drag image here</source>
|
<source>Drag image here</source>
|
||||||
<translation type="unfinished"></translation>
|
<translation type="unfinished"></translation>
|
||||||
</message>
|
</message>
|
||||||
@ -12,22 +12,22 @@
|
|||||||
<context>
|
<context>
|
||||||
<name>GraphicsView</name>
|
<name>GraphicsView</name>
|
||||||
<message>
|
<message>
|
||||||
<location filename="../graphicsview.cpp" line="32"/>
|
<location filename="../graphicsview.cpp" line="239"/>
|
||||||
<source>File url list is empty</source>
|
<source>File url list is empty</source>
|
||||||
<translation type="unfinished"></translation>
|
<translation type="unfinished"></translation>
|
||||||
</message>
|
</message>
|
||||||
<message>
|
<message>
|
||||||
<location filename="../graphicsview.cpp" line="46"/>
|
<location filename="../graphicsview.cpp" line="44"/>
|
||||||
<source>File is not a valid image</source>
|
<source>File is not a valid image</source>
|
||||||
<translation type="unfinished"></translation>
|
<translation type="unfinished"></translation>
|
||||||
</message>
|
</message>
|
||||||
<message>
|
<message>
|
||||||
<location filename="../graphicsview.cpp" line="238"/>
|
<location filename="../graphicsview.cpp" line="247"/>
|
||||||
<source>Image data is invalid</source>
|
<source>Image data is invalid</source>
|
||||||
<translation type="unfinished"></translation>
|
<translation type="unfinished"></translation>
|
||||||
</message>
|
</message>
|
||||||
<message>
|
<message>
|
||||||
<location filename="../graphicsview.cpp" line="245"/>
|
<location filename="../graphicsview.cpp" line="254"/>
|
||||||
<source>Not supported mimedata: %1</source>
|
<source>Not supported mimedata: %1</source>
|
||||||
<translation type="unfinished"></translation>
|
<translation type="unfinished"></translation>
|
||||||
</message>
|
</message>
|
||||||
@ -35,44 +35,74 @@
|
|||||||
<context>
|
<context>
|
||||||
<name>MainWindow</name>
|
<name>MainWindow</name>
|
||||||
<message>
|
<message>
|
||||||
<location filename="../mainwindow.cpp" line="229"/>
|
<location filename="../mainwindow.cpp" line="143"/>
|
||||||
<location filename="../mainwindow.cpp" line="248"/>
|
<source>File url list is empty</source>
|
||||||
|
<translation type="unfinished"></translation>
|
||||||
|
</message>
|
||||||
|
<message>
|
||||||
|
<location filename="../mainwindow.cpp" line="322"/>
|
||||||
|
<source>&Copy</source>
|
||||||
|
<translation type="unfinished"></translation>
|
||||||
|
</message>
|
||||||
|
<message>
|
||||||
|
<location filename="../mainwindow.cpp" line="343"/>
|
||||||
|
<source>Copy P&ixmap</source>
|
||||||
|
<translation type="unfinished"></translation>
|
||||||
|
</message>
|
||||||
|
<message>
|
||||||
|
<location filename="../mainwindow.cpp" line="348"/>
|
||||||
|
<source>Copy &File Path</source>
|
||||||
|
<translation type="unfinished"></translation>
|
||||||
|
</message>
|
||||||
|
<message>
|
||||||
|
<location filename="../mainwindow.cpp" line="358"/>
|
||||||
|
<source>&Paste Image</source>
|
||||||
|
<translation type="unfinished"></translation>
|
||||||
|
</message>
|
||||||
|
<message>
|
||||||
|
<location filename="../mainwindow.cpp" line="363"/>
|
||||||
|
<source>&Paste Image File</source>
|
||||||
|
<translation type="unfinished"></translation>
|
||||||
|
</message>
|
||||||
|
<message>
|
||||||
|
<location filename="../mainwindow.cpp" line="368"/>
|
||||||
|
<location filename="../mainwindow.cpp" line="387"/>
|
||||||
<source>Stay on top</source>
|
<source>Stay on top</source>
|
||||||
<translation type="unfinished"></translation>
|
<translation type="unfinished"></translation>
|
||||||
</message>
|
</message>
|
||||||
<message>
|
<message>
|
||||||
<location filename="../mainwindow.cpp" line="235"/>
|
<location filename="../mainwindow.cpp" line="374"/>
|
||||||
<location filename="../mainwindow.cpp" line="249"/>
|
<location filename="../mainwindow.cpp" line="388"/>
|
||||||
<source>Protected mode</source>
|
<source>Protected mode</source>
|
||||||
<translation type="unfinished"></translation>
|
<translation type="unfinished"></translation>
|
||||||
</message>
|
</message>
|
||||||
<message>
|
<message>
|
||||||
<location filename="../mainwindow.cpp" line="241"/>
|
<location filename="../mainwindow.cpp" line="380"/>
|
||||||
<source>Help</source>
|
<source>Help</source>
|
||||||
<translation type="unfinished"></translation>
|
<translation type="unfinished"></translation>
|
||||||
</message>
|
</message>
|
||||||
<message>
|
<message>
|
||||||
<location filename="../mainwindow.cpp" line="244"/>
|
<location filename="../mainwindow.cpp" line="383"/>
|
||||||
<source>Launch application with image file path as argument to load the file.</source>
|
<source>Launch application with image file path as argument to load the file.</source>
|
||||||
<translation type="unfinished"></translation>
|
<translation type="unfinished"></translation>
|
||||||
</message>
|
</message>
|
||||||
<message>
|
<message>
|
||||||
<location filename="../mainwindow.cpp" line="245"/>
|
<location filename="../mainwindow.cpp" line="384"/>
|
||||||
<source>Drag and drop image file onto the window is also supported.</source>
|
<source>Drag and drop image file onto the window is also supported.</source>
|
||||||
<translation type="unfinished"></translation>
|
<translation type="unfinished"></translation>
|
||||||
</message>
|
</message>
|
||||||
<message>
|
<message>
|
||||||
<location filename="../mainwindow.cpp" line="247"/>
|
<location filename="../mainwindow.cpp" line="386"/>
|
||||||
<source>Context menu option explanation:</source>
|
<source>Context menu option explanation:</source>
|
||||||
<translation type="unfinished"></translation>
|
<translation type="unfinished"></translation>
|
||||||
</message>
|
</message>
|
||||||
<message>
|
<message>
|
||||||
<location filename="../mainwindow.cpp" line="248"/>
|
<location filename="../mainwindow.cpp" line="387"/>
|
||||||
<source>Make window stay on top of all other windows.</source>
|
<source>Make window stay on top of all other windows.</source>
|
||||||
<translation type="unfinished"></translation>
|
<translation type="unfinished"></translation>
|
||||||
</message>
|
</message>
|
||||||
<message>
|
<message>
|
||||||
<location filename="../mainwindow.cpp" line="249"/>
|
<location filename="../mainwindow.cpp" line="388"/>
|
||||||
<source>Avoid close window accidentally. (eg. by double clicking the window)</source>
|
<source>Avoid close window accidentally. (eg. by double clicking the window)</source>
|
||||||
<translation type="unfinished"></translation>
|
<translation type="unfinished"></translation>
|
||||||
</message>
|
</message>
|
||||||
@ -80,7 +110,7 @@
|
|||||||
<context>
|
<context>
|
||||||
<name>main</name>
|
<name>main</name>
|
||||||
<message>
|
<message>
|
||||||
<location filename="../main.cpp" line="18"/>
|
<location filename="../main.cpp" line="24"/>
|
||||||
<source>File list.</source>
|
<source>File list.</source>
|
||||||
<translation type="unfinished"></translation>
|
<translation type="unfinished"></translation>
|
||||||
</message>
|
</message>
|
||||||
|
@ -4,7 +4,7 @@
|
|||||||
<context>
|
<context>
|
||||||
<name>GraphicsScene</name>
|
<name>GraphicsScene</name>
|
||||||
<message>
|
<message>
|
||||||
<location filename="../graphicsscene.cpp" line="15"/>
|
<location filename="../graphicsscene.cpp" line="16"/>
|
||||||
<source>Drag image here</source>
|
<source>Drag image here</source>
|
||||||
<translation>拖放图片至此</translation>
|
<translation>拖放图片至此</translation>
|
||||||
</message>
|
</message>
|
||||||
@ -12,22 +12,22 @@
|
|||||||
<context>
|
<context>
|
||||||
<name>GraphicsView</name>
|
<name>GraphicsView</name>
|
||||||
<message>
|
<message>
|
||||||
<location filename="../graphicsview.cpp" line="32"/>
|
<location filename="../graphicsview.cpp" line="239"/>
|
||||||
<source>File url list is empty</source>
|
<source>File url list is empty</source>
|
||||||
<translation>文件 URL 列表为空</translation>
|
<translation>文件 URL 列表为空</translation>
|
||||||
</message>
|
</message>
|
||||||
<message>
|
<message>
|
||||||
<location filename="../graphicsview.cpp" line="46"/>
|
<location filename="../graphicsview.cpp" line="44"/>
|
||||||
<source>File is not a valid image</source>
|
<source>File is not a valid image</source>
|
||||||
<translation>文件不是有效的图片文件</translation>
|
<translation>文件不是有效的图片文件</translation>
|
||||||
</message>
|
</message>
|
||||||
<message>
|
<message>
|
||||||
<location filename="../graphicsview.cpp" line="238"/>
|
<location filename="../graphicsview.cpp" line="247"/>
|
||||||
<source>Image data is invalid</source>
|
<source>Image data is invalid</source>
|
||||||
<translation>图片数据无效</translation>
|
<translation>图片数据无效</translation>
|
||||||
</message>
|
</message>
|
||||||
<message>
|
<message>
|
||||||
<location filename="../graphicsview.cpp" line="245"/>
|
<location filename="../graphicsview.cpp" line="254"/>
|
||||||
<source>Not supported mimedata: %1</source>
|
<source>Not supported mimedata: %1</source>
|
||||||
<translation>不受支持的 MimeData 格式:%1</translation>
|
<translation>不受支持的 MimeData 格式:%1</translation>
|
||||||
</message>
|
</message>
|
||||||
@ -35,44 +35,78 @@
|
|||||||
<context>
|
<context>
|
||||||
<name>MainWindow</name>
|
<name>MainWindow</name>
|
||||||
<message>
|
<message>
|
||||||
<location filename="../mainwindow.cpp" line="229"/>
|
<location filename="../mainwindow.cpp" line="143"/>
|
||||||
<location filename="../mainwindow.cpp" line="248"/>
|
<source>File url list is empty</source>
|
||||||
|
<translation>文件 URL 列表为空</translation>
|
||||||
|
</message>
|
||||||
|
<message>
|
||||||
|
<location filename="../mainwindow.cpp" line="322"/>
|
||||||
|
<source>&Copy</source>
|
||||||
|
<translation>复制(&C)</translation>
|
||||||
|
</message>
|
||||||
|
<message>
|
||||||
|
<source>Copy &Pixmap</source>
|
||||||
|
<translation type="vanished">复制位图(&P)</translation>
|
||||||
|
</message>
|
||||||
|
<message>
|
||||||
|
<location filename="../mainwindow.cpp" line="343"/>
|
||||||
|
<source>Copy P&ixmap</source>
|
||||||
|
<translation>复制位图(&I)</translation>
|
||||||
|
</message>
|
||||||
|
<message>
|
||||||
|
<location filename="../mainwindow.cpp" line="348"/>
|
||||||
|
<source>Copy &File Path</source>
|
||||||
|
<translation>复制文件路径(&F)</translation>
|
||||||
|
</message>
|
||||||
|
<message>
|
||||||
|
<location filename="../mainwindow.cpp" line="358"/>
|
||||||
|
<source>&Paste Image</source>
|
||||||
|
<translation>粘贴图像(&P)</translation>
|
||||||
|
</message>
|
||||||
|
<message>
|
||||||
|
<location filename="../mainwindow.cpp" line="363"/>
|
||||||
|
<source>&Paste Image File</source>
|
||||||
|
<translation>粘贴图像文件(&P)</translation>
|
||||||
|
</message>
|
||||||
|
<message>
|
||||||
|
<location filename="../mainwindow.cpp" line="368"/>
|
||||||
|
<location filename="../mainwindow.cpp" line="387"/>
|
||||||
<source>Stay on top</source>
|
<source>Stay on top</source>
|
||||||
<translation>总在最前</translation>
|
<translation>总在最前</translation>
|
||||||
</message>
|
</message>
|
||||||
<message>
|
<message>
|
||||||
<location filename="../mainwindow.cpp" line="235"/>
|
<location filename="../mainwindow.cpp" line="374"/>
|
||||||
<location filename="../mainwindow.cpp" line="249"/>
|
<location filename="../mainwindow.cpp" line="388"/>
|
||||||
<source>Protected mode</source>
|
<source>Protected mode</source>
|
||||||
<translation>保护模式</translation>
|
<translation>保护模式</translation>
|
||||||
</message>
|
</message>
|
||||||
<message>
|
<message>
|
||||||
<location filename="../mainwindow.cpp" line="241"/>
|
<location filename="../mainwindow.cpp" line="380"/>
|
||||||
<source>Help</source>
|
<source>Help</source>
|
||||||
<translation>帮助</translation>
|
<translation>帮助</translation>
|
||||||
</message>
|
</message>
|
||||||
<message>
|
<message>
|
||||||
<location filename="../mainwindow.cpp" line="244"/>
|
<location filename="../mainwindow.cpp" line="383"/>
|
||||||
<source>Launch application with image file path as argument to load the file.</source>
|
<source>Launch application with image file path as argument to load the file.</source>
|
||||||
<translation>以图片文件的路径作为参数运行程序即可直接打开图片文件。</translation>
|
<translation>以图片文件的路径作为参数运行程序即可直接打开图片文件。</translation>
|
||||||
</message>
|
</message>
|
||||||
<message>
|
<message>
|
||||||
<location filename="../mainwindow.cpp" line="245"/>
|
<location filename="../mainwindow.cpp" line="384"/>
|
||||||
<source>Drag and drop image file onto the window is also supported.</source>
|
<source>Drag and drop image file onto the window is also supported.</source>
|
||||||
<translation>也支持拖放图片文件到窗口内来加载图片。</translation>
|
<translation>也支持拖放图片文件到窗口内来加载图片。</translation>
|
||||||
</message>
|
</message>
|
||||||
<message>
|
<message>
|
||||||
<location filename="../mainwindow.cpp" line="247"/>
|
<location filename="../mainwindow.cpp" line="386"/>
|
||||||
<source>Context menu option explanation:</source>
|
<source>Context menu option explanation:</source>
|
||||||
<translation>菜单项说明:</translation>
|
<translation>菜单项说明:</translation>
|
||||||
</message>
|
</message>
|
||||||
<message>
|
<message>
|
||||||
<location filename="../mainwindow.cpp" line="248"/>
|
<location filename="../mainwindow.cpp" line="387"/>
|
||||||
<source>Make window stay on top of all other windows.</source>
|
<source>Make window stay on top of all other windows.</source>
|
||||||
<translation>使窗口始终至于其它非置顶窗口上方。</translation>
|
<translation>使窗口始终至于其它非置顶窗口上方。</translation>
|
||||||
</message>
|
</message>
|
||||||
<message>
|
<message>
|
||||||
<location filename="../mainwindow.cpp" line="249"/>
|
<location filename="../mainwindow.cpp" line="388"/>
|
||||||
<source>Avoid close window accidentally. (eg. by double clicking the window)</source>
|
<source>Avoid close window accidentally. (eg. by double clicking the window)</source>
|
||||||
<translation>避免窗口意外关闭。(如:不小心双击了窗口触发了关闭窗口行为)</translation>
|
<translation>避免窗口意外关闭。(如:不小心双击了窗口触发了关闭窗口行为)</translation>
|
||||||
</message>
|
</message>
|
||||||
@ -80,7 +114,7 @@
|
|||||||
<context>
|
<context>
|
||||||
<name>main</name>
|
<name>main</name>
|
||||||
<message>
|
<message>
|
||||||
<location filename="../main.cpp" line="18"/>
|
<location filename="../main.cpp" line="24"/>
|
||||||
<source>File list.</source>
|
<source>File list.</source>
|
||||||
<translation>文件列表。</translation>
|
<translation>文件列表。</translation>
|
||||||
</message>
|
</message>
|
||||||
|
15
main.cpp
15
main.cpp
@ -1,16 +1,27 @@
|
|||||||
#include "mainwindow.h"
|
#include "mainwindow.h"
|
||||||
#include <QApplication>
|
#include <QApplication>
|
||||||
#include <QCommandLineParser>
|
#include <QCommandLineParser>
|
||||||
|
#include <QDir>
|
||||||
#include <QTranslator>
|
#include <QTranslator>
|
||||||
#include <QUrl>
|
#include <QUrl>
|
||||||
|
|
||||||
|
// QM_FILE_INSTALL_DIR should be defined from the CMakeLists file.
|
||||||
|
#ifndef QM_FILE_INSTALL_DIR
|
||||||
|
#define QM_FILE_INSTALL_DIR ":/i18n/"
|
||||||
|
#endif // QM_FILE_INSTALL_DIR
|
||||||
|
|
||||||
int main(int argc, char *argv[])
|
int main(int argc, char *argv[])
|
||||||
{
|
{
|
||||||
QApplication a(argc, argv);
|
QApplication a(argc, argv);
|
||||||
|
|
||||||
// since we did `CONFIG += lrelease embed_translations`...
|
|
||||||
QTranslator translator;
|
QTranslator translator;
|
||||||
translator.load(QString("PineapplePictures_%1").arg(QLocale::system().name()), ":/i18n/");
|
QString qmDir;
|
||||||
|
#ifdef _WIN32
|
||||||
|
qmDir = QDir(QCoreApplication::applicationDirPath()).absoluteFilePath("translations");
|
||||||
|
#else
|
||||||
|
qmDir = QT_STRINGIFY(QM_FILE_INSTALL_DIR);
|
||||||
|
#endif
|
||||||
|
translator.load(QString("PineapplePictures_%1").arg(QLocale::system().name()), qmDir);
|
||||||
a.installTranslator(&translator);
|
a.installTranslator(&translator);
|
||||||
|
|
||||||
// parse commandline arguments
|
// parse commandline arguments
|
||||||
|
150
mainwindow.cpp
150
mainwindow.cpp
@ -17,6 +17,8 @@
|
|||||||
#include <QShortcut>
|
#include <QShortcut>
|
||||||
#include <QDir>
|
#include <QDir>
|
||||||
#include <QCollator>
|
#include <QCollator>
|
||||||
|
#include <QClipboard>
|
||||||
|
#include <QMimeData>
|
||||||
|
|
||||||
#ifdef _WIN32
|
#ifdef _WIN32
|
||||||
#include <windows.h>
|
#include <windows.h>
|
||||||
@ -29,6 +31,7 @@ MainWindow::MainWindow(QWidget *parent) :
|
|||||||
this->setAttribute(Qt::WA_TranslucentBackground, true);
|
this->setAttribute(Qt::WA_TranslucentBackground, true);
|
||||||
this->setMinimumSize(710, 530);
|
this->setMinimumSize(710, 530);
|
||||||
this->setWindowIcon(QIcon(":/icons/app-icon.svg"));
|
this->setWindowIcon(QIcon(":/icons/app-icon.svg"));
|
||||||
|
this->setMouseTracking(true);
|
||||||
|
|
||||||
m_fadeOutAnimation = new QPropertyAnimation(this, "windowOpacity");
|
m_fadeOutAnimation = new QPropertyAnimation(this, "windowOpacity");
|
||||||
m_fadeOutAnimation->setDuration(300);
|
m_fadeOutAnimation->setDuration(300);
|
||||||
@ -70,13 +73,29 @@ MainWindow::MainWindow(QWidget *parent) :
|
|||||||
connect(m_graphicsView, &GraphicsView::requestGallery,
|
connect(m_graphicsView, &GraphicsView::requestGallery,
|
||||||
this, &MainWindow::loadGalleryBySingleLocalFile);
|
this, &MainWindow::loadGalleryBySingleLocalFile);
|
||||||
|
|
||||||
m_closeButton = new ToolButton(m_graphicsView);
|
m_closeButton = new ToolButton(true, m_graphicsView);
|
||||||
m_closeButton->setIcon(QIcon(":/icons/window-close"));
|
m_closeButton->setIcon(QIcon(":/icons/window-close"));
|
||||||
m_closeButton->setIconSize(QSize(50, 50));
|
m_closeButton->setIconSize(QSize(50, 50));
|
||||||
|
|
||||||
connect(m_closeButton, &QAbstractButton::clicked,
|
connect(m_closeButton, &QAbstractButton::clicked,
|
||||||
this, &MainWindow::closeWindow);
|
this, &MainWindow::closeWindow);
|
||||||
|
|
||||||
|
m_prevButton = new ToolButton(false, m_graphicsView);
|
||||||
|
m_prevButton->setIcon(QIcon(":/icons/go-previous"));
|
||||||
|
m_prevButton->setIconSize(QSize(75, 75));
|
||||||
|
m_prevButton->setVisible(false);
|
||||||
|
m_prevButton->setOpacity(0, false);
|
||||||
|
m_nextButton = new ToolButton(false, m_graphicsView);
|
||||||
|
m_nextButton->setIcon(QIcon(":/icons/go-next"));
|
||||||
|
m_nextButton->setIconSize(QSize(75, 75));
|
||||||
|
m_nextButton->setVisible(false);
|
||||||
|
m_nextButton->setOpacity(0, false);
|
||||||
|
|
||||||
|
connect(m_prevButton, &QAbstractButton::clicked,
|
||||||
|
this, &MainWindow::galleryPrev);
|
||||||
|
connect(m_nextButton, &QAbstractButton::clicked,
|
||||||
|
this, &MainWindow::galleryNext);
|
||||||
|
|
||||||
m_bottomButtonGroup = new BottomButtonGroup(this);
|
m_bottomButtonGroup = new BottomButtonGroup(this);
|
||||||
|
|
||||||
connect(m_bottomButtonGroup, &BottomButtonGroup::resetToOriginalBtnClicked,
|
connect(m_bottomButtonGroup, &BottomButtonGroup::resetToOriginalBtnClicked,
|
||||||
@ -107,10 +126,19 @@ 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(this, &MainWindow::galleryLoaded, this, [this]() {
|
||||||
|
m_prevButton->setVisible(isGalleryAvailable());
|
||||||
|
m_nextButton->setVisible(isGalleryAvailable());
|
||||||
|
});
|
||||||
|
|
||||||
QShortcut * quitAppShorucut = new QShortcut(QKeySequence(Qt::Key_Space), this);
|
QShortcut * quitAppShorucut = new QShortcut(QKeySequence(Qt::Key_Space), this);
|
||||||
connect(quitAppShorucut, &QShortcut::activated,
|
connect(quitAppShorucut, &QShortcut::activated,
|
||||||
std::bind(&MainWindow::quitAppAction, this, false));
|
std::bind(&MainWindow::quitAppAction, this, false));
|
||||||
|
|
||||||
|
QShortcut * quitAppShorucut2 = new QShortcut(QKeySequence(Qt::Key_Escape), this);
|
||||||
|
connect(quitAppShorucut2, &QShortcut::activated,
|
||||||
|
std::bind(&MainWindow::quitAppAction, this, false));
|
||||||
|
|
||||||
QShortcut * prevPictureShorucut = new QShortcut(QKeySequence(Qt::Key_PageUp), this);
|
QShortcut * prevPictureShorucut = new QShortcut(QKeySequence(Qt::Key_PageUp), this);
|
||||||
connect(prevPictureShorucut, &QShortcut::activated,
|
connect(prevPictureShorucut, &QShortcut::activated,
|
||||||
this, &MainWindow::galleryPrev);
|
this, &MainWindow::galleryPrev);
|
||||||
@ -119,6 +147,10 @@ MainWindow::MainWindow(QWidget *parent) :
|
|||||||
connect(nextPictureShorucut, &QShortcut::activated,
|
connect(nextPictureShorucut, &QShortcut::activated,
|
||||||
this, &MainWindow::galleryNext);
|
this, &MainWindow::galleryNext);
|
||||||
|
|
||||||
|
QShortcut * fullscreenShorucut = new QShortcut(QKeySequence(QKeySequence::FullScreen), this);
|
||||||
|
connect(fullscreenShorucut, &QShortcut::activated,
|
||||||
|
this, &MainWindow::toggleFullscreen);
|
||||||
|
|
||||||
centerWindow();
|
centerWindow();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -173,12 +205,28 @@ void MainWindow::adjustWindowSizeBySceneRect()
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// can be empty if it is NOT from a local file.
|
||||||
|
QUrl MainWindow::currentImageFileUrl() const
|
||||||
|
{
|
||||||
|
if (m_currentFileIndex != -1) {
|
||||||
|
return m_files.value(m_currentFileIndex);
|
||||||
|
}
|
||||||
|
|
||||||
|
return QUrl();
|
||||||
|
}
|
||||||
|
|
||||||
|
void MainWindow::clearGallery()
|
||||||
|
{
|
||||||
|
m_currentFileIndex = -1;
|
||||||
|
m_files.clear();
|
||||||
|
}
|
||||||
|
|
||||||
void MainWindow::loadGalleryBySingleLocalFile(const QString &path)
|
void MainWindow::loadGalleryBySingleLocalFile(const QString &path)
|
||||||
{
|
{
|
||||||
QFileInfo info(path);
|
QFileInfo info(path);
|
||||||
QDir dir(info.path());
|
QDir dir(info.path());
|
||||||
QString currentFileName = info.fileName();
|
QString currentFileName = info.fileName();
|
||||||
QStringList entryList = dir.entryList({"*.jpg", "*.jpeg", "*.png", "*.gif", "*.svg"},
|
QStringList entryList = dir.entryList({"*.jpg", "*.jpeg", "*.jfif", "*.png", "*.gif", "*.svg", "*.bmp"},
|
||||||
QDir::Files | QDir::NoSymLinks, QDir::NoSort);
|
QDir::Files | QDir::NoSymLinks, QDir::NoSort);
|
||||||
|
|
||||||
QCollator collator;
|
QCollator collator;
|
||||||
@ -186,8 +234,7 @@ void MainWindow::loadGalleryBySingleLocalFile(const QString &path)
|
|||||||
|
|
||||||
std::sort(entryList.begin(), entryList.end(), collator);
|
std::sort(entryList.begin(), entryList.end(), collator);
|
||||||
|
|
||||||
m_currentFileIndex = -1;
|
clearGallery();
|
||||||
m_files.clear();
|
|
||||||
|
|
||||||
for (int i = 0; i < entryList.count(); i++) {
|
for (int i = 0; i < entryList.count(); i++) {
|
||||||
const QString & oneEntry = entryList.at(i);
|
const QString & oneEntry = entryList.at(i);
|
||||||
@ -197,13 +244,13 @@ void MainWindow::loadGalleryBySingleLocalFile(const QString &path)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
qDebug() << m_files << m_currentFileIndex;
|
emit galleryLoaded();
|
||||||
}
|
}
|
||||||
|
|
||||||
void MainWindow::galleryPrev()
|
void MainWindow::galleryPrev()
|
||||||
{
|
{
|
||||||
int count = m_files.count();
|
int count = m_files.count();
|
||||||
if (m_currentFileIndex < 0 || m_files.isEmpty() || m_currentFileIndex >= m_files.count()) {
|
if (!isGalleryAvailable()) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -215,7 +262,7 @@ void MainWindow::galleryPrev()
|
|||||||
void MainWindow::galleryNext()
|
void MainWindow::galleryNext()
|
||||||
{
|
{
|
||||||
int count = m_files.count();
|
int count = m_files.count();
|
||||||
if (m_currentFileIndex < 0 || m_files.isEmpty() || m_currentFileIndex >= m_files.count()) {
|
if (!isGalleryAvailable()) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -224,6 +271,14 @@ void MainWindow::galleryNext()
|
|||||||
m_graphicsView->showFileFromUrl(m_files.at(m_currentFileIndex), false);
|
m_graphicsView->showFileFromUrl(m_files.at(m_currentFileIndex), false);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool MainWindow::isGalleryAvailable()
|
||||||
|
{
|
||||||
|
if (m_currentFileIndex < 0 || m_files.isEmpty() || m_currentFileIndex >= m_files.count()) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
void MainWindow::showEvent(QShowEvent *event)
|
void MainWindow::showEvent(QShowEvent *event)
|
||||||
{
|
{
|
||||||
updateWidgetsPosition();
|
updateWidgetsPosition();
|
||||||
@ -237,6 +292,8 @@ void MainWindow::enterEvent(QEvent *event)
|
|||||||
m_gv->setOpacity(1);
|
m_gv->setOpacity(1);
|
||||||
|
|
||||||
m_closeButton->setOpacity(1);
|
m_closeButton->setOpacity(1);
|
||||||
|
m_prevButton->setOpacity(1);
|
||||||
|
m_nextButton->setOpacity(1);
|
||||||
|
|
||||||
return QMainWindow::enterEvent(event);
|
return QMainWindow::enterEvent(event);
|
||||||
}
|
}
|
||||||
@ -247,6 +304,8 @@ void MainWindow::leaveEvent(QEvent *event)
|
|||||||
m_gv->setOpacity(0);
|
m_gv->setOpacity(0);
|
||||||
|
|
||||||
m_closeButton->setOpacity(0);
|
m_closeButton->setOpacity(0);
|
||||||
|
m_prevButton->setOpacity(0);
|
||||||
|
m_nextButton->setOpacity(0);
|
||||||
|
|
||||||
return QMainWindow::leaveEvent(event);
|
return QMainWindow::leaveEvent(event);
|
||||||
}
|
}
|
||||||
@ -256,8 +315,8 @@ void MainWindow::mousePressEvent(QMouseEvent *event)
|
|||||||
if (event->buttons() & Qt::LeftButton && !isMaximized()) {
|
if (event->buttons() & Qt::LeftButton && !isMaximized()) {
|
||||||
m_clickedOnWindow = true;
|
m_clickedOnWindow = true;
|
||||||
m_oldMousePos = event->pos();
|
m_oldMousePos = event->pos();
|
||||||
qDebug() << m_oldMousePos << m_graphicsView->transform().m11()
|
// qDebug() << m_oldMousePos << m_graphicsView->transform().m11()
|
||||||
<< m_graphicsView->transform().m22() << m_graphicsView->matrix().m12();
|
// << m_graphicsView->transform().m22() << m_graphicsView->matrix().m12();
|
||||||
event->accept();
|
event->accept();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -307,6 +366,53 @@ void MainWindow::resizeEvent(QResizeEvent *event)
|
|||||||
void MainWindow::contextMenuEvent(QContextMenuEvent *event)
|
void MainWindow::contextMenuEvent(QContextMenuEvent *event)
|
||||||
{
|
{
|
||||||
QMenu * menu = new QMenu;
|
QMenu * menu = new QMenu;
|
||||||
|
QMenu * copyMenu = new QMenu(tr("&Copy"));
|
||||||
|
QUrl currentFileUrl = currentImageFileUrl();
|
||||||
|
QImage clipboardImage;
|
||||||
|
QUrl clipboardFileUrl;
|
||||||
|
|
||||||
|
const QMimeData * clipboardData = QApplication::clipboard()->mimeData();
|
||||||
|
if (clipboardData->hasImage()) {
|
||||||
|
QVariant imageVariant(clipboardData->imageData());
|
||||||
|
if (imageVariant.isValid()) {
|
||||||
|
clipboardImage = qvariant_cast<QImage>(imageVariant);
|
||||||
|
}
|
||||||
|
} else if (clipboardData->hasText()) {
|
||||||
|
QString clipboardText(clipboardData->text());
|
||||||
|
if (clipboardText.startsWith("PICTURE:")) {
|
||||||
|
QString maybeFilename(clipboardText.mid(8));
|
||||||
|
if (QFile::exists(maybeFilename)) {
|
||||||
|
clipboardFileUrl = QUrl::fromLocalFile(maybeFilename);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
QAction * copyPixmap = new QAction(tr("Copy P&ixmap"));
|
||||||
|
connect(copyPixmap, &QAction::triggered, this, [ = ](){
|
||||||
|
QClipboard *cb = QApplication::clipboard();
|
||||||
|
cb->setPixmap(m_graphicsView->scene()->renderToPixmap());
|
||||||
|
});
|
||||||
|
QAction * copyFilePath = new QAction(tr("Copy &File Path"));
|
||||||
|
connect(copyFilePath, &QAction::triggered, this, [ = ](){
|
||||||
|
QClipboard *cb = QApplication::clipboard();
|
||||||
|
cb->setText(currentFileUrl.toLocalFile());
|
||||||
|
});
|
||||||
|
copyMenu->addAction(copyPixmap);
|
||||||
|
if (currentFileUrl.isValid()) {
|
||||||
|
copyMenu->addAction(copyFilePath);
|
||||||
|
}
|
||||||
|
|
||||||
|
QAction * pasteImage = new QAction(tr("&Paste Image"));
|
||||||
|
connect(pasteImage, &QAction::triggered, this, [ = ](){
|
||||||
|
clearGallery();
|
||||||
|
m_graphicsView->showImage(clipboardImage);
|
||||||
|
});
|
||||||
|
|
||||||
|
QAction * pasteImageFile = new QAction(tr("&Paste Image File"));
|
||||||
|
connect(pasteImageFile, &QAction::triggered, this, [ = ](){
|
||||||
|
m_graphicsView->showFileFromUrl(clipboardFileUrl, true);
|
||||||
|
});
|
||||||
|
|
||||||
QAction * stayOnTopMode = new QAction(tr("Stay on top"));
|
QAction * stayOnTopMode = new QAction(tr("Stay on top"));
|
||||||
connect(stayOnTopMode, &QAction::triggered, this, [ = ](){
|
connect(stayOnTopMode, &QAction::triggered, this, [ = ](){
|
||||||
toggleStayOnTop();
|
toggleStayOnTop();
|
||||||
@ -331,6 +437,18 @@ void MainWindow::contextMenuEvent(QContextMenuEvent *event)
|
|||||||
};
|
};
|
||||||
m_graphicsView->showText(sl.join('\n'));
|
m_graphicsView->showText(sl.join('\n'));
|
||||||
});
|
});
|
||||||
|
|
||||||
|
if (copyMenu->actions().count() == 1) {
|
||||||
|
menu->addActions(copyMenu->actions());
|
||||||
|
} else {
|
||||||
|
menu->addMenu(copyMenu);
|
||||||
|
}
|
||||||
|
if (!clipboardImage.isNull()) {
|
||||||
|
menu->addAction(pasteImage);
|
||||||
|
} else if (clipboardFileUrl.isValid()) {
|
||||||
|
menu->addAction(pasteImageFile);
|
||||||
|
}
|
||||||
|
menu->addSeparator();
|
||||||
menu->addAction(stayOnTopMode);
|
menu->addAction(stayOnTopMode);
|
||||||
menu->addAction(protectedMode);
|
menu->addAction(protectedMode);
|
||||||
menu->addSeparator();
|
menu->addSeparator();
|
||||||
@ -453,6 +571,9 @@ void MainWindow::closeWindow()
|
|||||||
void MainWindow::updateWidgetsPosition()
|
void MainWindow::updateWidgetsPosition()
|
||||||
{
|
{
|
||||||
m_closeButton->move(width() - m_closeButton->width(), 0);
|
m_closeButton->move(width() - m_closeButton->width(), 0);
|
||||||
|
m_prevButton->move(25, (height() - m_prevButton->height()) / 2);
|
||||||
|
m_nextButton->move(width() - m_nextButton->width() - 25,
|
||||||
|
(height() - m_prevButton->height()) / 2);
|
||||||
m_bottomButtonGroup->move((width() - m_bottomButtonGroup->width()) / 2,
|
m_bottomButtonGroup->move((width() - m_bottomButtonGroup->width()) / 2,
|
||||||
height() - m_bottomButtonGroup->height());
|
height() - m_bottomButtonGroup->height());
|
||||||
m_gv->move(width() - m_gv->width(), height() - m_gv->height());
|
m_gv->move(width() - m_gv->width(), height() - m_gv->height());
|
||||||
@ -462,6 +583,8 @@ 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);
|
||||||
|
m_nextButton->setVisible(!m_protectedMode);
|
||||||
}
|
}
|
||||||
|
|
||||||
void MainWindow::toggleStayOnTop()
|
void MainWindow::toggleStayOnTop()
|
||||||
@ -481,3 +604,12 @@ void MainWindow::quitAppAction(bool force)
|
|||||||
closeWindow();
|
closeWindow();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void MainWindow::toggleFullscreen()
|
||||||
|
{
|
||||||
|
if (isFullScreen()) {
|
||||||
|
showNormal();
|
||||||
|
} else {
|
||||||
|
showFullScreen();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
@ -25,10 +25,16 @@ public:
|
|||||||
|
|
||||||
void showUrls(const QList<QUrl> &urls);
|
void showUrls(const QList<QUrl> &urls);
|
||||||
void adjustWindowSizeBySceneRect();
|
void adjustWindowSizeBySceneRect();
|
||||||
|
QUrl currentImageFileUrl() const;
|
||||||
|
|
||||||
|
void clearGallery();
|
||||||
void loadGalleryBySingleLocalFile(const QString &path);
|
void loadGalleryBySingleLocalFile(const QString &path);
|
||||||
void galleryPrev();
|
void galleryPrev();
|
||||||
void galleryNext();
|
void galleryNext();
|
||||||
|
bool isGalleryAvailable();
|
||||||
|
|
||||||
|
signals:
|
||||||
|
void galleryLoaded();
|
||||||
|
|
||||||
protected slots:
|
protected slots:
|
||||||
void showEvent(QShowEvent *event) override;
|
void showEvent(QShowEvent *event) override;
|
||||||
@ -51,6 +57,7 @@ protected slots:
|
|||||||
void toggleStayOnTop();
|
void toggleStayOnTop();
|
||||||
bool stayOnTop();
|
bool stayOnTop();
|
||||||
void quitAppAction(bool force = false);
|
void quitAppAction(bool force = false);
|
||||||
|
void toggleFullscreen();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
QPoint m_oldMousePos;
|
QPoint m_oldMousePos;
|
||||||
@ -58,6 +65,8 @@ private:
|
|||||||
QPropertyAnimation *m_floatUpAnimation;
|
QPropertyAnimation *m_floatUpAnimation;
|
||||||
QParallelAnimationGroup *m_exitAnimationGroup;
|
QParallelAnimationGroup *m_exitAnimationGroup;
|
||||||
ToolButton *m_closeButton;
|
ToolButton *m_closeButton;
|
||||||
|
ToolButton *m_prevButton;
|
||||||
|
ToolButton *m_nextButton;
|
||||||
GraphicsView *m_graphicsView;
|
GraphicsView *m_graphicsView;
|
||||||
NavigatorView *m_gv;
|
NavigatorView *m_gv;
|
||||||
BottomButtonGroup *m_bottomButtonGroup;
|
BottomButtonGroup *m_bottomButtonGroup;
|
||||||
|
12
pineapple-pictures.desktop
Normal file
12
pineapple-pictures.desktop
Normal file
@ -0,0 +1,12 @@
|
|||||||
|
[Desktop Entry]
|
||||||
|
Categories=Graphics;
|
||||||
|
Comment=Pineapple Pictures Image Viewer.
|
||||||
|
Exec=ppic %F
|
||||||
|
GenericName=Pictures
|
||||||
|
Icon=pineapple-pictures
|
||||||
|
Keywords=Picture;Image;Viewer;Jpg;Jpeg;Png;
|
||||||
|
MimeType=image/bmp;image/bmp24;image/jpg;image/jpe;image/jpeg;image/jpeg24;image/jng;image/pcd;image/pcx;image/png;image/tif;image/tiff;image/tiff24;image/dds;image/gif;image/sgi;image/j2k;image/jp2;image/pct;image/wdp;image/arw;image/icb;image/dng;image/vda;image/vst;image/svg;image/ptif;image/mef;image/xbm;image/svg+xml;
|
||||||
|
Name=Pineapple Pictures
|
||||||
|
StartupNotify=false
|
||||||
|
Type=Application
|
||||||
|
Terminal=false
|
1
pineapple-pictures.rc
Normal file
1
pineapple-pictures.rc
Normal file
@ -0,0 +1 @@
|
|||||||
|
IDI_ICON1 ICON DISCARDABLE "icons/app-icon.ico"
|
@ -8,5 +8,7 @@
|
|||||||
<file>icons/view-background-checkerboard.svg</file>
|
<file>icons/view-background-checkerboard.svg</file>
|
||||||
<file>icons/app-icon.svg</file>
|
<file>icons/app-icon.svg</file>
|
||||||
<file>icons/window-close.svg</file>
|
<file>icons/window-close.svg</file>
|
||||||
|
<file>icons/go-next.svg</file>
|
||||||
|
<file>icons/go-previous.svg</file>
|
||||||
</qresource>
|
</qresource>
|
||||||
</RCC>
|
</RCC>
|
||||||
|
@ -6,18 +6,20 @@
|
|||||||
#include <QGraphicsOpacityEffect>
|
#include <QGraphicsOpacityEffect>
|
||||||
#include <QPropertyAnimation>
|
#include <QPropertyAnimation>
|
||||||
|
|
||||||
ToolButton::ToolButton(QWidget *parent)
|
ToolButton::ToolButton(bool hoverColor, QWidget *parent)
|
||||||
: QPushButton(parent)
|
: QPushButton(parent)
|
||||||
, m_opacityHelper(new OpacityHelper(this))
|
, m_opacityHelper(new OpacityHelper(this))
|
||||||
{
|
{
|
||||||
setFlat(true);
|
setFlat(true);
|
||||||
setFixedSize(50, 50);
|
QString qss = "QPushButton {"
|
||||||
setStyleSheet("QPushButton {"
|
|
||||||
"background: transparent;"
|
"background: transparent;"
|
||||||
"}"
|
"}";
|
||||||
"QPushButton:hover {"
|
if (hoverColor) {
|
||||||
"background: red;"
|
qss += "QPushButton:hover {"
|
||||||
"}");
|
"background: red;"
|
||||||
|
"}";
|
||||||
|
}
|
||||||
|
setStyleSheet(qss);
|
||||||
}
|
}
|
||||||
|
|
||||||
void ToolButton::setOpacity(qreal opacity, bool animated)
|
void ToolButton::setOpacity(qreal opacity, bool animated)
|
||||||
|
@ -8,7 +8,7 @@ class ToolButton : public QPushButton
|
|||||||
{
|
{
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
public:
|
public:
|
||||||
ToolButton(QWidget * parent = nullptr);
|
ToolButton(bool hoverColor = false, QWidget * parent = nullptr);
|
||||||
|
|
||||||
public slots:
|
public slots:
|
||||||
void setOpacity(qreal opacity, bool animated = true);
|
void setOpacity(qreal opacity, bool animated = true);
|
||||||
|
Reference in New Issue
Block a user