Krita Source Code Documentation
Loading...
Searching...
No Matches
kis_config.cc
Go to the documentation of this file.
1/*
2 * SPDX-FileCopyrightText: 2002 Patrick Julien <freak@codepimps.org>
3 *
4 * SPDX-License-Identifier: GPL-2.0-or-later
5 */
6
7#include "kis_config.h"
8
9#include <QtGlobal>
10#include <QApplication>
11#include <QScreen>
12#include <QThread>
13#include <QStringList>
14#include <QSettings>
15#include <QStandardPaths>
16#include <QDebug>
17#include <QFileInfo>
18#include <QScreen>
19
20#include <kconfig.h>
21
22#include <KisDocument.h>
23#include <KisResourceLocator.h>
24
25#include <KoColor.h>
28#include <KoColorProfile.h>
29#include <KoPointerEvent.h>
30
31#include <kis_debug.h>
32#include <kis_types.h>
33
35#include "kis_config_notifier.h"
36#include "kis_snap_config.h"
37
38#include <config-ocio.h>
39
41#include <KisUsageLogger.h>
42#include <kis_image_config.h>
44#include <QSurfaceFormat>
45
46#if defined Q_OS_WIN && QT_VERSION >= QT_VERSION_CHECK(6, 0, 0)
47# include <QtGui/private/qguiapplication_p.h>
48# include <QtGui/qpa/qplatformintegration.h>
49#endif
50
51#ifdef Q_OS_ANDROID
52#include <KisAndroidUtils.h>
53#endif
54
56 : m_cfg( KSharedConfig::openConfig()->group(""))
57 , m_readOnly(readOnly)
58{
59 if (!readOnly) {
60 KIS_SAFE_ASSERT_RECOVER_RETURN(qApp && qApp->thread() == QThread::currentThread());
61 }
62}
63
65{
66 if (m_readOnly) return;
67
68 if (qApp && qApp->thread() != QThread::currentThread()) {
69 dbgKrita.noquote() << "WARNING: KisConfig: requested config synchronization from nonGUI thread! Called from:" << kisBacktrace();
70 return;
71 }
72
73 m_cfg.sync();
74}
75
77{
78 KisUsageLogger::writeSysInfo("Current Settings\n");
79 KisUsageLogger::writeSysInfo(QString(" Current Swap Location: %1").arg(KisImageConfig(true).swapDir()));
80 KisUsageLogger::writeSysInfo(QString(" Current Swap Location writable: %1").arg(QFileInfo(KisImageConfig(true).swapDir()).isWritable() ? "true" : "false"));
81 KisUsageLogger::writeSysInfo(QString(" Undo Enabled: %1").arg(undoEnabled()? "true" : "false"));
82 KisUsageLogger::writeSysInfo(QString(" Undo Stack Limit: %1").arg(undoStackLimit()));
83 KisUsageLogger::writeSysInfo(QString(" Use OpenGL: %1").arg(useOpenGL() ? "true" : "false"));
84 KisUsageLogger::writeSysInfo(QString(" Use OpenGL Texture Buffer: %1").arg(useOpenGLTextureBuffer() ? "true" : "false"));
85 KisUsageLogger::writeSysInfo(QString(" Disable Vector Optimizations: %1").arg(disableVectorOptimizations() ? "true" : "false"));
86 KisUsageLogger::writeSysInfo(QString(" Disable AVX Optimizations: %1").arg(disableAVXOptimizations() ? "true" : "false"));
87 KisUsageLogger::writeSysInfo(QString(" Canvas State: %1").arg(canvasState()));
88 KisUsageLogger::writeSysInfo(QString(" Autosave Interval: %1").arg(autoSaveInterval()));
89 KisUsageLogger::writeSysInfo(QString(" Use Backup Files: %1").arg(backupFile() ? "true" : "false"));
90 KisUsageLogger::writeSysInfo(QString(" Number of Backups Kept: %1").arg(m_cfg.readEntry("numberofbackupfiles", 1)));
91 KisUsageLogger::writeSysInfo(QString(" Backup File Suffix: %1").arg(m_cfg.readEntry("backupfilesuffix", "~")));
92
93 QString backupDir;
94 switch(m_cfg.readEntry("backupfilelocation", 0)) {
95 case 1:
96 backupDir = QStandardPaths::writableLocation(QStandardPaths::HomeLocation);
97 break;
98 case 2:
99 backupDir = QStandardPaths::writableLocation(QStandardPaths::TempLocation);
100 break;
101 default:
102 // Do nothing: the empty string is user file location
103 backupDir = "Same Folder as the File";
104 }
105 KisUsageLogger::writeSysInfo(QString(" Backup Location: %1").arg(backupDir));
106 KisUsageLogger::writeSysInfo(QString(" Backup Location writable: %1").arg(QFileInfo(backupDir).isWritable() ? "true" : "false"));
107 KisUsageLogger::writeSysInfo(QString(" Resource Location: %1").arg(m_cfg.readEntry(KisResourceLocator::resourceLocationKey)));
108
109 KisUsageLogger::writeSysInfo(QString(" Use Win8 Pointer Input: %1").arg(useWin8PointerInput() ? "true" : "false"));
110 KisUsageLogger::writeSysInfo(QString(" Use RightMiddleTabletButton Workaround: %1").arg(useRightMiddleTabletButtonWorkaround() ? "true" : "false"));
111 KisUsageLogger::writeSysInfo(QString(" Levels of Detail Enabled: %1").arg(levelOfDetailEnabled() ? "true" : "false"));
112 KisUsageLogger::writeSysInfo(QString(" Use Zip64: %1").arg(useZip64() ? "true" : "false"));
113
115
116 // Tablet API information
117#if defined Q_OS_WIN && QT_VERSION > QT_VERSION_CHECK(6, 0, 0)
118{
119 auto tabletAPIName = [] (bool useWinTab) {
120 return useWinTab ? "WinTab" : "WinInk";
121 };
122
123 QString actualTabletProtocol = "<unknown>";
124
125 using QWindowsApplication = QNativeInterface::Private::QWindowsApplication;
126 if (auto nativeWindowsApp = dynamic_cast<QWindowsApplication *>(QGuiApplicationPrivate::platformIntegration())) {
127 actualTabletProtocol = tabletAPIName(nativeWindowsApp->isWinTabEnabled());
128 } else {
129 KisUsageLogger::log("WARNING: Failed to fetch WinTab protocol status: QWindowsApplication is not available");
130 }
131
132 KisUsageLogger::writeSysInfo("Tablet API Information\n");
133 KisUsageLogger::writeSysInfo(QString(" User-selected tablet API: %1").arg(tabletAPIName(!useWin8PointerInput())));
134 KisUsageLogger::writeSysInfo(QString(" Actually used tablet API: %1").arg(actualTabletProtocol));
136}
137#endif
138
139}
140
142{
143 if (defaultValue) {
144 return TOUCH_PAINTING_AUTO;
145 } else {
146 int value = m_cfg.readEntry("touchPainting", int(TOUCH_PAINTING_AUTO));
147 return TouchPainting(value);
148 }
149}
150
152{
153 m_cfg.writeEntry("touchPainting", int(value));
155}
156
158{
159 switch (touchPainting()) {
161 return false;
163 return true;
164 default:
165 // Automatic detection: enable or disable touch input based on whether
166 // we've received a tablet input during this session and therefore know
167 // that the user has a pen available.
169 }
170}
171
172bool KisConfig::useProjections(bool defaultValue) const
173{
174 return (defaultValue ? true : m_cfg.readEntry("useProjections", true));
175}
176
177void KisConfig::setUseProjections(bool useProj) const
178{
179 m_cfg.writeEntry("useProjections", useProj);
180}
181
182bool KisConfig::undoEnabled(bool defaultValue) const
183{
184 return (defaultValue ? true : m_cfg.readEntry("undoEnabled", true));
185}
186
187void KisConfig::setUndoEnabled(bool undo) const
188{
189 m_cfg.writeEntry("undoEnabled", undo);
190}
191
192int KisConfig::undoStackLimit(bool defaultValue) const
193{
194 return (defaultValue ? 200 : m_cfg.readEntry("undoStackLimit", 200));
195}
196
197void KisConfig::setUndoStackLimit(int limit) const
198{
199 m_cfg.writeEntry("undoStackLimit", limit);
200}
201
202bool KisConfig::useCumulativeUndoRedo(bool defaultValue) const
203{
204 return (defaultValue ? false : m_cfg.readEntry("useCumulativeUndoRedo",false));
205}
206
208{
209 m_cfg.writeEntry("useCumulativeUndoRedo", value);
210}
211
213{
214 if (defaultValue) {
216 }
217
219 data.read(&m_cfg);
220 return data;
221}
222
227
228qint32 KisConfig::defImageWidth(bool defaultValue) const
229{
230 return (defaultValue ? 2480 : m_cfg.readEntry("imageWidthDef", 2480));
231}
232
233qint32 KisConfig::defImageHeight(bool defaultValue) const
234{
235 return (defaultValue ? 3508 : m_cfg.readEntry("imageHeightDef", 3508));
236}
237
238qreal KisConfig::defImageResolution(bool defaultValue) const
239{
240 return (defaultValue ? 300.0 : m_cfg.readEntry("imageResolutionDef", 300.0)) / 72.0;
241}
242
243QString KisConfig::defColorModel(bool defaultValue) const
244{
245 return (defaultValue ? KoColorSpaceRegistry::instance()->rgb8()->colorModelId().id()
246 : m_cfg.readEntry("colorModelDef", KoColorSpaceRegistry::instance()->rgb8()->colorModelId().id()));
247}
248
249void KisConfig::defColorModel(const QString & model) const
250{
251 m_cfg.writeEntry("colorModelDef", model);
252}
253
254QString KisConfig::defaultColorDepth(bool defaultValue) const
255{
256 return (defaultValue ? KoColorSpaceRegistry::instance()->rgb8()->colorDepthId().id()
257 : m_cfg.readEntry("colorDepthDef", KoColorSpaceRegistry::instance()->rgb8()->colorDepthId().id()));
258}
259
260void KisConfig::setDefaultColorDepth(const QString & depth) const
261{
262 m_cfg.writeEntry("colorDepthDef", depth);
263}
264
265QString KisConfig::defColorProfile(bool defaultValue) const
266{
267 return (defaultValue ? KoColorSpaceRegistry::instance()->rgb8()->profile()->name() :
268 m_cfg.readEntry("colorProfileDef",
269 KoColorSpaceRegistry::instance()->rgb8()->profile()->name()));
270}
271
272void KisConfig::defColorProfile(const QString & profile) const
273{
274 m_cfg.writeEntry("colorProfileDef", profile);
275}
276
277void KisConfig::defImageWidth(qint32 width) const
278{
279 m_cfg.writeEntry("imageWidthDef", width);
280}
281
282void KisConfig::defImageHeight(qint32 height) const
283{
284 m_cfg.writeEntry("imageHeightDef", height);
285}
286
287void KisConfig::defImageResolution(qreal res) const
288{
289 m_cfg.writeEntry("imageResolutionDef", res*72.0);
290}
291
293{
294 return defaultValue ? 100.0 : m_cfg.readEntry("preferredVectorImportResolution", 100.0);
295}
296
298{
299 m_cfg.writeEntry("preferredVectorImportResolution", value);
300}
301
302bool KisConfig::useDefaultColorSpace(bool defaultvalue) const
303{
304 return (defaultvalue? false: m_cfg.readEntry("useDefaultColorSpace", false));
305}
306
308{
309 m_cfg.writeEntry("useDefaultColorSpace", value);
310}
311
312// brush cursor settings
313
314void cleanOldCursorStyleKeys(KConfigGroup &cfg)
315{
316 if (cfg.hasKey("newCursorStyle") &&
317 cfg.hasKey("newOutlineStyle")) {
318
319 cfg.deleteEntry("cursorStyleDef");
320 }
321}
322
324{
325 if (defaultValue) {
327 }
328
329
330 int style = m_cfg.readEntry("newCursorStyle", int(-1));
331
332 if (style < 0) {
333 // old style format
334 style = m_cfg.readEntry("cursorStyleDef", int(OLD_CURSOR_STYLE_OUTLINE));
335
336 switch (style) {
338 style = CURSOR_STYLE_TOOLICON;
339 break;
343 break;
345 style = CURSOR_STYLE_POINTER;
346 break;
350 break;
354 break;
358 break;
362 break;
363 default:
364 style = -1;
365 }
366 }
367
369
370 // compatibility with future versions
371 if (style < 0 || style >= N_CURSOR_STYLE_SIZE) {
373 }
374
375 return (CursorStyle) style;
376}
377
379{
380 m_cfg.writeEntry("newCursorStyle", (int)style);
381}
382
383QColor KisConfig::getCursorMainColor(bool defaultValue) const
384{
385 QColor col;
386 col.setRgbF(1.0, 0.0, 1.0);
387 return (defaultValue ? col : m_cfg.readEntry("cursorMaincColor", col));
388}
389
390void KisConfig::setCursorMainColor(const QColor &v) const
391{
392 m_cfg.writeEntry("cursorMaincColor", v);
393}
394
396{
397 if (defaultValue) {
398 return OUTLINE_FULL;
399 }
400
401 int style = m_cfg.readEntry("newOutlineStyle", int(-1));
402
403 if (style < 0) {
404 // old style format
405 style = m_cfg.readEntry("cursorStyleDef", int(OLD_CURSOR_STYLE_OUTLINE));
406
407 switch (style) {
415 style = OUTLINE_NONE;
416 break;
422 style = OUTLINE_FULL;
423 break;
424 default:
425 style = -1;
426 }
427 }
428
430
431 // compatibility with future versions
432 if (style < 0 || style >= N_OUTLINE_STYLE_SIZE) {
433 style = OUTLINE_FULL;
434 }
435
436 return (OutlineStyle) style;
437}
438
440{
441 m_cfg.writeEntry("newOutlineStyle", (int)style);
442}
443
445{
446 if (defaultValue) {
447 return OUTLINE_NONE;
448 }
449
450 int style = m_cfg.readEntry("lastUsedOutlineStyle", int(-1));
451
452 return (OutlineStyle) style;
453}
454
456{
457 m_cfg.writeEntry("lastUsedOutlineStyle", (int)style);
458}
459
460// eraser cursor settings
461
462bool KisConfig::separateEraserCursor(bool defaultValue) const
463{
464 return (defaultValue ? false : m_cfg.readEntry("separateEraserCursor", false));
465}
466
468{
469 m_cfg.writeEntry("separateEraserCursor", value);
470}
471
473{
474 if (defaultValue) {
475 return CURSOR_STYLE_ERASER;
476 }
477
478 int style = m_cfg.readEntry("eraserCursorStyle", int(-1));
479
480 // compatibility with future versions
481 if (style < 0 || style >= N_CURSOR_STYLE_SIZE) {
482 style = CURSOR_STYLE_ERASER;
483 }
484
485 return (CursorStyle) style;
486}
487
489{
490 m_cfg.writeEntry("eraserCursorStyle", (int)style);
491}
492
493QColor KisConfig::getEraserCursorMainColor(bool defaultValue) const
494{
495 QColor col;
496 col.setRgbF(0.501961, 1.0, 0.501961);
497 return (defaultValue ? col : m_cfg.readEntry("eraserCursorMaincColor", col));
498}
499
500void KisConfig::setEraserCursorMainColor(const QColor &v) const
501{
502 m_cfg.writeEntry("eraserCursorMaincColor", v);
503}
504
506{
507 if (defaultValue) {
508 return OUTLINE_FULL;
509 }
510
511 int style = m_cfg.readEntry("eraserOutlineStyle", int(-1));
512
513 // compatibility with future versions
514 if (style < 0 || style >= N_OUTLINE_STYLE_SIZE) {
515 style = OUTLINE_FULL;
516 }
517
518 return (OutlineStyle) style;
519}
520
522{
523 m_cfg.writeEntry("eraserOutlineStyle", (int)style);
524}
525
527{
528 if (!defaultValue) {
529 int style = m_cfg.readEntry("colorSamplerPreviewStyle", int(ColorSamplerPreviewStyle::Circle));
530 if (style >= 0 && style < int(ColorSamplerPreviewStyle::Count)) {
531 return ColorSamplerPreviewStyle(style);
532 }
533 }
535}
536
538{
539 m_cfg.writeEntry("colorSamplerPreviewStyle", int(style));
541}
542
544{
545 int def = 180;
546 if (!defaultValue) {
547 return m_cfg.readEntry("colorSamplerPreviewCircleDiameter", def);
548 }
549 return def;
550}
551
553{
554 m_cfg.writeEntry("colorSamplerPreviewCircleDiameter", diameter);
555}
556
558{
559 qreal def = 12; // percentage
560 if (!defaultValue) {
561 return m_cfg.readEntry("colorSamplerPreviewCircleThickness", def);
562 }
563 return def;
564}
565
567{
568 m_cfg.writeEntry("colorSamplerPreviewCircleThickness", thickness);
569}
570
572{
573 bool def = true;
574 if (!defaultValue) {
575 return m_cfg.readEntry("colorSamplerPreviewCircleOutlineEnabled", def);
576 }
577 return def;
578}
579
581{
582 m_cfg.writeEntry("colorSamplerPreviewCircleOutlineEnabled", enabled);
583}
584
586{
587 bool def = true;
588 if (!defaultValue) {
589 return m_cfg.readEntry("colorSamplerPreviewCircleExtraCirclesEnabled", def);
590 }
591 return def;
592}
593
595{
596 m_cfg.writeEntry("colorSamplerPreviewCircleExtraCirclesEnabled", enabled);
597}
598
599bool KisConfig::colorSamplerZoomPreviewEnabled(bool defaultValue) const {
600 bool def = false;
601 if (!defaultValue) {
602 return m_cfg.readEntry("colorSamplerZoomPreviewEnabled", def);
603 }
604 return def;
605}
607 m_cfg.writeEntry("colorSamplerZoomPreviewEnabled", enabled);
608}
609
610qreal KisConfig::colorSamplerZoomPreviewScale(bool defaultValue) const {
611 qreal def = 10;
612 if (!defaultValue) {
613 return m_cfg.readEntry("colorSamplerZoomPreviewScale", def);
614 }
615 return def;
616}
617
619 m_cfg.writeEntry("colorSamplerZoomPreviewScale", scale);
620}
621
623 if (!defaultValue) {
624 int pos = m_cfg.readEntry("colorSamplerPreviewCirclePosition", int(ColorSamplerPreviewCirclePosition::Center));
625 if (pos >= 0 && pos < int(ColorSamplerPreviewCirclePosition::Count)) {
627 }
628 }
630}
631
633 m_cfg.writeEntry("colorSamplerPreviewCirclePosition", int(position));
634}
635
636bool KisConfig::useDirtyPresets(bool defaultValue) const
637{
638 return (defaultValue ? false : m_cfg.readEntry("useDirtyPresets", true));
639}
641{
642 m_cfg.writeEntry("useDirtyPresets",value);
644}
645
646bool KisConfig::useEraserBrushSize(bool defaultValue) const
647{
648 return (defaultValue ? false : m_cfg.readEntry("useEraserBrushSize", false));
649}
650
652{
653 m_cfg.writeEntry("useEraserBrushSize",value);
655}
656
657bool KisConfig::useEraserBrushOpacity(bool defaultValue) const
658{
659 return (defaultValue ? false : m_cfg.readEntry("useEraserBrushOpacity",false));
660}
661
663{
664 m_cfg.writeEntry("useEraserBrushOpacity",value);
666}
667
668QPoint KisConfig::getDefaultGridSpacing(bool defaultValue) const
669{
670 return (defaultValue ? QPoint(16, 16) : m_cfg.readEntry("defaultGridSpacing", QPoint(16, 16)));
671}
672
673void KisConfig::setDefaultGridSpacing(QPoint gridSpacing)
674{
675 m_cfg.writeEntry("defaultGridSpacing", gridSpacing);
676}
677
678QString KisConfig::getMDIBackgroundColor(bool defaultValue) const
679{
680 QColor col(77, 77, 77);
682 kol.fromQColor(col);
683 QString xml = kol.toXML();
684 return (defaultValue ? xml : m_cfg.readEntry("mdiBackgroundColorXML", xml));
685}
686
687void KisConfig::setMDIBackgroundColor(const QString &v) const
688{
689 m_cfg.writeEntry("mdiBackgroundColorXML", v);
690}
691
692QString KisConfig::getMDIBackgroundImage(bool defaultValue) const
693{
694 return (defaultValue ? "" : m_cfg.readEntry("mdiBackgroundImage", ""));
695}
696
697void KisConfig::setMDIBackgroundImage(const QString &filename) const
698{
699 m_cfg.writeEntry("mdiBackgroundImage", filename);
700}
701
703{
704 return (defaultValue ? true : m_cfg.readEntry("enableCanvasSurfaceColorSpaceManagement",true));
705}
706
708{
709 m_cfg.writeEntry("enableCanvasSurfaceColorSpaceManagement", value);
710}
711
712bool KisConfig::effectiveShouldUseNativeSurfaceForCanvas(bool osManagedSurfacePresent) const
713{
714 bool useNativeSurfaceForCanvas = osManagedSurfacePresent && this->enableCanvasSurfaceColorSpaceManagement();
715 if (qEnvironmentVariableIsSet("KRITA_USE_NATIVE_CANVAS_SURFACE")) {
716 useNativeSurfaceForCanvas = qEnvironmentVariableIntValue("KRITA_USE_NATIVE_CANVAS_SURFACE");
717 qDebug() << "FPS-DEBUG: Krita canvas mode is overridden:" << (useNativeSurfaceForCanvas ? "native surface" : "legacy mode") << useNativeSurfaceForCanvas << qEnvironmentVariableIsSet("KRITA_USE_NATIVE_CANVAS_SURFACE");
718 }
719 return useNativeSurfaceForCanvas;
720}
721
723 QString modeStr = defaultValue ? "preferred" : m_cfg.readEntry("canvasSurfaceColorSpaceManagementMode", "preferred");
724
725 if (modeStr == "preferred") {
727 } else if (modeStr == "rec709g22") {
729 } else if (modeStr == "rec709g10") {
731 } else if (modeStr == "rec2020pq") {
733 } else if (modeStr == "unmanaged") {
735 } else {
737 }
738}
739
741 QString modeStr;
742
743 switch (value) {
745 modeStr = "preferred";
746 break;
748 modeStr = "rec709g22";
749 break;
751 modeStr = "rec709g10";
752 break;
754 modeStr = "rec2020pq";
755 break;
757 modeStr = "unmanaged";
758 break;
759 }
760
761 m_cfg.writeEntry("canvasSurfaceColorSpaceManagementMode", modeStr);
762}
763
764
766{
767 QString modeStr = defaultValue ? "auto" : settings->value("canvasSurfaceBitDepthMode", "auto").toString();
768
769 if (modeStr == "auto") {
771 } else if (modeStr == "8bit") {
773 } else if (modeStr == "10bit") {
775 }
776
778}
779
781{
782 QString modeStr;
783
784 switch (value) {
786 modeStr = "auto";
787 break;
789 modeStr = "8bit";
790 break;
792 modeStr = "10bit";
793 break;
794 }
795
796 settings->setValue("canvasSurfaceBitDepthMode", modeStr);
797}
798
800{
801 const QString configPath = QStandardPaths::writableLocation(QStandardPaths::GenericConfigLocation);
802 QSettings kritarc(configPath + QStringLiteral("/kritadisplayrc"), QSettings::IniFormat);
803 return canvasSurfaceBitDepthMode(&kritarc, defaultValue);
804}
805
807{
808 const QString configPath = QStandardPaths::writableLocation(QStandardPaths::GenericConfigLocation);
809 QSettings kritarc(configPath + QStringLiteral("/kritadisplayrc"), QSettings::IniFormat);
811}
812
814{
815 auto mode = canvasSurfaceBitDepthMode();
816
818 if (format.redBufferSize() == 10 &&
819 format.greenBufferSize() == 10 &&
820 format.blueBufferSize() == 10) {
821
823 } else {
825 }
826 }
827
828 return mode;
829}
830
831
832QString KisConfig::monitorProfile(int screen) const
833{
834 // Note: keep this in sync with the default profile for the RGB colorspaces!
835 const QString defaultProfile = "sRGB-elle-V2-srgbtrc.icc";
836
837 QString profile;
838 const QString screenIdentifier = getScreenStringIdentfier(screen);
839 const QString screenIdentifierKey = "monitorProfile" + screenIdentifier;
840
846 if (!screenIdentifier.isEmpty() && m_cfg.hasKey(screenIdentifierKey)) {
847 profile = m_cfg.readEntry(screenIdentifierKey, defaultProfile);
848 } else {
849 profile = m_cfg.readEntry("monitorProfile" + QString(screen == 0 ? "": QString("_%1").arg(screen)), defaultProfile);
850 }
851
852 //dbgKrita << "KisConfig::monitorProfile()" << profile;
853 return profile;
854}
855
856void KisConfig::setMonitorProfile(int screen, const QString & monitorProfile) const
857{
858 m_cfg.writeEntry("monitorProfile" + QString(screen == 0 ? "": QString("_%1").arg(screen)), monitorProfile);
859 if (!getScreenStringIdentfier(screen).isEmpty()) {
860 m_cfg.writeEntry("monitorProfile" + getScreenStringIdentfier(screen), monitorProfile);
861 }
862}
863
865{
866 if (screen < 0) return 0;
867
868 const KoColorProfile *profile = 0;
869
870 {
871 //dbgKrita << "\tGoing to get the monitor profile";
872 QString monitorProfileName = monitorProfile(screen);
873 //dbgKrita << "\t\tmonitorProfileName:" << monitorProfileName;
874 if (!monitorProfileName.isEmpty()) {
875 profile = KoColorSpaceRegistry::instance()->profileByName(monitorProfileName);
876 }
877 if (profile) {
878 //dbgKrita << "\t\tsuitable for display" << profile->isSuitableForDisplay();
879 }
880 else {
881 //dbgKrita << "\t\tstill no profile";
882 }
883 }
884 // if we still don't have a profile, or the profile isn't suitable for display,
885 // we need to get a last-resort profile. the built-in sRGB is a good choice then.
886 if (!profile || !profile->isSuitableForDisplay()) {
887 //dbgKrita << "\tnothing worked, going to get sRGB built-in";
888 profile = KoColorSpaceRegistry::instance()->profileByName("sRGB Built-in");
889 }
890
891 if (profile) {
892 //dbgKrita << "\tKisConfig::displayProfile for screen" << screen << "is" << profile->name();
893 }
894 else {
895 //dbgKrita << "\tCouldn't get a display profile at all";
896 }
897
898 return profile;
899}
900
901const QString KisConfig::getScreenStringIdentfier(int screenNo) const {
902 if (screenNo < 0 || screenNo >= QGuiApplication::screens().length()) {
903 return QString();
904 }
905 QScreen* screen = QGuiApplication::screens()[screenNo];
906
907 QString manufacturer = screen->manufacturer();
908 QString model = screen->model();
909 QString serialNumber = screen->serialNumber();
910
911 if (manufacturer == "" && model == "" && serialNumber == "") {
912 return QString(); // it would be scary to base the profile just on resolution
913 }
914
915 QString identifier = QStringList({manufacturer, model, serialNumber}).join("_");
916 return identifier;
917}
918
919QString KisConfig::workingColorSpace(bool defaultValue) const
920{
921 return (defaultValue ? "RGBA" : m_cfg.readEntry("workingColorSpace", "RGBA"));
922}
923
924void KisConfig::setWorkingColorSpace(const QString & workingColorSpace) const
925{
926 m_cfg.writeEntry("workingColorSpace", workingColorSpace);
927}
928
929QString KisConfig::printerColorSpace(bool /*defaultValue*/) const
930{
931 //TODO currently only rgb8 is supported
932 //return (defaultValue ? "RGBA" : m_cfg.readEntry("printerColorSpace", "RGBA"));
933 return QString("RGBA");
934}
935
936void KisConfig::setPrinterColorSpace(const QString & printerColorSpace) const
937{
938 m_cfg.writeEntry("printerColorSpace", printerColorSpace);
939}
940
941
942QString KisConfig::printerProfile(bool defaultValue) const
943{
944 return (defaultValue ? "" : m_cfg.readEntry("printerProfile", ""));
945}
946
947void KisConfig::setPrinterProfile(const QString & printerProfile) const
948{
949 m_cfg.writeEntry("printerProfile", printerProfile);
950}
951
952
953bool KisConfig::useBlackPointCompensation(bool defaultValue) const
954{
955 return (defaultValue ? true : m_cfg.readEntry("useBlackPointCompensation", true));
956}
957
958void KisConfig::setUseBlackPointCompensation(bool useBlackPointCompensation) const
959{
960 m_cfg.writeEntry("useBlackPointCompensation", useBlackPointCompensation);
961}
962
963bool KisConfig::allowLCMSOptimization(bool defaultValue) const
964{
965 return (defaultValue ? true : m_cfg.readEntry("allowLCMSOptimization", true));
966}
967
968void KisConfig::setAllowLCMSOptimization(bool allowLCMSOptimization)
969{
970 m_cfg.writeEntry("allowLCMSOptimization", allowLCMSOptimization);
971}
972
973bool KisConfig::forcePaletteColors(bool defaultValue) const
974{
975 return (defaultValue ? false : m_cfg.readEntry("colorsettings/forcepalettecolors", false));
976}
977
978void KisConfig::setForcePaletteColors(bool forcePaletteColors)
979{
980 m_cfg.writeEntry("colorsettings/forcepalettecolors", forcePaletteColors);
981}
982
983bool KisConfig::colorHistoryPerDocument(bool defaultValue) const
984{
985 KConfigGroup cfg = KSharedConfig::openConfig()->group("advancedColorSelector");
986 return (defaultValue ? false : cfg.readEntry("lastUsedColorsPerDocument", false));
987}
988
989bool KisConfig::showRulers(bool defaultValue) const
990{
991 return (defaultValue ? false : m_cfg.readEntry("showrulers", false));
992}
993
994void KisConfig::setShowRulers(bool rulers) const
995{
996 m_cfg.writeEntry("showrulers", rulers);
997}
998
999bool KisConfig::forceShowSaveMessages(bool defaultValue) const
1000{
1001 return (defaultValue ? false : m_cfg.readEntry("forceShowSaveMessages", false));
1002}
1003
1005{
1006 m_cfg.writeEntry("forceShowSaveMessages", value);
1007}
1008
1009bool KisConfig::forceShowAutosaveMessages(bool defaultValue) const
1010{
1011 return (defaultValue ? false : m_cfg.readEntry("forceShowAutosaveMessages", false));
1012}
1013
1015{
1016 m_cfg.writeEntry("forceShowAutosaveMessages", value);
1017}
1018
1019bool KisConfig::rulersTrackMouse(bool defaultValue) const
1020{
1021 return (defaultValue ? true : m_cfg.readEntry("rulersTrackMouse", true));
1022}
1023
1025{
1026 m_cfg.writeEntry("rulersTrackMouse", value);
1027}
1028
1029qint32 KisConfig::pasteBehaviour(bool defaultValue) const
1030{
1031 return (defaultValue ? 2 : m_cfg.readEntry("pasteBehaviour", 2));
1032}
1033
1034void KisConfig::setPasteBehaviour(qint32 renderIntent) const
1035{
1036 m_cfg.writeEntry("pasteBehaviour", renderIntent);
1037}
1038
1039qint32 KisConfig::pasteFormat(bool defaultValue) const
1040{
1041 return defaultValue ? 0 : m_cfg.readEntry("pasteFormat", 0);
1042}
1043
1044void KisConfig::setPasteFormat(qint32 format)
1045{
1046 m_cfg.writeEntry("pasteFormat", format);
1047}
1048
1049qint32 KisConfig::monitorRenderIntent(bool defaultValue) const
1050{
1051 qint32 intent = m_cfg.readEntry("renderIntent", INTENT_RELATIVE_COLORIMETRIC);
1052 if (intent > 3) intent = 3;
1053 if (intent < 0) intent = 0;
1054 return (defaultValue ? INTENT_RELATIVE_COLORIMETRIC : intent);
1055}
1056
1057void KisConfig::setRenderIntent(qint32 renderIntent) const
1058{
1059 if (renderIntent > 3) renderIntent = 3;
1060 if (renderIntent < 0) renderIntent = 0;
1061 m_cfg.writeEntry("renderIntent", renderIntent);
1062}
1063
1064bool KisConfig::useOpenGL(bool defaultValue) const
1065{
1066 if (defaultValue) {
1067 return true;
1068 }
1069
1070 const QString configPath = QStandardPaths::writableLocation(QStandardPaths::GenericConfigLocation);
1071 QSettings kritarc(configPath + QStringLiteral("/kritadisplayrc"), QSettings::IniFormat);
1072
1073 return kritarc.value("OpenGLRenderer", "auto").toString() != "none";
1074}
1075
1077{
1078 const QString configPath = QStandardPaths::writableLocation(QStandardPaths::GenericConfigLocation);
1079 QSettings kritarc(configPath + QStringLiteral("/kritadisplayrc"), QSettings::IniFormat);
1080
1081 kritarc.setValue("OpenGLRenderer", "none");
1082}
1083
1084int KisConfig::openGLFilteringMode(bool defaultValue) const
1085{
1086 return (defaultValue ? 3 : m_cfg.readEntry("OpenGLFilterMode", 3));
1087}
1088
1090{
1091 m_cfg.writeEntry("OpenGLFilterMode", filteringMode);
1092}
1093
1095{
1096 m_cfg.writeEntry("widgetStyle", name);
1097}
1098
1099QString KisConfig::widgetStyle(bool defaultValue)
1100{
1101 return (defaultValue ? "" : m_cfg.readEntry("widgetStyle", ""));
1102}
1103
1104bool KisConfig::useOpenGLTextureBuffer(bool defaultValue) const
1105{
1106 return (defaultValue ? true : m_cfg.readEntry("useOpenGLTextureBuffer", true));
1107}
1108
1110{
1111 m_cfg.writeEntry("useOpenGLTextureBuffer", useBuffer);
1112}
1113
1114bool KisConfig::preferXcbEglProvider(const QSettings *settings, bool defaultValue)
1115{
1116 return (defaultValue ? false : settings->value("preferXcbEglProvider", false).toBool());
1117}
1118
1119bool KisConfig::preferXcbEglProvider(bool defaultValue) const
1120{
1121 const QString configPath = QStandardPaths::writableLocation(QStandardPaths::GenericConfigLocation);
1122 QSettings kritarc(configPath + QStringLiteral("/kritadisplayrc"), QSettings::IniFormat);
1123 return preferXcbEglProvider(&kritarc, defaultValue);
1124}
1125
1127{
1128 const QString configPath = QStandardPaths::writableLocation(QStandardPaths::GenericConfigLocation);
1129 QSettings kritarc(configPath + QStringLiteral("/kritadisplayrc"), QSettings::IniFormat);
1130 kritarc.setValue("preferXcbEglProvider", value);
1131}
1132
1133int KisConfig::openGLTextureSize(bool defaultValue) const
1134{
1135 return (defaultValue ? 256 : m_cfg.readEntry("textureSize", 256));
1136}
1137
1138bool KisConfig::forceOpenGLFenceWorkaround(bool defaultValue) const
1139{
1140 return (defaultValue ? false : m_cfg.readEntry("forceOpenGLFenceWorkaround", false));
1141}
1142
1143int KisConfig::numMipmapLevels(bool defaultValue) const
1144{
1145 return (defaultValue ? 4 : m_cfg.readEntry("numMipmapLevels", 4));
1146}
1147
1149{
1150 return 1 << qMax(0, numMipmapLevels());
1151}
1152
1153quint32 KisConfig::getGridMainStyle(bool defaultValue) const
1154{
1155 int v = m_cfg.readEntry("gridmainstyle", 0);
1156 v = qBound(0, v, 2);
1157 return (defaultValue ? 0 : v);
1158}
1159
1161{
1162 m_cfg.writeEntry("gridmainstyle", v);
1163}
1164
1165quint32 KisConfig::getGridSubdivisionStyle(bool defaultValue) const
1166{
1167 quint32 v = m_cfg.readEntry("gridsubdivisionstyle", 1);
1168 if (v > 2) v = 2;
1169 return (defaultValue ? 1 : v);
1170}
1171
1173{
1174 m_cfg.writeEntry("gridsubdivisionstyle", v);
1175}
1176
1177quint32 KisConfig::getGridIsoVerticalStyle(bool defaultValue) const
1178{
1179 int v = m_cfg.readEntry("gridisoverticalstyle", 0);
1180 v = qBound(0, v, 3);
1181 return (defaultValue ? 0 : v);
1182}
1183
1185{
1186 m_cfg.writeEntry("gridisoverticalstyle", v);
1187}
1188
1189QColor KisConfig::getGridMainColor(bool defaultValue) const
1190{
1191 QColor col(99, 99, 99);
1192 return (defaultValue ? col : m_cfg.readEntry("gridmaincolor", col));
1193}
1194
1195void KisConfig::setGridMainColor(const QColor & v) const
1196{
1197 m_cfg.writeEntry("gridmaincolor", v);
1198}
1199
1200QColor KisConfig::getGridSubdivisionColor(bool defaultValue) const
1201{
1202 QColor col(150, 150, 150);
1203 return (defaultValue ? col : m_cfg.readEntry("gridsubdivisioncolor", col));
1204}
1205
1206void KisConfig::setGridSubdivisionColor(const QColor & v) const
1207{
1208 m_cfg.writeEntry("gridsubdivisioncolor", v);
1209}
1210
1211QColor KisConfig::getGridIsoVerticalColor(bool defaultValue) const
1212{
1213 QColor col(150, 150, 150);
1214 return (defaultValue ? col : m_cfg.readEntry("gridisoverticalcolor", col));
1215}
1216
1217void KisConfig::setGridIsoVerticalColor(const QColor & v) const
1218{
1219 m_cfg.writeEntry("gridisoverticalcolor", v);
1220}
1221
1222QColor KisConfig::getPixelGridColor(bool defaultValue) const
1223{
1224 QColor col(255, 255, 255);
1225 return (defaultValue ? col : m_cfg.readEntry("pixelGridColor", col));
1226}
1227
1228void KisConfig::setPixelGridColor(const QColor & v) const
1229{
1230 m_cfg.writeEntry("pixelGridColor", v);
1231}
1232
1233qreal KisConfig::getPixelGridDrawingThreshold(bool defaultValue) const
1234{
1235 qreal border = 24.0f;
1236 return (defaultValue ? border : m_cfg.readEntry("pixelGridDrawingThreshold", border));
1237}
1238
1240{
1241 m_cfg.writeEntry("pixelGridDrawingThreshold", v);
1242}
1243
1244bool KisConfig::pixelGridEnabled(bool defaultValue) const
1245{
1246 bool enabled = true;
1247 return (defaultValue ? enabled : m_cfg.readEntry("pixelGridEnabled", enabled));
1248}
1249
1251{
1252 m_cfg.writeEntry("pixelGridEnabled", v);
1253}
1254
1255quint32 KisConfig::guidesLineStyle(bool defaultValue) const
1256{
1257 int v = m_cfg.readEntry("guidesLineStyle", 0);
1258 v = qBound(0, v, 2);
1259 return (defaultValue ? 0 : v);
1260}
1261
1263{
1264 m_cfg.writeEntry("guidesLineStyle", v);
1265}
1266
1267QColor KisConfig::guidesColor(bool defaultValue) const
1268{
1269 QColor col(99, 99, 99);
1270 return (defaultValue ? col : m_cfg.readEntry("guidesColor", col));
1271}
1272
1273void KisConfig::setGuidesColor(const QColor & v) const
1274{
1275 m_cfg.writeEntry("guidesColor", v);
1276}
1277
1278void KisConfig::loadSnapConfig(KisSnapConfig *config, bool defaultValue) const
1279{
1280 KisSnapConfig defaultConfig(false);
1281
1282 if (defaultValue) {
1283 *config = defaultConfig;
1284 return;
1285 }
1286
1287 config->setOrthogonal(m_cfg.readEntry("globalSnapOrthogonal", defaultConfig.orthogonal()));
1288 config->setNode(m_cfg.readEntry("globalSnapNode", defaultConfig.node()));
1289 config->setExtension(m_cfg.readEntry("globalSnapExtension", defaultConfig.extension()));
1290 config->setIntersection(m_cfg.readEntry("globalSnapIntersection", defaultConfig.intersection()));
1291 config->setBoundingBox(m_cfg.readEntry("globalSnapBoundingBox", defaultConfig.boundingBox()));
1292 config->setImageBounds(m_cfg.readEntry("globalSnapImageBounds", defaultConfig.imageBounds()));
1293 config->setImageCenter(m_cfg.readEntry("globalSnapImageCenter", defaultConfig.imageCenter()));
1294 config->setToPixel(m_cfg.readEntry("globalSnapToPixel", defaultConfig.toPixel()));
1295}
1296
1298{
1299 m_cfg.writeEntry("globalSnapOrthogonal", config.orthogonal());
1300 m_cfg.writeEntry("globalSnapNode", config.node());
1301 m_cfg.writeEntry("globalSnapExtension", config.extension());
1302 m_cfg.writeEntry("globalSnapIntersection", config.intersection());
1303 m_cfg.writeEntry("globalSnapBoundingBox", config.boundingBox());
1304 m_cfg.writeEntry("globalSnapImageBounds", config.imageBounds());
1305 m_cfg.writeEntry("globalSnapImageCenter", config.imageCenter());
1306 m_cfg.writeEntry("globalSnapToPixel", config.toPixel());
1307}
1308
1309qint32 KisConfig::checkSize(bool defaultValue) const
1310{
1311 qint32 size = (defaultValue ? 32 : m_cfg.readEntry("checksize", 32));
1312 if (size == 0) size = 32;
1313 return size;
1314}
1315
1316void KisConfig::setCheckSize(qint32 checksize) const
1317{
1318 if (checksize == 0) {
1319 checksize = 32;
1320 }
1321 m_cfg.writeEntry("checksize", checksize);
1322}
1323
1324bool KisConfig::scrollCheckers(bool defaultValue) const
1325{
1326 return (defaultValue ? false : m_cfg.readEntry("scrollingcheckers", false));
1327}
1328
1330{
1331 m_cfg.writeEntry("scrollingcheckers", sc);
1332}
1333
1334QColor KisConfig::canvasBorderColor(bool defaultValue) const
1335{
1336 QColor color(QColor(128,128,128));
1337 return (defaultValue ? color : m_cfg.readEntry("canvasBorderColor", color));
1338}
1339
1340void KisConfig::setCanvasBorderColor(const QColor& color) const
1341{
1342 m_cfg.writeEntry("canvasBorderColor", color);
1343}
1344
1345bool KisConfig::hideScrollbars(bool defaultValue) const
1346{
1347 return (defaultValue ? false : m_cfg.readEntry("hideScrollbars", false));
1348}
1349
1351{
1352 m_cfg.writeEntry("hideScrollbars", value);
1353}
1354
1355bool KisConfig::scrollbarZoomEnabled(bool defaultValue) const
1356{
1357 return (defaultValue ? true : m_cfg.readEntry("scrollbarZoomEnabled", true));
1358}
1359
1361{
1362 m_cfg.writeEntry("scrollbarZoomEnabled", enabled);
1363}
1364
1365QColor KisConfig::checkersColor1(bool defaultValue) const
1366{
1367 QColor col(220, 220, 220);
1368 return (defaultValue ? col : m_cfg.readEntry("checkerscolor", col));
1369}
1370
1371void KisConfig::setCheckersColor1(const QColor & v) const
1372{
1373 m_cfg.writeEntry("checkerscolor", v);
1374}
1375
1376QColor KisConfig::checkersColor2(bool defaultValue) const
1377{
1378 return (defaultValue ? QColor(Qt::white) : m_cfg.readEntry("checkerscolor2", QColor(Qt::white)));
1379}
1380
1381void KisConfig::setCheckersColor2(const QColor & v) const
1382{
1383 m_cfg.writeEntry("checkerscolor2", v);
1384}
1385
1386bool KisConfig::antialiasCurves(bool defaultValue) const
1387{
1388 return (defaultValue ? true : m_cfg.readEntry("antialiascurves", true));
1389}
1390
1392{
1393 m_cfg.writeEntry("antialiascurves", v);
1394}
1395
1396bool KisConfig::antialiasSelectionOutline(bool defaultValue) const
1397{
1398 return (defaultValue ? false : m_cfg.readEntry("AntialiasSelectionOutline", false));
1399}
1400
1402{
1403 m_cfg.writeEntry("AntialiasSelectionOutline", v);
1404}
1405
1406bool KisConfig::showRootLayer(bool defaultValue) const
1407{
1408 return (defaultValue ? false : m_cfg.readEntry("ShowRootLayer", false));
1409}
1410
1411void KisConfig::setShowRootLayer(bool showRootLayer) const
1412{
1413 m_cfg.writeEntry("ShowRootLayer", showRootLayer);
1414}
1415
1416bool KisConfig::showGlobalSelection(bool defaultValue) const
1417{
1418 return (defaultValue ? false : m_cfg.readEntry("ShowGlobalSelection", false));
1419}
1420
1421void KisConfig::setShowGlobalSelection(bool showGlobalSelection) const
1422{
1423 m_cfg.writeEntry("ShowGlobalSelection", showGlobalSelection);
1424}
1425
1426// brush outline settings
1427
1428bool KisConfig::showOutlineWhilePainting(bool defaultValue) const
1429{
1430 return (defaultValue ? true : m_cfg.readEntry("ShowOutlineWhilePainting", true));
1431}
1432
1433void KisConfig::setShowOutlineWhilePainting(bool showOutlineWhilePainting) const
1434{
1435 m_cfg.writeEntry("ShowOutlineWhilePainting", showOutlineWhilePainting);
1436}
1437
1438bool KisConfig::forceAlwaysFullSizedOutline(bool defaultValue) const
1439{
1440 return (defaultValue ? false : m_cfg.readEntry("forceAlwaysFullSizedOutline", false));
1441}
1442
1444{
1445 m_cfg.writeEntry("forceAlwaysFullSizedOutline", value);
1446}
1447
1448// eraser outline settings
1449
1451{
1452 return (defaultValue ? true : m_cfg.readEntry("ShowEraserOutlineWhilePainting", true));
1453}
1454
1455void KisConfig::setShowEraserOutlineWhilePainting(bool showEraserOutlineWhilePainting) const
1456{
1457 m_cfg.writeEntry("ShowEraserOutlineWhilePainting", showEraserOutlineWhilePainting);
1458}
1459
1461{
1462 return (defaultValue ? false : m_cfg.readEntry("forceAlwaysFullSizedEraserOutline", false));
1463}
1464
1466{
1467 m_cfg.writeEntry("forceAlwaysFullSizedEraserOutline", value);
1468}
1469
1471{
1472 int value = defaultValue ? SOS_BlankSession : m_cfg.readEntry("sessionOnStartup", (int)SOS_BlankSession);
1474}
1476{
1477 m_cfg.writeEntry("sessionOnStartup", (int)value);
1478}
1479
1481{
1482 int value = defaultValue ? IIM_Default : m_cfg.readEntry("iconsInMenu", (int)IIM_Default);
1484}
1486{
1487 m_cfg.writeEntry("iconsInMenu", (int)value);
1488}
1489
1490bool KisConfig::saveSessionOnQuit(bool defaultValue) const
1491{
1492 return defaultValue ? false : m_cfg.readEntry("saveSessionOnQuit", false);
1493}
1495{
1496 m_cfg.writeEntry("saveSessionOnQuit", value);
1497}
1498
1499bool KisConfig::hideDevFundBanner(bool defaultValue) const
1500{
1501 return defaultValue ? false : m_cfg.readEntry("hideDevFundBanner", false);
1502}
1503
1505{
1506 m_cfg.writeEntry("hideDevFundBanner", value);
1507}
1508
1509qreal KisConfig::outlineSizeMinimum(bool defaultValue) const
1510{
1511 return (defaultValue ? 1.0 : m_cfg.readEntry("OutlineSizeMinimum", 1.0));
1512}
1513
1514void KisConfig::setOutlineSizeMinimum(qreal outlineSizeMinimum) const
1515{
1516 m_cfg.writeEntry("OutlineSizeMinimum", outlineSizeMinimum);
1517}
1518
1519qreal KisConfig::selectionViewSizeMinimum(bool defaultValue) const
1520{
1521 return (defaultValue ? 5.0 : m_cfg.readEntry("SelectionViewSizeMinimum", 5.0));
1522}
1523
1524void KisConfig::setSelectionViewSizeMinimum(qreal outlineSizeMinimum) const
1525{
1526 m_cfg.writeEntry("SelectionViewSizeMinimum", outlineSizeMinimum);
1527}
1528
1529int KisConfig::autoSaveInterval(bool defaultValue) const
1530{
1531 int def = 7 * 60;
1532 return (defaultValue ? def : m_cfg.readEntry("AutoSaveInterval", def));
1533}
1534
1535void KisConfig::setAutoSaveInterval(int seconds) const
1536{
1537 return m_cfg.writeEntry("AutoSaveInterval", seconds);
1538}
1539
1540bool KisConfig::backupFile(bool defaultValue) const
1541{
1542 return (defaultValue ? true : m_cfg.readEntry("CreateBackupFile", true));
1543}
1544
1545void KisConfig::setBackupFile(bool backupFile) const
1546{
1547 m_cfg.writeEntry("CreateBackupFile", backupFile);
1548}
1549
1550bool KisConfig::showFilterGallery(bool defaultValue) const
1551{
1552 return (defaultValue ? false : m_cfg.readEntry("showFilterGallery", false));
1553}
1554
1555void KisConfig::setShowFilterGallery(bool showFilterGallery) const
1556{
1557 m_cfg.writeEntry("showFilterGallery", showFilterGallery);
1558}
1559
1561{
1562 return (defaultValue ? true : m_cfg.readEntry("showFilterGalleryLayerMaskDialog", true));
1563}
1564
1565void KisConfig::setShowFilterGalleryLayerMaskDialog(bool showFilterGallery) const
1566{
1567 m_cfg.writeEntry("setShowFilterGalleryLayerMaskDialog", showFilterGallery);
1568}
1569
1570QString KisConfig::canvasState(bool defaultValue) const
1571{
1572 const QString configPath = QStandardPaths::writableLocation(QStandardPaths::GenericConfigLocation);
1573 QSettings kritarc(configPath + QStringLiteral("/kritadisplayrc"), QSettings::IniFormat);
1574 return (defaultValue ? "OPENGL_NOT_TRIED" : kritarc.value("canvasState", "OPENGL_NOT_TRIED").toString());
1575}
1576
1577void KisConfig::setCanvasState(const QString& state) const
1578{
1579 static QStringList acceptableStates;
1580 if (acceptableStates.isEmpty()) {
1581 acceptableStates << "OPENGL_SUCCESS" << "TRY_OPENGL" << "OPENGL_NOT_TRIED" << "OPENGL_FAILED";
1582 }
1583 if (acceptableStates.contains(state)) {
1584 const QString configPath = QStandardPaths::writableLocation(QStandardPaths::GenericConfigLocation);
1585 QSettings kritarc(configPath + QStringLiteral("/kritadisplayrc"), QSettings::IniFormat);
1586 kritarc.setValue("canvasState", state);
1587 }
1588}
1589
1590bool KisConfig::toolOptionsPopupDetached(bool defaultValue) const
1591{
1592 return (defaultValue ? false : m_cfg.readEntry("ToolOptionsPopupDetached", false));
1593}
1594
1596{
1597 m_cfg.writeEntry("ToolOptionsPopupDetached", detached);
1598}
1599
1600
1601bool KisConfig::paintopPopupDetached(bool defaultValue) const
1602{
1603 return (defaultValue ? true : m_cfg.readEntry("PaintopPopupDetached", true));
1604}
1605
1606void KisConfig::setPaintopPopupDetached(bool detached) const
1607{
1608 m_cfg.writeEntry("PaintopPopupDetached", detached);
1609}
1610
1611QString KisConfig::pressureTabletCurve(bool defaultValue) const
1612{
1613 QString fallback = DEFAULT_CURVE_STRING;
1614#ifdef Q_OS_ANDROID
1615 // Xiaomi styluses need superhuman strength to reach full input pressure.
1616 // We use a much steeper default pressure curve for them by default that
1617 // effectively caps out at 70% pressure to make it at least bearable. A
1618 // note for a possible future: Apple styluses have an even greater range,
1619 // so if we somehow end up on iPads, we'll probably need to make those cap
1620 // out at 50% pressure at most something like: "0,0;0.5,1.0;"
1622 fallback = QStringLiteral("0,0;0.7,1;");
1623 }
1624#endif
1625 return (defaultValue ? fallback : m_cfg.readEntry("tabletPressureCurve", fallback));
1626}
1627
1628void KisConfig::setPressureTabletCurve(const QString& curveString) const
1629{
1630 m_cfg.writeEntry("tabletPressureCurve", curveString);
1631}
1632
1633bool KisConfig::useWin8PointerInput(bool defaultValue) const
1634{
1635#ifdef Q_OS_WIN
1636 const QString configPath = QStandardPaths::writableLocation(QStandardPaths::GenericConfigLocation);
1637 QSettings kritarc(configPath + QStringLiteral("/kritadisplayrc"), QSettings::IniFormat);
1638
1639 return useWin8PointerInputNoApp(&kritarc, defaultValue);
1640#else
1641 Q_UNUSED(defaultValue);
1642 return false;
1643#endif
1644}
1645
1647{
1648#ifdef Q_OS_WIN
1649
1650 // Special handling: Only set value if changed
1651 // I don't want it to be set if the user hasn't touched it
1652 if (useWin8PointerInput() != value) {
1653 const QString configPath = QStandardPaths::writableLocation(QStandardPaths::GenericConfigLocation);
1654 QSettings kritarc(configPath + QStringLiteral("/kritadisplayrc"), QSettings::IniFormat);
1656 }
1657
1658#else
1659 Q_UNUSED(value);
1660#endif
1661}
1662
1663bool KisConfig::useWin8PointerInputNoApp(QSettings *settings, bool defaultValue)
1664{
1665 return defaultValue ? false : settings->value("useWin8PointerInput", false).toBool();
1666}
1667
1668void KisConfig::setUseWin8PointerInputNoApp(QSettings *settings, bool value)
1669{
1670 settings->setValue("useWin8PointerInput", value);
1671}
1672
1674{
1675 return (defaultValue ? false : m_cfg.readEntry("useRightMiddleTabletButtonWorkaround", false));
1676}
1677
1679{
1680 m_cfg.writeEntry("useRightMiddleTabletButtonWorkaround", value);
1681}
1682
1683#ifdef Q_OS_ANDROID
1684bool KisConfig::usePageUpDownMouseButtonEmulationWorkaround(bool defaultValue) const
1685{
1687 if (defaultValue) {
1688 return fallback;
1689 } else {
1690 return m_cfg.readEntry("usePageUpDownMouseButtonEmulationWorkaround", fallback);
1691 }
1692}
1693
1694void KisConfig::setUsePageUpDownMouseButtonEmulationWorkaround(bool value)
1695{
1696 m_cfg.writeEntry("usePageUpDownMouseButtonEmulationWorkaround", value);
1697 KisConfigNotifier::instance()->notifyUsePageUpDownMouseButtonEmulationWorkaroundChanged(value);
1698}
1699
1700bool KisConfig::useHighFunctionKeyMouseButtonEmulationWorkaround(bool defaultValue) const
1701{
1702 // This hack is only relevant for OnePlus devices (as far as we know), but
1703 // it only affects the F21 key, which isn't something a creature of flesh
1704 // and blood would regularly input. So it'll be fine to just enable this b
1705 // default rather than bothering to detect the tablet brand or something.
1706 if (defaultValue) {
1707 return true;
1708 } else {
1709 return m_cfg.readEntry("useHighFunctionKeyMouseButtonEmulationWorkaround", true);
1710 }
1711}
1712
1713void KisConfig::setUseHighFunctionKeyMouseButtonEmulationWorkaround(bool value)
1714{
1715 m_cfg.writeEntry("useHighFunctionKeyMouseButtonEmulationWorkaround", value);
1716 KisConfigNotifier::instance()->notifyUseHighFunctionKeyMouseButtonEmulationWorkaroundChanged(value);
1717}
1718
1719bool KisConfig::useIgnoreHistoricTabletEventsWorkaround(bool defaultValue) const
1720{
1722 if (defaultValue) {
1723 return fallback;
1724 } else {
1725 return m_cfg.readEntry("useIgnoreHistoricTabletEventsWorkaround", fallback);
1726 }
1727}
1728
1729void KisConfig::setUseIgnoreHistoricTabletEventsWorkaround(bool value)
1730{
1731 m_cfg.writeEntry("useIgnoreHistoricTabletEventsWorkaround", value);
1732 KisConfigNotifier::instance()->notifyUseIgnoreHistoricTabletEventsWorkaroundChanged(value);
1733}
1734
1735bool KisConfig::hideTouchAndStylusCursorsWorkaround(bool defaultValue) const
1736{
1738 if (defaultValue) {
1739 return fallback;
1740 } else {
1741 return m_cfg.readEntry("hideTouchAndStylusCursorsWorkaround", fallback);
1742 }
1743}
1744
1745void KisConfig::setHideTouchAndStylusCursorsWorkaround(bool value)
1746{
1747 m_cfg.writeEntry("hideTouchAndStylusCursorsWorkaround", value);
1748 KisConfigNotifier::instance()->notifyHideTouchAndStylusCursorsWorkaroundChanged(value);
1749}
1750
1751qreal KisConfig::androidScalingLastInitialScale(bool defaultValue) const
1752{
1753 if (defaultValue) {
1754 return 0.0;
1755 } else {
1756 return m_cfg.readEntry("androidScalingLastInitialScale", 0.0);
1757 }
1758}
1759
1760void KisConfig::setAndroidScalingLastInitialScale(qreal value)
1761{
1762 m_cfg.writeEntry("androidScalingLastInitialScale", value);
1763}
1764
1765qreal KisConfig::androidScalingTargetScale(bool defaultValue) const
1766{
1767 if (defaultValue) {
1768 return 0.0;
1769 } else {
1770 return m_cfg.readEntry("androidScalingTargetScale", 0.0);
1771 }
1772}
1773
1774void KisConfig::setAndroidScalingTargetScale(qreal value)
1775{
1776 m_cfg.writeEntry("androidScalingTargetScale", value);
1777}
1778
1779bool KisConfig::androidScalingAskOnStartup(bool defaultValue) const
1780{
1781 if (defaultValue) {
1782 return true;
1783 } else {
1784 return m_cfg.readEntry("androidScalingAskOnStartup", true);
1785 }
1786}
1787
1788void KisConfig::setAndroidScalingAskOnStartup(bool value)
1789{
1790 m_cfg.writeEntry("androidScalingAskOnStartup", value);
1791}
1792#endif
1793
1794qreal KisConfig::vastScrolling(bool defaultValue) const
1795{
1796 return (defaultValue ? 0.9 : m_cfg.readEntry("vastScrolling", 0.9));
1797}
1798
1799void KisConfig::setVastScrolling(const qreal factor) const
1800{
1801 m_cfg.writeEntry("vastScrolling", factor);
1802}
1803
1804int KisConfig::presetChooserViewMode(bool defaultValue) const
1805{
1806 // For like 10 people that used a nightly after brush preview was merged, but before the detail option was removed.
1807 return std::min(2, (defaultValue ? 1 : m_cfg.readEntry("presetChooserViewMode", 1)));
1808}
1809
1810void KisConfig::setPresetChooserViewMode(const int mode) const
1811{
1812 m_cfg.writeEntry("presetChooserViewMode", mode);
1813}
1814
1815int KisConfig::presetIconSize(bool defaultValue) const
1816{
1817 return (defaultValue ? 60 : m_cfg.readEntry("presetIconSize", 60));
1818}
1819
1821{
1822 m_cfg.writeEntry("presetIconSize", value);
1823}
1824
1825bool KisConfig::firstRun(bool defaultValue) const
1826{
1827 return (defaultValue ? true : m_cfg.readEntry("firstRun", true));
1828}
1829
1830void KisConfig::setFirstRun(const bool first) const
1831{
1832 m_cfg.writeEntry("firstRun", first);
1833}
1834
1835QString KisConfig::splashScreenImage(bool defaultValue) const
1836{
1837 if (defaultValue) {
1838 return QString();
1839 } else {
1840 return m_cfg.readEntry(QStringLiteral("splashScreenImage"), QString());
1841 }
1842}
1843
1845{
1846 m_cfg.writeEntry(QStringLiteral("splashScreenImage"), value);
1847}
1848
1849int KisConfig::horizontalSplitLines(bool defaultValue) const
1850{
1851 return (defaultValue ? 1 : m_cfg.readEntry("horizontalSplitLines", 1));
1852}
1853void KisConfig::setHorizontalSplitLines(const int numberLines) const
1854{
1855 m_cfg.writeEntry("horizontalSplitLines", numberLines);
1856}
1857
1858int KisConfig::verticalSplitLines(bool defaultValue) const
1859{
1860 return (defaultValue ? 1 : m_cfg.readEntry("verticalSplitLines", 1));
1861}
1862
1863void KisConfig::setVerticalSplitLines(const int numberLines) const
1864{
1865 m_cfg.writeEntry("verticalSplitLines", numberLines);
1866}
1867
1868bool KisConfig::clicklessSpacePan(bool defaultValue) const
1869{
1870 return (defaultValue ? true : m_cfg.readEntry("clicklessSpacePan", true));
1871}
1872
1873void KisConfig::setClicklessSpacePan(const bool toggle) const
1874{
1875 m_cfg.writeEntry("clicklessSpacePan", toggle);
1876}
1877
1878
1879bool KisConfig::hideDockersFullscreen(bool defaultValue) const
1880{
1881 return (defaultValue ? true : m_cfg.readEntry("hideDockersFullScreen", true));
1882}
1883
1885{
1886 m_cfg.writeEntry("hideDockersFullScreen", value);
1887}
1888
1889bool KisConfig::showDockerTitleBars(bool defaultValue) const
1890{
1891 return (defaultValue ? true : m_cfg.readEntry("showDockerTitleBars", true));
1892}
1893
1895{
1896 m_cfg.writeEntry("showDockerTitleBars", value);
1897}
1898
1899bool KisConfig::showDockers(bool defaultValue) const
1900{
1901 return (defaultValue ? true : m_cfg.readEntry("showDockers", true));
1902}
1903
1904void KisConfig::setShowDockers(const bool value) const
1905{
1906 m_cfg.writeEntry("showDockers", value);
1907}
1908
1909bool KisConfig::showStatusBar(bool defaultValue) const
1910{
1911 return (defaultValue ? true : m_cfg.readEntry("showStatusBar", true));
1912}
1913
1915{
1916 m_cfg.writeEntry("showStatusBar", value);
1917}
1918
1919bool KisConfig::hideMenuFullscreen(bool defaultValue) const
1920{
1921 return (defaultValue ? true: m_cfg.readEntry("hideMenuFullScreen", true));
1922}
1923
1925{
1926 m_cfg.writeEntry("hideMenuFullScreen", value);
1927}
1928
1929bool KisConfig::hideScrollbarsFullscreen(bool defaultValue) const
1930{
1931 return (defaultValue ? true : m_cfg.readEntry("hideScrollbarsFullScreen", true));
1932}
1933
1935{
1936 m_cfg.writeEntry("hideScrollbarsFullScreen", value);
1937}
1938
1939bool KisConfig::hideStatusbarFullscreen(bool defaultValue) const
1940{
1941 return (defaultValue ? true: m_cfg.readEntry("hideStatusbarFullScreen", true));
1942}
1943
1945{
1946 m_cfg.writeEntry("hideStatusbarFullScreen", value);
1947}
1948
1949bool KisConfig::hideTitlebarFullscreen(bool defaultValue) const
1950{
1951 return (defaultValue ? true : m_cfg.readEntry("hideTitleBarFullscreen", true));
1952}
1953
1955{
1956 m_cfg.writeEntry("hideTitleBarFullscreen", value);
1957}
1958
1959bool KisConfig::hideToolbarFullscreen(bool defaultValue) const
1960{
1961 return (defaultValue ? true : m_cfg.readEntry("hideToolbarFullscreen", true));
1962}
1963
1965{
1966 m_cfg.writeEntry("hideToolbarFullscreen", value);
1967}
1968
1969bool KisConfig::fullscreenMode(bool defaultValue) const
1970{
1971 return (defaultValue ? true : m_cfg.readEntry("fullscreenMode", false));
1972}
1973
1975{
1976 m_cfg.writeEntry("fullscreenMode", value);
1977}
1978
1980{
1981 return (defaultValue ? QStringList() :
1982 m_cfg.readEntry("favoriteCompositeOps",
1983 QString("normal,erase,multiply,burn,darken,add,dodge,screen,overlay,soft_light_svg,luminize,lighten,saturation,color,divide").split(',')));
1984}
1985
1987{
1988 m_cfg.writeEntry("favoriteCompositeOps", compositeOps);
1989}
1990
1991QString KisConfig::exportConfigurationXML(const QString &filterId, bool defaultValue) const
1992{
1993 return (defaultValue ? QString() : m_cfg.readEntry("ExportConfiguration-" + filterId, QString()));
1994}
1995
1996KisPropertiesConfigurationSP KisConfig::exportConfiguration(const QString &filterId, bool defaultValue) const
1997{
1999 const QString xmlData = exportConfigurationXML(filterId, defaultValue);
2000 cfg->fromXML(xmlData);
2001 return cfg;
2002}
2003
2004void KisConfig::setExportConfiguration(const QString &filterId, KisPropertiesConfigurationSP properties) const
2005{
2006 QString exportConfig = properties->toXML();
2007 m_cfg.writeEntry("ExportConfiguration-" + filterId, exportConfig);
2008}
2009
2010QString KisConfig::importConfiguration(const QString &filterId, bool defaultValue) const
2011{
2012 return (defaultValue ? QString() : m_cfg.readEntry("ImportConfiguration-" + filterId, QString()));
2013}
2014
2015void KisConfig::setImportConfiguration(const QString &filterId, KisPropertiesConfigurationSP properties) const
2016{
2017 QString importConfig = properties->toXML();
2018 m_cfg.writeEntry("ImportConfiguration-" + filterId, importConfig);
2019}
2020
2021bool KisConfig::useOcio(bool defaultValue) const
2022{
2023#ifdef HAVE_OCIO
2024 return (defaultValue ? false : m_cfg.readEntry("Krita/Ocio/UseOcio", false));
2025#else
2026 Q_UNUSED(defaultValue);
2027 return false;
2028#endif
2029}
2030
2031void KisConfig::setUseOcio(bool useOCIO) const
2032{
2033 m_cfg.writeEntry("Krita/Ocio/UseOcio", useOCIO);
2034}
2035
2036int KisConfig::favoritePresets(bool defaultValue) const
2037{
2038 return (defaultValue ? 10: m_cfg.readEntry("numFavoritePresets", 10));
2039}
2040
2042{
2043 m_cfg.writeEntry("numFavoritePresets", value);
2044}
2045
2046bool KisConfig::levelOfDetailEnabled(bool defaultValue) const
2047{
2048 return (defaultValue ? false : m_cfg.readEntry("levelOfDetailEnabled", false));
2049}
2050
2052{
2053 m_cfg.writeEntry("levelOfDetailEnabled", value);
2054}
2055
2057{
2059
2060 if (!defaultValue) {
2061 cfg.mode = (KisOcioConfiguration::Mode)m_cfg.readEntry("Krita/Ocio/OcioColorManagementMode", 0);
2062 cfg.configurationPath = m_cfg.readEntry("Krita/Ocio/OcioConfigPath", QString());
2063 cfg.lutPath = m_cfg.readEntry("Krita/Ocio/OcioLutPath", QString());
2064 cfg.inputColorSpace = m_cfg.readEntry("Krita/Ocio/InputColorSpace", QString());
2065 cfg.displayDevice = m_cfg.readEntry("Krita/Ocio/DisplayDevice", QString());
2066 }
2067
2068 return cfg;
2069}
2070
2072{
2073 m_cfg.writeEntry("Krita/Ocio/OcioColorManagementMode", (int) cfg.mode);
2074 m_cfg.writeEntry("Krita/Ocio/OcioConfigPath", cfg.configurationPath);
2075 m_cfg.writeEntry("Krita/Ocio/OcioLutPath", cfg.lutPath);
2076 m_cfg.writeEntry("Krita/Ocio/InputColorSpace", cfg.inputColorSpace);
2077 m_cfg.writeEntry("Krita/Ocio/DisplayDevice", cfg.displayDevice);
2078}
2079
2082{
2083 // FIXME: this option duplicates ocioConfiguration(), please deprecate it
2084 return (OcioColorManagementMode)(defaultValue ? INTERNAL
2085 : m_cfg.readEntry("Krita/Ocio/OcioColorManagementMode", (int) INTERNAL));
2086}
2087
2089{
2090 // FIXME: this option duplicates ocioConfiguration(), please deprecate it
2091 m_cfg.writeEntry("Krita/Ocio/OcioColorManagementMode", (int) mode);
2092}
2093
2094int KisConfig::ocioLutEdgeSize(bool defaultValue) const
2095{
2096 return (defaultValue ? 64 : m_cfg.readEntry("Krita/Ocio/LutEdgeSize", 64));
2097}
2098
2100{
2101 m_cfg.writeEntry("Krita/Ocio/LutEdgeSize", value);
2102}
2103
2105{
2106 return (defaultValue ? false : m_cfg.readEntry("Krita/Ocio/OcioLockColorVisualRepresentation", false));
2107}
2108
2110{
2111 m_cfg.writeEntry("Krita/Ocio/OcioLockColorVisualRepresentation", value);
2112}
2113
2114QString KisConfig::defaultPalette(bool defaultValue) const
2115{
2116 return (defaultValue ? QString() : m_cfg.readEntry("defaultPalette", "Default"));
2117}
2118
2119void KisConfig::setDefaultPalette(const QString& name) const
2120{
2121 m_cfg.writeEntry("defaultPalette", name);
2122}
2123
2124QString KisConfig::toolbarSlider(int sliderNumber, bool defaultValue) const
2125{
2126 QString def = "flow";
2127 if (sliderNumber == 1) {
2128 def = "opacity";
2129 }
2130 if (sliderNumber == 2) {
2131 def = "size";
2132 }
2133 return (defaultValue ? def : m_cfg.readEntry(QString("toolbarslider_%1").arg(sliderNumber), def));
2134}
2135
2136void KisConfig::setToolbarSlider(int sliderNumber, const QString &slider)
2137{
2138 m_cfg.writeEntry(QString("toolbarslider_%1").arg(sliderNumber), slider);
2139}
2140
2141int KisConfig::layerThumbnailSize(bool defaultValue) const
2142{
2143 return (defaultValue ? 20 : m_cfg.readEntry("layerThumbnailSize", 20));
2144}
2145
2147{
2148 m_cfg.writeEntry("layerThumbnailSize", size);
2149}
2150
2151int KisConfig::layerTreeIndentation(bool defaultValue) const
2152{
2153 return (defaultValue ? 50 : m_cfg.readEntry("layerTreeIndentation", 50));
2154}
2155
2157{
2158 m_cfg.writeEntry("layerTreeIndentation", percentage);
2159}
2160
2161bool KisConfig::sliderLabels(bool defaultValue) const
2162{
2163 return (defaultValue ? true : m_cfg.readEntry("sliderLabels", true));
2164}
2165
2167{
2168 m_cfg.writeEntry("sliderLabels", enabled);
2169}
2170
2171QString KisConfig::currentInputProfile(bool defaultValue) const
2172{
2173 return (defaultValue ? QString() : m_cfg.readEntry("currentInputProfile", QString()));
2174}
2175
2176void KisConfig::setCurrentInputProfile(const QString& name)
2177{
2178 m_cfg.writeEntry("currentInputProfile", name);
2179}
2180
2181bool KisConfig::presetStripVisible(bool defaultValue) const
2182{
2183 return (defaultValue ? true : m_cfg.readEntry("presetStripVisible", true));
2184}
2185
2187{
2188 m_cfg.writeEntry("presetStripVisible", visible);
2189}
2190
2191bool KisConfig::scratchpadVisible(bool defaultValue) const
2192{
2193 return (defaultValue ? true : m_cfg.readEntry("scratchpadVisible", true));
2194}
2195
2197{
2198 m_cfg.writeEntry("scratchpadVisible", visible);
2199}
2200
2201bool KisConfig::showSingleChannelAsColor(bool defaultValue) const
2202{
2203 return (defaultValue ? false : m_cfg.readEntry("showSingleChannelAsColor", false));
2204}
2205
2207{
2208 m_cfg.writeEntry("showSingleChannelAsColor", asColor);
2209}
2210
2211bool KisConfig::hidePopups(bool defaultValue) const
2212{
2213 return (defaultValue ? false : m_cfg.readEntry("hidePopups", false));
2214}
2215
2216void KisConfig::setHidePopups(bool hidePopups)
2217{
2218 m_cfg.writeEntry("hidePopups", hidePopups);
2219}
2220
2221int KisConfig::numDefaultLayers(const QLatin1String &dialogType, bool defaultValue) const
2222{
2223 return (defaultValue ? 2 : m_cfg.readEntry(dialogType + "NumberOfLayersForNewImage", 2));
2224}
2225
2226void KisConfig::setNumDefaultLayers(const QLatin1String &dialogType, int num)
2227{
2228 m_cfg.writeEntry(dialogType + "NumberOfLayersForNewImage", num);
2229}
2230
2231quint8 KisConfig::defaultBackgroundOpacity(const QLatin1String &dialogType, bool defaultValue) const
2232{
2233 return (defaultValue ? (int)OPACITY_OPAQUE_U8 : m_cfg.readEntry(dialogType + "BackgroundOpacityForNewImage", (int)OPACITY_OPAQUE_U8));
2234}
2235
2236void KisConfig::setDefaultBackgroundOpacity(const QLatin1String &dialogType, quint8 value)
2237{
2238 m_cfg.writeEntry(dialogType + "BackgroundOpacityForNewImage", (int)value);
2239}
2240
2241QColor KisConfig::defaultBackgroundColor(const QLatin1String &dialogType, bool defaultValue) const
2242{
2243 return (defaultValue ? QColor(Qt::white) : m_cfg.readEntry(dialogType + "BackgroundColorForNewImage", QColor(Qt::white)));
2244}
2245
2246void KisConfig::setDefaultBackgroundColor(const QLatin1String &dialogType, const QColor &value)
2247{
2248 m_cfg.writeEntry(dialogType + "BackgroundColorForNewImage", value);
2249}
2250
2251KisConfig::BackgroundStyle KisConfig::defaultBackgroundStyle(const QLatin1String &dialogType, bool defaultValue) const
2252{
2253 return (KisConfig::BackgroundStyle)(defaultValue ? RASTER_LAYER : m_cfg.readEntry(dialogType + "BackgroundStyleForNewImage", (int)RASTER_LAYER));
2254}
2255
2257{
2258 m_cfg.writeEntry(dialogType + "BackgroundStyleForNewImage", (int)value);
2259}
2260
2261int KisConfig::lineSmoothingType(bool defaultValue) const
2262{
2263 return (defaultValue ? 1 : m_cfg.readEntry("LineSmoothingType", 1));
2264}
2265
2267{
2268 m_cfg.writeEntry("LineSmoothingType", value);
2269}
2270
2271qreal KisConfig::lineSmoothingDistanceMin(bool defaultValue) const
2272{
2273 return (defaultValue ? 50.0 : m_cfg.readEntry("LineSmoothingDistanceMin", 50.0));
2274}
2275
2277{
2278 m_cfg.writeEntry("LineSmoothingDistanceMin", value);
2279}
2280
2281qreal KisConfig::lineSmoothingDistanceMax(bool defaultValue) const
2282{
2283 return (defaultValue ? 50.0 : m_cfg.readEntry("LineSmoothingDistanceMax", 50.0));
2284}
2285
2287{
2288 m_cfg.writeEntry("LineSmoothingDistanceMax", value);
2289}
2290
2292{
2293 return (defaultValue ? true : m_cfg.readEntry("LineSmoothingDistanceKeepAspectRatio", true));
2294}
2295
2297{
2298 m_cfg.writeEntry("LineSmoothingDistanceKeepAspectRatio", value);
2299}
2300
2302{
2303 return (defaultValue ? 0.15 : m_cfg.readEntry("LineSmoothingTailAggressiveness", 0.15));
2304}
2305
2307{
2308 m_cfg.writeEntry("LineSmoothingTailAggressiveness", value);
2309}
2310
2311bool KisConfig::lineSmoothingSmoothPressure(bool defaultValue) const
2312{
2313 return (defaultValue ? false : m_cfg.readEntry("LineSmoothingSmoothPressure", false));
2314}
2315
2317{
2318 m_cfg.writeEntry("LineSmoothingSmoothPressure", value);
2319}
2320
2321bool KisConfig::lineSmoothingScalableDistance(bool defaultValue) const
2322{
2323 return (defaultValue ? true : m_cfg.readEntry("LineSmoothingScalableDistance", true));
2324}
2325
2327{
2328 m_cfg.writeEntry("LineSmoothingScalableDistance", value);
2329}
2330
2331qreal KisConfig::lineSmoothingDelayDistance(bool defaultValue) const
2332{
2333 return (defaultValue ? 50.0 : m_cfg.readEntry("LineSmoothingDelayDistance", 50.0));
2334}
2335
2337{
2338 m_cfg.writeEntry("LineSmoothingDelayDistance", value);
2339}
2340
2341bool KisConfig::lineSmoothingUseDelayDistance(bool defaultValue) const
2342{
2343 return (defaultValue ? true : m_cfg.readEntry("LineSmoothingUseDelayDistance", true));
2344}
2345
2347{
2348 m_cfg.writeEntry("LineSmoothingUseDelayDistance", value);
2349}
2350
2352{
2353 return (defaultValue ? true : m_cfg.readEntry("LineSmoothingFinishStabilizedCurve", true));
2354}
2355
2357{
2358 m_cfg.writeEntry("LineSmoothingFinishStabilizedCurve", value);
2359}
2360
2361bool KisConfig::lineSmoothingStabilizeSensors(bool defaultValue) const
2362{
2363 return (defaultValue ? true : m_cfg.readEntry("LineSmoothingStabilizeSensors", true));
2364}
2365
2367{
2368 m_cfg.writeEntry("LineSmoothingStabilizeSensors", value);
2369}
2370
2371int KisConfig::tabletEventsDelay(bool defaultValue) const
2372{
2373 return (defaultValue ? 10 : m_cfg.readEntry("tabletEventsDelay", 10));
2374}
2375
2377{
2378 m_cfg.writeEntry("tabletEventsDelay", value);
2379}
2380
2381bool KisConfig::trackTabletEventLatency(bool defaultValue) const
2382{
2383 return (defaultValue ? false : m_cfg.readEntry("trackTabletEventLatency", false));
2384}
2385
2387{
2388 m_cfg.writeEntry("trackTabletEventLatency", value);
2389}
2390
2391bool KisConfig::ignoreHighFunctionKeys(bool defaultValue) const
2392{
2393 return (defaultValue ? true : m_cfg.readEntry("ignoreHighFunctionKeys", true));
2394}
2395
2397{
2398 m_cfg.writeEntry("ignoreHighFunctionKeys", value);
2399}
2400
2402{
2403 return (defaultValue ? false : m_cfg.readEntry("testingAcceptCompressedTabletEvents", false));
2404}
2405
2407{
2408 m_cfg.writeEntry("testingAcceptCompressedTabletEvents", value);
2409}
2410
2411bool KisConfig::shouldEatDriverShortcuts(bool defaultValue) const
2412{
2413 return (defaultValue ? false : m_cfg.readEntry("shouldEatDriverShortcuts", false));
2414}
2415
2416bool KisConfig::testingCompressBrushEvents(bool defaultValue) const
2417{
2418 return (defaultValue ? false : m_cfg.readEntry("testingCompressBrushEvents", false));
2419}
2420
2422{
2423 m_cfg.writeEntry("testingCompressBrushEvents", value);
2424}
2425
2427{
2428 return (defaultValue ? 0 : m_cfg.readEntry("workaroundX11SmoothPressureSteps", 0));
2429}
2430
2431bool KisConfig::showCanvasMessages(bool defaultValue) const
2432{
2433 return (defaultValue ? true : m_cfg.readEntry("showOnCanvasMessages", true));
2434}
2435
2437{
2438 m_cfg.writeEntry("showOnCanvasMessages", show);
2439}
2440
2441bool KisConfig::compressKra(bool defaultValue) const
2442{
2443 return (defaultValue ? false : m_cfg.readEntry("compressLayersInKra", false));
2444}
2445
2446void KisConfig::setCompressKra(bool compress)
2447{
2448 m_cfg.writeEntry("compressLayersInKra", compress);
2449}
2450
2451bool KisConfig::trimKra(bool defaultValue) const
2452{
2453 return (defaultValue ? false : m_cfg.readEntry("TrimKra", false));
2454}
2455
2457{
2458 m_cfg.writeEntry("TrimKra", trim);
2459}
2460
2461bool KisConfig::trimFramesImport(bool defaultValue) const
2462{
2463 return (defaultValue ? false : m_cfg.readEntry("TrimFramesImport", false));
2464}
2466{
2467 m_cfg.writeEntry("TrimFramesImport", trim);
2468}
2469
2470QString KisConfig::exportMimeType(bool defaultValue) const
2471{
2472 return (defaultValue ? 0 : m_cfg.readEntry("defaultExportMimeType", QString()));
2473}
2474
2475void KisConfig::setExportMimeType(const QString &defaultExportMimeType)
2476{
2477 m_cfg.writeEntry("defaultExportMimeType", defaultExportMimeType);
2478}
2479
2480bool KisConfig::toolOptionsInDocker(bool defaultValue) const
2481{
2482 return (defaultValue ? true : m_cfg.readEntry("ToolOptionsInDocker", true));
2483}
2484
2486{
2487 m_cfg.writeEntry("ToolOptionsInDocker", inDocker);
2488}
2489
2490bool KisConfig::kineticScrollingEnabled(bool defaultValue) const
2491{
2492 return (defaultValue ? true : m_cfg.readEntry("KineticScrollingEnabled", true));
2493}
2494
2496{
2497 m_cfg.writeEntry("KineticScrollingEnabled", value);
2498}
2499
2500int KisConfig::kineticScrollingGesture(bool defaultValue) const
2501{
2502#ifdef Q_OS_ANDROID
2503 int defaultGesture = 1; // LeftMouseButtonGesture
2504#else
2505 int defaultGesture = 2; // MiddleMouseButtonGesture
2506#endif
2507
2508 return (defaultValue ? defaultGesture : m_cfg.readEntry("KineticScrollingGesture", defaultGesture));
2509}
2510
2512{
2513 m_cfg.writeEntry("KineticScrollingGesture", gesture);
2514}
2515
2516int KisConfig::kineticScrollingSensitivity(bool defaultValue) const
2517{
2518 return (defaultValue ? 75 : m_cfg.readEntry("KineticScrollingSensitivity", 75));
2519}
2520
2522{
2523 m_cfg.writeEntry("KineticScrollingSensitivity", sensitivity);
2524}
2525
2527{
2528 return (defaultValue ? false : m_cfg.readEntry("KineticScrollingHideScrollbar", false));
2529}
2530
2532{
2533 m_cfg.writeEntry("KineticScrollingHideScrollbar", scrollbar);
2534}
2535
2536int KisConfig::zoomSteps(bool defaultValue) const
2537{
2538 return (defaultValue ? 2 : m_cfg.readEntry("zoomSteps", 2));
2539}
2540
2542{
2543 m_cfg.writeEntry("zoomSteps", steps);
2544}
2545
2546int KisConfig::zoomMarginSize(bool defaultValue) const
2547{
2548 return (defaultValue ? 0 : m_cfg.readEntry("zoomMarginSize", 0));
2549}
2550
2551void KisConfig::setZoomMarginSize(int zoomMarginSize)
2552{
2553 m_cfg.writeEntry("zoomMarginSize", zoomMarginSize);
2554}
2555
2557{
2558 const KoColorSpace *cs = 0;
2559
2560 KConfigGroup cfg = KSharedConfig::openConfig()->group("advancedColorSelector");
2561 if (defaultValue || cfg.readEntry("useCustomColorSpace", true)) {
2563 QString modelID = cfg.readEntry("customColorSpaceModel", "RGBA");
2564 QString depthID = cfg.readEntry("customColorSpaceDepthID", "U8");
2565 QString profile = cfg.readEntry("customColorSpaceProfile", "sRGB built-in - (lcms internal)");
2566 if (profile == "default") {
2567 // qDebug() << "Falling back to default color profile.";
2568 profile = "sRGB built-in - (lcms internal)";
2569 }
2570 cs = csr->colorSpace(modelID, depthID, profile);
2571 }
2572
2573 return cs;
2574}
2575
2577{
2578 KConfigGroup cfg = KSharedConfig::openConfig()->group("advancedColorSelector");
2579 cfg.writeEntry("useCustomColorSpace", bool(cs));
2580 if(cs) {
2581 cfg.writeEntry("customColorSpaceModel", cs->colorModelId().id());
2582 cfg.writeEntry("customColorSpaceDepthID", cs->colorDepthId().id());
2583 cfg.writeEntry("customColorSpaceProfile", cs->profile()->name());
2584 }
2585}
2586
2587bool KisConfig::enableOpenGLFramerateLogging(bool defaultValue) const
2588{
2589 return (defaultValue ? false : m_cfg.readEntry("enableOpenGLFramerateLogging", false));
2590}
2591
2593{
2594 m_cfg.writeEntry("enableOpenGLFramerateLogging", value);
2595}
2596
2597bool KisConfig::enableBrushSpeedLogging(bool defaultValue) const
2598{
2599 return (defaultValue ? false : m_cfg.readEntry("enableBrushSpeedLogging", false));
2600}
2601
2603{
2604 m_cfg.writeEntry("enableBrushSpeedLogging", value);
2605}
2606
2608{
2609 // use the old key name for compatibility
2610 m_cfg.writeEntry("amdDisableVectorWorkaround", value);
2611}
2612
2613bool KisConfig::disableVectorOptimizations(bool defaultValue) const
2614{
2615 // use the old key name for compatibility
2616 return (defaultValue ? false : m_cfg.readEntry("amdDisableVectorWorkaround", false));
2617}
2618
2620{
2621 m_cfg.writeEntry("disableAVXOptimizations", value);
2622}
2623
2624bool KisConfig::disableAVXOptimizations(bool defaultValue) const
2625{
2626 return (defaultValue ? false : m_cfg.readEntry("disableAVXOptimizations", false));
2627}
2628
2630{
2631 m_cfg.writeEntry("animationPlaybackBackend", value);
2632}
2633
2634int KisConfig::animationPlaybackBackend(bool defaultValue) const
2635{
2636 return (defaultValue ? 1 : m_cfg.readEntry("animationPlaybackBackend", 1));
2637}
2638
2640{
2641 bool oldValue = animationDropFrames();
2642
2643 if (value == oldValue) return;
2644
2645 m_cfg.writeEntry("animationDropFrames", value);
2647}
2648
2649bool KisConfig::autoPinLayersToTimeline(bool defaultValue) const
2650{
2651 return (defaultValue ? true : m_cfg.readEntry("autoPinLayers", true));
2652}
2653
2655{
2656 m_cfg.writeEntry("autoPinLayers", value);
2657}
2658
2659bool KisConfig::adaptivePlaybackRange(bool defaultValue) const
2660{
2661 return (defaultValue ? true : m_cfg.readEntry("adaptivePlaybackRange", true));
2662}
2663
2665{
2666 m_cfg.writeEntry("adaptivePlaybackRange", value);
2667}
2668
2670{
2671 return (defaultValue ? true : m_cfg.readEntry("autoZoomTimelineToPlaybackRange", true));
2672}
2673
2675{
2676 m_cfg.writeEntry("autoZoomTimelineToPlaybackRange", value);
2677}
2678
2679QString KisConfig::ffmpegLocation(bool defaultValue) const {
2680 return (defaultValue ? "" : m_cfg.readEntry("ffmpegLocation", ""));
2681}
2682
2684 m_cfg.writeEntry("ffmpegLocation", value);
2685}
2686
2687qreal KisConfig::timelineZoom(bool defaultValue) const
2688{
2689 return (defaultValue ? 1.0f : m_cfg.readEntry("timelineZoom", 1.0f));
2690}
2691
2693{
2694 m_cfg.writeEntry("timelineZoom", value);
2695}
2696
2697bool KisConfig::animationDropFrames(bool defaultValue) const
2698{
2699 return (defaultValue ? true : m_cfg.readEntry("animationDropFrames", true));
2700}
2701
2702int KisConfig::scrubbingUpdatesDelay(bool defaultValue) const
2703{
2704 return (defaultValue ? 30 : m_cfg.readEntry("scrubbingUpdatesDelay", 30));
2705}
2706
2708{
2709 m_cfg.writeEntry("scrubbingUpdatesDelay", value);
2710}
2711
2712int KisConfig::scrubbingAudioUpdatesDelay(bool defaultValue) const
2713{
2714 return (defaultValue ? -1 : m_cfg.readEntry("scrubbingAudioUpdatesDelay", -1));
2715}
2716
2718{
2719 m_cfg.writeEntry("scrubbingAudioUpdatesDelay", value);
2720}
2721
2722int KisConfig::audioOffsetTolerance(bool defaultValue) const
2723{
2724 return (defaultValue ? -1 : m_cfg.readEntry("audioOffsetTolerance", -1));
2725}
2726
2728{
2729 m_cfg.writeEntry("audioOffsetTolerance", value);
2730}
2731
2732bool KisConfig::switchSelectionCtrlAlt(bool defaultValue) const
2733{
2734 return defaultValue ? false : m_cfg.readEntry("switchSelectionCtrlAlt", false);
2735}
2736
2738{
2739 m_cfg.writeEntry("switchSelectionCtrlAlt", value);
2740}
2741
2743{
2744 return defaultValue ? false : m_cfg.readEntry("ConvertToImageColorSpaceOnImport", false);
2745}
2746
2748{
2749 m_cfg.writeEntry("ConvertToImageColorSpaceOnImport", value);
2750}
2751
2752int KisConfig::stabilizerSampleSize(bool defaultValue) const
2753{
2754#ifdef Q_OS_WIN
2755 const int defaultSampleSize = 50;
2756#else
2757 const int defaultSampleSize = 15;
2758#endif
2759
2760 return defaultValue ?
2761 defaultSampleSize : m_cfg.readEntry("stabilizerSampleSize", defaultSampleSize);
2762}
2763
2765{
2766 m_cfg.writeEntry("stabilizerSampleSize", value);
2767}
2768
2769bool KisConfig::stabilizerDelayedPaint(bool defaultValue) const
2770{
2771 const bool defaultEnabled = true;
2772
2773 return defaultValue ?
2774 defaultEnabled : m_cfg.readEntry("stabilizerDelayedPaint", defaultEnabled);
2775}
2776
2778{
2779 m_cfg.writeEntry("stabilizerDelayedPaint", value);
2780}
2781
2782bool KisConfig::showBrushHud(bool defaultValue) const
2783{
2784 return defaultValue ? false : m_cfg.readEntry("showBrushHud", false);
2785}
2786
2788{
2789 m_cfg.writeEntry("showBrushHud", value);
2790}
2791
2792bool KisConfig::showPaletteBottomBar(bool defaultValue) const
2793{
2794 return defaultValue ? true : m_cfg.readEntry("showPaletteBottomBar", true);
2795}
2796
2798{
2799 m_cfg.writeEntry("showPaletteBottomBar", value);
2800}
2801
2802QString KisConfig::brushHudSetting(bool defaultValue) const
2803{
2804 QString defaultDoc = "<!DOCTYPE hud_properties>\n<hud_properties>\n <version value=\"1\" type=\"value\"/>\n <paintbrush>\n <properties_list type=\"array\">\n <item_0 value=\"size\" type=\"value\"/>\n <item_1 value=\"opacity\" type=\"value\"/>\n <item_2 value=\"angle\" type=\"value\"/>\n </properties_list>\n </paintbrush>\n <colorsmudge>\n <properties_list type=\"array\">\n <item_0 value=\"size\" type=\"value\"/>\n <item_1 value=\"opacity\" type=\"value\"/>\n <item_2 value=\"smudge_mode\" type=\"value\"/>\n <item_3 value=\"smudge_length\" type=\"value\"/>\n <item_4 value=\"smudge_color_rate\" type=\"value\"/>\n </properties_list>\n </colorsmudge>\n <sketchbrush>\n <properties_list type=\"array\">\n <item_0 value=\"opacity\" type=\"value\"/>\n <item_1 value=\"size\" type=\"value\"/>\n </properties_list>\n </sketchbrush>\n <hairybrush>\n <properties_list type=\"array\">\n <item_0 value=\"size\" type=\"value\"/>\n <item_1 value=\"opacity\" type=\"value\"/>\n </properties_list>\n </hairybrush>\n <experimentbrush>\n <properties_list type=\"array\">\n <item_0 value=\"opacity\" type=\"value\"/>\n <item_1 value=\"shape_windingfill\" type=\"value\"/>\n </properties_list>\n </experimentbrush>\n <spraybrush>\n <properties_list type=\"array\">\n <item_0 value=\"size\" type=\"value\"/>\n <item_1 value=\"opacity\" type=\"value\"/>\n <item_2 value=\"spray_particlecount\" type=\"value\"/>\n <item_3 value=\"spray_density\" type=\"value\"/>\n </properties_list>\n </spraybrush>\n <hatchingbrush>\n <properties_list type=\"array\">\n <item_0 value=\"size\" type=\"value\"/>\n <item_1 value=\"opacity\" type=\"value\"/>\n <item_2 value=\"hatching_angle\" type=\"value\"/>\n <item_3 value=\"hatching_thickness\" type=\"value\"/>\n <item_4 value=\"hatching_separation\" type=\"value\"/>\n </properties_list>\n </hatchingbrush>\n <gridbrush>\n <properties_list type=\"array\">\n <item_0 value=\"size\" type=\"value\"/>\n <item_1 value=\"opacity\" type=\"value\"/>\n <item_2 value=\"grid_divisionlevel\" type=\"value\"/>\n </properties_list>\n </gridbrush>\n <curvebrush>\n <properties_list type=\"array\">\n <item_0 value=\"opacity\" type=\"value\"/>\n <item_1 value=\"curve_historysize\" type=\"value\"/>\n <item_2 value=\"curve_linewidth\" type=\"value\"/>\n <item_3 value=\"curve_lineopacity\" type=\"value\"/>\n <item_4 value=\"curve_connectionline\" type=\"value\"/>\n </properties_list>\n </curvebrush>\n <dynabrush>\n <properties_list type=\"array\">\n <item_0 value=\"dyna_diameter\" type=\"value\"/>\n <item_1 value=\"opacity\" type=\"value\"/>\n <item_2 value=\"dyna_mass\" type=\"value\"/>\n <item_3 value=\"dyna_drag\" type=\"value\"/>\n </properties_list>\n </dynabrush>\n <particlebrush>\n <properties_list type=\"array\">\n <item_0 value=\"opacity\" type=\"value\"/>\n <item_1 value=\"particle_particles\" type=\"value\"/>\n <item_2 value=\"particle_opecityweight\" type=\"value\"/>\n <item_3 value=\"particle_iterations\" type=\"value\"/>\n </properties_list>\n </particlebrush>\n <duplicate>\n <properties_list type=\"array\">\n <item_0 value=\"size\" type=\"value\"/>\n <item_1 value=\"opacity\" type=\"value\"/>\n <item_2 value=\"clone_healing\" type=\"value\"/>\n <item_3 value=\"clone_movesource\" type=\"value\"/>\n </properties_list>\n </duplicate>\n <deformbrush>\n <properties_list type=\"array\">\n <item_0 value=\"size\" type=\"value\"/>\n <item_1 value=\"opacity\" type=\"value\"/>\n <item_2 value=\"deform_amount\" type=\"value\"/>\n <item_3 value=\"deform_mode\" type=\"value\"/>\n </properties_list>\n </deformbrush>\n <tangentnormal>\n <properties_list type=\"array\">\n <item_0 value=\"size\" type=\"value\"/>\n <item_1 value=\"opacity\" type=\"value\"/>\n </properties_list>\n </tangentnormal>\n <filter>\n <properties_list type=\"array\">\n <item_0 value=\"size\" type=\"value\"/>\n <item_1 value=\"opacity\" type=\"value\"/>\n </properties_list>\n </filter>\n <roundmarker>\n <properties_list type=\"array\">\n <item_0 value=\"opacity\" type=\"value\"/>\n <item_1 value=\"size\" type=\"value\"/>\n </properties_list>\n </roundmarker>\n</hud_properties>\n";
2805 return defaultValue ? defaultDoc : m_cfg.readEntry("brushHudSettings", defaultDoc);
2806}
2807
2808void KisConfig::setBrushHudSetting(const QString &value) const
2809{
2810 m_cfg.writeEntry("brushHudSettings", value);
2811}
2812
2814{
2815 return defaultValue ? true : m_cfg.readEntry("calculateAnimationCacheInBackground", true);
2816}
2817
2819{
2820 m_cfg.writeEntry("calculateAnimationCacheInBackground", value);
2821}
2822
2823QColor KisConfig::defaultAssistantsColor(bool defaultValue) const
2824{
2825 static const QColor defaultColor = QColor(176, 176, 176, 255);
2826 return defaultValue ? defaultColor : m_cfg.readEntry("defaultAssistantsColor", defaultColor);
2827}
2828
2829void KisConfig::setDefaultAssistantsColor(const QColor &color) const
2830{
2831 m_cfg.writeEntry("defaultAssistantsColor", color);
2832}
2833
2834bool KisConfig::autoSmoothBezierCurves(bool defaultValue) const
2835{
2836 return defaultValue ? false : m_cfg.readEntry("autoSmoothBezierCurves", false);
2837}
2838
2840{
2841 m_cfg.writeEntry("autoSmoothBezierCurves", value);
2842}
2843
2845{
2846 return defaultValue ? false : m_cfg.readEntry("activateTransformToolAfterPaste", false);
2847}
2848
2850{
2851 m_cfg.writeEntry("activateTransformToolAfterPaste", value);
2852}
2853
2854bool KisConfig::zoomHorizontal(bool defaultValue) const
2855{
2856 return defaultValue ? false : m_cfg.readEntry("zoomHorizontal", false);
2857}
2858
2860{
2861 m_cfg.writeEntry("zoomHorizontal", value);
2862}
2863
2864bool KisConfig::selectionActionBar(bool defaultValue) const
2865{
2866 return defaultValue ? true : m_cfg.readEntry("selectionActionBar", true);
2867}
2868
2870{
2871 m_cfg.writeEntry("selectionActionBar", value);
2872}
2873
2878
2880{
2881 m_cfg.writeEntry("selectionActionBarBehavior", (int)value);
2882}
2883
2888
2890{
2891 m_cfg.writeEntry("selectionActionBarPosition", (int)value);
2892}
2893
2898
2900{
2901 m_cfg.writeEntry("selectionActionBarOrientation", (int)value);
2902}
2903
2905{
2906 const QString configPath = QStandardPaths::writableLocation(QStandardPaths::GenericConfigLocation);
2907 QSettings kritarc(configPath + QStringLiteral("/kritadisplayrc"), QSettings::IniFormat);
2908
2909 return rootSurfaceFormat(&kritarc, defaultValue);
2910}
2911
2913{
2914 const QString configPath = QStandardPaths::writableLocation(QStandardPaths::GenericConfigLocation);
2915 QSettings kritarc(configPath + QStringLiteral("/kritadisplayrc"), QSettings::IniFormat);
2916
2917 setRootSurfaceFormat(&kritarc, value);
2918}
2919
2920KisConfig::RootSurfaceFormat KisConfig::rootSurfaceFormat(QSettings *displayrc, bool defaultValue)
2921{
2922 QString textValue = "bt709-g22";
2923
2924 if (!defaultValue) {
2925 textValue = displayrc->value("rootSurfaceFormat", textValue).toString();
2926 }
2927
2928 return textValue == "bt709-g10" ? BT709_G10 :
2929 textValue == "bt2020-pq" ? BT2020_PQ :
2930 BT709_G22;
2931}
2932
2934{
2935 const QString textValue =
2936 value == BT709_G10 ? "bt709-g10" :
2937 value == BT2020_PQ ? "bt2020-pq" :
2938 "bt709-g22";
2939
2940 displayrc->setValue("rootSurfaceFormat", textValue);
2941}
2942
2943bool KisConfig::useZip64(bool defaultValue) const
2944{
2945 return defaultValue ? false : m_cfg.readEntry("UseZip64", false);
2946}
2947
2949{
2950 m_cfg.writeEntry("UseZip64", value);
2951}
2952
2954{
2955 return defaultValue ? true : m_cfg.readEntry("convertLayerColorSpaceInProperties", true);
2956}
2957
2959{
2960 m_cfg.writeEntry("convertLayerColorSpaceInProperties", value);
2961}
2962
2963bool KisConfig::renamePastedLayers(bool defaultValue) const
2964{
2965 return defaultValue ? true : m_cfg.readEntry("renamePastedLayers", true);
2966}
2967
2969{
2970 m_cfg.writeEntry("renamePastedLayers", value);
2971}
2972
2974{
2975 return (KisConfig::LayerInfoTextStyle)(defaultValue ? INFOTEXT_NONE : m_cfg.readEntry("layerInfoTextStyle", (int)INFOTEXT_NONE));
2976}
2977
2979{
2980 m_cfg.writeEntry("layerInfoTextStyle", (int)value);
2981}
2982
2983int KisConfig::layerInfoTextOpacity(bool defaultValue) const
2984{
2985 return defaultValue ? 55 : m_cfg.readEntry("layerInfoTextOpacity", 55);
2986}
2987
2989{
2990 m_cfg.writeEntry("layerInfoTextOpacity", value);
2991}
2992
2993bool KisConfig::useInlineLayerInfoText(bool defaultValue) const
2994{
2995 return defaultValue ? false : m_cfg.readEntry("useInlineLayerInfoText", false);
2996}
2997
2999{
3000 m_cfg.writeEntry("useInlineLayerInfoText", value);
3001}
3002
3003bool KisConfig::useLayerSelectionCheckbox(bool defaultValue) const
3004{
3005 return defaultValue ? false : m_cfg.readEntry("useLayerSelectionCheckbox", true);
3006}
3007
3009{
3010 m_cfg.writeEntry("useLayerSelectionCheckbox", value);
3011}
3012
3014{
3015 if (defaultValue) {
3017 }
3018
3019 return static_cast<AssistantsDrawMode>(
3020 m_cfg.readEntry("assistantsDrawMode", static_cast<int>(ASSISTANTS_DRAW_MODE_DIRECT)));
3021}
3022
3024{
3025 m_cfg.writeEntry("assistantsDrawMode", static_cast<int>(value));
3026}
3027
3028bool KisConfig::longPressEnabled(bool defaultValue) const
3029{
3030#ifdef Q_OS_ANDROID
3031 bool defaultEnabled = true;
3032#else
3033 bool defaultEnabled = false;
3034#endif
3035 if (defaultValue) {
3036 return defaultEnabled;
3037 } else {
3038 return m_cfg.readEntry("longPressEnabled", defaultEnabled);
3039 }
3040}
3041
3043{
3044 m_cfg.writeEntry("longPressEnabled", value);
3046}
3047
3049{
3050 return defaultValue ? 40 : m_cfg.readEntry("layerThumbnailGenerationTimeout", 40);
3051}
3052
3054{
3055 m_cfg.writeEntry("layerThumbnailGenerationTimeout", value);
3056}
3057
3059{
3060 return m_cfg.readEntry(QStringLiteral("newsCheckEnabled"), true);
3061}
3062
3064{
3065 m_cfg.writeEntry(QStringLiteral("newsCheckEnabled"), value);
3066}
3067
3069{
3070 return m_cfg.readEntry(QStringLiteral("newsFirstStartup"), true);
3071}
3072
3074{
3075 m_cfg.writeEntry(QStringLiteral("newsFirstStartup"), value);
3076}
3077
3078#include <QDomDocument>
3079#include <QDomElement>
3080
3081void KisConfig::writeKoColor(const QString& name, const KoColor& color) const
3082{
3083 QDomDocument doc = QDomDocument(name);
3084 QDomElement el = doc.createElement(name);
3085 doc.appendChild(el);
3086 color.toXML(doc, el);
3087 m_cfg.writeEntry(name, doc.toString());
3088}
3089
3090//ported from kispropertiesconfig.
3091KoColor KisConfig::readKoColor(const QString& name, const KoColor& _color) const
3092{
3093 QDomDocument doc;
3094
3095 KoColor color = _color;
3096
3097 if (!m_cfg.readEntry(name).isNull()) {
3098 doc.setContent(m_cfg.readEntry(name));
3099 QDomElement e = doc.documentElement().firstChild().toElement();
3101 }
3102 else {
3103 QString blackColor = "<!DOCTYPE Color>\n<Color>\n <RGB r=\"0\" space=\"sRGB-elle-V2-srgbtrc.icc\" b=\"0\" g=\"0\"/>\n</Color>\n";
3104 doc.setContent(blackColor);
3105 QDomElement e = doc.documentElement().firstChild().toElement();
3107 }
3108 return color;
3109}
3110
3111void KisConfig::writeKoColors(const QString& name, const QList<KoColor>& colors) const
3112{
3113 QDomDocument doc = QDomDocument(name);
3114 QDomElement colorsElement = doc.createElement("colors");
3115 doc.appendChild(colorsElement);
3116
3117 // Writes like <colors><RGB ../><RGB .. /> ... </colors>
3118 Q_FOREACH(const KoColor & color, colors) {
3119 color.toXML(doc, colorsElement);
3120 }
3121 m_cfg.writeEntry(name, doc.toString());
3122}
3123
3124QList<KoColor> KisConfig::readKoColors(const QString& name) const
3125{
3126 QList<KoColor> colors;
3127 QString colorListXML = m_cfg.readEntry(name);
3128
3129 if (!colorListXML.isNull()) {
3130 QDomDocument doc;
3131 doc.setContent(colorListXML);
3132 QDomElement colorsElement = doc.firstChildElement();
3133 if (!colorsElement.isNull()) {
3134 QDomNodeList colorNodes = colorsElement.childNodes();
3135 colors.reserve(colorNodes.size());
3136
3137 for (int k = 0; k < colorNodes.size(); k++) {
3138 QDomElement colorElement = colorNodes.at(k).toElement();
3139 KoColor color = KoColor::fromXML(colorElement, Integer16BitsColorDepthID.id());
3140 colors.push_back(color);
3141 }
3142 }
3143 }
3144
3145 return colors;
3146}
3147
3148QDebug operator<<(QDebug debug, const KisConfig::CanvasSurfaceMode &mode)
3149{
3150 QDebugStateSaver saver(debug);
3151 debug.nospace() << "CanvasSurfaceMode(";
3152
3153 switch (mode) {
3155 debug.nospace() << "Preferred";
3156 break;
3158 debug.nospace() << "Rec709g22";
3159 break;
3161 debug.nospace() << "Rec709g10";
3162 break;
3164 debug.nospace() << "Rec2020pq";
3165 break;
3167 debug.nospace() << "Unmanaged";
3168 break;
3169 default:
3170 debug.nospace() << "unknown(" << static_cast<int>(mode) << ")";
3171 break;
3172 }
3173
3174 debug.nospace() << ")";
3175
3176 return debug.space();
3177}
3178
3179QDebug operator<<(QDebug debug, const KisConfig::CanvasSurfaceBitDepthMode &mode)
3180{
3181
3182 QDebugStateSaver saver(debug);
3183 debug.nospace() << "CanvasSurfaceBitDepthMode(";
3184
3185 switch (mode) {
3187 debug.nospace() << "DepthAuto";
3188 break;
3190 debug.nospace() << "Depth8Bit";
3191 break;
3193 debug.nospace() << "Depth10Bit";
3194 break;
3195 default:
3196 debug.nospace() << "unknown(" << static_cast<int>(mode) << ")";
3197 break;
3198 }
3199
3200 debug.nospace() << ")";
3201
3202 return debug.space();
3203}
3204
qreal length(const QPointF &vec)
Definition Ellipse.cc:82
float value(const T *src, size_t ch)
qreal v
QList< QString > QStringList
const KoID Integer16BitsColorDepthID("U16", ki18n("16-bit integer/channel"))
const quint8 OPACITY_OPAQUE_U8
void notifyLongPressChanged(bool enabled)
static KisConfigNotifier * instance()
void notifyColorSamplerPreviewStyleChanged()
QString widgetStyle(bool defaultValue=false)
void setCumulativeUndoData(KisCumulativeUndoData value)
qreal lineSmoothingDistanceMin(bool defaultValue=false) const
bool testingAcceptCompressedTabletEvents(bool defaultValue=false) const
void setForceShowSaveMessages(bool value) const
QString importConfiguration(const QString &filterId, bool defaultValue=false) const
void setPreferredVectorImportResolutionPPI(int value) const
ColorSamplerPreviewCirclePosition colorSamplerPreviewCirclePosition(bool defaultValue=false) const
bool backupFile(bool defaultValue=false) const
void setAntialiasCurves(bool v) const
bool useOcio(bool defaultValue=false) const
void setDefaultBackgroundOpacity(const QLatin1String &dialogType, quint8 value)
void setSwitchSelectionCtrlAlt(bool value)
qint32 defImageHeight(bool defaultValue=false) const
bool antialiasSelectionOutline(bool defaultValue=false) const
void setColorSamplerZoomPreviewScale(qreal scale)
void setZoomSteps(int steps)
@ ASSISTANTS_DRAW_MODE_DIRECT
Definition kis_config.h:878
int zoomSteps(bool defaultValue=false) const
qreal lineSmoothingTailAggressiveness(bool defaultValue=false) const
OcioColorManagementMode ocioColorManagementMode(bool defaultValue=false) const
void setHideDockersFullscreen(const bool value) const
void setUseEraserBrushOpacity(bool value)
LayerInfoTextStyle layerInfoTextStyle(bool defaultValue=false) const
static CanvasSurfaceBitDepthMode canvasSurfaceBitDepthMode(QSettings *settings, bool defaultValue=false)
void setCurrentInputProfile(const QString &name)
int preferredVectorImportResolutionPPI(bool defaultValue=false) const
void setAdaptivePlaybackRange(bool value)
void setEnableCanvasSurfaceColorSpaceManagement(bool value)
void setLineSmoothingTailAggressiveness(qreal value)
void loadSnapConfig(KisSnapConfig *config, bool defaultValue=false) const
bool colorSamplerPreviewCircleOutlineEnabled(bool defaultValue=false) const
void setPasteFormat(qint32 format)
KConfigGroup m_cfg
Definition kis_config.h:928
QColor checkersColor2(bool defaultValue=false) const
void setColorSamplerPreviewCircleOutlineEnabled(bool enabled)
void setGridSubdivisionColor(const QColor &v) const
void setUseRightMiddleTabletButtonWorkaround(bool value)
int lineSmoothingType(bool defaultValue=false) const
void setDefaultBackgroundStyle(const QLatin1String &dialogType, BackgroundStyle value)
void setCheckersColor1(const QColor &v) const
QString toolbarSlider(int sliderNumber, bool defaultValue=false) const
int stabilizerSampleSize(bool defaultValue=false) const
quint32 guidesLineStyle(bool defaultValue=false) const
void setHidePopups(bool hidePopups)
void setFullscreenMode(const bool value) const
void setLineSmoothingUseDelayDistance(bool value)
void setMDIBackgroundColor(const QString &v) const
QString pressureTabletCurve(bool defaultValue=false) const
void setUndoStackLimit(int limit) const
qint32 defImageWidth(bool defaultValue=false) const
bool showGlobalSelection(bool defaultValue=false) const
bool hideScrollbars(bool defaultValue=false) const
int verticalSplitLines(bool defaultValue=false) const
int openGLFilteringMode(bool defaultValue=false) const
void setUseZip64(bool value)
bool showSingleChannelAsColor(bool defaultValue=false) const
void setWidgetStyle(QString name)
void setHideToolbarFullscreen(const bool value) const
BackgroundStyle defaultBackgroundStyle(const QLatin1String &dialogType, bool defaultValue=false) const
void setCanvasState(const QString &state) const
void setLineSmoothingDistanceKeepAspectRatio(bool value)
int kineticScrollingSensitivity(bool defaultValue=false) const
bool convertToImageColorspaceOnImport(bool defaultValue=false) const
QString exportConfigurationXML(const QString &filterId, bool defaultValue=false) const
int zoomMarginSize(bool defaultValue=false) const
void setFFMpegLocation(const QString &value)
void setAutoZoomTimelineToPlaybackRange(bool value)
bool showRootLayer(bool defaultValue=false) const
void setTestingAcceptCompressedTabletEvents(bool value)
qint32 pasteFormat(bool defaultValue) const
void setEnableBrushSpeedLogging(bool value) const
QColor defaultBackgroundColor(const QLatin1String &dialogType, bool defaultValue=false) const
void setShowDockers(const bool value) const
void setExportMimeType(const QString &defaultExportMimeType)
bool forceShowSaveMessages(bool defaultValue=true) const
bool useInlineLayerInfoText(bool defaultValue=false) const
void setUseWin8PointerInput(bool value)
QPoint getDefaultGridSpacing(bool defaultValue=false) const
void setShowBrushHud(bool value)
void enablePixelGrid(bool v) const
void setShowStatusBar(const bool value) const
bool useDirtyPresets(bool defaultValue=false) const
void setOcioLutEdgeSize(int value)
void setDefaultBackgroundColor(const QLatin1String &dialogType, const QColor &value)
void setDefaultPalette(const QString &name) const
qreal getPixelGridDrawingThreshold(bool defaultValue=false) const
bool switchSelectionCtrlAlt(bool defaultValue=false) const
void setRenamePastedLayers(bool value)
bool shouldEatDriverShortcuts(bool defaultValue=false) const
QColor checkersColor1(bool defaultValue=false) const
void setHideScrollbars(bool value) const
void writeKoColors(const QString &name, const QList< KoColor > &colors) const
bool allowLCMSOptimization(bool defaultValue=false) const
KisConfig(bool readOnly)
KisConfig create a kisconfig object.
Definition kis_config.cc:55
int animationPlaybackBackend(bool defaultValue=false) const
void setShowPaletteBottomBar(bool value)
CanvasSurfaceBitDepthMode effectiveCanvasSurfaceBitDepthMode(const QSurfaceFormat &format) const
static void setCanvasSurfaceBitDepthMode(QSettings *settings, CanvasSurfaceBitDepthMode value)
int numMipmapLevels(bool defaultValue=false) const
void setIgnoreHighFunctionKeys(bool value)
const KoColorSpace * customColorSelectorColorSpace(bool defaultValue=false) const
bool showFilterGalleryLayerMaskDialog(bool defaultValue=false) const
bool activateTransformToolAfterPaste(bool defaultValue=false) const
void setNewCursorStyle(CursorStyle style)
bool hideDockersFullscreen(bool defaultValue=false) const
static void setUseWin8PointerInputNoApp(QSettings *settings, bool value)
void setUseInlineLayerInfoText(bool value)
void disableOpenGL() const
void setGridSubdivisionStyle(quint32 v) const
void setEraserCursorStyle(CursorStyle style)
bool compressKra(bool defaultValue=false) const
void setTrackTabletEventLatency(bool value)
static bool preferXcbEglProvider(const QSettings *settings, bool defaultValue=false)
int textureOverlapBorder() const
bool disableVectorOptimizations(bool defaultValue=false) const
void setCursorMainColor(const QColor &v) const
void setColorSamplerPreviewCircleThickness(qreal thickness)
SelectionActionsBarOrientation selectionActionBarOrientation(bool defaultValue=false) const
void setCanvasSurfaceColorSpaceManagementMode(CanvasSurfaceMode value)
void setUndoEnabled(bool undo) const
bool levelOfDetailEnabled(bool defaultValue=false) const
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
bool lineSmoothingScalableDistance(bool defaultValue=false) const
bool newsFirstStartup() const
bool forceOpenGLFenceWorkaround(bool defaultValue=false) const
void setForcePaletteColors(bool forcePaletteColors)
void setHideTitlebarFullscreen(const bool value) const
void setScrubbingAudioUpdatesDelay(int value)
int layerThumbnailSize(bool defaultValue=false) const
bool enableOpenGLFramerateLogging(bool defaultValue=false) const
QColor getPixelGridColor(bool defaultValue=false) const
void setGridIsoVerticalStyle(quint32 v) const
qreal vastScrolling(bool defaultValue=false) const
void setSelectionViewSizeMinimum(qreal outlineSizeMinimum) const
bool fullscreenMode(bool defaultValue=false) const
bool useDefaultColorSpace(bool defaultvalue=false) const
bool toolOptionsPopupDetached(bool defaultValue=false) const
bool autoSmoothBezierCurves(bool defaultValue=false) const
bool pixelGridEnabled(bool defaultValue=false) const
void setRulersTrackMouse(bool value) const
QColor defaultAssistantsColor(bool defaultValue=false) const
quint8 defaultBackgroundOpacity(const QLatin1String &dialogType, bool defaultValue=false) const
bool hideMenuFullscreen(bool defaultValue=false) const
QString getMDIBackgroundColor(bool defaultValue=false) const
bool showPaletteBottomBar(bool defaultValue=false) const
bool lineSmoothingFinishStabilizedCurve(bool defaultValue=false) const
void setLineSmoothingFinishStabilizedCurve(bool value)
void setUseDefaultColorSpace(bool value) const
void setDefaultColorDepth(const QString &depth) const
bool hideScrollbarsFullscreen(bool defaultValue=false) const
QString printerProfile(bool defaultValue=false) const
void setStabilizerDelayedPaint(bool value)
TouchPainting touchPainting(bool defaultValue=false) const
void setSeparateEraserCursor(bool value) const
qint32 monitorRenderIntent(bool defaultValue=false) const
bool showFilterGallery(bool defaultValue=false) const
void setActivateTransformToolAfterPaste(bool value)
void setShowFilterGallery(bool showFilterGallery) const
bool m_readOnly
Definition kis_config.h:929
int kineticScrollingGesture(bool defaultValue=false) const
bool useZip64(bool defaultValue=false) const
bool calculateAnimationCacheInBackground(bool defaultValue=false) const
void setLineSmoothingDistanceMin(qreal value)
void setSelectionActionBarBehavior(SelectionActionsBarBehavior value)
int favoritePresets(bool defaultValue=false) const
bool zoomHorizontal(bool defaultValue=false) const
SelectionActionsBarPosition
Definition kis_config.h:813
QString getMDIBackgroundImage(bool defaultValue=false) const
KisPropertiesConfigurationSP exportConfiguration(const QString &filterId, bool defaultValue=false) const
void setAssistantsDrawMode(AssistantsDrawMode value)
void setShowGlobalSelection(bool showGlobalSelection) const
quint32 getGridMainStyle(bool defaultValue=false) const
SelectionActionsBarBehavior
Definition kis_config.h:808
void setScrubbingUpdatesDelay(int value)
CanvasSurfaceMode canvasSurfaceColorSpaceManagementMode(bool defaultValue=false) const
bool hideToolbarFullscreen(bool defaultValue=false) const
void setScratchpadVisible(bool visible)
qreal outlineSizeMinimum(bool defaultValue=false) const
bool showCanvasMessages(bool defaultValue=false) const
QList< KoColor > readKoColors(const QString &name) const
QColor getGridMainColor(bool defaultValue=false) const
bool hideDevFundBanner(bool defaultValue=false) const
void setAnimationDropFrames(bool value)
int openGLTextureSize(bool defaultValue=false) const
qreal timelineZoom(bool defaultValue=false) const
void setDefaultGridSpacing(QPoint gridSpacing)
bool useWin8PointerInput(bool defaultValue=false) const
void setPrinterColorSpace(const QString &printerColorSpace) const
bool useOpenGLTextureBuffer(bool defaultValue=false) const
void setToolOptionsPopupDetached(bool detached) const
void setLineSmoothingDelayDistance(qreal value)
OutlineStyle lastUsedOutlineStyle(bool defaultValue=false) const
void setCalculateAnimationCacheInBackground(bool value)
void setGridMainStyle(quint32 v) const
void setColorSamplerPreviewCircleExtraCirclesEnabled(bool enabled)
void setAutoSaveInterval(int seconds) const
void setShowSingleChannelAsColor(bool asColor)
void setTrimFramesImport(bool trim)
bool forcePaletteColors(bool defaultValue=false) const
void setClicklessSpacePan(const bool toggle) const
bool convertLayerColorSpaceInProperties(bool defaultValue=false) const
bool colorSamplerZoomPreviewEnabled(bool defaultValue=false) const
bool showDockerTitleBars(bool defaultValue=false) const
qreal defImageResolution(bool defaultValue=false) const
void setTimelineZoom(qreal value)
void setAllowLCMSOptimization(bool allowLCMSOptimization)
void setPrinterProfile(const QString &printerProfile) const
void setUseLayerSelectionCheckbox(bool value)
void setVerticalSplitLines(const int numberLines) const
KisOcioConfiguration ocioConfiguration(bool defaultValue=false) const
void setColorSamplerPreviewCircleDiameter(int style)
void setSliderLabels(bool enabled)
void setRenderIntent(qint32 monitorRenderIntent) const
void setBrushHudSetting(const QString &value) const
void setFavoritePresets(const int value)
void setEraserOutlineStyle(OutlineStyle style)
bool effectiveShouldUseNativeSurfaceForCanvas(bool osManagedSurfacePresent) const
void setShowOutlineWhilePainting(bool showOutlineWhilePainting) const
bool lineSmoothingDistanceKeepAspectRatio(bool defaultValue=false) const
RootSurfaceFormat rootSurfaceFormat(bool defaultValue=false) const
QColor canvasBorderColor(bool defaultValue=false) const
void setPresetStripVisible(bool visible)
int colorSamplerPreviewCircleDiameter(bool defaultValue=false) const
int tabletEventsDelay(bool defaultValue=false) const
QString exportMimeType(bool defaultValue) const
void setScrollingCheckers(bool scrollCheckers) const
const QString getScreenStringIdentfier(int screenNo) const
bool firstRun(bool defaultValue=false) const
void setBackupFile(bool backupFile) const
void setTabletEventsDelay(int value)
KoColor readKoColor(const QString &name, const KoColor &color=KoColor()) const
void logImportantSettings() const
Log the most interesting settings to the usage log.
Definition kis_config.cc:76
IconsInMenu iconsInMenu(bool defaultValue=false) const
QString ffmpegLocation(bool defaultValue=false) const
void setImportConfiguration(const QString &filterId, KisPropertiesConfigurationSP properties) const
bool useLayerSelectionCheckbox(bool defaultValue=false) const
int numDefaultLayers(const QLatin1String &dialogType, bool defaultValue=false) const
QColor guidesColor(bool defaultValue=false) const
void setNumDefaultLayers(const QLatin1String &dialogType, int num)
CursorStyle newCursorStyle(bool defaultValue=false) const
bool useCumulativeUndoRedo(bool defaultValue=false) const
void setCheckSize(qint32 checkSize) const
void setLevelOfDetailEnabled(bool value)
bool paintopPopupDetached(bool defaultValue=false) const
void setToolbarSlider(int sliderNumber, const QString &slider)
CursorStyle eraserCursorStyle(bool defaultValue=false) const
void setNewsCheckEnabled(bool value)
void setKineticScrollingGesture(int kineticScroll)
QString defColorProfile(bool defaultValue=false) const
void setLineSmoothingSmoothPressure(bool value)
void setPreferXcbEglProvider(bool value)
void setPixelGridDrawingThreshold(qreal v) const
void setStabilizerSampleSize(int value)
QString currentInputProfile(bool defaultValue=false) const
void setCanvasBorderColor(const QColor &color) const
QString monitorProfile(int screen) const
get the profile the user has selected for the given screen
void setGridIsoVerticalColor(const QColor &v) const
void setVastScrolling(const qreal factor) const
@ TOUCH_PAINTING_DISABLED
Definition kis_config.h:50
@ TOUCH_PAINTING_ENABLED
Definition kis_config.h:49
@ TOUCH_PAINTING_AUTO
Definition kis_config.h:48
void setShowCanvasMessages(bool show)
void setDefaultAssistantsColor(const QColor &color) const
qint32 checkSize(bool defaultValue=false) const
void setConvertLayerColorSpaceInProperties(bool value)
void setWorkingColorSpace(const QString &workingColorSpace) const
void setColorSamplerPreviewCirclePosition(ColorSamplerPreviewCirclePosition position)
KisCumulativeUndoData cumulativeUndoData(bool defaultValue=false) const
QString splashScreenImage(bool defaultValue=false) const
void setMonitorProfile(int screen, const QString &monitorProfile) const
bool scratchpadVisible(bool defaultValue=false) const
OutlineStyle newOutlineStyle(bool defaultValue=false) const
int layerThumbnailGenerationTimeout(bool defaultValue=false) const
bool forceAlwaysFullSizedOutline(bool defaultValue=false) const
void setCustomColorSelectorColorSpace(const KoColorSpace *cs)
ColorSamplerPreviewStyle
Definition kis_config.h:138
void setLineSmoothingType(int value)
void setPressureTabletCurve(const QString &curveString) const
qreal colorSamplerPreviewCircleThickness(bool defaultValue=false) const
SelectionActionsBarBehavior selectionActionBarBehavior(bool defaultValue=false) const
bool clicklessSpacePan(bool defaultValue=false) const
QString workingColorSpace(bool defaultValue=false) const
void setEnableOpenGLFramerateLogging(bool value) const
bool trackTabletEventLatency(bool defaultValue=false) const
bool renamePastedLayers(bool defaultValue=false) const
int horizontalSplitLines(bool defaultValue=false) const
void setShowDockerTitleBars(const bool value) const
void setFirstRun(const bool firstRun) const
void setNewOutlineStyle(OutlineStyle style)
void setCheckersColor2(const QColor &v) const
void setShowRootLayer(bool showRootLayer) const
void setColorSamplerZoomPreviewEnabled(bool enabled)
void setAutoSmoothBezierCurves(bool value)
void setSelectionActionBarOrientation(SelectionActionsBarOrientation value)
OutlineStyle eraserOutlineStyle(bool defaultValue=false) const
void saveSnapConfig(const KisSnapConfig &config)
void setScrollbarZoomEnabled(bool enabled) const
int presetChooserViewMode(bool defaultValue=false) const
void setUseBlackPointCompensation(bool useBlackPointCompensation) const
bool kineticScrollingEnabled(bool defaultValue=false) const
bool animationDropFrames(bool defaultValue=false) const
void setLineSmoothingStabilizeSensors(bool value)
void setNewsFirstStartup(bool value)
void setSplashScreenImage(const QString &value)
SelectionActionsBarOrientation
Definition kis_config.h:824
bool disableTouchOnCanvas() const
int ocioLutEdgeSize(bool defaultValue=false) const
void setAudioOffsetTolerance(int value)
void setUseOpenGLTextureBuffer(bool useBuffer)
void setTrimKra(bool trim)
void setOcioConfiguration(const KisOcioConfiguration &cfg)
void setIconsInMenu(IconsInMenu value)
ColorSamplerPreviewCirclePosition
Definition kis_config.h:168
void setPresetIconSize(const int value) const
OcioColorManagementMode
Definition kis_config.h:553
bool hideTitlebarFullscreen(bool defaultValue=false) const
QString defaultPalette(bool defaultValue=false) const
bool useRightMiddleTabletButtonWorkaround(bool defaultValue=false) const
bool longPressEnabled(bool defaultValue=false) const
QStringList favoriteCompositeOps(bool defaultValue=false) const
bool useEraserBrushOpacity(bool defaultValue=false) const
void setColorSamplerPreviewStyle(ColorSamplerPreviewStyle style)
bool sliderLabels(bool defaultValue=false) const
bool hidePopups(bool defaultValue=false) const
bool enableCanvasSurfaceColorSpaceManagement(bool defaultValue=false) const
void setGuidesLineStyle(quint32 v) const
QString printerColorSpace(bool defaultValue=false) const
bool showBrushHud(bool defaultValue=false) const
void setRootSurfaceFormat(RootSurfaceFormat value)
bool autoPinLayersToTimeline(bool defaultValue=false) const
bool scrollbarZoomEnabled(bool defaultValue=false) const
bool toolOptionsInDocker(bool defaultValue=false) const
void setPresetChooserViewMode(const int mode) const
void setOpenGLFilteringMode(int filteringMode)
void setKineticScrollingHideScrollbars(bool scrollbar)
void setAntialiasSelectionOutline(bool v) const
bool trimKra(bool defaultValue=false) const
static bool useWin8PointerInputNoApp(QSettings *settings, bool defaultValue=false)
bool forceShowAutosaveMessages(bool defaultValue=true) const
SelectionActionsBarPosition selectionActionBarPosition(bool defaultValue=false) const
int layerTreeIndentation(bool defaultValue=false) const
void setFavoriteCompositeOps(const QStringList &compositeOps) const
void setOcioColorManagementMode(OcioColorManagementMode mode) const
bool enableBrushSpeedLogging(bool defaultValue=false) const
bool forceAlwaysFullSizedEraserOutline(bool defaultValue=false) const
int autoSaveInterval(bool defaultValue=false) const
int workaroundX11SmoothPressureSteps(bool defaultValue=false) const
QString defColorModel(bool defaultValue=false) const
void setPaintopPopupDetached(bool detached) const
void setDisableVectorOptimizations(bool value)
void setHideStatusbarFullscreen(const bool value) const
void setCompressKra(bool compress)
void setTouchPainting(TouchPainting value) const
int audioOffsetTolerance(bool defaultValue=false) const
bool showOutlineWhilePainting(bool defaultValue=false) const
qreal lineSmoothingDelayDistance(bool defaultValue=false) const
void setUseEraserBrushSize(bool value)
quint32 getGridIsoVerticalStyle(bool defaultValue=false) const
void setShowEraserOutlineWhilePainting(bool showEraserOutlineWhilePainting) const
bool lineSmoothingSmoothPressure(bool defaultValue=false) const
QString canvasState(bool defaultValue=false) const
void setHideMenuFullscreen(const bool value) const
int scrubbingUpdatesDelay(bool defaultValue=false) const
bool autoZoomTimelineToPlaybackRange(bool defaultValue=false) const
bool scrollCheckers(bool defaultValue=false) const
void setForceShowAutosaveMessages(bool ShowAutosaveMessages) const
QColor getGridIsoVerticalColor(bool defaultValue=false) const
bool colorHistoryPerDocument(bool defaultValue=false) const
bool stabilizerDelayedPaint(bool defaultValue=false) const
void setOutlineSizeMinimum(qreal outlineSizeMinimum) const
CanvasSurfaceBitDepthMode
Definition kis_config.h:214
bool useEraserBrushSize(bool defaultValue=false) const
void setLayerThumbnailSize(int size)
void setZoomMarginSize(int zoomMarginSize)
@ SOS_BlankSession
Definition kis_config.h:392
void setShowRulers(bool rulers) const
void setLayerInfoTextOpacity(int value)
bool hideStatusbarFullscreen(bool defaultValue=false) const
void setGridMainColor(const QColor &v) const
qreal lineSmoothingDistanceMax(bool defaultValue=false) const
bool presetStripVisible(bool defaultValue=false) const
bool lineSmoothingUseDelayDistance(bool defaultValue=false) const
bool colorSamplerPreviewCircleExtraCirclesEnabled(bool defaultValue=false) const
void setZoomHorizontal(bool value)
void setLineSmoothingScalableDistance(bool value)
void setHideDevFundBanner(bool value=true)
bool kineticScrollingHiddenScrollbars(bool defaultValue=false) const
bool newsCheckEnabled() const
bool showDockers(bool defaultValue=false) const
void setExportConfiguration(const QString &filterId, KisPropertiesConfigurationSP properties) const
const KoColorProfile * displayProfile(int screen) const
void setLineSmoothingDistanceMax(qreal value)
bool useOpenGL(bool defaultValue=false) const
void setTestingCompressBrushEvents(bool value)
bool trimFramesImport(bool defaultValue=false) const
int presetIconSize(bool defaultValue=false) const
bool testingCompressBrushEvents(bool defaultValue=false) const
void setForceAlwaysFullSizedEraserOutline(bool value) const
bool selectionActionBar(bool defaultValue=false) const
QString defaultColorDepth(bool defaultValue=false) const
void setSelectionActionBarPosition(SelectionActionsBarPosition value)
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 setLayerThumbnailGenerationTimeout(int value)
void setUseProjections(bool useProj) const
void setSelectionActionBar(bool value)
qint32 pasteBehaviour(bool defaultValue=false) const
AssistantsDrawMode assistantsDrawMode(bool defaultValue=false) const
bool rulersTrackMouse(bool defaultValue=false) const
void setUseDirtyPresets(bool value)
quint32 getGridSubdivisionStyle(bool defaultValue=false) const
bool separateEraserCursor(bool defaultValue=false) const
void setGuidesColor(const QColor &v) const
void setEraserCursorMainColor(const QColor &v) const
void setSaveSessionOnQuit(bool value)
bool disableAVXOptimizations(bool defaultValue=false) const
bool showEraserOutlineWhilePainting(bool defaultValue=false) const
bool showStatusBar(bool defaultValue=false) const
bool showRulers(bool defaultValue=false) const
void setPasteBehaviour(qint32 behaviour) const
void setLayerInfoTextStyle(LayerInfoTextStyle value)
void setSessionOnStartup(SessionOnStartup value)
void setLayerTreeIndentation(int percentage)
int scrubbingAudioUpdatesDelay(bool defaultValue=false) const
void setHideScrollbarsFullscreen(const bool value) const
int layerInfoTextOpacity(bool defaultValue=false) const
QColor getGridSubdivisionColor(bool defaultValue=false) const
void setAnimationPlaybackBackend(int value)
void setAutoPinLayersToTimeline(bool value)
QColor getEraserCursorMainColor(bool defaultValue=false) const
void setUseOcio(bool useOCIO) const
void setLastUsedOutlineStyle(OutlineStyle style)
qreal colorSamplerZoomPreviewScale(bool defaultValue=false) const
bool lineSmoothingStabilizeSensors(bool defaultValue=false) const
bool antialiasCurves(bool defaultValue=false) const
void setKineticScrollingSensitivity(int sensitivity)
QString brushHudSetting(bool defaultValue=false) const
bool ignoreHighFunctionKeys(bool defaultValue=false) const
bool useProjections(bool defaultValue=false) const
void setDisableAVXOptimizations(bool value)
qreal selectionViewSizeMinimum(bool defaultValue=false) const
bool adaptivePlaybackRange(bool defaultValue=false) const
void writeKoColor(const QString &name, const KoColor &color) const
void setOcioLockColorVisualRepresentation(bool value)
void setShowFilterGalleryLayerMaskDialog(bool showFilterGallery) const
void setHorizontalSplitLines(const int numberLines) const
bool undoEnabled(bool defaultValue=false) const
void setKineticScrollingEnabled(bool enabled)
bool ocioLockColorVisualRepresentation(bool defaultValue=false) const
static const QString resourceLocationKey
bool orthogonal() const
void setImageCenter(bool value)
void setIntersection(bool value)
bool node() const
bool toPixel() const
bool imageBounds() const
void setOrthogonal(bool value)
bool boundingBox() const
void setExtension(bool value)
void setToPixel(bool value)
void setBoundingBox(bool value)
bool intersection() const
bool extension() const
void setImageBounds(bool value)
bool imageCenter() const
void setNode(bool value)
static void log(const QString &message)
Logs with date/time.
static void writeSysInfo(const QString &message)
Writes to the system information file and Krita log.
virtual KoID colorModelId() const =0
virtual KoID colorDepthId() const =0
virtual const KoColorProfile * profile() const =0
static KoColor fromXML(const QDomElement &elt, const QString &channelDepthId)
Definition KoColor.cpp:350
void toXML(QDomDocument &doc, QDomElement &colorElt) const
Definition KoColor.cpp:304
void fromQColor(const QColor &c)
Convenient function for converting from a QColor.
Definition KoColor.cpp:213
QString id() const
Definition KoID.cpp:63
static bool tabletInputReceived()
#define KIS_SAFE_ASSERT_RECOVER_RETURN(cond)
Definition kis_assert.h:128
void cleanOldCursorStyleKeys(KConfigGroup &cfg)
QDebug operator<<(QDebug debug, const KisConfig::CanvasSurfaceMode &mode)
const QString DEFAULT_CURVE_STRING
QString kisBacktrace()
Definition kis_debug.cpp:51
#define dbgKrita
Definition kis_debug.h:49
@ OLD_CURSOR_STYLE_OUTLINE_TRIANGLE_RIGHTHANDED
Definition kis_global.h:93
@ OLD_CURSOR_STYLE_OUTLINE
Definition kis_global.h:82
@ OLD_CURSOR_STYLE_OUTLINE_CENTER_CROSS
Definition kis_global.h:88
@ OLD_CURSOR_STYLE_CROSSHAIR
Definition kis_global.h:79
@ OLD_CURSOR_STYLE_NO_CURSOR
Definition kis_global.h:84
@ OLD_CURSOR_STYLE_TOOLICON
Definition kis_global.h:78
@ OLD_CURSOR_STYLE_TRIANGLE_LEFTHANDED
Definition kis_global.h:91
@ OLD_CURSOR_STYLE_POINTER
Definition kis_global.h:80
@ OLD_CURSOR_STYLE_OUTLINE_CENTER_DOT
Definition kis_global.h:87
@ OLD_CURSOR_STYLE_OUTLINE_TRIANGLE_LEFTHANDED
Definition kis_global.h:94
@ OLD_CURSOR_STYLE_TRIANGLE_RIGHTHANDED
Definition kis_global.h:90
@ OLD_CURSOR_STYLE_SMALL_ROUND
Definition kis_global.h:85
OutlineStyle
Definition kis_global.h:53
@ N_OUTLINE_STYLE_SIZE
Definition kis_global.h:59
@ OUTLINE_FULL
Definition kis_global.h:56
@ OUTLINE_NONE
Definition kis_global.h:54
#define INTENT_RELATIVE_COLORIMETRIC
Definition kis_global.h:104
CursorStyle
Definition kis_global.h:62
@ CURSOR_STYLE_POINTER
Definition kis_global.h:65
@ CURSOR_STYLE_SMALL_ROUND
Definition kis_global.h:66
@ CURSOR_STYLE_CROSSHAIR
Definition kis_global.h:67
@ CURSOR_STYLE_TOOLICON
Definition kis_global.h:64
@ CURSOR_STYLE_TRIANGLE_RIGHTHANDED
Definition kis_global.h:68
@ N_CURSOR_STYLE_SIZE
Definition kis_global.h:74
@ CURSOR_STYLE_TRIANGLE_LEFTHANDED
Definition kis_global.h:69
@ CURSOR_STYLE_NO_CURSOR
Definition kis_global.h:63
@ CURSOR_STYLE_ERASER
Definition kis_global.h:72
bool looksLikeBrokenCursorDevice()
static const KisCumulativeUndoData defaultValue
bool read(const KConfigGroup *config)
void write(KConfigGroup *config) const
virtual bool isSuitableForDisplay() const =0
const KoColorProfile * profileByName(const QString &name) const
const KoColorSpace * colorSpace(const QString &colorModelId, const QString &colorDepthId, const KoColorProfile *profile)
static KoColorSpaceRegistry * instance()