Commit e1071ab5 authored by Boudewijn Rempt's avatar Boudewijn Rempt

Load the system profiles on Windows and macOS

(cherry picked from commit aa58837b)
parent 4b7bf8ed
...@@ -66,16 +66,16 @@ ...@@ -66,16 +66,16 @@
#include "colorspaces/ycbcr_f32/YCbCrF32ColorSpace.h" #include "colorspaces/ycbcr_f32/YCbCrF32ColorSpace.h"
#include <KoConfig.h> #include <KoConfig.h>
#ifdef HAVE_OPENEXR
#include <half.h>
#ifdef HAVE_LCMS24 #ifdef HAVE_OPENEXR
#include "colorspaces/gray_f16/GrayF16ColorSpace.h" # include <half.h>
#include "colorspaces/xyz_f16/XyzF16ColorSpace.h" # ifdef HAVE_LCMS24
#include "colorspaces/rgb_f16/RgbF16ColorSpace.h" # include "colorspaces/gray_f16/GrayF16ColorSpace.h"
# include "colorspaces/xyz_f16/XyzF16ColorSpace.h"
# include "colorspaces/rgb_f16/RgbF16ColorSpace.h"
# endif
#endif #endif
#endif
void lcms2LogErrorHandlerFunction(cmsContext /*ContextID*/, cmsUInt32Number ErrorCode, const char *Text) void lcms2LogErrorHandlerFunction(cmsContext /*ContextID*/, cmsUInt32Number ErrorCode, const char *Text)
{ {
qCritical() << "Lcms2 error: " << ErrorCode << Text; qCritical() << "Lcms2 error: " << ErrorCode << Text;
...@@ -110,13 +110,26 @@ LcmsEnginePlugin::LcmsEnginePlugin(QObject *parent, const QVariantList &) ...@@ -110,13 +110,26 @@ LcmsEnginePlugin::LcmsEnginePlugin(QObject *parent, const QVariantList &)
profileFilenames += KoResourcePaths::findAllResources("icc_profiles", "*.ICM", KoResourcePaths::Recursive); profileFilenames += KoResourcePaths::findAllResources("icc_profiles", "*.ICM", KoResourcePaths::Recursive);
profileFilenames += KoResourcePaths::findAllResources("icc_profiles", "*.ICC", KoResourcePaths::Recursive); profileFilenames += KoResourcePaths::findAllResources("icc_profiles", "*.ICC", KoResourcePaths::Recursive);
profileFilenames += KoResourcePaths::findAllResources("icc_profiles", "*.icc", KoResourcePaths::Recursive); profileFilenames += KoResourcePaths::findAllResources("icc_profiles", "*.icc", KoResourcePaths::Recursive);
QStringList iccProfileDirs;
#ifdef Q_OS_MAC
iccProfileDirs.append(QDir::homePath() + "/Library/ColorSync/Profiles/");
iccProfileDirs.append("/System/Library/ColorSync/Profiles/");
iccProfileDirs.append("/Library/ColorSync/Profiles/");
#endif
#ifdef Q_OS_WIN #ifdef Q_OS_WIN
const QString windowsProfilePath("C:/Windows/System32/spool/drivers/color"); QString winPath = QString::fromUtf8(qgetenv("windir"));
QDir windowsProfileDir(windowsProfilePath); winPath.replace('\\','/');
Q_FOREACH(const QString &entry, windowsProfileDir.entryList(QStringList() << "*.icm" << "*.icc", QDir::NoDotAndDotDot | QDir::Files | QDir::Readable)) { iccProfileDirs.append(winPath + "/Spool/Drivers/Color/");
profileFilenames << windowsProfilePath + "/" + entry;
}
#endif #endif
Q_FOREACH(const QString &iccProfiledir, iccProfileDirs) {
QDir profileDir(iccProfiledir);
Q_FOREACH(const QString &entry, profileDir.entryList(QStringList() << "*.icm" << "*.icc", QDir::NoDotAndDotDot | QDir::Files | QDir::Readable)) {
profileFilenames << iccProfiledir + "/" + entry;
}
}
// Load the profiles // Load the profiles
if (!profileFilenames.empty()) { if (!profileFilenames.empty()) {
for (QStringList::Iterator it = profileFilenames.begin(); it != profileFilenames.end(); ++it) { for (QStringList::Iterator it = profileFilenames.begin(); it != profileFilenames.end(); ++it) {
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment