Krita Source Code Documentation
Loading...
Searching...
No Matches
ColorSettingsTab Class Reference

#include <kis_dlg_preferences.h>

+ Inheritance diagram for ColorSettingsTab:

Public Types

using CanvasSurfaceBitDepthMode = KisConfig::CanvasSurfaceBitDepthMode
 
using CanvasSurfaceMode = KisConfig::CanvasSurfaceMode
 
enum  PreferredSpaceType { PreferredSpace , MasteringSpace }
 

Public Member Functions

 ColorSettingsTab (QWidget *parent=0, const char *name=0)
 
void setDefault ()
 

Public Attributes

QPointer< KisSqueezedComboBoxm_canvasSurfaceBitDepth
 
QPointer< KisSqueezedComboBoxm_canvasSurfaceColorSpace
 
QPointer< QCheckBox > m_chkEnableCanvasColorSpaceManagement
 
bool m_colorManagedByOS {false}
 
QList< QLabel * > m_monitorProfileLabels
 
QList< KisSqueezedComboBox * > m_monitorProfileWidgets
 
WdgColorSettingsm_page
 
QButtonGroup m_pasteBehaviourGroup
 
QPointer< KisCIETongueWidgetm_preferredSpaceGraphic
 
QButtonGroup m_preferredSpaceGraphicMode
 
QScopedPointer< KisProofingConfigModelm_proofModel
 
QScopedPointer< KisScreenMigrationTrackerm_screenMigrationTracker
 

Private Slots

void installProfile ()
 
void refillMonitorProfiles (const KoID &s)
 
void toggleAllowMonitorProfileSelection (bool useSystemProfile)
 
void toggleUseDefaultColorSpace (bool useDefColorSpace)
 
void updatePreferredSpaceGraphic ()
 
void updateProofingDisplayInfo ()
 

Detailed Description

Definition at line 190 of file kis_dlg_preferences.h.

Member Typedef Documentation

◆ CanvasSurfaceBitDepthMode

◆ CanvasSurfaceMode

Member Enumeration Documentation

◆ PreferredSpaceType

Enumerator
PreferredSpace 
MasteringSpace 

Definition at line 198 of file kis_dlg_preferences.h.

Constructor & Destructor Documentation

◆ ColorSettingsTab()

ColorSettingsTab::ColorSettingsTab ( QWidget * parent = 0,
const char * name = 0 )

Default proofing config

Definition at line 1215 of file kis_dlg_preferences.cc.

1216 : QWidget(parent)
1218{
1219 setObjectName(name);
1220
1221 // XXX: Make sure only profiles that fit the specified color model
1222 // are shown in the profile combos
1223
1224 QGridLayout * l = new QGridLayout(this);
1225 l->setContentsMargins(0, 0, 0, 0);
1226 m_page = new WdgColorSettings(this);
1227 l->addWidget(m_page, 0, 0);
1228
1229 KisConfig cfg(true);
1230
1232
1233 if (!m_colorManagedByOS) {
1234 m_page->chkUseSystemMonitorProfile->setChecked(cfg.useSystemMonitorProfile());
1235 connect(m_page->chkUseSystemMonitorProfile, SIGNAL(toggled(bool)), this, SLOT(toggleAllowMonitorProfileSelection(bool)));
1236 }
1237 m_page->chkUseSystemMonitorProfile->setVisible(!m_colorManagedByOS);
1238
1239 m_page->useDefColorSpace->setChecked(cfg.useDefaultColorSpace());
1240 connect(m_page->useDefColorSpace, SIGNAL(toggled(bool)), this, SLOT(toggleUseDefaultColorSpace(bool)));
1242 for (QList<KoID>::iterator id = colorSpaces.begin(); id != colorSpaces.end(); /* nop */) {
1244 id = colorSpaces.erase(id);
1245 } else {
1246 ++id;
1247 }
1248 }
1249 m_page->cmbWorkingColorSpace->setIDList(colorSpaces);
1250 m_page->cmbWorkingColorSpace->setCurrent(cfg.workingColorSpace());
1251 m_page->cmbWorkingColorSpace->setEnabled(cfg.useDefaultColorSpace());
1252
1253 if (!m_colorManagedByOS) {
1254 m_page->bnAddColorProfile->setIcon(koIcon("document-import-16"));
1255 connect(m_page->bnAddColorProfile, SIGNAL(clicked()), SLOT(installProfile()));
1256 }
1257 m_page->bnAddColorProfile->setVisible(!m_colorManagedByOS);
1258
1259 {
1260 QStringList profiles;
1261 QMap<QString, const KoColorProfile *> profileList;
1262 Q_FOREACH(const KoColorProfile *profile, KoColorSpaceRegistry::instance()->profilesFor(RGBAColorModelID.id())) {
1263 profileList[profile->name()] = profile;
1264 profiles.append(profile->name());
1265 }
1266
1267 std::sort(profiles.begin(), profiles.end());
1268 Q_FOREACH (const QString profile, profiles) {
1269 m_page->cmbColorProfileForEXR->addSqueezedItem(profile);
1270 }
1271
1273 const QString defaultProfile = KoColorSpaceRegistry::instance()->defaultProfileForColorSpace(colorSpaceId);
1274 const QString userProfile = cfg.readEntry("ExrDefaultColorProfile", defaultProfile);
1275
1276 m_page->cmbColorProfileForEXR->setCurrent(profiles.contains(userProfile) ? userProfile : defaultProfile);
1277 }
1278
1279
1280 if (!m_colorManagedByOS) {
1281 QFormLayout *monitorProfileGrid = new QFormLayout(m_page->monitorprofileholder);
1282 monitorProfileGrid->setContentsMargins(0, 0, 0, 0);
1283 for(int i = 0; i < QGuiApplication::screens().count(); ++i) {
1284 QLabel *lbl = new QLabel(i18nc("The number of the screen (ordinal) and shortened 'name' of the screen (model + resolution)", "Screen %1 (%2):", i + 1, shortNameOfDisplay(i)));
1285 lbl->setWordWrap(true);
1288 cmb->setSizePolicy(QSizePolicy::MinimumExpanding, QSizePolicy::Fixed);
1289 monitorProfileGrid->addRow(lbl, cmb);
1291 }
1292
1293 // disable if not Linux as KisColorManager is not yet implemented outside Linux
1294#ifndef Q_OS_LINUX
1295 m_page->chkUseSystemMonitorProfile->setChecked(false);
1296 m_page->chkUseSystemMonitorProfile->setDisabled(true);
1297 m_page->chkUseSystemMonitorProfile->setHidden(true);
1298#endif
1299
1300 refillMonitorProfiles(KoID("RGBA"));
1301
1302 for(int i = 0; i < QApplication::screens().count(); ++i) {
1303 if (m_monitorProfileWidgets[i]->contains(cfg.monitorProfile(i))) {
1304 m_monitorProfileWidgets[i]->setCurrent(cfg.monitorProfile(i));
1305 }
1306 }
1307 } else {
1308 QVBoxLayout *vboxLayout = new QVBoxLayout(m_page->monitorprofileholder);
1309 vboxLayout->setContentsMargins(0, 0, 0, 0);
1310 vboxLayout->addItem(new QSpacerItem(20,20));
1311
1312 QGroupBox *groupBox = new QGroupBox(i18n("Display's color space is managed by the operating system"));
1313 vboxLayout->addWidget(groupBox);
1314
1315 QFormLayout *monitorProfileGrid = new QFormLayout(groupBox);
1316 monitorProfileGrid->setContentsMargins(0, 0, 0, 0);
1317
1319 new QCheckBox(i18n("Enable canvas color management"), this);
1320
1322 i18n("<p>Enabling canvas color management automatically creates "
1323 "a separate native surface for the canvas. It might cause "
1324 "performance issues on some systems.</p>"
1325 ""
1326 "<p>If color management is disabled, Krita will render "
1327 "the canvas into the surface of the main window, which "
1328 "is considered sRGB. It will cause two limitations:"
1329 ""
1330 "<ol>"
1331 " <li>the color gamut will be limited to sRGB</li>"
1332 " <li>color proofing mode will be limited to \"use global display settings\", "
1333 " i.e. paper white proofing will become impossible</li>"
1334 "</ol>"
1335 "</p>"));
1336
1337 monitorProfileGrid->addRow(m_chkEnableCanvasColorSpaceManagement);
1338
1339 // surface color space
1341 m_canvasSurfaceColorSpace->setSizePolicy(QSizePolicy::MinimumExpanding, QSizePolicy::Fixed);
1342 QLabel *canvasSurfaceColorSpaceLbl = new QLabel(i18n("Canvas surface color space:"), this);
1343 monitorProfileGrid->addRow(canvasSurfaceColorSpaceLbl, m_canvasSurfaceColorSpace);
1344
1345 m_canvasSurfaceColorSpace->addSqueezedItem(i18n("Preferred by operating system"), QVariant::fromValue(CanvasSurfaceMode::Preferred));
1346 m_canvasSurfaceColorSpace->addSqueezedItem(i18n("Rec 709 Gamma 2.2"), QVariant::fromValue(CanvasSurfaceMode::Rec709g22));
1347 m_canvasSurfaceColorSpace->addSqueezedItem(i18n("Rec 709 Linear"), QVariant::fromValue(CanvasSurfaceMode::Rec709g10));
1348 m_canvasSurfaceColorSpace->addSqueezedItem(i18n("Rec 2020 PQ"), QVariant::fromValue(CanvasSurfaceMode::Rec2020pq));
1349 m_canvasSurfaceColorSpace->addSqueezedItem(i18n("Unmanaged (testing only)"), QVariant::fromValue(CanvasSurfaceMode::Unmanaged));
1350
1351 m_canvasSurfaceColorSpace->setToolTip(
1352 i18n("<p>Color space of the pixels that are transferred to the "
1353 "window compositor. Use \"preferred\" space unless you know "
1354 "what you are doing</p>"));
1355
1356 // surface bit depth
1358 m_canvasSurfaceBitDepth->setSizePolicy(QSizePolicy::MinimumExpanding, QSizePolicy::Fixed);
1359 QLabel *canvasSurfaceBitDepthLbl = new QLabel(i18n("Canvas surface bit depth (needs restart):"), this);
1360 monitorProfileGrid->addRow(canvasSurfaceBitDepthLbl, m_canvasSurfaceBitDepth);
1361
1362 m_canvasSurfaceBitDepth->addSqueezedItem(i18n("Auto"), QVariant::fromValue(CanvasSurfaceBitDepthMode::DepthAuto));
1363 m_canvasSurfaceBitDepth->addSqueezedItem(i18n("8-bit"), QVariant::fromValue(CanvasSurfaceBitDepthMode::Depth8Bit));
1364 m_canvasSurfaceBitDepth->addSqueezedItem(i18n("10-bit"), QVariant::fromValue(CanvasSurfaceBitDepthMode::Depth10Bit));
1365
1366 m_canvasSurfaceBitDepth->setToolTip(
1367 i18n("<p>The bit depth of the color that is passed to the window "
1368 "compositor. You should switch into 10-bit mode if you want to use "
1369 "HDR capabilities of your display</p>"));
1370
1371 const QString currentBitBepthString = QSurfaceFormat::defaultFormat().redBufferSize() == 10 ? i18n("10-bit") : i18n("8-bit");
1372 QLabel *currentCanvasSurfaceBitDepthLbl = new QLabel(i18n("Current canvas surface bit depth:"), this);
1373 QLabel *currentCanvasSurfaceBitDepth = new QLabel(currentBitBepthString, this);
1374 monitorProfileGrid->addRow(currentCanvasSurfaceBitDepthLbl, currentCanvasSurfaceBitDepth);
1375
1376 vboxLayout->addItem(new QSpacerItem(20,20));
1377
1379 QTextBrowser *preferredLbl = new QTextBrowser(this);
1380 preferredLbl->setText(i18n("Color space preferred by the operating system:\n%1", KisPlatformPluginInterfaceFactory::instance()->osPreferredColorSpaceReport(mainWindow)));
1381 preferredLbl->setReadOnly(true);
1382
1383 QHBoxLayout *colorDescriptionChoice = new QHBoxLayout();
1384 vboxLayout->addLayout(colorDescriptionChoice);
1385
1386 QLabel *descriptionChoiceLabel = new QLabel(i18n("Diagram:"));
1387 colorDescriptionChoice->addWidget(descriptionChoiceLabel);
1388
1389 QRadioButton *containerSpace = new QRadioButton(i18nc("@info:radiobutton", "Preferred Space"), this);
1390 colorDescriptionChoice->addWidget(containerSpace);
1391 containerSpace->setToolTip(i18nc("@info:tooltip", "This is the space preferred by the operating system."));
1392 m_preferredSpaceGraphicMode.addButton(containerSpace, PreferredSpace);
1393
1394 QRadioButton *masteringSpace = new QRadioButton(i18nc("@info:radiobutton", "Current Display"), this);
1395 colorDescriptionChoice->addWidget(masteringSpace);
1396 m_preferredSpaceGraphicMode.addButton(masteringSpace, MasteringSpace);
1397 masteringSpace->setToolTip(i18nc("@info:tooltip", "This is the space representing the currently active display."));
1398
1399 QHBoxLayout *colorDescriptionLayout = new QHBoxLayout();
1400 vboxLayout->addLayout(colorDescriptionLayout);
1402 colorDescriptionLayout->addWidget(m_preferredSpaceGraphic);
1403 colorDescriptionLayout->addWidget(preferredLbl);
1404
1405 containerSpace->setChecked(true);
1406 colorDescriptionChoice->addItem(new QSpacerItem(0, 0, QSizePolicy::Expanding));
1407
1408 m_preferredSpaceGraphic->setFixedSize(QSize(200, 200));
1410 connect(&m_preferredSpaceGraphicMode, SIGNAL(buttonClicked(QAbstractButton*)), this, SLOT(updatePreferredSpaceGraphic()));
1414
1415 m_chkEnableCanvasColorSpaceManagement->setChecked(cfg.enableCanvasSurfaceColorSpaceManagement());
1416
1417 {
1418 auto mode = cfg.canvasSurfaceColorSpaceManagementMode();
1419 int index = m_canvasSurfaceColorSpace->findData(QVariant::fromValue(mode));
1420 KIS_SAFE_ASSERT_RECOVER(index >= 0) {
1421 index = 0;
1422 }
1423 m_canvasSurfaceColorSpace->setCurrentIndex(index);
1424 }
1425
1426 {
1427 auto mode = cfg.canvasSurfaceBitDepthMode();
1428 int index = m_canvasSurfaceBitDepth->findData(QVariant::fromValue(mode));
1429 KIS_SAFE_ASSERT_RECOVER(index >= 0) {
1430 index = 0;
1431 }
1432 m_canvasSurfaceBitDepth->setCurrentIndex(index);
1433 }
1434
1435 connect(m_chkEnableCanvasColorSpaceManagement, &QCheckBox::toggled, m_canvasSurfaceColorSpace, &QWidget::setEnabled);
1437
1438 connect(m_chkEnableCanvasColorSpaceManagement, &QCheckBox::toggled, canvasSurfaceColorSpaceLbl, &QWidget::setEnabled);
1439 canvasSurfaceColorSpaceLbl->setEnabled(m_chkEnableCanvasColorSpaceManagement->isChecked());
1440
1441 connect(m_chkEnableCanvasColorSpaceManagement, &QCheckBox::toggled, m_canvasSurfaceBitDepth, &QWidget::setEnabled);
1443
1444 connect(m_chkEnableCanvasColorSpaceManagement, &QCheckBox::toggled, canvasSurfaceBitDepthLbl, &QWidget::setEnabled);
1445 canvasSurfaceBitDepthLbl->setEnabled(m_chkEnableCanvasColorSpaceManagement->isChecked());
1446 }
1447
1448 m_page->chkBlackpoint->setChecked(cfg.useBlackPointCompensation());
1449 m_page->chkAllowLCMSOptimization->setChecked(cfg.allowLCMSOptimization());
1450 m_page->chkForcePaletteColor->setChecked(cfg.forcePaletteColors());
1451 m_page->cmbMonitorIntent->setCurrentIndex(cfg.monitorRenderIntent());
1452 KisImageConfig cfgImage(true);
1453
1457 KisProofingConfigurationSP proofingConfig = cfgImage.defaultProofingconfiguration();
1458
1459 m_page->wdgProofingOptions->setProofingConfig(proofingConfig);
1460
1461 m_proofModel->data.set(*proofingConfig.data());
1462
1463 connect(m_page->chkBlackpoint, SIGNAL(toggled(bool)), this, SLOT(updateProofingDisplayInfo()));
1464 connect(m_page->cmbMonitorIntent, SIGNAL(currentIndexChanged(int)), this, SLOT(updateProofingDisplayInfo()));
1466
1469 m_pasteBehaviourGroup.addButton(m_page->radioPasteAsk, KisClipboard::PASTE_ASK);
1470
1471 QAbstractButton *button = m_pasteBehaviourGroup.button(cfg.pasteBehaviour());
1472 Q_ASSERT(button);
1473
1474 if (button) {
1475 button->setChecked(true);
1476 }
1477
1478 if (!m_colorManagedByOS) {
1479 toggleAllowMonitorProfileSelection(cfg.useSystemMonitorProfile());
1480 }
1481}
const KoID AlphaColorModelID("A", ki18n("Alpha mask"))
const KoID Float16BitsColorDepthID("F16", ki18n("16-bit float/channel"))
const KoID RGBAColorModelID("RGBA", ki18n("RGB/Alpha"))
void toggleUseDefaultColorSpace(bool useDefColorSpace)
QList< QLabel * > m_monitorProfileLabels
void toggleAllowMonitorProfileSelection(bool useSystemProfile)
QPointer< KisCIETongueWidget > m_preferredSpaceGraphic
QButtonGroup m_pasteBehaviourGroup
QPointer< QCheckBox > m_chkEnableCanvasColorSpaceManagement
QPointer< KisSqueezedComboBox > m_canvasSurfaceBitDepth
QScopedPointer< KisProofingConfigModel > m_proofModel
QPointer< KisSqueezedComboBox > m_canvasSurfaceColorSpace
QList< KisSqueezedComboBox * > m_monitorProfileWidgets
void refillMonitorProfiles(const KoID &s)
QButtonGroup m_preferredSpaceGraphicMode
WdgColorSettings * m_page
QScopedPointer< KisScreenMigrationTracker > m_screenMigrationTracker
Main window for Krita.
static KisPart * instance()
Definition KisPart.cpp:131
KisMainWindow * currentMainwindow() const
Definition KisPart.cpp:459
static KisPlatformPluginInterfaceFactory * instance()
The KisProofingConfigModel class.
void sigScreenChanged(QScreen *screen)
Definition KoID.h:30
QString id() const
Definition KoID.cpp:63
#define KIS_SAFE_ASSERT_RECOVER(cond)
Definition kis_assert.h:126
QString shortNameOfDisplay(int index)
#define koIcon(name)
Use these macros for icons without any issues.
Definition kis_icon.h:25
QString button(const QWheelEvent &ev)
QString colorSpaceId(const QString &colorModelId, const QString &colorDepthId) const
static KoColorSpaceRegistry * instance()
QString defaultProfileForColorSpace(const QString &colorSpaceId) const
KoID colorSpaceColorModelId(const QString &_colorSpaceId) const
QList< KoID > listKeys() const

References KisConfig::allowLCMSOptimization(), AlphaColorModelID, button(), KisConfig::canvasSurfaceBitDepthMode(), KisConfig::canvasSurfaceColorSpaceManagementMode(), KoColorSpaceRegistry::colorSpaceColorModelId(), KoColorSpaceRegistry::colorSpaceId(), KisPart::currentMainwindow(), KoColorSpaceRegistry::defaultProfileForColorSpace(), KisImageConfig::defaultProofingconfiguration(), KisConfig::enableCanvasSurfaceColorSpaceManagement(), Float16BitsColorDepthID, KisConfig::forcePaletteColors(), KoID::id(), installProfile(), KoColorSpaceRegistry::instance(), KisPart::instance(), KisPlatformPluginInterfaceFactory::instance(), KIS_SAFE_ASSERT_RECOVER, koIcon, KoColorSpaceRegistry::listKeys(), m_canvasSurfaceBitDepth, m_canvasSurfaceColorSpace, m_chkEnableCanvasColorSpaceManagement, m_colorManagedByOS, m_monitorProfileLabels, m_monitorProfileWidgets, m_page, m_pasteBehaviourGroup, m_preferredSpaceGraphic, m_preferredSpaceGraphicMode, m_proofModel, m_screenMigrationTracker, MasteringSpace, KisConfig::monitorProfile(), KisConfig::monitorRenderIntent(), KoColorProfile::name, KisClipboard::PASTE_ASK, KisClipboard::PASTE_ASSUME_MONITOR, KisClipboard::PASTE_ASSUME_WEB, KisConfig::pasteBehaviour(), PreferredSpace, KisConfig::readEntry(), refillMonitorProfiles(), RGBAColorModelID, shortNameOfDisplay(), KisScreenMigrationTracker::sigScreenChanged(), KisPlatformPluginInterfaceFactory::surfaceColorManagedByOS(), toggleAllowMonitorProfileSelection(), toggleUseDefaultColorSpace(), updatePreferredSpaceGraphic(), updateProofingDisplayInfo(), KisConfig::useBlackPointCompensation(), KisConfig::useDefaultColorSpace(), KisConfig::useSystemMonitorProfile(), and KisConfig::workingColorSpace().

Member Function Documentation

◆ installProfile

void ColorSettingsTab::installProfile ( )
privateslot

Definition at line 1483 of file kis_dlg_preferences.cc.

1484{
1486
1487 KoFileDialog dialog(this, KoFileDialog::OpenFiles, "OpenDocumentICC");
1488 dialog.setCaption(i18n("Install Color Profiles"));
1489 dialog.setDefaultDir(QStandardPaths::writableLocation(QStandardPaths::HomeLocation));
1490 dialog.setMimeTypeFilters(QStringList() << "application/vnd.iccprofile", "application/vnd.iccprofile");
1491 QStringList profileNames = dialog.filenames();
1492
1494 Q_ASSERT(iccEngine);
1495
1496 QString saveLocation = KoResourcePaths::saveLocation("icc_profiles");
1497
1498 Q_FOREACH (const QString &profileName, profileNames) {
1499 if (!QFile::copy(profileName, saveLocation + QFileInfo(profileName).fileName())) {
1500 qWarning() << "Could not install profile!" << saveLocation + QFileInfo(profileName).fileName();
1501 continue;
1502 }
1503 iccEngine->addProfile(saveLocation + QFileInfo(profileName).fileName());
1504 }
1505
1506 KisConfig cfg(true);
1507 refillMonitorProfiles(KoID("RGBA"));
1508
1509 for(int i = 0; i < QApplication::screens().count(); ++i) {
1510 if (m_monitorProfileWidgets[i]->contains(cfg.monitorProfile(i))) {
1511 m_monitorProfileWidgets[i]->setCurrent(cfg.monitorProfile(i));
1512 }
1513 }
1514
1515}
QList< QString > QStringList
static KoColorSpaceEngineRegistry * instance()
T get(const QString &id) const
static QString saveLocation(const QString &type, const QString &suffix=QString(), bool create=true)
#define KIS_SAFE_ASSERT_RECOVER_RETURN(cond)
Definition kis_assert.h:128
virtual const KoColorProfile * addProfile(const QString &filename)=0

References KoColorSpaceEngine::addProfile(), KoGenericRegistry< T >::get(), KoColorSpaceEngineRegistry::instance(), KIS_SAFE_ASSERT_RECOVER_RETURN, m_colorManagedByOS, m_monitorProfileWidgets, KisConfig::monitorProfile(), KoFileDialog::OpenFiles, refillMonitorProfiles(), and KoResourcePaths::saveLocation().

◆ refillMonitorProfiles

void ColorSettingsTab::refillMonitorProfiles ( const KoID & s)
privateslot

Definition at line 1608 of file kis_dlg_preferences.cc.

1609{
1611
1612 for (int i = 0; i < QApplication::screens().count(); ++i) {
1613 m_monitorProfileWidgets[i]->clear();
1614 }
1615
1616 QMap<QString, const KoColorProfile *> profileList;
1617 Q_FOREACH(const KoColorProfile *profile, KoColorSpaceRegistry::instance()->profilesFor(colorSpaceId.id())) {
1618 profileList[profile->name()] = profile;
1619 }
1620
1621 Q_FOREACH (const KoColorProfile *profile, profileList.values()) {
1622 //qDebug() << "Profile" << profile->name() << profile->isSuitableForDisplay() << csf->defaultProfile();
1623 if (profile->isSuitableForDisplay()) {
1624 for (int i = 0; i < QApplication::screens().count(); ++i) {
1625 m_monitorProfileWidgets[i]->addSqueezedItem(profile->name());
1626 }
1627 }
1628 }
1629
1630 for (int i = 0; i < QApplication::screens().count(); ++i) {
1631 m_monitorProfileLabels[i]->setText(i18nc("The number of the screen (ordinal) and shortened 'name' of the screen (model + resolution)", "Screen %1 (%2):", i + 1, shortNameOfDisplay(i)));
1633 }
1634}
virtual bool isSuitableForDisplay() const =0

References KoColorSpaceRegistry::defaultProfileForColorSpace(), KoID::id(), KoColorSpaceRegistry::instance(), KoColorProfile::isSuitableForDisplay(), KIS_SAFE_ASSERT_RECOVER_RETURN, m_colorManagedByOS, m_monitorProfileLabels, m_monitorProfileWidgets, KoColorProfile::name, and shortNameOfDisplay().

◆ setDefault()

void ColorSettingsTab::setDefault ( )

Definition at line 1555 of file kis_dlg_preferences.cc.

1556{
1557 m_page->cmbWorkingColorSpace->setCurrent("RGBA");
1558
1560 const QString defaultProfile = KoColorSpaceRegistry::instance()->defaultProfileForColorSpace(colorSpaceId);
1561 m_page->cmbColorProfileForEXR->setCurrent(defaultProfile);
1562
1563 KisConfig cfg(true);
1564
1565 if (!m_colorManagedByOS) {
1566 refillMonitorProfiles(KoID("RGBA"));
1567 } else {
1568 m_chkEnableCanvasColorSpaceManagement->setChecked(cfg.enableCanvasSurfaceColorSpaceManagement(true));
1569
1570 {
1571 auto mode = cfg.canvasSurfaceColorSpaceManagementMode(true);
1572 int index = m_canvasSurfaceColorSpace->findData(QVariant::fromValue(mode));
1573 KIS_SAFE_ASSERT_RECOVER(index >= 0) {
1574 index = 0;
1575 }
1576 m_canvasSurfaceColorSpace->setCurrentIndex(index);
1577 }
1578
1579 {
1580 auto mode = cfg.canvasSurfaceBitDepthMode(true);
1581 int index = m_canvasSurfaceBitDepth->findData(QVariant::fromValue(mode));
1582 KIS_SAFE_ASSERT_RECOVER(index >= 0) {
1583 index = 0;
1584 }
1585 m_canvasSurfaceBitDepth->setCurrentIndex(index);
1586 }
1587 }
1588
1589 KisImageConfig cfgImage(true);
1590 KisProofingConfigurationSP proofingConfig = cfgImage.defaultProofingconfiguration(true);
1591 m_page->wdgProofingOptions->setProofingConfig(proofingConfig);
1592
1593 m_page->chkBlackpoint->setChecked(cfg.useBlackPointCompensation(true));
1594 m_page->chkAllowLCMSOptimization->setChecked(cfg.allowLCMSOptimization(true));
1595 m_page->chkForcePaletteColor->setChecked(cfg.forcePaletteColors(true));
1596 m_page->cmbMonitorIntent->setCurrentIndex(cfg.monitorRenderIntent(true));
1597 if (!m_colorManagedByOS) {
1598 m_page->chkUseSystemMonitorProfile->setChecked(cfg.useSystemMonitorProfile(true));
1599 }
1600 QAbstractButton *button = m_pasteBehaviourGroup.button(cfg.pasteBehaviour(true));
1601 Q_ASSERT(button);
1602 if (button) {
1603 button->setChecked(true);
1604 }
1605}

References KisConfig::allowLCMSOptimization(), button(), KisConfig::canvasSurfaceBitDepthMode(), KisConfig::canvasSurfaceColorSpaceManagementMode(), KoColorSpaceRegistry::colorSpaceId(), KoColorSpaceRegistry::defaultProfileForColorSpace(), KisImageConfig::defaultProofingconfiguration(), KisConfig::enableCanvasSurfaceColorSpaceManagement(), Float16BitsColorDepthID, KisConfig::forcePaletteColors(), KoID::id(), KoColorSpaceRegistry::instance(), KIS_SAFE_ASSERT_RECOVER, m_canvasSurfaceBitDepth, m_canvasSurfaceColorSpace, m_chkEnableCanvasColorSpaceManagement, m_colorManagedByOS, m_page, m_pasteBehaviourGroup, KisConfig::monitorRenderIntent(), KisConfig::pasteBehaviour(), refillMonitorProfiles(), RGBAColorModelID, KisConfig::useBlackPointCompensation(), and KisConfig::useSystemMonitorProfile().

◆ toggleAllowMonitorProfileSelection

void ColorSettingsTab::toggleAllowMonitorProfileSelection ( bool useSystemProfile)
privateslot

Definition at line 1517 of file kis_dlg_preferences.cc.

1518{
1520
1521 KisConfig cfg(true);
1522
1523 if (useSystemProfile) {
1525 if (devices.size() == QApplication::screens().count()) {
1526 for(int i = 0; i < QApplication::screens().count(); ++i) {
1527 m_monitorProfileWidgets[i]->clear();
1528 QString monitorForScreen = cfg.monitorForScreen(i, devices[i]);
1529 Q_FOREACH (const QString &device, devices) {
1530 m_monitorProfileLabels[i]->setText(i18nc("The number of the screen (ordinal) and shortened 'name' of the screen (model + resolution)", "Screen %1 (%2):", i + 1, shortNameOfDisplay(i)));
1531 m_monitorProfileWidgets[i]->addSqueezedItem(KisColorManager::instance()->deviceName(device), device);
1532 if (devices[i] == monitorForScreen) {
1533 m_monitorProfileWidgets[i]->setCurrentIndex(i);
1534 }
1535 }
1536 }
1537 }
1538 }
1539 else {
1540 refillMonitorProfiles(KoID("RGBA"));
1541
1542 for(int i = 0; i < QApplication::screens().count(); ++i) {
1543 if (m_monitorProfileWidgets[i]->contains(cfg.monitorProfile(i))) {
1544 m_monitorProfileWidgets[i]->setCurrent(cfg.monitorProfile(i));
1545 }
1546 }
1547 }
1548}
QStringList devices(DeviceType type=screen) const
Return a list of device id's for the specified type.
static KisColorManager * instance()

References KisColorManager::devices(), KisColorManager::instance(), KIS_SAFE_ASSERT_RECOVER_RETURN, m_colorManagedByOS, m_monitorProfileLabels, m_monitorProfileWidgets, KisConfig::monitorForScreen(), KisConfig::monitorProfile(), refillMonitorProfiles(), and shortNameOfDisplay().

◆ toggleUseDefaultColorSpace

void ColorSettingsTab::toggleUseDefaultColorSpace ( bool useDefColorSpace)
privateslot

Definition at line 1550 of file kis_dlg_preferences.cc.

1551{
1552 m_page->cmbWorkingColorSpace->setEnabled(useDefColorSpace);
1553}

References m_page.

◆ updatePreferredSpaceGraphic

void ColorSettingsTab::updatePreferredSpaceGraphic ( )
privateslot

Definition at line 1644 of file kis_dlg_preferences.cc.

1645{
1646 if (!m_preferredSpaceGraphic) return;
1647 if (!KisPlatformPluginInterfaceFactory::instance()->surfaceColorManagedByOS()) return;
1649 QVector<double> colorants;
1650 QVector <double> whitePoint;
1651
1652#ifdef Q_OS_LINUX
1653#if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0)
1654 KisRootSurfaceInfoProxy proxy(mainWindow);
1655 std::optional<KisSurfaceColorimetry::SurfaceDescription> currentDescription = proxy.currentSurfaceDescription();
1656 if (m_preferredSpaceGraphicMode.checkedId() == PreferredSpace) {
1657 if (currentDescription) {
1658 if (std::holds_alternative<KisSurfaceColorimetry::Colorimetry>(currentDescription->colorSpace.primaries)) {
1659 auto col = std::get<KisSurfaceColorimetry::Colorimetry>(currentDescription->colorSpace.primaries);
1660 colorants << col.red().toxy().x << col.red().toxy().y << col.red().toxyY().Y
1661 << col.green().toxy().x << col.green().toxy().y << col.green().toxyY().Y
1662 << col.blue().toxy().x << col.blue().toxy().y << col.blue().toxyY().Y;
1663 whitePoint << col.white().toxy().x << col.white().toxy().y << col.white().toxyY().Y;
1664 m_preferredSpaceGraphic->setRGBData(whitePoint, colorants);
1665 } else {
1666 bool enable = true;
1667 auto named = std::get<KisSurfaceColorimetry::NamedPrimaries>(currentDescription->colorSpace.primaries);
1679 } else {
1680 enable = false;
1681 }
1682
1683 if (enable) {
1684 colorants << col.red().toxy().x << col.red().toxy().y << col.red().toxyY().Y
1685 << col.green().toxy().x << col.green().toxy().y << col.green().toxyY().Y
1686 << col.blue().toxy().x << col.blue().toxy().y << col.blue().toxyY().Y;
1687 whitePoint << col.white().toxy().x << col.white().toxy().y << col.white().toxyY().Y;
1688 m_preferredSpaceGraphic->setRGBData(whitePoint, colorants);
1689 } else {
1690 m_preferredSpaceGraphic->setProfileDataAvailable(false);
1691 }
1692
1693 }
1694 } else {
1695 m_preferredSpaceGraphic->setProfileDataAvailable(false);
1696 }
1697 } else if(m_preferredSpaceGraphicMode.checkedId() == MasteringSpace) {
1698 if (currentDescription && currentDescription->masteringInfo) {
1699 auto col = currentDescription->masteringInfo->primaries;
1700 colorants << col.red().toxy().x << col.red().toxy().y << col.red().toxyY().Y
1701 << col.green().toxy().x << col.green().toxy().y << col.green().toxyY().Y
1702 << col.blue().toxy().x << col.blue().toxy().y << col.blue().toxyY().Y;
1703 whitePoint << col.white().toxy().x << col.white().toxy().y << col.white().toxyY().Y;
1704
1705 m_preferredSpaceGraphic->setRGBData(whitePoint, colorants);
1706 } else {
1707 m_preferredSpaceGraphic->setProfileDataAvailable(false);
1708 }
1709 }
1710#endif
1711#endif
1712 m_preferredSpaceGraphic->update();
1713}
static const Colorimetry AdobeRGB
static const Colorimetry DisplayP3

References KisColorimetryUtils::Colorimetry::AdobeRGB, KisColorimetryUtils::Colorimetry::blue(), KisColorimetryUtils::Colorimetry::BT2020, KisColorimetryUtils::Colorimetry::BT709, KisPart::currentMainwindow(), KisRootSurfaceInfoProxy::currentSurfaceDescription(), KisColorimetryUtils::Colorimetry::DCIP3, KisColorimetryUtils::Colorimetry::DisplayP3, KisColorimetryUtils::Colorimetry::green(), KisPart::instance(), KisPlatformPluginInterfaceFactory::instance(), m_preferredSpaceGraphic, m_preferredSpaceGraphicMode, MasteringSpace, PreferredSpace, KisSurfaceColorimetry::primaries_adobe_rgb, KisSurfaceColorimetry::primaries_bt2020, KisSurfaceColorimetry::primaries_dci_p3, KisSurfaceColorimetry::primaries_display_p3, KisSurfaceColorimetry::primaries_srgb, KisColorimetryUtils::Colorimetry::red(), KisColorimetryUtils::XYZ::toxy(), KisColorimetryUtils::XYZ::toxyY(), KisColorimetryUtils::Colorimetry::white(), KisColorimetryUtils::xy::x, KisColorimetryUtils::xy::y, and KisColorimetryUtils::xyY::Y.

◆ updateProofingDisplayInfo

void ColorSettingsTab::updateProofingDisplayInfo ( )
privateslot

Definition at line 1636 of file kis_dlg_preferences.cc.

1636 {
1638 options.first = KoColorConversionTransformation::Intent(m_page->cmbMonitorIntent->currentIndex());
1640 options.second.setFlag(KoColorConversionTransformation::BlackpointCompensation, m_page->chkBlackpoint->isChecked());
1641 m_page->wdgProofingOptions->setDisplayConfigOptions(options);
1642}
std::pair< KoColorConversionTransformation::Intent, KoColorConversionTransformation::ConversionFlags > Options

References KoColorConversionTransformation::BlackpointCompensation, KoColorConversionTransformation::internalConversionFlags(), and m_page.

Member Data Documentation

◆ m_canvasSurfaceBitDepth

QPointer<KisSqueezedComboBox> ColorSettingsTab::m_canvasSurfaceBitDepth

Definition at line 229 of file kis_dlg_preferences.h.

◆ m_canvasSurfaceColorSpace

QPointer<KisSqueezedComboBox> ColorSettingsTab::m_canvasSurfaceColorSpace

Definition at line 228 of file kis_dlg_preferences.h.

◆ m_chkEnableCanvasColorSpaceManagement

QPointer<QCheckBox> ColorSettingsTab::m_chkEnableCanvasColorSpaceManagement

Definition at line 227 of file kis_dlg_preferences.h.

◆ m_colorManagedByOS

bool ColorSettingsTab::m_colorManagedByOS {false}

Definition at line 226 of file kis_dlg_preferences.h.

226{false};

◆ m_monitorProfileLabels

QList<QLabel*> ColorSettingsTab::m_monitorProfileLabels

Definition at line 218 of file kis_dlg_preferences.h.

◆ m_monitorProfileWidgets

QList<KisSqueezedComboBox*> ColorSettingsTab::m_monitorProfileWidgets

Definition at line 219 of file kis_dlg_preferences.h.

◆ m_page

WdgColorSettings* ColorSettingsTab::m_page

Definition at line 216 of file kis_dlg_preferences.h.

◆ m_pasteBehaviourGroup

QButtonGroup ColorSettingsTab::m_pasteBehaviourGroup

Definition at line 217 of file kis_dlg_preferences.h.

◆ m_preferredSpaceGraphic

QPointer<KisCIETongueWidget> ColorSettingsTab::m_preferredSpaceGraphic

Definition at line 230 of file kis_dlg_preferences.h.

◆ m_preferredSpaceGraphicMode

QButtonGroup ColorSettingsTab::m_preferredSpaceGraphicMode

Definition at line 231 of file kis_dlg_preferences.h.

◆ m_proofModel

QScopedPointer<KisProofingConfigModel> ColorSettingsTab::m_proofModel

Definition at line 220 of file kis_dlg_preferences.h.

◆ m_screenMigrationTracker

QScopedPointer<KisScreenMigrationTracker> ColorSettingsTab::m_screenMigrationTracker

Definition at line 221 of file kis_dlg_preferences.h.


The documentation for this class was generated from the following files: