kioslave: remove EXR thumbnailer

no image handler for EXR now and the thumbnail may be too small to fit
well in the file properties dialog, if there is image handler (plugin)
for EXR the generic image thumbnailer can still create one

Signed-off-by: Ivailo Monev <xakepa10@gmail.com>
This commit is contained in:
Ivailo Monev 2022-10-12 04:07:12 +03:00
parent 9f7fa3836c
commit 9471b46f07
5 changed files with 0 additions and 253 deletions

View file

@ -186,14 +186,6 @@ set_package_properties(Gphoto2 PROPERTIES
PURPOSE "Needed to build camera kioslave"
)
kde4_optional_find_package(OpenEXR)
set_package_properties(OpenEXR PROPERTIES
DESCRIPTION "API for accessing OpenEXR formatted images"
URL "https://www.openexr.com/"
PURPOSE "Provides support for EXR formatted images in the thumbnail KIO slave"
TYPE OPTIONAL
)
kde4_optional_find_package(EPub)
set_package_properties(EPub PROPERTIES
DESCRIPTION "A library for reading EPub documents"

View file

@ -47,27 +47,6 @@ install(TARGETS djvuthumbnail DESTINATION ${KDE4_PLUGIN_INSTALL_DIR})
########### next target ###############
if(OPENEXR_FOUND)
include_directories(${OPENEXR_INCLUDE_DIR})
set(exrthumbnail_PART_SRCS exrcreator.cpp)
kde4_add_plugin(exrthumbnail ${exrthumbnail_PART_SRCS})
target_link_libraries(exrthumbnail ${KDE4_KIO_LIBS} ${OPENEXR_LIBRARIES})
# OpenEXR headers use exceptions; at least clang refuses to build the target
# when exceptions are not enabled.
set_target_properties(exrthumbnail PROPERTIES
COMPILE_FLAGS "${KDE4_ENABLE_EXCEPTIONS}"
)
install(TARGETS exrthumbnail DESTINATION ${KDE4_PLUGIN_INSTALL_DIR})
install(FILES exrthumbnail.desktop DESTINATION ${KDE4_SERVICES_INSTALL_DIR})
endif()
########### next target ###############
if(X11_Xcursor_FOUND)
set(cursorthumbnail_PART_SRCS cursorcreator.cpp)

View file

@ -1,93 +0,0 @@
/* This file is part of the KDE libraries
Copyright (C) 2004 Brad Hards <bradh@frogmouth.net>
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Library General Public
License as published by the Free Software Foundation; either
version 2 of the License, or (at your option) any later version.
This library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Library General Public License for more details.
You should have received a copy of the GNU Library General Public License
along with this library; see the file COPYING.LIB. If not, write to
the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
Boston, MA 02110-1301, USA.
*/
#include "exrcreator.h"
#include "thumbnail.h"
#include <QImage>
#include <QFile>
#include <kdebug.h>
#include <ksharedconfig.h>
#include <kglobal.h>
#include <kconfiggroup.h>
#include <kdemacros.h>
#include <ImfInputFile.h>
#include <ImfPreviewImage.h>
#include <ImfHeader.h>
extern "C"
{
KDE_EXPORT ThumbCreator *new_creator()
{
return new EXRCreator();
}
}
EXRCreator::EXRCreator()
{
}
bool EXRCreator::create(const QString &path, int, int, QImage &img)
{
Imf::InputFile in(path.toAscii());
const Imf::Header &h = in.header();
if (h.hasPreviewImage()) {
kDebug() << "EXRcreator - using preview";
const Imf::PreviewImage &preview = in.header().previewImage();
QImage qpreview(preview.width(), preview.height(), QImage::Format_RGB32);
for (unsigned int y = 0; y < preview.height(); y++ ) {
for (unsigned int x=0; x < preview.width(); x++) {
const Imf::PreviewRgba &q = preview.pixel(x, y);
qpreview.setPixel(x, y, qRgba(q.r, q.g, q.b, q.a));
}
}
img = qpreview;
return true;
}
// do it the hard way
// We ignore maximum size when just extracting the thumnail
// from the header, but it is very expensive to render large
// EXR images just to turn it into an icon, so we go back
// to honoring it in here.
kDebug() << "EXRcreator - using original image";
KSharedConfig::Ptr config = KGlobal::config();
KConfigGroup configGroup(config, "PreviewSettings");
unsigned long long maxSize = configGroup.readEntry("MaximumSize", MaxPreviewSizes::MaxLocalSize * 1024 * 1024);
unsigned long long fileSize = QFile(path).size();
if ((fileSize > 0) && (fileSize < maxSize)) {
if (!img.load(path)) {
return false;
}
if (img.depth() != 32) {
img = img.convertToFormat(QImage::Format_RGB32);
}
return true;
}
kDebug() << "EXRcreator - image file size too large" << fileSize << maxSize;
return false;
}
ThumbCreator::Flags EXRCreator::flags() const
{
return ThumbCreator::None;
}

View file

@ -1,34 +0,0 @@
/* This file is part of the KDE libraries
Copyright (C) 2004 Brad Hards <bradh@frogmouth.net>
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Library General Public
License as published by the Free Software Foundation; either
version 2 of the License, or (at your option) any later version.
This library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Library General Public License for more details.
You should have received a copy of the GNU Library General Public License
along with this library; see the file COPYING.LIB. If not, write to
the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
Boston, MA 02110-1301, USA.
*/
#ifndef _EXRCREATOR_H_
#define _EXRCREATOR_H_
#include <kio/thumbcreator.h>
class EXRCreator : public ThumbCreator
{
public:
EXRCreator();
bool create(const QString &path, int, int, QImage &img) final;
Flags flags() const final;
};
#endif

View file

@ -1,97 +0,0 @@
[Desktop Entry]
Type=Service
Name=EXR Images
Name[af]=EXR Beelde
Name[ar]=EXR صور
Name[ast]=Imáxenes EXR
Name[be]=Відарысы EXR
Name[be@latin]=Vyjavy EXR
Name[bg]=EXR образи
Name[bn]=-- ি
Name[bn_IN]=EXR ি
Name[br]=Skeudennoù EXR
Name[bs]=EIksR slike
Name[ca]=Imatges EXR
Name[ca@valencia]=Imatges EXR
Name[cs]=EXR obrázky
Name[csb]=Òbrôzczi EXR
Name[da]=EXR-billeder
Name[de]=EXR-Bilder
Name[el]=Εικόνες EXR
Name[en_GB]=EXR Images
Name[eo]=EXR-bildoj
Name[es]=Imágenes EXR
Name[et]=EXR pildifailid
Name[eu]=EXR irudiak
Name[fa]=تصاویر EXR
Name[fi]=EXR-kuvat
Name[fr]=Images EXR
Name[fy]=EXR-ôfbyldings
Name[ga]=Íomhánna EXR
Name[gl]=Imaxes EXR
Name[gu]=EXR િ
Name[he]=תמונות EXR
Name[hi]= ि
Name[hne]=
Name[hr]=EXR slike
Name[hsb]=EXR wobrazy
Name[hu]=EXR-képek
Name[ia]=Imagines EXR
Name[id]=Gambar EXR
Name[is]=EXR myndir
Name[it]=Immagini EXR
Name[ja]=EXR
Name[ka]=EXR
Name[kk]=EXR кескіндері
Name[km]= EXR
Name[kn]= ಿ
Name[ko]=EXR
Name[ku]=Wêneyên EXR
Name[lt]=EXR paveikslėliai
Name[lv]=EXR attēli
Name[mai]= ि
Name[mk]=EXR-слики
Name[ml]= ി
Name[mr]=EXR ि
Name[ms]=Imej EXR
Name[nb]=EXR-bilder
Name[nds]=EXR-Biller
Name[ne]=EXR ि
Name[nl]=EXR-afbeeldingen
Name[nn]=EXR-bilete
Name[or]=EXR ିିି
Name[pa]=EXR ਿ
Name[pl]=Obrazy EXR
Name[pt]=Imagens EXR
Name[pt_BR]=Imagens EXR
Name[ro]=Imagini EXR
Name[ru]=Изображения EXR
Name[se]=EXR-govat
Name[si]=EXR
Name[sk]=Obrázky EXR
Name[sl]=Slike EXR
Name[sr]=ЕИксР слике
Name[sr@ijekavian]=ЕИксР слике
Name[sr@ijekavianlatin]=EXR slike
Name[sr@latin]=EXR slike
Name[sv]=EXR-bilder
Name[ta]= ி
Name[te]= ి
Name[tg]=Тасвирҳои EXR
Name[th]= EXR
Name[tr]=EXR Resimleri
Name[ug]=EXR سۈرەتلەر
Name[uk]=Зображення EXR
Name[uz]=EXR-rasmlar
Name[uz@cyrillic]=EXR-расмлар
Name[vi]=nh EXR
Name[wa]=Imådjes EXR
Name[x-test]=xxEXR Imagesxx
Name[zh_CN]=EXR
Name[zh_TW]=EXR
X-KDE-ServiceTypes=ThumbCreator
MimeType=image/x-exr;
X-KDE-Library=exrthumbnail
CacheThumbnail=true
IgnoreMaximumSize=true
InitialPreference=2