Skip to content

Commit

Permalink
AppImage support
Browse files Browse the repository at this point in the history
* add AppImage build
* fix scrolling in reader
* remove dead code
  • Loading branch information
karwler committed Oct 23, 2021
1 parent c39595f commit 6bb6aac
Show file tree
Hide file tree
Showing 46 changed files with 1,368 additions and 273 deletions.
6 changes: 5 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -339,4 +339,8 @@ $RECYCLE.BIN/
*.msix
*.msm
*.msp
*.lnk
*.lnk

# Other
*.ico
*.png
329 changes: 245 additions & 84 deletions CMakeLists.txt

Large diffs are not rendered by default.

12 changes: 6 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,21 +3,21 @@ A simple comic/manga reader for Linux and Windows.
It's basically just an image viewer that shows all pictures of a directory/archive.
Currently supported file formats are whatever SDL2_image and libarchive support.

Used libraries are SDL2, SDL2_image, SDL2_ttf, libarchive and by extension libjpeg, libpng, libtiff, libwebp, FreeType and zlib and the included default font is BrisaSans.
The CMakeLists.txt is written for at least CMake 3.10.2 with Clang, GCC or MSVC which need to support C++17.
Used libraries are SDL2, SDL2_image, SDL2_ttf, libarchive and by extension libjpeg, libpng, libtiff, libwebp, FreeType and zlib and the included default font is BrisaSans.
The CMakeLists.txt is written for at least CMake 3.10.2 with Clang, GCC or MSVC which need to support C++17. You also need some version of Python 3 with Wand which requires ImageMagick to be installed.
You can create a Makefile for a debug build by running CMake with the "-DCMAKE_BUILD_TYPE=Debug" option. Otherwise it'll default to a release build.

## Linux
All dependencies need to be installed manually.
All dependencies need to be installed manually unless building an AppImage.
Installing the development packages for libsdl2 libsdl2-image libsdl2-ttf and libarchive should do the trick, assuming that all necessary dependencies are installed automatically.
To build an AppImage run CMake with the "-DAPPIMAGE=1" option, in which case SDL2, SDL2_image, SDL2_ttf and libarchive will be downloaded and compiled automatically.
Settings files are being saved in "~/.vertiread".

There’s a launcher file, which is copied to the build directory after compilation.
If you want a menu entry for the program, just set the executable’s and icon’s path in the .desktop file and move it to either "/usr/share/applications" or "~/.local/share/applications".

## Windows
Currently only MS Visual Studio is supported.
All necessary libraries are downloaded while running CMake, however because CMake is being a bitch, libarchive needs to be built manually. To do that, go to "lib/libarchive-${VER_ARCH}/bout", open "libarchive.sln", select the Release build and build the target "archive".
Currently only MS Visual Studio is supported. All necessary libraries are downloaded while running CMake.
Settings files are being saved in "%AppData%\VertiRead".

## How to use it
Expand All @@ -33,4 +33,4 @@ To reset certain settings, edit or delete the corresponding ini files in the set

## Supported files
- images: bmp, gif, jpg, lbm, pcx, png, pnm, svg, tga, tiff, webp, xcf, xpm, xv
- archives: 7z, ar, cab, cpio, ISO9660, lha, lzh, mtree, pax, rar, tar, ustar, xar, zip, zipx
- archives: 7z, ar, cab, cpio, ISO9660, lha, lzh, mtree, pax, rar, tar, ustar, xar, zip, zipx
30 changes: 30 additions & 0 deletions pictool.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
import os
import sys
import wand.api
import wand.color
import wand.image

def convert_image(dst: str, filepath: str, save_ico: bool = False) -> None:
try:
with wand.image.Image() as img:
with wand.color.Color('transparent') as bgcolor:
wand.api.library.MagickSetBackgroundColor(img.wand, bgcolor.resource)
img.read(filename=filepath)

filebase = os.path.join(dst, os.path.splitext(os.path.basename(filepath))[0])
with open(filebase + '.png', 'wb') as out:
out.write(img.make_blob('png8'))
if save_ico:
with open(filebase + '.ico', 'wb') as out:
out.write(img.make_blob('ico'))
except Exception as ex:
print(f'"{filepath}": {ex}')

if __name__ == '__main__':
if len(sys.argv) == 2:
convert_image(os.path.dirname(sys.argv[1]), sys.argv[1], True)
elif len(sys.argv) > 2:
for file in sys.argv[2:]:
convert_image(sys.argv[1], file)
else:
print('USAGE:\n', __file__, '<file>\n', __file__, '<destination> <files>')
Binary file removed rsc/data/textures/circle.png
Binary file not shown.
Binary file removed rsc/data/textures/cross.png
Binary file not shown.
Binary file removed rsc/data/textures/file.png
Binary file not shown.
Binary file removed rsc/data/textures/folder.png
Binary file not shown.
Binary file removed rsc/data/textures/left.png
Binary file not shown.
Binary file removed rsc/data/textures/minus.png
Binary file not shown.
Binary file removed rsc/data/textures/plus.png
Binary file not shown.
Binary file removed rsc/data/textures/right.png
Binary file not shown.
Binary file removed rsc/data/textures/search.png
Binary file not shown.
Binary file removed rsc/data/textures/square.png
Binary file not shown.
File renamed without changes.
Binary file removed rsc/icon.ico
Binary file not shown.
91 changes: 91 additions & 0 deletions rsc/icons/center.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
77 changes: 77 additions & 0 deletions rsc/icons/cross.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
129 changes: 129 additions & 0 deletions rsc/icons/file.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading

0 comments on commit 6bb6aac

Please sign in to comment.