9 Commits
0.3.0 ... 0.3.1

11 changed files with 124 additions and 15 deletions

View File

@ -17,4 +17,8 @@ jobs:
cd build
cmake ../
make
sudo cpack
cpack -G DEB
- uses: actions/upload-artifact@v2
with:
name: ubuntu-20.04-deb-package
path: build/*.deb

View File

@ -3,6 +3,7 @@ project (pineapple-pictures)
cmake_minimum_required (VERSION 3.9.5)
include (GNUInstallDirs)
include (FeatureSummary)
set (CMAKE_AUTOMOC ON)
set (CMAKE_AUTORCC ON)
@ -71,6 +72,49 @@ if (WIN32)
TARGET ${EXE_NAME}
PROPERTY WIN32_EXECUTABLE true
)
target_compile_definitions(${EXE_NAME} PRIVATE
FLAG_PORTABLE_MODE_SUPPORT=1
)
endif ()
# Helper macros for parsing and setting project version from `git describe --long` result
macro (ppic_set_version_via_describe _describe_long)
string (
REGEX REPLACE
"^([0-9a-z.]*)-[0-9]+-g[0-9a-f]*$"
"\\1"
_tag_parts
"${_describe_long}"
)
list (GET _tag_parts 0 _matched_tag_version)
if ("${_matched_tag_version}" MATCHES "^[0-9]+\\.[0-9]+\\.[0-9]+$")
string (
REGEX REPLACE
"^([0-9]+)\\.([0-9]+)\\.([0-9]+).*$"
"\\1;\\2;\\3"
_ver_parts
"${_matched_tag_version}"
)
list (GET _ver_parts 0 CPACK_PACKAGE_VERSION_MAJOR)
list (GET _ver_parts 1 CPACK_PACKAGE_VERSION_MINOR)
list (GET _ver_parts 2 CPACK_PACKAGE_VERSION_PATCH)
endif ()
endmacro ()
# Version setup
if (EXISTS "${CMAKE_SOURCE_DIR}/.git")
find_package(Git)
set_package_properties(Git PROPERTIES TYPE OPTIONAL PURPOSE "Determine exact build version.")
if (GIT_FOUND)
execute_process (
COMMAND ${GIT_EXECUTABLE} describe --tags --always --long
WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}
OUTPUT_VARIABLE _git_describe_long
)
string (REGEX REPLACE "\n" "" _git_describe_long "${_git_describe_long}")
ppic_set_version_via_describe(${_git_describe_long})
endif ()
endif ()
# Helper macros for install settings

View File

@ -59,6 +59,6 @@ else: unix:!android: target.path = /opt/$${TARGET}/bin
RESOURCES += \
resources.qrc
# Generate fron svg:
# Generate from svg:
# magick convert -background none app-icon.svg -define icon:auto-resize="16,32,48,64,128,256" app-icon.ico
RC_ICONS = icons/app-icon.ico

View File

@ -13,19 +13,54 @@ Yet another image viewer.
- [GitHub Release Page](https://github.com/BLumia/pineapple-pictures/releases)
- Archlinux AUR: [pineapple-pictures-git](https://aur.archlinux.org/packages/pineapple-pictures-git/)
## Build it manually:
Current state, we need:
- `cmake`: as the build system.
- `qt5` with `qt5-svg` and `qt5-tools`: since the app is using Qt.
Then we can build it with any proper c++ compiler like g++ or msvc.
Building it just requires normal cmake building steps:
``` bash
$ mkdir build && cd build
$ cmake ..
$ cmake --build . # or simply using `make` if you are using Makefile as the cmake generator.
```
After that, a `ppic` executable file will be available to use. You can also optionally install it by using the target `install` (or simply `make install` in case you are using Makefile). After the build process, you can also use `cpack` to make a package.
Image formats supports rely on Qt's imageformats plugins, just get the plugins you need from your distro's package manager will be fine. For Windows user, you may need build and install the imageformats plugin manually, read the content below.
### Linux
Just normal build process as other program will be fine. Nothing special ;)
For Archlinux there are also a [PKGBUILD](https://aur.archlinux.org/cgit/aur.git/tree/PKGBUILD?h=pineapple-pictures-git) you can use.
For packaging to debian-based distro, the `CMakeLists.txt` provides some cpack configurations for generating a `.deb` package. After the build process, use `cpack -G DEB` to generate the package. You can also take `.github/workflows/ubuntu.yml` as a reference.
For this project, `DEB` is the only supported cpack generator in current state, feel free to submit a PR if you like improving `cpack` support for this project.
### Windows
The normal build steps for Linux is also applied to Windows, but since Windows doesn't have a decent package manager, so if you need any other image formats support other than the supported formats which Qt provided, you need to get and build these imageformats plugins manually and vendor it. It's optional and can be skipped if you don't need extra image formats support.
For the Windows binary I provided, kimageformats plugin is used (for formats like kra, xcf, psd and etc.). You can take `appveyor.yml` as a reference to learn what I did when building the Windows binary.
[KDE Craft](https://community.kde.org/Craft) environment also can be used to build and package this program. I did also created a blueprint for building this project, but since I don't have a CI to run KDE Craft build, the blueprint repo are not provided here. Maybe sometimes later.
### macOS
I don't have a mac, so no support at all. There is also a GitHub Action (see `.github/workflows/macos.yml`) running macOS build though so at least it can build. Feel free to submit a PR if you would like to give some love to the macOS build ;P
## 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):
- Mixed `CR LF` and `LF`.
- Ugly action icons.
- Ugly implementations.
- 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).
Feel free to open up an issue to request a new language to translate.
## License

View File

@ -59,6 +59,7 @@ build_script:
- mingw32-make install
# fixme: I don't know how to NOT make the binary installed to the ./bin/ folder...
- cd bin
- copy %APPVEYOR_BUILD_FOLDER%\LICENSE .
- copy C:\projects\cmake\bin\libKF5Archive.dll .
- windeployqt --verbose=2 --no-quick-import --no-translations --no-opengl-sw --no-angle --no-system-d3d-compiler --release .\ppic.exe
# for debug..

View File

@ -31,6 +31,17 @@ void GraphicsView::showFileFromUrl(const QUrl &url, bool doRequestGallery)
QString filePath(url.toLocalFile());
#ifdef Q_OS_WIN
// TODO: remove this workaround when M$ change the "wsl$" hostname.
if (Q_UNLIKELY(url.scheme() == QStringLiteral("qtbug-86277"))) {
filePath = url.path();
// Qt's QUrl won't work with such hostname anyway so the urls will
// still be the wrong one when requesting gallery. So we just don't
// request gallery here...
doRequestGallery = false;
}
#endif // Q_OS_WIN
if (filePath.endsWith(".svg")) {
showSvg(filePath);
} else if (filePath.endsWith(".gif")) {

View File

@ -37,6 +37,14 @@ int main(int argc, char *argv[])
QList<QUrl> urlList;
for (const QString & str : urlStrList) {
QUrl url = QUrl::fromLocalFile(str);
#ifdef Q_OS_WIN
// TODO: remove this workaround when M$ change the "wsl$" hostname.
if (Q_UNLIKELY(str.startsWith(R"(\\wsl$\)"))) {
url.clear();
url.setScheme(QStringLiteral("qtbug-86277"));
url.setPath(str);
}
#endif // Q_OS_WIN
if (url.isValid()) {
urlList.append(url);
}

View File

@ -30,9 +30,9 @@ MainWindow::MainWindow(QWidget *parent) :
QMainWindow(parent)
{
if (Settings::instance()->stayOnTop()) {
this->setWindowFlags(Qt::Window | Qt::FramelessWindowHint | Qt::WindowStaysOnTopHint);
this->setWindowFlags(Qt::Window | Qt::FramelessWindowHint | Qt::WindowMinimizeButtonHint | Qt::WindowStaysOnTopHint);
} else {
this->setWindowFlags(Qt::Window | Qt::FramelessWindowHint);
this->setWindowFlags(Qt::Window | Qt::FramelessWindowHint | Qt::WindowMinimizeButtonHint);
}
this->setAttribute(Qt::WA_TranslucentBackground, true);

View File

@ -1,12 +1,15 @@
[Desktop Entry]
Categories=Graphics;
Comment=Pineapple Pictures Image Viewer.
Comment=Pineapple Pictures is a lightweight image viewer
Comment[zh_CN]=菠萝看图是一个轻量级的图像查看器
Exec=ppic %F
GenericName=Pictures
GenericName=Image Viewer
GenericName[zh_CN]=图像查看器
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
Name[zh_CN]=菠萝看图
StartupNotify=false
Type=Application
Terminal=false

View File

@ -67,12 +67,14 @@ Settings::Settings()
{
QString configPath;
#ifdef FLAG_PORTABLE_MODE_SUPPORT
QString portableConfigDirPath = QDir(QCoreApplication::applicationDirPath()).absoluteFilePath("data");
QFileInfo portableConfigDirInfo(portableConfigDirPath);
if (portableConfigDirInfo.exists() && portableConfigDirInfo.isDir() && portableConfigDirInfo.isWritable()) {
// we can use it.
configPath = portableConfigDirPath;
}
#endif // FLAG_PORTABLE_MODE_SUPPORT
// %LOCALAPPDATA% under Windows.
if (configPath.isEmpty()) {

View File

@ -42,6 +42,7 @@ SettingsDialog::SettingsDialog(QWidget *parent)
});
this->setMinimumSize(300, 61); // not sure why it complain "Unable to set geometry"
setWindowFlag(Qt::WindowContextHelpButtonHint, false);
}
SettingsDialog::~SettingsDialog()