SVN commit 531782 by cgilles:
digikam from stable : Fix broken thumbnail creation by digiKam KIO-slave with 16 bits TIFF images unrecognized properly by dcraw::parse method like a real tiff images. CCBUGS: 125916 CCMAIL: [hidden email] M +55 -34 digikamthumbnail.cpp M +32 -29 digikamthumbnail.h --- branches/stable/extragear/graphics/digikam/kioslave/digikamthumbnail.cpp #531781:531782 @@ -1,30 +1,27 @@ -////////////////////////////////////////////////////////////////////////////// -// -// DIGIKAMTHUMBNAIL.CPP -// -// Copyright (C) 2003-2004 Renchi Raju <renchi at pooh.tam.uiuc.edu> -// Gilles CAULIER <caulier dot gilles at free.fr> -// -// This program is free software; you can redistribute it and/or modify -// it under the terms of the GNU General Public License as published by -// the Free Software Foundation; either version 2 of the License, or -// (at your option) any later version. -// -// This program 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 General Public License for more details. -// -// You should have received a copy of the GNU General Public License -// along with this program; if not, write to the Free Software -// Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. -// -////////////////////////////////////////////////////////////////////////////// +/* ============================================================ + * Authors: Renchi Raju <[hidden email]> + * Gilles Caulier <caulier dot gilles at kdemail dot net> + * Date : 2003-01-15 + * Description : digiKam KIO slave to get image thumbnails. + * + * Copyright 2003-2005 by Renchi Raju, Gilles Caulier + * Copyright 2006 by Gilles Caulier + * + * This program is free software; you can redistribute it + * and/or modify it under the terms of the GNU General + * Public License as published by the Free Software Foundation; + * either version 2, or (at your option) + * any later version. + * + * This program 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 General Public License for more details. + * + * ============================================================ */ #define XMD_H -#include <digikam_export.h> - // Qt Includes. #include <qcstring.h> @@ -32,6 +29,7 @@ #include <qimage.h> #include <qdatastream.h> #include <qfile.h> +#include <qfileinfo.h> #include <qdir.h> #include <qwmatrix.h> #include <qregexp.h> @@ -80,6 +78,7 @@ #include "dcraw_parse.h" #include "digikamthumbnail.h" +#include "digikam_export.h" #define X_DISPLAY_MISSING 1 #include <Imlib2.h> @@ -342,20 +341,25 @@ if (regenerate) { - // Try JPEG loading... - if ( !loadJPEG(img, url.path()) ) + // In first we trying to load image using the file extension. This is mandatory because + // some tiff files are detected like RAW files by dcraw::parse method. + if ( !loadByExtension(img, url.path()) ) { - // Try to load with imlib2 - if ( !loadImlib2(img, url.path()) ) + // Try JPEG loading... + if ( !loadJPEG(img, url.path()) ) { - // Try to load with QT/KDELib - if (!img.load(url.path())) + // Try to load with dcraw : RAW files. + if ( !loadDCRAW(img, url.path()) ) { - // Try to load with KDE thumbcreators - if (!loadKDEThumbCreator(img, url.path())) + // Try to load with imlib2 : TIFF, PNG, etc. + if ( !loadImlib2(img, url.path()) ) { - // Try to load with dcraw - loadDCRAW( img, url.path() ); + // Try to load with QT/KDELib + if ( !img.load(url.path()) ) + { + // Try to load with KDE thumbcreators : video files and others stuff. + loadKDEThumbCreator(img, url.path()); + } } } } @@ -436,7 +440,24 @@ finished(); } +bool kio_digikamthumbnailProtocol::loadByExtension(QImage& image, const QString& path) +{ + QFileInfo fileInfo(path); + if (!fileInfo.exists()) + return false; + + QString ext = fileInfo.extension().upper(); + if (ext == QString("JPEG") || ext == QString("JPG")) + return (loadJPEG(image, path)); + else if (ext == QString("PNG")) + return (image.load(path)); + else if (ext == QString("TIFF") || ext == QString("TIF")) + return (image.load(path)); + + return false; +} + ///////////////////////////////////////////////////////////////////////////////////////// // JPEG Extraction --- branches/stable/extragear/graphics/digikam/kioslave/digikamthumbnail.h #531781:531782 @@ -1,25 +1,24 @@ -////////////////////////////////////////////////////////////////////////////// -// -// DIGIKAMTHUMBNAIL.H -// -// Copyright (C) 2003-2004 Renchi Raju <renchi at pooh.tam.uiuc.edu> -// Gilles CAULIER <caulier dot gilles at free.fr> -// -// This program is free software; you can redistribute it and/or modify -// it under the terms of the GNU General Public License as published by -// the Free Software Foundation; either version 2 of the License, or -// (at your option) any later version. -// -// This program 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 General Public License for more details. -// -// You should have received a copy of the GNU General Public License -// along with this program; if not, write to the Free Software -// Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. -// -////////////////////////////////////////////////////////////////////////////// +/* ============================================================ + * Authors: Renchi Raju <[hidden email]> + * Gilles Caulier <caulier dot gilles at kdemail dot net> + * Date : 2003-01-15 + * Description : digiKam KIO slave to get image thumbnails. + * + * Copyright 2003-2005 by Renchi Raju, Gilles Caulier + * Copyright 2006 by Gilles Caulier + * + * This program is free software; you can redistribute it + * and/or modify it under the terms of the GNU General + * Public License as published by the Free Software Foundation; + * either version 2, or (at your option) + * any later version. + * + * This program 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 General Public License for more details. + * + * ============================================================ */ #ifndef _digikamthumbnail_H_ #define _digikamthumbnail_H_ @@ -36,6 +35,7 @@ class kio_digikamthumbnailProtocol : public KIO::SlaveBase { + public: kio_digikamthumbnailProtocol(int argc, char** argv); @@ -44,22 +44,25 @@ private: + bool loadByExtension(QImage& image, const QString& path); bool loadJPEG(QImage& image, const QString& path); bool loadImlib2(QImage& image, const QString& path); bool loadKDEThumbCreator(QImage& image, const QString& path); bool loadDCRAW(QImage& image, const QString& path); void createThumbnailDirs(); - int cachedSize_; +private: - int org_width_; - int org_height_; - int new_width_; - int new_height_; + int cachedSize_; - QString smallThumbPath_; - QString bigThumbPath_; + int org_width_; + int org_height_; + int new_width_; + int new_height_; + QString smallThumbPath_; + QString bigThumbPath_; + QApplication *app_; int argc_; char** argv_; _______________________________________________ Digikam-devel mailing list [hidden email] https://mail.kde.org/mailman/listinfo/digikam-devel |
Free forum by Nabble | Edit this page |