[Digikam-devel] extragear/graphics/digikam/utilities/cameragui
Gilles Caulier
caulier.gilles at free.fr
Sat Dec 24 13:41:39 GMT 2005
SVN commit 491071 by cgilles:
digiKam from trunk : It's Christmast Time !
Camera Interface can display RAW file thumbnails. Tom you can backport this commit into stable branch.
Next stage is to create new DImg method to get thumbnail.
CCMAIL: digikam-devel at kde.org
M +10 -9 Makefile.am
M +48 -14 umscamera.cpp
--- trunk/extragear/graphics/digikam/utilities/cameragui/Makefile.am #491070:491071
@@ -2,20 +2,21 @@
noinst_LTLIBRARIES = libcameragui.la
-libcameragui_la_SOURCES = cameraui.cpp cameraiconview.cpp \
- cameraiconitem.cpp cameracontroller.cpp \
- animwidget.cpp renamecustomizer.cpp \
- dkcamera.cpp gpcamera.cpp umscamera.cpp \
- gpiteminfo.cpp gpiteminfodlg.cpp camerainfodialog.cpp \
- albumselectdialog.cpp
+libcameragui_la_SOURCES = cameraui.cpp cameraiconview.cpp \
+ cameraiconitem.cpp cameracontroller.cpp \
+ animwidget.cpp renamecustomizer.cpp \
+ dkcamera.cpp gpcamera.cpp umscamera.cpp \
+ gpiteminfo.cpp gpiteminfodlg.cpp camerainfodialog.cpp \
+ albumselectdialog.cpp
libcameragui_la_LDFLAGS = $(all_libraries) $(KDE_RPATH)
libcameragui_la_LIBADD = $(LIB_GPHOTO) $(LIBKEXIF_LIBS) $(LIBJPEG)
INCLUDES= -I$(top_srcdir)/digikam/digikam \
- -I$(top_srcdir)/digikam/utilities/imageeditor/editor \
- -I$(top_srcdir)/digikam/libs/jpegutils \
- $(GPHOTO_CFLAGS) $(LIBKEXIF_CFLAGS) $(all_includes)
+ -I$(top_srcdir)/digikam/utilities/imageeditor/editor \
+ -I$(top_srcdir)/digikam/libs/jpegutils \
+ -I$(top_srcdir)/digikam/libs/dcraw \
+ $(GPHOTO_CFLAGS) $(LIBKEXIF_CFLAGS) $(all_includes)
digikamcameraguiicondir = $(kde_datadir)/digikam/icons
digikamcameraguiicon_ICON = AUTO
--- trunk/extragear/graphics/digikam/utilities/cameragui/umscamera.cpp #491070:491071
@@ -1,10 +1,12 @@
/* ============================================================
* Author: Renchi Raju <renchi at pooh.tam.uiuc.edu>
+ * Gilles Caulier <caulier dot gilles at free.fr>
* Date : 2004-12-21
* Description :
*
- * Copyright 2004 by Renchi Raju
-
+ * Copyright 2004-2005 by Renchi Raju
+ * Copyright 2005 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;
@@ -18,14 +20,8 @@
*
* ============================================================ */
-#include <kdebug.h>
+// C Ansi includes.
-#include <qdir.h>
-#include <qfileinfo.h>
-#include <qfile.h>
-#include <qstringlist.h>
-#include <qdeepcopy.h>
-
extern "C"
{
#include <sys/types.h>
@@ -34,10 +30,27 @@
#include <utime.h>
}
+// QT includes.
+
+#include <qdir.h>
+#include <qfileinfo.h>
+#include <qfile.h>
+#include <qstringlist.h>
+#include <qdeepcopy.h>
+
+// KDE includes.
+
+#include <ktempfile.h>
+#include <kdebug.h>
+
+// LibKExif includes.
+
#include <libkexif/kexifdata.h>
+// Local includes.
+
+#include "dcraw_parse.h"
#include "albumsettings.h"
-
#include "umscamera.h"
UMSCamera::UMSCamera(const QString& model,
@@ -130,17 +143,38 @@
QImage& thumbnail)
{
m_cancel = false;
+
+ // Trying to get thumbnail from Exif data.
+
KExifData exifData;
- if (!exifData.readFromFile(folder + "/" + itemName))
+
+ if (exifData.readFromFile(folder + "/" + itemName))
{
- return false;
+ thumbnail = exifData.getThumbnail();
+ if (!thumbnail.isNull())
+ return true;
}
+
+ // Trying to get thumbnail from RAW file using dcraw parse utility.
- thumbnail = exifData.getThumbnail();
+ KTempFile thumbFile(QString::null, "camerarawthumb");
+ thumbFile.setAutoDelete(true);
+ Digikam::DcrawParse rawFileParser;
+
+ if (thumbFile.status() == 0)
+ {
+ if (rawFileParser.getThumbnail(QFile::encodeName(folder + "/" + itemName),
+ QFile::encodeName(thumbFile.name())) == 0)
+ {
+ thumbnail.load(thumbFile.name());
+ if (!thumbnail.isNull())
+ return true;
+ }
+ }
// TODO: check for thm files if we didn't manage to get thumbnail from exif
- return true;
+ return false;
}
bool UMSCamera::getExif(const QString& ,
More information about the Digikam-devel
mailing list