r22201 by jghali -

scribus-commit scribus-commit at lists.scribus.net
Sun Oct 22 22:26:47 UTC 2017


Author: jghali
Date: Sun Oct 22 22:26:47 2017
New Revision: 22201

URL: http://scribus.net/websvn/listing.php?repname=Scribus&sc=1&rev=22201
Log:
when possible, shorten missing profiles message which may appear after loading doc

Modified:
    trunk/Scribus/scribus/scribus.cpp

Modified: trunk/Scribus/scribus/scribus.cpp
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=22201&path=/trunk/Scribus/scribus/scribus.cpp
==============================================================================
--- trunk/Scribus/scribus/scribus.cpp	(original)
+++ trunk/Scribus/scribus/scribus.cpp	Sun Oct 22 22:26:47 2017
@@ -49,6 +49,7 @@
 #include <QMdiSubWindow>
 #include <QMessageBox>
 #include <QMouseEvent>
+#include <QMultiMap>
 #include <QPixmap>
 #include <QProgressBar>
 #include <QPushButton>
@@ -3630,79 +3631,88 @@
 			doc->HasCMS = false;
 		if ((ScCore->haveCMS()) && (doc->cmsSettings().CMSinUse))
 		{
-			bool cmsWarning = false;
-			QStringList missing;
-			QStringList replacement;
+			QString missing, replacement;
+			QMultiMap<QString, QString> missingMap;
 			if (!ScCore->InputProfiles.contains(doc->cmsSettings().DefaultImageRGBProfile))
 			{
-				cmsWarning = true;
-				missing.append(doc->cmsSettings().DefaultImageRGBProfile);
-				replacement.append(m_prefsManager->appPrefs.colorPrefs.DCMSset.DefaultImageRGBProfile);
+				missing = doc->cmsSettings().DefaultImageRGBProfile;
+				replacement = m_prefsManager->appPrefs.colorPrefs.DCMSset.DefaultImageRGBProfile;
+				if (!missingMap.contains(missing, replacement))
+					missingMap.insert(missing, replacement);
 				doc->cmsSettings().DefaultImageRGBProfile = m_prefsManager->appPrefs.colorPrefs.DCMSset.DefaultImageRGBProfile;
 			}
 			if (!ScCore->InputProfilesCMYK.contains(doc->cmsSettings().DefaultImageCMYKProfile))
 			{
-				cmsWarning = true;
-				missing.append(doc->cmsSettings().DefaultImageCMYKProfile);
-				replacement.append(m_prefsManager->appPrefs.colorPrefs.DCMSset.DefaultImageCMYKProfile);
+				missing = doc->cmsSettings().DefaultImageCMYKProfile;
+				replacement = m_prefsManager->appPrefs.colorPrefs.DCMSset.DefaultImageCMYKProfile;
+				if (!missingMap.contains(missing, replacement))
+					missingMap.insert(missing, replacement);
 				doc->cmsSettings().DefaultImageCMYKProfile = m_prefsManager->appPrefs.colorPrefs.DCMSset.DefaultImageCMYKProfile;
 			}
 			if (!ScCore->InputProfiles.contains(doc->cmsSettings().DefaultSolidColorRGBProfile))
 			{
-				cmsWarning = true;
-				missing.append(doc->cmsSettings().DefaultSolidColorRGBProfile);
-				replacement.append(m_prefsManager->appPrefs.colorPrefs.DCMSset.DefaultSolidColorRGBProfile);
+				missing = doc->cmsSettings().DefaultSolidColorRGBProfile;
+				replacement = m_prefsManager->appPrefs.colorPrefs.DCMSset.DefaultSolidColorRGBProfile;
+				if (!missingMap.contains(missing, replacement))
+					missingMap.insert(missing, replacement);
 				doc->cmsSettings().DefaultSolidColorRGBProfile = m_prefsManager->appPrefs.colorPrefs.DCMSset.DefaultSolidColorRGBProfile;
 			}
 			if (!ScCore->InputProfilesCMYK.contains(doc->cmsSettings().DefaultSolidColorCMYKProfile))
 			{
-				cmsWarning = true;
-				missing.append(doc->cmsSettings().DefaultSolidColorCMYKProfile);
-				replacement.append(m_prefsManager->appPrefs.colorPrefs.DCMSset.DefaultSolidColorCMYKProfile);
+				missing = doc->cmsSettings().DefaultSolidColorCMYKProfile;
+				replacement = m_prefsManager->appPrefs.colorPrefs.DCMSset.DefaultSolidColorCMYKProfile;
+				if (!missingMap.contains(missing, replacement))
+					missingMap.insert(missing, replacement);
 				doc->cmsSettings().DefaultSolidColorCMYKProfile = m_prefsManager->appPrefs.colorPrefs.DCMSset.DefaultSolidColorCMYKProfile;
 			}
 			if (!ScCore->MonitorProfiles.contains(doc->cmsSettings().DefaultMonitorProfile))
 			{
-				cmsWarning = true;
-				missing.append(doc->cmsSettings().DefaultMonitorProfile);
-				replacement.append(m_prefsManager->appPrefs.colorPrefs.DCMSset.DefaultMonitorProfile);
+				missing = doc->cmsSettings().DefaultMonitorProfile;
+				replacement = m_prefsManager->appPrefs.colorPrefs.DCMSset.DefaultMonitorProfile;
+				if (!missingMap.contains(missing, replacement))
+					missingMap.insert(missing, replacement);
 				doc->cmsSettings().DefaultMonitorProfile = m_prefsManager->appPrefs.colorPrefs.DCMSset.DefaultMonitorProfile;
 			}
 			if (!ScCore->PrinterProfiles.contains(doc->cmsSettings().DefaultPrinterProfile))
 			{
-				cmsWarning = true;
-				missing.append(doc->cmsSettings().DefaultPrinterProfile);
-				replacement.append(m_prefsManager->appPrefs.colorPrefs.DCMSset.DefaultPrinterProfile);
+				missing = doc->cmsSettings().DefaultPrinterProfile;
+				replacement = m_prefsManager->appPrefs.colorPrefs.DCMSset.DefaultPrinterProfile;
+				if (!missingMap.contains(missing, replacement))
+					missingMap.insert(missing, replacement);
 				doc->cmsSettings().DefaultPrinterProfile = m_prefsManager->appPrefs.colorPrefs.DCMSset.DefaultPrinterProfile;
 			}
 			if (!ScCore->PrinterProfiles.contains(doc->pdfOptions().PrintProf))
 			{
-				cmsWarning = true;
-				missing.append(doc->pdfOptions().PrintProf);
-				replacement.append(m_prefsManager->appPrefs.colorPrefs.DCMSset.DefaultPrinterProfile);
+				missing = doc->pdfOptions().PrintProf;
+				replacement = m_prefsManager->appPrefs.colorPrefs.DCMSset.DefaultPrinterProfile;
+				if (!missingMap.contains(missing, replacement))
+					missingMap.insert(missing, replacement);
 				doc->pdfOptions().PrintProf = doc->cmsSettings().DefaultPrinterProfile;
 			}
 			if (!ScCore->InputProfiles.contains(doc->pdfOptions().ImageProf))
 			{
-				cmsWarning = true;
-				missing.append(doc->pdfOptions().ImageProf);
-				replacement.append(m_prefsManager->appPrefs.colorPrefs.DCMSset.DefaultImageRGBProfile);
+				missing = doc->pdfOptions().ImageProf;
+				replacement = m_prefsManager->appPrefs.colorPrefs.DCMSset.DefaultImageRGBProfile;
+				if (!missingMap.contains(missing, replacement))
+					missingMap.insert(missing, replacement);
 				doc->pdfOptions().ImageProf = doc->cmsSettings().DefaultImageRGBProfile;
 			}
 			if (!ScCore->InputProfiles.contains(doc->pdfOptions().SolidProf))
 			{
-				cmsWarning = true;
-				missing.append(doc->pdfOptions().SolidProf);
-				replacement.append(m_prefsManager->appPrefs.colorPrefs.DCMSset.DefaultSolidColorRGBProfile);
+				missing = doc->pdfOptions().SolidProf;
+				replacement = m_prefsManager->appPrefs.colorPrefs.DCMSset.DefaultSolidColorRGBProfile;
+				if (!missingMap.contains(missing, replacement))
+					missingMap.insert(missing, replacement);
 				doc->pdfOptions().SolidProf = doc->cmsSettings().DefaultSolidColorRGBProfile;
 			}
-			if (cmsWarning)
-			{
+			if (missingMap.count() > 0)
+			{
+				QMultiMap<QString, QString>::const_iterator it;
 				qApp->changeOverrideCursor(QCursor(Qt::ArrowCursor));
 				QString mess = tr("Some color profiles used by this document are not installed:")+"\n\n";
-				for (int m = 0; m < missing.count(); ++m)
+				for (it = missingMap.begin(); it != missingMap.end(); ++it)
 				{
-					mess += missing[m] + tr(" was replaced by: ")+replacement[m]+"\n";
+					mess += it.key() + tr(" was replaced by: ") + it.value() +"\n";
 				}
 				ScMessageBox::warning(this, CommonStrings::trWarning, mess);
 			}




More information about the scribus-commit mailing list