r22811 by jghali - Small refactoring for ScribusCore initCMS(): exit function early when possible

scribus-commit scribus-commit at lists.scribus.net
Sun Jan 20 15:46:01 UTC 2019


Author: jghali
Date: Sun Jan 20 15:46:01 2019
New Revision: 22811

URL: http://scribus.net/websvn/listing.php?repname=Scribus&sc=1&rev=22811
Log:
Small refactoring for ScribusCore initCMS(): exit function early when possible

Modified:
    trunk/Scribus/scribus/scribuscore.cpp

Modified: trunk/Scribus/scribus/scribuscore.cpp
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=22811&path=/trunk/Scribus/scribus/scribuscore.cpp
==============================================================================
--- trunk/Scribus/scribus/scribuscore.cpp	(original)
+++ trunk/Scribus/scribus/scribuscore.cpp	Sun Jan 20 15:46:01 2019
@@ -495,59 +495,59 @@
 
 void ScribusCore::initCMS()
 {
-	if (m_HaveCMS)
-	{
-		ProfilesL::Iterator ip;
-		if ((m_prefsManager->appPrefs.colorPrefs.DCMSset.DefaultImageRGBProfile.isEmpty()) || (!InputProfiles.contains(m_prefsManager->appPrefs.colorPrefs.DCMSset.DefaultImageRGBProfile)))
-		{
-			ip = InputProfiles.find("sRGB IEC61966-2.1");
-			if (ip == InputProfiles.end())
-				ip = InputProfiles.begin();
-			m_prefsManager->appPrefs.colorPrefs.DCMSset.DefaultImageRGBProfile = ip.key();
-		}
-		if ((m_prefsManager->appPrefs.colorPrefs.DCMSset.DefaultImageCMYKProfile.isEmpty()) || (!InputProfilesCMYK.contains(m_prefsManager->appPrefs.colorPrefs.DCMSset.DefaultImageCMYKProfile)))
-		{
-			ip = InputProfilesCMYK.find("ISO Coated v2 300% (basICColor)");
-			if (ip == InputProfilesCMYK.end())
-				ip = InputProfilesCMYK.find("Fogra27L CMYK Coated Press");
-			if (ip == InputProfilesCMYK.end())
-				ip = InputProfilesCMYK.begin();
-			m_prefsManager->appPrefs.colorPrefs.DCMSset.DefaultImageCMYKProfile = ip.key();
-		}
-		if ((m_prefsManager->appPrefs.colorPrefs.DCMSset.DefaultSolidColorRGBProfile.isEmpty()) || (!InputProfiles.contains(m_prefsManager->appPrefs.colorPrefs.DCMSset.DefaultSolidColorRGBProfile)))
-		{
-			ip = InputProfiles.find("sRGB IEC61966-2.1");
-			if (ip == InputProfiles.end())
-				ip = InputProfiles.begin();
-			m_prefsManager->appPrefs.colorPrefs.DCMSset.DefaultSolidColorRGBProfile = ip.key();
-		}
-		if ((m_prefsManager->appPrefs.colorPrefs.DCMSset.DefaultSolidColorCMYKProfile.isEmpty()) || (!InputProfilesCMYK.contains(m_prefsManager->appPrefs.colorPrefs.DCMSset.DefaultSolidColorCMYKProfile)))
-		{
-			ip = InputProfilesCMYK.find("ISO Coated v2 300% (basICColor)");
-			if (ip == InputProfilesCMYK.end())
-				ip = InputProfilesCMYK.find("Fogra27L CMYK Coated Press");
-			if (ip == InputProfilesCMYK.end())
-				ip = InputProfilesCMYK.begin();
-			m_prefsManager->appPrefs.colorPrefs.DCMSset.DefaultSolidColorCMYKProfile = ip.key();
-		}
-		if ((m_prefsManager->appPrefs.colorPrefs.DCMSset.DefaultMonitorProfile.isEmpty()) || (!MonitorProfiles.contains(m_prefsManager->appPrefs.colorPrefs.DCMSset.DefaultMonitorProfile)))
-		{
-			ip = MonitorProfiles.find("sRGB IEC61966-2.1");
-			if (ip == MonitorProfiles.end())
-				ip = MonitorProfiles.begin();
-			m_prefsManager->appPrefs.colorPrefs.DCMSset.DefaultMonitorProfile = ip.key();
-		}
-		if ((m_prefsManager->appPrefs.colorPrefs.DCMSset.DefaultPrinterProfile.isEmpty()) || (!PrinterProfiles.contains(m_prefsManager->appPrefs.colorPrefs.DCMSset.DefaultPrinterProfile)))
-		{
-			ip = PrinterProfiles.find("ISO Coated v2 300% (basICColor)");
-			if (ip == PrinterProfiles.end())
-				ip = PrinterProfiles.find("Fogra27L CMYK Coated Press");
-			if (ip == PrinterProfiles.end())
-				ip = PrinterProfiles.begin();
-			m_prefsManager->appPrefs.colorPrefs.DCMSset.DefaultPrinterProfile = ip.key();
-		}
-		InitDefaultColorTransforms();
-	}
+	if (!m_HaveCMS)
+		return;
+
+	ProfilesL::Iterator ip;
+	if ((m_prefsManager->appPrefs.colorPrefs.DCMSset.DefaultImageRGBProfile.isEmpty()) || (!InputProfiles.contains(m_prefsManager->appPrefs.colorPrefs.DCMSset.DefaultImageRGBProfile)))
+	{
+		ip = InputProfiles.find("sRGB IEC61966-2.1");
+		if (ip == InputProfiles.end())
+			ip = InputProfiles.begin();
+		m_prefsManager->appPrefs.colorPrefs.DCMSset.DefaultImageRGBProfile = ip.key();
+	}
+	if ((m_prefsManager->appPrefs.colorPrefs.DCMSset.DefaultImageCMYKProfile.isEmpty()) || (!InputProfilesCMYK.contains(m_prefsManager->appPrefs.colorPrefs.DCMSset.DefaultImageCMYKProfile)))
+	{
+		ip = InputProfilesCMYK.find("ISO Coated v2 300% (basICColor)");
+		if (ip == InputProfilesCMYK.end())
+			ip = InputProfilesCMYK.find("Fogra27L CMYK Coated Press");
+		if (ip == InputProfilesCMYK.end())
+			ip = InputProfilesCMYK.begin();
+		m_prefsManager->appPrefs.colorPrefs.DCMSset.DefaultImageCMYKProfile = ip.key();
+	}
+	if ((m_prefsManager->appPrefs.colorPrefs.DCMSset.DefaultSolidColorRGBProfile.isEmpty()) || (!InputProfiles.contains(m_prefsManager->appPrefs.colorPrefs.DCMSset.DefaultSolidColorRGBProfile)))
+	{
+		ip = InputProfiles.find("sRGB IEC61966-2.1");
+		if (ip == InputProfiles.end())
+			ip = InputProfiles.begin();
+		m_prefsManager->appPrefs.colorPrefs.DCMSset.DefaultSolidColorRGBProfile = ip.key();
+	}
+	if ((m_prefsManager->appPrefs.colorPrefs.DCMSset.DefaultSolidColorCMYKProfile.isEmpty()) || (!InputProfilesCMYK.contains(m_prefsManager->appPrefs.colorPrefs.DCMSset.DefaultSolidColorCMYKProfile)))
+	{
+		ip = InputProfilesCMYK.find("ISO Coated v2 300% (basICColor)");
+		if (ip == InputProfilesCMYK.end())
+			ip = InputProfilesCMYK.find("Fogra27L CMYK Coated Press");
+		if (ip == InputProfilesCMYK.end())
+			ip = InputProfilesCMYK.begin();
+		m_prefsManager->appPrefs.colorPrefs.DCMSset.DefaultSolidColorCMYKProfile = ip.key();
+	}
+	if ((m_prefsManager->appPrefs.colorPrefs.DCMSset.DefaultMonitorProfile.isEmpty()) || (!MonitorProfiles.contains(m_prefsManager->appPrefs.colorPrefs.DCMSset.DefaultMonitorProfile)))
+	{
+		ip = MonitorProfiles.find("sRGB IEC61966-2.1");
+		if (ip == MonitorProfiles.end())
+			ip = MonitorProfiles.begin();
+		m_prefsManager->appPrefs.colorPrefs.DCMSset.DefaultMonitorProfile = ip.key();
+	}
+	if ((m_prefsManager->appPrefs.colorPrefs.DCMSset.DefaultPrinterProfile.isEmpty()) || (!PrinterProfiles.contains(m_prefsManager->appPrefs.colorPrefs.DCMSset.DefaultPrinterProfile)))
+	{
+		ip = PrinterProfiles.find("ISO Coated v2 300% (basICColor)");
+		if (ip == PrinterProfiles.end())
+			ip = PrinterProfiles.find("Fogra27L CMYK Coated Press");
+		if (ip == PrinterProfiles.end())
+			ip = PrinterProfiles.begin();
+		m_prefsManager->appPrefs.colorPrefs.DCMSset.DefaultPrinterProfile = ip.key();
+	}
+	InitDefaultColorTransforms();
 }
 
 ScribusMainWindow * ScribusCore::primaryMainWindow()




More information about the scribus-commit mailing list