[Digikam-devel] extragear/graphics/digikam

Gilles Caulier caulier.gilles at free.fr
Mon May 15 14:22:37 BST 2006


SVN commit 541066 by cgilles:

digikam from trunk : add 2 new button on preview of ICC color correction dialog to see embedded or output ICC color profile informations.

CCMAIL: digikam-devel at kde.org, francisco.jct at gmail.com
CCBUGS: 125733

 M  +15 -7     libs/dialogs/iccprofileinfodlg.cpp  
 M  +1 -2      libs/dialogs/iccprofileinfodlg.h  
 M  +20 -0     libs/dimg/filters/icctransform.cpp  
 M  +7 -2      libs/dimg/filters/icctransform.h  
 M  +1 -0      utilities/imageeditor/canvas/Makefile.am  
 M  +28 -5     utilities/imageeditor/canvas/colorcorrectiondlg.cpp  
 M  +11 -1     utilities/imageeditor/canvas/colorcorrectiondlg.h  


--- trunk/extragear/graphics/digikam/libs/dialogs/iccprofileinfodlg.cpp #541065:541066
@@ -1,5 +1,4 @@
 /* ============================================================
- * File  : iccprofileinfodlg.cpp
  * Author: Gilles Caulier <caulier dot gilles at kdemail dot net>
  * Date  : 2006-02-16
  * Description : a dialog to display icc profile informations.
@@ -54,15 +53,21 @@
 namespace Digikam
 {
 
-ICCProfileInfoDlg::ICCProfileInfoDlg(QWidget* parent, const QString& profilePath)
+ICCProfileInfoDlg::ICCProfileInfoDlg(QWidget* parent, const QString& profilePath,
+                                     const QByteArray& profileData)
                  : KDialogBase(Plain, i18n("Color Profile Info"), Help|Ok, Ok,
                                parent, 0, true, true)
 {
     setHelp("iccprofile.anchor", "digikam");
 
     QString intent;
+    cmsHPROFILE hProfile=0;
 
-    cmsHPROFILE hProfile        = cmsOpenProfileFromFile(QFile::encodeName(profilePath), "r");
+    if (profileData.isEmpty())
+        hProfile = cmsOpenProfileFromFile(QFile::encodeName(profilePath), "r");
+    else 
+        hProfile = cmsOpenProfileFromMem(profileData.data(), (DWORD)profileData.size());
+        
     QString profileName         = QString((cmsTakeProductName(hProfile)));
     QString profileDescription  = QString((cmsTakeProductDesc(hProfile)));
     QString profileManufacturer = QString(cmsTakeCopyright(hProfile));
@@ -108,10 +113,13 @@
     grid->addMultiCellWidget(label7, 3, 3, 0, 0);
     grid->addMultiCellWidget(label8, 3, 3, 1, 1);
                                      
-    QLabel *label9  = new QLabel(i18n("<p><b>Path:</b>"), plainPage());
-    KSqueezedTextLabel *label10 = new KSqueezedTextLabel(profilePath, plainPage());
-    grid->addMultiCellWidget(label9, 4, 4, 0, 0);
-    grid->addMultiCellWidget(label10, 4, 4, 1, 1);
+    if (profileData.isEmpty())
+    {
+        QLabel *label9  = new QLabel(i18n("<p><b>Path:</b>"), plainPage());
+        KSqueezedTextLabel *label10 = new KSqueezedTextLabel(profilePath, plainPage());
+        grid->addMultiCellWidget(label9, 4, 4, 0, 0);
+        grid->addMultiCellWidget(label10, 4, 4, 1, 1);
+    }
                                      
     QLabel *label11  = new QLabel(i18n("<p><b>CIE diagram:</b>"), plainPage());
     CIETongueWidget *cieTongue = new CIETongueWidget(256, 256, plainPage());
--- trunk/extragear/graphics/digikam/libs/dialogs/iccprofileinfodlg.h #541065:541066
@@ -1,5 +1,4 @@
 /* ============================================================
- * File  : iccprofileinfodlg.h
  * Author: Gilles Caulier <caulier dot gilles at kdemail dot net>
  * Date  : 2006-02-16
  * Description : a dialog to display icc profile informations.
@@ -46,7 +45,7 @@
 
 public:
 
-    ICCProfileInfoDlg(QWidget *parent, const QString& profilePath);
+    ICCProfileInfoDlg(QWidget *parent, const QString& profilePath, const QByteArray& profileData=QByteArray());
     ~ICCProfileInfoDlg();
 
 };
--- trunk/extragear/graphics/digikam/libs/dimg/filters/icctransform.cpp #541065:541066
@@ -80,6 +80,26 @@
     return d->has_output_profile;
 }
 
+QByteArray IccTransform::embeddedProfile() const
+{
+    return d->embedded_profile;
+}
+
+QByteArray IccTransform::inputProfile() const
+{
+    return d->input_profile;
+}
+
+QByteArray IccTransform::outputProfile() const
+{
+    return d->output_profile;
+}
+
+QByteArray IccTransform::proofProfile() const
+{
+    return d->proof_profile;
+}
+
 void IccTransform::getTransformType(bool do_proof_profile)
 {
     if (do_proof_profile)
--- trunk/extragear/graphics/digikam/libs/dimg/filters/icctransform.h #541065:541066
@@ -45,12 +45,17 @@
     
     void getTransformType(bool do_proof_profile);
     void apply(DImg& image);
-    void apply(DImg& image, QByteArray& profile, int intent, bool useBPC = false, bool checkGamut = false,
-               bool useBuiltin=false);
+    void apply(DImg& image, QByteArray& profile, int intent, 
+               bool useBPC=false, bool checkGamut=false, bool useBuiltin=false);
     void getEmbeddedProfile(DImg image);
 
     int  getRenderingIntent();
     
+    QByteArray embeddedProfile() const;
+    QByteArray inputProfile() const;
+    QByteArray outputProfile() const;
+    QByteArray proofProfile() const;
+    
     //Input profile from file
     void setProfiles(QString input_profile, QString output_profile);
     void setProfiles(QString input_profile, QString output_profile, QString proof_profile);
--- trunk/extragear/graphics/digikam/utilities/imageeditor/canvas/Makefile.am #541065:541066
@@ -15,6 +15,7 @@
 	  -I$(top_srcdir)/digikam/libs/dimg \
 	  -I$(top_srcdir)/digikam/libs/dimg/filters \
           -I$(top_srcdir)/digikam/libs/dmetadata \
+          -I$(top_srcdir)/digikam/libs/dialogs \
 	  -I$(top_srcdir)/digikam/libs/histogram \
 	  -I$(top_srcdir)/digikam/libs/threadimageio \
 	  -I$(top_srcdir)/digikam/utilities/splashscreen \
--- trunk/extragear/graphics/digikam/utilities/imageeditor/canvas/colorcorrectiondlg.cpp #541065:541066
@@ -38,19 +38,24 @@
 
 #include "dimg.h"
 #include "icctransform.h"
+#include "iccprofileinfodlg.h"
 #include "colorcorrectiondlg.h"
 
 namespace Digikam
 {
 
 ColorCorrectionDlg::ColorCorrectionDlg(QWidget* parent, DImg *preview, 
-                                       IccTransform *iccTrans, const QString& msg)
-                  : KDialogBase(Plain, i18n("Applying Workspace Color Profile"), Help|Ok|Cancel, Ok,
-                                parent, 0, true, true)
+                                       IccTransform *iccTrans, const QString& msg,
+                                       bool hasEmbededProfile)
+                  : KDialogBase(Plain, i18n("Applying Workspace Color Profile"), Help|User1|User2|Ok|Cancel,
+                                Ok, parent, 0, true, true)
 {
+    m_iccTrans = iccTrans;
     setHelp("iccprofile.anchor", "digikam");
-    setButtonText(Ok, i18n("Apply Profile"));
+    setButtonText(Ok, i18n("Apply"));
     setButtonText(Cancel, i18n("Do Nothing"));
+    setButtonText(User1, i18n("Workspace Profile Info..."));
+    setButtonText(User2, i18n("Image Profile Info..."));
     
     QGridLayout* grid = new QGridLayout( plainPage(), 4, 1, 0, KDialog::spacingHint());
         
@@ -62,7 +67,7 @@
     QLabel *message         = new QLabel(msg, plainPage());
     
     previewOriginal->setPixmap(preview->convertToPixmap());
-    previewTarget->setPixmap(preview->convertToPixmap(iccTrans));
+    previewTarget->setPixmap(preview->convertToPixmap(m_iccTrans));
     KIconLoader* iconLoader = KApplication::kApplication()->iconLoader();
     logo->setPixmap(iconLoader->loadIcon("digikam", KIcon::NoGroup, 128, KIcon::DefaultState, 0, true));    
     
@@ -78,5 +83,23 @@
 {
 }
 
+void ColorCorrectionDlg::slotUser1()
+{
+    if (m_iccTrans->outputProfile().isEmpty())
+        return;
+
+    ICCProfileInfoDlg infoDlg(this, QString::null, m_iccTrans->outputProfile());
+    infoDlg.exec();
+}
+
+void ColorCorrectionDlg::slotUser2()
+{
+    if (m_iccTrans->embeddedProfile().isEmpty())
+        return;
+
+    ICCProfileInfoDlg infoDlg(this, QString::null, m_iccTrans->embeddedProfile());
+    infoDlg.exec();
+}
+
 }  // NameSpace Digikam
 
--- trunk/extragear/graphics/digikam/utilities/imageeditor/canvas/colorcorrectiondlg.h #541065:541066
@@ -42,9 +42,19 @@
 public:
 
     ColorCorrectionDlg(QWidget *parent, DImg *preview, 
-                       IccTransform *iccTrans, const QString& msg);
+                       IccTransform *iccTrans, const QString& msg,
+                       bool hasEmbededProfile=false);
     ~ColorCorrectionDlg();
+    
+protected slots:
+    
+    void slotUser1();
+    void slotUser2();
+    
+private: 
 
+    IccTransform *m_iccTrans;
+
 };
 
 }  // Namespace Digikam



More information about the Digikam-devel mailing list