git: 079bb54b2cb1 - main - graphics/qimgv: new port: fast and easy to use image viewer

From: Vladimir Druzenko <vvd_at_FreeBSD.org>
Date: Wed, 24 Jul 2024 22:43:51 UTC
The branch main has been updated by vvd:

URL: https://cgit.FreeBSD.org/ports/commit/?id=079bb54b2cb1d63fd53b21267d59b11d2f04ece2

commit 079bb54b2cb1d63fd53b21267d59b11d2f04ece2
Author:     Kenneth Raplee <kenrap@kennethraplee.com>
AuthorDate: 2024-07-24 22:40:08 +0000
Commit:     Vladimir Druzenko <vvd@FreeBSD.org>
CommitDate: 2024-07-24 22:40:08 +0000

    graphics/qimgv: new port: fast and easy to use image viewer
    
    Key features:
     * Simple UI
     * Fast
     * Easy to use
     * Fully configurable, including themes, shortcuts
     * High quality scaling
     * Basic image editing: Crop, Rotate and Resize
     * Ability to quickly copy / move images to different folders
     * Experimental video playback via libmpv
     * Folder view mode
     * Ability to run shell scripts
    https://github.com/easymodo/qimgv
    
    PR:     280422
---
 graphics/Makefile                              |   1 +
 graphics/qimgv/Makefile                        |  62 +++++++++++++++
 graphics/qimgv/distinfo                        |   3 +
 graphics/qimgv/files/patch-add-freebsd-support | 103 +++++++++++++++++++++++++
 graphics/qimgv/pkg-descr                       |   2 +
 graphics/qimgv/pkg-plist                       |  19 +++++
 6 files changed, 190 insertions(+)

diff --git a/graphics/Makefile b/graphics/Makefile
index 9f03289c5a8a..cd38ce73984e 100644
--- a/graphics/Makefile
+++ b/graphics/Makefile
@@ -1015,6 +1015,7 @@
     SUBDIR += qcustomplot
     SUBDIR += qgis
     SUBDIR += qgis-ltr
+    SUBDIR += qimgv
     SUBDIR += qiv
     SUBDIR += qr-code-generator
     SUBDIR += qt5-3d
diff --git a/graphics/qimgv/Makefile b/graphics/qimgv/Makefile
new file mode 100644
index 000000000000..c558dee4465c
--- /dev/null
+++ b/graphics/qimgv/Makefile
@@ -0,0 +1,62 @@
+PORTNAME=	qimgv
+PORTVERSION=	1.03.g20240620
+CATEGORIES=	graphics
+
+MAINTAINER=	kenrap@kennethraplee.com
+COMMENT=	Fast and easy to use image viewer
+WWW=		https://github.com/easymodo/qimgv
+
+LICENSE=	GPLv3
+
+LIB_DEPENDS=	libinotify.so:devel/libinotify
+
+USES=		cmake compiler:c++11-lang desktop-file-utils \
+		localbase:ldflags
+USE_GITHUB=	yes
+GH_ACCOUNT=	easymodo
+GH_PROJECT=	qimgv
+GH_TAGNAME=	7672cb4b15f8f5eef2b5535e7bbb59248931db72
+
+LDFLAGS+=	-linotify
+
+OPTIONS_DEFINE=		EXIV2 KDE5 OPENCV VIDEO
+OPTIONS_DEFAULT=	EXIV2 OPENCV QT6 VIDEO
+OPTIONS_SINGLE=		QT
+OPTIONS_SINGLE_QT=	QT5 QT6
+OPTIONS_SUB=		yes
+
+EXIV2_DESC=		Support reading exif tags via exiv2
+KDE5_DESC=		${KDE_DESC} (require QT5)
+OPENCV_DESC=		Enables high quality scaling options
+VIDEO_DESC=		Enables video playback via mpv
+
+EXIV2_LIB_DEPENDS=	libexiv2.so:graphics/exiv2
+EXIV2_CMAKE_BOOL=	EXIV2
+
+KDE5_IMPLIES=		QT5
+KDE5_PREVENTS=		QT6
+KDE5_USES=		kde:5 xorg
+KDE5_USE=		kde=windowsystem xorg=x11
+KDE5_CMAKE_BOOL=	KDE_SUPPORT
+
+OPENCV_LIB_DEPENDS=	libopencv_core.so:graphics/opencv \
+			libopencv_imgproc.so:graphics/opencv
+OPENCV_CMAKE_BOOL=	OPENCV_SUPPORT
+
+QT5_USES=		qt:5
+QT5_USE=		qt=buildtools:build,linguisttools:build,qmake:build \
+			qt=core,gui,printsupport,svg,widgets
+QT5_CMAKE_BOOL=		CMAKE_DISABLE_FIND_PACKAGE_Qt6
+
+QT6_USES=		qt:6 gl
+QT6_USE=		gl=opengl qt=base,svg,tools:build
+QT6_CMAKE_BOOL=		CMAKE_DISABLE_FIND_PACKAGE_Qt5
+
+VIDEO_LIB_DEPENDS=	libmpv.so:multimedia/mpv
+VIDEO_CMAKE_BOOL=	VIDEO_SUPPORT
+
+post-patch:
+	@${REINPLACE_CMD} -e 's|/usr/local|${LOCALBASE}|g' \
+		${WRKSRC}/qimgv/settings.cpp
+
+.include <bsd.port.mk>
diff --git a/graphics/qimgv/distinfo b/graphics/qimgv/distinfo
new file mode 100644
index 000000000000..8690254e14ab
--- /dev/null
+++ b/graphics/qimgv/distinfo
@@ -0,0 +1,3 @@
+TIMESTAMP = 1719751325
+SHA256 (easymodo-qimgv-1.03.g20240620-7672cb4b15f8f5eef2b5535e7bbb59248931db72_GH0.tar.gz) = 78bb1943559a43f536a71641b913de5dab3a69ebfe781d8ef11382a89be68691
+SIZE (easymodo-qimgv-1.03.g20240620-7672cb4b15f8f5eef2b5535e7bbb59248931db72_GH0.tar.gz) = 1082895
diff --git a/graphics/qimgv/files/patch-add-freebsd-support b/graphics/qimgv/files/patch-add-freebsd-support
new file mode 100644
index 000000000000..2ca17d221ed9
--- /dev/null
+++ b/graphics/qimgv/files/patch-add-freebsd-support
@@ -0,0 +1,103 @@
+--- qimgv/components/directorymanager/watchers/directorywatcher.cpp.orig	2024-06-20 15:55:26 UTC
++++ qimgv/components/directorymanager/watchers/directorywatcher.cpp
+@@ -1,6 +1,6 @@
+ #include "directorywatcher_p.h"
+ 
+-#ifdef __linux__
++#if defined(__FreeBSD__) || defined(__linux__)
+ #include "linux/linuxwatcher.h"
+ #elif _WIN32
+ #include "windows/windowswatcher.h"
+@@ -34,7 +34,7 @@ DirectoryWatcher *DirectoryWatcher::newInstance()
+ {
+     DirectoryWatcher* watcher;
+ 
+-#ifdef __linux__
++#if defined(__FreeBSD__) || defined(__linux__)
+         watcher = new LinuxWatcher();
+ #elif _WIN32
+         watcher = new WindowsWatcher();
+--- qimgv/core.cpp.orig	2024-06-20 15:55:26 UTC
++++ qimgv/core.cpp
+@@ -728,7 +728,7 @@ void Core::showInDirectory() {
+         QDesktopServices::openUrl(QUrl::fromLocalFile(model->directoryPath()));
+         return;
+     }
+-#ifdef __linux__
++#if defined(__FreeBSD__) || defined(__linux__)
+     QString fm = ScriptManager::runCommand("xdg-mime query default inode/directory");
+     if(fm.contains("dolphin"))
+         ScriptManager::runCommandDetached("dolphin --select " + selectedPath());
+--- qimgv/settings.cpp.orig	2024-06-20 15:55:26 UTC
++++ qimgv/settings.cpp
+@@ -3,7 +3,7 @@ Settings::Settings(QObject *parent) : QObject(parent) 
+ Settings *settings = nullptr;
+ 
+ Settings::Settings(QObject *parent) : QObject(parent) {
+-#ifdef __linux__
++#if defined(__FreeBSD__) || defined(__linux__)
+     // config files
+     QSettings::setDefaultFormat(QSettings::NativeFormat);
+     settingsConf = new QSettings();
+@@ -38,7 +38,7 @@ void Settings::setupCache() {
+ }
+ //------------------------------------------------------------------------------
+ void Settings::setupCache() {
+-#ifdef __linux__
++#if defined(__FreeBSD__) || defined(__linux__)
+     QString genericCacheLocation = QStandardPaths::writableLocation(QStandardPaths::GenericCacheLocation);
+     if(genericCacheLocation.isEmpty())
+         genericCacheLocation = QDir::homePath() + "/.cache";
+@@ -292,6 +292,8 @@ QString Settings::mpvBinary() {
+     if(!QFile::exists(mpvPath)) {
+     #ifdef _WIN32
+         mpvPath = QCoreApplication::applicationDirPath() + "/mpv.exe";
++    #elif defined __FreeBSD__
++        mpvPath = "/usr/local/bin/mpv";
+     #elif defined __linux__
+         mpvPath = "/usr/bin/mpv";
+     #endif
+--- qimgv/shortcutbuilder.cpp.orig	2024-06-20 15:55:26 UTC
++++ qimgv/shortcutbuilder.cpp
+@@ -64,7 +64,7 @@ QString ShortcutBuilder::processKeyEvent(QKeyEvent *ev
+ QString ShortcutBuilder::processKeyEvent(QKeyEvent *event) {
+     if(event->type() != QEvent::KeyPress || isModifier(Qt::Key(event->key())))
+         return "";
+-#if defined(__linux__) || defined(_WIN32)
++#if defined(__FreeBSD__) || defined(__linux__) || defined(_WIN32)
+     return fromEventNativeScanCode(event);
+ #else
+     return fromEventText(event);
+--- qimgv/utils/inputmap.cpp.orig	2024-06-20 15:55:26 UTC
++++ qimgv/utils/inputmap.cpp
+@@ -162,7 +162,7 @@ void InputMap::initKeyMap() {
+     keyMap.insert( 57397 , "/" );
+     keyMap.insert( 57372 , "Enter" );
+ 
+-#elif defined __linux__
++#elif defined(__FreeBSD__) || defined(__linux__)
+     // linux keymap for qimgv
+ 
+     // row 1
+--- qimgv/utils/stuff.cpp.orig	2024-06-20 15:55:26 UTC
++++ qimgv/utils/stuff.cpp
+@@ -8,7 +8,7 @@ int probeOS() {
+ int probeOS() {
+ #ifdef TARGET_OS_MAC
+     return 0;
+-#elif defined __linux__
++#elif defined(__FreeBSD__) || defined(__linux__)
+     return 1;
+ #elif defined _WIN32 || defined _WIN64
+     return 2;
+--- qimgv/utils/wallpapersetter.cpp.orig	2024-06-20 15:55:26 UTC
++++ qimgv/utils/wallpapersetter.cpp
+@@ -11,7 +11,7 @@ void WallpaperSetter::setWallpaper(QString path) {
+                                    (PVOID) path.utf16(),
+                                    SPIF_UPDATEINIFILE | SPIF_SENDWININICHANGE);
+     qDebug() << "wallpaper changed:" << (ok ? "true" : "false");
+-#elif defined __linux__
++#elif defined(__FreeBSD__) || defined(__linux__)
+     QString command;
+     command = "qdbus org.kde.plasmashell /PlasmaShell org.kde.PlasmaShell.evaluateScript \'var allDesktops = desktops(); print (allDesktops); for (i = 0; i < allDesktops.length; i++) { d = allDesktops[i]; d.wallpaperPlugin = \"org.kde.image\"; d.currentConfigGroup = Array(\"Wallpaper\", \"org.kde.image\", \"General\"); d.writeConfig(\"Image\", \"" + path + "\") } \'";
+     QProcess process;
diff --git a/graphics/qimgv/pkg-descr b/graphics/qimgv/pkg-descr
new file mode 100644
index 000000000000..b8fab38e23d4
--- /dev/null
+++ b/graphics/qimgv/pkg-descr
@@ -0,0 +1,2 @@
+A fast image viewer with an unclutted, simple, and easy to use UI.
+Optional video support.
diff --git a/graphics/qimgv/pkg-plist b/graphics/qimgv/pkg-plist
new file mode 100644
index 000000000000..38d5c72c0966
--- /dev/null
+++ b/graphics/qimgv/pkg-plist
@@ -0,0 +1,19 @@
+bin/qimgv
+%%VIDEO%%lib/qimgv/player_mpv.so
+share/applications/qimgv.desktop
+share/icons/hicolor/128x128/apps/qimgv.png
+share/icons/hicolor/16x16/apps/qimgv.png
+share/icons/hicolor/22x22/apps/qimgv.png
+share/icons/hicolor/24x24/apps/qimgv.png
+share/icons/hicolor/256x256/apps/qimgv.png
+share/icons/hicolor/32x32/apps/qimgv.png
+share/icons/hicolor/36x36/apps/qimgv.png
+share/icons/hicolor/48x48/apps/qimgv.png
+share/icons/hicolor/64x64/apps/qimgv.png
+share/icons/hicolor/scalable/apps/qimgv.svg
+share/metainfo/qimgv.appdata.xml
+%%DATADIR%%/translations/de_DE.qm
+%%DATADIR%%/translations/es_ES.qm
+%%DATADIR%%/translations/fr_FR.qm
+%%DATADIR%%/translations/uk_UA.qm
+%%DATADIR%%/translations/zh_CN.qm