generic: port to new kexiv2 library

Signed-off-by: Ivailo Monev <xakepa10@gmail.com>
This commit is contained in:
Ivailo Monev 2021-08-01 16:25:30 +03:00
parent 3408f0c695
commit 5069836bc9
4 changed files with 11 additions and 23 deletions

View file

@ -17,10 +17,6 @@ kde4_add_plugin(imagethumbnail ${imagethumbnail_PART_SRCS})
target_link_libraries(imagethumbnail ${KDE4_KIO_LIBS} ${KDE4_KEXIV2_LIBS})
set_target_properties(imagethumbnail PROPERTIES
COMPILE_FLAGS "-DHAVE_KEXIV2 ${KDE4_ENABLE_EXCEPTIONS}"
)
install(TARGETS imagethumbnail DESTINATION ${KDE4_PLUGIN_INSTALL_DIR})
install(FILES imagecreatorsettings.kcfg DESTINATION ${KDE4_KCFG_INSTALL_DIR})
install(TARGETS imagethumbnail DESTINATION ${KDE4_PLUGIN_INSTALL_DIR})

View file

@ -25,10 +25,7 @@
#include <QCheckBox>
#include <kdemacros.h>
#include <klocale.h>
#ifdef HAVE_KEXIV2
#include <libkexiv2/kexiv2.h>
#endif
#include <kexiv2.h>
extern "C"
{
@ -40,19 +37,20 @@ extern "C"
bool ImageCreator::create(const QString &path, int, int, QImage &img)
{
// create image preview
if (!img.load(path)) {
// use preview from Exiv2 metadata if possible
KExiv2 exiv(path);
img = exiv.preview();
// create image preview otherwise
if (img.isNull() && !img.load(path)) {
return false;
}
#ifdef HAVE_KEXIV2
ImageCreatorSettings* settings = ImageCreatorSettings::self();
settings->readConfig();
if (settings->rotate()) {
KExiv2Iface::KExiv2 exiv(path);
exiv.rotateExifQImage(img, exiv.getImageOrientation());
exiv.rotateImage(img);
}
#endif
if (img.depth() != 32) {
img = img.convertToFormat(img.hasAlphaChannel() ? QImage::Format_ARGB32 : QImage::Format_RGB32);

View file

@ -28,7 +28,6 @@ set(kslideshow.kss_SRCS slideshow.cpp slideshowcfg.ui)
add_executable(kslideshow.kss ${kslideshow.kss_SRCS})
set_source_files_properties(slideshow.cpp PROPERTIES COMPILE_FLAGS -DHAVE_KEXIV2)
target_link_libraries(kslideshow.kss
${KDE4_KIO_LIBS}
${KDE4_KEXIV2_LIBS}

View file

@ -38,16 +38,13 @@
#include <kaboutapplicationdialog.h>
#include <kdebug.h>
#include <krandom.h>
#include <kexiv2.h>
#include <stdlib.h>
#include <assert.h>
#include <math.h>
#include <time.h>
#ifdef HAVE_KEXIV2
#include <libkexiv2/kexiv2.h>
#endif
#include "slideshow.h"
#include "moc_slideshow.cpp"
@ -896,10 +893,8 @@ nexttry:
}
mFileIdx++;
#ifdef HAVE_KEXIV2
KExiv2Iface::KExiv2 exiv(fname);
exiv.rotateExifQImage(mImage, exiv.getImageOrientation());
#endif
KExiv2 exiv(fname);
exiv.rotateImage(mImage);
mImageName = mPrintPath ? fname : QFileInfo(fname).completeBaseName();
}