[prev in list] [next in list] [prev in thread] [next in thread]
List: kde-commits
Subject: [digikam] libs/dimg/loaders: fix warnings under M$ Visual C++ 2012
From: Gilles Caulier <caulier.gilles () gmail ! com>
Date: 2012-09-21 12:55:00
Message-ID: 20120921125500.AA97FA6094 () git ! kde ! org
[Download RAW message or body]
Git commit a6a7bca71ef18877af1f93dfd4cc483b188d34c1 by Gilles Caulier.
Committed on 21/09/2012 at 14:54.
Pushed by cgilles into branch 'master'.
fix warnings under M$ Visual C++ 2012
use const ref
remove unused methods and declaration
constify and polish
M +26 -11 libs/dimg/loaders/dimgloader.cpp
M +28 -26 libs/dimg/loaders/dimgloader.h
M +17 -10 libs/dimg/loaders/dimgloaderobserver.h
M +9 -4 libs/dimg/loaders/jp2kloader.cpp
M +5 -8 libs/dimg/loaders/jp2kloader.h
M +7 -8 libs/dimg/loaders/jp2ksettings.cpp
M +6 -7 libs/dimg/loaders/jp2ksettings.h
M +20 -5 libs/dimg/loaders/jpegloader.cpp
M +8 -18 libs/dimg/loaders/jpegloader.h
M +7 -7 libs/dimg/loaders/jpegsettings.cpp
M +6 -7 libs/dimg/loaders/jpegsettings.h
M +5 -0 libs/dimg/loaders/pgfloader.cpp
M +1 -4 libs/dimg/loaders/pgfloader.h
M +7 -7 libs/dimg/loaders/pgfsettings.cpp
M +6 -7 libs/dimg/loaders/pgfsettings.h
M +7 -268 libs/dimg/loaders/pngloader.cpp
M +5 -18 libs/dimg/loaders/pngloader.h
M +5 -5 libs/dimg/loaders/pngsettings.cpp
M +5 -6 libs/dimg/loaders/pngsettings.h
M +19 -4 libs/dimg/loaders/ppmloader.cpp
M +8 -22 libs/dimg/loaders/ppmloader.h
M +13 -3 libs/dimg/loaders/qimageloader.cpp
M +7 -13 libs/dimg/loaders/qimageloader.h
M +31 -10 libs/dimg/loaders/rawloader.cpp
M +14 -29 libs/dimg/loaders/rawloader.h
M +14 -9 libs/dimg/loaders/tiffloader.cpp
M +8 -11 libs/dimg/loaders/tiffloader.h
M +6 -6 libs/dimg/loaders/tiffsettings.cpp
M +5 -6 libs/dimg/loaders/tiffsettings.h
http://commits.kde.org/digikam/a6a7bca71ef18877af1f93dfd4cc483b188d34c1
diff --git a/libs/dimg/loaders/dimgloader.cpp b/libs/dimg/loaders/dimgloader.cpp
index 5b2ad11..b112f12 100644
--- a/libs/dimg/loaders/dimgloader.cpp
+++ b/libs/dimg/loaders/dimgloader.cpp
@@ -6,8 +6,8 @@
* Date : 2005-06-14
* Description : DImg image loader interface
*
- * Copyright (C) 2005 by Renchi Raju <renchi dot raju at gmail dot com>
- * Copyright (C) 2005-2011 by Gilles Caulier <caulier dot gilles at gmail dot com>
+ * Copyright (C) 2005 by Renchi Raju <renchi dot raju at gmail dot com>
+ * Copyright (C) 2005-2012 by Gilles Caulier <caulier dot gilles at gmail dot com>
*
* This program is free software; you can redistribute it
* and/or modify it under the terms of the GNU General
@@ -52,12 +52,17 @@
namespace Digikam
{
-DImgLoader::DImgLoader(DImg* image)
+DImgLoader::DImgLoader(DImg* const image)
: m_image(image)
{
m_loadFlags = LoadAll;
}
+DImgLoader::~DImgLoader()
+{
+}
+
+
void DImgLoader::setLoadFlags(LoadFlags flags)
{
m_loadFlags = flags;
@@ -68,7 +73,7 @@ bool DImgLoader::hasLoadedData() const
return (m_loadFlags & LoadImageData) && m_image->m_priv->data;
}
-int DImgLoader::granularity(DImgLoaderObserver* observer, int total, float \
progressSlice) +int DImgLoader::granularity(DImgLoaderObserver* const observer, int \
total, float progressSlice) {
// Splits expect total value into the chunks where checks shall occur
// and combines this with a possible correction factor from observer.
@@ -125,12 +130,12 @@ void DImgLoader::imageSetIccProfile(const IccProfile& profile)
m_image->setIccProfile(profile);
}
-QVariant DImgLoader::imageGetAttribute(const QString& key)
+QVariant DImgLoader::imageGetAttribute(const QString& key) const
{
return m_image->attribute(key);
}
-QString DImgLoader::imageGetEmbbededText(const QString& key)
+QString DImgLoader::imageGetEmbbededText(const QString& key) const
{
return m_image->embeddedText(key);
}
@@ -140,7 +145,7 @@ void DImgLoader::imageSetAttribute(const QString& key, const \
QVariant& value) m_image->setAttribute(key, value);
}
-QMap<QString, QString>& DImgLoader::imageEmbeddedText()
+QMap<QString, QString>& DImgLoader::imageEmbeddedText() const
{
return m_image->m_priv->embeddedText;
}
@@ -272,7 +277,7 @@ bool DImgLoader::saveMetadata(const QString& filePath)
return metaDataToFile.applyChanges();
}
-bool DImgLoader::checkExifWorkingColorSpace()
+bool DImgLoader::checkExifWorkingColorSpace() const
{
DMetadata metaData(m_image->getMetadata());
IccProfile profile = metaData.getIccProfile();
@@ -305,7 +310,7 @@ void DImgLoader::purgeExifWorkingColorSpace()
m_image->setMetadata(meta.data());
}
-QByteArray DImgLoader::uniqueHashV2(const QString& filePath, const DImg* img)
+QByteArray DImgLoader::uniqueHashV2(const QString& filePath, const DImg* const img)
{
QFile file(filePath);
@@ -318,7 +323,7 @@ QByteArray DImgLoader::uniqueHashV2(const QString& filePath, \
const DImg* img)
// Specified size: 100 kB; but limit to file size
const qint64 specifiedSize = 100 * 1024; // 100 kB
- qint64 size = qMin(file.size(), specifiedSize);
+ qint64 size = qMin(file.size(), specifiedSize);
if (size)
{
@@ -384,7 +389,7 @@ QByteArray DImgLoader::uniqueHash(const QString& filePath, const \
DImg& img, bool QFile qfile(filePath);
char databuf[8192];
- int readlen = 0;
+ int readlen = 0;
QByteArray size = 0;
QByteArray hash;
@@ -407,4 +412,14 @@ QByteArray DImgLoader::uniqueHash(const QString& filePath, const \
DImg& img, bool return hash;
}
+unsigned char* DImgLoader::new_failureTolerant(size_t unsecureSize)
+{
+ return new_failureTolerant<unsigned char>(unsecureSize);
+}
+
+unsigned short* DImgLoader::new_short_failureTolerant(size_t unsecureSize)
+{
+ return new_failureTolerant<unsigned short>(unsecureSize);
+}
+
} // namespace Digikam
diff --git a/libs/dimg/loaders/dimgloader.h b/libs/dimg/loaders/dimgloader.h
index 87fbdf6..8e21440 100644
--- a/libs/dimg/loaders/dimgloader.h
+++ b/libs/dimg/loaders/dimgloader.h
@@ -6,8 +6,8 @@
* Date : 2005-06-14
* Description : DImg image loader interface
*
- * Copyright (C) 2005 by Renchi Raju <renchi dot raju at gmail dot com>
- * Copyright (C) 2005-2010 by Gilles Caulier <caulier dot gilles at gmail dot com>
+ * Copyright (C) 2005 by Renchi Raju <renchi dot raju at gmail dot com>
+ * Copyright (C) 2005-2012 by Gilles Caulier <caulier dot gilles at gmail dot com>
*
* This program is free software; you can redistribute it
* and/or modify it under the terms of the GNU General
@@ -63,26 +63,26 @@ public:
};
Q_DECLARE_FLAGS(LoadFlags, LoadFlag)
- virtual ~DImgLoader() {};
+public:
void setLoadFlags(LoadFlags flags);
- virtual bool load(const QString& filePath, DImgLoaderObserver* observer) = 0;
- virtual bool save(const QString& filePath, DImgLoaderObserver* observer) = 0;
+ virtual ~DImgLoader();
+
+ virtual bool load(const QString& filePath, DImgLoaderObserver* const observer) = \
0; + virtual bool save(const QString& filePath, DImgLoaderObserver* const \
observer) = 0;
+ virtual bool hasLoadedData() const;
virtual bool hasAlpha() const = 0;
virtual bool sixteenBit() const = 0;
virtual bool isReadOnly() const = 0;
- virtual bool hasLoadedData() const;
- static QByteArray uniqueHashV2(const QString& filePath, const DImg* img = 0);
- static QByteArray uniqueHash(const QString& filePath, const DImg& img, bool \
loadMetadata); + static QByteArray uniqueHashV2(const QString& filePath, const \
DImg* const img = 0); + static QByteArray uniqueHash(const QString& filePath, \
const DImg& img, bool loadMetadata);
static HistoryImageId createHistoryImageId(const QString& filePath, const DImg& \
img, const DMetadata& metadata);
- static unsigned char* new_failureTolerant(size_t unsecureSize)
- { return new_failureTolerant<unsigned char>(unsecureSize); }
- static unsigned short* new_short_failureTolerant(size_t unsecureSize)
- { return new_failureTolerant<unsigned short>(unsecureSize); }
+ static unsigned char* new_failureTolerant(size_t unsecureSize);
+ static unsigned short* new_short_failureTolerant(size_t unsecureSize);
static int checkAllocation(qint64 fullSize);
@@ -90,48 +90,50 @@ public:
protected:
- DImgLoader(DImg* image);
+ DImgLoader(DImg* const image);
unsigned char*& imageData();
unsigned int& imageWidth();
unsigned int& imageHeight();
- bool imageHasAlpha() const;
+ bool imageHasAlpha() const;
bool imageSixteenBit() const;
- int imageBitsDepth() const;
+ int imageBitsDepth() const;
int imageBytesDepth() const;
void imageSetIccProfile(const IccProfile& profile);
- QVariant imageGetAttribute(const QString& key);
+ QVariant imageGetAttribute(const QString& key) const;
void imageSetAttribute(const QString& key, const QVariant& \
value);
- QMap<QString, QString>& imageEmbeddedText();
- KExiv2Data imageMetadata();
- KExiv2Data videoMetadata();
- QString imageGetEmbbededText(const QString& key);
+ QMap<QString, QString>& imageEmbeddedText() const;
+ QString imageGetEmbbededText(const QString& key) const;
void imageSetEmbbededText(const QString& key, const QString& \
text);
+ void loadingFailed();
+ bool checkExifWorkingColorSpace() const;
+ void purgeExifWorkingColorSpace();
+ void storeColorProfileInMetadata();
+
virtual bool readMetadata(const QString& filePath, DImg::FORMAT ff);
virtual bool saveMetadata(const QString& filePath);
- void loadingFailed();
virtual int granularity(DImgLoaderObserver* observer, int total, \
float progressSlice = 1.0);
- bool checkExifWorkingColorSpace();
- void purgeExifWorkingColorSpace();
- void storeColorProfileInMetadata();
protected:
- DImg* m_image;
- LoadFlags m_loadFlags;
+ DImg* m_image;
+ LoadFlags m_loadFlags;
private:
DImgLoader();
};
+// ---------------------------------------------------------------------------------------------------
+
template <typename Type>
+
Q_INLINE_TEMPLATE Type* DImgLoader::new_failureTolerant(size_t size)
{
if (!checkAllocation(size))
diff --git a/libs/dimg/loaders/dimgloaderobserver.h \
b/libs/dimg/loaders/dimgloaderobserver.h index 8835f2b..906dc4f 100644
--- a/libs/dimg/loaders/dimgloaderobserver.h
+++ b/libs/dimg/loaders/dimgloaderobserver.h
@@ -6,7 +6,7 @@
* Date : 2006-01-03
* Description : DImgLoader observer interface
*
- * Copyright (C) 2006-2011 by Marcel Wiesweg <marcel.wiesweg@gmx.de>
+ * Copyright (C) 2006-2012 by Marcel Wiesweg <marcel.wiesweg@gmx.de>
*
* This program is free software; you can redistribute it
* and/or modify it under the terms of the GNU General
@@ -37,26 +37,33 @@ class DIGIKAM_EXPORT DImgLoaderObserver
{
public:
- // posts progress information about image IO
+
+ virtual ~DImgLoaderObserver()
+ {
+ };
+
+ /** Posts progress information about image IO
+ */
virtual void progressInfo(const DImg*, float /*progress*/)
- {};
+ {
+ };
- // queries whether the image IO operation shall be continued
+ /** Queries whether the image IO operation shall be continued
+ */
virtual bool continueQuery(const DImg*)
{
return true;
};
- // Return a relative value which determines the granularity, the frequency
- // with which the DImgLoaderObserver is checked and progress is posted.
- // Standard is 1.0. Values < 1 mean less granularity (fewer checks),
- // values > 1 mean higher granularity (more checks).
+ /** Return a relative value which determines the granularity, the frequency
+ * with which the DImgLoaderObserver is checked and progress is posted.
+ * Standard is 1.0. Values < 1 mean less granularity (fewer checks),
+ * values > 1 mean higher granularity (more checks).
+ */
virtual float granularity()
{
return 1.0;
};
-
- virtual ~DImgLoaderObserver() {};
};
} // namespace Digikam
diff --git a/libs/dimg/loaders/jp2kloader.cpp b/libs/dimg/loaders/jp2kloader.cpp
index ea3ade8..11d73bd 100644
--- a/libs/dimg/loaders/jp2kloader.cpp
+++ b/libs/dimg/loaders/jp2kloader.cpp
@@ -6,7 +6,7 @@
* Date : 2006-06-14
* Description : A JPEG2000 IO file for DImg framework
*
- * Copyright (C) 2006-2011 by Gilles Caulier <caulier dot gilles at gmail dot com>
+ * Copyright (C) 2006-2012 by Gilles Caulier <caulier dot gilles at gmail dot com>
*
* This implementation use Jasper API
* library : http://www.ece.uvic.ca/~mdadams/jasper
@@ -53,14 +53,14 @@
namespace Digikam
{
-JP2KLoader::JP2KLoader(DImg* image)
+JP2KLoader::JP2KLoader(DImg* const image)
: DImgLoader(image)
{
m_hasAlpha = false;
m_sixteenBit = false;
}
-bool JP2KLoader::load(const QString& filePath, DImgLoaderObserver* observer)
+bool JP2KLoader::load(const QString& filePath, DImgLoaderObserver* const observer)
{
readMetadata(filePath, DImg::JPEG);
@@ -558,7 +558,7 @@ bool JP2KLoader::load(const QString& filePath, \
DImgLoaderObserver* observer) return true;
}
-bool JP2KLoader::save(const QString& filePath, DImgLoaderObserver* observer)
+bool JP2KLoader::save(const QString& filePath, DImgLoaderObserver* const observer)
{
FILE* file = fopen(QFile::encodeName(filePath), "wb");
@@ -851,4 +851,9 @@ bool JP2KLoader::sixteenBit() const
return m_sixteenBit;
}
+bool JP2KLoader::isReadOnly() const
+{
+ return false;
+};
+
} // namespace Digikam
diff --git a/libs/dimg/loaders/jp2kloader.h b/libs/dimg/loaders/jp2kloader.h
index 51694b4..9e238ef 100644
--- a/libs/dimg/loaders/jp2kloader.h
+++ b/libs/dimg/loaders/jp2kloader.h
@@ -6,7 +6,7 @@
* Date : 2006-06-14
* Description : A JPEG2000 IO file for DImg framework
*
- * Copyright (C) 2006-2009 by Gilles Caulier <caulier dot gilles at gmail dot com>
+ * Copyright (C) 2006-2012 by Gilles Caulier <caulier dot gilles at gmail dot com>
*
* This program is free software; you can redistribute it
* and/or modify it under the terms of the GNU General
@@ -49,17 +49,14 @@ class DIGIKAM_EXPORT JP2KLoader : public DImgLoader
public:
- JP2KLoader(DImg* image);
+ JP2KLoader(DImg* const image);
- bool load(const QString& filePath, DImgLoaderObserver* observer);
- bool save(const QString& filePath, DImgLoaderObserver* observer);
+ bool load(const QString& filePath, DImgLoaderObserver* const observer);
+ bool save(const QString& filePath, DImgLoaderObserver* const observer);
virtual bool hasAlpha() const;
virtual bool sixteenBit() const;
- virtual bool isReadOnly() const
- {
- return false;
- };
+ virtual bool isReadOnly() const;
private:
diff --git a/libs/dimg/loaders/jp2ksettings.cpp b/libs/dimg/loaders/jp2ksettings.cpp
index 9d978cc..fbed3a0 100644
--- a/libs/dimg/loaders/jp2ksettings.cpp
+++ b/libs/dimg/loaders/jp2ksettings.cpp
@@ -6,7 +6,7 @@
* Date : 2007-08-02
* Description : save JPEG 2000 image options.
*
- * Copyright (C) 2007 by Gilles Caulier <caulier dot gilles at gmail dot com>
+ * Copyright (C) 2007-2012 by Gilles Caulier <caulier dot gilles at gmail dot com>
*
* This program is free software; you can redistribute it
* and/or modify it under the terms of the GNU General
@@ -21,7 +21,6 @@
*
* ============================================================ */
-
#include "jp2ksettings.moc"
// Qt includes
@@ -41,12 +40,12 @@
namespace Digikam
{
-class JP2KSettingsPriv
+class JP2KSettings::Private
{
public:
- JP2KSettingsPriv()
+ Private()
{
JPEG2000Grid = 0;
labelJPEG2000compression = 0;
@@ -63,8 +62,8 @@ public:
KIntNumInput* JPEG2000compression;
};
-JP2KSettings::JP2KSettings(QWidget* parent)
- : QWidget(parent), d(new JP2KSettingsPriv)
+JP2KSettings::JP2KSettings(QWidget* const parent)
+ : QWidget(parent), d(new Private)
{
setAttribute(Qt::WA_DeleteOnClose);
@@ -118,7 +117,7 @@ void JP2KSettings::setCompressionValue(int val)
d->JPEG2000compression->setValue(val);
}
-int JP2KSettings::getCompressionValue()
+int JP2KSettings::getCompressionValue() const
{
return d->JPEG2000compression->value();
}
@@ -129,7 +128,7 @@ void JP2KSettings::setLossLessCompression(bool b)
slotToggleJPEG2000LossLess(d->JPEG2000LossLess->isChecked());
}
-bool JP2KSettings::getLossLessCompression()
+bool JP2KSettings::getLossLessCompression() const
{
return d->JPEG2000LossLess->isChecked();
}
diff --git a/libs/dimg/loaders/jp2ksettings.h b/libs/dimg/loaders/jp2ksettings.h
index a69186c..3760bd4 100644
--- a/libs/dimg/loaders/jp2ksettings.h
+++ b/libs/dimg/loaders/jp2ksettings.h
@@ -6,7 +6,7 @@
* Date : 2007-08-02
* Description : save JPEG 2000 image options.
*
- * Copyright (C) 2007-2009 by Gilles Caulier <caulier dot gilles at gmail dot com>
+ * Copyright (C) 2007-2012 by Gilles Caulier <caulier dot gilles at gmail dot com>
*
* This program is free software; you can redistribute it
* and/or modify it under the terms of the GNU General
@@ -35,22 +35,20 @@
namespace Digikam
{
-class JP2KSettingsPriv;
-
class DIGIKAM_EXPORT JP2KSettings : public QWidget
{
Q_OBJECT
public:
- JP2KSettings(QWidget* parent = 0);
+ JP2KSettings(QWidget* const parent = 0);
~JP2KSettings();
void setCompressionValue(int val);
- int getCompressionValue();
+ int getCompressionValue() const;
void setLossLessCompression(bool b);
- bool getLossLessCompression();
+ bool getLossLessCompression() const;
Q_SIGNALS:
@@ -62,7 +60,8 @@ private Q_SLOTS:
private:
- JP2KSettingsPriv* const d;
+ class Private;
+ Private* const d;
};
} // namespace Digikam
diff --git a/libs/dimg/loaders/jpegloader.cpp b/libs/dimg/loaders/jpegloader.cpp
index fd03fbf..56fa4ba 100644
--- a/libs/dimg/loaders/jpegloader.cpp
+++ b/libs/dimg/loaders/jpegloader.cpp
@@ -6,8 +6,8 @@
* Date : 2005-06-14
* Description : A JPEG IO file for DImg framework
*
- * Copyright (C) 2005 by Renchi Raju <renchi dot raju at gmail dot com>
- * Copyright (C) 2005-2011 by Gilles Caulier <caulier dot gilles at gmail dot com>
+ * Copyright (C) 2005 by Renchi Raju <renchi dot raju at gmail dot com>
+ * Copyright (C) 2005-2012 by Gilles Caulier <caulier dot gilles at gmail dot com>
*
* This program is free software; you can redistribute it
* and/or modify it under the terms of the GNU General
@@ -93,12 +93,12 @@ void JPEGLoader::dimg_jpeg_output_message(j_common_ptr cinfo)
#endif
}
-JPEGLoader::JPEGLoader(DImg* image)
+JPEGLoader::JPEGLoader(DImg* const image)
: DImgLoader(image)
{
}
-bool JPEGLoader::load(const QString& filePath, DImgLoaderObserver* observer)
+bool JPEGLoader::load(const QString& filePath, DImgLoaderObserver* const observer)
{
readMetadata(filePath, DImg::JPEG);
@@ -622,7 +622,7 @@ bool JPEGLoader::load(const QString& filePath, \
DImgLoaderObserver* observer) return true;
}
-bool JPEGLoader::save(const QString& filePath, DImgLoaderObserver* observer)
+bool JPEGLoader::save(const QString& filePath, DImgLoaderObserver* const observer)
{
FILE* file = fopen(QFile::encodeName(filePath), "wb");
@@ -894,4 +894,19 @@ bool JPEGLoader::save(const QString& filePath, \
DImgLoaderObserver* observer) return true;
}
+bool JPEGLoader::hasAlpha() const
+{
+ return false;
+};
+
+bool JPEGLoader::sixteenBit() const
+{
+ return false;
+};
+
+bool JPEGLoader::isReadOnly() const
+{
+ return false;
+};
+
} // namespace Digikam
diff --git a/libs/dimg/loaders/jpegloader.h b/libs/dimg/loaders/jpegloader.h
index 102b606..336584a 100644
--- a/libs/dimg/loaders/jpegloader.h
+++ b/libs/dimg/loaders/jpegloader.h
@@ -6,8 +6,8 @@
* Date : 2005-06-14
* Description : A JPEG IO file for DImg framework
*
- * Copyright (C) 2005 by Renchi Raju <renchi dot raju at gmail dot com>, Gilles \
Caulier
- * Copyright (C) 2005-2009 by Gilles Caulier <caulier dot gilles at gmail dot com>
+ * Copyright (C) 2005 by Renchi Raju <renchi dot raju at gmail dot com>, Gilles \
Caulier + * Copyright (C) 2005-2012 by Gilles Caulier <caulier dot gilles at gmail \
dot com>
*
* This program is free software; you can redistribute it
* and/or modify it under the terms of the GNU General
@@ -56,23 +56,14 @@ class DIGIKAM_EXPORT JPEGLoader : public DImgLoader
public:
- JPEGLoader(DImg* image);
+ JPEGLoader(DImg* const image);
- bool load(const QString& filePath, DImgLoaderObserver* observer);
- bool save(const QString& filePath, DImgLoaderObserver* observer);
+ bool load(const QString& filePath, DImgLoaderObserver* const observer);
+ bool save(const QString& filePath, DImgLoaderObserver* const observer);
- virtual bool hasAlpha() const
- {
- return false;
- };
- virtual bool sixteenBit() const
- {
- return false;
- };
- virtual bool isReadOnly() const
- {
- return false;
- };
+ virtual bool hasAlpha() const;
+ virtual bool sixteenBit() const;
+ virtual bool isReadOnly() const;
private:
@@ -86,7 +77,6 @@ private:
static void dimg_jpeg_error_exit(j_common_ptr cinfo);
static void dimg_jpeg_emit_message(j_common_ptr cinfo, int msg_level);
static void dimg_jpeg_output_message(j_common_ptr cinfo);
-
};
} // namespace Digikam
diff --git a/libs/dimg/loaders/jpegsettings.cpp b/libs/dimg/loaders/jpegsettings.cpp
index 82d0849..befd0ba 100644
--- a/libs/dimg/loaders/jpegsettings.cpp
+++ b/libs/dimg/loaders/jpegsettings.cpp
@@ -6,7 +6,7 @@
* Date : 2007-08-02
* Description : save JPEG image options.
*
- * Copyright (C) 2007-2009 by Gilles Caulier <caulier dot gilles at gmail dot com>
+ * Copyright (C) 2007-2012 by Gilles Caulier <caulier dot gilles at gmail dot com>
*
* This program is free software; you can redistribute it
* and/or modify it under the terms of the GNU General
@@ -41,12 +41,12 @@
namespace Digikam
{
-class JPEGSettingsPriv
+class JPEGSettings::Private
{
public:
- JPEGSettingsPriv() :
+ Private() :
JPEGGrid(0),
labelJPEGcompression(0),
labelWarning(0),
@@ -67,8 +67,8 @@ public:
KIntNumInput* JPEGcompression;
};
-JPEGSettings::JPEGSettings(QWidget* parent)
- : QWidget(parent), d(new JPEGSettingsPriv)
+JPEGSettings::JPEGSettings(QWidget* const parent)
+ : QWidget(parent), d(new Private)
{
setAttribute(Qt::WA_DeleteOnClose);
@@ -142,7 +142,7 @@ void JPEGSettings::setCompressionValue(int val)
d->JPEGcompression->setValue(val);
}
-int JPEGSettings::getCompressionValue()
+int JPEGSettings::getCompressionValue() const
{
return d->JPEGcompression->value();
}
@@ -152,7 +152,7 @@ void JPEGSettings::setSubSamplingValue(int val)
d->subSamplingCB->setCurrentIndex(val);
}
-int JPEGSettings::getSubSamplingValue()
+int JPEGSettings::getSubSamplingValue() const
{
return d->subSamplingCB->currentIndex();
}
diff --git a/libs/dimg/loaders/jpegsettings.h b/libs/dimg/loaders/jpegsettings.h
index 79eafad..162d739 100644
--- a/libs/dimg/loaders/jpegsettings.h
+++ b/libs/dimg/loaders/jpegsettings.h
@@ -6,7 +6,7 @@
* Date : 2007-08-02
* Description : save JPEG image options.
*
- * Copyright (C) 2007-2009 by Gilles Caulier <caulier dot gilles at gmail dot com>
+ * Copyright (C) 2007-2012 by Gilles Caulier <caulier dot gilles at gmail dot com>
*
* This program is free software; you can redistribute it
* and/or modify it under the terms of the GNU General
@@ -35,22 +35,20 @@
namespace Digikam
{
-class JPEGSettingsPriv;
-
class DIGIKAM_EXPORT JPEGSettings : public QWidget
{
Q_OBJECT
public:
- JPEGSettings(QWidget* parent = 0);
+ JPEGSettings(QWidget* const parent = 0);
~JPEGSettings();
void setCompressionValue(int val);
- int getCompressionValue();
+ int getCompressionValue() const;
void setSubSamplingValue(int val);
- int getSubSamplingValue();
+ int getSubSamplingValue() const;
static int convertCompressionForLibJpeg(int value);
@@ -60,7 +58,8 @@ Q_SIGNALS:
private:
- JPEGSettingsPriv* const d;
+ class Private;
+ Private* const d;
};
} // namespace Digikam
diff --git a/libs/dimg/loaders/pgfloader.cpp b/libs/dimg/loaders/pgfloader.cpp
index e553d29..f9bd3ab 100644
--- a/libs/dimg/loaders/pgfloader.cpp
+++ b/libs/dimg/loaders/pgfloader.cpp
@@ -547,4 +547,9 @@ bool PGFLoader::progressCallback(double percent, bool \
escapeAllowed) return false;
}
+bool PGFLoader::isReadOnly() const
+{
+ return false;
+};
+
} // namespace Digikam
diff --git a/libs/dimg/loaders/pgfloader.h b/libs/dimg/loaders/pgfloader.h
index f1c6237..ce338d8 100644
--- a/libs/dimg/loaders/pgfloader.h
+++ b/libs/dimg/loaders/pgfloader.h
@@ -45,10 +45,7 @@ public:
virtual bool hasAlpha() const;
virtual bool sixteenBit() const;
- virtual bool isReadOnly() const
- {
- return false;
- };
+ virtual bool isReadOnly() const;
bool progressCallback(double percent, bool escapeAllowed);
diff --git a/libs/dimg/loaders/pgfsettings.cpp b/libs/dimg/loaders/pgfsettings.cpp
index e04a796..4759046 100644
--- a/libs/dimg/loaders/pgfsettings.cpp
+++ b/libs/dimg/loaders/pgfsettings.cpp
@@ -6,7 +6,7 @@
* Date : 2009-06-06
* Description : save PGF image options.
*
- * Copyright (C) 2009 by Gilles Caulier <caulier dot gilles at gmail dot com>
+ * Copyright (C) 2009-2012 by Gilles Caulier <caulier dot gilles at gmail dot com>
*
* This program is free software; you can redistribute it
* and/or modify it under the terms of the GNU General
@@ -40,12 +40,12 @@
namespace Digikam
{
-class PGFSettingsPriv
+class PGFSettings::Private
{
public:
- PGFSettingsPriv()
+ Private()
{
PGFGrid = 0;
labelPGFcompression = 0;
@@ -62,8 +62,8 @@ public:
KIntNumInput* PGFcompression;
};
-PGFSettings::PGFSettings(QWidget* parent)
- : QWidget(parent), d(new PGFSettingsPriv)
+PGFSettings::PGFSettings(QWidget* const parent)
+ : QWidget(parent), d(new Private)
{
setAttribute(Qt::WA_DeleteOnClose);
@@ -117,7 +117,7 @@ void PGFSettings::setCompressionValue(int val)
d->PGFcompression->setValue(val);
}
-int PGFSettings::getCompressionValue()
+int PGFSettings::getCompressionValue() const
{
return d->PGFcompression->value();
}
@@ -128,7 +128,7 @@ void PGFSettings::setLossLessCompression(bool b)
slotTogglePGFLossLess(d->PGFLossLess->isChecked());
}
-bool PGFSettings::getLossLessCompression()
+bool PGFSettings::getLossLessCompression() const
{
return d->PGFLossLess->isChecked();
}
diff --git a/libs/dimg/loaders/pgfsettings.h b/libs/dimg/loaders/pgfsettings.h
index 1c2530b..4b89396 100644
--- a/libs/dimg/loaders/pgfsettings.h
+++ b/libs/dimg/loaders/pgfsettings.h
@@ -6,7 +6,7 @@
* Date : 2009-06-06
* Description : save PGF image options.
*
- * Copyright (C) 2009 by Gilles Caulier <caulier dot gilles at gmail dot com>
+ * Copyright (C) 2009-2012 by Gilles Caulier <caulier dot gilles at gmail dot com>
*
* This program is free software; you can redistribute it
* and/or modify it under the terms of the GNU General
@@ -35,22 +35,20 @@
namespace Digikam
{
-class PGFSettingsPriv;
-
class DIGIKAM_EXPORT PGFSettings : public QWidget
{
Q_OBJECT
public:
- PGFSettings(QWidget* parent = 0);
+ PGFSettings(QWidget* const parent = 0);
~PGFSettings();
void setCompressionValue(int val);
- int getCompressionValue();
+ int getCompressionValue() const;
void setLossLessCompression(bool b);
- bool getLossLessCompression();
+ bool getLossLessCompression() const;
Q_SIGNALS:
@@ -62,7 +60,8 @@ private Q_SLOTS:
private:
- PGFSettingsPriv* const d;
+ class Private;
+ Private* const d;
};
} // namespace Digikam
diff --git a/libs/dimg/loaders/pngloader.cpp b/libs/dimg/loaders/pngloader.cpp
index afce54c..c11deaa 100644
--- a/libs/dimg/loaders/pngloader.cpp
+++ b/libs/dimg/loaders/pngloader.cpp
@@ -6,7 +6,7 @@
* Date : 2005-11-01
* Description : a PNG image loader for DImg framework.
*
- * Copyright (C) 2005-2011 by Gilles Caulier <caulier dot gilles at gmail dot com>
+ * Copyright (C) 2005-2012 by Gilles Caulier <caulier dot gilles at gmail dot com>
*
* This program is free software; you can redistribute it
* and/or modify it under the terms of the GNU General
@@ -75,14 +75,14 @@ typedef png_bytep iCCP_data;
typedef png_charp iCCP_data;
#endif
-PNGLoader::PNGLoader(DImg* image)
+PNGLoader::PNGLoader(DImg* const image)
: DImgLoader(image)
{
m_hasAlpha = false;
m_sixteenBit = false;
}
-bool PNGLoader::load(const QString& filePath, DImgLoaderObserver* observer)
+bool PNGLoader::load(const QString& filePath, DImgLoaderObserver* const observer)
{
png_uint_32 w32, h32;
int width, height;
@@ -693,7 +693,7 @@ bool PNGLoader::load(const QString& filePath, DImgLoaderObserver* \
observer) return true;
}
-bool PNGLoader::save(const QString& filePath, DImgLoaderObserver* observer)
+bool PNGLoader::save(const QString& filePath, DImgLoaderObserver* const observer)
{
FILE* f;
png_structp png_ptr;
@@ -928,88 +928,6 @@ bool PNGLoader::save(const QString& filePath, \
DImgLoaderObserver* observer) text.compression = PNG_TEXT_COMPRESSION_zTXt;
png_set_text(png_ptr, info_ptr, &(text), 1);
- /*
- // There is an unsolved problem in the following code block, see bug \
#151552.
- // If exiv2 supports writing to PNG, which it does since 0.18, this code is \
not needed
- // and should not be used therefore.
- if (KExiv2Iface::KExiv2::supportMetadataWritting("image/png"))
- {
- // Write embedded Raw profiles metadata (Exif/Iptc) in text tag using \
ImageMagick technique.
- // Write digiKam comment like an iTXt chunk using UTF8 encoding.
- // NOTE: iTXt will be enable by default with libpng >= 1.3.0.
-
- typedef QMap<int, QByteArray> MetaDataMap;
- MetaDataMap metaDataMap = imageMetaData();
-
- for (MetaDataMap::const_iterator it = metaDataMap.constBegin();
- it != metaDataMap.constEnd(); ++it)
- {
- QByteArray ba = it.value();
-
- switch (it.key())
- {
-
- / *
- #ifdef PNG_iTXt_SUPPORTED
- // TODO : this code requires libpng 1.3.0, it is not yet tested \
and crashes. See bug #229340.
-
- case(DImg::COM):
- {
- png_text comment;
- comment.key = const_cast<char*> ("Comment");
- comment.text = ba.data();
- comment.itxt_length = ba.size();
- comment.compression = PNG_ITXT_COMPRESSION_zTXt;
- png_set_text(png_ptr, info_ptr, &(comment), 1);
-
- kDebug() << "Writing digiKam comment into iTXt PNG chunk : " \
<< ba;
- break;
- }
- #endif
- * /
-
- case(DImg::EXIF):
- {
- const uchar ExifHeader[] = {0x45, 0x78, 0x69, 0x66, 0x00, \
0x00};
- QByteArray profile;
-
- // If bytes array do not start with ImageMagick header, Exif \
metadata have been created from
- // scratch using Exiv2. In this case, we need to add Exif \
header from start.
- if (memcmp(ba.data(), "exif", 4) != 0 &&
- memcmp(ba.data(), "iptc", 4) != 0 &&
- memcmp(ba.data(), "xmp", 3) != 0 &&
- memcmp(ba.data(), "profile", 7) != 0)
- {
- profile = QByteArray();
- profile.resize(ba.size() + sizeof(ExifHeader));
- memcpy(profile.data(), ExifHeader, sizeof(ExifHeader));
- memcpy(profile.data() + sizeof(ExifHeader), ba.data(), \
ba.size());
- }
- else
- {
- profile = ba;
- }
-
- writeRawProfile(png_ptr, info_ptr, (png_charp)("exif"), \
profile.data(), (png_uint_32) profile.size());
- break;
- }
- case(DImg::IPTC):
- {
- writeRawProfile(png_ptr, info_ptr, (png_charp)("iptc"), \
ba.data(), (png_uint_32) ba.size());
- break;
- }
- case(DImg::XMP):
- {
- writeRawProfile(png_ptr, info_ptr, (png_charp)("xmp"), \
ba.data(), (png_uint_32) ba.size());
- break;
- }
- default:
- break;
- }
- }
- }
- */
-
if (observer)
{
observer->progressInfo(m_image, 0.2F);
@@ -1132,188 +1050,9 @@ bool PNGLoader::sixteenBit() const
return m_sixteenBit;
}
-void PNGLoader::writeRawProfile(png_struct* ping, png_info* ping_info, char* \
profile_type,
- char* profile_data, png_uint_32 length)
-{
- png_textp text;
-
- register long i;
-
- uchar* sp;
-
- png_charp dp;
-
- png_uint_32 allocated_length, description_length;
-
- const uchar hex[16] = {'0', '1', '2', '3', '4', '5', '6', '7', '8', '9', 'a', \
'b', 'c', 'd', 'e', 'f'};
-
- kDebug() << "Writing Raw profile: type=" << profile_type << ", length=" << \
length;
-
- text = (png_textp) png_malloc(ping, (png_uint_32) \
sizeof(png_text));
- description_length = strlen((const char*) profile_type);
- allocated_length = (png_uint_32)(length * 2 + (length >> 5) + 20 + \
description_length);
-
- text[0].text = (png_charp) png_malloc(ping, allocated_length);
- text[0].key = (png_charp) png_malloc(ping, (png_uint_32) 80);
- text[0].key[0] = '\0';
-
- concatenateString(text[0].key, "Raw profile type ", 4096);
- concatenateString(text[0].key, (const char*) profile_type, 62);
-
- sp = (uchar*)profile_data;
- dp = text[0].text;
- *dp++ = '\n';
-
- copyString(dp, (const char*) profile_type, allocated_length);
-
- dp += description_length;
- *dp++ = '\n';
-
- formatString(dp, allocated_length - strlen(text[0].text), "%8lu ", length);
-
- dp += 8;
-
- for (i = 0; i < (long) length; ++i)
- {
- if (i % 36 == 0)
- {
- *dp++ = '\n';
- }
-
- *(dp++) = (char) hex[((*sp >> 4) & 0x0f)];
- *(dp++) = (char) hex[((*sp++) & 0x0f)];
- }
-
- *dp++ = '\n';
- *dp = '\0';
- text[0].text_length = (png_size_t)(dp - text[0].text);
- text[0].compression = -1;
-
- if (text[0].text_length <= allocated_length)
- {
- png_set_text(ping, ping_info, text, 1);
- }
-
- png_free(ping, text[0].text);
- png_free(ping, text[0].key);
- png_free(ping, text);
-}
-
-size_t PNGLoader::concatenateString(char* destination, const char* source, const \
size_t length) +bool PNGLoader::isReadOnly() const
{
- register char* q;
-
- register const char* p;
-
- register size_t i;
-
- size_t count;
-
- if (!destination || !source || length == 0)
- {
- return 0;
- }
-
- p = source;
- q = destination;
- i = length;
-
- while ((i-- != 0) && (*q != '\0'))
- {
- ++q;
- }
-
- count = (size_t)(q - destination);
- i = length - count;
-
- if (i == 0)
- {
- return(count + strlen(p));
- }
-
- while (*p != '\0')
- {
- if (i != 1)
- {
- *q++ = (*p);
- --i;
- }
-
- ++p;
- }
-
- *q = '\0';
-
- return(count + (p - source));
-}
-
-size_t PNGLoader::copyString(char* destination, const char* source, const size_t \
length)
-{
- register char* q;
-
- register const char* p;
-
- register size_t i;
-
- if (!destination || !source || length == 0)
- {
- return 0;
- }
-
- p = source;
- q = destination;
- i = length;
-
- if ((i != 0) && (--i != 0))
- {
- do
- {
- if ((*q++ = (*p++)) == '\0')
- {
- break;
- }
- }
- while (--i != 0);
- }
-
- if (i == 0)
- {
- if (length != 0)
- {
- *q = '\0';
- }
-
- do
- {
- }
- while (*p++ != '\0');
- }
-
- return((size_t)(p - source - 1));
-}
-
-long PNGLoader::formatString(char* string, const size_t length, const char* format, \
...)
-{
- long n;
-
- va_list operands;
-
- va_start(operands, format);
- n = (long) formatStringList(string, length, format, operands);
- va_end(operands);
- return(n);
-}
-
-long PNGLoader::formatStringList(char* string, const size_t length, const char* \
format, va_list operands)
-{
- int n = vsnprintf(string, length, format, operands);
-
- if (n < 0)
- {
- string[length - 1] = '\0';
- }
-
- return((long) n);
-}
+ return false;
+};
} // namespace Digikam
diff --git a/libs/dimg/loaders/pngloader.h b/libs/dimg/loaders/pngloader.h
index e8ff85f..62bfb55 100644
--- a/libs/dimg/loaders/pngloader.h
+++ b/libs/dimg/loaders/pngloader.h
@@ -6,7 +6,7 @@
* Date : 2005-11-01
* Description : a PNG image loader for DImg framework.
*
- * Copyright (C) 2005-2009 by Gilles Caulier <caulier dot gilles at gmail dot com>
+ * Copyright (C) 2005-2012 by Gilles Caulier <caulier dot gilles at gmail dot com>
*
* This program is free software; you can redistribute it
* and/or modify it under the terms of the GNU General
@@ -48,27 +48,14 @@ class DIGIKAM_EXPORT PNGLoader : public DImgLoader
{
public:
- PNGLoader(DImg* image);
+ PNGLoader(DImg* const image);
- bool load(const QString& filePath, DImgLoaderObserver* observer);
- bool save(const QString& filePath, DImgLoaderObserver* observer);
+ bool load(const QString& filePath, DImgLoaderObserver* const observer);
+ bool save(const QString& filePath, DImgLoaderObserver* const observer);
virtual bool hasAlpha() const;
virtual bool sixteenBit() const;
- virtual bool isReadOnly() const
- {
- return false;
- };
-
-private:
-
- void writeRawProfile(png_struct* ping, png_info* ping_info, char* \
profile_type,
- char* profile_data, png_uint_32 length);
-
- size_t concatenateString(char* destination, const char* source, const size_t \
length);
- size_t copyString(char* destination, const char* source, const size_t length);
- long formatString(char* string, const size_t length, const char* format, ...);
- long formatStringList(char* string, const size_t length, const char* format, \
va_list operands); + virtual bool isReadOnly() const;
private:
diff --git a/libs/dimg/loaders/pngsettings.cpp b/libs/dimg/loaders/pngsettings.cpp
index a318d6a..b5dabef 100644
--- a/libs/dimg/loaders/pngsettings.cpp
+++ b/libs/dimg/loaders/pngsettings.cpp
@@ -6,7 +6,7 @@
* Date : 2007-08-02
* Description : save PNG image options.
*
- * Copyright (C) 2007-2009 by Gilles Caulier <caulier dot gilles at gmail dot com>
+ * Copyright (C) 2007-2012 by Gilles Caulier <caulier dot gilles at gmail dot com>
*
* This program is free software; you can redistribute it
* and/or modify it under the terms of the GNU General
@@ -39,12 +39,12 @@
namespace Digikam
{
-class PNGSettingsPriv
+class PNGSettings::Private
{
public:
- PNGSettingsPriv()
+ Private()
{
PNGGrid = 0;
labelPNGcompression = 0;
@@ -59,7 +59,7 @@ public:
};
PNGSettings::PNGSettings(QWidget* parent)
- : QWidget(parent), d(new PNGSettingsPriv)
+ : QWidget(parent), d(new Private)
{
setAttribute(Qt::WA_DeleteOnClose);
@@ -99,7 +99,7 @@ void PNGSettings::setCompressionValue(int val)
d->PNGcompression->setValue(val);
}
-int PNGSettings::getCompressionValue()
+int PNGSettings::getCompressionValue() const
{
return d->PNGcompression->value();
}
diff --git a/libs/dimg/loaders/pngsettings.h b/libs/dimg/loaders/pngsettings.h
index 53c4a06..9f5afb7 100644
--- a/libs/dimg/loaders/pngsettings.h
+++ b/libs/dimg/loaders/pngsettings.h
@@ -6,7 +6,7 @@
* Date : 2007-08-02
* Description : save PNG image options.
*
- * Copyright (C) 2007-2009 by Gilles Caulier <caulier dot gilles at gmail dot com>
+ * Copyright (C) 2007-2012 by Gilles Caulier <caulier dot gilles at gmail dot com>
*
* This program is free software; you can redistribute it
* and/or modify it under the terms of the GNU General
@@ -35,19 +35,17 @@
namespace Digikam
{
-class PNGSettingsPriv;
-
class DIGIKAM_EXPORT PNGSettings : public QWidget
{
Q_OBJECT
public:
- PNGSettings(QWidget* parent = 0);
+ PNGSettings(QWidget* const parent = 0);
~PNGSettings();
void setCompressionValue(int val);
- int getCompressionValue();
+ int getCompressionValue() const;
static int convertCompressionForLibPng(int value);
@@ -57,7 +55,8 @@ Q_SIGNALS:
private:
- PNGSettingsPriv* const d;
+ class Private;
+ Private* const d;
};
} // namespace Digikam
diff --git a/libs/dimg/loaders/ppmloader.cpp b/libs/dimg/loaders/ppmloader.cpp
index f20e6f7..5f1d467 100644
--- a/libs/dimg/loaders/ppmloader.cpp
+++ b/libs/dimg/loaders/ppmloader.cpp
@@ -7,8 +7,8 @@
* Description : A 16 bits/color/pixel PPM IO file for
* DImg framework
*
- * Copyright (C) 2005 by Renchi Raju <renchi dot raju at gmail dot com>
- * Copyright (C) 2005-2011 by Gilles Caulier <caulier dot gilles at gmail dot com>
+ * Copyright (C) 2005 by Renchi Raju <renchi dot raju at gmail dot com>
+ * Copyright (C) 2005-2012 by Gilles Caulier <caulier dot gilles at gmail dot com>
*
* This program is free software; you can redistribute it
* and/or modify it under the terms of the GNU General
@@ -60,7 +60,7 @@ PPMLoader::PPMLoader(DImg* image)
{
}
-bool PPMLoader::load(const QString& filePath, DImgLoaderObserver* observer)
+bool PPMLoader::load(const QString& filePath, DImgLoaderObserver* const observer)
{
//TODO: progress information
int width, height, rgbmax;
@@ -199,9 +199,24 @@ bool PPMLoader::load(const QString& filePath, \
DImgLoaderObserver* observer) return true;
}
-bool PPMLoader::save(const QString& /*filePath*/, DImgLoaderObserver* /*observer*/)
+bool PPMLoader::save(const QString& /*filePath*/, DImgLoaderObserver* const \
/*observer*/) {
return false;
}
+bool PPMLoader::hasAlpha() const
+{
+ return false;
+}
+
+bool PPMLoader::sixteenBit() const
+{
+ return true;
+}
+
+bool PPMLoader::isReadOnly() const
+{
+ return true;
+};
+
} // namespace Digikam
diff --git a/libs/dimg/loaders/ppmloader.h b/libs/dimg/loaders/ppmloader.h
index 0a3c897..02d725f 100644
--- a/libs/dimg/loaders/ppmloader.h
+++ b/libs/dimg/loaders/ppmloader.h
@@ -7,8 +7,8 @@
* Description : A 16 bits/color/pixel PPM IO file for
* DImg framework
*
- * Copyright (C) 2005 by Renchi Raju <renchi dot raju at gmail dot com>
- * Copyright (C) 2005-2006 by Gilles Caulier <caulier dot gilles at gmail dot com>
+ * Copyright (C) 2005 by Renchi Raju <renchi dot raju at gmail dot com>
+ * Copyright (C) 2005-2012 by Gilles Caulier <caulier dot gilles at gmail dot com>
*
* This program is free software; you can redistribute it
* and/or modify it under the terms of the GNU General
@@ -39,28 +39,14 @@ class DIGIKAM_EXPORT PPMLoader : public DImgLoader
{
public:
- PPMLoader(DImg* image);
+ PPMLoader(DImg* const image);
- bool load(const QString& filePath, DImgLoaderObserver* observer);
- bool save(const QString& filePath, DImgLoaderObserver* observer);
+ bool load(const QString& filePath, DImgLoaderObserver* const observer);
+ bool save(const QString& filePath, DImgLoaderObserver* const observer);
- virtual bool hasAlpha() const
- {
- return false;
- };
- virtual bool sixteenBit() const
- {
- return true;
- };
- virtual bool isReadOnly() const
- {
- return true;
- };
-
-private:
-
- bool m_alpha;
- bool m_sixteenBit;
+ virtual bool hasAlpha() const;
+ virtual bool sixteenBit() const;
+ virtual bool isReadOnly() const;
};
} // namespace Digikam
diff --git a/libs/dimg/loaders/qimageloader.cpp b/libs/dimg/loaders/qimageloader.cpp
index 55fe41f..44030a3 100644
--- a/libs/dimg/loaders/qimageloader.cpp
+++ b/libs/dimg/loaders/qimageloader.cpp
@@ -42,12 +42,12 @@
namespace Digikam
{
-QImageLoader::QImageLoader(DImg* image)
+QImageLoader::QImageLoader(DImg* const image)
: DImgLoader(image)
{
}
-bool QImageLoader::load(const QString& filePath, DImgLoaderObserver* observer)
+bool QImageLoader::load(const QString& filePath, DImgLoaderObserver* const observer)
{
// Loading is opaque to us. No support for stopping from observer,
// progress info are only pseudo values
@@ -145,7 +145,7 @@ bool QImageLoader::load(const QString& filePath, \
DImgLoaderObserver* observer) return true;
}
-bool QImageLoader::save(const QString& filePath, DImgLoaderObserver* observer)
+bool QImageLoader::save(const QString& filePath, DImgLoaderObserver* const observer)
{
QVariant qualityAttr = imageGetAttribute("quality");
int quality = qualityAttr.isValid() ? qualityAttr.toInt() : 90;
@@ -189,4 +189,14 @@ bool QImageLoader::hasAlpha() const
return m_hasAlpha;
}
+bool QImageLoader::sixteenBit() const
+{
+ return false;
+}
+
+bool QImageLoader::isReadOnly() const
+{
+ return false;
+}
+
} // namespace Digikam
diff --git a/libs/dimg/loaders/qimageloader.h b/libs/dimg/loaders/qimageloader.h
index 3d73588..503b86b 100644
--- a/libs/dimg/loaders/qimageloader.h
+++ b/libs/dimg/loaders/qimageloader.h
@@ -6,8 +6,8 @@
* Date : 2005-06-14
* Description : A QImage loader for DImg framework.
*
- * Copyright (C) 2005 by Renchi Raju <renchi dot raju at gmail dot com>
- * Copyright (C) 2006-2007 by Caulier Gilles <caulier dot gilles at gmail dot com>
+ * Copyright (C) 2005 by Renchi Raju <renchi dot raju at gmail dot com>
+ * Copyright (C) 2006-2012 by Caulier Gilles <caulier dot gilles at gmail dot com>
*
* This program is free software; you can redistribute it
* and/or modify it under the terms of the GNU General
@@ -38,20 +38,14 @@ class DIGIKAM_EXPORT QImageLoader : public DImgLoader
{
public:
- QImageLoader(DImg* image);
+ QImageLoader(DImg* const image);
- virtual bool load(const QString& filePath, DImgLoaderObserver* observer);
- virtual bool save(const QString& filePath, DImgLoaderObserver* observer);
+ virtual bool load(const QString& filePath, DImgLoaderObserver* const observer);
+ virtual bool save(const QString& filePath, DImgLoaderObserver* const observer);
virtual bool hasAlpha() const;
- virtual bool sixteenBit() const
- {
- return false;
- };
- virtual bool isReadOnly() const
- {
- return false;
- };
+ virtual bool sixteenBit() const;
+ virtual bool isReadOnly() const;
private:
diff --git a/libs/dimg/loaders/rawloader.cpp b/libs/dimg/loaders/rawloader.cpp
index dd0bcf0..639f6a2 100644
--- a/libs/dimg/loaders/rawloader.cpp
+++ b/libs/dimg/loaders/rawloader.cpp
@@ -7,8 +7,8 @@
* Description : A digital camera RAW files loader for DImg
* framework using an external dcraw instance.
*
- * Copyright (C) 2005-2010 by Gilles Caulier <caulier dot gilles at gmail dot com>
- * Copyright (C) 2005-2010 by Marcel Wiesweg <marcel.wiesweg@gmx.de>
+ * Copyright (C) 2005-2012 by Gilles Caulier <caulier dot gilles at gmail dot com>
+ * Copyright (C) 2005-2012 by Marcel Wiesweg <marcel.wiesweg@gmx.de>
*
* This program is free software; you can redistribute it
* and/or modify it under the terms of the GNU General
@@ -54,7 +54,7 @@
namespace Digikam
{
-RAWLoader::RAWLoader(DImg* image, DRawDecoding rawDecodingSettings)
+RAWLoader::RAWLoader(DImg* const image, const DRawDecoding& rawDecodingSettings)
: DImgLoader(image),
m_observer(0),
m_filter(0)
@@ -65,7 +65,7 @@ RAWLoader::RAWLoader(DImg* image, DRawDecoding rawDecodingSettings)
m_filter->setSettings(rawDecodingSettings);
}
-bool RAWLoader::load(const QString& filePath, DImgLoaderObserver* observer)
+bool RAWLoader::load(const QString& filePath, DImgLoaderObserver* const observer)
{
m_observer = observer;
@@ -129,7 +129,7 @@ bool RAWLoader::load(const QString& filePath, DImgLoaderObserver* \
observer) return false;
}
- if (!loadedFromDcraw(data, width, height, rgbmax, observer))
+ if (!loadedFromRawData(data, width, height, rgbmax, observer))
{
loadingFailed();
return false;
@@ -162,8 +162,8 @@ void RAWLoader::setWaitingDataProgress(double value)
}
}
-bool RAWLoader::loadedFromDcraw(QByteArray data, int width, int height, int rgbmax,
- DImgLoaderObserver* observer)
+bool RAWLoader::loadedFromRawData(const QByteArray& data, int width, int height, int \
rgbmax, + DImgLoaderObserver* const observer)
{
int checkpoint = 0;
@@ -320,8 +320,8 @@ bool RAWLoader::loadedFromDcraw(QByteArray data, int width, int \
height, int rgbm FilterAction action = m_filter->filterAction();
m_image->addFilterAction(action);
- imageWidth() = width;
- imageHeight() = height;
+ imageWidth() = width;
+ imageHeight() = height;
imageSetAttribute("rawDecodingSettings", \
QVariant::fromValue(m_filter->settings()));
imageSetAttribute("rawDecodingFilterAction", QVariant::fromValue(action));
// other attributes are set above
@@ -329,7 +329,7 @@ bool RAWLoader::loadedFromDcraw(QByteArray data, int width, int \
height, int rgbm return true;
}
-void RAWLoader::postProcess(DImgLoaderObserver* observer)
+void RAWLoader::postProcess(DImgLoaderObserver* const observer)
{
if (m_filter->settings().postProcessingSettingsIsDirty())
{
@@ -344,4 +344,25 @@ FilterAction RAWLoader::filterAction() const
return m_filter->filterAction();
}
+bool RAWLoader::save(const QString& /*filePath*/, DImgLoaderObserver* const \
/*observer=0*/) +{
+ // NOTE: RAW files are always Read only.
+ return false;
+}
+
+bool RAWLoader::hasAlpha() const
+{
+ return false;
+}
+
+bool RAWLoader::isReadOnly() const
+{
+ return true;
+}
+
+bool RAWLoader::sixteenBit() const
+{
+ return m_rawDecodingSettings.sixteenBitsImage;
+}
+
} // namespace Digikam
diff --git a/libs/dimg/loaders/rawloader.h b/libs/dimg/loaders/rawloader.h
index 0b30575..76e6ad8 100644
--- a/libs/dimg/loaders/rawloader.h
+++ b/libs/dimg/loaders/rawloader.h
@@ -7,8 +7,8 @@
* Description : A digital camera RAW files loader for DImg
* framework using an external dcraw instance.
*
- * Copyright (C) 2005-2010 by Gilles Caulier <caulier dot gilles at gmail dot com>
- * Copyright (C) 2005-2010 by Marcel Wiesweg <marcel.wiesweg@gmx.de>
+ * Copyright (C) 2005-2012 by Gilles Caulier <caulier dot gilles at gmail dot com>
+ * Copyright (C) 2005-2012 by Marcel Wiesweg <marcel.wiesweg@gmx.de>
*
* This program is free software; you can redistribute it
* and/or modify it under the terms of the GNU General
@@ -51,38 +51,23 @@ class DIGIKAM_EXPORT RAWLoader : public KDcrawIface::KDcraw, \
public DImgLoader
public:
- explicit RAWLoader(DImg* image, DRawDecoding rawDecodingSettings = \
DRawDecoding());
-
- bool load(const QString& filePath, DImgLoaderObserver* observer = 0);
- void postProcess(DImgLoaderObserver* observer);
-
- // NOTE: RAW files are always Read only.
- bool save(const QString& /*filePath*/, DImgLoaderObserver* /*observer=0*/)
- {
- return false;
- };
-
- bool hasAlpha() const
- {
- return false;
- };
- bool isReadOnly() const
- {
- return true;
- };
- bool sixteenBit() const
- {
- return m_rawDecodingSettings.sixteenBitsImage;
- };
+ explicit RAWLoader(DImg* const image, const DRawDecoding& rawDecodingSettings = \
DRawDecoding()); +
+ bool load(const QString& filePath, DImgLoaderObserver* const observer = 0);
+ bool save(const QString& /*filePath*/, DImgLoaderObserver* const \
/*observer=0*/); +
+ bool hasAlpha() const;
+ bool isReadOnly() const;
+ bool sixteenBit() const;
+
+ void postProcess(DImgLoaderObserver* const observer);
FilterAction filterAction() const;
private:
- // Methods to load RAW image using external dcraw instance.
-
- bool loadedFromDcraw(QByteArray data, int width, int height, int rgbmax,
- DImgLoaderObserver* observer);
+ bool loadedFromRawData(const QByteArray& data, int width, int height, int \
rgbmax, + DImgLoaderObserver* const observer);
bool checkToCancelWaitingData();
void setWaitingDataProgress(double value);
diff --git a/libs/dimg/loaders/tiffloader.cpp b/libs/dimg/loaders/tiffloader.cpp
index e42abfa..6d40427 100644
--- a/libs/dimg/loaders/tiffloader.cpp
+++ b/libs/dimg/loaders/tiffloader.cpp
@@ -6,8 +6,8 @@
* Date : 2005-06-17
* Description : A TIFF IO file for DImg framework
*
- * Copyright (C) 2005 by Renchi Raju <renchi dot raju at gmail dot com>
- * Copyright (C) 2006-2011 by Gilles Caulier <caulier dot gilles at gmail dot com>
+ * Copyright (C) 2005 by Renchi Raju <renchi dot raju at gmail dot com>
+ * Copyright (C) 2006-2012 by Gilles Caulier <caulier dot gilles at gmail dot com>
*
* Specifications & references:
* - TIFF 6.0 : http://partners.adobe.com/public/developer/en/tiff/TIFF6.pdf
@@ -97,14 +97,14 @@ void TIFFLoader::dimg_tiff_error(const char* module, const char* \
format, va_list #endif
}
-TIFFLoader::TIFFLoader(DImg* image)
+TIFFLoader::TIFFLoader(DImg* const image)
: DImgLoader(image)
{
m_hasAlpha = false;
m_sixteenBit = false;
}
-bool TIFFLoader::load(const QString& filePath, DImgLoaderObserver* observer)
+bool TIFFLoader::load(const QString& filePath, DImgLoaderObserver* const observer)
{
readMetadata(filePath, DImg::TIFF);
@@ -671,7 +671,7 @@ bool TIFFLoader::load(const QString& filePath, \
DImgLoaderObserver* observer) return true;
}
-bool TIFFLoader::save(const QString& filePath, DImgLoaderObserver* observer)
+bool TIFFLoader::save(const QString& filePath, DImgLoaderObserver* const observer)
{
uint32 w = imageWidth();
uint32 h = imageHeight();
@@ -1005,8 +1005,8 @@ bool TIFFLoader::sixteenBit() const
return m_sixteenBit;
}
-void TIFFLoader::tiffSetExifAsciiTag(TIFF* tif, ttag_t tiffTag,
- const DMetadata& metaData, const char* \
exifTagName) +void TIFFLoader::tiffSetExifAsciiTag(TIFF* const tif, ttag_t tiffTag,
+ const DMetadata& metaData, const char* const \
exifTagName) {
QByteArray tag = metaData.getExifTagData(exifTagName);
@@ -1017,8 +1017,8 @@ void TIFFLoader::tiffSetExifAsciiTag(TIFF* tif, ttag_t tiffTag,
}
}
-void TIFFLoader::tiffSetExifDataTag(TIFF* tif, ttag_t tiffTag,
- const DMetadata& metaData, const char* \
exifTagName) +void TIFFLoader::tiffSetExifDataTag(TIFF* const tif, ttag_t tiffTag,
+ const DMetadata& metaData, const char* const \
exifTagName) {
QByteArray tag = metaData.getExifTagData(exifTagName);
@@ -1028,4 +1028,9 @@ void TIFFLoader::tiffSetExifDataTag(TIFF* tif, ttag_t tiffTag,
}
}
+bool TIFFLoader::isReadOnly() const
+{
+ return false;
+}
+
} // namespace Digikam
diff --git a/libs/dimg/loaders/tiffloader.h b/libs/dimg/loaders/tiffloader.h
index 12fbe03..ef57005 100644
--- a/libs/dimg/loaders/tiffloader.h
+++ b/libs/dimg/loaders/tiffloader.h
@@ -6,8 +6,8 @@
* Date : 2005-06-17
* Description : A TIFF IO file for DImg framework
*
- * Copyright (C) 2005 by Renchi Raju <renchi dot raju at gmail dot com>
- * Copyright (C) 2006-2009 by Gilles Caulier <caulier dot gilles at gmail dot com>
+ * Copyright (C) 2005 by Renchi Raju <renchi dot raju at gmail dot com>
+ * Copyright (C) 2006-2012 by Gilles Caulier <caulier dot gilles at gmail dot com>
*
* This program is free software; you can redistribute it
* and/or modify it under the terms of the GNU General
@@ -48,22 +48,19 @@ class DIGIKAM_EXPORT TIFFLoader : public DImgLoader
{
public:
- TIFFLoader(DImg* image);
+ TIFFLoader(DImg* const image);
- bool load(const QString& filePath, DImgLoaderObserver* observer);
- bool save(const QString& filePath, DImgLoaderObserver* observer);
+ bool load(const QString& filePath, DImgLoaderObserver* const observer);
+ bool save(const QString& filePath, DImgLoaderObserver* const observer);
virtual bool hasAlpha() const;
virtual bool sixteenBit() const;
- virtual bool isReadOnly() const
- {
- return false;
- };
+ virtual bool isReadOnly() const;
private:
- void tiffSetExifAsciiTag(TIFF* tif, ttag_t tiffTag, const DMetadata& metaData, \
const char* exifTagName);
- void tiffSetExifDataTag(TIFF* tif, ttag_t tiffTag, const DMetadata& metaData, \
const char* exifTagName); + void tiffSetExifAsciiTag(TIFF* const tif, ttag_t \
tiffTag, const DMetadata& metaData, const char* const exifTagName); + void \
tiffSetExifDataTag(TIFF* const tif, ttag_t tiffTag, const DMetadata& metaData, const \
char* const exifTagName);
static void dimg_tiff_warning(const char* module, const char* format, va_list \
warnings);
static void dimg_tiff_error(const char* module, const char* format, va_list \
errors);
diff --git a/libs/dimg/loaders/tiffsettings.cpp b/libs/dimg/loaders/tiffsettings.cpp
index 3f129c4..73e600e 100644
--- a/libs/dimg/loaders/tiffsettings.cpp
+++ b/libs/dimg/loaders/tiffsettings.cpp
@@ -6,7 +6,7 @@
* Date : 2007-08-02
* Description : save TIFF image options.
*
- * Copyright (C) 2007-2009 by Gilles Caulier <caulier dot gilles at gmail dot com>
+ * Copyright (C) 2007-2012 by Gilles Caulier <caulier dot gilles at gmail dot com>
*
* This program is free software; you can redistribute it
* and/or modify it under the terms of the GNU General
@@ -39,12 +39,12 @@
namespace Digikam
{
-class TIFFSettingsPriv
+class TIFFSettings::Private
{
public:
- TIFFSettingsPriv()
+ Private()
{
TIFFGrid = 0;
TIFFcompression = 0;
@@ -55,8 +55,8 @@ public:
QCheckBox* TIFFcompression;
};
-TIFFSettings::TIFFSettings(QWidget* parent)
- : QWidget(parent), d(new TIFFSettingsPriv)
+TIFFSettings::TIFFSettings(QWidget* const parent)
+ : QWidget(parent), d(new Private)
{
setAttribute(Qt::WA_DeleteOnClose);
@@ -89,7 +89,7 @@ void TIFFSettings::setCompression(bool b)
d->TIFFcompression->setChecked(b);
}
-bool TIFFSettings::getCompression()
+bool TIFFSettings::getCompression() const
{
return d->TIFFcompression->isChecked();
}
diff --git a/libs/dimg/loaders/tiffsettings.h b/libs/dimg/loaders/tiffsettings.h
index 24227cd..ae18810 100644
--- a/libs/dimg/loaders/tiffsettings.h
+++ b/libs/dimg/loaders/tiffsettings.h
@@ -6,7 +6,7 @@
* Date : 2007-08-02
* Description : save TIFF image options.
*
- * Copyright (C) 2007-2009 by Gilles Caulier <caulier dot gilles at gmail dot com>
+ * Copyright (C) 2007-2012 by Gilles Caulier <caulier dot gilles at gmail dot com>
*
* This program is free software; you can redistribute it
* and/or modify it under the terms of the GNU General
@@ -35,19 +35,17 @@
namespace Digikam
{
-class TIFFSettingsPriv;
-
class DIGIKAM_EXPORT TIFFSettings : public QWidget
{
Q_OBJECT
public:
- TIFFSettings(QWidget* parent = 0);
+ TIFFSettings(QWidget* const parent = 0);
~TIFFSettings();
void setCompression(bool b);
- bool getCompression();
+ bool getCompression() const;
Q_SIGNALS:
@@ -55,7 +53,8 @@ Q_SIGNALS:
private:
- TIFFSettingsPriv* const d;
+ class Private;
+ Private* const d;
};
} // namespace Digikam
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic