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#ifdef 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#ifdef 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_IGNORE_HISTORIC_TABLET_EVENTS
1626 m_page->chkUseIgnoreHistoricTabletEventsWorkaround->setChecked(cfg.useIgnoreHistoricTabletEventsWorkaround(true));
1627#endif
1628
1629 m_page->chkUseTimestampsForBrushSpeed->setChecked(false);
1630 m_page->intMaxAllowedBrushSpeed->setValue(30);
1631 m_page->intBrushSpeedSmoothing->setValue(3);
1632 m_page->tiltDirectionOffsetAngle->setAngle(0);
1633}
1634
1635TabletSettingsTab::TabletSettingsTab(QWidget* parent, const char* name): QWidget(parent)
1636{
1637 setObjectName(name);
1638
1639 QGridLayout * l = new QGridLayout(this);
1640 l->setContentsMargins(0, 0, 0, 0);
1641 m_page = new WdgTabletSettings(this);
1642 l->addWidget(m_page, 0, 0);
1643
1644 KisConfig cfg(true);
1645 const KisCubicCurve curve(cfg.pressureTabletCurve());
1646 m_page->pressureCurve->setMaximumSize(QSize(QWIDGETSIZE_MAX, QWIDGETSIZE_MAX));
1647 m_page->pressureCurve->setCurve(curve);
1648
1649 m_page->chkUseRightMiddleClickWorkaround->setChecked(
1651
1652#if defined Q_OS_WIN && (defined QT5_HAS_WINTAB_SWITCH || QT_VERSION >= QT_VERSION_CHECK(6, 0, 0))
1653# if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0)
1654 QString actualTabletProtocol = "<unknown>";
1655 using QWindowsApplication = QNativeInterface::Private::QWindowsApplication;
1656 if (auto nativeWindowsApp = dynamic_cast<QWindowsApplication *>(QGuiApplicationPrivate::platformIntegration())) {
1657 actualTabletProtocol = nativeWindowsApp->isWinTabEnabled() ? "WinTab" : "Windows Ink";
1658 }
1659 m_page->grpTabletApi->setTitle(i18n("Tablet Input API (currently active API: \"%1\")", actualTabletProtocol));
1660# endif
1661 m_page->radioWintab->setChecked(!cfg.useWin8PointerInput());
1662 m_page->radioWin8PointerInput->setChecked(cfg.useWin8PointerInput());
1663
1664 connect(m_page->btnResolutionSettings, SIGNAL(clicked()), SLOT(slotResolutionSettings()));
1665 connect(m_page->radioWintab, SIGNAL(toggled(bool)), m_page->btnResolutionSettings, SLOT(setEnabled(bool)));
1666 m_page->btnResolutionSettings->setEnabled(m_page->radioWintab->isChecked());
1667#else
1668 m_page->grpTabletApi->setVisible(false);
1669#endif
1670 connect(m_page->btnTabletTest, SIGNAL(clicked()), SLOT(slotTabletTest()));
1671
1672#ifdef Q_OS_WIN
1673 m_page->chkUseTimestampsForBrushSpeed->setText(i18n("Use tablet driver timestamps for brush speed (may cause severe artifacts when using WinTab tablet API)"));
1674#else
1675 m_page->chkUseTimestampsForBrushSpeed->setText(i18n("Use tablet driver timestamps for brush speed"));
1676#endif
1677 m_page->chkUseTimestampsForBrushSpeed->setChecked(cfg.readEntry("useTimestampsForBrushSpeed", false));
1678
1679#if KRITA_QT_HAS_ANDROID_EMULATE_MOUSE_BUTTONS_FOR_PAGE_UP_DOWN
1680 m_page->chkUsePageUpDownMouseButtonEmulationWorkaround->setChecked(
1681 cfg.usePageUpDownMouseButtonEmulationWorkaround());
1682#else
1683 m_page->chkUsePageUpDownMouseButtonEmulationWorkaround->hide();
1684#endif
1685
1686#if KRITA_QT_HAS_ANDROID_IGNORE_HISTORIC_TABLET_EVENTS
1687 m_page->chkUseIgnoreHistoricTabletEventsWorkaround->setChecked(cfg.useIgnoreHistoricTabletEventsWorkaround());
1688#else
1689 m_page->chkUseIgnoreHistoricTabletEventsWorkaround->hide();
1690#endif
1691
1692 m_page->intMaxAllowedBrushSpeed->setRange(1, 100);
1693 m_page->intMaxAllowedBrushSpeed->setValue(cfg.readEntry("maxAllowedSpeedValue", 30));
1694 KisSpinBoxI18nHelper::install(m_page->intMaxAllowedBrushSpeed, [](int value) {
1695 // i18n: This is meant to be used in a spinbox so keep the {n} in the text
1696 // and it will be substituted by the number. The text before will be
1697 // used as the prefix and the text after as the suffix
1698 return i18np("Maximum brush speed: {n} px/ms", "Maximum brush speed: {n} px/ms", value);
1699 });
1700
1701 m_page->intBrushSpeedSmoothing->setRange(3, 100);
1702 m_page->intBrushSpeedSmoothing->setValue(cfg.readEntry("speedValueSmoothing", 3));
1703 KisSpinBoxI18nHelper::install(m_page->intBrushSpeedSmoothing, [](int value) {
1704 // i18n: This is meant to be used in a spinbox so keep the {n} in the text
1705 // and it will be substituted by the number. The text before will be
1706 // used as the prefix and the text after as the suffix
1707 return i18np("Brush speed smoothing: {n} sample", "Brush speed smoothing: {n} samples", value);
1708 });
1709
1710 m_page->tiltDirectionOffsetAngle->setDecimals(0);
1711 m_page->tiltDirectionOffsetAngle->setRange(-180, 180);
1712 // the angle is saved in clockwise direction to be consistent with Drawing Angle, so negate
1713 m_page->tiltDirectionOffsetAngle->setAngle(-cfg.readEntry("tiltDirectionOffset", 0.0));
1714 m_page->tiltDirectionOffsetAngle->setPrefix(i18n("Pen tilt direction offset: "));
1715 m_page->tiltDirectionOffsetAngle->setFlipOptionsMode(KisAngleSelector::FlipOptionsMode_MenuButton);
1716}
1717
1719{
1720 TabletTestDialog tabletTestDialog(this);
1721 tabletTestDialog.exec();
1722}
1723
1724#ifdef Q_OS_WIN
1726#endif
1727
1729{
1730#ifdef Q_OS_WIN
1732 dlg.exec();
1733#endif
1734}
1735
1736
1737//---------------------------------------------------------------------------------------------------
1739
1741{
1742 return KisImageConfig(true).totalRAM();
1743}
1744
1746{
1747 return intMemoryLimit->value() - intPoolLimit->value();
1748}
1749
1750PerformanceTab::PerformanceTab(QWidget *parent, const char *name)
1751 : WdgPerformanceSettings(parent, name)
1752 , m_frameRateModel(new KisFrameRateLimitModel())
1753{
1754 KisImageConfig cfg(true);
1755 const double totalRAM = cfg.totalRAM();
1756 lblTotalMemory->setText(KFormat().formatByteSize(totalRAM * 1024 * 1024, 0, KFormat::IECBinaryDialect, KFormat::UnitMegaByte));
1757
1758 KisSpinBoxI18nHelper::setText(sliderMemoryLimit, i18nc("{n} is the number value, % is the percent sign", "{n}%"));
1759 sliderMemoryLimit->setRange(1, 100, 2);
1760 sliderMemoryLimit->setSingleStep(0.01);
1761
1762 KisSpinBoxI18nHelper::setText(sliderPoolLimit, i18nc("{n} is the number value, % is the percent sign", "{n}%"));
1763 sliderPoolLimit->setRange(0, 20, 2);
1764 sliderPoolLimit->setSingleStep(0.01);
1765
1766 KisSpinBoxI18nHelper::setText(sliderUndoLimit, i18nc("{n} is the number value, % is the percent sign", "{n}%"));
1767 sliderUndoLimit->setRange(0, 50, 2);
1768 sliderUndoLimit->setSingleStep(0.01);
1769
1770 intMemoryLimit->setMinimumWidth(80);
1771 intPoolLimit->setMinimumWidth(80);
1772 intUndoLimit->setMinimumWidth(80);
1773
1774 {
1775 formLayout->takeRow(2);
1776 label_5->setVisible(false);
1777 intPoolLimit->setVisible(false);
1778 sliderPoolLimit->setVisible(false);
1779 }
1780
1781 SliderAndSpinBoxSync *sync1 =
1782 new SliderAndSpinBoxSync(sliderMemoryLimit,
1783 intMemoryLimit,
1784 getTotalRAM);
1785
1786 sync1->slotParentValueChanged();
1787 m_syncs << sync1;
1788
1789 SliderAndSpinBoxSync *sync2 =
1790 new SliderAndSpinBoxSync(sliderPoolLimit,
1791 intPoolLimit,
1792 std::bind(&KisIntParseSpinBox::value,
1793 intMemoryLimit));
1794
1795
1796 connect(intMemoryLimit, SIGNAL(valueChanged(int)), sync2, SLOT(slotParentValueChanged()));
1797 sync2->slotParentValueChanged();
1798 m_syncs << sync2;
1799
1800 SliderAndSpinBoxSync *sync3 =
1801 new SliderAndSpinBoxSync(sliderUndoLimit,
1802 intUndoLimit,
1804 this));
1805
1806
1807 connect(intPoolLimit, SIGNAL(valueChanged(int)), sync3, SLOT(slotParentValueChanged()));
1808 connect(intMemoryLimit, SIGNAL(valueChanged(int)), sync3, SLOT(slotParentValueChanged()));
1809 sync3->slotParentValueChanged();
1810 m_syncs << sync3;
1811
1812 sliderSwapSize->setSuffix(i18n(" GiB"));
1813 sliderSwapSize->setRange(1, 64);
1814 intSwapSize->setRange(1, 64);
1815
1816
1817 KisAcyclicSignalConnector *swapSizeConnector = new KisAcyclicSignalConnector(this);
1818
1819 swapSizeConnector->connectForwardInt(sliderSwapSize, SIGNAL(valueChanged(int)),
1820 intSwapSize, SLOT(setValue(int)));
1821
1822 swapSizeConnector->connectBackwardInt(intSwapSize, SIGNAL(valueChanged(int)),
1823 sliderSwapSize, SLOT(setValue(int)));
1824
1825 swapFileLocation->setMode(KoFileDialog::OpenDirectory);
1826 swapFileLocation->setConfigurationName("swapfile_location");
1827 swapFileLocation->setFileName(cfg.swapDir());
1828
1829 sliderThreadsLimit->setRange(1, QThread::idealThreadCount());
1830 sliderFrameClonesLimit->setRange(1, QThread::idealThreadCount());
1831
1832 sliderFrameTimeout->setRange(5, 600);
1833 sliderFrameTimeout->setSuffix(i18nc("suffix for \"seconds\"", " sec"));
1834 sliderFrameTimeout->setValue(cfg.frameRenderingTimeout() / 1000);
1835
1836 sliderFpsLimit->setSuffix(i18n(" fps"));
1837
1838 KisWidgetConnectionUtils::connectControlState(sliderFpsLimit, m_frameRateModel.data(), "frameRateState", "frameRate");
1839 KisWidgetConnectionUtils::connectControl(chkDetectFps, m_frameRateModel.data(), "detectFrameRate");
1840
1841 connect(sliderThreadsLimit, SIGNAL(valueChanged(int)), SLOT(slotThreadsLimitChanged(int)));
1842 connect(sliderFrameClonesLimit, SIGNAL(valueChanged(int)), SLOT(slotFrameClonesLimitChanged(int)));
1843
1844 intCachedFramesSizeLimit->setRange(256, 10000);
1845 intCachedFramesSizeLimit->setSuffix(i18n(" px"));
1846 intCachedFramesSizeLimit->setSingleStep(1);
1847 intCachedFramesSizeLimit->setPageStep(1000);
1848
1849 intRegionOfInterestMargin->setRange(1, 100);
1850 KisSpinBoxI18nHelper::setText(intRegionOfInterestMargin,
1851 i18nc("{n} is the number value, % is the percent sign", "{n}%"));
1852 intRegionOfInterestMargin->setSingleStep(1);
1853 intRegionOfInterestMargin->setPageStep(10);
1854
1855 connect(chkCachedFramesSizeLimit, SIGNAL(toggled(bool)), intCachedFramesSizeLimit, SLOT(setEnabled(bool)));
1856 connect(chkUseRegionOfInterest, SIGNAL(toggled(bool)), intRegionOfInterestMargin, SLOT(setEnabled(bool)));
1857
1858 connect(chkTransformToolUseInStackPreview, SIGNAL(toggled(bool)), chkTransformToolForceLodMode, SLOT(setEnabled(bool)));
1859
1860#ifndef Q_OS_WIN
1861 // AVX workaround is needed on Windows+GCC only
1862 chkDisableAVXOptimizations->setVisible(false);
1863#endif
1864
1865 load(false);
1866}
1867
1869{
1870 qDeleteAll(m_syncs);
1871}
1872
1873void PerformanceTab::load(bool requestDefault)
1874{
1875 KisImageConfig cfg(true);
1876
1877 sliderMemoryLimit->setValue(cfg.memoryHardLimitPercent(requestDefault));
1878 sliderPoolLimit->setValue(cfg.memoryPoolLimitPercent(requestDefault));
1879 sliderUndoLimit->setValue(cfg.memorySoftLimitPercent(requestDefault));
1880
1881 chkPerformanceLogging->setChecked(cfg.enablePerfLog(requestDefault));
1882 chkProgressReporting->setChecked(cfg.enableProgressReporting(requestDefault));
1883
1884 sliderSwapSize->setValue(cfg.maxSwapSize(requestDefault) / 1024);
1885 swapFileLocation->setFileName(cfg.swapDir(requestDefault));
1886
1887 m_lastUsedThreadsLimit = cfg.maxNumberOfThreads(requestDefault);
1888 m_lastUsedClonesLimit = cfg.frameRenderingClones(requestDefault);
1889
1890 sliderThreadsLimit->setValue(m_lastUsedThreadsLimit);
1891 sliderFrameClonesLimit->setValue(m_lastUsedClonesLimit);
1892
1893#if KRITA_QT_HAS_UPDATE_COMPRESSION_PATCH
1894 m_frameRateModel->data.set(std::make_tuple(cfg.detectFpsLimit(requestDefault), cfg.fpsLimit(requestDefault)));
1895#else
1896 m_frameRateModel->data.set(std::make_tuple(false, cfg.fpsLimit(requestDefault)));
1897 chkDetectFps->setVisible(false);
1898#endif
1899 {
1900 KisConfig cfg2(true);
1901 chkOpenGLFramerateLogging->setChecked(cfg2.enableOpenGLFramerateLogging(requestDefault));
1902 chkBrushSpeedLogging->setChecked(cfg2.enableBrushSpeedLogging(requestDefault));
1903 chkDisableVectorOptimizations->setChecked(cfg2.disableVectorOptimizations(requestDefault));
1904#ifdef Q_OS_WIN
1905 chkDisableAVXOptimizations->setChecked(cfg2.disableAVXOptimizations(requestDefault));
1906#endif
1907 chkBackgroundCacheGeneration->setChecked(cfg2.calculateAnimationCacheInBackground(requestDefault));
1908 }
1909
1910 if (cfg.useOnDiskAnimationCacheSwapping(requestDefault)) {
1911 optOnDisk->setChecked(true);
1912 } else {
1913 optInMemory->setChecked(true);
1914 }
1915
1916 chkCachedFramesSizeLimit->setChecked(cfg.useAnimationCacheFrameSizeLimit(requestDefault));
1917 intCachedFramesSizeLimit->setValue(cfg.animationCacheFrameSizeLimit(requestDefault));
1918 intCachedFramesSizeLimit->setEnabled(chkCachedFramesSizeLimit->isChecked());
1919
1920 chkUseRegionOfInterest->setChecked(cfg.useAnimationCacheRegionOfInterest(requestDefault));
1921 intRegionOfInterestMargin->setValue(cfg.animationCacheRegionOfInterestMargin(requestDefault) * 100.0);
1922 intRegionOfInterestMargin->setEnabled(chkUseRegionOfInterest->isChecked());
1923
1924 {
1925 KConfigGroup group = KSharedConfig::openConfig()->group("KisToolTransform");
1926 chkTransformToolUseInStackPreview->setChecked(!group.readEntry("useOverlayPreviewStyle", false));
1927 chkTransformToolForceLodMode->setChecked(group.readEntry("forceLodMode", true));
1928 chkTransformToolForceLodMode->setEnabled(chkTransformToolUseInStackPreview->isChecked());
1929 }
1930
1931 {
1932 KConfigGroup group = KSharedConfig::openConfig()->group("KritaTransform/KisToolMove");
1933 chkMoveToolForceLodMode->setChecked(group.readEntry("forceLodMode", false));
1934 }
1935
1936 {
1937 KConfigGroup group( KSharedConfig::openConfig(), "filterdialog");
1938 chkFiltersForceLodMode->setChecked(group.readEntry("forceLodMode", true));
1939 }
1940}
1941
1943{
1944 KisImageConfig cfg(false);
1945
1946 cfg.setMemoryHardLimitPercent(sliderMemoryLimit->value());
1947 cfg.setMemorySoftLimitPercent(sliderUndoLimit->value());
1948 cfg.setMemoryPoolLimitPercent(sliderPoolLimit->value());
1949
1950 cfg.setEnablePerfLog(chkPerformanceLogging->isChecked());
1951 cfg.setEnableProgressReporting(chkProgressReporting->isChecked());
1952
1953 cfg.setMaxSwapSize(sliderSwapSize->value() * 1024);
1954
1955 cfg.setSwapDir(swapFileLocation->fileName());
1956
1957 cfg.setMaxNumberOfThreads(sliderThreadsLimit->value());
1958 cfg.setFrameRenderingClones(sliderFrameClonesLimit->value());
1959 cfg.setFrameRenderingTimeout(sliderFrameTimeout->value() * 1000);
1960 cfg.setFpsLimit(std::get<int>(*m_frameRateModel->data));
1961#if KRITA_QT_HAS_UPDATE_COMPRESSION_PATCH
1962 cfg.setDetectFpsLimit(std::get<bool>(*m_frameRateModel->data));
1963#endif
1964
1965 {
1966 KisConfig cfg2(true);
1967 cfg2.setEnableOpenGLFramerateLogging(chkOpenGLFramerateLogging->isChecked());
1968 cfg2.setEnableBrushSpeedLogging(chkBrushSpeedLogging->isChecked());
1969 cfg2.setDisableVectorOptimizations(chkDisableVectorOptimizations->isChecked());
1970#ifdef Q_OS_WIN
1971 cfg2.setDisableAVXOptimizations(chkDisableAVXOptimizations->isChecked());
1972#endif
1973 cfg2.setCalculateAnimationCacheInBackground(chkBackgroundCacheGeneration->isChecked());
1974 }
1975
1976 cfg.setUseOnDiskAnimationCacheSwapping(optOnDisk->isChecked());
1977
1978 cfg.setUseAnimationCacheFrameSizeLimit(chkCachedFramesSizeLimit->isChecked());
1979 cfg.setAnimationCacheFrameSizeLimit(intCachedFramesSizeLimit->value());
1980
1981 cfg.setUseAnimationCacheRegionOfInterest(chkUseRegionOfInterest->isChecked());
1982 cfg.setAnimationCacheRegionOfInterestMargin(intRegionOfInterestMargin->value() / 100.0);
1983
1984 {
1985 KConfigGroup group = KSharedConfig::openConfig()->group("KisToolTransform");
1986 group.writeEntry("useOverlayPreviewStyle", !chkTransformToolUseInStackPreview->isChecked());
1987 group.writeEntry("forceLodMode", chkTransformToolForceLodMode->isChecked());
1988 }
1989
1990 {
1991 KConfigGroup group = KSharedConfig::openConfig()->group("KritaTransform/KisToolMove");
1992 group.writeEntry("forceLodMode", chkMoveToolForceLodMode->isChecked());
1993 }
1994
1995 {
1996 KConfigGroup group( KSharedConfig::openConfig(), "filterdialog");
1997 group.writeEntry("forceLodMode", chkFiltersForceLodMode->isChecked());
1998 }
1999
2000}
2001
2003{
2004 KisSignalsBlocker b(sliderFrameClonesLimit);
2005 sliderFrameClonesLimit->setValue(qMin(m_lastUsedClonesLimit, value));
2007}
2008
2010{
2011 KisSignalsBlocker b(sliderThreadsLimit);
2012 sliderThreadsLimit->setValue(qMax(m_lastUsedThreadsLimit, value));
2014}
2015
2016//---------------------------------------------------------------------------------------------------
2017
2018#include "KoColor.h"
2021#include <QOpenGLContext>
2022#include <QScreen>
2023
2024namespace {
2025
2026QString colorSpaceString(const KisSurfaceColorSpaceWrapper &cs, int depth)
2027{
2028 const QString csString =
2029#ifdef HAVE_HDR
2031 cs == KisSurfaceColorSpaceWrapper::scRGBColorSpace ? "Rec. 709 Linear" :
2032#endif
2035 "Unknown Color Space";
2036
2037 return QString("%1 (%2 bit)").arg(csString).arg(depth);
2038}
2039
2040int formatToIndex(KisConfig::RootSurfaceFormat fmt)
2041{
2042 return fmt == KisConfig::BT2020_PQ ? 1 :
2043 fmt == KisConfig::BT709_G10 ? 2 :
2044 0;
2045}
2046
2047KisConfig::RootSurfaceFormat indexToFormat(int value)
2048{
2049 return value == 1 ? KisConfig::BT2020_PQ :
2052}
2053
2054int assistantDrawModeToIndex(KisConfig::AssistantsDrawMode mode)
2055{
2058 0;
2059}
2060
2061KisConfig::AssistantsDrawMode indexToAssistantDrawMode(int value)
2062{
2066}
2067
2068} // anonymous namespace
2069
2070DisplaySettingsTab::DisplaySettingsTab(QWidget *parent, const char *name)
2071 : WdgDisplaySettings(parent, name)
2072{
2073 KisConfig cfg(true);
2074
2075 const QString rendererOpenGLText = i18nc("canvas renderer", "OpenGL");
2076 const QString rendererSoftwareText = i18nc("canvas renderer", "Software Renderer (very slow)");
2077#ifdef Q_OS_WIN
2078 const QString rendererOpenGLESText =
2079 qEnvironmentVariable("QT_ANGLE_PLATFORM") != "opengl"
2080 ? i18nc("canvas renderer", "Direct3D 11 via ANGLE")
2081 : i18nc("canvas renderer", "OpenGL via ANGLE");
2082#else
2083 const QString rendererOpenGLESText = i18nc("canvas renderer", "OpenGL ES");
2084#endif
2085
2087 lblCurrentRenderer->setText(renderer == KisOpenGL::RendererOpenGLES ? rendererOpenGLESText :
2088 renderer == KisOpenGL::RendererDesktopGL ? rendererOpenGLText :
2089 renderer == KisOpenGL::RendererSoftware ? rendererSoftwareText :
2090 i18nc("canvas renderer", "Unknown"));
2091
2092 cmbPreferredRenderer->clear();
2093
2094 const KisOpenGL::OpenGLRenderers supportedRenderers = KisOpenGL::getSupportedOpenGLRenderers();
2095 const bool onlyOneRendererSupported =
2096 supportedRenderers == KisOpenGL::RendererDesktopGL ||
2097 supportedRenderers == KisOpenGL::RendererOpenGLES ||
2098 supportedRenderers == KisOpenGL::RendererSoftware;
2099
2100
2101 if (!onlyOneRendererSupported) {
2102 QString qtPreferredRendererText;
2104 qtPreferredRendererText = rendererOpenGLESText;
2106 qtPreferredRendererText = rendererSoftwareText;
2107 } else {
2108 qtPreferredRendererText = rendererOpenGLText;
2109 }
2110 cmbPreferredRenderer->addItem(i18nc("canvas renderer", "Auto (%1)", qtPreferredRendererText), KisOpenGL::RendererAuto);
2111 cmbPreferredRenderer->setCurrentIndex(0);
2112 } else {
2113 cmbPreferredRenderer->setEnabled(false);
2114 }
2115
2116 if (supportedRenderers & KisOpenGL::RendererDesktopGL) {
2117 cmbPreferredRenderer->addItem(rendererOpenGLText, KisOpenGL::RendererDesktopGL);
2119 cmbPreferredRenderer->setCurrentIndex(cmbPreferredRenderer->count() - 1);
2120 }
2121 }
2122
2123 if (supportedRenderers & KisOpenGL::RendererOpenGLES) {
2124 cmbPreferredRenderer->addItem(rendererOpenGLESText, KisOpenGL::RendererOpenGLES);
2126 cmbPreferredRenderer->setCurrentIndex(cmbPreferredRenderer->count() - 1);
2127 }
2128 }
2129
2130 if (supportedRenderers & KisOpenGL::RendererSoftware) {
2131 cmbPreferredRenderer->addItem(rendererSoftwareText, KisOpenGL::RendererSoftware);
2133 cmbPreferredRenderer->setCurrentIndex(cmbPreferredRenderer->count() - 1);
2134 }
2135 }
2136
2137 if (!(supportedRenderers &
2141
2142 grpOpenGL->setEnabled(false);
2143 grpOpenGL->setChecked(false);
2144 chkUseTextureBuffer->setEnabled(false);
2145 cmbAssistantsDrawMode->setEnabled(false);
2146 cmbFilterMode->setEnabled(false);
2147 } else {
2148 grpOpenGL->setEnabled(true);
2149 grpOpenGL->setChecked(cfg.useOpenGL());
2150 chkUseTextureBuffer->setEnabled(cfg.useOpenGL());
2151 chkUseTextureBuffer->setChecked(cfg.useOpenGLTextureBuffer());
2152 cmbAssistantsDrawMode->setEnabled(cfg.useOpenGL());
2153 cmbAssistantsDrawMode->setCurrentIndex(assistantDrawModeToIndex(cfg.assistantsDrawMode()));
2154 cmbFilterMode->setEnabled(cfg.useOpenGL());
2155 cmbFilterMode->setCurrentIndex(cfg.openGLFilteringMode());
2156 // Don't show the high quality filtering mode if it's not available
2157 if (!KisOpenGL::supportsLoD()) {
2158 cmbFilterMode->removeItem(3);
2159 }
2160 }
2161
2162 lblCurrentDisplayFormat->setText("");
2163 lblCurrentRootSurfaceFormat->setText("");
2164 grpHDRWarning->setVisible(false);
2165 cmbPreferedRootSurfaceFormat->addItem(colorSpaceString(KisSurfaceColorSpaceWrapper::sRGBColorSpace, 8));
2166#ifdef HAVE_HDR
2167 cmbPreferedRootSurfaceFormat->addItem(colorSpaceString(KisSurfaceColorSpaceWrapper::bt2020PQColorSpace, 10));
2168 cmbPreferedRootSurfaceFormat->addItem(colorSpaceString(KisSurfaceColorSpaceWrapper::scRGBColorSpace, 16));
2169#endif
2170 cmbPreferedRootSurfaceFormat->setCurrentIndex(formatToIndex(KisConfig::BT709_G22));
2171 slotPreferredSurfaceFormatChanged(cmbPreferedRootSurfaceFormat->currentIndex());
2172
2173 QOpenGLContext *context = QOpenGLContext::currentContext();
2174
2175 if (!context) {
2176 context = QOpenGLContext::globalShareContext();
2177 }
2178
2179 if (context) {
2180 QScreen *screen = KisPart::instance()->currentMainwindow()->screen();
2181 KisScreenInformationAdapter adapter(context);
2182 if (screen && adapter.isValid()) {
2184 if (info.isValid()) {
2185 QStringList toolTip;
2186
2187 toolTip << i18n("Display Id: %1", info.screen->name());
2188 toolTip << i18n("Display Name: %1 %2", info.screen->manufacturer(), info.screen->model());
2189 toolTip << i18n("Min Luminance: %1", info.minLuminance);
2190 toolTip << i18n("Max Luminance: %1", info.maxLuminance);
2191 toolTip << i18n("Max Full Frame Luminance: %1", info.maxFullFrameLuminance);
2192 toolTip << i18n("Red Primary: %1, %2", info.redPrimary[0], info.redPrimary[1]);
2193 toolTip << i18n("Green Primary: %1, %2", info.greenPrimary[0], info.greenPrimary[1]);
2194 toolTip << i18n("Blue Primary: %1, %2", info.bluePrimary[0], info.bluePrimary[1]);
2195 toolTip << i18n("White Point: %1, %2", info.whitePoint[0], info.whitePoint[1]);
2196
2197 lblCurrentDisplayFormat->setToolTip(toolTip.join('\n'));
2198 lblCurrentDisplayFormat->setText(colorSpaceString(info.colorSpace, info.bitsPerColor));
2199 } else {
2200 lblCurrentDisplayFormat->setToolTip("");
2201 lblCurrentDisplayFormat->setText(i18n("Unknown"));
2202 }
2203 } else {
2204 lblCurrentDisplayFormat->setToolTip("");
2205 lblCurrentDisplayFormat->setText(i18n("Unknown"));
2206 qWarning() << "Failed to fetch display info:" << adapter.errorString();
2207 }
2208
2209 const QSurfaceFormat currentFormat = KisOpenGLModeProber::instance()->surfaceformatInUse();
2210 const auto colorSpace = KisSurfaceColorSpaceWrapper::fromQtColorSpace(currentFormat.colorSpace());
2211 lblCurrentRootSurfaceFormat->setText(colorSpaceString(colorSpace, currentFormat.redBufferSize()));
2212 cmbPreferedRootSurfaceFormat->setCurrentIndex(formatToIndex(cfg.rootSurfaceFormat()));
2213 connect(cmbPreferedRootSurfaceFormat, SIGNAL(currentIndexChanged(int)), SLOT(slotPreferredSurfaceFormatChanged(int)));
2214 slotPreferredSurfaceFormatChanged(cmbPreferedRootSurfaceFormat->currentIndex());
2215 }
2216
2217#ifndef HAVE_HDR
2218 tabHDR->setEnabled(false);
2219
2225 if (KisPlatformPluginInterfaceFactory::instance()->surfaceColorManagedByOS()) {
2226 const int hdrTabIndex = tabWidget->indexOf(tabHDR);
2227 KIS_SAFE_ASSERT_RECOVER_NOOP(hdrTabIndex >= 0);
2228 if (hdrTabIndex >= 0) {
2229 tabWidget->setTabVisible(hdrTabIndex, false);
2230 }
2231 }
2232#endif
2233
2234 const QStringList openglWarnings = KisOpenGL::getOpenGLWarnings();
2235 if (openglWarnings.isEmpty()) {
2236 grpOpenGLWarnings->setVisible(false);
2237 } else {
2238 QString text = QString("<p><b>%1</b>").arg(i18n("Warning(s):"));
2239 text.append("<ul>");
2240 Q_FOREACH (const QString &warning, openglWarnings) {
2241 text.append("<li>");
2242 text.append(warning.toHtmlEscaped());
2243 text.append("</li>");
2244 }
2245 text.append("</ul></p>");
2246 grpOpenGLWarnings->setText(text);
2247 grpOpenGLWarnings->setPixmap(
2248 grpOpenGLWarnings->style()->standardIcon(QStyle::SP_MessageBoxWarning).pixmap(QSize(32, 32)));
2249 grpOpenGLWarnings->setVisible(true);
2250 }
2251
2252 KisImageConfig imageCfg(false);
2253
2254 KoColor c;
2256 c.setOpacity(1.0);
2257 btnSelectionOverlayColor->setColor(c);
2258 sldSelectionOverlayOpacity->setRange(0.0, 1.0, 2);
2259 sldSelectionOverlayOpacity->setSingleStep(0.05);
2260 sldSelectionOverlayOpacity->setValue(imageCfg.selectionOverlayMaskColor().alphaF());
2261
2262 sldSelectionOutlineOpacity->setRange(0.0, 1.0, 2);
2263 sldSelectionOutlineOpacity->setSingleStep(0.05);
2264 sldSelectionOutlineOpacity->setValue(imageCfg.selectionOutlineOpacity());
2265
2266 intCheckSize->setValue(cfg.checkSize());
2267 chkMoving->setChecked(cfg.scrollCheckers());
2269 ck1.fromQColor(cfg.checkersColor1());
2270 colorChecks1->setColor(ck1);
2272 ck2.fromQColor(cfg.checkersColor2());
2273 colorChecks2->setColor(ck2);
2275 cb.fromQColor(cfg.canvasBorderColor());
2276 canvasBorder->setColor(cb);
2277 hideScrollbars->setChecked(cfg.hideScrollbars());
2278 chkCurveAntialiasing->setChecked(cfg.antialiasCurves());
2279 chkSelectionOutlineAntialiasing->setChecked(cfg.antialiasSelectionOutline());
2280 chkChannelsAsColor->setChecked(cfg.showSingleChannelAsColor());
2281 chkHidePopups->setChecked(cfg.hidePopups());
2282
2283 connect(grpOpenGL, SIGNAL(toggled(bool)), SLOT(slotUseOpenGLToggled(bool)));
2284
2285 KoColor gridColor(KoColorSpaceRegistry::instance()->rgb8());
2286 gridColor.fromQColor(cfg.getPixelGridColor());
2287 pixelGridColorButton->setColor(gridColor);
2288 pixelGridDrawingThresholdBox->setValue(cfg.getPixelGridDrawingThreshold() * 100);
2289 KisSpinBoxI18nHelper::setText(pixelGridDrawingThresholdBox, i18nc("{n} is the number value, % is the percent sign", "{n}%"));
2290}
2291
2293{
2294 KisConfig cfg(true);
2295 cmbPreferredRenderer->setCurrentIndex(0);
2298 grpOpenGL->setEnabled(false);
2299 grpOpenGL->setChecked(false);
2300 chkUseTextureBuffer->setEnabled(false);
2301 cmbAssistantsDrawMode->setEnabled(false);
2302 cmbFilterMode->setEnabled(false);
2303 }
2304 else {
2305 grpOpenGL->setEnabled(true);
2306 grpOpenGL->setChecked(cfg.useOpenGL(true));
2307 chkUseTextureBuffer->setChecked(cfg.useOpenGLTextureBuffer(true));
2308 chkUseTextureBuffer->setEnabled(true);
2309 cmbAssistantsDrawMode->setEnabled(true);
2310 cmbAssistantsDrawMode->setCurrentIndex(assistantDrawModeToIndex(cfg.assistantsDrawMode(true)));
2311 cmbFilterMode->setEnabled(true);
2312 cmbFilterMode->setCurrentIndex(cfg.openGLFilteringMode(true));
2313 }
2314
2315 chkMoving->setChecked(cfg.scrollCheckers(true));
2316
2317 KisImageConfig imageCfg(false);
2318
2319 KoColor c;
2320 c.fromQColor(imageCfg.selectionOverlayMaskColor(true));
2321 c.setOpacity(1.0);
2322 btnSelectionOverlayColor->setColor(c);
2323 sldSelectionOverlayOpacity->setValue(imageCfg.selectionOverlayMaskColor(true).alphaF());
2324
2325 sldSelectionOutlineOpacity->setValue(imageCfg.selectionOutlineOpacity(true));
2326
2327 intCheckSize->setValue(cfg.checkSize(true));
2329 ck1.fromQColor(cfg.checkersColor1(true));
2330 colorChecks1->setColor(ck1);
2332 ck2.fromQColor(cfg.checkersColor2(true));
2333 colorChecks2->setColor(ck2);
2335 cvb.fromQColor(cfg.canvasBorderColor(true));
2336 canvasBorder->setColor(cvb);
2337 hideScrollbars->setChecked(cfg.hideScrollbars(true));
2338 chkCurveAntialiasing->setChecked(cfg.antialiasCurves(true));
2339 chkSelectionOutlineAntialiasing->setChecked(cfg.antialiasSelectionOutline(true));
2340 chkChannelsAsColor->setChecked(cfg.showSingleChannelAsColor(true));
2341 chkHidePopups->setChecked(cfg.hidePopups(true));
2342
2343 KoColor gridColor(KoColorSpaceRegistry::instance()->rgb8());
2344 gridColor.fromQColor(cfg.getPixelGridColor(true));
2345 pixelGridColorButton->setColor(gridColor);
2346 pixelGridDrawingThresholdBox->setValue(cfg.getPixelGridDrawingThreshold(true) * 100);
2347 KisSpinBoxI18nHelper::setText(pixelGridDrawingThresholdBox, i18nc("{n} is the number value, % is the percent sign", "{n}%"));
2348
2349 cmbPreferedRootSurfaceFormat->setCurrentIndex(formatToIndex(KisConfig::BT709_G22));
2350 slotPreferredSurfaceFormatChanged(cmbPreferedRootSurfaceFormat->currentIndex());
2351}
2352
2354{
2355 chkUseTextureBuffer->setEnabled(isChecked);
2356 cmbFilterMode->setEnabled(isChecked);
2357 cmbAssistantsDrawMode->setEnabled(isChecked);
2358}
2359
2361{
2362 Q_UNUSED(index);
2363
2364 QOpenGLContext *context = QOpenGLContext::currentContext();
2365 if (context) {
2366 QScreen *screen = KisPart::instance()->currentMainwindow()->screen();
2367 KisScreenInformationAdapter adapter(context);
2368 if (adapter.isValid()) {
2370 if (info.isValid()) {
2371 if (cmbPreferedRootSurfaceFormat->currentIndex() != formatToIndex(KisConfig::BT709_G22) &&
2373 grpHDRWarning->setVisible(true);
2374 grpHDRWarning->setPixmap(
2375 grpHDRWarning->style()->standardIcon(QStyle::SP_MessageBoxWarning).pixmap(QSize(32, 32)));
2376 grpHDRWarning->setText(i18n("<b>Warning:</b> current display doesn't support HDR rendering"));
2377 } else {
2378 grpHDRWarning->setVisible(false);
2379 }
2380 }
2381 }
2382 }
2383}
2384
2385//---------------------------------------------------------------------------------------------------
2387{
2388 KisConfig cfg(true);
2389
2390 chkDockers->setChecked(cfg.hideDockersFullscreen());
2391 chkMenu->setChecked(cfg.hideMenuFullscreen());
2392 chkScrollbars->setChecked(cfg.hideScrollbarsFullscreen());
2393 chkStatusbar->setChecked(cfg.hideStatusbarFullscreen());
2394 chkTitlebar->setChecked(cfg.hideTitlebarFullscreen());
2395 chkToolbar->setChecked(cfg.hideToolbarFullscreen());
2396
2397}
2398
2400{
2401 KisConfig cfg(true);
2402 chkDockers->setChecked(cfg.hideDockersFullscreen(true));
2403 chkMenu->setChecked(cfg.hideMenuFullscreen(true));
2404 chkScrollbars->setChecked(cfg.hideScrollbarsFullscreen(true));
2405 chkStatusbar->setChecked(cfg.hideStatusbarFullscreen(true));
2406 chkTitlebar->setChecked(cfg.hideTitlebarFullscreen(true));
2407 chkToolbar->setChecked(cfg.hideToolbarFullscreen(true));
2408}
2409
2410
2411//---------------------------------------------------------------------------------------------------
2412
2414static const QStringList allowedColorHistorySortingValues({"none", "hsv"});
2415}
2416
2417PopupPaletteTab::PopupPaletteTab(QWidget *parent, const char *name)
2418 : WdgPopupPaletteSettingsBase(parent, name)
2419{
2420 using namespace PopupPaletteTabPrivate;
2421
2422 load();
2423
2424 connect(chkShowColorHistory, SIGNAL(toggled(bool)), cmbColorHistorySorting, SLOT(setEnabled(bool)));
2425 connect(chkShowColorHistory, SIGNAL(toggled(bool)), lblColorHistorySorting, SLOT(setEnabled(bool)));
2426 KIS_SAFE_ASSERT_RECOVER_NOOP(cmbColorHistorySorting->count() == allowedColorHistorySortingValues.size());
2427}
2428
2430{
2431 using namespace PopupPaletteTabPrivate;
2432
2433 KisConfig config(true);
2434 sbNumPresets->setValue(config.favoritePresets());
2435 sbPaletteSize->setValue(config.readEntry("popuppalette/size", 385));
2436 sbSelectorSize->setValue(config.readEntry("popuppalette/selectorSize", 140));
2437 cmbSelectorType->setCurrentIndex(config.readEntry<bool>("popuppalette/usevisualcolorselector", false) ? 1 : 0);
2438 chkShowColorHistory->setChecked(config.readEntry("popuppalette/showColorHistory", true));
2439 chkShowRotationTrack->setChecked(config.readEntry("popuppalette/showRotationTrack", true));
2440 chkUseDynamicSlotCount->setChecked(config.readEntry("popuppalette/useDynamicSlotCount", true));
2441
2442 QString currentSorting = config.readEntry("popuppalette/colorHistorySorting", QString("hsv"));
2443 if (!allowedColorHistorySortingValues.contains(currentSorting)) {
2444 currentSorting = "hsv";
2445 }
2446 cmbColorHistorySorting->setCurrentIndex(allowedColorHistorySortingValues.indexOf(currentSorting));
2447 cmbColorHistorySorting->setEnabled(chkShowColorHistory->isChecked());
2448 lblColorHistorySorting->setEnabled(chkShowColorHistory->isChecked());
2449}
2450
2452{
2453 using namespace PopupPaletteTabPrivate;
2454
2455 KisConfig config(true);
2456 config.setFavoritePresets(sbNumPresets->value());
2457 config.writeEntry("popuppalette/size", sbPaletteSize->value());
2458 config.writeEntry("popuppalette/selectorSize", sbSelectorSize->value());
2459 config.writeEntry<bool>("popuppalette/usevisualcolorselector", cmbSelectorType->currentIndex() > 0);
2460 config.writeEntry<bool>("popuppalette/showColorHistory", chkShowColorHistory->isChecked());
2461 config.writeEntry<bool>("popuppalette/showRotationTrack", chkShowRotationTrack->isChecked());
2462 config.writeEntry<bool>("popuppalette/useDynamicSlotCount", chkUseDynamicSlotCount->isChecked());
2463 config.writeEntry("popuppalette/colorHistorySorting",
2464 allowedColorHistorySortingValues[cmbColorHistorySorting->currentIndex()]);
2465}
2466
2468{
2469 KisConfig config(true);
2470 sbNumPresets->setValue(config.favoritePresets(true));
2471 sbPaletteSize->setValue(385);
2472 sbSelectorSize->setValue(140);
2473 cmbSelectorType->setCurrentIndex(0);
2474 chkShowColorHistory->setChecked(true);
2475 chkShowRotationTrack->setChecked(true);
2476 chkUseDynamicSlotCount->setChecked(true);
2477 cmbColorHistorySorting->setEnabled(chkShowColorHistory->isChecked());
2478 lblColorHistorySorting->setEnabled(chkShowColorHistory->isChecked());
2479}
2480
2481//---------------------------------------------------------------------------------------------------
2482
2483KisDlgPreferences::KisDlgPreferences(QWidget* parent, const char* name)
2484 : KPageDialog(parent)
2485{
2486 Q_UNUSED(name);
2487 setWindowTitle(i18n("Configure Krita"));
2488 setStandardButtons(QDialogButtonBox::Ok | QDialogButtonBox::Cancel | QDialogButtonBox::RestoreDefaults);
2489
2490 setFaceType(KPageDialog::List);
2491
2492 // General
2493 KoVBox *vbox = new KoVBox();
2494 KPageWidgetItem *page = new KPageWidgetItem(vbox, i18n("General"));
2495 page->setObjectName("general");
2496 page->setHeader(i18n("General"));
2497 page->setIcon(KisIconUtils::loadIcon("config-general"));
2498 m_pages << page;
2499 addPage(page);
2500 m_general = new GeneralTab(vbox);
2501
2502 // Shortcuts
2503 vbox = new KoVBox();
2504 page = new KPageWidgetItem(vbox, i18n("Keyboard Shortcuts"));
2505 page->setObjectName("shortcuts");
2506 page->setHeader(i18n("Shortcuts"));
2507 page->setIcon(KisIconUtils::loadIcon("config-keyboard"));
2508 m_pages << page;
2509 addPage(page);
2511 connect(this, SIGNAL(accepted()), m_shortcutSettings, SLOT(saveChanges()));
2512 connect(this, SIGNAL(rejected()), m_shortcutSettings, SLOT(cancelChanges()));
2513
2514 // Canvas input settings
2516 page = addPage(m_inputConfiguration, i18n("Canvas Input Settings"));
2517 page->setHeader(i18n("Canvas Input"));
2518 page->setObjectName("canvasinput");
2519 page->setIcon(KisIconUtils::loadIcon("config-canvas-input"));
2520 m_pages << page;
2521
2522 // Display
2523 vbox = new KoVBox();
2524 page = new KPageWidgetItem(vbox, i18n("Display"));
2525 page->setObjectName("display");
2526 page->setHeader(i18n("Display"));
2527 page->setIcon(KisIconUtils::loadIcon("config-display"));
2528 m_pages << page;
2529 addPage(page);
2531
2532 // Color
2533 vbox = new KoVBox();
2534 page = new KPageWidgetItem(vbox, i18n("Color Management"));
2535 page->setObjectName("colormanagement");
2536 page->setHeader(i18nc("Label of color as in Color Management", "Color"));
2537 page->setIcon(KisIconUtils::loadIcon("config-color-manage"));
2538 m_pages << page;
2539 addPage(page);
2541
2542 // Performance
2543 vbox = new KoVBox();
2544 page = new KPageWidgetItem(vbox, i18n("Performance"));
2545 page->setObjectName("performance");
2546 page->setHeader(i18n("Performance"));
2547 page->setIcon(KisIconUtils::loadIcon("config-performance"));
2548 m_pages << page;
2549 addPage(page);
2551
2552 // Tablet
2553 vbox = new KoVBox();
2554 page = new KPageWidgetItem(vbox, i18n("Tablet settings"));
2555 page->setObjectName("tablet");
2556 page->setHeader(i18n("Tablet"));
2557 page->setIcon(KisIconUtils::loadIcon("config-tablet"));
2558 m_pages << page;
2559 addPage(page);
2561
2562 // full-screen mode
2563 vbox = new KoVBox();
2564 page = new KPageWidgetItem(vbox, i18n("Canvas-only settings"));
2565 page->setObjectName("canvasonly");
2566 page->setHeader(i18n("Canvas-only"));
2567 page->setIcon(KisIconUtils::loadIcon("config-canvas-only"));
2568 m_pages << page;
2569 addPage(page);
2571
2572 // Pop-up Palette
2573 vbox = new KoVBox();
2574 page = new KPageWidgetItem(vbox, i18n("Pop-up Palette"));
2575 page->setObjectName("popuppalette");
2576 page->setHeader(i18n("Pop-up Palette"));
2577 page->setIcon(KisIconUtils::loadIcon("config-popup-palette"));
2578 m_pages << page;
2579 addPage(page);
2581
2582 // Author profiles
2584 page = addPage(m_authorPage, i18nc("@title:tab Author page", "Author" ));
2585 page->setObjectName("author");
2586 page->setHeader(i18n("Author"));
2587 page->setIcon(KisIconUtils::loadIcon("user-identity"));
2588 m_pages << page;
2589
2590 KGuiItem::assign(button(QDialogButtonBox::Ok), KStandardGuiItem::ok());
2591 KGuiItem::assign(button(QDialogButtonBox::Cancel), KStandardGuiItem::cancel());
2592 QPushButton *restoreDefaultsButton = button(QDialogButtonBox::RestoreDefaults);
2593 restoreDefaultsButton->setText(i18nc("@action:button", "Restore Defaults"));
2594
2595 connect(this, SIGNAL(accepted()), m_inputConfiguration, SLOT(saveChanges()));
2596 connect(this, SIGNAL(rejected()), m_inputConfiguration, SLOT(revertChanges()));
2597
2599 QStringList keys = preferenceSetRegistry->keys();
2600 keys.sort();
2601 Q_FOREACH(const QString &key, keys) {
2602 KisAbstractPreferenceSetFactory *preferenceSetFactory = preferenceSetRegistry->value(key);
2603 KisPreferenceSet* preferenceSet = preferenceSetFactory->createPreferenceSet();
2604 vbox = new KoVBox();
2605 page = new KPageWidgetItem(vbox, preferenceSet->name());
2606 page->setHeader(preferenceSet->header());
2607 page->setIcon(preferenceSet->icon());
2608 addPage(page);
2609 preferenceSet->setParent(vbox);
2610 preferenceSet->loadPreferences();
2611
2612 connect(restoreDefaultsButton, SIGNAL(clicked(bool)), preferenceSet, SLOT(loadDefaultPreferences()), Qt::UniqueConnection);
2613 connect(this, SIGNAL(accepted()), preferenceSet, SLOT(savePreferences()), Qt::UniqueConnection);
2614 }
2615
2616 connect(restoreDefaultsButton, SIGNAL(clicked(bool)), this, SLOT(slotDefault()));
2617
2618 KisConfig cfg(true);
2619 QString currentPageName = cfg.readEntry<QString>("KisDlgPreferences/CurrentPage");
2620 Q_FOREACH(KPageWidgetItem *page, m_pages) {
2621 if (page->objectName() == currentPageName) {
2622 setCurrentPage(page);
2623 break;
2624 }
2625 }
2626
2627 // TODO QT6: check what this code actually does?
2628#if (QT_VERSION < QT_VERSION_CHECK(6, 0, 0))
2629 {
2630 // HACK ALERT! Remove title widget background, thus making
2631 // it consistent across all systems
2632 const auto *titleWidget = findChild<KTitleWidget*>();
2633 if (titleWidget) {
2634 QLayoutItem *titleFrame = titleWidget->layout()->itemAt(0); // vboxLayout -> titleFrame
2635 if (titleFrame) {
2636 titleFrame->widget()->setBackgroundRole(QPalette::Window);
2637 }
2638 }
2639 }
2640#endif
2641}
2642
2644{
2645 KisConfig cfg(true);
2646 cfg.writeEntry<QString>("KisDlgPreferences/CurrentPage", currentPage()->objectName());
2647}
2648
2649void KisDlgPreferences::showEvent(QShowEvent *event){
2650 KPageDialog::showEvent(event);
2651 button(QDialogButtonBox::Cancel)->setAutoDefault(false);
2652 button(QDialogButtonBox::Ok)->setAutoDefault(false);
2653 button(QDialogButtonBox::RestoreDefaults)->setAutoDefault(false);
2654 button(QDialogButtonBox::Cancel)->setDefault(false);
2655 button(QDialogButtonBox::Ok)->setDefault(false);
2656 button(QDialogButtonBox::RestoreDefaults)->setDefault(false);
2657}
2658
2660{
2661 if (buttonBox()->buttonRole(button) == QDialogButtonBox::RejectRole) {
2662 m_cancelClicked = true;
2663 }
2664}
2665
2667{
2668 if (currentPage()->objectName() == "general") {
2670 }
2671 else if (currentPage()->objectName() == "shortcuts") {
2673 }
2674 else if (currentPage()->objectName() == "display") {
2676 }
2677 else if (currentPage()->objectName() == "colormanagement") {
2679 }
2680 else if (currentPage()->objectName() == "performance") {
2682 }
2683 else if (currentPage()->objectName() == "tablet") {
2685 }
2686 else if (currentPage()->objectName() == "canvasonly") {
2688 }
2689 else if (currentPage()->objectName() == "canvasinput") {
2691 }
2692 else if (currentPage()->objectName() == "popuppalette") {
2694 }
2695}
2696
2698{
2699 connect(this->buttonBox(), SIGNAL(clicked(QAbstractButton*)), this, SLOT(slotButtonClicked(QAbstractButton*)));
2700
2701 int retval = exec();
2702 Q_UNUSED(retval);
2703
2704 if (!m_cancelClicked) {
2705 // General settings
2706 KisConfig cfg(false);
2707 KisImageConfig cfgImage(false);
2708
2711 cfg.setSeparateEraserCursor(m_general->m_chkSeparateEraserCursor->isChecked());
2719
2722 cfg.setForceAlwaysFullSizedOutline(!m_general->m_changeBrushOutline->isChecked());
2724 cfg.setForceAlwaysFullSizedEraserOutline(!m_general->m_changeEraserBrushOutline->isChecked());
2727
2728 KConfigGroup group = KSharedConfig::openConfig()->group("File Dialogs");
2729 group.writeEntry("DontUseNativeFileDialog", !m_general->m_chkNativeFileDialog->isChecked());
2730
2731 cfgImage.setMaxBrushSize(m_general->intMaxBrushSize->value());
2732 cfg.setIgnoreHighFunctionKeys(m_general->chkIgnoreHighFunctionKeys->isChecked());
2733
2734 cfg.writeEntry<bool>("use_custom_system_font", m_general->chkUseCustomFont->isChecked());
2735 if (m_general->chkUseCustomFont->isChecked()) {
2736 cfg.writeEntry<QString>("custom_system_font", m_general->cmbCustomFont->currentFont().family());
2737 cfg.writeEntry<int>("custom_font_size", m_general->intFontSize->value());
2738 }
2739 else {
2740 cfg.writeEntry<QString>("custom_system_font", "");
2741 cfg.writeEntry<int>("custom_font_size", -1);
2742 }
2743
2744 cfg.writeEntry<int>("mdi_viewmode", m_general->mdiMode());
2745 cfg.setMDIBackgroundColor(m_general->m_mdiColor->color().toXML());
2746 cfg.setMDIBackgroundImage(m_general->m_backgroundimage->text());
2747 cfg.writeEntry<int>("mdi_rubberband", m_general->m_chkRubberBand->isChecked());
2749 cfg.writeEntry("autosavefileshidden", m_general->chkHideAutosaveFiles->isChecked());
2750
2751 cfg.setBackupFile(m_general->m_backupFileCheckBox->isChecked());
2752 cfg.writeEntry("backupfilelocation", m_general->cmbBackupFileLocation->currentIndex());
2753 cfg.writeEntry("backupfilesuffix", m_general->txtBackupFileSuffix->text());
2754 cfg.writeEntry("numberofbackupfiles", m_general->intNumBackupFiles->value());
2755
2756
2764
2765 const QString configPath = QStandardPaths::writableLocation(QStandardPaths::GenericConfigLocation);
2766 QSettings kritarc(configPath + QStringLiteral("/kritadisplayrc"), QSettings::IniFormat);
2767 kritarc.setValue("EnableHiDPI", m_general->m_chkHiDPI->isChecked());
2768#ifdef HAVE_HIGH_DPI_SCALE_FACTOR_ROUNDING_POLICY
2769 kritarc.setValue("EnableHiDPIFractionalScaling", m_general->m_chkHiDPIFractionalScaling->isChecked());
2770#endif
2771 kritarc.setValue("LogUsage", m_general->chkUsageLogging->isChecked());
2772
2774
2775 cfg.writeEntry<bool>("useCreamyAlphaDarken", (bool)!m_general->cmbFlowMode->currentIndex());
2776 cfg.writeEntry<bool>("useSubtractiveBlendingForCmykColorSpaces", (bool)!m_general->cmbCmykBlendingMode->currentIndex());
2777
2784
2786
2788 cfg.setTouchPainting(KisConfig::TouchPainting(m_general->cmbTouchPainting->currentIndex()));
2789 cfg.writeEntry("useTouchPressureSensitivity", m_general->chkTouchPressureSensitivity->isChecked());
2790 cfg.setActivateTransformToolAfterPaste(m_general->chkEnableTransformToolAfterPaste->isChecked());
2791 cfg.setZoomHorizontal(m_general->chkZoomHorizontally->isChecked());
2792 cfg.setSelectionActionBar(m_general->chkEnableSelectionActionBar->isChecked());
2795 cfg.setCumulativeUndoRedo(m_general->chkCumulativeUndo->isChecked());
2797
2798 // Animation..
2802
2803#ifdef Q_OS_ANDROID
2804 QFileInfo fi(m_general->m_resourceFolderSelector->currentData(Qt::UserRole).value<QString>());
2805#else
2806 QFileInfo fi(m_general->m_urlResourceFolder->fileName());
2807#endif
2808 if (fi.isWritable()) {
2810 }
2811
2815
2816 // Color settings
2818 cfg.setUseSystemMonitorProfile(m_colorSettings->m_page->chkUseSystemMonitorProfile->isChecked());
2819 for (int i = 0; i < QApplication::screens().count(); ++i) {
2820 if (m_colorSettings->m_page->chkUseSystemMonitorProfile->isChecked()) {
2821 int currentIndex = m_colorSettings->m_monitorProfileWidgets[i]->currentIndex();
2822 QString monitorid = m_colorSettings->m_monitorProfileWidgets[i]->itemData(currentIndex).toString();
2823 cfg.setMonitorForScreen(i, monitorid);
2824 } else {
2825 cfg.setMonitorProfile(i,
2826 m_colorSettings->m_monitorProfileWidgets[i]->currentUnsqueezedText(),
2827 m_colorSettings->m_page->chkUseSystemMonitorProfile->isChecked());
2828 }
2829 }
2830 } else {
2834 }
2835 cfg.setUseDefaultColorSpace(m_colorSettings->m_page->useDefColorSpace->isChecked());
2836 if (cfg.useDefaultColorSpace())
2837 {
2838 KoID currentWorkingColorSpace = m_colorSettings->m_page->cmbWorkingColorSpace->currentItem();
2839 cfg.setWorkingColorSpace(currentWorkingColorSpace.id());
2840 cfg.defColorModel(KoColorSpaceRegistry::instance()->colorSpaceColorModelId(currentWorkingColorSpace.id()).id());
2841 cfg.setDefaultColorDepth(KoColorSpaceRegistry::instance()->colorSpaceColorDepthId(currentWorkingColorSpace.id()).id());
2842 }
2843
2844 cfg.writeEntry("ExrDefaultColorProfile", m_colorSettings->m_page->cmbColorProfileForEXR->currentText());
2845
2846 cfgImage.setDefaultProofingConfig(*m_colorSettings->m_page->wdgProofingOptions->currentProofingConfig());
2847 cfg.setUseBlackPointCompensation(m_colorSettings->m_page->chkBlackpoint->isChecked());
2848 cfg.setAllowLCMSOptimization(m_colorSettings->m_page->chkAllowLCMSOptimization->isChecked());
2849 cfg.setForcePaletteColors(m_colorSettings->m_page->chkForcePaletteColor->isChecked());
2851 cfg.setRenderIntent(m_colorSettings->m_page->cmbMonitorIntent->currentIndex());
2852
2853 // Tablet settings
2854 cfg.setPressureTabletCurve( m_tabletSettings->m_page->pressureCurve->curve().toString() );
2856 m_tabletSettings->m_page->chkUseRightMiddleClickWorkaround->isChecked());
2857
2858#if defined Q_OS_WIN && (defined QT5_HAS_WINTAB_SWITCH || QT_VERSION >= QT_VERSION_CHECK(6, 0, 0))
2859 cfg.setUseWin8PointerInput(m_tabletSettings->m_page->radioWin8PointerInput->isChecked());
2860
2861# if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0)
2862 // Qt6 supports switching the tablet API on the fly
2863 using QWindowsApplication = QNativeInterface::Private::QWindowsApplication;
2864 if (auto nativeWindowsApp = dynamic_cast<QWindowsApplication *>(QGuiApplicationPrivate::platformIntegration())) {
2865 nativeWindowsApp->setWinTabEnabled(!cfg.useWin8PointerInput());
2866 }
2867# endif
2868#endif
2869 cfg.writeEntry<bool>("useTimestampsForBrushSpeed", m_tabletSettings->m_page->chkUseTimestampsForBrushSpeed->isChecked());
2870
2871#if KRITA_QT_HAS_ANDROID_EMULATE_MOUSE_BUTTONS_FOR_PAGE_UP_DOWN
2872 cfg.setUsePageUpDownMouseButtonEmulationWorkaround(
2873 m_tabletSettings->m_page->chkUsePageUpDownMouseButtonEmulationWorkaround->isChecked());
2874#endif
2875
2876#if KRITA_QT_HAS_ANDROID_IGNORE_HISTORIC_TABLET_EVENTS
2877 cfg.setUseIgnoreHistoricTabletEventsWorkaround(
2878 m_tabletSettings->m_page->chkUseIgnoreHistoricTabletEventsWorkaround->isChecked());
2879#endif
2880
2881 cfg.writeEntry<int>("maxAllowedSpeedValue", m_tabletSettings->m_page->intMaxAllowedBrushSpeed->value());
2882 cfg.writeEntry<int>("speedValueSmoothing", m_tabletSettings->m_page->intBrushSpeedSmoothing->value());
2883 // the angle is saved in clockwise direction to be consistent with Drawing Angle, so negate
2884 cfg.writeEntry<int>("tiltDirectionOffset", -m_tabletSettings->m_page->tiltDirectionOffsetAngle->angle());
2885
2887
2888 if (!cfg.useOpenGL() && m_displaySettings->grpOpenGL->isChecked())
2889 cfg.setCanvasState("TRY_OPENGL");
2890
2891 if (m_displaySettings->grpOpenGL->isChecked()) {
2893 m_displaySettings->cmbPreferredRenderer->itemData(
2894 m_displaySettings->cmbPreferredRenderer->currentIndex()).toInt());
2896 } else {
2898 }
2899
2900 cfg.setUseOpenGLTextureBuffer(m_displaySettings->chkUseTextureBuffer->isChecked());
2901 cfg.setOpenGLFilteringMode(m_displaySettings->cmbFilterMode->currentIndex());
2902 cfg.setRootSurfaceFormat(&kritarc, indexToFormat(m_displaySettings->cmbPreferedRootSurfaceFormat->currentIndex()));
2903 cfg.setAssistantsDrawMode(indexToAssistantDrawMode(m_displaySettings->cmbAssistantsDrawMode->currentIndex()));
2904
2905 cfg.setCheckSize(m_displaySettings->intCheckSize->value());
2906 cfg.setScrollingCheckers(m_displaySettings->chkMoving->isChecked());
2907 cfg.setCheckersColor1(m_displaySettings->colorChecks1->color().toQColor());
2908 cfg.setCheckersColor2(m_displaySettings->colorChecks2->color().toQColor());
2909 cfg.setCanvasBorderColor(m_displaySettings->canvasBorder->color().toQColor());
2910 cfg.setHideScrollbars(m_displaySettings->hideScrollbars->isChecked());
2911 KoColor c = m_displaySettings->btnSelectionOverlayColor->color();
2912 c.setOpacity(m_displaySettings->sldSelectionOverlayOpacity->value());
2914 cfgImage.setSelectionOutlineOpacity(m_displaySettings->sldSelectionOutlineOpacity->value());
2915 cfg.setAntialiasCurves(m_displaySettings->chkCurveAntialiasing->isChecked());
2916 cfg.setAntialiasSelectionOutline(m_displaySettings->chkSelectionOutlineAntialiasing->isChecked());
2917 cfg.setShowSingleChannelAsColor(m_displaySettings->chkChannelsAsColor->isChecked());
2918 cfg.setHidePopups(m_displaySettings->chkHidePopups->isChecked());
2919
2920 cfg.setHideDockersFullscreen(m_fullscreenSettings->chkDockers->checkState());
2921 cfg.setHideMenuFullscreen(m_fullscreenSettings->chkMenu->checkState());
2922 cfg.setHideScrollbarsFullscreen(m_fullscreenSettings->chkScrollbars->checkState());
2923 cfg.setHideStatusbarFullscreen(m_fullscreenSettings->chkStatusbar->checkState());
2924 cfg.setHideTitlebarFullscreen(m_fullscreenSettings->chkTitlebar->checkState());
2925 cfg.setHideToolbarFullscreen(m_fullscreenSettings->chkToolbar->checkState());
2926
2927 cfg.setCursorMainColor(m_general->cursorColorButton->color().toQColor());
2928 cfg.setEraserCursorMainColor(m_general->eraserCursorColorButton->color().toQColor());
2929 cfg.setPixelGridColor(m_displaySettings->pixelGridColorButton->color().toQColor());
2930 cfg.setPixelGridDrawingThreshold(m_displaySettings->pixelGridDrawingThresholdBox->value() / 100);
2931
2934
2936 cfg.writeEntry("forcedDpiForQtFontBugWorkaround", m_general->forcedFontDpi());
2937 }
2938
2939 return !m_cancelClicked;
2940}
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:799
@ ASSISTANTS_DRAW_MODE_DIRECT
Definition kis_config.h:798
@ ASSISTANTS_DRAW_MODE_LARGE_PIXMAP_CACHE
Definition kis_config.h:800
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:809
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
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 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:819
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()
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)
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)