r23537 by jghali - Fix issue where ability to select image embedded icc profile would be lost after reopening document

scribus-commit scribus-commit at lists.scribus.net
Thu Mar 26 12:08:52 UTC 2020


Author: jghali
Date: Thu Mar 26 12:08:52 2020
New Revision: 23537

URL: http://scribus.net/websvn/listing.php?repname=Scribus&sc=1&rev=23537
Log:
Fix issue where ability to select image embedded icc profile would be lost after reopening document

Modified:
    trunk/Scribus/scribus/canvasmode_imageimport.cpp
    trunk/Scribus/scribus/imagedataloaders/scimgdataloader_jpeg.cpp
    trunk/Scribus/scribus/imagedataloaders/scimgdataloader_kra.cpp
    trunk/Scribus/scribus/imagedataloaders/scimgdataloader_png.cpp
    trunk/Scribus/scribus/imagedataloaders/scimgdataloader_ps.cpp
    trunk/Scribus/scribus/imagedataloaders/scimgdataloader_psd.cpp
    trunk/Scribus/scribus/imagedataloaders/scimgdataloader_tiff.cpp
    trunk/Scribus/scribus/pageitem.cpp
    trunk/Scribus/scribus/plugins/picbrowser/loadimage.cpp
    trunk/Scribus/scribus/scimage.cpp
    trunk/Scribus/scribus/scimagestructs.h
    trunk/Scribus/scribus/scribus.cpp
    trunk/Scribus/scribus/scribusdoc.cpp

Modified: trunk/Scribus/scribus/canvasmode_imageimport.cpp
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=23537&path=/trunk/Scribus/scribus/canvasmode_imageimport.cpp
==============================================================================
--- trunk/Scribus/scribus/canvasmode_imageimport.cpp	(original)
+++ trunk/Scribus/scribus/canvasmode_imageimport.cpp	Thu Mar 26 12:08:52 2020
@@ -228,9 +228,9 @@
 void CanvasMode_ImageImport::setImage(PageItem *currItem)
 {
 	QString fileName = m_imageList.takeFirst();
-	currItem->EmbeddedProfile.clear();
 	currItem->pixm.imgInfo.isRequest = false;
 	currItem->UseEmbedded = true;
+	currItem->EmbeddedProfile.clear();
 	currItem->ImageProfile = m_doc->cmsSettings().DefaultImageRGBProfile;
 	currItem->ImageIntent = m_doc->cmsSettings().DefaultIntentImages;
 	qApp->processEvents(QEventLoop::ExcludeUserInputEvents);

Modified: trunk/Scribus/scribus/imagedataloaders/scimgdataloader_jpeg.cpp
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=23537&path=/trunk/Scribus/scribus/imagedataloaders/scimgdataloader_jpeg.cpp
==============================================================================
--- trunk/Scribus/scribus/imagedataloaders/scimgdataloader_jpeg.cpp	(original)
+++ trunk/Scribus/scribus/imagedataloaders/scimgdataloader_jpeg.cpp	Thu Mar 26 12:08:52 2020
@@ -306,6 +306,7 @@
 		{
 			m_embeddedProfile = profArray;
 			m_imageInfoRecord.profileName = prof.productDescription();
+			m_imageInfoRecord.embeddedProfileName = m_imageInfoRecord.profileName;
 		}
 		m_imageInfoRecord.isEmbedded = profileIsValid;
 		free(EmbedBuffer);
@@ -313,7 +314,7 @@
 	else
 	{
 		m_imageInfoRecord.isEmbedded = false;
-		m_imageInfoRecord.profileName = "";
+		m_imageInfoRecord.profileName.clear();
 	}
 
 	unsigned int PhotoshopLen = 0;
@@ -402,8 +403,8 @@
 	{
 		m_image = QImage( cinfo.output_width, cinfo.output_height, QImage::Format_Indexed8 );
 		m_image.setColorCount(256);
-		for (int i=0; i<256; i++)
-			m_image.setColor(i, qRgb(i,i,i));
+		for (int i = 0; i < 256; i++)
+			m_image.setColor(i, qRgb(i, i, i));
 	}
 	if (!m_image.isNull())
 	{
@@ -499,11 +500,11 @@
 			m_image = QImage( cinfo.output_width, cinfo.output_height, QImage::Format_ARGB32 );
 			QRgb *s;
 			QRgb *d;
-			for (int yi=0; yi < tmpImg.height(); ++yi)
+			for (int yi = 0; yi < tmpImg.height(); ++yi)
 			{
 				s = (QRgb*)(tmpImg.scanLine( yi ));
 				d = (QRgb*)(m_image.scanLine( yi ));
-				for (int xi=0; xi < tmpImg.width(); ++xi)
+				for (int xi = 0; xi < tmpImg.width(); ++xi)
 				{
 					(*d) = (*s);
 					s++;

Modified: trunk/Scribus/scribus/imagedataloaders/scimgdataloader_kra.cpp
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=23537&path=/trunk/Scribus/scribus/imagedataloaders/scimgdataloader_kra.cpp
==============================================================================
--- trunk/Scribus/scribus/imagedataloaders/scimgdataloader_kra.cpp	(original)
+++ trunk/Scribus/scribus/imagedataloaders/scimgdataloader_kra.cpp	Thu Mar 26 12:08:52 2020
@@ -274,6 +274,10 @@
 				m_profileComponents = 4;
 			if (prof.colorSpace() == ColorSpace_Gray)
 				m_profileComponents = 1;
+			m_imageInfoRecord.profileName = prof.productDescription();
+			if (m_imageInfoRecord.profileName.isEmpty())
+				m_imageInfoRecord.profileName = "Profile #" + prof.dataHash();
+			m_imageInfoRecord.embeddedProfileName = m_imageInfoRecord.profileName;
 			m_embeddedProfile = profileData;
 		}
 	}

Modified: trunk/Scribus/scribus/imagedataloaders/scimgdataloader_png.cpp
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=23537&path=/trunk/Scribus/scribus/imagedataloaders/scimgdataloader_png.cpp
==============================================================================
--- trunk/Scribus/scribus/imagedataloaders/scimgdataloader_png.cpp	(original)
+++ trunk/Scribus/scribus/imagedataloaders/scimgdataloader_png.cpp	Thu Mar 26 12:08:52 2020
@@ -137,6 +137,7 @@
 		m_imageInfoRecord.profileName = imgProfile.productDescription();
 		if (m_imageInfoRecord.profileName.isEmpty())
 			m_imageInfoRecord.profileName = "Profile #" + imgProfile.dataHash();
+		m_imageInfoRecord.embeddedProfileName = m_imageInfoRecord.profileName;
 		m_imageInfoRecord.isEmbedded = true;
 	}
 

Modified: trunk/Scribus/scribus/imagedataloaders/scimgdataloader_ps.cpp
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=23537&path=/trunk/Scribus/scribus/imagedataloaders/scimgdataloader_ps.cpp
==============================================================================
--- trunk/Scribus/scribus/imagedataloaders/scimgdataloader_ps.cpp	(original)
+++ trunk/Scribus/scribus/imagedataloaders/scimgdataloader_ps.cpp	Thu Mar 26 12:08:52 2020
@@ -115,6 +115,7 @@
 						if (prof.colorSpace() == ColorSpace_Cmyk)
 							m_profileComponents = 4;
 						m_imageInfoRecord.profileName = prof.productDescription();
+						m_imageInfoRecord.embeddedProfileName = m_imageInfoRecord.profileName;
 						m_imageInfoRecord.isEmbedded = true;
 						m_embeddedProfile = psdata;
 					}

Modified: trunk/Scribus/scribus/imagedataloaders/scimgdataloader_psd.cpp
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=23537&path=/trunk/Scribus/scribus/imagedataloaders/scimgdataloader_psd.cpp
==============================================================================
--- trunk/Scribus/scribus/imagedataloaders/scimgdataloader_psd.cpp	(original)
+++ trunk/Scribus/scribus/imagedataloaders/scimgdataloader_psd.cpp	Thu Mar 26 12:08:52 2020
@@ -170,6 +170,7 @@
 		{
 			ScColorProfile prof = engine.openProfileFromMem(m_embeddedProfile);
 			m_imageInfoRecord.profileName = prof.productDescription();
+			m_imageInfoRecord.embeddedProfileName = m_imageInfoRecord.profileName;
 			m_imageInfoRecord.isEmbedded = true;
 		}
 		isCMYK = (header.color_mode == CM_CMYK);

Modified: trunk/Scribus/scribus/imagedataloaders/scimgdataloader_tiff.cpp
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=23537&path=/trunk/Scribus/scribus/imagedataloaders/scimgdataloader_tiff.cpp
==============================================================================
--- trunk/Scribus/scribus/imagedataloaders/scimgdataloader_tiff.cpp	(original)
+++ trunk/Scribus/scribus/imagedataloaders/scimgdataloader_tiff.cpp	Thu Mar 26 12:08:52 2020
@@ -731,12 +731,14 @@
 		ScColorProfile tiffProf = engine.openProfileFromMem(profArray);
 		m_embeddedProfile = profArray;
 		m_imageInfoRecord.profileName = tiffProf.productDescription();
+		m_imageInfoRecord.embeddedProfileName = m_imageInfoRecord.profileName;
 		m_imageInfoRecord.isEmbedded = true;
 	}
 	else
 	{
 		m_imageInfoRecord.isEmbedded = false;
-		m_imageInfoRecord.profileName = "";
+		m_imageInfoRecord.profileName.clear();
+		m_imageInfoRecord.embeddedProfileName.clear();
 	}
 	unsigned int PhotoshopLen = 0;
 	unsigned char* PhotoshopBuffer;

Modified: trunk/Scribus/scribus/pageitem.cpp
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=23537&path=/trunk/Scribus/scribus/pageitem.cpp
==============================================================================
--- trunk/Scribus/scribus/pageitem.cpp	(original)
+++ trunk/Scribus/scribus/pageitem.cpp	Thu Mar 26 12:08:52 2020
@@ -9454,20 +9454,23 @@
 		imgcache.addInfo("OrigW", QString::number(OrigW));
 		imgcache.addInfo("OrigH", QString::number(OrigH));
 	}
+
 	isRaster = !(extensionIndicatesPDF(ext) || extensionIndicatesEPSorPS(ext));
 	if (!isRaster)
 	{
 		effectsInUse.clear();
 		imgcache.delModifier("effectsInUse");
 	}
+
 	UseEmbedded = pixm.imgInfo.isEmbedded;
 	if (pixm.imgInfo.isEmbedded)
-	{
 		ImageProfile = "Embedded " + pixm.imgInfo.profileName;
-		EmbeddedProfile = "Embedded " + pixm.imgInfo.profileName;
-	}
 	else
 		ImageProfile = pixm.imgInfo.profileName;
+	if (!pixm.imgInfo.embeddedProfileName.isEmpty())
+		EmbeddedProfile = "Embedded " + pixm.imgInfo.embeddedProfileName;
+	else
+		EmbeddedProfile.clear();
 
 	adjustPictScale();
 

Modified: trunk/Scribus/scribus/plugins/picbrowser/loadimage.cpp
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=23537&path=/trunk/Scribus/scribus/plugins/picbrowser/loadimage.cpp
==============================================================================
--- trunk/Scribus/scribus/plugins/picbrowser/loadimage.cpp	(original)
+++ trunk/Scribus/scribus/plugins/picbrowser/loadimage.cpp	Thu Mar 26 12:08:52 2020
@@ -106,7 +106,7 @@
 					imgInfo->ydpi = 72;
 					imgInfo->layers = 0;
 					imgInfo->embedded = false;
-					imgInfo->profileName = "";
+					imgInfo->profileName.clear();
 					imgInfo->valid = true;
 
 					if ((im.width() > (size - 2)) || (im.height() > (size - 2)))

Modified: trunk/Scribus/scribus/scimage.cpp
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=23537&path=/trunk/Scribus/scribus/scimage.cpp
==============================================================================
--- trunk/Scribus/scribus/scimage.cpp	(original)
+++ trunk/Scribus/scribus/scimage.cpp	Thu Mar 26 12:08:52 2020
@@ -109,12 +109,14 @@
 	imgInfo.lowResScale = 1.0;
 	imgInfo.PDSpathData.clear();
 	imgInfo.RequestProps.clear();
-	imgInfo.clipPath = "";
-	imgInfo.usedPath = "";
+	imgInfo.clipPath.clear();
+	imgInfo.usedPath.clear();
+	imgInfo.profileName.clear();
+	imgInfo.embeddedProfileName.clear();
 	imgInfo.layerInfo.clear();
 	imgInfo.duotoneColors.clear();
-	imgInfo.exifInfo.cameraName = "";
-	imgInfo.exifInfo.cameraVendor = "";
+	imgInfo.exifInfo.cameraName.clear();
+	imgInfo.exifInfo.cameraVendor.clear();
 	imgInfo.exifInfo.thumbnail = QImage();
 	imgInfo.BBoxX = 0;
 	imgInfo.BBoxH = 0;
@@ -2268,7 +2270,7 @@
 	if (!fi.exists())
 		return ret;
 	QString ext = fi.suffix().toLower();
-	QString profileName = "";
+	QString profileName;
 	bool hasEmbeddedProfile = false;
 	QList<QByteArray> fmtList = QImageReader::supportedImageFormats();
 	QStringList fmtImg;

Modified: trunk/Scribus/scribus/scimagestructs.h
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=23537&path=/trunk/Scribus/scribus/scimagestructs.h
==============================================================================
--- trunk/Scribus/scribus/scimagestructs.h	(original)
+++ trunk/Scribus/scribus/scimagestructs.h	Thu Mar 26 12:08:52 2020
@@ -157,6 +157,7 @@
 	QString clipPath;
 	QString usedPath;
 	QString profileName;
+	QString embeddedProfileName;
 	QList<PSDLayer> layerInfo;
 	QList<PSDDuotone_Color> duotoneColors;
 	ExifValues exifInfo;

Modified: trunk/Scribus/scribus/scribus.cpp
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=23537&path=/trunk/Scribus/scribus/scribus.cpp
==============================================================================
--- trunk/Scribus/scribus/scribus.cpp	(original)
+++ trunk/Scribus/scribus/scribus.cpp	Thu Mar 26 12:08:52 2020
@@ -4026,10 +4026,10 @@
 		QFile::remove(fileName);
 		return;
 	}
-
-	currItem->EmbeddedProfile.clear();
+	
 	currItem->pixm.imgInfo.isRequest = false;
 	currItem->UseEmbedded = true;
+	currItem->EmbeddedProfile.clear();
 	currItem->ImageProfile = doc->cmsSettings().DefaultImageRGBProfile;
 	currItem->ImageIntent = doc->cmsSettings().DefaultIntentImages;
 	qApp->setOverrideCursor( QCursor(Qt::WaitCursor) );
@@ -8880,8 +8880,8 @@
 	if (i != QMessageBox::Yes)
 		return;
 
+	imageItem->pixm.imgInfo.isRequest = false;
 	imageItem->EmbeddedProfile.clear();
-	imageItem->pixm.imgInfo.isRequest = false;
 	imageItem->ImageProfile = doc->cmsSettings().DefaultImageRGBProfile;
 	imageItem->ImageIntent  = doc->cmsSettings().DefaultIntentImages;
 	imageItem->effectsInUse = contentsBuffer.effects;

Modified: trunk/Scribus/scribus/scribusdoc.cpp
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=23537&path=/trunk/Scribus/scribus/scribusdoc.cpp
==============================================================================
--- trunk/Scribus/scribus/scribusdoc.cpp	(original)
+++ trunk/Scribus/scribus/scribusdoc.cpp	Thu Mar 26 12:08:52 2020
@@ -5441,9 +5441,9 @@
 				if (QFile::exists(iafData.source))
 				{
 					PrefsManager::instance().prefsFile->getContext("dirs")->set("images", iafData.source.left(iafData.source.lastIndexOf("/")));
-					currItem->EmbeddedProfile.clear();
 					currItem->pixm.imgInfo.isRequest = false;
 					currItem->UseEmbedded = true;
+					currItem->EmbeddedProfile.clear();
 					currItem->ImageProfile = m_docPrefsData.colorPrefs.DCMSset.DefaultImageRGBProfile;
 					currItem->ImageIntent = m_docPrefsData.colorPrefs.DCMSset.DefaultIntentImages;
 					qApp->setOverrideCursor( QCursor(Qt::WaitCursor) );




More information about the scribus-commit mailing list