Example #1
0
bool CollectForOutput::collectProfiles()
{
    int c = 0;
    ProfilesL::Iterator itend = docProfiles.end();
    for (ProfilesL::Iterator it = docProfiles.begin(); it != itend; ++it)
    {
        QString profileName(it.key());
        QString oldFile(it.value());
        QString outFile(m_outputDirectory + "profiles/" + QFileInfo(oldFile).fileName());
        bool success = copyFileAtomic(oldFile, outFile);
        if (!success)
            qDebug()<<"CollectForOutput::collectFile copyFileAtomic failed for"<<oldFile<<"to"<<outFile;
#ifndef Q_OS_WIN32
        else
        {
            QFile of(outFile);
            if (of.exists())
            {
                bool permsSet=of.setPermissions(QFile::permissions(oldFile));
                if (!permsSet)
                    qDebug()<<"Unable to set permissions successfully while collecting for output on"<<outFile;
            }
            else
                qDebug()<<"Unable to set permissions successfully while collecting for output on"<<outFile<<"as the file does not exist";
        }
#endif
        if (uiCollect)
            emit profilesCollected(c++);
    }
    return true;
}
void ScribusCore::initCMS()
{
	if (m_HaveCMS)
	{
		ProfilesL::Iterator ip;
		if ((prefsManager->appPrefs.colorPrefs.DCMSset.DefaultImageRGBProfile.isEmpty()) || (!InputProfiles.contains(prefsManager->appPrefs.colorPrefs.DCMSset.DefaultImageRGBProfile)))
		{
			ip = InputProfiles.find("sRGB IEC61966-2.1");
			if (ip == InputProfiles.end())
				ip = InputProfiles.begin();
			prefsManager->appPrefs.colorPrefs.DCMSset.DefaultImageRGBProfile = ip.key();
		}
		if ((prefsManager->appPrefs.colorPrefs.DCMSset.DefaultImageCMYKProfile.isEmpty()) || (!InputProfilesCMYK.contains(prefsManager->appPrefs.colorPrefs.DCMSset.DefaultImageCMYKProfile)))
		{
			ip = InputProfilesCMYK.find("Fogra27L CMYK Coated Press");
			if (ip == InputProfilesCMYK.end())
				ip = InputProfilesCMYK.begin();
			prefsManager->appPrefs.colorPrefs.DCMSset.DefaultImageCMYKProfile = ip.key();
		}
		if ((prefsManager->appPrefs.colorPrefs.DCMSset.DefaultSolidColorRGBProfile.isEmpty()) || (!InputProfiles.contains(prefsManager->appPrefs.colorPrefs.DCMSset.DefaultSolidColorRGBProfile)))
		{
			ip = InputProfiles.find("sRGB IEC61966-2.1");
			if (ip == InputProfiles.end())
				ip = InputProfiles.begin();
			prefsManager->appPrefs.colorPrefs.DCMSset.DefaultSolidColorRGBProfile = ip.key();
		}
		if ((prefsManager->appPrefs.colorPrefs.DCMSset.DefaultSolidColorCMYKProfile.isEmpty()) || (!InputProfilesCMYK.contains(prefsManager->appPrefs.colorPrefs.DCMSset.DefaultSolidColorCMYKProfile)))
		{
			ip = InputProfilesCMYK.find("Fogra27L CMYK Coated Press");
			if (ip == InputProfilesCMYK.end())
				ip = InputProfilesCMYK.begin();
			prefsManager->appPrefs.colorPrefs.DCMSset.DefaultSolidColorCMYKProfile = ip.key();
		}
		if ((prefsManager->appPrefs.colorPrefs.DCMSset.DefaultMonitorProfile.isEmpty()) || (!MonitorProfiles.contains(prefsManager->appPrefs.colorPrefs.DCMSset.DefaultMonitorProfile)))
		{
			ip = MonitorProfiles.find("sRGB IEC61966-2.1");
			if (ip == MonitorProfiles.end())
				ip = MonitorProfiles.begin();
			prefsManager->appPrefs.colorPrefs.DCMSset.DefaultMonitorProfile = ip.key();
		}
		if ((prefsManager->appPrefs.colorPrefs.DCMSset.DefaultPrinterProfile.isEmpty()) || (!PrinterProfiles.contains(prefsManager->appPrefs.colorPrefs.DCMSset.DefaultPrinterProfile)))
		{
			ip = PrinterProfiles.find("Fogra27L CMYK Coated Press");
			if (ip == PrinterProfiles.end())
				ip = PrinterProfiles.begin();
			prefsManager->appPrefs.colorPrefs.DCMSset.DefaultPrinterProfile = ip.key();
		}
		InitDefaultColorTransforms();
	}
}