From f3aa0437ed19f9d89643a7a8195c01e62bb19d24 Mon Sep 17 00:00:00 2001 From: Gerasim Troeglazov <3dEyes@gmail.com> Date: Thu, 28 Mar 2019 22:49:35 +1000 Subject: [PATCH] Krusader: get file icons from Tracker --- kde-misc/krusader/krusader-2.7.1.recipe | 6 +- .../krusader/patches/krusader-2.7.1.patchset | 122 ++++++++++++++++++ 2 files changed, 126 insertions(+), 2 deletions(-) create mode 100644 kde-misc/krusader/patches/krusader-2.7.1.patchset diff --git a/kde-misc/krusader/krusader-2.7.1.recipe b/kde-misc/krusader/krusader-2.7.1.recipe index c0d4ed7e8..142572be6 100644 --- a/kde-misc/krusader/krusader-2.7.1.recipe +++ b/kde-misc/krusader/krusader-2.7.1.recipe @@ -20,10 +20,11 @@ user friendly, fast and looks great on your desktop! You should give it a try." HOMEPAGE="https://krusader.org/" COPYRIGHT="2000-2018 Krusader Krew" LICENSE="GNU GPL v2" -REVISION="2" +REVISION="3" SOURCE_URI="https://github.com/KDE/krusader/archive/v$portVersion.tar.gz" CHECKSUM_SHA256="1ce50427db5256c46985374b267b378d69591c4093386dbd692655772826fc37" ADDITIONAL_FILES="krusader.rdef.in" +PATCHES="krusader-$portVersion.patchset" ARCHITECTURES="x86_64" SECONDARY_ARCHITECTURES="x86" @@ -69,7 +70,7 @@ REQUIRES=" BUILD_REQUIRES=" haiku${secondaryArchSuffix}_devel - extra_cmake_modules$secondaryArchSuffix >= 5.46 + extra_cmake_modules$secondaryArchSuffix >= 5.55 devel:libKF5Archive$secondaryArchSuffix devel:libKF5Auth$secondaryArchSuffix devel:libKF5Bookmarks$secondaryArchSuffix @@ -105,6 +106,7 @@ BUILD_PREREQUIRES=" cmd:cmake cmd:g++$secondaryArchSuffix cmd:make + cmd:qdbuscpp2xml$secondaryArchSuffix >= 5 " defineDebugInfoPackage krusader$secondaryArchSuffix \ diff --git a/kde-misc/krusader/patches/krusader-2.7.1.patchset b/kde-misc/krusader/patches/krusader-2.7.1.patchset new file mode 100644 index 000000000..162571067 --- /dev/null +++ b/kde-misc/krusader/patches/krusader-2.7.1.patchset @@ -0,0 +1,122 @@ +From 40f199bd4f20d2a5095052f2bb3684af7bcc1111 Mon Sep 17 00:00:00 2001 +From: Gerasim Troeglazov <3dEyes@gmail.com> +Date: Thu, 28 Mar 2019 22:28:54 +1000 +Subject: Add haiku file icons support + + +diff --git a/krusader/Panel/PanelView/krview.cpp b/krusader/Panel/PanelView/krview.cpp +index a7f0437..f07b62e 100644 +--- a/krusader/Panel/PanelView/krview.cpp ++++ b/krusader/Panel/PanelView/krview.cpp +@@ -316,6 +316,59 @@ QPixmap KrView::processIcon(const QPixmap &icon, bool dim, const QColor & dimCol + Qt::ThresholdAlphaDither | Qt::NoOpaqueDetection ); + } + ++#ifdef __HAIKU__ ++QPixmap KrView::getIcon(FileItem *fileitem, bool active, int size) ++{ ++ QPixmap icon; ++ QString iconName = fileitem->getIcon(); ++ if (!fileitem->getUrl().path().isNull()) ++ iconName = fileitem->getUrl().path(); ++ QString cacheName; ++ ++ if(!size) ++ size = _FilelistIconSize.toInt(); ++ ++ QColor dimColor; ++ int dimFactor; ++ bool dim = !active && KrColorCache::getColorCache().getDimSettings(dimColor, dimFactor); ++ ++ if (iconName.isNull()) ++ iconName = ""; ++ ++ cacheName.append(QString::number(size)); ++ if(fileitem->isSymLink()) ++ cacheName.append("LINK_"); ++ if(dim) ++ cacheName.append("DIM_"); ++ cacheName.append(iconName); ++ ++ if (!QPixmapCache::find(cacheName, icon)) { ++ QPixmap pixmap = QPixmap(size, size); ++ if (fileitem->getUrl().path().isNull()) ++ pixmap = Icon(iconName, Icon("unknown")).pixmap(size); ++ else { ++ pixmap.fill(Qt::transparent); ++ QString filename = fileitem->getUrl().path(); ++ if (filename == "/") ++ filename = "/system/servers/mount_server"; ++ ++ BFile file(filename.toUtf8(), O_RDONLY); ++ BNodeInfo nodeInfo(&file); ++ icon_size iconSize = (icon_size)size; ++ BRect rect(0, 0, iconSize - 1, iconSize -1); ++ BBitmap bitmap(rect, B_RGBA32); ++ if (nodeInfo.GetTrackerIcon(&bitmap, iconSize) == B_NO_ERROR) { ++ QImage image(iconSize, iconSize, QImage::Format_ARGB32); ++ memcpy((uchar*)image.bits(), (uchar*)bitmap.Bits(), iconSize * iconSize * 4); ++ pixmap = QPixmap::fromImage(image).scaled(size, size, Qt::IgnoreAspectRatio, Qt::SmoothTransformation); ++ } ++ } ++ icon = processIcon(pixmap, dim, dimColor, dimFactor, fileitem->isSymLink()); ++ QPixmapCache::insert(cacheName, icon); ++ } ++ return icon; ++} ++#else + QPixmap KrView::getIcon(FileItem *fileitem, bool active, int size/*, KRListItem::cmpColor color*/) + { + // KConfigGroup ag( krConfig, "Advanced"); +@@ -353,6 +406,7 @@ QPixmap KrView::getIcon(FileItem *fileitem, bool active, int size/*, KRListItem: + + return icon; + } ++#endif + + QPixmap KrView::getIcon(FileItem *fileitem) + { +diff --git a/krusader/Panel/PanelView/krview.h b/krusader/Panel/PanelView/krview.h +index 6371cdb..d973e83 100644 +--- a/krusader/Panel/PanelView/krview.h ++++ b/krusader/Panel/PanelView/krview.h +@@ -33,6 +33,13 @@ + #include + #include + ++#ifdef __HAIKU__ ++#include ++#include ++#include ++#include ++#endif ++ + #include "krviewproperties.h" + + class KrView; +-- +2.19.1 + + +From 6f5844e31bb1d4e022444a9130d8c35f1bdbff85 Mon Sep 17 00:00:00 2001 +From: Gerasim Troeglazov <3dEyes@gmail.com> +Date: Thu, 28 Mar 2019 22:41:58 +1000 +Subject: Link with be and tracker libraries + + +diff --git a/krusader/CMakeLists.txt b/krusader/CMakeLists.txt +index 0ade19c..dcd2cf3 100644 +--- a/krusader/CMakeLists.txt ++++ b/krusader/CMakeLists.txt +@@ -77,6 +77,8 @@ target_link_libraries(krusader + KF5::WindowSystem + Qt5::PrintSupport + Qt5::Concurrent ++ be ++ tracker + ) + + if(SYNCHRONIZER_ENABLED) +-- +2.19.1 +