Changeset View
Changeset View
Standalone View
Standalone View
libs/ui/kis_config.cc
Context not available. | |||||
49 | #include <config-ocio.h> | 49 | #include <config-ocio.h> | ||
---|---|---|---|---|---|
50 | 50 | | |||
51 | #include <kis_color_manager.h> | 51 | #include <kis_color_manager.h> | ||
52 | #include <KisOcioConfiguration.h> | ||||
52 | 53 | | |||
53 | KisConfig::KisConfig(bool readOnly) | 54 | KisConfig::KisConfig(bool readOnly) | ||
54 | : m_cfg( KSharedConfig::openConfig()->group("")) | 55 | : m_cfg( KSharedConfig::openConfig()->group("")) | ||
Context not available. | |||||
1364 | m_cfg.writeEntry("levelOfDetailEnabled", value); | 1365 | m_cfg.writeEntry("levelOfDetailEnabled", value); | ||
1365 | } | 1366 | } | ||
1366 | 1367 | | |||
1367 | KisConfig::OcioColorManagementMode | 1368 | KisOcioConfiguration KisConfig::ocioConfiguration(bool defaultValue) const | ||
1368 | KisConfig::ocioColorManagementMode(bool defaultValue) const | | |||
1369 | { | 1369 | { | ||
1370 | return (OcioColorManagementMode)(defaultValue ? INTERNAL | 1370 | KisOcioConfiguration cfg; | ||
1371 | : m_cfg.readEntry("Krita/Ocio/OcioColorManagementMode", (int) INTERNAL)); | | |||
1372 | } | | |||
1373 | 1371 | | |||
1374 | void KisConfig::setOcioColorManagementMode(OcioColorManagementMode mode) const | 1372 | if (!defaultValue) { | ||
1375 | { | 1373 | cfg.mode = (KisOcioConfiguration::Mode)m_cfg.readEntry("Krita/Ocio/OcioColorManagementMode", 0); | ||
1376 | m_cfg.writeEntry("Krita/Ocio/OcioColorManagementMode", (int) mode); | 1374 | cfg.configurationPath = m_cfg.readEntry("Krita/Ocio/OcioConfigPath", QString()); | ||
1377 | } | 1375 | cfg.lutPath = m_cfg.readEntry("Krita/Ocio/OcioLutPath", QString()); | ||
1376 | cfg.inputColorSpace = m_cfg.readEntry("Krita/Ocio/InputColorSpace", QString()); | ||||
1377 | cfg.displayDevice = m_cfg.readEntry("Krita/Ocio/DisplayDevice", QString()); | ||||
1378 | cfg.displayView = m_cfg.readEntry("Krita/Ocio/DisplayView", QString()); | ||||
1379 | cfg.look = m_cfg.readEntry("Krita/Ocio/DisplayLook", QString()); | ||||
1380 | } | ||||
1378 | 1381 | | |||
1379 | QString KisConfig::ocioConfigurationPath(bool defaultValue) const | 1382 | return cfg; | ||
1380 | { | | |||
1381 | return (defaultValue ? QString() : m_cfg.readEntry("Krita/Ocio/OcioConfigPath", QString())); | | |||
1382 | } | 1383 | } | ||
1383 | 1384 | | |||
1384 | void KisConfig::setOcioConfigurationPath(const QString &path) const | 1385 | void KisConfig::setOcioConfiguration(const KisOcioConfiguration &cfg) | ||
1385 | { | 1386 | { | ||
1386 | m_cfg.writeEntry("Krita/Ocio/OcioConfigPath", path); | 1387 | m_cfg.writeEntry("Krita/Ocio/OcioColorManagementMode", (int) cfg.mode); | ||
1388 | m_cfg.writeEntry("Krita/Ocio/OcioConfigPath", cfg.configurationPath); | ||||
1389 | m_cfg.writeEntry("Krita/Ocio/OcioLutPath", cfg.lutPath); | ||||
1390 | m_cfg.writeEntry("Krita/Ocio/InputColorSpace", cfg.inputColorSpace); | ||||
1391 | m_cfg.writeEntry("Krita/Ocio/DisplayDevice", cfg.displayDevice); | ||||
1392 | m_cfg.writeEntry("Krita/Ocio/DisplayView", cfg.displayView); | ||||
1393 | m_cfg.writeEntry("Krita/Ocio/DisplayLook", cfg.look); | ||||
1387 | } | 1394 | } | ||
1388 | 1395 | | |||
1389 | QString KisConfig::ocioLutPath(bool defaultValue) const | 1396 | KisConfig::OcioColorManagementMode | ||
1397 | KisConfig::ocioColorManagementMode(bool defaultValue) const | ||||
1390 | { | 1398 | { | ||
1391 | return (defaultValue ? QString() : m_cfg.readEntry("Krita/Ocio/OcioLutPath", QString())); | 1399 | // FIXME: this option duplicates ocioConfiguration(), please deprecate it | ||
1400 | return (OcioColorManagementMode)(defaultValue ? INTERNAL | ||||
1401 | : m_cfg.readEntry("Krita/Ocio/OcioColorManagementMode", (int) INTERNAL)); | ||||
1392 | } | 1402 | } | ||
1393 | 1403 | | |||
1394 | void KisConfig::setOcioLutPath(const QString &path) const | 1404 | void KisConfig::setOcioColorManagementMode(OcioColorManagementMode mode) const | ||
1395 | { | 1405 | { | ||
1396 | m_cfg.writeEntry("Krita/Ocio/OcioLutPath", path); | 1406 | // FIXME: this option duplicates ocioConfiguration(), please deprecate it | ||
1407 | m_cfg.writeEntry("Krita/Ocio/OcioColorManagementMode", (int) mode); | ||||
1397 | } | 1408 | } | ||
1398 | 1409 | | |||
1399 | int KisConfig::ocioLutEdgeSize(bool defaultValue) const | 1410 | int KisConfig::ocioLutEdgeSize(bool defaultValue) const | ||
Context not available. | |||||
2004 | m_cfg.writeEntry("activateTransformToolAfterPaste", value); | 2015 | m_cfg.writeEntry("activateTransformToolAfterPaste", value); | ||
2005 | } | 2016 | } | ||
2006 | 2017 | | |||
2018 | KisConfig::RootSurfaceFormat KisConfig::rootSurfaceFormat(bool defaultValue) const | ||||
2019 | { | ||||
2020 | const QString configPath = QStandardPaths::writableLocation(QStandardPaths::GenericConfigLocation); | ||||
2021 | QSettings kritarc(configPath + QStringLiteral("/kritadisplayrc"), QSettings::IniFormat); | ||||
2022 | | ||||
2023 | return rootSurfaceFormat(&kritarc, defaultValue); | ||||
2024 | } | ||||
2025 | | ||||
2026 | void KisConfig::setRootSurfaceFormat(KisConfig::RootSurfaceFormat value) | ||||
2027 | { | ||||
2028 | const QString configPath = QStandardPaths::writableLocation(QStandardPaths::GenericConfigLocation); | ||||
2029 | QSettings kritarc(configPath + QStringLiteral("/kritadisplayrc"), QSettings::IniFormat); | ||||
2030 | | ||||
2031 | setRootSurfaceFormat(&kritarc, value); | ||||
2032 | } | ||||
2033 | | ||||
2034 | KisConfig::RootSurfaceFormat KisConfig::rootSurfaceFormat(QSettings *displayrc, bool defaultValue) | ||||
2035 | { | ||||
2036 | QString textValue = "bt709-g22"; | ||||
2037 | | ||||
2038 | if (!defaultValue) { | ||||
2039 | textValue = displayrc->value("rootSurfaceFormat", textValue).toString(); | ||||
2040 | } | ||||
2041 | | ||||
2042 | return textValue == "bt709-g10" ? BT709_G10 : | ||||
2043 | textValue == "bt2020-pq" ? BT2020_PQ : | ||||
2044 | BT709_G22; | ||||
2045 | } | ||||
2046 | | ||||
2047 | void KisConfig::setRootSurfaceFormat(QSettings *displayrc, KisConfig::RootSurfaceFormat value) | ||||
2048 | { | ||||
2049 | const QString textValue = | ||||
2050 | value == BT709_G10 ? "bt709-g10" : | ||||
2051 | value == BT2020_PQ ? "bt2020-pq" : | ||||
2052 | "bt709-g22"; | ||||
2053 | | ||||
2054 | displayrc->setValue("rootSurfaceFormat", textValue); | ||||
2055 | } | ||||
2056 | | ||||
2007 | bool KisConfig::useZip64(bool defaultValue) const | 2057 | bool KisConfig::useZip64(bool defaultValue) const | ||
2008 | { | 2058 | { | ||
2009 | return defaultValue ? false : m_cfg.readEntry("UseZip64", false); | 2059 | return defaultValue ? false : m_cfg.readEntry("UseZip64", false); | ||
Context not available. |