Commit 9b6e1cda authored by Stefan Brüns's avatar Stefan Brüns
Browse files

Add debug categories for thumbnail kioslave

Adds 3 debug categories:
- log_kio_thumbnail (not yet used)
- log_kio_thumbnail.comic
- log_kio_thumbnail.exr
parent 99b7cb0e
......@@ -12,3 +12,6 @@ log_kio_archive kioslave (archive) IDENTIFIER [KIO_ARCHIVE_LOG]
log_kio_man kioslave (man) IDENTIFIER [KIO_MAN_LOG]
log_kio_recentlyused kioslave (recentlyused) IDENTIFIER [KIO_RECENTLYUSED_LOG]
log_kio_smb kioslave (smb aka samba) IDENTIFIER [KIO_SMB_LOG]
log_kio_thumbnail kioslave (thumbnail) IDENTIFIER [KIO_THUMBNAIL_LOG]
log_kio_thumbnail.comic kioslave (Comic thumbnail) IDENTIFIER [KIO_THUMBNAIL_COMIC_LOG]
log_kio_thumbnail.exr kioslave (EXR thumbnail) IDENTIFIER [KIO_THUMBNAIL_EXR_LOG]
......@@ -27,6 +27,11 @@ include_directories(${CMAKE_BINARY_DIR})
set(kio_thumbnail_PART_SRCS thumbnail.cpp imagefilter.cpp)
ecm_qt_declare_logging_category(kio_thumbnail_PART_SRCS
HEADER thumbnail-logsettings.h
IDENTIFIER KIO_THUMBNAIL_LOG
CATEGORY_NAME log_kio_thumbnail)
add_library(kio_thumbnail MODULE ${kio_thumbnail_PART_SRCS})
target_link_libraries(kio_thumbnail
......@@ -125,6 +130,10 @@ endif()
if(OpenEXR_FOUND)
set(exrthumbnail_PART_SRCS exrcreator.cpp)
ecm_qt_declare_logging_category(exrthumbnail_PART_SRCS
HEADER thumbnail-exr-logsettings.h
IDENTIFIER KIO_THUMBNAIL_EXR_LOG
CATEGORY_NAME log_kio_thumbnail.exr)
add_library(exrthumbnail MODULE ${exrthumbnail_PART_SRCS})
target_link_libraries(exrthumbnail
......@@ -188,6 +197,11 @@ install ( FILES windowsimagethumbnail.desktop DESTINATION ${KDE_INSTALL_KSERVICE
########### next target ###############
set(comicbookthumbnail_SRCS comiccreator.cpp)
ecm_qt_declare_logging_category(comicbookthumbnail_SRCS
HEADER thumbnail-comic-logsettings.h
IDENTIFIER KIO_THUMBNAIL_COMIC_LOG
CATEGORY_NAME log_kio_thumbnail.comic)
add_library(comicbookthumbnail MODULE ${comicbookthumbnail_SRCS})
target_link_libraries(comicbookthumbnail
Qt5::Gui
......
......@@ -28,11 +28,11 @@
// comiccreator.cpp
#include "comiccreator.h"
#include "thumbnail-comic-logsettings.h"
#include <kzip.h>
#include <ktar.h>
#include <k7zip.h>
#include <QDebug>
#include <kprocess.h>
#include <memory>
......@@ -44,10 +44,6 @@
#include <QStandardPaths>
#include <QTemporaryDir>
// For KIO-Thumbnail debug outputs
// TODO KF5 qCDebug
#define KIO_THUMB 11371
extern "C"
{
Q_DECL_EXPORT ThumbCreator *new_creator()
......@@ -86,7 +82,7 @@ bool ComicCreator::create(const QString& path, int width, int height, QImage& im
}
if (cover.isNull()) {
qDebug()<<"Error creating the comic book thumbnail.";
qCDebug(KIO_THUMBNAIL_COMIC_LOG) << "Error creating the comic book thumbnail.";
return false;
}
......@@ -186,7 +182,7 @@ QImage ComicCreator::extractRARImage(const QString& path)
// Check if unrar is available. Get its path in 'unrarPath'.
QString unrar = unrarPath();
if (unrar.isEmpty()) {
qDebug()<<"A suitable version of unrar is not available.";
qCDebug(KIO_THUMBNAIL_COMIC_LOG) << "A suitable version of unrar is not available.";
return QImage();
}
......
......@@ -18,9 +18,9 @@
*/
#include "exrcreator.h"
#include "thumbnail-exr-logsettings.h"
#include <QImage>
#include <QDebug>
#include <QFile>
#include <ImfInputFile.h>
......@@ -43,7 +43,7 @@ bool EXRCreator::create(const QString &path, int, int, QImage &img)
const Imf::Header &h = in.header();
if ( h.hasPreviewImage() ) {
qDebug() << "EXRcreator - using preview";
qCDebug(KIO_THUMBNAIL_EXR_LOG) << "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++ ) {
......@@ -60,7 +60,7 @@ bool EXRCreator::create(const QString &path, int, int, QImage &img)
// 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.
qDebug() << "EXRcreator - using original image";
qCDebug(KIO_THUMBNAIL_EXR_LOG) << "EXRcreator - using original image";
KSharedConfig::Ptr config = KSharedConfig::openConfig();
KConfigGroup configGroup( config, "PreviewSettings" );
unsigned long long maxSize = configGroup.readEntry( "MaximumSize", 1024*1024 /* 1MB */ );
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment