[prev in list] [next in list] [prev in thread] [next in thread]
List: kde-commits
Subject: extragear/graphics/digikam/libs
From: Marcel Wiesweg <marcel.wiesweg () gmx ! de>
Date: 2009-08-08 13:05:02
Message-ID: 1249736702.527746.6238.nullmailer () svn ! kde ! org
[Download RAW message or body]
SVN commit 1008824 by mwiesweg:
Adapt to IccProfile/IccTransform API
M +3 -3 dialogs/iccprofileinfodlg.cpp
M +2 -1 dialogs/iccprofileinfodlg.h
M +4 -4 imageproperties/imagepropertiescolorstab.cpp
M +24 -38 widgets/iccprofiles/iccprofilewidget.cpp
M +4 -3 widgets/iccprofiles/iccprofilewidget.h
M +2 -2 widgets/imageplugins/imageguidewidget.cpp
M +1 -1 widgets/imageplugins/imageregionwidget.cpp
--- trunk/extragear/graphics/digikam/libs/dialogs/iccprofileinfodlg.cpp \
#1008823:1008824 @@ -36,7 +36,7 @@
{
ICCProfileInfoDlg::ICCProfileInfoDlg(QWidget* parent, const QString& profilePath,
- const QByteArray& profileData)
+ const IccProfile& profile)
: KDialog(parent)
{
setCaption(i18n("Color Profile Info - %1", profilePath));
@@ -47,10 +47,10 @@
ICCProfileWidget *profileWidget = new ICCProfileWidget(this, 340, 256);
- if (profileData.isEmpty())
+ if (profile.isNull())
profileWidget->loadFromURL(KUrl(profilePath));
else
- profileWidget->loadFromProfileData(profilePath, profileData);
+ profileWidget->loadProfile(profilePath, profile);
setMainWidget(profileWidget);
}
--- trunk/extragear/graphics/digikam/libs/dialogs/iccprofileinfodlg.h \
#1008823:1008824 @@ -36,6 +36,7 @@
// Local includes
#include "digikam_export.h"
+#include "icctransform.h"
class QWidget;
@@ -48,7 +49,7 @@
public:
- ICCProfileInfoDlg(QWidget *parent, const QString& profilePath, const QByteArray& \
profileData=QByteArray()); + ICCProfileInfoDlg(QWidget *parent, const QString& \
profilePath, const IccProfile& profileData = IccProfile()); ~ICCProfileInfoDlg();
};
--- trunk/extragear/graphics/digikam/libs/imageproperties/imagepropertiescolorstab.cpp \
#1008823:1008824 @@ -123,7 +123,7 @@
QRect selectionArea;
- QByteArray embedded_profile;
+ IccProfile embedded_profile;
DImg image;
DImg imageSelection;
@@ -668,14 +668,14 @@
void ImagePropertiesColorsTab::getICCData()
{
- if (d->image.getICCProfil().isNull())
+ if (d->image.getIccProfile().isNull())
{
d->iccProfileWidget->setLoadingFailed();
}
else
{
- d->embedded_profile = d->image.getICCProfil();
- d->iccProfileWidget->loadFromProfileData(d->currentFilePath, \
d->embedded_profile); + d->embedded_profile = d->image.getIccProfile();
+ d->iccProfileWidget->loadProfile(d->currentFilePath, d->embedded_profile);
}
}
--- trunk/extragear/graphics/digikam/libs/widgets/iccprofiles/iccprofilewidget.cpp \
#1008823:1008824 @@ -105,7 +105,7 @@
cieTongue = 0;
}
- QByteArray profileData;
+ IccProfile profile;
QStringList keysFilter;
@@ -182,16 +182,18 @@
delete d;
}
-bool ICCProfileWidget::setProfileData(const QByteArray& data)
+bool ICCProfileWidget::setProfile(const IccProfile& profile)
{
- d->profileData = data;
-
// Cleanup all metadata contents.
setMetadataMap();
- if (d->profileData.isEmpty())
+ d->profile = profile;
+
+ if (!d->profile.open())
{
setMetadataEmpty();
+ d->cieTongue->setProfileData();
+ d->profile = IccProfile();
return false;
}
@@ -206,9 +208,9 @@
return true;
}
-const QByteArray& ICCProfileWidget::getProfileData()
+IccProfile ICCProfileWidget::getProfile() const
{
- return d->profileData;
+ return d->profile;
}
void ICCProfileWidget::setDataLoading()
@@ -232,38 +234,19 @@
if (url.isEmpty())
{
- setProfileData();
+ setProfile();
d->cieTongue->setProfileData();
return false;
}
else
{
- QFile file(url.path());
- if ( !file.open(QIODevice::ReadOnly) )
+ IccProfile profile(url.path());
+ if (!setProfile(profile))
{
- setProfileData();
+ setProfile();
d->cieTongue->setProfileData();
return false;
}
-
- QByteArray iccData;
- iccData.resize(file.size());
-
- QDataStream stream( &file );
- stream.readRawData(iccData.data(), iccData.size());
- file.close();
-
- if (iccData.isEmpty())
- {
- setProfileData();
- d->cieTongue->setProfileData();
- return false;
- }
- else
- {
- setProfileData(iccData);
- d->cieTongue->setProfileData(iccData);
- }
}
return true;
@@ -272,18 +255,23 @@
bool ICCProfileWidget::loadFromProfileData(const QString& fileName, const \
QByteArray& data) {
setFileName(fileName);
- return(setProfileData(data));
+ return(setProfile(data));
}
+bool ICCProfileWidget::loadProfile(const QString& fileName, const IccProfile& \
profile) +{
+ setFileName(fileName);
+ return(setProfile(profile));
+}
+
bool ICCProfileWidget::decodeMetadata()
{
- QByteArray iccData = getProfileData();
- if (iccData.isNull())
+ if (!d->profile.isOpen())
return false;
- d->cieTongue->setProfileData(iccData);
+ d->cieTongue->setProfileData(d->profile.data());
- cmsHPROFILE hProfile = cmsOpenProfileFromMem(iccData.data(), \
(DWORD)iccData.size()); + cmsHPROFILE hProfile = d->profile.handle();
if (!hProfile)
{
@@ -432,8 +420,6 @@
}
metaDataMap.insert("Icc.Header.RenderingIntent", intent);
- cmsCloseProfile(hProfile);
-
// Update all metadata contents.
setMetadataMap(metaDataMap);
return true;
@@ -466,7 +452,7 @@
{
KUrl url = saveMetadataToFile(i18n("ICC color profile File to Save"),
QString("*.icc *.icm|"+i18n("ICC Files (*.icc; \
*.icm)")));
- storeMetadataToFile(url, d->profileData);
+ storeMetadataToFile(url, d->profile.data());
}
QString ICCProfileWidget::getTagDescription(const QString& key)
--- trunk/extragear/graphics/digikam/libs/widgets/iccprofiles/iccprofilewidget.h \
#1008823:1008824 @@ -49,7 +49,8 @@
~ICCProfileWidget();
bool loadFromURL(const KUrl& url);
- bool loadFromProfileData(const QString& fileName, const QByteArray& \
data=QByteArray()); + bool loadFromProfileData(const QString& fileName, const \
QByteArray& data); + bool loadProfile(const QString& fileName, const \
IccProfile& data);
QString getTagDescription(const QString& key);
QString getTagTitle(const QString& key);
@@ -59,8 +60,8 @@
void setLoadingFailed();
void setDataLoading();
- bool setProfileData(const QByteArray& data=QByteArray());
- const QByteArray& getProfileData();
+ bool setProfile(const IccProfile& profile = IccProfile());
+ IccProfile getProfile() const;
protected Q_SLOTS:
--- trunk/extragear/graphics/digikam/libs/widgets/imageplugins/imageguidewidget.cpp \
#1008823:1008824 @@ -145,7 +145,7 @@
bool sixteenBit = d->iface->previewSixteenBit();
bool hasAlpha = d->iface->previewHasAlpha();
d->preview = DImg(d->width, d->height, sixteenBit, hasAlpha, data);
- d->preview.setICCProfil( d->iface->getOriginalImg()->getICCProfil() );
+ d->preview.setIccProfile( d->iface->getOriginalImg()->getIccProfile() );
delete [] data;
d->pixmap = new QPixmap(w, h);
@@ -598,7 +598,7 @@
bool sixteenBit = d->iface->previewSixteenBit();
bool hasAlpha = d->iface->previewHasAlpha();
d->preview = DImg(d->width, d->height, sixteenBit, hasAlpha, data);
- d->preview.setICCProfil( d->iface->getOriginalImg()->getICCProfil() );
+ d->preview.setIccProfile( d->iface->getOriginalImg()->getIccProfile() );
delete [] data;
d->pixmap = new QPixmap(w, h);
--- trunk/extragear/graphics/digikam/libs/widgets/imageplugins/imageregionwidget.cpp \
#1008823:1008824 @@ -362,7 +362,7 @@
// Because image plugins are tool witch only work on image data, the DImg \
container
// do not contain metadata from original image. About Color Managed View, we \
need to // restore the embedded ICC color profile.
- image.setICCProfil(d->image.getICCProfil());
+ image.setIccProfile(d->image.getIccProfile());
d->pixmapRegion = d->iface->convertToPixmap(image);
}
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic