Krita Source Code Documentation
Loading...
Searching...
No Matches
kis_dlg_preferences.cc
Go to the documentation of this file.
1/*
2 * preferencesdlg.cc - part of KImageShop
3 *
4 * SPDX-FileCopyrightText: 1999 Michael Koch <koch@kde.org>
5 * SPDX-FileCopyrightText: 2003-2011 Boudewijn Rempt <boud@valdyas.org>
6 *
7 * SPDX-License-Identifier: GPL-2.0-or-later
8 */
9
10#include "kis_dlg_preferences.h"
11
12#include <config-hdr.h>
13#include <opengl/kis_opengl.h>
14
15#include <QBitmap>
16#include <QCheckBox>
17#include <QComboBox>
18#include <QClipboard>
19#include <QCursor>
20#include <QScreen>
21#include <QFileDialog>
22#include <QFormLayout>
23#include <QGridLayout>
24#include <QGroupBox>
25#include <QLabel>
26#include <QLayout>
27#include <QLineEdit>
28#include <QMdiArea>
29#include <QMessageBox>
30#include <QPushButton>
31#include <QRadioButton>
32#include <QSettings>
33#include <QSlider>
34#include <QStandardPaths>
35#include <QThread>
36#include <QStyleFactory>
37#include <QScreen>
38#include <QFontComboBox>
39#include <QFont>
40#include <QSurfaceFormat>
41#include <QColorSpace>
42
43#include <KisApplication.h>
44#include <KisDocument.h>
45#include <kis_icon.h>
46#include <KisPart.h>
49#include <KoColorProfile.h>
50#include <KoColorSpaceEngine.h>
51#include <KoConfigAuthorPage.h>
52#include <KoConfig.h>
53#include <KoPointerEvent.h>
54
55#include <KoFileDialog.h>
56#include "KoID.h"
57#include <KoVBox.h>
58
59#include <KTitleWidget>
60#include <KoResourcePaths.h>
61#include <kformat.h>
62#include <klocalizedstring.h>
63#include <kstandardguiitem.h>
64#include <kundo2stack.h>
65
66#include <KisResourceCacheDb.h>
67#include <KisResourceLocator.h>
68
72#include "kis_action_registry.h"
73#include <kis_image.h>
74#include <KisSqueezedComboBox.h>
75#include "kis_clipboard.h"
77#include "KoColorSpace.h"
80#include "kis_color_manager.h"
81#include "kis_config.h"
82#include "kis_image_config.h"
84#include "KisMainWindow.h"
85#include "KisMimeDatabase.h"
90
92
93// for the performance update
94#include <kis_cubic_curve.h>
95#include <kis_signals_blocker.h>
96
99
101#include <config-qt-patches-present.h>
102
103#ifdef Q_OS_WIN
104#if QT_VERSION < QT_VERSION_CHECK(6, 0, 0)
105// this include is Qt5-only, the switch to WinTab is embedded in Qt
106# include "config_qt5_has_wintab_switch.h"
107#else
108# include <QtGui/private/qguiapplication_p.h>
109# include <QtGui/qpa/qplatformintegration.h>
110#endif
111#include "config-high-dpi-scale-factor-rounding-policy.h"
113#endif
114
120Q_GUI_EXPORT int qt_defaultDpi();
121
122QString shortNameOfDisplay(int index)
123{
124 if (QGuiApplication::screens().length() <= index) {
125 return QString();
126 }
127 QScreen* screen = QGuiApplication::screens()[index];
128 QString resolution = QString::number(screen->geometry().width()).append("x").append(QString::number(screen->geometry().height()));
129 QString name = screen->name();
130 // name and resolution for a specific screen can change, so they are not used in the identifier; but they can help people understand which screen is which
131
132 KisConfig cfg(true);
133 QString shortName = resolution + " " + name + " " + cfg.getScreenStringIdentfier(index);
134 return shortName;
135}
136
137
138struct WritableLocationValidator : public QValidator {
140 : QValidator(parent)
141 {
142 }
143
144 State validate(QString &line, int &/*pos*/) const override
145 {
146 QFileInfo fi(line);
147 if (!fi.isWritable()) {
148 return Invalid;
149 }
150 return Acceptable;
151 }
152};
153
154struct BackupSuffixValidator : public QValidator {
155 BackupSuffixValidator(QObject *parent)
156 : QValidator(parent)
158 << "0" << "1" << "2" << "3" << "4" << "5" << "6" << "7" << "8" << "9"
159 << "/" << "\\" << ":" << ";" << " ")
160 {}
161
163
165
166 State validate(QString &line, int &/*pos*/) const override
167 {
168 Q_FOREACH(const QString invalidChar, invalidCharacters) {
169 if (line.contains(invalidChar)) {
170 return Invalid;
171 }
172 }
173 return Acceptable;
174 }
175};
176
177/*
178 * We need this because the final item in the ComboBox is a used as an action to launch file selection dialog.
179 * So disabling it makes sure that user doesn't accidentally scroll and select it and get confused why the
180 * file picker launched.
181 */
182class UnscrollableComboBox : public QObject
183{
184public:
185 UnscrollableComboBox(QObject *parent)
186 : QObject(parent)
187 {
188 }
189
190 bool eventFilter(QObject *, QEvent *event) override
191 {
192 if (event->type() == QEvent::Wheel) {
193 event->accept();
194 return true;
195 }
196 return false;
197 }
198};
199
200GeneralTab::GeneralTab(QWidget *_parent, const char *_name)
201 : WdgGeneralSettings(_parent, _name)
202{
203 KisConfig cfg(true);
204
205 // HACK ALERT!
206 // QScrollArea contents are opaque at multiple levels
207 // The contents themselves AND the viewport widget
208 {
209 scrollAreaWidgetContents->setAutoFillBackground(false);
210 scrollAreaWidgetContents->parentWidget()->setAutoFillBackground(false);
211 }
212
213 //
214 // Cursor Tab
215 //
216
217 QStringList cursorItems = QStringList()
218 << i18n("No Cursor")
219 << i18n("Tool Icon")
220 << i18n("Arrow")
221 << i18n("Small Circle")
222 << i18n("Crosshair")
223 << i18n("Triangle Righthanded")
224 << i18n("Triangle Lefthanded")
225 << i18n("Black Pixel")
226 << i18n("White Pixel");
227
228 QStringList outlineItems = QStringList()
229 << i18nc("Display options label to not DISPLAY brush outline", "No Outline")
230 << i18n("Circle Outline")
231 << i18n("Preview Outline")
232 << i18n("Tilt Outline");
233
234 // brush
235
236 m_cmbCursorShape->addItems(cursorItems);
237
238 m_cmbCursorShape->setCurrentIndex(cfg.newCursorStyle());
239
240 m_cmbOutlineShape->addItems(outlineItems);
241
242 m_cmbOutlineShape->setCurrentIndex(cfg.newOutlineStyle());
243
244 m_showOutlinePainting->setChecked(cfg.showOutlineWhilePainting());
245 m_changeBrushOutline->setChecked(!cfg.forceAlwaysFullSizedOutline());
246
247 KoColor cursorColor(KoColorSpaceRegistry::instance()->rgb8());
248 cursorColor.fromQColor(cfg.getCursorMainColor());
249 cursorColorButton->setColor(cursorColor);
250
251 // eraser
252
253 m_chkSeparateEraserCursor->setChecked(cfg.separateEraserCursor());
254
255 m_cmbEraserCursorShape->addItems(cursorItems);
256 m_cmbEraserCursorShape->addItem(i18n("Eraser"));
257
258 m_cmbEraserCursorShape->setCurrentIndex(cfg.eraserCursorStyle());
259
260 m_cmbEraserOutlineShape->addItems(outlineItems);
261
262 m_cmbEraserOutlineShape->setCurrentIndex(cfg.eraserOutlineStyle());
263
264 m_showEraserOutlinePainting->setChecked(cfg.showEraserOutlineWhilePainting());
265 m_changeEraserBrushOutline->setChecked(!cfg.forceAlwaysFullSizedEraserOutline());
266
267 KoColor eraserCursorColor(KoColorSpaceRegistry::instance()->rgb8());
268 eraserCursorColor.fromQColor(cfg.getEraserCursorMainColor());
269 eraserCursorColorButton->setColor(eraserCursorColor);
270
271 // Color sampler
272
273 setColorSamplerPreviewStyleItems(m_cmbColorSamplerPreviewStyle);
274 setColorSamplerPreviewStyleIndexByValue(m_cmbColorSamplerPreviewStyle, cfg.colorSamplerPreviewStyle());
275 connect(m_cmbColorSamplerPreviewStyle,
276 QOverload<int>::of(&QComboBox::currentIndexChanged),
277 this,
279 colorSamplePreviewStyleChanged(m_cmbColorSamplerPreviewStyle->currentIndex());
280
281 m_nmbColorSamplerPreviewSize->setRange(1, 400);
282 m_nmbColorSamplerPreviewSize->setValue(cfg.colorSamplerPreviewCircleDiameter());
283 m_lblColorSamplerPreviewSizePreview->setDiameter(cfg.colorSamplerPreviewCircleDiameter());
284 connect(m_nmbColorSamplerPreviewSize,SIGNAL(valueChanged(int)), SLOT(colorSamplePreviewSizeChanged(int)));
285
286 m_ssbColorSamplerPreviewThickness->setRange(1, 50);
287 m_ssbColorSamplerPreviewThickness->setValue(cfg.colorSamplerPreviewCircleThickness());
288 m_lblColorSamplerPreviewSizePreview->setThickness(cfg.colorSamplerPreviewCircleThickness()/100.0);
289 connect(m_ssbColorSamplerPreviewThickness,SIGNAL(valueChanged(qreal)), SLOT(colorSamplePreviewThicknessChanged(qreal)));
290
291 m_chkColorSamplerPreviewOutlineEnabled->setChecked(cfg.colorSamplerPreviewCircleOutlineEnabled());
292 m_lblColorSamplerPreviewSizePreview->setOutlineEnabled(cfg.colorSamplerPreviewCircleOutlineEnabled());
293 connect(m_chkColorSamplerPreviewOutlineEnabled,SIGNAL(stateChanged(int)), SLOT(colorSamplePreviewOutlineEnabledChanged(int)));
294
295 m_chkColorSamplerPreviewExtraCircles->setChecked(cfg.colorSamplerPreviewCircleExtraCirclesEnabled());
296
297
298 KisSpinBoxI18nHelper::setText(m_ssbColorSamplerPreviewThickness, i18nc("{n} is the number value, % is the percent sign", "{n}%"));
299
300
301
302
303
304
305
306
307 //
308 // Window Tab
309 //
310 chkUseCustomFont->setChecked(cfg.readEntry<bool>("use_custom_system_font", false));
311 cmbCustomFont->findChild <QComboBox*>("stylesComboBox")->setVisible(false);
312
313 QString fontName = cfg.readEntry<QString>("custom_system_font", "");
314 if (fontName.isEmpty()) {
315 cmbCustomFont->setCurrentFont(qApp->font());
316
317 }
318 else {
319 int pointSize = qApp->font().pointSize();
320 cmbCustomFont->setCurrentFont(QFont(fontName, pointSize));
321 }
322 int fontSize = cfg.readEntry<int>("custom_font_size", -1);
323 if (fontSize < 0) {
324 intFontSize->setValue(qApp->font().pointSize());
325 }
326 else {
327 intFontSize->setValue(fontSize);
328 }
329
330 m_cmbMDIType->setCurrentIndex(cfg.readEntry<int>("mdi_viewmode", (int)QMdiArea::TabbedView));
331 enableSubWindowOptions(m_cmbMDIType->currentIndex());
332 connect(m_cmbMDIType, SIGNAL(currentIndexChanged(int)), SLOT(enableSubWindowOptions(int)));
333
334 m_backgroundimage->setText(cfg.getMDIBackgroundImage());
335 connect(m_bnFileName, SIGNAL(clicked()), SLOT(getBackgroundImage()));
336 connect(clearBgImageButton, SIGNAL(clicked()), SLOT(clearBackgroundImage()));
337
338 QString xml = cfg.getMDIBackgroundColor();
339 KoColor mdiColor = KoColor::fromXML(xml);
340 m_mdiColor->setColor(mdiColor);
341
342 m_chkRubberBand->setChecked(cfg.readEntry<int>("mdi_rubberband", cfg.useOpenGL()));
343
344 m_chkCanvasMessages->setChecked(cfg.showCanvasMessages());
345
346 const QString configPath = QStandardPaths::writableLocation(QStandardPaths::GenericConfigLocation);
347 QSettings kritarc(configPath + QStringLiteral("/kritadisplayrc"), QSettings::IniFormat);
348 m_chkHiDPI->setChecked(kritarc.value("EnableHiDPI", true).toBool());
349#if defined(Q_OS_WIN) && defined(HAVE_HIGH_DPI_SCALE_FACTOR_ROUNDING_POLICY)
350 m_chkHiDPIFractionalScaling->setChecked(kritarc.value("EnableHiDPIFractionalScaling", false).toBool());
351#else
352 m_wdgHiDPIFractionalScaling->setEnabled(false);
353#endif
354 chkUsageLogging->setChecked(kritarc.value("LogUsage", true).toBool());
355
356
357 //
358 // Tools tab
359 //
360 m_radioToolOptionsInDocker->setChecked(cfg.toolOptionsInDocker());
361 cmbFlowMode->setCurrentIndex((int)!cfg.readEntry<bool>("useCreamyAlphaDarken", true));
362 cmbCmykBlendingMode->setCurrentIndex((int)!cfg.readEntry<bool>("useSubtractiveBlendingForCmykColorSpaces", true));
363 m_chkSwitchSelectionCtrlAlt->setChecked(cfg.switchSelectionCtrlAlt());
364 cmbTouchPainting->addItem(
365 KoPointerEvent::tabletInputReceived() ? i18nc("touch painting", "Auto (Disabled)")
366 : i18nc("touch painting", "Auto (Enabled)"));
367 cmbTouchPainting->addItem(i18nc("touch painting", "Enabled"));
368 cmbTouchPainting->addItem(i18nc("touch painting", "Disabled"));
369 cmbTouchPainting->setCurrentIndex(int(cfg.touchPainting()));
370 chkTouchPressureSensitivity->setChecked(cfg.readEntry("useTouchPressureSensitivity", true));
371 connect(cmbTouchPainting, SIGNAL(currentIndexChanged(int)),
373 updateTouchPressureSensitivityEnabled(cmbTouchPainting->currentIndex());
374
375 chkEnableTransformToolAfterPaste->setChecked(cfg.activateTransformToolAfterPaste());
376 chkZoomHorizontally->setChecked(cfg.zoomHorizontal());
377
378 chkEnableLongPress->setChecked(cfg.longPressEnabled());
379
380 m_groupBoxKineticScrollingSettings->setChecked(cfg.kineticScrollingEnabled());
381
382 m_cmbKineticScrollingGesture->addItem(i18n("On Touch Drag"));
383 m_cmbKineticScrollingGesture->addItem(i18n("On Click Drag"));
384 m_cmbKineticScrollingGesture->addItem(i18n("On Middle-Click Drag"));
385 //m_cmbKineticScrollingGesture->addItem(i18n("On Right Click Drag"));
386
387 spnZoomSteps->setValue(cfg.zoomSteps());
388
389
390 m_cmbKineticScrollingGesture->setCurrentIndex(cfg.kineticScrollingGesture());
391 m_kineticScrollingSensitivitySlider->setRange(0, 100);
392 m_kineticScrollingSensitivitySlider->setValue(cfg.kineticScrollingSensitivity());
393 m_chkKineticScrollingHideScrollbars->setChecked(cfg.kineticScrollingHiddenScrollbars());
394
395 intZoomMarginSize->setValue(cfg.zoomMarginSize());
396
397 chkEnableSelectionActionBar->setChecked(cfg.selectionActionBar());
398
399 //
400 // File handling
401 //
402 int autosaveInterval = cfg.autoSaveInterval();
403 //convert to minutes
404 m_autosaveSpinBox->setValue(autosaveInterval / 60);
405 m_autosaveCheckBox->setChecked(autosaveInterval > 0);
406 chkHideAutosaveFiles->setChecked(cfg.readEntry<bool>("autosavefileshidden", true));
407
408 m_chkCompressKra->setChecked(cfg.compressKra());
409 chkZip64->setChecked(cfg.useZip64());
410 m_chkTrimKra->setChecked(cfg.trimKra());
411 m_chkTrimFramesImport->setChecked(cfg.trimFramesImport());
412
413 m_backupFileCheckBox->setChecked(cfg.backupFile());
414 cmbBackupFileLocation->setCurrentIndex(cfg.readEntry<int>("backupfilelocation", 0));
415 txtBackupFileSuffix->setText(cfg.readEntry<QString>("backupfilesuffix", "~"));
416 QValidator *validator = new BackupSuffixValidator(txtBackupFileSuffix);
417 txtBackupFileSuffix->setValidator(validator);
418 intNumBackupFiles->setValue(cfg.readEntry<int>("numberofbackupfiles", 1));
419
420 cmbDefaultExportFileType->clear();
422
423 QMap<QString, QString> mimeTypeMap;
424
425 foreach (const QString &mimeType, mimeFilter) {
426 QString description = KisMimeDatabase::descriptionForMimeType(mimeType);
427 mimeTypeMap.insert(description, mimeType);
428 }
429
430 // Sort after we get the description because mimeType values have image, application, etc... in front
431 QStringList sortedDescriptions = mimeTypeMap.keys();
432 sortedDescriptions.sort(Qt::CaseInsensitive);
433
434 cmbDefaultExportFileType->addItem(i18n("All Supported Files"), "all/mime");
435 foreach (const QString &description, sortedDescriptions) {
436 const QString &mimeType = mimeTypeMap.value(description);
437 cmbDefaultExportFileType->addItem(description, mimeType);
438 }
439
440 const QString mimeTypeToFind = cfg.exportMimeType(false).toUtf8();
441 const int index = cmbDefaultExportFileType->findData(mimeTypeToFind);
442
443 if (index >= 0) {
444 cmbDefaultExportFileType->setCurrentIndex(index);
445 } else {
446 // Index can't be found, default set to image/png
447 const QString defaultMimeType = "image/png";
448 const int defaultIndex = cmbDefaultExportFileType->findData(defaultMimeType);
449 if (defaultIndex >= 0) {
450 cmbDefaultExportFileType->setCurrentIndex(defaultIndex);
451 } else {
452 // Case where the default mime type is also not found in the combo box
453 qDebug() << "Default mime type not found in the combo box.";
454 }
455 }
456
457 QString selectedMimeType = cmbDefaultExportFileType->currentData().toString();
458
459 //
460 // Animation tab
461 //
462 m_chkAutoPin->setChecked(cfg.autoPinLayersToTimeline());
463 m_chkAdaptivePlaybackRange->setChecked(cfg.adaptivePlaybackRange());
464 m_chkAutoZoom->setChecked(cfg.autoZoomTimelineToPlaybackRange());
465
466 //
467 // Miscellaneous tab
468 //
469 cmbStartupSession->addItem(i18n("Open default window"));
470 cmbStartupSession->addItem(i18n("Load previous session"));
471 cmbStartupSession->addItem(i18n("Show session manager"));
472 cmbStartupSession->setCurrentIndex(cfg.sessionOnStartup());
473
474 chkSaveSessionOnQuit->setChecked(cfg.saveSessionOnQuit(false));
475
476 m_chkConvertOnImport->setChecked(cfg.convertToImageColorspaceOnImport());
477
478 m_undoStackSize->setValue(cfg.undoStackLimit());
479 chkCumulativeUndo->setChecked(cfg.useCumulativeUndoRedo());
480 connect(chkCumulativeUndo, SIGNAL(toggled(bool)), btnAdvancedCumulativeUndo, SLOT(setEnabled(bool)));
481 btnAdvancedCumulativeUndo->setEnabled(chkCumulativeUndo->isChecked());
482 connect(btnAdvancedCumulativeUndo, SIGNAL(clicked()), SLOT(showAdvancedCumulativeUndoSettings()));
484
485 chkShowRootLayer->setChecked(cfg.showRootLayer());
486
487 chkRenameMergedLayers->setChecked(KisImageConfig(true).renameMergedLayers());
488 chkRenamePastedLayers->setChecked(cfg.renamePastedLayers());
489 chkRenameDuplicatedLayers->setChecked(KisImageConfig(true).renameDuplicatedLayers());
490
491 KConfigGroup group = KSharedConfig::openConfig()->group("File Dialogs");
492 bool dontUseNative = true;
493#ifdef Q_OS_ANDROID
494 dontUseNative = false;
495#endif
496#ifdef Q_OS_UNIX
497 if (qgetenv("XDG_CURRENT_DESKTOP") == "KDE") {
498 dontUseNative = false;
499 }
500#endif
501#ifdef Q_OS_MACOS
502 dontUseNative = false;
503#endif
504#ifdef Q_OS_WIN
505 dontUseNative = false;
506#endif
507 m_chkNativeFileDialog->setChecked(!group.readEntry("DontUseNativeFileDialog", dontUseNative));
508
509 if (!qEnvironmentVariable("APPIMAGE").isEmpty()) {
510 // AppImages don't have access to platform plugins. BUG: 447805
511 // Setting the checkbox to false is
512 m_chkNativeFileDialog->setChecked(false);
513 m_chkNativeFileDialog->setEnabled(false);
514 }
515
516 intMaxBrushSize->setValue(KisImageConfig(true).maxBrushSize());
517 chkIgnoreHighFunctionKeys->setChecked(cfg.ignoreHighFunctionKeys());
518#ifndef Q_OS_WIN
519 // we properly support ignoring high F-keys on Windows only. To support on other platforms
520 // we should synchronize KisExtendedModifiersMatcher to ignore the keys as well.
521 chkIgnoreHighFunctionKeys->setVisible(false);
522#endif
523
524 //
525 // Resources
526 //
527 m_urlResourceFolder->setMode(KoFileDialog::OpenDirectory);
528 m_urlResourceFolder->setConfigurationName("resource_directory");
529 const QString resourceLocation = KoResourcePaths::getAppDataLocation();
530 if (QFileInfo(resourceLocation).isWritable()) {
531 m_urlResourceFolder->setFileName(resourceLocation);
532 }
533 else {
534 m_urlResourceFolder->setFileName(QStandardPaths::writableLocation(QStandardPaths::AppDataLocation));
535 }
536 QValidator *writableValidator = new WritableLocationValidator(m_urlResourceFolder);
537 txtBackupFileSuffix->setValidator(writableValidator);
538 connect(m_urlResourceFolder, SIGNAL(textChanged(QString)), SLOT(checkResourcePath()));
540
541 grpRestartMessage->setPixmap(
542 grpRestartMessage->style()->standardIcon(QStyle::SP_MessageBoxWarning).pixmap(QSize(32, 32)));
543 grpRestartMessage->setText(i18n("You will need to Restart Krita for the changes to take an effect."));
544
545 grpAndroidWarningMessage->setVisible(false);
546 grpAndroidWarningMessage->setPixmap(
547 grpAndroidWarningMessage->style()->standardIcon(QStyle::SP_MessageBoxWarning).pixmap(QSize(32, 32)));
548 grpAndroidWarningMessage->setText(
549 i18n("Saving at a Location picked from the File Picker may slow down the startup!"));
550
551#ifdef Q_OS_ANDROID
552 m_urlResourceFolder->setVisible(false);
553
554 m_resourceFolderSelector->setVisible(true);
555 m_resourceFolderSelector->installEventFilter(new UnscrollableComboBox(this));
556
557 const QList<QPair<QString, QString>> writableLocations = []() {
558 QList<QPair<QString, QString>> writableLocationsAndText;
559 // filters out the duplicates
560 const QList<QString> locations = []() {
561 QStringList filteredLocations;
562 const QStringList locations = QStandardPaths::standardLocations(QStandardPaths::AppDataLocation);
563 Q_FOREACH(const QString &location, locations) {
564 if (!filteredLocations.contains(location)) {
565 filteredLocations.append(location);
566 }
567 }
568 return filteredLocations;
569 }();
570
571 bool isFirst = true;
572
573 Q_FOREACH (QString location, locations) {
574 QString text;
575 QFileInfo fileLocation(location);
576 // The first one that we get from is the "Default"
577 if (isFirst) {
578 text = i18n("Default");
579 isFirst = false;
580 } else if (location.startsWith("/data")) {
581 text = i18n("Internal Storage");
582 } else {
583 text = i18n("SD-Card");
584 }
585 if (fileLocation.isWritable()) {
586 writableLocationsAndText.append({text, location});
587 }
588 }
589 return writableLocationsAndText;
590 }();
591
592 for (auto it = writableLocations.constBegin(); it != writableLocations.constEnd(); ++it) {
593 m_resourceFolderSelector->addItem(it->first + " - " + it->second);
594 // we need it to extract out the path
595 m_resourceFolderSelector->setItemData(m_resourceFolderSelector->count() - 1, it->second, Qt::UserRole);
596 }
597
598 // if the user has selected a custom location, we add it to the list as well.
599 if (resourceLocation.startsWith("content://")) {
600 m_resourceFolderSelector->addItem(resourceLocation);
601 int index = m_resourceFolderSelector->count() - 1;
602 m_resourceFolderSelector->setItemData(index, resourceLocation, Qt::UserRole);
603 m_resourceFolderSelector->setCurrentIndex(index);
604 grpAndroidWarningMessage->setVisible(true);
605 } else {
606 // find the index of the current resource location in the writableLocation, so we can set our view to that
607 auto iterator = std::find_if(writableLocations.constBegin(),
608 writableLocations.constEnd(),
609 [&resourceLocation](QPair<QString, QString> location) {
610 return location.second == resourceLocation;
611 });
612
613 if (iterator != writableLocations.constEnd()) {
614 int index = writableLocations.indexOf(*iterator);
615 KIS_SAFE_ASSERT_RECOVER_NOOP(index < m_resourceFolderSelector->count());
616 m_resourceFolderSelector->setCurrentIndex(index);
617 }
618 }
619
620 // this should be the last item we add.
621 m_resourceFolderSelector->addItem(i18n("Choose Manually"));
622
623 connect(m_resourceFolderSelector, qOverload<int>(&QComboBox::activated), [this](int index) {
624 const int previousIndex = m_resourceFolderSelector->currentIndex();
625
626 // if it is the last item in the last item, then open file picker and set the name returned as the filename
627 if (m_resourceFolderSelector->count() - 1 == index) {
628 KoFileDialog dialog(this, KoFileDialog::OpenDirectory, "Select Directory");
629 const QString selectedDirectory = dialog.filename();
630
631 if (!selectedDirectory.isEmpty()) {
632 // if the index above "Choose Manually" is a content Uri, then we just modify it, and then set that as
633 // the index.
634 if (m_resourceFolderSelector->itemData(index - 1, Qt::DisplayRole)
635 .value<QString>()
636 .startsWith("content://")) {
637 m_resourceFolderSelector->setItemText(index - 1, selectedDirectory);
638 m_resourceFolderSelector->setItemData(index - 1, selectedDirectory, Qt::UserRole);
639 m_resourceFolderSelector->setCurrentIndex(index - 1);
640 } else {
641 // There isn't any content Uri in the ComboBox list, so just insert one, and set that as the index.
642 m_resourceFolderSelector->insertItem(index, selectedDirectory);
643 m_resourceFolderSelector->setItemData(index, selectedDirectory, Qt::UserRole);
644 m_resourceFolderSelector->setCurrentIndex(index);
645 }
646 // since we have selected the custom location, make the warning visible.
647 grpAndroidWarningMessage->setVisible(true);
648 } else {
649 m_resourceFolderSelector->setCurrentIndex(previousIndex);
650 }
651 }
652
653 // hide-unhide based on the selection of user.
654 grpAndroidWarningMessage->setVisible(
655 m_resourceFolderSelector->currentData(Qt::UserRole).value<QString>().startsWith("content://"));
656 });
657
658#else
659 m_resourceFolderSelector->setVisible(false);
660#endif
661
662 grpWindowsAppData->setVisible(false);
663#ifdef Q_OS_WIN
664 QString folderInStandardAppData;
665 QString folderInPrivateAppData;
666 KoResourcePaths::getAllUserResourceFoldersLocationsForWindowsStore(folderInStandardAppData, folderInPrivateAppData);
667
668 if (!folderInPrivateAppData.isEmpty()) {
669 const auto pathToDisplay = [](const QString &path) {
670 // Due to how Unicode word wrapping works, the string does not
671 // wrap after backslashes in Qt 5.12. We don't want the path to
672 // become too long, so we add a U+200B ZERO WIDTH SPACE to allow
673 // wrapping. The downside is that we cannot let the user select
674 // and copy the path because it now contains invisible unicode
675 // code points.
676 // See: https://bugreports.qt.io/browse/QTBUG-80892
677 return QDir::toNativeSeparators(path).replace(QChar('\\'), QStringLiteral(u"\\\u200B"));
678 };
679
680 const QDir privateResourceDir(folderInPrivateAppData);
681 const QDir appDataDir(folderInStandardAppData);
682 grpWindowsAppData->setPixmap(
683 grpWindowsAppData->style()->standardIcon(QStyle::SP_MessageBoxInformation).pixmap(QSize(32, 32)));
684 // Similar text is also used in KisViewManager.cpp
685 grpWindowsAppData->setText(i18nc("@info resource folder",
686 "<p>You are using the Microsoft Store package version of Krita. "
687 "Even though Krita can be configured to place resources under the "
688 "user AppData location, Windows may actually store the files "
689 "inside a private app location.</p>\n"
690 "<p>You should check both locations to determine where "
691 "the files are located.</p>\n"
692 "<p><b>User AppData</b> (<a href=\"copyuser\">Copy</a>):<br/>\n"
693 "%1</p>\n"
694 "<p><b>Private app location</b> (<a href=\"copyprivate\">Copy</a>):<br/>\n"
695 "%2</p>",
696 pathToDisplay(appDataDir.absolutePath()),
697 pathToDisplay(privateResourceDir.absolutePath())));
698 grpWindowsAppData->setVisible(true);
699
700 connect(grpWindowsAppData,
702 [userPath = appDataDir.absolutePath(),
703 privatePath = privateResourceDir.absolutePath()](const QString &link) {
704 if (link == QStringLiteral("copyuser")) {
705 qApp->clipboard()->setText(QDir::toNativeSeparators(userPath));
706 } else if (link == QStringLiteral("copyprivate")) {
707 qApp->clipboard()->setText(QDir::toNativeSeparators(privatePath));
708 } else {
709 qWarning() << "Unexpected link activated in lblWindowsAppDataNote:" << link;
710 }
711 });
712 }
713#endif
714
715
716 const int forcedFontDPI = cfg.readEntry("forcedDpiForQtFontBugWorkaround", -1);
717 chkForcedFontDPI->setChecked(forcedFontDPI > 0);
718 intForcedFontDPI->setValue(forcedFontDPI > 0 ? forcedFontDPI : qt_defaultDpi());
719 intForcedFontDPI->setEnabled(forcedFontDPI > 0);
720 connect(chkForcedFontDPI, SIGNAL(toggled(bool)), intForcedFontDPI, SLOT(setEnabled(bool)));
721
722 m_pasteFormatGroup.addButton(btnDownload, KisClipboard::PASTE_FORMAT_DOWNLOAD);
723 m_pasteFormatGroup.addButton(btnLocal, KisClipboard::PASTE_FORMAT_LOCAL);
724 m_pasteFormatGroup.addButton(btnBitmap, KisClipboard::PASTE_FORMAT_CLIP);
725 m_pasteFormatGroup.addButton(btnAsk, KisClipboard::PASTE_FORMAT_ASK);
726
727 QAbstractButton *button = m_pasteFormatGroup.button(cfg.pasteFormat(false));
728
729 Q_ASSERT(button);
730
731 if (button) {
732 button->setChecked(true);
733 }
734}
735
737{
738 KisConfig cfg(true);
739
740 m_cmbCursorShape->setCurrentIndex(cfg.newCursorStyle(true));
741 m_cmbOutlineShape->setCurrentIndex(cfg.newOutlineStyle(true));
742 m_chkSeparateEraserCursor->setChecked(cfg.readEntry<bool>("separateEraserCursor", false));
743 m_cmbEraserCursorShape->setCurrentIndex(cfg.eraserCursorStyle(true));
744 m_cmbEraserOutlineShape->setCurrentIndex(cfg.eraserOutlineStyle(true));
745 setColorSamplerPreviewStyleIndexByValue(m_cmbColorSamplerPreviewStyle, cfg.colorSamplerPreviewStyle(true));
746 m_ssbColorSamplerPreviewThickness->setValue(cfg.colorSamplerPreviewCircleThickness(true));
747 m_nmbColorSamplerPreviewSize->setValue(cfg.colorSamplerPreviewCircleDiameter(true));
748 m_chkColorSamplerPreviewOutlineEnabled->setChecked(cfg.colorSamplerPreviewCircleOutlineEnabled(true));
749
750
751 chkShowRootLayer->setChecked(cfg.showRootLayer(true));
752 m_autosaveCheckBox->setChecked(cfg.autoSaveInterval(true) > 0);
753 //convert to minutes
754 m_autosaveSpinBox->setValue(cfg.autoSaveInterval(true) / 60);
755 chkHideAutosaveFiles->setChecked(true);
756
757 m_undoStackSize->setValue(cfg.undoStackLimit(true));
758 chkCumulativeUndo->setChecked(cfg.useCumulativeUndoRedo(true));
760
761 m_backupFileCheckBox->setChecked(cfg.backupFile(true));
762 cmbBackupFileLocation->setCurrentIndex(0);
763 txtBackupFileSuffix->setText("~");
764 intNumBackupFiles->setValue(1);
765
766 m_showOutlinePainting->setChecked(cfg.showOutlineWhilePainting(true));
767 m_changeBrushOutline->setChecked(!cfg.forceAlwaysFullSizedOutline(true));
768 m_showEraserOutlinePainting->setChecked(cfg.showEraserOutlineWhilePainting(true));
769 m_changeEraserBrushOutline->setChecked(!cfg.forceAlwaysFullSizedEraserOutline(true));
770
771#if defined Q_OS_ANDROID || defined Q_OS_MACOS || defined Q_OS_WIN
772 m_chkNativeFileDialog->setChecked(true);
773#else
774 m_chkNativeFileDialog->setChecked(false);
775#endif
776
777 intMaxBrushSize->setValue(1000);
778
779 chkIgnoreHighFunctionKeys->setChecked(cfg.ignoreHighFunctionKeys(true));
780
781
782 chkUseCustomFont->setChecked(false);
783 cmbCustomFont->setCurrentFont(qApp->font());
784 intFontSize->setValue(qApp->font().pointSize());
785
786
787 m_cmbMDIType->setCurrentIndex((int)QMdiArea::TabbedView);
788 m_chkRubberBand->setChecked(cfg.useOpenGL(true));
789 KoColor mdiColor;
790 mdiColor.fromXML(cfg.getMDIBackgroundColor(true));
791 m_mdiColor->setColor(mdiColor);
792 m_backgroundimage->setText(cfg.getMDIBackgroundImage(true));
793 m_chkCanvasMessages->setChecked(cfg.showCanvasMessages(true));
794 m_chkCompressKra->setChecked(cfg.compressKra(true));
795 m_chkTrimKra->setChecked(cfg.trimKra(true));
796 m_chkTrimFramesImport->setChecked(cfg.trimFramesImport(true));
797 chkZip64->setChecked(cfg.useZip64(true));
798 m_chkHiDPI->setChecked(true);
799#if defined(Q_OS_WIN) && defined(HAVE_HIGH_DPI_SCALE_FACTOR_ROUNDING_POLICY)
800 m_chkHiDPIFractionalScaling->setChecked(true);
801#endif
802 chkUsageLogging->setChecked(true);
803 m_radioToolOptionsInDocker->setChecked(cfg.toolOptionsInDocker(true));
804 cmbFlowMode->setCurrentIndex(0);
805 chkEnableLongPress->setChecked(cfg.longPressEnabled(true));
806 m_groupBoxKineticScrollingSettings->setChecked(cfg.kineticScrollingEnabled(true));
807 m_cmbKineticScrollingGesture->setCurrentIndex(cfg.kineticScrollingGesture(true));
808 spnZoomSteps->setValue(cfg.zoomSteps(true));
809 m_kineticScrollingSensitivitySlider->setValue(cfg.kineticScrollingSensitivity(true));
810 m_chkKineticScrollingHideScrollbars->setChecked(cfg.kineticScrollingHiddenScrollbars(true));
811 intZoomMarginSize->setValue(cfg.zoomMarginSize(true));
812 m_chkSwitchSelectionCtrlAlt->setChecked(cfg.switchSelectionCtrlAlt(true));
813 cmbTouchPainting->setCurrentIndex(int(cfg.touchPainting(true)));
814 chkTouchPressureSensitivity->setChecked(true);
815 chkEnableTransformToolAfterPaste->setChecked(cfg.activateTransformToolAfterPaste(true));
816 chkZoomHorizontally->setChecked(cfg.zoomHorizontal(true));
817 m_chkConvertOnImport->setChecked(cfg.convertToImageColorspaceOnImport(true));
818
819 KoColor cursorColor(KoColorSpaceRegistry::instance()->rgb8());
820 cursorColor.fromQColor(cfg.getCursorMainColor(true));
821 cursorColorButton->setColor(cursorColor);
822
823 KoColor eraserCursorColor(KoColorSpaceRegistry::instance()->rgb8());
824 eraserCursorColor.fromQColor(cfg.getEraserCursorMainColor(true));
825 eraserCursorColorButton->setColor(eraserCursorColor);
826
827
828 m_chkAutoPin->setChecked(cfg.autoPinLayersToTimeline(true));
829 m_chkAdaptivePlaybackRange->setChecked(cfg.adaptivePlaybackRange(false));
830
831 m_urlResourceFolder->setFileName(KoResourcePaths::getAppDataLocation());
832
833 chkForcedFontDPI->setChecked(false);
834 intForcedFontDPI->setValue(qt_defaultDpi());
835 intForcedFontDPI->setEnabled(false);
836
837 chkRenameMergedLayers->setChecked(KisImageConfig(true).renameMergedLayers(true));
838 chkRenamePastedLayers->setChecked(cfg.renamePastedLayers(true));
839 chkRenameDuplicatedLayers->setChecked(KisImageConfig(true).renameDuplicatedLayers(true));
840
841 QAbstractButton *button = m_pasteFormatGroup.button(cfg.pasteFormat(true));
842 Q_ASSERT(button);
843
844 if (button) {
845 button->setChecked(true);
846 }
847}
848
850{
851 KisDlgConfigureCumulativeUndo dlg(m_cumulativeUndoData, m_undoStackSize->value(), this);
852 if (dlg.exec() == KoDialog::Accepted) {
854 }
855}
856
858{
859 bool circleSettingsVisible = index == int(KisConfig::ColorSamplerPreviewStyle::Circle);
860 m_frmColorSamplerCircleSettings->setVisible(circleSettingsVisible);
861}
862
864{
865 m_lblColorSamplerPreviewSizePreview->setDiameter(value);
866}
867
869{
870 m_lblColorSamplerPreviewSizePreview->setThickness(value/100.0);
871}
872
874{
875 m_lblColorSamplerPreviewSizePreview->setOutlineEnabled(value);
876}
877
879{
880 return (CursorStyle)m_cmbCursorShape->currentIndex();
881}
882
884{
885 return (OutlineStyle)m_cmbOutlineShape->currentIndex();
886}
887
889{
890 return (CursorStyle)m_cmbEraserCursorShape->currentIndex();
891}
892
894{
895 return (OutlineStyle)m_cmbEraserOutlineShape->currentIndex();
896}
897
902
904{
905 return m_nmbColorSamplerPreviewSize->value();
906}
907
909{
910 return m_ssbColorSamplerPreviewThickness->value();
911}
912
914{
915 return m_chkColorSamplerPreviewOutlineEnabled->isChecked();
916}
917
919{
920 return m_chkColorSamplerPreviewExtraCircles->isChecked();
921}
922
923
925{
926 return (KisConfig::SessionOnStartup)cmbStartupSession->currentIndex();
927}
928
930{
931 return chkSaveSessionOnQuit->isChecked();
932}
933
935{
936 return chkShowRootLayer->isChecked();
937}
938
940{
941 //convert to seconds
942 return m_autosaveCheckBox->isChecked() ? m_autosaveSpinBox->value() * 60 : 0;
943}
944
946{
947 return m_undoStackSize->value();
948}
949
951{
952 return m_showOutlinePainting->isChecked();
953}
954
956{
957 return m_showEraserOutlinePainting->isChecked();
958}
959
961{
962 return m_cmbMDIType->currentIndex();
963}
964
966{
967 return m_chkCanvasMessages->isChecked();
968}
969
971{
972 return m_chkCompressKra->isChecked();
973}
974
976{
977 return m_chkTrimKra->isChecked();
978}
979
981{
982 return m_chkTrimFramesImport->isChecked();
983}
984
986{
987 return cmbDefaultExportFileType->currentData().toString();
988}
989
991{
992 return chkZip64->isChecked();
993}
994
996{
997 return m_radioToolOptionsInDocker->isChecked();
998}
999
1001{
1002 return spnZoomSteps->value();
1003}
1004
1006{
1007 return chkEnableLongPress->isChecked();
1008}
1009
1011{
1012 return m_groupBoxKineticScrollingSettings->isChecked();
1013}
1014
1016{
1017 return m_cmbKineticScrollingGesture->currentIndex();
1018}
1019
1021{
1022 return m_kineticScrollingSensitivitySlider->value();
1023}
1024
1026{
1027 return m_chkKineticScrollingHideScrollbars->isChecked();
1028}
1029
1031{
1032 return intZoomMarginSize->value();
1033}
1034
1036{
1037 return m_chkSwitchSelectionCtrlAlt->isChecked();
1038}
1039
1041{
1042 return m_chkConvertOnImport->isChecked();
1043}
1044
1046{
1047 return m_chkAutoPin->isChecked();
1048}
1049
1051{
1052 return m_chkAdaptivePlaybackRange->isChecked();
1053}
1054
1056{
1057 return m_chkAutoZoom->isChecked();
1058}
1059
1061{
1062 return chkForcedFontDPI->isChecked() ? intForcedFontDPI->value() : -1;
1063}
1064
1066{
1067 // Order is synchronized with KisConfig::ColorSamplerPreviewStyle.
1068 cmb->addItems({
1069 i18nc("Preview option for no color sampler", "None"),
1070 i18nc("Preview option for a circular/ring-shaped color sampler", "Circle"),
1071 i18nc("Preview option for a rectangular color sampler left of the cursor", "Rectangle Left"),
1072 i18nc("Preview option for a rectangular color sampler right of the cursor", "Rectangle Right"),
1073 i18nc("Preview option for a rectangular color sampler above the cursor", "Rectangle Above"),
1074 });
1075}
1076
1078{
1079 cmb->setCurrentIndex(int(style));
1080}
1081
1086
1088{
1089 return chkRenameMergedLayers->isChecked();
1090}
1091
1093{
1094 return chkRenamePastedLayers->isChecked();
1095}
1096
1098{
1099 return chkRenameDuplicatedLayers->isChecked();
1100}
1101
1103{
1104 KoFileDialog dialog(this, KoFileDialog::OpenFile, "BackgroundImages");
1105 dialog.setCaption(i18n("Select a Background Image"));
1106 dialog.setDefaultDir(QStandardPaths::writableLocation(QStandardPaths::PicturesLocation));
1107 dialog.setImageFilters();
1108
1109 QString fn = dialog.filename();
1110 // dialog box was canceled or somehow no file was selected
1111 if (fn.isEmpty()) {
1112 return;
1113 }
1114
1115 QImage image(fn);
1116 if (image.isNull()) {
1117 QMessageBox::warning(this, i18nc("@title:window", "Krita"), i18n("%1 is not a valid image file!", fn));
1118 }
1119 else {
1120 m_backgroundimage->setText(fn);
1121 }
1122}
1123
1125{
1126 // clearing the background image text will implicitly make the background color be used
1127 m_backgroundimage->setText("");
1128}
1129
1131{
1132 const QFileInfo fi(m_urlResourceFolder->fileName());
1133 if (!fi.isWritable()) {
1134 grpNonWritableLocation->setPixmap(
1135 grpNonWritableLocation->style()->standardIcon(QStyle::SP_MessageBoxWarning).pixmap(QSize(32, 32)));
1136 grpNonWritableLocation->setText(
1137 i18nc("@info resource folder", "<b>Warning:</b> this location is not writable."));
1138 grpNonWritableLocation->setVisible(true);
1139 } else {
1140 grpNonWritableLocation->setVisible(false);
1141 }
1142}
1143
1145{
1146 group_subWinMode->setEnabled(mdi_mode == QMdiArea::SubWindowView);
1147}
1148
1150{
1151 chkTouchPressureSensitivity->setEnabled(touchPainting != int(KisConfig::TOUCH_PAINTING_DISABLED));
1152}
1153
1154
1155#include "kactioncollection.h"
1156#include "KisActionsSnapshot.h"
1157
1158ShortcutSettingsTab::ShortcutSettingsTab(QWidget *parent, const char *name)
1159 : QWidget(parent)
1160{
1161 setObjectName(name);
1162
1163 QGridLayout * l = new QGridLayout(this);
1164 l->setContentsMargins(0, 0, 0, 0);
1165 m_page = new WdgShortcutSettings(this);
1166 l->addWidget(m_page, 0, 0);
1167
1168
1169 m_snapshot.reset(new KisActionsSnapshot);
1170
1171 KisKActionCollection *collection =
1173
1174 Q_FOREACH (QAction *action, collection->actions()) {
1175 m_snapshot->addAction(action->objectName(), action);
1176 }
1177
1178 QMap<QString, KisKActionCollection*> sortedCollections =
1179 m_snapshot->actionCollections();
1180
1181 for (auto it = sortedCollections.constBegin(); it != sortedCollections.constEnd(); ++it) {
1182 m_page->addCollection(it.value(), it.key());
1183 }
1184}
1185
1189
1194
1200
1205
1206ColorSettingsTab::ColorSettingsTab(QWidget *parent, const char *name)
1207 : QWidget(parent)
1208 , m_proofModel(new KisProofingConfigModel())
1209{
1210 setObjectName(name);
1211
1212 // XXX: Make sure only profiles that fit the specified color model
1213 // are shown in the profile combos
1214
1215 QGridLayout * l = new QGridLayout(this);
1216 l->setContentsMargins(0, 0, 0, 0);
1217 m_page = new WdgColorSettings(this);
1218 l->addWidget(m_page, 0, 0);
1219
1220 KisConfig cfg(true);
1221
1223
1224 if (!m_colorManagedByOS) {
1225 m_page->chkUseSystemMonitorProfile->setChecked(cfg.useSystemMonitorProfile());
1226 connect(m_page->chkUseSystemMonitorProfile, SIGNAL(toggled(bool)), this, SLOT(toggleAllowMonitorProfileSelection(bool)));
1227 }
1228 m_page->chkUseSystemMonitorProfile->setVisible(!m_colorManagedByOS);
1229
1230 m_page->useDefColorSpace->setChecked(cfg.useDefaultColorSpace());
1231 connect(m_page->useDefColorSpace, SIGNAL(toggled(bool)), this, SLOT(toggleUseDefaultColorSpace(bool)));
1233 for (QList<KoID>::iterator id = colorSpaces.begin(); id != colorSpaces.end(); /* nop */) {
1235 id = colorSpaces.erase(id);
1236 } else {
1237 ++id;
1238 }
1239 }
1240 m_page->cmbWorkingColorSpace->setIDList(colorSpaces);
1241 m_page->cmbWorkingColorSpace->setCurrent(cfg.workingColorSpace());
1242 m_page->cmbWorkingColorSpace->setEnabled(cfg.useDefaultColorSpace());
1243
1244 if (!m_colorManagedByOS) {
1245 m_page->bnAddColorProfile->setIcon(koIcon("document-import-16"));
1246 connect(m_page->bnAddColorProfile, SIGNAL(clicked()), SLOT(installProfile()));
1247 }
1248 m_page->bnAddColorProfile->setVisible(!m_colorManagedByOS);
1249
1250 {
1251 QStringList profiles;
1252 QMap<QString, const KoColorProfile *> profileList;
1253 Q_FOREACH(const KoColorProfile *profile, KoColorSpaceRegistry::instance()->profilesFor(RGBAColorModelID.id())) {
1254 profileList[profile->name()] = profile;
1255 profiles.append(profile->name());
1256 }
1257
1258 std::sort(profiles.begin(), profiles.end());
1259 Q_FOREACH (const QString profile, profiles) {
1260 m_page->cmbColorProfileForEXR->addSqueezedItem(profile);
1261 }
1262
1264 const QString defaultProfile = KoColorSpaceRegistry::instance()->defaultProfileForColorSpace(colorSpaceId);
1265 const QString userProfile = cfg.readEntry("ExrDefaultColorProfile", defaultProfile);
1266
1267 m_page->cmbColorProfileForEXR->setCurrent(profiles.contains(userProfile) ? userProfile : defaultProfile);
1268 }
1269
1270
1271 if (!m_colorManagedByOS) {
1272 QFormLayout *monitorProfileGrid = new QFormLayout(m_page->monitorprofileholder);
1273 monitorProfileGrid->setContentsMargins(0, 0, 0, 0);
1274 for(int i = 0; i < QGuiApplication::screens().count(); ++i) {
1275 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)));
1276 lbl->setWordWrap(true);
1279 cmb->setSizePolicy(QSizePolicy::MinimumExpanding, QSizePolicy::Fixed);
1280 monitorProfileGrid->addRow(lbl, cmb);
1282 }
1283
1284 // disable if not Linux as KisColorManager is not yet implemented outside Linux
1285#ifndef Q_OS_LINUX
1286 m_page->chkUseSystemMonitorProfile->setChecked(false);
1287 m_page->chkUseSystemMonitorProfile->setDisabled(true);
1288 m_page->chkUseSystemMonitorProfile->setHidden(true);
1289#endif
1290
1291 refillMonitorProfiles(KoID("RGBA"));
1292
1293 for(int i = 0; i < QApplication::screens().count(); ++i) {
1294 if (m_monitorProfileWidgets[i]->contains(cfg.monitorProfile(i))) {
1295 m_monitorProfileWidgets[i]->setCurrent(cfg.monitorProfile(i));
1296 }
1297 }
1298 } else {
1299 QVBoxLayout *vboxLayout = new QVBoxLayout(m_page->monitorprofileholder);
1300 vboxLayout->setContentsMargins(0, 0, 0, 0);
1301 vboxLayout->addItem(new QSpacerItem(20,20));
1302
1303 QGroupBox *groupBox = new QGroupBox(i18n("Display's color space is managed by the operating system"));
1304 vboxLayout->addWidget(groupBox);
1305
1306 QFormLayout *monitorProfileGrid = new QFormLayout(groupBox);
1307 monitorProfileGrid->setContentsMargins(0, 0, 0, 0);
1308
1310 new QCheckBox(i18n("Enable canvas color management"), this);
1311
1313 i18n("<p>Enabling canvas color management automatically creates "
1314 "a separate native surface for the canvas. It might cause "
1315 "performance issues on some systems.</p>"
1316 ""
1317 "<p>If color management is disabled, Krita will render "
1318 "the canvas into the surface of the main window, which "
1319 "is considered sRGB. It will cause two limitations:"
1320 ""
1321 "<ol>"
1322 " <li>the color gamut will be limited to sRGB</li>"
1323 " <li>color proofing mode will be limited to \"use global display settings\", "
1324 " i.e. paper white proofing will become impossible</li>"
1325 "</ol>"
1326 "</p>"));
1327
1328 monitorProfileGrid->addRow(m_chkEnableCanvasColorSpaceManagement);
1329
1330 // surface color space
1332 m_canvasSurfaceColorSpace->setSizePolicy(QSizePolicy::MinimumExpanding, QSizePolicy::Fixed);
1333 QLabel *canvasSurfaceColorSpaceLbl = new QLabel(i18n("Canvas surface color space:"), this);
1334 monitorProfileGrid->addRow(canvasSurfaceColorSpaceLbl, m_canvasSurfaceColorSpace);
1335
1336 m_canvasSurfaceColorSpace->addSqueezedItem(i18n("Preferred by operating system"), QVariant::fromValue(CanvasSurfaceMode::Preferred));
1337 m_canvasSurfaceColorSpace->addSqueezedItem(i18n("Rec 709 Gamma 2.2"), QVariant::fromValue(CanvasSurfaceMode::Rec709g22));
1338 m_canvasSurfaceColorSpace->addSqueezedItem(i18n("Rec 709 Linear"), QVariant::fromValue(CanvasSurfaceMode::Rec709g10));
1339 m_canvasSurfaceColorSpace->addSqueezedItem(i18n("Rec 2020 PQ"), QVariant::fromValue(CanvasSurfaceMode::Rec2020pq));
1340 m_canvasSurfaceColorSpace->addSqueezedItem(i18n("Unmanaged (testing only)"), QVariant::fromValue(CanvasSurfaceMode::Unmanaged));
1341
1342 m_canvasSurfaceColorSpace->setToolTip(
1343 i18n("<p>Color space of the pixels that are transferred to the "
1344 "window compositor. Use \"preferred\" space unless you know "
1345 "what you are doing</p>"));
1346
1347 // surface bit depth
1349 m_canvasSurfaceBitDepth->setSizePolicy(QSizePolicy::MinimumExpanding, QSizePolicy::Fixed);
1350 QLabel *canvasSurfaceBitDepthLbl = new QLabel(i18n("Canvas surface bit depth (needs restart):"), this);
1351 monitorProfileGrid->addRow(canvasSurfaceBitDepthLbl, m_canvasSurfaceBitDepth);
1352
1353 m_canvasSurfaceBitDepth->addSqueezedItem(i18n("Auto"), QVariant::fromValue(CanvasSurfaceBitDepthMode::DepthAuto));
1354 m_canvasSurfaceBitDepth->addSqueezedItem(i18n("8-bit"), QVariant::fromValue(CanvasSurfaceBitDepthMode::Depth8Bit));
1355 m_canvasSurfaceBitDepth->addSqueezedItem(i18n("10-bit"), QVariant::fromValue(CanvasSurfaceBitDepthMode::Depth10Bit));
1356
1357 m_canvasSurfaceBitDepth->setToolTip(
1358 i18n("<p>The bit depth of the color that is passed to the window "
1359 "compositor. You should switch into 10-bit mode if you want to use "
1360 "HDR capabilities of your display</p>"));
1361
1362 const QString currentBitBepthString = QSurfaceFormat::defaultFormat().redBufferSize() == 10 ? i18n("10-bit") : i18n("8-bit");
1363 QLabel *currentCanvasSurfaceBitDepthLbl = new QLabel(i18n("Current canvas surface bit depth:"), this);
1364 QLabel *currentCanvasSurfaceBitDepth = new QLabel(currentBitBepthString, this);
1365 monitorProfileGrid->addRow(currentCanvasSurfaceBitDepthLbl, currentCanvasSurfaceBitDepth);
1366
1367 vboxLayout->addItem(new QSpacerItem(20,20));
1368
1370 QLabel *preferredLbl = new QLabel(i18n("Color space preferred by the operating system:\n%1", KisPlatformPluginInterfaceFactory::instance()->osPreferredColorSpaceReport(mainWindow)), this);
1371 vboxLayout->addWidget(preferredLbl);
1372
1374
1375 {
1376 auto mode = cfg.canvasSurfaceColorSpaceManagementMode();
1377 int index = m_canvasSurfaceColorSpace->findData(QVariant::fromValue(mode));
1378 KIS_SAFE_ASSERT_RECOVER(index >= 0) {
1379 index = 0;
1380 }
1381 m_canvasSurfaceColorSpace->setCurrentIndex(index);
1382 }
1383
1384 {
1385 auto mode = cfg.canvasSurfaceBitDepthMode();
1386 int index = m_canvasSurfaceBitDepth->findData(QVariant::fromValue(mode));
1387 KIS_SAFE_ASSERT_RECOVER(index >= 0) {
1388 index = 0;
1389 }
1390 m_canvasSurfaceBitDepth->setCurrentIndex(index);
1391 }
1392
1393 connect(m_chkEnableCanvasColorSpaceManagement, &QCheckBox::toggled, m_canvasSurfaceColorSpace, &QWidget::setEnabled);
1395
1396 connect(m_chkEnableCanvasColorSpaceManagement, &QCheckBox::toggled, canvasSurfaceColorSpaceLbl, &QWidget::setEnabled);
1397 canvasSurfaceColorSpaceLbl->setEnabled(m_chkEnableCanvasColorSpaceManagement->isChecked());
1398
1399 connect(m_chkEnableCanvasColorSpaceManagement, &QCheckBox::toggled, m_canvasSurfaceBitDepth, &QWidget::setEnabled);
1401
1402 connect(m_chkEnableCanvasColorSpaceManagement, &QCheckBox::toggled, canvasSurfaceBitDepthLbl, &QWidget::setEnabled);
1403 canvasSurfaceBitDepthLbl->setEnabled(m_chkEnableCanvasColorSpaceManagement->isChecked());
1404 }
1405
1406 m_page->chkBlackpoint->setChecked(cfg.useBlackPointCompensation());
1407 m_page->chkAllowLCMSOptimization->setChecked(cfg.allowLCMSOptimization());
1408 m_page->chkForcePaletteColor->setChecked(cfg.forcePaletteColors());
1409 m_page->cmbMonitorIntent->setCurrentIndex(cfg.monitorRenderIntent());
1410 KisImageConfig cfgImage(true);
1411
1415 KisProofingConfigurationSP proofingConfig = cfgImage.defaultProofingconfiguration();
1416
1417 m_page->wdgProofingOptions->setProofingConfig(proofingConfig);
1418
1419 m_proofModel->data.set(*proofingConfig.data());
1420
1421 connect(m_page->chkBlackpoint, SIGNAL(toggled(bool)), this, SLOT(updateProofingDisplayInfo()));
1422 connect(m_page->cmbMonitorIntent, SIGNAL(currentIndexChanged(int)), this, SLOT(updateProofingDisplayInfo()));
1424
1427 m_pasteBehaviourGroup.addButton(m_page->radioPasteAsk, KisClipboard::PASTE_ASK);
1428
1429 QAbstractButton *button = m_pasteBehaviourGroup.button(cfg.pasteBehaviour());
1430 Q_ASSERT(button);
1431
1432 if (button) {
1433 button->setChecked(true);
1434 }
1435
1436 if (!m_colorManagedByOS) {
1438 }
1439}
1440
1442{
1444
1445 KoFileDialog dialog(this, KoFileDialog::OpenFiles, "OpenDocumentICC");
1446 dialog.setCaption(i18n("Install Color Profiles"));
1447 dialog.setDefaultDir(QStandardPaths::writableLocation(QStandardPaths::HomeLocation));
1448 dialog.setMimeTypeFilters(QStringList() << "application/vnd.iccprofile", "application/vnd.iccprofile");
1449 QStringList profileNames = dialog.filenames();
1450
1452 Q_ASSERT(iccEngine);
1453
1454 QString saveLocation = KoResourcePaths::saveLocation("icc_profiles");
1455
1456 Q_FOREACH (const QString &profileName, profileNames) {
1457 if (!QFile::copy(profileName, saveLocation + QFileInfo(profileName).fileName())) {
1458 qWarning() << "Could not install profile!" << saveLocation + QFileInfo(profileName).fileName();
1459 continue;
1460 }
1461 iccEngine->addProfile(saveLocation + QFileInfo(profileName).fileName());
1462 }
1463
1464 KisConfig cfg(true);
1465 refillMonitorProfiles(KoID("RGBA"));
1466
1467 for(int i = 0; i < QApplication::screens().count(); ++i) {
1468 if (m_monitorProfileWidgets[i]->contains(cfg.monitorProfile(i))) {
1469 m_monitorProfileWidgets[i]->setCurrent(cfg.monitorProfile(i));
1470 }
1471 }
1472
1473}
1474
1476{
1478
1479 KisConfig cfg(true);
1480
1481 if (useSystemProfile) {
1483 if (devices.size() == QApplication::screens().count()) {
1484 for(int i = 0; i < QApplication::screens().count(); ++i) {
1485 m_monitorProfileWidgets[i]->clear();
1486 QString monitorForScreen = cfg.monitorForScreen(i, devices[i]);
1487 Q_FOREACH (const QString &device, devices) {
1488 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)));
1489 m_monitorProfileWidgets[i]->addSqueezedItem(KisColorManager::instance()->deviceName(device), device);
1490 if (devices[i] == monitorForScreen) {
1491 m_monitorProfileWidgets[i]->setCurrentIndex(i);
1492 }
1493 }
1494 }
1495 }
1496 }
1497 else {
1498 refillMonitorProfiles(KoID("RGBA"));
1499
1500 for(int i = 0; i < QApplication::screens().count(); ++i) {
1501 if (m_monitorProfileWidgets[i]->contains(cfg.monitorProfile(i))) {
1502 m_monitorProfileWidgets[i]->setCurrent(cfg.monitorProfile(i));
1503 }
1504 }
1505 }
1506}
1507
1509{
1510 m_page->cmbWorkingColorSpace->setEnabled(useDefColorSpace);
1511}
1512
1514{
1515 m_page->cmbWorkingColorSpace->setCurrent("RGBA");
1516
1518 const QString defaultProfile = KoColorSpaceRegistry::instance()->defaultProfileForColorSpace(colorSpaceId);
1519 m_page->cmbColorProfileForEXR->setCurrent(defaultProfile);
1520
1521 KisConfig cfg(true);
1522
1523 if (!m_colorManagedByOS) {
1524 refillMonitorProfiles(KoID("RGBA"));
1525 } else {
1527
1528 {
1529 auto mode = cfg.canvasSurfaceColorSpaceManagementMode(true);
1530 int index = m_canvasSurfaceColorSpace->findData(QVariant::fromValue(mode));
1531 KIS_SAFE_ASSERT_RECOVER(index >= 0) {
1532 index = 0;
1533 }
1534 m_canvasSurfaceColorSpace->setCurrentIndex(index);
1535 }
1536
1537 {
1538 auto mode = cfg.canvasSurfaceBitDepthMode(true);
1539 int index = m_canvasSurfaceBitDepth->findData(QVariant::fromValue(mode));
1540 KIS_SAFE_ASSERT_RECOVER(index >= 0) {
1541 index = 0;
1542 }
1543 m_canvasSurfaceBitDepth->setCurrentIndex(index);
1544 }
1545 }
1546
1547 KisImageConfig cfgImage(true);
1548 KisProofingConfigurationSP proofingConfig = cfgImage.defaultProofingconfiguration(true);
1549 m_page->wdgProofingOptions->setProofingConfig(proofingConfig);
1550
1551 m_page->chkBlackpoint->setChecked(cfg.useBlackPointCompensation(true));
1552 m_page->chkAllowLCMSOptimization->setChecked(cfg.allowLCMSOptimization(true));
1553 m_page->chkForcePaletteColor->setChecked(cfg.forcePaletteColors(true));
1554 m_page->cmbMonitorIntent->setCurrentIndex(cfg.monitorRenderIntent(true));
1555 if (!m_colorManagedByOS) {
1556 m_page->chkUseSystemMonitorProfile->setChecked(cfg.useSystemMonitorProfile(true));
1557 }
1558 QAbstractButton *button = m_pasteBehaviourGroup.button(cfg.pasteBehaviour(true));
1559 Q_ASSERT(button);
1560 if (button) {
1561 button->setChecked(true);
1562 }
1563}
1564
1565
1567{
1569
1570 for (int i = 0; i < QApplication::screens().count(); ++i) {
1571 m_monitorProfileWidgets[i]->clear();
1572 }
1573
1574 QMap<QString, const KoColorProfile *> profileList;
1575 Q_FOREACH(const KoColorProfile *profile, KoColorSpaceRegistry::instance()->profilesFor(colorSpaceId.id())) {
1576 profileList[profile->name()] = profile;
1577 }
1578
1579 Q_FOREACH (const KoColorProfile *profile, profileList.values()) {
1580 //qDebug() << "Profile" << profile->name() << profile->isSuitableForDisplay() << csf->defaultProfile();
1581 if (profile->isSuitableForDisplay()) {
1582 for (int i = 0; i < QApplication::screens().count(); ++i) {
1583 m_monitorProfileWidgets[i]->addSqueezedItem(profile->name());
1584 }
1585 }
1586 }
1587
1588 for (int i = 0; i < QApplication::screens().count(); ++i) {
1589 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)));
1591 }
1592}
1593
1596 options.first = KoColorConversionTransformation::Intent(m_page->cmbMonitorIntent->currentIndex());
1598 options.second.setFlag(KoColorConversionTransformation::BlackpointCompensation, m_page->chkBlackpoint->isChecked());
1599 m_page->wdgProofingOptions->setDisplayConfigOptions(options);
1600}
1601
1602//---------------------------------------------------------------------------------------------------
1603
1605{
1606 KisConfig cfg(true);
1607 const KisCubicCurve curve(cfg.pressureTabletCurve(true));
1608 m_page->pressureCurve->setCurve(curve);
1609
1610 m_page->chkUseRightMiddleClickWorkaround->setChecked(
1611 KisConfig(true).useRightMiddleTabletButtonWorkaround(true));
1612
1613#if defined Q_OS_WIN && (defined QT5_HAS_WINTAB_SWITCH || QT_VERSION >= QT_VERSION_CHECK(6, 0, 0))
1614 m_page->radioWintab->setChecked(!cfg.useWin8PointerInput(true));
1615 m_page->radioWin8PointerInput->setChecked(cfg.useWin8PointerInput(true));
1616#else
1617 m_page->grpTabletApi->setVisible(false);
1618#endif
1619
1620#if KRITA_QT_HAS_ANDROID_EMULATE_MOUSE_BUTTONS_FOR_PAGE_UP_DOWN
1621 m_page->chkUsePageUpDownMouseButtonEmulationWorkaround->setChecked(
1622 cfg.usePageUpDownMouseButtonEmulationWorkaround(true));
1623#endif
1624
1625#if KRITA_QT_HAS_ANDROID_EMULATE_MOUSE_BUTTONS_FOR_HIGH_FUNCTION_KEYS
1626 m_page->chkUseHighFunctionKeyMouseButtonEmulationWorkaround->setChecked(
1627 cfg.useHighFunctionKeyMouseButtonEmulationWorkaround(true));
1628#endif
1629
1630#if KRITA_QT_HAS_ANDROID_IGNORE_HISTORIC_TABLET_EVENTS
1631 m_page->chkUseIgnoreHistoricTabletEventsWorkaround->setChecked(cfg.useIgnoreHistoricTabletEventsWorkaround(true));
1632#endif
1633
1634 m_page->chkUseTimestampsForBrushSpeed->setChecked(false);
1635 m_page->intMaxAllowedBrushSpeed->setValue(30);
1636 m_page->intBrushSpeedSmoothing->setValue(3);
1637 m_page->tiltDirectionOffsetAngle->setAngle(0);
1638}
1639
1640TabletSettingsTab::TabletSettingsTab(QWidget* parent, const char* name): QWidget(parent)
1641{
1642 setObjectName(name);
1643
1644 QGridLayout * l = new QGridLayout(this);
1645 l->setContentsMargins(0, 0, 0, 0);
1646 m_page = new WdgTabletSettings(this);
1647 l->addWidget(m_page, 0, 0);
1648
1649 KisConfig cfg(true);
1650 const KisCubicCurve curve(cfg.pressureTabletCurve());
1651 m_page->pressureCurve->setMaximumSize(QSize(QWIDGETSIZE_MAX, QWIDGETSIZE_MAX));
1652 m_page->pressureCurve->setCurve(curve);
1653
1654 m_page->chkUseRightMiddleClickWorkaround->setChecked(
1656
1657#if defined Q_OS_WIN && (defined QT5_HAS_WINTAB_SWITCH || QT_VERSION >= QT_VERSION_CHECK(6, 0, 0))
1658# if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0)
1659 QString actualTabletProtocol = "<unknown>";
1660 using QWindowsApplication = QNativeInterface::Private::QWindowsApplication;
1661 if (auto nativeWindowsApp = dynamic_cast<QWindowsApplication *>(QGuiApplicationPrivate::platformIntegration())) {
1662 actualTabletProtocol = nativeWindowsApp->isWinTabEnabled() ? "WinTab" : "Windows Ink";
1663 }
1664 m_page->grpTabletApi->setTitle(i18n("Tablet Input API (currently active API: \"%1\")", actualTabletProtocol));
1665# endif
1666 m_page->radioWintab->setChecked(!cfg.useWin8PointerInput());
1667 m_page->radioWin8PointerInput->setChecked(cfg.useWin8PointerInput());
1668
1669 connect(m_page->btnResolutionSettings, SIGNAL(clicked()), SLOT(slotResolutionSettings()));
1670 connect(m_page->radioWintab, SIGNAL(toggled(bool)), m_page->btnResolutionSettings, SLOT(setEnabled(bool)));
1671 m_page->btnResolutionSettings->setEnabled(m_page->radioWintab->isChecked());
1672#else
1673 m_page->grpTabletApi->setVisible(false);
1674#endif
1675 connect(m_page->btnTabletTest, SIGNAL(clicked()), SLOT(slotTabletTest()));
1676
1677#ifdef Q_OS_WIN
1678 m_page->chkUseTimestampsForBrushSpeed->setText(i18n("Use tablet driver timestamps for brush speed (may cause severe artifacts when using WinTab tablet API)"));
1679#else
1680 m_page->chkUseTimestampsForBrushSpeed->setText(i18n("Use tablet driver timestamps for brush speed"));
1681#endif
1682 m_page->chkUseTimestampsForBrushSpeed->setChecked(cfg.readEntry("useTimestampsForBrushSpeed", false));
1683
1684#if KRITA_QT_HAS_ANDROID_EMULATE_MOUSE_BUTTONS_FOR_PAGE_UP_DOWN
1685 m_page->chkUsePageUpDownMouseButtonEmulationWorkaround->setChecked(
1686 cfg.usePageUpDownMouseButtonEmulationWorkaround());
1687#else
1688 m_page->chkUsePageUpDownMouseButtonEmulationWorkaround->hide();
1689#endif
1690
1691#if KRITA_QT_HAS_ANDROID_EMULATE_MOUSE_BUTTONS_FOR_HIGH_FUNCTION_KEYS
1692 m_page->chkUseHighFunctionKeyMouseButtonEmulationWorkaround->setChecked(
1693 cfg.useHighFunctionKeyMouseButtonEmulationWorkaround());
1694#else
1695 m_page->chkUseHighFunctionKeyMouseButtonEmulationWorkaround->hide();
1696#endif
1697
1698#if KRITA_QT_HAS_ANDROID_IGNORE_HISTORIC_TABLET_EVENTS
1699 m_page->chkUseIgnoreHistoricTabletEventsWorkaround->setChecked(cfg.useIgnoreHistoricTabletEventsWorkaround());
1700#else
1701 m_page->chkUseIgnoreHistoricTabletEventsWorkaround->hide();
1702#endif
1703
1704 m_page->intMaxAllowedBrushSpeed->setRange(1, 100);
1705 m_page->intMaxAllowedBrushSpeed->setValue(cfg.readEntry("maxAllowedSpeedValue", 30));
1706 KisSpinBoxI18nHelper::install(m_page->intMaxAllowedBrushSpeed, [](int value) {
1707 // i18n: This is meant to be used in a spinbox so keep the {n} in the text
1708 // and it will be substituted by the number. The text before will be
1709 // used as the prefix and the text after as the suffix
1710 return i18np("Maximum brush speed: {n} px/ms", "Maximum brush speed: {n} px/ms", value);
1711 });
1712
1713 m_page->intBrushSpeedSmoothing->setRange(3, 100);
1714 m_page->intBrushSpeedSmoothing->setValue(cfg.readEntry("speedValueSmoothing", 3));
1715 KisSpinBoxI18nHelper::install(m_page->intBrushSpeedSmoothing, [](int value) {
1716 // i18n: This is meant to be used in a spinbox so keep the {n} in the text
1717 // and it will be substituted by the number. The text before will be
1718 // used as the prefix and the text after as the suffix
1719 return i18np("Brush speed smoothing: {n} sample", "Brush speed smoothing: {n} samples", value);
1720 });
1721
1722 m_page->tiltDirectionOffsetAngle->setDecimals(0);
1723 m_page->tiltDirectionOffsetAngle->setRange(-180, 180);
1724 // the angle is saved in clockwise direction to be consistent with Drawing Angle, so negate
1725 m_page->tiltDirectionOffsetAngle->setAngle(-cfg.readEntry("tiltDirectionOffset", 0.0));
1726 m_page->tiltDirectionOffsetAngle->setPrefix(i18n("Pen tilt direction offset: "));
1727 m_page->tiltDirectionOffsetAngle->setFlipOptionsMode(KisAngleSelector::FlipOptionsMode_MenuButton);
1728}
1729
1731{
1732 TabletTestDialog tabletTestDialog(this);
1733 tabletTestDialog.exec();
1734}
1735
1736#ifdef Q_OS_WIN
1738#endif
1739
1741{
1742#ifdef Q_OS_WIN
1744 dlg.exec();
1745#endif
1746}
1747
1748
1749//---------------------------------------------------------------------------------------------------
1751
1753{
1754 return KisImageConfig(true).totalRAM();
1755}
1756
1758{
1759 return intMemoryLimit->value() - intPoolLimit->value();
1760}
1761
1762PerformanceTab::PerformanceTab(QWidget *parent, const char *name)
1763 : WdgPerformanceSettings(parent, name)
1764 , m_frameRateModel(new KisFrameRateLimitModel())
1765{
1766 KisImageConfig cfg(true);
1767 const double totalRAM = cfg.totalRAM();
1768 lblTotalMemory->setText(KFormat().formatByteSize(totalRAM * 1024 * 1024, 0, KFormat::IECBinaryDialect, KFormat::UnitMegaByte));
1769
1770 KisSpinBoxI18nHelper::setText(sliderMemoryLimit, i18nc("{n} is the number value, % is the percent sign", "{n}%"));
1771 sliderMemoryLimit->setRange(1, 100, 2);
1772 sliderMemoryLimit->setSingleStep(0.01);
1773
1774 KisSpinBoxI18nHelper::setText(sliderPoolLimit, i18nc("{n} is the number value, % is the percent sign", "{n}%"));
1775 sliderPoolLimit->setRange(0, 20, 2);
1776 sliderPoolLimit->setSingleStep(0.01);
1777
1778 KisSpinBoxI18nHelper::setText(sliderUndoLimit, i18nc("{n} is the number value, % is the percent sign", "{n}%"));
1779 sliderUndoLimit->setRange(0, 50, 2);
1780 sliderUndoLimit->setSingleStep(0.01);
1781
1782 intMemoryLimit->setMinimumWidth(80);
1783 intPoolLimit->setMinimumWidth(80);
1784 intUndoLimit->setMinimumWidth(80);
1785
1786 {
1787 formLayout->takeRow(2);
1788 label_5->setVisible(false);
1789 intPoolLimit->setVisible(false);
1790 sliderPoolLimit->setVisible(false);
1791 }
1792
1793 SliderAndSpinBoxSync *sync1 =
1794 new SliderAndSpinBoxSync(sliderMemoryLimit,
1795 intMemoryLimit,
1796 getTotalRAM);
1797
1798 sync1->slotParentValueChanged();
1799 m_syncs << sync1;
1800
1801 SliderAndSpinBoxSync *sync2 =
1802 new SliderAndSpinBoxSync(sliderPoolLimit,
1803 intPoolLimit,
1804 std::bind(&KisIntParseSpinBox::value,
1805 intMemoryLimit));
1806
1807
1808 connect(intMemoryLimit, SIGNAL(valueChanged(int)), sync2, SLOT(slotParentValueChanged()));
1809 sync2->slotParentValueChanged();
1810 m_syncs << sync2;
1811
1812 SliderAndSpinBoxSync *sync3 =
1813 new SliderAndSpinBoxSync(sliderUndoLimit,
1814 intUndoLimit,
1816 this));
1817
1818
1819 connect(intPoolLimit, SIGNAL(valueChanged(int)), sync3, SLOT(slotParentValueChanged()));
1820 connect(intMemoryLimit, SIGNAL(valueChanged(int)), sync3, SLOT(slotParentValueChanged()));
1821 sync3->slotParentValueChanged();
1822 m_syncs << sync3;
1823
1824 sliderSwapSize->setSuffix(i18n(" GiB"));
1825 sliderSwapSize->setRange(1, 64);
1826 intSwapSize->setRange(1, 64);
1827
1828
1829 KisAcyclicSignalConnector *swapSizeConnector = new KisAcyclicSignalConnector(this);
1830
1831 swapSizeConnector->connectForwardInt(sliderSwapSize, SIGNAL(valueChanged(int)),
1832 intSwapSize, SLOT(setValue(int)));
1833
1834 swapSizeConnector->connectBackwardInt(intSwapSize, SIGNAL(valueChanged(int)),
1835 sliderSwapSize, SLOT(setValue(int)));
1836
1837 swapFileLocation->setMode(KoFileDialog::OpenDirectory);
1838 swapFileLocation->setConfigurationName("swapfile_location");
1839 swapFileLocation->setFileName(cfg.swapDir());
1840
1841 sliderThreadsLimit->setRange(1, QThread::idealThreadCount());
1842 sliderFrameClonesLimit->setRange(1, QThread::idealThreadCount());
1843
1844 sliderFrameTimeout->setRange(5, 600);
1845 sliderFrameTimeout->setSuffix(i18nc("suffix for \"seconds\"", " sec"));
1846 sliderFrameTimeout->setValue(cfg.frameRenderingTimeout() / 1000);
1847
1848 sliderFpsLimit->setSuffix(i18n(" fps"));
1849
1850 KisWidgetConnectionUtils::connectControlState(sliderFpsLimit, m_frameRateModel.data(), "frameRateState", "frameRate");
1851 KisWidgetConnectionUtils::connectControl(chkDetectFps, m_frameRateModel.data(), "detectFrameRate");
1852
1853 connect(sliderThreadsLimit, SIGNAL(valueChanged(int)), SLOT(slotThreadsLimitChanged(int)));
1854 connect(sliderFrameClonesLimit, SIGNAL(valueChanged(int)), SLOT(slotFrameClonesLimitChanged(int)));
1855
1856 intCachedFramesSizeLimit->setRange(256, 10000);
1857 intCachedFramesSizeLimit->setSuffix(i18n(" px"));
1858 intCachedFramesSizeLimit->setSingleStep(1);
1859 intCachedFramesSizeLimit->setPageStep(1000);
1860
1861 intRegionOfInterestMargin->setRange(1, 100);
1862 KisSpinBoxI18nHelper::setText(intRegionOfInterestMargin,
1863 i18nc("{n} is the number value, % is the percent sign", "{n}%"));
1864 intRegionOfInterestMargin->setSingleStep(1);
1865 intRegionOfInterestMargin->setPageStep(10);
1866
1867 connect(chkCachedFramesSizeLimit, SIGNAL(toggled(bool)), intCachedFramesSizeLimit, SLOT(setEnabled(bool)));
1868 connect(chkUseRegionOfInterest, SIGNAL(toggled(bool)), intRegionOfInterestMargin, SLOT(setEnabled(bool)));
1869
1870 connect(chkTransformToolUseInStackPreview, SIGNAL(toggled(bool)), chkTransformToolForceLodMode, SLOT(setEnabled(bool)));
1871
1872#ifndef Q_OS_WIN
1873 // AVX workaround is needed on Windows+GCC only
1874 chkDisableAVXOptimizations->setVisible(false);
1875#endif
1876
1877 load(false);
1878}
1879
1881{
1882 qDeleteAll(m_syncs);
1883}
1884
1885void PerformanceTab::load(bool requestDefault)
1886{
1887 KisImageConfig cfg(true);
1888
1889 sliderMemoryLimit->setValue(cfg.memoryHardLimitPercent(requestDefault));
1890 sliderPoolLimit->setValue(cfg.memoryPoolLimitPercent(requestDefault));
1891 sliderUndoLimit->setValue(cfg.memorySoftLimitPercent(requestDefault));
1892
1893 chkPerformanceLogging->setChecked(cfg.enablePerfLog(requestDefault));
1894 chkProgressReporting->setChecked(cfg.enableProgressReporting(requestDefault));
1895
1896 sliderSwapSize->setValue(cfg.maxSwapSize(requestDefault) / 1024);
1897 swapFileLocation->setFileName(cfg.swapDir(requestDefault));
1898
1899 m_lastUsedThreadsLimit = cfg.maxNumberOfThreads(requestDefault);
1900 m_lastUsedClonesLimit = cfg.frameRenderingClones(requestDefault);
1901
1902 sliderThreadsLimit->setValue(m_lastUsedThreadsLimit);
1903 sliderFrameClonesLimit->setValue(m_lastUsedClonesLimit);
1904
1905#if KRITA_QT_HAS_UPDATE_COMPRESSION_PATCH
1906 m_frameRateModel->data.set(std::make_tuple(cfg.detectFpsLimit(requestDefault), cfg.fpsLimit(requestDefault)));
1907#else
1908 m_frameRateModel->data.set(std::make_tuple(false, cfg.fpsLimit(requestDefault)));
1909 chkDetectFps->setVisible(false);
1910#endif
1911 {
1912 KisConfig cfg2(true);
1913 chkOpenGLFramerateLogging->setChecked(cfg2.enableOpenGLFramerateLogging(requestDefault));
1914 chkBrushSpeedLogging->setChecked(cfg2.enableBrushSpeedLogging(requestDefault));
1915 chkDisableVectorOptimizations->setChecked(cfg2.disableVectorOptimizations(requestDefault));
1916#ifdef Q_OS_WIN
1917 chkDisableAVXOptimizations->setChecked(cfg2.disableAVXOptimizations(requestDefault));
1918#endif
1919 chkBackgroundCacheGeneration->setChecked(cfg2.calculateAnimationCacheInBackground(requestDefault));
1920 }
1921
1922 if (cfg.useOnDiskAnimationCacheSwapping(requestDefault)) {
1923 optOnDisk->setChecked(true);
1924 } else {
1925 optInMemory->setChecked(true);
1926 }
1927
1928 chkCachedFramesSizeLimit->setChecked(cfg.useAnimationCacheFrameSizeLimit(requestDefault));
1929 intCachedFramesSizeLimit->setValue(cfg.animationCacheFrameSizeLimit(requestDefault));
1930 intCachedFramesSizeLimit->setEnabled(chkCachedFramesSizeLimit->isChecked());
1931
1932 chkUseRegionOfInterest->setChecked(cfg.useAnimationCacheRegionOfInterest(requestDefault));
1933 intRegionOfInterestMargin->setValue(cfg.animationCacheRegionOfInterestMargin(requestDefault) * 100.0);
1934 intRegionOfInterestMargin->setEnabled(chkUseRegionOfInterest->isChecked());
1935
1936 {
1937 KConfigGroup group = KSharedConfig::openConfig()->group("KisToolTransform");
1938 chkTransformToolUseInStackPreview->setChecked(!group.readEntry("useOverlayPreviewStyle", false));
1939 chkTransformToolForceLodMode->setChecked(group.readEntry("forceLodMode", true));
1940 chkTransformToolForceLodMode->setEnabled(chkTransformToolUseInStackPreview->isChecked());
1941 }
1942
1943 {
1944 KConfigGroup group = KSharedConfig::openConfig()->group("KritaTransform/KisToolMove");
1945 chkMoveToolForceLodMode->setChecked(group.readEntry("forceLodMode", false));
1946 }
1947
1948 {
1949 KConfigGroup group( KSharedConfig::openConfig(), "filterdialog");
1950 chkFiltersForceLodMode->setChecked(group.readEntry("forceLodMode", true));
1951 }
1952}
1953
1955{
1956 KisImageConfig cfg(false);
1957
1958 cfg.setMemoryHardLimitPercent(sliderMemoryLimit->value());
1959 cfg.setMemorySoftLimitPercent(sliderUndoLimit->value());
1960 cfg.setMemoryPoolLimitPercent(sliderPoolLimit->value());
1961
1962 cfg.setEnablePerfLog(chkPerformanceLogging->isChecked());
1963 cfg.setEnableProgressReporting(chkProgressReporting->isChecked());
1964
1965 cfg.setMaxSwapSize(sliderSwapSize->value() * 1024);
1966
1967 cfg.setSwapDir(swapFileLocation->fileName());
1968
1969 cfg.setMaxNumberOfThreads(sliderThreadsLimit->value());
1970 cfg.setFrameRenderingClones(sliderFrameClonesLimit->value());
1971 cfg.setFrameRenderingTimeout(sliderFrameTimeout->value() * 1000);
1972 cfg.setFpsLimit(std::get<int>(*m_frameRateModel->data));
1973#if KRITA_QT_HAS_UPDATE_COMPRESSION_PATCH
1974 cfg.setDetectFpsLimit(std::get<bool>(*m_frameRateModel->data));
1975#endif
1976
1977 {
1978 KisConfig cfg2(true);
1979 cfg2.setEnableOpenGLFramerateLogging(chkOpenGLFramerateLogging->isChecked());
1980 cfg2.setEnableBrushSpeedLogging(chkBrushSpeedLogging->isChecked());
1981 cfg2.setDisableVectorOptimizations(chkDisableVectorOptimizations->isChecked());
1982#ifdef Q_OS_WIN
1983 cfg2.setDisableAVXOptimizations(chkDisableAVXOptimizations->isChecked());
1984#endif
1985 cfg2.setCalculateAnimationCacheInBackground(chkBackgroundCacheGeneration->isChecked());
1986 }
1987
1988 cfg.setUseOnDiskAnimationCacheSwapping(optOnDisk->isChecked());
1989
1990 cfg.setUseAnimationCacheFrameSizeLimit(chkCachedFramesSizeLimit->isChecked());
1991 cfg.setAnimationCacheFrameSizeLimit(intCachedFramesSizeLimit->value());
1992
1993 cfg.setUseAnimationCacheRegionOfInterest(chkUseRegionOfInterest->isChecked());
1994 cfg.setAnimationCacheRegionOfInterestMargin(intRegionOfInterestMargin->value() / 100.0);
1995
1996 {
1997 KConfigGroup group = KSharedConfig::openConfig()->group("KisToolTransform");
1998 group.writeEntry("useOverlayPreviewStyle", !chkTransformToolUseInStackPreview->isChecked());
1999 group.writeEntry("forceLodMode", chkTransformToolForceLodMode->isChecked());
2000 }
2001
2002 {
2003 KConfigGroup group = KSharedConfig::openConfig()->group("KritaTransform/KisToolMove");
2004 group.writeEntry("forceLodMode", chkMoveToolForceLodMode->isChecked());
2005 }
2006
2007 {
2008 KConfigGroup group( KSharedConfig::openConfig(), "filterdialog");
2009 group.writeEntry("forceLodMode", chkFiltersForceLodMode->isChecked());
2010 }
2011
2012}
2013
2015{
2016 KisSignalsBlocker b(sliderFrameClonesLimit);
2017 sliderFrameClonesLimit->setValue(qMin(m_lastUsedClonesLimit, value));
2019}
2020
2022{
2023 KisSignalsBlocker b(sliderThreadsLimit);
2024 sliderThreadsLimit->setValue(qMax(m_lastUsedThreadsLimit, value));
2026}
2027
2028//---------------------------------------------------------------------------------------------------
2029
2030#include "KoColor.h"
2033#include <QOpenGLContext>
2034#include <QScreen>
2035
2036namespace {
2037
2038QString colorSpaceString(const KisSurfaceColorSpaceWrapper &cs, int depth)
2039{
2040 const QString csString =
2041#ifdef HAVE_HDR
2043 cs == KisSurfaceColorSpaceWrapper::scRGBColorSpace ? "Rec. 709 Linear" :
2044#endif
2047 "Unknown Color Space";
2048
2049 return QString("%1 (%2 bit)").arg(csString).arg(depth);
2050}
2051
2052int formatToIndex(KisConfig::RootSurfaceFormat fmt)
2053{
2054 return fmt == KisConfig::BT2020_PQ ? 1 :
2055 fmt == KisConfig::BT709_G10 ? 2 :
2056 0;
2057}
2058
2059KisConfig::RootSurfaceFormat indexToFormat(int value)
2060{
2061 return value == 1 ? KisConfig::BT2020_PQ :
2064}
2065
2066int assistantDrawModeToIndex(KisConfig::AssistantsDrawMode mode)
2067{
2070 0;
2071}
2072
2073KisConfig::AssistantsDrawMode indexToAssistantDrawMode(int value)
2074{
2078}
2079
2080} // anonymous namespace
2081
2082DisplaySettingsTab::DisplaySettingsTab(QWidget *parent, const char *name)
2083 : WdgDisplaySettings(parent, name)
2084{
2085 KisConfig cfg(true);
2086
2087 const QString rendererOpenGLText = i18nc("canvas renderer", "OpenGL");
2088 const QString rendererSoftwareText = i18nc("canvas renderer", "Software Renderer (very slow)");
2089#ifdef Q_OS_WIN
2090 const QString rendererOpenGLESText =
2091 qEnvironmentVariable("QT_ANGLE_PLATFORM") != "opengl"
2092 ? i18nc("canvas renderer", "Direct3D 11 via ANGLE")
2093 : i18nc("canvas renderer", "OpenGL via ANGLE");
2094#else
2095 const QString rendererOpenGLESText = i18nc("canvas renderer", "OpenGL ES");
2096#endif
2097
2099 lblCurrentRenderer->setText(renderer == KisOpenGL::RendererOpenGLES ? rendererOpenGLESText :
2100 renderer == KisOpenGL::RendererDesktopGL ? rendererOpenGLText :
2101 renderer == KisOpenGL::RendererSoftware ? rendererSoftwareText :
2102 i18nc("canvas renderer", "Unknown"));
2103
2104 cmbPreferredRenderer->clear();
2105
2106 const KisOpenGL::OpenGLRenderers supportedRenderers = KisOpenGL::getSupportedOpenGLRenderers();
2107 const bool onlyOneRendererSupported =
2108 supportedRenderers == KisOpenGL::RendererDesktopGL ||
2109 supportedRenderers == KisOpenGL::RendererOpenGLES ||
2110 supportedRenderers == KisOpenGL::RendererSoftware;
2111
2112
2113 if (!onlyOneRendererSupported) {
2114 QString qtPreferredRendererText;
2116 qtPreferredRendererText = rendererOpenGLESText;
2118 qtPreferredRendererText = rendererSoftwareText;
2119 } else {
2120 qtPreferredRendererText = rendererOpenGLText;
2121 }
2122 cmbPreferredRenderer->addItem(i18nc("canvas renderer", "Auto (%1)", qtPreferredRendererText), KisOpenGL::RendererAuto);
2123 cmbPreferredRenderer->setCurrentIndex(0);
2124 } else {
2125 cmbPreferredRenderer->setEnabled(false);
2126 }
2127
2128 if (supportedRenderers & KisOpenGL::RendererDesktopGL) {
2129 cmbPreferredRenderer->addItem(rendererOpenGLText, KisOpenGL::RendererDesktopGL);
2131 cmbPreferredRenderer->setCurrentIndex(cmbPreferredRenderer->count() - 1);
2132 }
2133 }
2134
2135 if (supportedRenderers & KisOpenGL::RendererOpenGLES) {
2136 cmbPreferredRenderer->addItem(rendererOpenGLESText, KisOpenGL::RendererOpenGLES);
2138 cmbPreferredRenderer->setCurrentIndex(cmbPreferredRenderer->count() - 1);
2139 }
2140 }
2141
2142 if (supportedRenderers & KisOpenGL::RendererSoftware) {
2143 cmbPreferredRenderer->addItem(rendererSoftwareText, KisOpenGL::RendererSoftware);
2145 cmbPreferredRenderer->setCurrentIndex(cmbPreferredRenderer->count() - 1);
2146 }
2147 }
2148
2149 if (!(supportedRenderers &
2153
2154 grpOpenGL->setEnabled(false);
2155 grpOpenGL->setChecked(false);
2156 chkUseTextureBuffer->setEnabled(false);
2157 cmbAssistantsDrawMode->setEnabled(false);
2158 cmbFilterMode->setEnabled(false);
2159 } else {
2160 grpOpenGL->setEnabled(true);
2161 grpOpenGL->setChecked(cfg.useOpenGL());
2162 chkUseTextureBuffer->setEnabled(cfg.useOpenGL());
2163 chkUseTextureBuffer->setChecked(cfg.useOpenGLTextureBuffer());
2164 cmbAssistantsDrawMode->setEnabled(cfg.useOpenGL());
2165 cmbAssistantsDrawMode->setCurrentIndex(assistantDrawModeToIndex(cfg.assistantsDrawMode()));
2166 cmbFilterMode->setEnabled(cfg.useOpenGL());
2167 cmbFilterMode->setCurrentIndex(cfg.openGLFilteringMode());
2168 // Don't show the high quality filtering mode if it's not available
2169 if (!KisOpenGL::supportsLoD()) {
2170 cmbFilterMode->removeItem(3);
2171 }
2172 }
2173
2174 {
2175 std::optional<KisOpenGL::XcbGLProviderProtocol> currentXcbGlProvider = KisOpenGL::xcbGlProviderProtocol();
2176
2177 lblPreferredXcbGlApi->setVisible(currentXcbGlProvider.has_value());
2178 cmbPreferredXcbGlApi->setVisible(currentXcbGlProvider.has_value());
2179
2180 if (currentXcbGlProvider.has_value()) {
2181 const QString glxCurrent = i18nc("@item:inlistbox", "GLX (current)");
2182 const QString glxNotCurrent = i18nc("@item:inlistbox", "GLX");
2183 const QString eglCurrent = i18nc("@item:inlistbox", "EGL (current)");
2184 const QString eglNotCurrent = i18nc("@item:inlistbox", "EGL");
2185
2186 cmbPreferredXcbGlApi->addItem(*currentXcbGlProvider == KisOpenGL::XCB_GLX ? glxCurrent : glxNotCurrent, KisOpenGL::XCB_GLX);
2187 cmbPreferredXcbGlApi->addItem(*currentXcbGlProvider == KisOpenGL::XCB_EGL ? eglCurrent : eglNotCurrent, KisOpenGL::XCB_EGL);
2188
2189 cmbPreferredXcbGlApi->setToolTip(i18nc("@info:tooltip",
2190 "<p>If you are using Krita on X11 or XWayland and experience slowness, "
2191 "try switching between EGL and GLX</p>"));
2192
2193 KisOpenGL::XcbGLProviderProtocol preferredValue =
2195
2196 int index = cmbPreferredXcbGlApi->findData(preferredValue);
2197
2198 KIS_SAFE_ASSERT_RECOVER(index >= 0) {
2199 index = 0;
2200 }
2201 cmbPreferredXcbGlApi->setCurrentIndex(index);
2202 }
2203 }
2204
2205 lblCurrentDisplayFormat->setText("");
2206 lblCurrentRootSurfaceFormat->setText("");
2207 grpHDRWarning->setVisible(false);
2208 cmbPreferedRootSurfaceFormat->addItem(colorSpaceString(KisSurfaceColorSpaceWrapper::sRGBColorSpace, 8));
2209#ifdef HAVE_HDR
2210 cmbPreferedRootSurfaceFormat->addItem(colorSpaceString(KisSurfaceColorSpaceWrapper::bt2020PQColorSpace, 10));
2211 cmbPreferedRootSurfaceFormat->addItem(colorSpaceString(KisSurfaceColorSpaceWrapper::scRGBColorSpace, 16));
2212#endif
2213 cmbPreferedRootSurfaceFormat->setCurrentIndex(formatToIndex(KisConfig::BT709_G22));
2214 slotPreferredSurfaceFormatChanged(cmbPreferedRootSurfaceFormat->currentIndex());
2215
2216 QOpenGLContext *context = QOpenGLContext::currentContext();
2217
2218 if (!context) {
2219 context = QOpenGLContext::globalShareContext();
2220 }
2221
2222 if (context) {
2223 QScreen *screen = KisPart::instance()->currentMainwindow()->screen();
2224 KisScreenInformationAdapter adapter(context);
2225 if (screen && adapter.isValid()) {
2227 if (info.isValid()) {
2228 QStringList toolTip;
2229
2230 toolTip << i18n("Display Id: %1", info.screen->name());
2231 toolTip << i18n("Display Name: %1 %2", info.screen->manufacturer(), info.screen->model());
2232 toolTip << i18n("Min Luminance: %1", info.minLuminance);
2233 toolTip << i18n("Max Luminance: %1", info.maxLuminance);
2234 toolTip << i18n("Max Full Frame Luminance: %1", info.maxFullFrameLuminance);
2235 toolTip << i18n("Red Primary: %1, %2", info.redPrimary[0], info.redPrimary[1]);
2236 toolTip << i18n("Green Primary: %1, %2", info.greenPrimary[0], info.greenPrimary[1]);
2237 toolTip << i18n("Blue Primary: %1, %2", info.bluePrimary[0], info.bluePrimary[1]);
2238 toolTip << i18n("White Point: %1, %2", info.whitePoint[0], info.whitePoint[1]);
2239
2240 lblCurrentDisplayFormat->setToolTip(toolTip.join('\n'));
2241 lblCurrentDisplayFormat->setText(colorSpaceString(info.colorSpace, info.bitsPerColor));
2242 } else {
2243 lblCurrentDisplayFormat->setToolTip("");
2244 lblCurrentDisplayFormat->setText(i18n("Unknown"));
2245 }
2246 } else {
2247 lblCurrentDisplayFormat->setToolTip("");
2248 lblCurrentDisplayFormat->setText(i18n("Unknown"));
2249 qWarning() << "Failed to fetch display info:" << adapter.errorString();
2250 }
2251
2252 const QSurfaceFormat currentFormat = KisOpenGLModeProber::instance()->surfaceformatInUse();
2253 const auto colorSpace = KisSurfaceColorSpaceWrapper::fromQtColorSpace(currentFormat.colorSpace());
2254 lblCurrentRootSurfaceFormat->setText(colorSpaceString(colorSpace, currentFormat.redBufferSize()));
2255 cmbPreferedRootSurfaceFormat->setCurrentIndex(formatToIndex(cfg.rootSurfaceFormat()));
2256 connect(cmbPreferedRootSurfaceFormat, SIGNAL(currentIndexChanged(int)), SLOT(slotPreferredSurfaceFormatChanged(int)));
2257 slotPreferredSurfaceFormatChanged(cmbPreferedRootSurfaceFormat->currentIndex());
2258 }
2259
2260#ifndef HAVE_HDR
2261 tabHDR->setEnabled(false);
2262
2268 if (KisPlatformPluginInterfaceFactory::instance()->surfaceColorManagedByOS()) {
2269 const int hdrTabIndex = tabWidget->indexOf(tabHDR);
2270 KIS_SAFE_ASSERT_RECOVER_NOOP(hdrTabIndex >= 0);
2271 if (hdrTabIndex >= 0) {
2272 tabWidget->setTabVisible(hdrTabIndex, false);
2273 }
2274 }
2275#endif
2276
2277 const QStringList openglWarnings = KisOpenGL::getOpenGLWarnings();
2278 if (openglWarnings.isEmpty()) {
2279 grpOpenGLWarnings->setVisible(false);
2280 } else {
2281 QString text = QString("<p><b>%1</b>").arg(i18n("Warning(s):"));
2282 text.append("<ul>");
2283 Q_FOREACH (const QString &warning, openglWarnings) {
2284 text.append("<li>");
2285 text.append(warning.toHtmlEscaped());
2286 text.append("</li>");
2287 }
2288 text.append("</ul></p>");
2289 grpOpenGLWarnings->setText(text);
2290 grpOpenGLWarnings->setPixmap(
2291 grpOpenGLWarnings->style()->standardIcon(QStyle::SP_MessageBoxWarning).pixmap(QSize(32, 32)));
2292 grpOpenGLWarnings->setVisible(true);
2293 }
2294
2295 KisImageConfig imageCfg(false);
2296
2297 KoColor c;
2299 c.setOpacity(1.0);
2300 btnSelectionOverlayColor->setColor(c);
2301 sldSelectionOverlayOpacity->setRange(0.0, 1.0, 2);
2302 sldSelectionOverlayOpacity->setSingleStep(0.05);
2303 sldSelectionOverlayOpacity->setValue(imageCfg.selectionOverlayMaskColor().alphaF());
2304
2305 sldSelectionOutlineOpacity->setRange(0.0, 1.0, 2);
2306 sldSelectionOutlineOpacity->setSingleStep(0.05);
2307 sldSelectionOutlineOpacity->setValue(imageCfg.selectionOutlineOpacity());
2308
2309 intCheckSize->setValue(cfg.checkSize());
2310 chkMoving->setChecked(cfg.scrollCheckers());
2312 ck1.fromQColor(cfg.checkersColor1());
2313 colorChecks1->setColor(ck1);
2315 ck2.fromQColor(cfg.checkersColor2());
2316 colorChecks2->setColor(ck2);
2318 cb.fromQColor(cfg.canvasBorderColor());
2319 canvasBorder->setColor(cb);
2320 hideScrollbars->setChecked(cfg.hideScrollbars());
2321 chkCurveAntialiasing->setChecked(cfg.antialiasCurves());
2322 chkSelectionOutlineAntialiasing->setChecked(cfg.antialiasSelectionOutline());
2323 chkChannelsAsColor->setChecked(cfg.showSingleChannelAsColor());
2324 chkHidePopups->setChecked(cfg.hidePopups());
2325
2326 connect(grpOpenGL, SIGNAL(toggled(bool)), SLOT(slotUseOpenGLToggled(bool)));
2327
2328 KoColor gridColor(KoColorSpaceRegistry::instance()->rgb8());
2329 gridColor.fromQColor(cfg.getPixelGridColor());
2330 pixelGridColorButton->setColor(gridColor);
2331 pixelGridDrawingThresholdBox->setValue(cfg.getPixelGridDrawingThreshold() * 100);
2332 KisSpinBoxI18nHelper::setText(pixelGridDrawingThresholdBox, i18nc("{n} is the number value, % is the percent sign", "{n}%"));
2333}
2334
2336{
2337 KisConfig cfg(true);
2338 cmbPreferredRenderer->setCurrentIndex(0);
2341 grpOpenGL->setEnabled(false);
2342 grpOpenGL->setChecked(false);
2343 chkUseTextureBuffer->setEnabled(false);
2344 cmbAssistantsDrawMode->setEnabled(false);
2345 cmbFilterMode->setEnabled(false);
2346 }
2347 else {
2348 grpOpenGL->setEnabled(true);
2349 grpOpenGL->setChecked(cfg.useOpenGL(true));
2350 chkUseTextureBuffer->setChecked(cfg.useOpenGLTextureBuffer(true));
2351 chkUseTextureBuffer->setEnabled(true);
2352 cmbAssistantsDrawMode->setEnabled(true);
2353 cmbAssistantsDrawMode->setCurrentIndex(assistantDrawModeToIndex(cfg.assistantsDrawMode(true)));
2354 cmbFilterMode->setEnabled(true);
2355 cmbFilterMode->setCurrentIndex(cfg.openGLFilteringMode(true));
2356 }
2357
2358 chkMoving->setChecked(cfg.scrollCheckers(true));
2359
2360 KisImageConfig imageCfg(false);
2361
2362 KoColor c;
2363 c.fromQColor(imageCfg.selectionOverlayMaskColor(true));
2364 c.setOpacity(1.0);
2365 btnSelectionOverlayColor->setColor(c);
2366 sldSelectionOverlayOpacity->setValue(imageCfg.selectionOverlayMaskColor(true).alphaF());
2367
2368 sldSelectionOutlineOpacity->setValue(imageCfg.selectionOutlineOpacity(true));
2369
2370 intCheckSize->setValue(cfg.checkSize(true));
2372 ck1.fromQColor(cfg.checkersColor1(true));
2373 colorChecks1->setColor(ck1);
2375 ck2.fromQColor(cfg.checkersColor2(true));
2376 colorChecks2->setColor(ck2);
2378 cvb.fromQColor(cfg.canvasBorderColor(true));
2379 canvasBorder->setColor(cvb);
2380 hideScrollbars->setChecked(cfg.hideScrollbars(true));
2381 chkCurveAntialiasing->setChecked(cfg.antialiasCurves(true));
2382 chkSelectionOutlineAntialiasing->setChecked(cfg.antialiasSelectionOutline(true));
2383 chkChannelsAsColor->setChecked(cfg.showSingleChannelAsColor(true));
2384 chkHidePopups->setChecked(cfg.hidePopups(true));
2385
2386 KoColor gridColor(KoColorSpaceRegistry::instance()->rgb8());
2387 gridColor.fromQColor(cfg.getPixelGridColor(true));
2388 pixelGridColorButton->setColor(gridColor);
2389 pixelGridDrawingThresholdBox->setValue(cfg.getPixelGridDrawingThreshold(true) * 100);
2390 KisSpinBoxI18nHelper::setText(pixelGridDrawingThresholdBox, i18nc("{n} is the number value, % is the percent sign", "{n}%"));
2391
2392 cmbPreferedRootSurfaceFormat->setCurrentIndex(formatToIndex(KisConfig::BT709_G22));
2393 slotPreferredSurfaceFormatChanged(cmbPreferedRootSurfaceFormat->currentIndex());
2394}
2395
2397{
2398 chkUseTextureBuffer->setEnabled(isChecked);
2399 cmbFilterMode->setEnabled(isChecked);
2400 cmbAssistantsDrawMode->setEnabled(isChecked);
2401}
2402
2404{
2405 Q_UNUSED(index);
2406
2407 QOpenGLContext *context = QOpenGLContext::currentContext();
2408 if (context) {
2409 QScreen *screen = KisPart::instance()->currentMainwindow()->screen();
2410 KisScreenInformationAdapter adapter(context);
2411 if (adapter.isValid()) {
2413 if (info.isValid()) {
2414 if (cmbPreferedRootSurfaceFormat->currentIndex() != formatToIndex(KisConfig::BT709_G22) &&
2416 grpHDRWarning->setVisible(true);
2417 grpHDRWarning->setPixmap(
2418 grpHDRWarning->style()->standardIcon(QStyle::SP_MessageBoxWarning).pixmap(QSize(32, 32)));
2419 grpHDRWarning->setText(i18n("<b>Warning:</b> current display doesn't support HDR rendering"));
2420 } else {
2421 grpHDRWarning->setVisible(false);
2422 }
2423 }
2424 }
2425 }
2426}
2427
2428//---------------------------------------------------------------------------------------------------
2430{
2431 KisConfig cfg(true);
2432
2433 chkDockers->setChecked(cfg.hideDockersFullscreen());
2434 chkMenu->setChecked(cfg.hideMenuFullscreen());
2435 chkScrollbars->setChecked(cfg.hideScrollbarsFullscreen());
2436 chkStatusbar->setChecked(cfg.hideStatusbarFullscreen());
2437 chkTitlebar->setChecked(cfg.hideTitlebarFullscreen());
2438 chkToolbar->setChecked(cfg.hideToolbarFullscreen());
2439
2440}
2441
2443{
2444 KisConfig cfg(true);
2445 chkDockers->setChecked(cfg.hideDockersFullscreen(true));
2446 chkMenu->setChecked(cfg.hideMenuFullscreen(true));
2447 chkScrollbars->setChecked(cfg.hideScrollbarsFullscreen(true));
2448 chkStatusbar->setChecked(cfg.hideStatusbarFullscreen(true));
2449 chkTitlebar->setChecked(cfg.hideTitlebarFullscreen(true));
2450 chkToolbar->setChecked(cfg.hideToolbarFullscreen(true));
2451}
2452
2453
2454//---------------------------------------------------------------------------------------------------
2455
2457static const QStringList allowedColorHistorySortingValues({"none", "hsv"});
2458}
2459
2460PopupPaletteTab::PopupPaletteTab(QWidget *parent, const char *name)
2461 : WdgPopupPaletteSettingsBase(parent, name)
2462{
2463 using namespace PopupPaletteTabPrivate;
2464
2465 load();
2466
2467 connect(chkShowColorHistory, SIGNAL(toggled(bool)), cmbColorHistorySorting, SLOT(setEnabled(bool)));
2468 connect(chkShowColorHistory, SIGNAL(toggled(bool)), lblColorHistorySorting, SLOT(setEnabled(bool)));
2469 connect(cmbSelectorType, SIGNAL(currentIndexChanged(int)), this, SLOT(slotSelectorTypeChanged(int)));
2470 KIS_SAFE_ASSERT_RECOVER_NOOP(cmbColorHistorySorting->count() == allowedColorHistorySortingValues.size());
2471}
2472
2474{
2475 using namespace PopupPaletteTabPrivate;
2476
2477 KisConfig config(true);
2478 sbNumPresets->setValue(config.favoritePresets());
2479 sbPaletteSize->setValue(config.readEntry("popuppalette/size", 385));
2480 sbSelectorSize->setValue(config.readEntry("popuppalette/selectorSize", 140));
2481 cmbSelectorType->setCurrentIndex(config.readEntry<bool>("popuppalette/usevisualcolorselector", false) ? 1 : 0);
2482 chkShowColorHistory->setChecked(config.readEntry("popuppalette/showColorHistory", true));
2483 chkShowRotationTrack->setChecked(config.readEntry("popuppalette/showRotationTrack", true));
2484 chkUseDynamicSlotCount->setChecked(config.readEntry("popuppalette/useDynamicSlotCount", true));
2485 grpFixTriangleRotation->setChecked(config.readEntry("popuppalette/fixTriangleRotation", false));
2486 sbTriangleRotationAngle->setValue(config.readEntry("popuppalette/triangleRotationAngle", 0));
2487
2488 QString currentSorting = config.readEntry("popuppalette/colorHistorySorting", QString("hsv"));
2489 if (!allowedColorHistorySortingValues.contains(currentSorting)) {
2490 currentSorting = "hsv";
2491 }
2492 cmbColorHistorySorting->setCurrentIndex(allowedColorHistorySortingValues.indexOf(currentSorting));
2493 cmbColorHistorySorting->setEnabled(chkShowColorHistory->isChecked());
2494 lblColorHistorySorting->setEnabled(chkShowColorHistory->isChecked());
2495 grpFixTriangleRotation->setEnabled(!cmbSelectorType->currentIndex());
2496}
2497
2499{
2500 using namespace PopupPaletteTabPrivate;
2501
2502 KisConfig config(true);
2503 config.setFavoritePresets(sbNumPresets->value());
2504 config.writeEntry("popuppalette/size", sbPaletteSize->value());
2505 config.writeEntry("popuppalette/selectorSize", sbSelectorSize->value());
2506 config.writeEntry<bool>("popuppalette/usevisualcolorselector", cmbSelectorType->currentIndex() > 0);
2507 config.writeEntry<bool>("popuppalette/showColorHistory", chkShowColorHistory->isChecked());
2508 config.writeEntry<bool>("popuppalette/showRotationTrack", chkShowRotationTrack->isChecked());
2509 config.writeEntry<bool>("popuppalette/useDynamicSlotCount", chkUseDynamicSlotCount->isChecked());
2510 config.writeEntry("popuppalette/colorHistorySorting",
2511 allowedColorHistorySortingValues[cmbColorHistorySorting->currentIndex()]);
2512 config.writeEntry<bool>("popuppalette/fixTriangleRotation", grpFixTriangleRotation->isChecked());
2513 config.writeEntry("popuppalette/triangleRotationAngle", sbTriangleRotationAngle->value());
2514}
2515
2517{
2518 KisConfig config(true);
2519 sbNumPresets->setValue(config.favoritePresets(true));
2520 sbPaletteSize->setValue(385);
2521 sbSelectorSize->setValue(140);
2522 cmbSelectorType->setCurrentIndex(0);
2523 chkShowColorHistory->setChecked(true);
2524 chkShowRotationTrack->setChecked(true);
2525 chkUseDynamicSlotCount->setChecked(true);
2526 cmbColorHistorySorting->setEnabled(chkShowColorHistory->isChecked());
2527 lblColorHistorySorting->setEnabled(chkShowColorHistory->isChecked());
2528 grpFixTriangleRotation->setChecked(false);
2529 sbTriangleRotationAngle->setValue(0);
2530}
2531
2533 grpFixTriangleRotation->setEnabled(!index);
2534}
2535
2536//---------------------------------------------------------------------------------------------------
2537
2538KisDlgPreferences::KisDlgPreferences(QWidget* parent, const char* name)
2539 : KPageDialog(parent)
2540{
2541 Q_UNUSED(name);
2542 setWindowTitle(i18n("Configure Krita"));
2543 setStandardButtons(QDialogButtonBox::Ok | QDialogButtonBox::Cancel | QDialogButtonBox::RestoreDefaults);
2544
2545 setFaceType(KPageDialog::List);
2546
2547 // General
2548 KoVBox *vbox = new KoVBox();
2549 KPageWidgetItem *page = new KPageWidgetItem(vbox, i18n("General"));
2550 page->setObjectName("general");
2551 page->setHeader(i18n("General"));
2552 page->setIcon(KisIconUtils::loadIcon("config-general"));
2553 m_pages << page;
2554 addPage(page);
2555 m_general = new GeneralTab(vbox);
2556
2557 // Shortcuts
2558 vbox = new KoVBox();
2559 page = new KPageWidgetItem(vbox, i18n("Keyboard Shortcuts"));
2560 page->setObjectName("shortcuts");
2561 page->setHeader(i18n("Shortcuts"));
2562 page->setIcon(KisIconUtils::loadIcon("config-keyboard"));
2563 m_pages << page;
2564 addPage(page);
2566 connect(this, SIGNAL(accepted()), m_shortcutSettings, SLOT(saveChanges()));
2567 connect(this, SIGNAL(rejected()), m_shortcutSettings, SLOT(cancelChanges()));
2568
2569 // Canvas input settings
2571 page = addPage(m_inputConfiguration, i18n("Canvas Input Settings"));
2572 page->setHeader(i18n("Canvas Input"));
2573 page->setObjectName("canvasinput");
2574 page->setIcon(KisIconUtils::loadIcon("config-canvas-input"));
2575 m_pages << page;
2576
2577 // Display
2578 vbox = new KoVBox();
2579 page = new KPageWidgetItem(vbox, i18n("Display"));
2580 page->setObjectName("display");
2581 page->setHeader(i18n("Display"));
2582 page->setIcon(KisIconUtils::loadIcon("config-display"));
2583 m_pages << page;
2584 addPage(page);
2586
2587 // Color
2588 vbox = new KoVBox();
2589 page = new KPageWidgetItem(vbox, i18n("Color Management"));
2590 page->setObjectName("colormanagement");
2591 page->setHeader(i18nc("Label of color as in Color Management", "Color"));
2592 page->setIcon(KisIconUtils::loadIcon("config-color-manage"));
2593 m_pages << page;
2594 addPage(page);
2596
2597 // Performance
2598 vbox = new KoVBox();
2599 page = new KPageWidgetItem(vbox, i18n("Performance"));
2600 page->setObjectName("performance");
2601 page->setHeader(i18n("Performance"));
2602 page->setIcon(KisIconUtils::loadIcon("config-performance"));
2603 m_pages << page;
2604 addPage(page);
2606
2607 // Tablet
2608 vbox = new KoVBox();
2609 page = new KPageWidgetItem(vbox, i18n("Tablet settings"));
2610 page->setObjectName("tablet");
2611 page->setHeader(i18n("Tablet"));
2612 page->setIcon(KisIconUtils::loadIcon("config-tablet"));
2613 m_pages << page;
2614 addPage(page);
2616
2617 // full-screen mode
2618 vbox = new KoVBox();
2619 page = new KPageWidgetItem(vbox, i18n("Canvas-only settings"));
2620 page->setObjectName("canvasonly");
2621 page->setHeader(i18n("Canvas-only"));
2622 page->setIcon(KisIconUtils::loadIcon("config-canvas-only"));
2623 m_pages << page;
2624 addPage(page);
2626
2627 // Pop-up Palette
2628 vbox = new KoVBox();
2629 page = new KPageWidgetItem(vbox, i18n("Pop-up Palette"));
2630 page->setObjectName("popuppalette");
2631 page->setHeader(i18n("Pop-up Palette"));
2632 page->setIcon(KisIconUtils::loadIcon("config-popup-palette"));
2633 m_pages << page;
2634 addPage(page);
2636
2637 // Author profiles
2639 page = addPage(m_authorPage, i18nc("@title:tab Author page", "Author" ));
2640 page->setObjectName("author");
2641 page->setHeader(i18n("Author"));
2642 page->setIcon(KisIconUtils::loadIcon("user-identity"));
2643 m_pages << page;
2644
2645 KGuiItem::assign(button(QDialogButtonBox::Ok), KStandardGuiItem::ok());
2646 KGuiItem::assign(button(QDialogButtonBox::Cancel), KStandardGuiItem::cancel());
2647 QPushButton *restoreDefaultsButton = button(QDialogButtonBox::RestoreDefaults);
2648 restoreDefaultsButton->setText(i18nc("@action:button", "Restore Defaults"));
2649
2650 connect(this, SIGNAL(accepted()), m_inputConfiguration, SLOT(saveChanges()));
2651 connect(this, SIGNAL(rejected()), m_inputConfiguration, SLOT(revertChanges()));
2652
2654 QStringList keys = preferenceSetRegistry->keys();
2655 keys.sort();
2656 Q_FOREACH(const QString &key, keys) {
2657 KisAbstractPreferenceSetFactory *preferenceSetFactory = preferenceSetRegistry->value(key);
2658 KisPreferenceSet* preferenceSet = preferenceSetFactory->createPreferenceSet();
2659 vbox = new KoVBox();
2660 page = new KPageWidgetItem(vbox, preferenceSet->name());
2661 page->setHeader(preferenceSet->header());
2662 page->setIcon(preferenceSet->icon());
2663 addPage(page);
2664 preferenceSet->setParent(vbox);
2665 preferenceSet->loadPreferences();
2666
2667 connect(restoreDefaultsButton, SIGNAL(clicked(bool)), preferenceSet, SLOT(loadDefaultPreferences()), Qt::UniqueConnection);
2668 connect(this, SIGNAL(accepted()), preferenceSet, SLOT(savePreferences()), Qt::UniqueConnection);
2669 }
2670
2671 connect(restoreDefaultsButton, SIGNAL(clicked(bool)), this, SLOT(slotDefault()));
2672
2673 KisConfig cfg(true);
2674 QString currentPageName = cfg.readEntry<QString>("KisDlgPreferences/CurrentPage");
2675 Q_FOREACH(KPageWidgetItem *page, m_pages) {
2676 if (page->objectName() == currentPageName) {
2677 setCurrentPage(page);
2678 break;
2679 }
2680 }
2681
2682 // TODO QT6: check what this code actually does?
2683#if (QT_VERSION < QT_VERSION_CHECK(6, 0, 0))
2684 {
2685 // HACK ALERT! Remove title widget background, thus making
2686 // it consistent across all systems
2687 const auto *titleWidget = findChild<KTitleWidget*>();
2688 if (titleWidget) {
2689 QLayoutItem *titleFrame = titleWidget->layout()->itemAt(0); // vboxLayout -> titleFrame
2690 if (titleFrame) {
2691 titleFrame->widget()->setBackgroundRole(QPalette::Window);
2692 }
2693 }
2694 }
2695#endif
2696}
2697
2699{
2700 KisConfig cfg(true);
2701 cfg.writeEntry<QString>("KisDlgPreferences/CurrentPage", currentPage()->objectName());
2702}
2703
2704void KisDlgPreferences::showEvent(QShowEvent *event){
2705 KPageDialog::showEvent(event);
2706 button(QDialogButtonBox::Cancel)->setAutoDefault(false);
2707 button(QDialogButtonBox::Ok)->setAutoDefault(false);
2708 button(QDialogButtonBox::RestoreDefaults)->setAutoDefault(false);
2709 button(QDialogButtonBox::Cancel)->setDefault(false);
2710 button(QDialogButtonBox::Ok)->setDefault(false);
2711 button(QDialogButtonBox::RestoreDefaults)->setDefault(false);
2712}
2713
2715{
2716 if (buttonBox()->buttonRole(button) == QDialogButtonBox::RejectRole) {
2717 m_cancelClicked = true;
2718 }
2719}
2720
2722{
2723 if (currentPage()->objectName() == "general") {
2725 }
2726 else if (currentPage()->objectName() == "shortcuts") {
2728 }
2729 else if (currentPage()->objectName() == "display") {
2731 }
2732 else if (currentPage()->objectName() == "colormanagement") {
2734 }
2735 else if (currentPage()->objectName() == "performance") {
2737 }
2738 else if (currentPage()->objectName() == "tablet") {
2740 }
2741 else if (currentPage()->objectName() == "canvasonly") {
2743 }
2744 else if (currentPage()->objectName() == "canvasinput") {
2746 }
2747 else if (currentPage()->objectName() == "popuppalette") {
2749 }
2750}
2751
2753{
2754 connect(this->buttonBox(), SIGNAL(clicked(QAbstractButton*)), this, SLOT(slotButtonClicked(QAbstractButton*)));
2755
2756 int retval = exec();
2757 Q_UNUSED(retval);
2758
2759 if (!m_cancelClicked) {
2760 // General settings
2761 KisConfig cfg(false);
2762 KisImageConfig cfgImage(false);
2763
2766 cfg.setSeparateEraserCursor(m_general->m_chkSeparateEraserCursor->isChecked());
2774
2777 cfg.setForceAlwaysFullSizedOutline(!m_general->m_changeBrushOutline->isChecked());
2779 cfg.setForceAlwaysFullSizedEraserOutline(!m_general->m_changeEraserBrushOutline->isChecked());
2782
2783 KConfigGroup group = KSharedConfig::openConfig()->group("File Dialogs");
2784 group.writeEntry("DontUseNativeFileDialog", !m_general->m_chkNativeFileDialog->isChecked());
2785
2786 cfgImage.setMaxBrushSize(m_general->intMaxBrushSize->value());
2787 cfg.setIgnoreHighFunctionKeys(m_general->chkIgnoreHighFunctionKeys->isChecked());
2788
2789 cfg.writeEntry<bool>("use_custom_system_font", m_general->chkUseCustomFont->isChecked());
2790 if (m_general->chkUseCustomFont->isChecked()) {
2791 cfg.writeEntry<QString>("custom_system_font", m_general->cmbCustomFont->currentFont().family());
2792 cfg.writeEntry<int>("custom_font_size", m_general->intFontSize->value());
2793 }
2794 else {
2795 cfg.writeEntry<QString>("custom_system_font", "");
2796 cfg.writeEntry<int>("custom_font_size", -1);
2797 }
2798
2799 cfg.writeEntry<int>("mdi_viewmode", m_general->mdiMode());
2800 cfg.setMDIBackgroundColor(m_general->m_mdiColor->color().toXML());
2801 cfg.setMDIBackgroundImage(m_general->m_backgroundimage->text());
2802 cfg.writeEntry<int>("mdi_rubberband", m_general->m_chkRubberBand->isChecked());
2804 cfg.writeEntry("autosavefileshidden", m_general->chkHideAutosaveFiles->isChecked());
2805
2806 cfg.setBackupFile(m_general->m_backupFileCheckBox->isChecked());
2807 cfg.writeEntry("backupfilelocation", m_general->cmbBackupFileLocation->currentIndex());
2808 cfg.writeEntry("backupfilesuffix", m_general->txtBackupFileSuffix->text());
2809 cfg.writeEntry("numberofbackupfiles", m_general->intNumBackupFiles->value());
2810
2811
2819
2820 const QString configPath = QStandardPaths::writableLocation(QStandardPaths::GenericConfigLocation);
2821 QSettings kritarc(configPath + QStringLiteral("/kritadisplayrc"), QSettings::IniFormat);
2822 kritarc.setValue("EnableHiDPI", m_general->m_chkHiDPI->isChecked());
2823#if defined(Q_OS_WIN) && defined(HAVE_HIGH_DPI_SCALE_FACTOR_ROUNDING_POLICY)
2824 kritarc.setValue("EnableHiDPIFractionalScaling", m_general->m_chkHiDPIFractionalScaling->isChecked());
2825#endif
2826 kritarc.setValue("LogUsage", m_general->chkUsageLogging->isChecked());
2827
2829
2830 cfg.writeEntry<bool>("useCreamyAlphaDarken", (bool)!m_general->cmbFlowMode->currentIndex());
2831 cfg.writeEntry<bool>("useSubtractiveBlendingForCmykColorSpaces", (bool)!m_general->cmbCmykBlendingMode->currentIndex());
2832
2839
2841
2843 cfg.setTouchPainting(KisConfig::TouchPainting(m_general->cmbTouchPainting->currentIndex()));
2844 cfg.writeEntry("useTouchPressureSensitivity", m_general->chkTouchPressureSensitivity->isChecked());
2845 cfg.setActivateTransformToolAfterPaste(m_general->chkEnableTransformToolAfterPaste->isChecked());
2846 cfg.setZoomHorizontal(m_general->chkZoomHorizontally->isChecked());
2847 cfg.setSelectionActionBar(m_general->chkEnableSelectionActionBar->isChecked());
2850 cfg.setCumulativeUndoRedo(m_general->chkCumulativeUndo->isChecked());
2852
2853 // Animation..
2857
2858#ifdef Q_OS_ANDROID
2859 QFileInfo fi(m_general->m_resourceFolderSelector->currentData(Qt::UserRole).value<QString>());
2860#else
2861 QFileInfo fi(m_general->m_urlResourceFolder->fileName());
2862#endif
2863 if (fi.isWritable()) {
2865 }
2866
2870
2871 // Color settings
2873 cfg.setUseSystemMonitorProfile(m_colorSettings->m_page->chkUseSystemMonitorProfile->isChecked());
2874 for (int i = 0; i < QApplication::screens().count(); ++i) {
2875 if (m_colorSettings->m_page->chkUseSystemMonitorProfile->isChecked()) {
2876 int currentIndex = m_colorSettings->m_monitorProfileWidgets[i]->currentIndex();
2877 QString monitorid = m_colorSettings->m_monitorProfileWidgets[i]->itemData(currentIndex).toString();
2878 cfg.setMonitorForScreen(i, monitorid);
2879 } else {
2880 cfg.setMonitorProfile(i,
2881 m_colorSettings->m_monitorProfileWidgets[i]->currentUnsqueezedText(),
2882 m_colorSettings->m_page->chkUseSystemMonitorProfile->isChecked());
2883 }
2884 }
2885 } else {
2889 }
2890 cfg.setUseDefaultColorSpace(m_colorSettings->m_page->useDefColorSpace->isChecked());
2891 if (cfg.useDefaultColorSpace())
2892 {
2893 KoID currentWorkingColorSpace = m_colorSettings->m_page->cmbWorkingColorSpace->currentItem();
2894 cfg.setWorkingColorSpace(currentWorkingColorSpace.id());
2895 cfg.defColorModel(KoColorSpaceRegistry::instance()->colorSpaceColorModelId(currentWorkingColorSpace.id()).id());
2896 cfg.setDefaultColorDepth(KoColorSpaceRegistry::instance()->colorSpaceColorDepthId(currentWorkingColorSpace.id()).id());
2897 }
2898
2899 cfg.writeEntry("ExrDefaultColorProfile", m_colorSettings->m_page->cmbColorProfileForEXR->currentText());
2900
2901 cfgImage.setDefaultProofingConfig(*m_colorSettings->m_page->wdgProofingOptions->currentProofingConfig());
2902 cfg.setUseBlackPointCompensation(m_colorSettings->m_page->chkBlackpoint->isChecked());
2903 cfg.setAllowLCMSOptimization(m_colorSettings->m_page->chkAllowLCMSOptimization->isChecked());
2904 cfg.setForcePaletteColors(m_colorSettings->m_page->chkForcePaletteColor->isChecked());
2906 cfg.setRenderIntent(m_colorSettings->m_page->cmbMonitorIntent->currentIndex());
2907
2908 // Tablet settings
2909 cfg.setPressureTabletCurve( m_tabletSettings->m_page->pressureCurve->curve().toString() );
2911 m_tabletSettings->m_page->chkUseRightMiddleClickWorkaround->isChecked());
2912
2913#if defined Q_OS_WIN && (defined QT5_HAS_WINTAB_SWITCH || QT_VERSION >= QT_VERSION_CHECK(6, 0, 0))
2914 cfg.setUseWin8PointerInput(m_tabletSettings->m_page->radioWin8PointerInput->isChecked());
2915
2916# if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0)
2917 // Qt6 supports switching the tablet API on the fly
2918 using QWindowsApplication = QNativeInterface::Private::QWindowsApplication;
2919 if (auto nativeWindowsApp = dynamic_cast<QWindowsApplication *>(QGuiApplicationPrivate::platformIntegration())) {
2920 nativeWindowsApp->setWinTabEnabled(!cfg.useWin8PointerInput());
2921 }
2922# endif
2923#endif
2924 cfg.writeEntry<bool>("useTimestampsForBrushSpeed", m_tabletSettings->m_page->chkUseTimestampsForBrushSpeed->isChecked());
2925
2926#if KRITA_QT_HAS_ANDROID_EMULATE_MOUSE_BUTTONS_FOR_PAGE_UP_DOWN
2927 cfg.setUsePageUpDownMouseButtonEmulationWorkaround(
2928 m_tabletSettings->m_page->chkUsePageUpDownMouseButtonEmulationWorkaround->isChecked());
2929#endif
2930
2931#if KRITA_QT_HAS_ANDROID_EMULATE_MOUSE_BUTTONS_FOR_HIGH_FUNCTION_KEYS
2932 cfg.setUseHighFunctionKeyMouseButtonEmulationWorkaround(
2933 m_tabletSettings->m_page->chkUseHighFunctionKeyMouseButtonEmulationWorkaround->isChecked());
2934#endif
2935
2936#if KRITA_QT_HAS_ANDROID_IGNORE_HISTORIC_TABLET_EVENTS
2937 cfg.setUseIgnoreHistoricTabletEventsWorkaround(
2938 m_tabletSettings->m_page->chkUseIgnoreHistoricTabletEventsWorkaround->isChecked());
2939#endif
2940
2941 cfg.writeEntry<int>("maxAllowedSpeedValue", m_tabletSettings->m_page->intMaxAllowedBrushSpeed->value());
2942 cfg.writeEntry<int>("speedValueSmoothing", m_tabletSettings->m_page->intBrushSpeedSmoothing->value());
2943 // the angle is saved in clockwise direction to be consistent with Drawing Angle, so negate
2944 cfg.writeEntry<int>("tiltDirectionOffset", -m_tabletSettings->m_page->tiltDirectionOffsetAngle->angle());
2945
2947
2948 if (!cfg.useOpenGL() && m_displaySettings->grpOpenGL->isChecked())
2949 cfg.setCanvasState("TRY_OPENGL");
2950
2951 if (m_displaySettings->grpOpenGL->isChecked()) {
2953 m_displaySettings->cmbPreferredRenderer->itemData(
2954 m_displaySettings->cmbPreferredRenderer->currentIndex()).toInt());
2956 } else {
2958 }
2959
2960 if (KisOpenGL::xcbGlProviderProtocol().has_value()) {
2961 cfg.setPreferXcbEglProvider(m_displaySettings->cmbPreferredXcbGlApi->currentData().value<KisOpenGL::XcbGLProviderProtocol>() == KisOpenGL::XCB_EGL);
2962 }
2963
2964 cfg.setUseOpenGLTextureBuffer(m_displaySettings->chkUseTextureBuffer->isChecked());
2965 cfg.setOpenGLFilteringMode(m_displaySettings->cmbFilterMode->currentIndex());
2966 cfg.setRootSurfaceFormat(&kritarc, indexToFormat(m_displaySettings->cmbPreferedRootSurfaceFormat->currentIndex()));
2967 cfg.setAssistantsDrawMode(indexToAssistantDrawMode(m_displaySettings->cmbAssistantsDrawMode->currentIndex()));
2968
2969 cfg.setCheckSize(m_displaySettings->intCheckSize->value());
2970 cfg.setScrollingCheckers(m_displaySettings->chkMoving->isChecked());
2971 cfg.setCheckersColor1(m_displaySettings->colorChecks1->color().toQColor());
2972 cfg.setCheckersColor2(m_displaySettings->colorChecks2->color().toQColor());
2973 cfg.setCanvasBorderColor(m_displaySettings->canvasBorder->color().toQColor());
2974 cfg.setHideScrollbars(m_displaySettings->hideScrollbars->isChecked());
2975 KoColor c = m_displaySettings->btnSelectionOverlayColor->color();
2976 c.setOpacity(m_displaySettings->sldSelectionOverlayOpacity->value());
2978 cfgImage.setSelectionOutlineOpacity(m_displaySettings->sldSelectionOutlineOpacity->value());
2979 cfg.setAntialiasCurves(m_displaySettings->chkCurveAntialiasing->isChecked());
2980 cfg.setAntialiasSelectionOutline(m_displaySettings->chkSelectionOutlineAntialiasing->isChecked());
2981 cfg.setShowSingleChannelAsColor(m_displaySettings->chkChannelsAsColor->isChecked());
2982 cfg.setHidePopups(m_displaySettings->chkHidePopups->isChecked());
2983
2984 cfg.setHideDockersFullscreen(m_fullscreenSettings->chkDockers->checkState());
2985 cfg.setHideMenuFullscreen(m_fullscreenSettings->chkMenu->checkState());
2986 cfg.setHideScrollbarsFullscreen(m_fullscreenSettings->chkScrollbars->checkState());
2987 cfg.setHideStatusbarFullscreen(m_fullscreenSettings->chkStatusbar->checkState());
2988 cfg.setHideTitlebarFullscreen(m_fullscreenSettings->chkTitlebar->checkState());
2989 cfg.setHideToolbarFullscreen(m_fullscreenSettings->chkToolbar->checkState());
2990
2991 cfg.setCursorMainColor(m_general->cursorColorButton->color().toQColor());
2992 cfg.setEraserCursorMainColor(m_general->eraserCursorColorButton->color().toQColor());
2993 cfg.setPixelGridColor(m_displaySettings->pixelGridColorButton->color().toQColor());
2994 cfg.setPixelGridDrawingThreshold(m_displaySettings->pixelGridDrawingThresholdBox->value() / 100);
2995
2998
3000 cfg.writeEntry("forcedDpiForQtFontBugWorkaround", m_general->forcedFontDpi());
3001 }
3002
3003 return !m_cancelClicked;
3004}
qreal length(const QPointF &vec)
Definition Ellipse.cc:82
float value(const T *src, size_t ch)
qreal u
QList< QString > QStringList
const KoID AlphaColorModelID("A", ki18n("Alpha mask"))
const KoID Float16BitsColorDepthID("F16", ki18n("16-bit float/channel"))
const KoID RGBAColorModelID("RGBA", ki18n("RGB/Alpha"))
Q_GUI_EXPORT int qt_defaultDpi()
void toggleUseDefaultColorSpace(bool useDefColorSpace)
QList< QLabel * > m_monitorProfileLabels
void toggleAllowMonitorProfileSelection(bool useSystemProfile)
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)
ColorSettingsTab(QWidget *parent=0, const char *name=0)
WdgColorSettings * m_page
DisplaySettingsTab(QWidget *parent=0, const char *name=0)
void slotUseOpenGLToggled(bool isChecked)
void slotPreferredSurfaceFormatChanged(int index)
FullscreenSettingsTab(QWidget *parent)
KisConfig::SessionOnStartup sessionOnStartup() const
bool kineticScrollingHiddenScrollbars()
bool saveSessionOnQuit() const
void showAdvancedCumulativeUndoSettings()
int colorSamplerPreviewCircleDiameter() const
bool autoZoomTimelineToPlaybackRange()
void colorSamplePreviewThicknessChanged(qreal value)
KisConfig::ColorSamplerPreviewStyle colorSamplerPreviewStyle() const
void colorSamplePreviewOutlineEnabledChanged(int value)
void colorSamplePreviewStyleChanged(int index)
bool colorSamplerPreviewCircleExtraCirclesEnabled() const
bool convertToImageColorspaceOnImport()
QButtonGroup m_pasteFormatGroup
OutlineStyle eraserOutlineStyle()
static KisConfig::ColorSamplerPreviewStyle getColorSamplerPreviewStyleValue(const QComboBox *cmb)
int kineticScrollingSensitivity()
void colorSamplePreviewSizeChanged(int value)
KisCumulativeUndoData m_cumulativeUndoData
QString exportMimeType()
void updateTouchPressureSensitivityEnabled(int)
bool showOutlineWhilePainting()
CursorStyle eraserCursorStyle()
static void setColorSamplerPreviewStyleItems(QComboBox *cmb)
static void setColorSamplerPreviewStyleIndexByValue(QComboBox *cmb, KisConfig::ColorSamplerPreviewStyle style)
void enableSubWindowOptions(int)
bool colorSamplerPreviewCircleOutlineEnabled() const
OutlineStyle outlineStyle()
bool showEraserOutlineWhilePainting()
CursorStyle cursorStyle()
qreal colorSamplerPreviewCircleThickness() const
GeneralTab(QWidget *parent=0, const char *name=0)
virtual KisPreferenceSet * createPreferenceSet()=0
static KisActionRegistry * instance()
The KisActionsSnapshot class.
void connectBackwardInt(QObject *sender, const char *signal, QObject *receiver, const char *method)
void connectForwardInt(QObject *sender, const char *signal, QObject *receiver, const char *method)
@ FlipOptionsMode_MenuButton
The flip options are shown as a menu accessible via a options button.
QStringList devices(DeviceType type=screen) const
Return a list of device id's for the specified type.
static KisColorManager * instance()
void setCumulativeUndoData(KisCumulativeUndoData value)
bool backupFile(bool defaultValue=false) const
void setAntialiasCurves(bool v) const
void setSwitchSelectionCtrlAlt(bool value)
bool antialiasSelectionOutline(bool defaultValue=false) const
void setZoomSteps(int steps)
@ ASSISTANTS_DRAW_MODE_PIXMAP_CACHE
Definition kis_config.h:806
@ ASSISTANTS_DRAW_MODE_DIRECT
Definition kis_config.h:805
@ ASSISTANTS_DRAW_MODE_LARGE_PIXMAP_CACHE
Definition kis_config.h:807
int zoomSteps(bool defaultValue=false) const
void setHideDockersFullscreen(const bool value) const
static CanvasSurfaceBitDepthMode canvasSurfaceBitDepthMode(QSettings *settings, bool defaultValue=false)
void setAdaptivePlaybackRange(bool value)
void setEnableCanvasSurfaceColorSpaceManagement(bool value)
bool colorSamplerPreviewCircleOutlineEnabled(bool defaultValue=false) const
void setPasteFormat(qint32 format)
QColor checkersColor2(bool defaultValue=false) const
void setColorSamplerPreviewCircleOutlineEnabled(bool enabled)
void setUseRightMiddleTabletButtonWorkaround(bool value)
void setCheckersColor1(const QColor &v) const
void setHidePopups(bool hidePopups)
void setMDIBackgroundColor(const QString &v) const
QString pressureTabletCurve(bool defaultValue=false) const
void setUndoStackLimit(int limit) const
bool hideScrollbars(bool defaultValue=false) const
int openGLFilteringMode(bool defaultValue=false) const
void setUseZip64(bool value)
bool showSingleChannelAsColor(bool defaultValue=false) const
void setHideToolbarFullscreen(const bool value) const
void setCanvasState(const QString &state) const
int kineticScrollingSensitivity(bool defaultValue=false) const
bool convertToImageColorspaceOnImport(bool defaultValue=false) const
int zoomMarginSize(bool defaultValue=false) const
void setAutoZoomTimelineToPlaybackRange(bool value)
bool showRootLayer(bool defaultValue=false) const
qint32 pasteFormat(bool defaultValue) const
void setEnableBrushSpeedLogging(bool value) const
void setExportMimeType(const QString &defaultExportMimeType)
void setUseWin8PointerInput(bool value)
qreal getPixelGridDrawingThreshold(bool defaultValue=false) const
bool switchSelectionCtrlAlt(bool defaultValue=false) const
void writeEntry(const QString &name, const T &value)
Definition kis_config.h:825
void setRenamePastedLayers(bool value)
QColor checkersColor1(bool defaultValue=false) const
void setHideScrollbars(bool value) const
bool allowLCMSOptimization(bool defaultValue=false) const
static void setCanvasSurfaceBitDepthMode(QSettings *settings, CanvasSurfaceBitDepthMode value)
void setIgnoreHighFunctionKeys(bool value)
bool activateTransformToolAfterPaste(bool defaultValue=false) const
void setNewCursorStyle(CursorStyle style)
bool hideDockersFullscreen(bool defaultValue=false) const
void setEraserCursorStyle(CursorStyle style)
bool compressKra(bool defaultValue=false) const
static bool preferXcbEglProvider(const QSettings *settings, bool defaultValue=false)
bool disableVectorOptimizations(bool defaultValue=false) const
void setCursorMainColor(const QColor &v) const
void setColorSamplerPreviewCircleThickness(qreal thickness)
void setCanvasSurfaceColorSpaceManagementMode(CanvasSurfaceMode value)
void setCumulativeUndoRedo(bool value)
void setConvertToImageColorspaceOnImport(bool value)
void setPixelGridColor(const QColor &v) const
void setToolOptionsInDocker(bool inDocker)
void setForceAlwaysFullSizedOutline(bool value) const
void setLongPressEnabled(bool value)
SessionOnStartup sessionOnStartup(bool defaultValue=false) const
void setForcePaletteColors(bool forcePaletteColors)
void setHideTitlebarFullscreen(const bool value) const
bool enableOpenGLFramerateLogging(bool defaultValue=false) const
QColor getPixelGridColor(bool defaultValue=false) const
bool useDefaultColorSpace(bool defaultvalue=false) const
bool hideMenuFullscreen(bool defaultValue=false) const
QString getMDIBackgroundColor(bool defaultValue=false) const
void setMonitorProfile(int screen, const QString &monitorProfile, bool override) const
void setUseDefaultColorSpace(bool value) const
void setDefaultColorDepth(const QString &depth) const
bool hideScrollbarsFullscreen(bool defaultValue=false) const
TouchPainting touchPainting(bool defaultValue=false) const
void setSeparateEraserCursor(bool value) const
qint32 monitorRenderIntent(bool defaultValue=false) const
void setActivateTransformToolAfterPaste(bool value)
int kineticScrollingGesture(bool defaultValue=false) const
bool useZip64(bool defaultValue=false) const
bool calculateAnimationCacheInBackground(bool defaultValue=false) const
int favoritePresets(bool defaultValue=false) const
bool zoomHorizontal(bool defaultValue=false) const
QString getMDIBackgroundImage(bool defaultValue=false) const
void setAssistantsDrawMode(AssistantsDrawMode value)
CanvasSurfaceMode canvasSurfaceColorSpaceManagementMode(bool defaultValue=false) const
bool hideToolbarFullscreen(bool defaultValue=false) const
bool showCanvasMessages(bool defaultValue=false) const
void setUseSystemMonitorProfile(bool _useSystemMonitorProfile) const
bool useWin8PointerInput(bool defaultValue=false) const
bool useOpenGLTextureBuffer(bool defaultValue=false) const
void setCalculateAnimationCacheInBackground(bool value)
void setColorSamplerPreviewCircleExtraCirclesEnabled(bool enabled)
void setAutoSaveInterval(int seconds) const
void setShowSingleChannelAsColor(bool asColor)
void setTrimFramesImport(bool trim)
bool forcePaletteColors(bool defaultValue=false) const
void setAllowLCMSOptimization(bool allowLCMSOptimization)
void setColorSamplerPreviewCircleDiameter(int style)
void setRenderIntent(qint32 monitorRenderIntent) const
void setFavoritePresets(const int value)
void setEraserOutlineStyle(OutlineStyle style)
void setShowOutlineWhilePainting(bool showOutlineWhilePainting) const
RootSurfaceFormat rootSurfaceFormat(bool defaultValue=false) const
QColor canvasBorderColor(bool defaultValue=false) const
int colorSamplerPreviewCircleDiameter(bool defaultValue=false) const
QString exportMimeType(bool defaultValue) const
void setScrollingCheckers(bool scrollCheckers) const
const QString getScreenStringIdentfier(int screenNo) const
void setBackupFile(bool backupFile) const
void logImportantSettings() const
Log the most interesting settings to the usage log.
Definition kis_config.cc:77
CursorStyle newCursorStyle(bool defaultValue=false) const
bool useCumulativeUndoRedo(bool defaultValue=false) const
void setCheckSize(qint32 checkSize) const
CursorStyle eraserCursorStyle(bool defaultValue=false) const
void setKineticScrollingGesture(int kineticScroll)
void setPreferXcbEglProvider(bool value)
void setPixelGridDrawingThreshold(qreal v) const
void setMonitorForScreen(int screen, const QString &monitor)
void setCanvasBorderColor(const QColor &color) const
QString monitorProfile(int screen) const
get the profile the user has selected for the given screen
@ TOUCH_PAINTING_DISABLED
Definition kis_config.h:50
void setShowCanvasMessages(bool show)
qint32 checkSize(bool defaultValue=false) const
void setWorkingColorSpace(const QString &workingColorSpace) const
KisCumulativeUndoData cumulativeUndoData(bool defaultValue=false) const
OutlineStyle newOutlineStyle(bool defaultValue=false) const
bool forceAlwaysFullSizedOutline(bool defaultValue=false) const
ColorSamplerPreviewStyle
Definition kis_config.h:138
void setPressureTabletCurve(const QString &curveString) const
qreal colorSamplerPreviewCircleThickness(bool defaultValue=false) const
QString workingColorSpace(bool defaultValue=false) const
void setEnableOpenGLFramerateLogging(bool value) const
bool renamePastedLayers(bool defaultValue=false) const
void setNewOutlineStyle(OutlineStyle style)
void setCheckersColor2(const QColor &v) const
void setShowRootLayer(bool showRootLayer) const
OutlineStyle eraserOutlineStyle(bool defaultValue=false) const
void setUseBlackPointCompensation(bool useBlackPointCompensation) const
bool kineticScrollingEnabled(bool defaultValue=false) const
void setUseOpenGLTextureBuffer(bool useBuffer)
void setTrimKra(bool trim)
bool hideTitlebarFullscreen(bool defaultValue=false) const
bool useRightMiddleTabletButtonWorkaround(bool defaultValue=false) const
bool longPressEnabled(bool defaultValue=false) const
void setColorSamplerPreviewStyle(ColorSamplerPreviewStyle style)
bool hidePopups(bool defaultValue=false) const
bool enableCanvasSurfaceColorSpaceManagement(bool defaultValue=false) const
void setRootSurfaceFormat(RootSurfaceFormat value)
bool autoPinLayersToTimeline(bool defaultValue=false) const
bool toolOptionsInDocker(bool defaultValue=false) const
void setOpenGLFilteringMode(int filteringMode)
void setKineticScrollingHideScrollbars(bool scrollbar)
void setAntialiasSelectionOutline(bool v) const
bool trimKra(bool defaultValue=false) const
bool enableBrushSpeedLogging(bool defaultValue=false) const
bool forceAlwaysFullSizedEraserOutline(bool defaultValue=false) const
T readEntry(const QString &name, const T &defaultValue=T())
Definition kis_config.h:835
int autoSaveInterval(bool defaultValue=false) const
QString defColorModel(bool defaultValue=false) const
void setDisableVectorOptimizations(bool value)
void setHideStatusbarFullscreen(const bool value) const
void setCompressKra(bool compress)
void setTouchPainting(TouchPainting value) const
bool showOutlineWhilePainting(bool defaultValue=false) const
void setShowEraserOutlineWhilePainting(bool showEraserOutlineWhilePainting) const
void setHideMenuFullscreen(const bool value) const
bool useSystemMonitorProfile(bool defaultValue=false) const
bool autoZoomTimelineToPlaybackRange(bool defaultValue=false) const
bool scrollCheckers(bool defaultValue=false) const
CanvasSurfaceBitDepthMode
Definition kis_config.h:189
void setZoomMarginSize(int zoomMarginSize)
bool hideStatusbarFullscreen(bool defaultValue=false) const
bool colorSamplerPreviewCircleExtraCirclesEnabled(bool defaultValue=false) const
void setZoomHorizontal(bool value)
bool kineticScrollingHiddenScrollbars(bool defaultValue=false) const
bool useOpenGL(bool defaultValue=false) const
bool trimFramesImport(bool defaultValue=false) const
void setForceAlwaysFullSizedEraserOutline(bool value) const
bool selectionActionBar(bool defaultValue=false) const
int undoStackLimit(bool defaultValue=false) const
bool useBlackPointCompensation(bool defaultValue=false) const
bool saveSessionOnQuit(bool defaultValue) const
ColorSamplerPreviewStyle colorSamplerPreviewStyle(bool defaultValue=false) const
void setMDIBackgroundImage(const QString &fileName) const
QColor getCursorMainColor(bool defaultValue=false) const
void setSelectionActionBar(bool value)
qint32 pasteBehaviour(bool defaultValue=false) const
AssistantsDrawMode assistantsDrawMode(bool defaultValue=false) const
bool separateEraserCursor(bool defaultValue=false) const
void setEraserCursorMainColor(const QColor &v) const
void setSaveSessionOnQuit(bool value)
bool disableAVXOptimizations(bool defaultValue=false) const
bool showEraserOutlineWhilePainting(bool defaultValue=false) const
void setPasteBehaviour(qint32 behaviour) const
void setSessionOnStartup(SessionOnStartup value)
void setHideScrollbarsFullscreen(const bool value) const
QString monitorForScreen(int screen, const QString &defaultMonitor, bool defaultValue=true) const
void setAutoPinLayersToTimeline(bool value)
QColor getEraserCursorMainColor(bool defaultValue=false) const
bool antialiasCurves(bool defaultValue=false) const
void setKineticScrollingSensitivity(int sensitivity)
bool ignoreHighFunctionKeys(bool defaultValue=false) const
void setDisableAVXOptimizations(bool value)
bool adaptivePlaybackRange(bool defaultValue=false) const
void setKineticScrollingEnabled(bool enabled)
std::pair< KoColorConversionTransformation::Intent, KoColorConversionTransformation::ConversionFlags > Options
KisCumulativeUndoData cumulativeUndoData() const
KoConfigAuthorPage * m_authorPage
PerformanceTab * m_performanceSettings
ColorSettingsTab * m_colorSettings
PopupPaletteTab * m_popupPaletteSettings
KisInputConfigurationPage * m_inputConfiguration
FullscreenSettingsTab * m_fullscreenSettings
ShortcutSettingsTab * m_shortcutSettings
TabletSettingsTab * m_tabletSettings
QList< KPageWidgetItem * > m_pages
DisplaySettingsTab * m_displaySettings
void slotButtonClicked(QAbstractButton *button)
KisDlgPreferences(QWidget *parent=0, const char *name=0)
void showEvent(QShowEvent *event) override
void setEnableProgressReporting(bool value)
void setUseAnimationCacheRegionOfInterest(bool value)
bool useAnimationCacheFrameSizeLimit(bool defaultValue=false) const
void setAnimationCacheFrameSizeLimit(int value)
void setFrameRenderingClones(int value)
int animationCacheFrameSizeLimit(bool defaultValue=false) const
KisProofingConfigurationSP defaultProofingconfiguration(bool requestDefault=false)
void setMaxNumberOfThreads(int value)
bool useAnimationCacheRegionOfInterest(bool defaultValue=false) const
int frameRenderingClones(bool defaultValue=false) const
void setDetectFpsLimit(bool value)
void setFpsLimit(int value)
QString swapDir(bool requestDefault=false)
int maxNumberOfThreads(bool defaultValue=false) const
qreal memoryPoolLimitPercent(bool requestDefault=false) const
void setEnablePerfLog(bool value)
bool detectFpsLimit(bool defaultValue=false) const
bool enableProgressReporting(bool requestDefault=false) const
void setUseAnimationCacheFrameSizeLimit(bool value)
int fpsLimit(bool defaultValue=false) const
void setSelectionOutlineOpacity(qreal value)
int maxSwapSize(bool requestDefault=false) const
void setUseOnDiskAnimationCacheSwapping(bool value)
qreal animationCacheRegionOfInterestMargin(bool defaultValue=false) const
void setFrameRenderingTimeout(int value)
void setMaxSwapSize(int value)
qreal memoryHardLimitPercent(bool requestDefault=false) const
void setMemorySoftLimitPercent(qreal value)
void setSwapDir(const QString &swapDir)
void setSelectionOverlayMaskColor(const QColor &color)
qreal selectionOutlineOpacity(bool defaultValue=false) const
void setRenameDuplicatedLayers(bool value)
static int totalRAM()
int frameRenderingTimeout(bool defaultValue=false) const
bool enablePerfLog(bool requestDefault=false) const
void setMaxBrushSize(int value)
void setRenameMergedLayers(bool value)
void setDefaultProofingConfig(const KisProofingConfiguration &config)
QColor selectionOverlayMaskColor(bool defaultValue=false) const
qreal memorySoftLimitPercent(bool requestDefault=false) const
void setMemoryHardLimitPercent(qreal value)
bool useOnDiskAnimationCacheSwapping(bool defaultValue=false) const
void setMemoryPoolLimitPercent(qreal value)
void setAnimationCacheRegionOfInterestMargin(qreal value)
static QStringList supportedMimeTypes(Direction direction)
A Configuration Dialog Page to configure the canvas input.
A container for a set of QAction objects.
Q_INVOKABLE QAction * addAction(const QString &name, QAction *action)
QList< QAction * > actions() const
virtual KisKActionCollection * actionCollection() const
Main window for Krita.
static QString descriptionForMimeType(const QString &mimeType)
Find the user-readable description for the given mimetype.
static KisOpenGLModeProber * instance()
QSurfaceFormat surfaceformatInUse() const
static OpenGLRenderer getCurrentOpenGLRenderer()
static OpenGLRenderers getSupportedOpenGLRenderers()
@ RendererSoftware
Definition kis_opengl.h:45
@ RendererDesktopGL
Definition kis_opengl.h:43
@ RendererOpenGLES
Definition kis_opengl.h:44
static QStringList getOpenGLWarnings()
static bool supportsLoD()
static OpenGLRenderer getUserPreferredOpenGLRendererConfig()
static OpenGLRenderer getQtPreferredOpenGLRenderer()
XcbGLProviderProtocol
Definition kis_opengl.h:63
static std::optional< XcbGLProviderProtocol > xcbGlProviderProtocol()
static void setUserPreferredOpenGLRendererConfig(OpenGLRenderer renderer)
static KisPart * instance()
Definition KisPart.cpp:131
KisMainWindow * currentMainwindow() const
Definition KisPart.cpp:459
static KisPlatformPluginInterfaceFactory * instance()
static KisPreferenceSetRegistry * instance()
virtual QIcon icon()=0
virtual QString header()=0
virtual void loadPreferences()=0
virtual QString name()=0
The KisProofingConfigModel class.
static const QString resourceLocationKey
ScreenInfo infoForScreen(QScreen *screen) const
void addCollection(KisKActionCollection *, const QString &title=QString())
static KisSurfaceColorSpaceWrapper fromQtColorSpace(const QColorSpace &colorSpace)
static KoColorSpaceEngineRegistry * instance()
static KoColor fromXML(const QDomElement &elt, const QString &channelDepthId)
Definition KoColor.cpp:350
void setColor(const quint8 *data, const KoColorSpace *colorSpace=0)
Definition KoColor.cpp:186
void setOpacity(quint8 alpha)
Definition KoColor.cpp:333
void fromQColor(const QColor &c)
Convenient function for converting from a QColor.
Definition KoColor.cpp:213
void toQColor(QColor *c) const
a convenience method for the above.
Definition KoColor.cpp:198
const T value(const QString &id) const
T get(const QString &id) const
QList< QString > keys() const
Definition KoID.h:30
QString id() const
Definition KoID.cpp:63
static bool tabletInputReceived()
static void getAllUserResourceFoldersLocationsForWindowsStore(QString &standardLocation, QString &privateLocation)
getAllAppDataLocationsForWindowsStore Use this to get both private and general appdata folders which ...
static QString getAppDataLocation()
static QString saveLocation(const QString &type, const QString &suffix=QString(), bool create=true)
void load(bool requestDefault)
PerformanceTab(QWidget *parent=0, const char *name=0)
QScopedPointer< KisFrameRateLimitModel > m_frameRateModel
void slotThreadsLimitChanged(int value)
QVector< SliderAndSpinBoxSync * > m_syncs
void slotFrameClonesLimitChanged(int value)
PopupPaletteTab(QWidget *parent=0, const char *name=0)
void slotSelectorTypeChanged(int index)
WdgShortcutSettings * m_page
QScopedPointer< KisActionsSnapshot > m_snapshot
ShortcutSettingsTab(QWidget *parent=0, const char *name=0)
WdgTabletSettings * m_page
TabletSettingsTab(QWidget *parent=0, const char *name=0)
bool eventFilter(QObject *, QEvent *event) override
UnscrollableComboBox(QObject *parent)
#define KIS_SAFE_ASSERT_RECOVER(cond)
Definition kis_assert.h:126
#define KIS_SAFE_ASSERT_RECOVER_RETURN(cond)
Definition kis_assert.h:128
#define KIS_SAFE_ASSERT_RECOVER_NOOP(cond)
Definition kis_assert.h:130
int getTotalRAM()
QString shortNameOfDisplay(int index)
Q_GUI_EXPORT int qt_defaultDpi()
OutlineStyle
Definition kis_global.h:53
CursorStyle
Definition kis_global.h:62
#define koIcon(name)
Use these macros for icons without any issues.
Definition kis_icon.h:25
QString button(const QWheelEvent &ev)
QIcon loadIcon(const QString &name)
void setText(QSpinBox *spinBox, const QStringView textTemplate)
void install(QSpinBox *spinBox, std::function< QString(int)> messageFn)
void connectControl(KisCompositeOpListWidget *widget, QObject *source, const char *property)
void connectControlState(QSpinBox *spinBox, QObject *source, const char *readStateProperty, const char *writeProperty)
static const QStringList allowedColorHistorySortingValues({"none", "hsv"})
State validate(QString &line, int &) const override
BackupSuffixValidator(QObject *parent)
const QStringList invalidCharacters
void linkActivated(const QString &link)
virtual bool isSuitableForDisplay() const =0
virtual const KoColorProfile * addProfile(const QString &filename)=0
QString colorSpaceId(const QString &colorModelId, const QString &colorDepthId) const
static KoColorSpaceRegistry * instance()
KoID colorSpaceColorDepthId(const QString &_colorSpaceId) const
QString defaultProfileForColorSpace(const QString &colorSpaceId) const
KoID colorSpaceColorModelId(const QString &_colorSpaceId) const
QList< KoID > listKeys() const
State validate(QString &line, int &) const override
WritableLocationValidator(QObject *parent)