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
40#include <kis_color_manager.h>
42#include <KisUsageLogger.h>
43#include <kis_image_config.h>
45#include <QSurfaceFormat>
46
47#if defined Q_OS_WIN && QT_VERSION >= QT_VERSION_CHECK(6, 0, 0)
48# include <QtGui/private/qguiapplication_p.h>
49# include <QtGui/qpa/qplatformintegration.h>
50#endif
51
52#ifdef Q_OS_ANDROID
53#include <KisAndroidUtils.h>
54#endif
55
57 : m_cfg( KSharedConfig::openConfig()->group(""))
58 , m_readOnly(readOnly)
59{
60 if (!readOnly) {
61 KIS_SAFE_ASSERT_RECOVER_RETURN(qApp && qApp->thread() == QThread::currentThread());
62 }
63}
64
66{
67 if (m_readOnly) return;
68
69 if (qApp && qApp->thread() != QThread::currentThread()) {
70 dbgKrita.noquote() << "WARNING: KisConfig: requested config synchronization from nonGUI thread! Called from:" << kisBacktrace();
71 return;
72 }
73
74 m_cfg.sync();
75}
76
78{
79 KisUsageLogger::writeSysInfo("Current Settings\n");
80 KisUsageLogger::writeSysInfo(QString(" Current Swap Location: %1").arg(KisImageConfig(true).swapDir()));
81 KisUsageLogger::writeSysInfo(QString(" Current Swap Location writable: %1").arg(QFileInfo(KisImageConfig(true).swapDir()).isWritable() ? "true" : "false"));
82 KisUsageLogger::writeSysInfo(QString(" Undo Enabled: %1").arg(undoEnabled()? "true" : "false"));
83 KisUsageLogger::writeSysInfo(QString(" Undo Stack Limit: %1").arg(undoStackLimit()));
84 KisUsageLogger::writeSysInfo(QString(" Use OpenGL: %1").arg(useOpenGL() ? "true" : "false"));
85 KisUsageLogger::writeSysInfo(QString(" Use OpenGL Texture Buffer: %1").arg(useOpenGLTextureBuffer() ? "true" : "false"));
86 KisUsageLogger::writeSysInfo(QString(" Disable Vector Optimizations: %1").arg(disableVectorOptimizations() ? "true" : "false"));
87 KisUsageLogger::writeSysInfo(QString(" Disable AVX Optimizations: %1").arg(disableAVXOptimizations() ? "true" : "false"));
88 KisUsageLogger::writeSysInfo(QString(" Canvas State: %1").arg(canvasState()));
89 KisUsageLogger::writeSysInfo(QString(" Autosave Interval: %1").arg(autoSaveInterval()));
90 KisUsageLogger::writeSysInfo(QString(" Use Backup Files: %1").arg(backupFile() ? "true" : "false"));
91 KisUsageLogger::writeSysInfo(QString(" Number of Backups Kept: %1").arg(m_cfg.readEntry("numberofbackupfiles", 1)));
92 KisUsageLogger::writeSysInfo(QString(" Backup File Suffix: %1").arg(m_cfg.readEntry("backupfilesuffix", "~")));
93
94 QString backupDir;
95 switch(m_cfg.readEntry("backupfilelocation", 0)) {
96 case 1:
97 backupDir = QStandardPaths::writableLocation(QStandardPaths::HomeLocation);
98 break;
99 case 2:
100 backupDir = QStandardPaths::writableLocation(QStandardPaths::TempLocation);
101 break;
102 default:
103 // Do nothing: the empty string is user file location
104 backupDir = "Same Folder as the File";
105 }
106 KisUsageLogger::writeSysInfo(QString(" Backup Location: %1").arg(backupDir));
107 KisUsageLogger::writeSysInfo(QString(" Backup Location writable: %1").arg(QFileInfo(backupDir).isWritable() ? "true" : "false"));
108 KisUsageLogger::writeSysInfo(QString(" Resource Location: %1").arg(m_cfg.readEntry(KisResourceLocator::resourceLocationKey)));
109
110 KisUsageLogger::writeSysInfo(QString(" Use Win8 Pointer Input: %1").arg(useWin8PointerInput() ? "true" : "false"));
111 KisUsageLogger::writeSysInfo(QString(" Use RightMiddleTabletButton Workaround: %1").arg(useRightMiddleTabletButtonWorkaround() ? "true" : "false"));
112 KisUsageLogger::writeSysInfo(QString(" Levels of Detail Enabled: %1").arg(levelOfDetailEnabled() ? "true" : "false"));
113 KisUsageLogger::writeSysInfo(QString(" Use Zip64: %1").arg(useZip64() ? "true" : "false"));
114
116
117 // Tablet API information
118#if defined Q_OS_WIN && QT_VERSION > QT_VERSION_CHECK(6, 0, 0)
119{
120 auto tabletAPIName = [] (bool useWinTab) {
121 return useWinTab ? "WinTab" : "WinInk";
122 };
123
124 QString actualTabletProtocol = "<unknown>";
125
126 using QWindowsApplication = QNativeInterface::Private::QWindowsApplication;
127 if (auto nativeWindowsApp = dynamic_cast<QWindowsApplication *>(QGuiApplicationPrivate::platformIntegration())) {
128 actualTabletProtocol = tabletAPIName(nativeWindowsApp->isWinTabEnabled());
129 } else {
130 KisUsageLogger::log("WARNING: Failed to fetch WinTab protocol status: QWindowsApplication is not available");
131 }
132
133 KisUsageLogger::writeSysInfo("Tablet API Information\n");
134 KisUsageLogger::writeSysInfo(QString(" User-selected tablet API: %1").arg(tabletAPIName(!useWin8PointerInput())));
135 KisUsageLogger::writeSysInfo(QString(" Actually used tablet API: %1").arg(actualTabletProtocol));
137}
138#endif
139
140}
141
143{
144 if (defaultValue) {
145 return TOUCH_PAINTING_AUTO;
146 } else {
147 int value = m_cfg.readEntry("touchPainting", int(TOUCH_PAINTING_AUTO));
148 return TouchPainting(value);
149 }
150}
151
153{
154 m_cfg.writeEntry("touchPainting", int(value));
156}
157
159{
160 switch (touchPainting()) {
162 return false;
164 return true;
165 default:
166 // Automatic detection: enable or disable touch input based on whether
167 // we've received a tablet input during this session and therefore know
168 // that the user has a pen available.
170 }
171}
172
173bool KisConfig::useProjections(bool defaultValue) const
174{
175 return (defaultValue ? true : m_cfg.readEntry("useProjections", true));
176}
177
178void KisConfig::setUseProjections(bool useProj) const
179{
180 m_cfg.writeEntry("useProjections", useProj);
181}
182
183bool KisConfig::undoEnabled(bool defaultValue) const
184{
185 return (defaultValue ? true : m_cfg.readEntry("undoEnabled", true));
186}
187
188void KisConfig::setUndoEnabled(bool undo) const
189{
190 m_cfg.writeEntry("undoEnabled", undo);
191}
192
193int KisConfig::undoStackLimit(bool defaultValue) const
194{
195 return (defaultValue ? 200 : m_cfg.readEntry("undoStackLimit", 200));
196}
197
198void KisConfig::setUndoStackLimit(int limit) const
199{
200 m_cfg.writeEntry("undoStackLimit", limit);
201}
202
203bool KisConfig::useCumulativeUndoRedo(bool defaultValue) const
204{
205 return (defaultValue ? false : m_cfg.readEntry("useCumulativeUndoRedo",false));
206}
207
209{
210 m_cfg.writeEntry("useCumulativeUndoRedo", value);
211}
212
214{
215 if (defaultValue) {
217 }
218
220 data.read(&m_cfg);
221 return data;
222}
223
228
229qint32 KisConfig::defImageWidth(bool defaultValue) const
230{
231 return (defaultValue ? 2480 : m_cfg.readEntry("imageWidthDef", 2480));
232}
233
234qint32 KisConfig::defImageHeight(bool defaultValue) const
235{
236 return (defaultValue ? 3508 : m_cfg.readEntry("imageHeightDef", 3508));
237}
238
239qreal KisConfig::defImageResolution(bool defaultValue) const
240{
241 return (defaultValue ? 300.0 : m_cfg.readEntry("imageResolutionDef", 300.0)) / 72.0;
242}
243
244QString KisConfig::defColorModel(bool defaultValue) const
245{
246 return (defaultValue ? KoColorSpaceRegistry::instance()->rgb8()->colorModelId().id()
247 : m_cfg.readEntry("colorModelDef", KoColorSpaceRegistry::instance()->rgb8()->colorModelId().id()));
248}
249
250void KisConfig::defColorModel(const QString & model) const
251{
252 m_cfg.writeEntry("colorModelDef", model);
253}
254
255QString KisConfig::defaultColorDepth(bool defaultValue) const
256{
257 return (defaultValue ? KoColorSpaceRegistry::instance()->rgb8()->colorDepthId().id()
258 : m_cfg.readEntry("colorDepthDef", KoColorSpaceRegistry::instance()->rgb8()->colorDepthId().id()));
259}
260
261void KisConfig::setDefaultColorDepth(const QString & depth) const
262{
263 m_cfg.writeEntry("colorDepthDef", depth);
264}
265
266QString KisConfig::defColorProfile(bool defaultValue) const
267{
268 return (defaultValue ? KoColorSpaceRegistry::instance()->rgb8()->profile()->name() :
269 m_cfg.readEntry("colorProfileDef",
270 KoColorSpaceRegistry::instance()->rgb8()->profile()->name()));
271}
272
273void KisConfig::defColorProfile(const QString & profile) const
274{
275 m_cfg.writeEntry("colorProfileDef", profile);
276}
277
278void KisConfig::defImageWidth(qint32 width) const
279{
280 m_cfg.writeEntry("imageWidthDef", width);
281}
282
283void KisConfig::defImageHeight(qint32 height) const
284{
285 m_cfg.writeEntry("imageHeightDef", height);
286}
287
288void KisConfig::defImageResolution(qreal res) const
289{
290 m_cfg.writeEntry("imageResolutionDef", res*72.0);
291}
292
294{
295 return defaultValue ? 100.0 : m_cfg.readEntry("preferredVectorImportResolution", 100.0);
296}
297
299{
300 m_cfg.writeEntry("preferredVectorImportResolution", value);
301}
302
303bool KisConfig::useDefaultColorSpace(bool defaultvalue) const
304{
305 return (defaultvalue? false: m_cfg.readEntry("useDefaultColorSpace", false));
306}
307
309{
310 m_cfg.writeEntry("useDefaultColorSpace", value);
311}
312
313// brush cursor settings
314
315void cleanOldCursorStyleKeys(KConfigGroup &cfg)
316{
317 if (cfg.hasKey("newCursorStyle") &&
318 cfg.hasKey("newOutlineStyle")) {
319
320 cfg.deleteEntry("cursorStyleDef");
321 }
322}
323
325{
326 if (defaultValue) {
328 }
329
330
331 int style = m_cfg.readEntry("newCursorStyle", int(-1));
332
333 if (style < 0) {
334 // old style format
335 style = m_cfg.readEntry("cursorStyleDef", int(OLD_CURSOR_STYLE_OUTLINE));
336
337 switch (style) {
339 style = CURSOR_STYLE_TOOLICON;
340 break;
344 break;
346 style = CURSOR_STYLE_POINTER;
347 break;
351 break;
355 break;
359 break;
363 break;
364 default:
365 style = -1;
366 }
367 }
368
370
371 // compatibility with future versions
372 if (style < 0 || style >= N_CURSOR_STYLE_SIZE) {
374 }
375
376 return (CursorStyle) style;
377}
378
380{
381 m_cfg.writeEntry("newCursorStyle", (int)style);
382}
383
384QColor KisConfig::getCursorMainColor(bool defaultValue) const
385{
386 QColor col;
387 col.setRgbF(1.0, 0.0, 1.0);
388 return (defaultValue ? col : m_cfg.readEntry("cursorMaincColor", col));
389}
390
391void KisConfig::setCursorMainColor(const QColor &v) const
392{
393 m_cfg.writeEntry("cursorMaincColor", v);
394}
395
397{
398 if (defaultValue) {
399 return OUTLINE_FULL;
400 }
401
402 int style = m_cfg.readEntry("newOutlineStyle", int(-1));
403
404 if (style < 0) {
405 // old style format
406 style = m_cfg.readEntry("cursorStyleDef", int(OLD_CURSOR_STYLE_OUTLINE));
407
408 switch (style) {
416 style = OUTLINE_NONE;
417 break;
423 style = OUTLINE_FULL;
424 break;
425 default:
426 style = -1;
427 }
428 }
429
431
432 // compatibility with future versions
433 if (style < 0 || style >= N_OUTLINE_STYLE_SIZE) {
434 style = OUTLINE_FULL;
435 }
436
437 return (OutlineStyle) style;
438}
439
441{
442 m_cfg.writeEntry("newOutlineStyle", (int)style);
443}
444
446{
447 if (defaultValue) {
448 return OUTLINE_NONE;
449 }
450
451 int style = m_cfg.readEntry("lastUsedOutlineStyle", int(-1));
452
453 return (OutlineStyle) style;
454}
455
457{
458 m_cfg.writeEntry("lastUsedOutlineStyle", (int)style);
459}
460
461// eraser cursor settings
462
463bool KisConfig::separateEraserCursor(bool defaultValue) const
464{
465 return (defaultValue ? false : m_cfg.readEntry("separateEraserCursor", false));
466}
467
469{
470 m_cfg.writeEntry("separateEraserCursor", value);
471}
472
474{
475 if (defaultValue) {
476 return CURSOR_STYLE_ERASER;
477 }
478
479 int style = m_cfg.readEntry("eraserCursorStyle", int(-1));
480
481 // compatibility with future versions
482 if (style < 0 || style >= N_CURSOR_STYLE_SIZE) {
483 style = CURSOR_STYLE_ERASER;
484 }
485
486 return (CursorStyle) style;
487}
488
490{
491 m_cfg.writeEntry("eraserCursorStyle", (int)style);
492}
493
494QColor KisConfig::getEraserCursorMainColor(bool defaultValue) const
495{
496 QColor col;
497 col.setRgbF(0.501961, 1.0, 0.501961);
498 return (defaultValue ? col : m_cfg.readEntry("eraserCursorMaincColor", col));
499}
500
501void KisConfig::setEraserCursorMainColor(const QColor &v) const
502{
503 m_cfg.writeEntry("eraserCursorMaincColor", v);
504}
505
507{
508 if (defaultValue) {
509 return OUTLINE_FULL;
510 }
511
512 int style = m_cfg.readEntry("eraserOutlineStyle", int(-1));
513
514 // compatibility with future versions
515 if (style < 0 || style >= N_OUTLINE_STYLE_SIZE) {
516 style = OUTLINE_FULL;
517 }
518
519 return (OutlineStyle) style;
520}
521
523{
524 m_cfg.writeEntry("eraserOutlineStyle", (int)style);
525}
526
528{
529 if (!defaultValue) {
530 int style = m_cfg.readEntry("colorSamplerPreviewStyle", int(ColorSamplerPreviewStyle::Circle));
531 if (style >= 0 && style < int(ColorSamplerPreviewStyle::Count)) {
532 return ColorSamplerPreviewStyle(style);
533 }
534 }
536}
537
539{
540 m_cfg.writeEntry("colorSamplerPreviewStyle", int(style));
542}
543
545{
546 int def = 180;
547 if (!defaultValue) {
548 return m_cfg.readEntry("colorSamplerPreviewCircleDiameter", def);
549 }
550 return def;
551}
552
554{
555 m_cfg.writeEntry("colorSamplerPreviewCircleDiameter", diameter);
556}
557
559{
560 qreal def = 12; // percentage
561 if (!defaultValue) {
562 return m_cfg.readEntry("colorSamplerPreviewCircleThickness", def);
563 }
564 return def;
565}
566
568{
569 m_cfg.writeEntry("colorSamplerPreviewCircleThickness", thickness);
570}
571
573{
574 bool def = true;
575 if (!defaultValue) {
576 return m_cfg.readEntry("colorSamplerPreviewCircleOutlineEnabled", def);
577 }
578 return def;
579}
580
582{
583 m_cfg.writeEntry("colorSamplerPreviewCircleOutlineEnabled", enabled);
584}
585
587{
588 bool def = true;
589 if (!defaultValue) {
590 return m_cfg.readEntry("colorSamplerPreviewCircleExtraCirclesEnabled", def);
591 }
592 return def;
593}
594
596{
597 m_cfg.writeEntry("colorSamplerPreviewCircleExtraCirclesEnabled", enabled);
598}
599
600bool KisConfig::useDirtyPresets(bool defaultValue) const
601{
602 return (defaultValue ? false : m_cfg.readEntry("useDirtyPresets", true));
603}
605{
606 m_cfg.writeEntry("useDirtyPresets",value);
608}
609
610bool KisConfig::useEraserBrushSize(bool defaultValue) const
611{
612 return (defaultValue ? false : m_cfg.readEntry("useEraserBrushSize", false));
613}
614
616{
617 m_cfg.writeEntry("useEraserBrushSize",value);
619}
620
621bool KisConfig::useEraserBrushOpacity(bool defaultValue) const
622{
623 return (defaultValue ? false : m_cfg.readEntry("useEraserBrushOpacity",false));
624}
625
627{
628 m_cfg.writeEntry("useEraserBrushOpacity",value);
630}
631
632QPoint KisConfig::getDefaultGridSpacing(bool defaultValue) const
633{
634 return (defaultValue ? QPoint(16, 16) : m_cfg.readEntry("defaultGridSpacing", QPoint(16, 16)));
635}
636
637void KisConfig::setDefaultGridSpacing(QPoint gridSpacing)
638{
639 m_cfg.writeEntry("defaultGridSpacing", gridSpacing);
640}
641
642QString KisConfig::getMDIBackgroundColor(bool defaultValue) const
643{
644 QColor col(77, 77, 77);
646 kol.fromQColor(col);
647 QString xml = kol.toXML();
648 return (defaultValue ? xml : m_cfg.readEntry("mdiBackgroundColorXML", xml));
649}
650
651void KisConfig::setMDIBackgroundColor(const QString &v) const
652{
653 m_cfg.writeEntry("mdiBackgroundColorXML", v);
654}
655
656QString KisConfig::getMDIBackgroundImage(bool defaultValue) const
657{
658 return (defaultValue ? "" : m_cfg.readEntry("mdiBackgroundImage", ""));
659}
660
661void KisConfig::setMDIBackgroundImage(const QString &filename) const
662{
663 m_cfg.writeEntry("mdiBackgroundImage", filename);
664}
665
667{
668 return (defaultValue ? true : m_cfg.readEntry("enableCanvasSurfaceColorSpaceManagement",true));
669}
670
672{
673 m_cfg.writeEntry("enableCanvasSurfaceColorSpaceManagement", value);
674}
675
677 QString modeStr = defaultValue ? "preferred" : m_cfg.readEntry("canvasSurfaceColorSpaceManagementMode", "preferred");
678
679 if (modeStr == "preferred") {
681 } else if (modeStr == "rec709g22") {
683 } else if (modeStr == "rec709g10") {
685 } else if (modeStr == "rec2020pq") {
687 } else if (modeStr == "unmanaged") {
689 } else {
691 }
692}
693
695 QString modeStr;
696
697 switch (value) {
699 modeStr = "preferred";
700 break;
702 modeStr = "rec709g22";
703 break;
705 modeStr = "rec709g10";
706 break;
708 modeStr = "rec2020pq";
709 break;
711 modeStr = "unmanaged";
712 break;
713 }
714
715 m_cfg.writeEntry("canvasSurfaceColorSpaceManagementMode", modeStr);
716}
717
718
720{
721 QString modeStr = defaultValue ? "auto" : settings->value("canvasSurfaceBitDepthMode", "auto").toString();
722
723 if (modeStr == "auto") {
725 } else if (modeStr == "8bit") {
727 } else if (modeStr == "10bit") {
729 }
730
732}
733
735{
736 QString modeStr;
737
738 switch (value) {
740 modeStr = "auto";
741 break;
743 modeStr = "8bit";
744 break;
746 modeStr = "10bit";
747 break;
748 }
749
750 settings->setValue("canvasSurfaceBitDepthMode", modeStr);
751}
752
754{
755 const QString configPath = QStandardPaths::writableLocation(QStandardPaths::GenericConfigLocation);
756 QSettings kritarc(configPath + QStringLiteral("/kritadisplayrc"), QSettings::IniFormat);
757 return canvasSurfaceBitDepthMode(&kritarc, defaultValue);
758}
759
761{
762 const QString configPath = QStandardPaths::writableLocation(QStandardPaths::GenericConfigLocation);
763 QSettings kritarc(configPath + QStringLiteral("/kritadisplayrc"), QSettings::IniFormat);
765}
766
768{
769 auto mode = canvasSurfaceBitDepthMode();
770
772 if (format.redBufferSize() == 10 &&
773 format.greenBufferSize() == 10 &&
774 format.blueBufferSize() == 10) {
775
777 } else {
779 }
780 }
781
782 return mode;
783}
784
785
786QString KisConfig::monitorProfile(int screen) const
787{
788 // Note: keep this in sync with the default profile for the RGB colorspaces!
789 const QString defaultProfile = "sRGB-elle-V2-srgbtrc.icc";
790
791 QString profile;
792 const QString screenIdentifier = getScreenStringIdentfier(screen);
793 const QString screenIdentifierKey = "monitorProfile" + screenIdentifier;
794
800 if (!screenIdentifier.isEmpty() && m_cfg.hasKey(screenIdentifierKey)) {
801 profile = m_cfg.readEntry(screenIdentifierKey, defaultProfile);
802 } else {
803 profile = m_cfg.readEntry("monitorProfile" + QString(screen == 0 ? "": QString("_%1").arg(screen)), defaultProfile);
804 }
805
806 //dbgKrita << "KisConfig::monitorProfile()" << profile;
807 return profile;
808}
809
810QString KisConfig::monitorForScreen(int screen, const QString &defaultMonitor, bool defaultValue) const
811{
812 return (defaultValue ? defaultMonitor
813 : m_cfg.readEntry(QString("monitor_for_screen_%1").arg(screen), defaultMonitor));
814}
815
816void KisConfig::setMonitorForScreen(int screen, const QString& monitor)
817{
818 m_cfg.writeEntry(QString("monitor_for_screen_%1").arg(screen), monitor);
819}
820
821void KisConfig::setMonitorProfile(int screen, const QString & monitorProfile, bool override) const
822{
823 m_cfg.writeEntry("monitorProfile/OverrideX11", override);
824 m_cfg.writeEntry("monitorProfile" + QString(screen == 0 ? "": QString("_%1").arg(screen)), monitorProfile);
825 if (!getScreenStringIdentfier(screen).isEmpty()) {
826 m_cfg.writeEntry("monitorProfile" + getScreenStringIdentfier(screen), monitorProfile);
827 }
828}
829
830// TODO: rename into getSystemScreenProfile
832{
833 if (screen < 0) return 0;
834
835 KisConfig cfg(true);
836 QString monitorId;
837 if (KisColorManager::instance()->devices().size() > screen) {
838 monitorId = cfg.monitorForScreen(screen, KisColorManager::instance()->devices()[screen]);
839 }
840 //dbgKrita << "getScreenProfile(). Screen" << screen << "monitor id" << monitorId;
841
842 if (monitorId.isEmpty()) {
843 return 0;
844 }
845
846 QByteArray bytes = KisColorManager::instance()->displayProfile(monitorId);
847
848 //dbgKrita << "\tgetScreenProfile()" << bytes.size();
849 const KoColorProfile * profile = 0;
850 if (bytes.length() > 0) {
852 //dbgKrita << "\tKisConfig::getScreenProfile for screen" << screen << profile->name();
853 }
854 return profile;
855}
856
858{
859 if (screen < 0) return 0;
860
861 // if the user plays with the settings, they can override the display profile, in which case
862 // we don't want the system setting.
863 bool override = useSystemMonitorProfile();
864 //dbgKrita << "KisConfig::displayProfile(). Override X11:" << override;
865 const KoColorProfile *profile = 0;
866 if (override) {
867 //dbgKrita << "\tGoing to get the screen profile";
868 profile = KisConfig::getScreenProfile(screen);
869 }
870
871 // if it fails. check the configuration
872 if (!profile || !profile->isSuitableForDisplay()) {
873 //dbgKrita << "\tGoing to get the monitor profile";
874 QString monitorProfileName = monitorProfile(screen);
875 //dbgKrita << "\t\tmonitorProfileName:" << monitorProfileName;
876 if (!monitorProfileName.isEmpty()) {
877 profile = KoColorSpaceRegistry::instance()->profileByName(monitorProfileName);
878 }
879 if (profile) {
880 //dbgKrita << "\t\tsuitable for display" << profile->isSuitableForDisplay();
881 }
882 else {
883 //dbgKrita << "\t\tstill no profile";
884 }
885 }
886 // if we still don't have a profile, or the profile isn't suitable for display,
887 // we need to get a last-resort profile. the built-in sRGB is a good choice then.
888 if (!profile || !profile->isSuitableForDisplay()) {
889 //dbgKrita << "\tnothing worked, going to get sRGB built-in";
890 profile = KoColorSpaceRegistry::instance()->profileByName("sRGB Built-in");
891 }
892
893 if (profile) {
894 //dbgKrita << "\tKisConfig::displayProfile for screen" << screen << "is" << profile->name();
895 }
896 else {
897 //dbgKrita << "\tCouldn't get a display profile at all";
898 }
899
900 return profile;
901}
902
903const QString KisConfig::getScreenStringIdentfier(int screenNo) const {
904 if (screenNo < 0 || screenNo >= QGuiApplication::screens().length()) {
905 return QString();
906 }
907 QScreen* screen = QGuiApplication::screens()[screenNo];
908
909 QString manufacturer = screen->manufacturer();
910 QString model = screen->model();
911 QString serialNumber = screen->serialNumber();
912
913 if (manufacturer == "" && model == "" && serialNumber == "") {
914 return QString(); // it would be scary to base the profile just on resolution
915 }
916
917 QString identifier = QStringList({manufacturer, model, serialNumber}).join("_");
918 return identifier;
919}
920
921QString KisConfig::workingColorSpace(bool defaultValue) const
922{
923 return (defaultValue ? "RGBA" : m_cfg.readEntry("workingColorSpace", "RGBA"));
924}
925
926void KisConfig::setWorkingColorSpace(const QString & workingColorSpace) const
927{
928 m_cfg.writeEntry("workingColorSpace", workingColorSpace);
929}
930
931QString KisConfig::printerColorSpace(bool /*defaultValue*/) const
932{
933 //TODO currently only rgb8 is supported
934 //return (defaultValue ? "RGBA" : m_cfg.readEntry("printerColorSpace", "RGBA"));
935 return QString("RGBA");
936}
937
938void KisConfig::setPrinterColorSpace(const QString & printerColorSpace) const
939{
940 m_cfg.writeEntry("printerColorSpace", printerColorSpace);
941}
942
943
944QString KisConfig::printerProfile(bool defaultValue) const
945{
946 return (defaultValue ? "" : m_cfg.readEntry("printerProfile", ""));
947}
948
949void KisConfig::setPrinterProfile(const QString & printerProfile) const
950{
951 m_cfg.writeEntry("printerProfile", printerProfile);
952}
953
954
955bool KisConfig::useBlackPointCompensation(bool defaultValue) const
956{
957 return (defaultValue ? true : m_cfg.readEntry("useBlackPointCompensation", true));
958}
959
960void KisConfig::setUseBlackPointCompensation(bool useBlackPointCompensation) const
961{
962 m_cfg.writeEntry("useBlackPointCompensation", useBlackPointCompensation);
963}
964
965bool KisConfig::allowLCMSOptimization(bool defaultValue) const
966{
967 return (defaultValue ? true : m_cfg.readEntry("allowLCMSOptimization", true));
968}
969
970void KisConfig::setAllowLCMSOptimization(bool allowLCMSOptimization)
971{
972 m_cfg.writeEntry("allowLCMSOptimization", allowLCMSOptimization);
973}
974
975bool KisConfig::forcePaletteColors(bool defaultValue) const
976{
977 return (defaultValue ? false : m_cfg.readEntry("colorsettings/forcepalettecolors", false));
978}
979
980void KisConfig::setForcePaletteColors(bool forcePaletteColors)
981{
982 m_cfg.writeEntry("colorsettings/forcepalettecolors", forcePaletteColors);
983}
984
985bool KisConfig::colorHistoryPerDocument(bool defaultValue) const
986{
987 KConfigGroup cfg = KSharedConfig::openConfig()->group("advancedColorSelector");
988 return (defaultValue ? false : cfg.readEntry("lastUsedColorsPerDocument", false));
989}
990
991bool KisConfig::showRulers(bool defaultValue) const
992{
993 return (defaultValue ? false : m_cfg.readEntry("showrulers", false));
994}
995
996void KisConfig::setShowRulers(bool rulers) const
997{
998 m_cfg.writeEntry("showrulers", rulers);
999}
1000
1001bool KisConfig::forceShowSaveMessages(bool defaultValue) const
1002{
1003 return (defaultValue ? false : m_cfg.readEntry("forceShowSaveMessages", false));
1004}
1005
1007{
1008 m_cfg.writeEntry("forceShowSaveMessages", value);
1009}
1010
1011bool KisConfig::forceShowAutosaveMessages(bool defaultValue) const
1012{
1013 return (defaultValue ? false : m_cfg.readEntry("forceShowAutosaveMessages", false));
1014}
1015
1017{
1018 m_cfg.writeEntry("forceShowAutosaveMessages", value);
1019}
1020
1021bool KisConfig::rulersTrackMouse(bool defaultValue) const
1022{
1023 return (defaultValue ? true : m_cfg.readEntry("rulersTrackMouse", true));
1024}
1025
1027{
1028 m_cfg.writeEntry("rulersTrackMouse", value);
1029}
1030
1031qint32 KisConfig::pasteBehaviour(bool defaultValue) const
1032{
1033 return (defaultValue ? 2 : m_cfg.readEntry("pasteBehaviour", 2));
1034}
1035
1036void KisConfig::setPasteBehaviour(qint32 renderIntent) const
1037{
1038 m_cfg.writeEntry("pasteBehaviour", renderIntent);
1039}
1040
1041qint32 KisConfig::pasteFormat(bool defaultValue) const
1042{
1043 return defaultValue ? 0 : m_cfg.readEntry("pasteFormat", 0);
1044}
1045
1046void KisConfig::setPasteFormat(qint32 format)
1047{
1048 m_cfg.writeEntry("pasteFormat", format);
1049}
1050
1051qint32 KisConfig::monitorRenderIntent(bool defaultValue) const
1052{
1053 qint32 intent = m_cfg.readEntry("renderIntent", INTENT_PERCEPTUAL);
1054 if (intent > 3) intent = 3;
1055 if (intent < 0) intent = 0;
1056 return (defaultValue ? INTENT_PERCEPTUAL : intent);
1057}
1058
1059void KisConfig::setRenderIntent(qint32 renderIntent) const
1060{
1061 if (renderIntent > 3) renderIntent = 3;
1062 if (renderIntent < 0) renderIntent = 0;
1063 m_cfg.writeEntry("renderIntent", renderIntent);
1064}
1065
1066bool KisConfig::useOpenGL(bool defaultValue) const
1067{
1068 if (defaultValue) {
1069 return true;
1070 }
1071
1072 const QString configPath = QStandardPaths::writableLocation(QStandardPaths::GenericConfigLocation);
1073 QSettings kritarc(configPath + QStringLiteral("/kritadisplayrc"), QSettings::IniFormat);
1074
1075 return kritarc.value("OpenGLRenderer", "auto").toString() != "none";
1076}
1077
1079{
1080 const QString configPath = QStandardPaths::writableLocation(QStandardPaths::GenericConfigLocation);
1081 QSettings kritarc(configPath + QStringLiteral("/kritadisplayrc"), QSettings::IniFormat);
1082
1083 kritarc.setValue("OpenGLRenderer", "none");
1084}
1085
1086int KisConfig::openGLFilteringMode(bool defaultValue) const
1087{
1088 return (defaultValue ? 3 : m_cfg.readEntry("OpenGLFilterMode", 3));
1089}
1090
1092{
1093 m_cfg.writeEntry("OpenGLFilterMode", filteringMode);
1094}
1095
1097{
1098 m_cfg.writeEntry("widgetStyle", name);
1099}
1100
1101QString KisConfig::widgetStyle(bool defaultValue)
1102{
1103 return (defaultValue ? "" : m_cfg.readEntry("widgetStyle", ""));
1104}
1105
1106bool KisConfig::useOpenGLTextureBuffer(bool defaultValue) const
1107{
1108 return (defaultValue ? true : m_cfg.readEntry("useOpenGLTextureBuffer", true));
1109}
1110
1112{
1113 m_cfg.writeEntry("useOpenGLTextureBuffer", useBuffer);
1114}
1115
1116bool KisConfig::preferXcbEglProvider(const QSettings *settings, bool defaultValue)
1117{
1118 return (defaultValue ? false : settings->value("preferXcbEglProvider", false).toBool());
1119}
1120
1121bool KisConfig::preferXcbEglProvider(bool defaultValue) const
1122{
1123 const QString configPath = QStandardPaths::writableLocation(QStandardPaths::GenericConfigLocation);
1124 QSettings kritarc(configPath + QStringLiteral("/kritadisplayrc"), QSettings::IniFormat);
1125 return preferXcbEglProvider(&kritarc, defaultValue);
1126}
1127
1129{
1130 const QString configPath = QStandardPaths::writableLocation(QStandardPaths::GenericConfigLocation);
1131 QSettings kritarc(configPath + QStringLiteral("/kritadisplayrc"), QSettings::IniFormat);
1132 kritarc.setValue("preferXcbEglProvider", value);
1133}
1134
1135int KisConfig::openGLTextureSize(bool defaultValue) const
1136{
1137 return (defaultValue ? 256 : m_cfg.readEntry("textureSize", 256));
1138}
1139
1140bool KisConfig::forceOpenGLFenceWorkaround(bool defaultValue) const
1141{
1142 return (defaultValue ? false : m_cfg.readEntry("forceOpenGLFenceWorkaround", false));
1143}
1144
1145int KisConfig::numMipmapLevels(bool defaultValue) const
1146{
1147 return (defaultValue ? 4 : m_cfg.readEntry("numMipmapLevels", 4));
1148}
1149
1151{
1152 return 1 << qMax(0, numMipmapLevels());
1153}
1154
1155quint32 KisConfig::getGridMainStyle(bool defaultValue) const
1156{
1157 int v = m_cfg.readEntry("gridmainstyle", 0);
1158 v = qBound(0, v, 2);
1159 return (defaultValue ? 0 : v);
1160}
1161
1163{
1164 m_cfg.writeEntry("gridmainstyle", v);
1165}
1166
1167quint32 KisConfig::getGridSubdivisionStyle(bool defaultValue) const
1168{
1169 quint32 v = m_cfg.readEntry("gridsubdivisionstyle", 1);
1170 if (v > 2) v = 2;
1171 return (defaultValue ? 1 : v);
1172}
1173
1175{
1176 m_cfg.writeEntry("gridsubdivisionstyle", v);
1177}
1178
1179quint32 KisConfig::getGridIsoVerticalStyle(bool defaultValue) const
1180{
1181 int v = m_cfg.readEntry("gridisoverticalstyle", 0);
1182 v = qBound(0, v, 3);
1183 return (defaultValue ? 0 : v);
1184}
1185
1187{
1188 m_cfg.writeEntry("gridisoverticalstyle", v);
1189}
1190
1191QColor KisConfig::getGridMainColor(bool defaultValue) const
1192{
1193 QColor col(99, 99, 99);
1194 return (defaultValue ? col : m_cfg.readEntry("gridmaincolor", col));
1195}
1196
1197void KisConfig::setGridMainColor(const QColor & v) const
1198{
1199 m_cfg.writeEntry("gridmaincolor", v);
1200}
1201
1202QColor KisConfig::getGridSubdivisionColor(bool defaultValue) const
1203{
1204 QColor col(150, 150, 150);
1205 return (defaultValue ? col : m_cfg.readEntry("gridsubdivisioncolor", col));
1206}
1207
1208void KisConfig::setGridSubdivisionColor(const QColor & v) const
1209{
1210 m_cfg.writeEntry("gridsubdivisioncolor", v);
1211}
1212
1213QColor KisConfig::getGridIsoVerticalColor(bool defaultValue) const
1214{
1215 QColor col(150, 150, 150);
1216 return (defaultValue ? col : m_cfg.readEntry("gridisoverticalcolor", col));
1217}
1218
1219void KisConfig::setGridIsoVerticalColor(const QColor & v) const
1220{
1221 m_cfg.writeEntry("gridisoverticalcolor", v);
1222}
1223
1224QColor KisConfig::getPixelGridColor(bool defaultValue) const
1225{
1226 QColor col(255, 255, 255);
1227 return (defaultValue ? col : m_cfg.readEntry("pixelGridColor", col));
1228}
1229
1230void KisConfig::setPixelGridColor(const QColor & v) const
1231{
1232 m_cfg.writeEntry("pixelGridColor", v);
1233}
1234
1235qreal KisConfig::getPixelGridDrawingThreshold(bool defaultValue) const
1236{
1237 qreal border = 24.0f;
1238 return (defaultValue ? border : m_cfg.readEntry("pixelGridDrawingThreshold", border));
1239}
1240
1242{
1243 m_cfg.writeEntry("pixelGridDrawingThreshold", v);
1244}
1245
1246bool KisConfig::pixelGridEnabled(bool defaultValue) const
1247{
1248 bool enabled = true;
1249 return (defaultValue ? enabled : m_cfg.readEntry("pixelGridEnabled", enabled));
1250}
1251
1253{
1254 m_cfg.writeEntry("pixelGridEnabled", v);
1255}
1256
1257quint32 KisConfig::guidesLineStyle(bool defaultValue) const
1258{
1259 int v = m_cfg.readEntry("guidesLineStyle", 0);
1260 v = qBound(0, v, 2);
1261 return (defaultValue ? 0 : v);
1262}
1263
1265{
1266 m_cfg.writeEntry("guidesLineStyle", v);
1267}
1268
1269QColor KisConfig::guidesColor(bool defaultValue) const
1270{
1271 QColor col(99, 99, 99);
1272 return (defaultValue ? col : m_cfg.readEntry("guidesColor", col));
1273}
1274
1275void KisConfig::setGuidesColor(const QColor & v) const
1276{
1277 m_cfg.writeEntry("guidesColor", v);
1278}
1279
1280void KisConfig::loadSnapConfig(KisSnapConfig *config, bool defaultValue) const
1281{
1282 KisSnapConfig defaultConfig(false);
1283
1284 if (defaultValue) {
1285 *config = defaultConfig;
1286 return;
1287 }
1288
1289 config->setOrthogonal(m_cfg.readEntry("globalSnapOrthogonal", defaultConfig.orthogonal()));
1290 config->setNode(m_cfg.readEntry("globalSnapNode", defaultConfig.node()));
1291 config->setExtension(m_cfg.readEntry("globalSnapExtension", defaultConfig.extension()));
1292 config->setIntersection(m_cfg.readEntry("globalSnapIntersection", defaultConfig.intersection()));
1293 config->setBoundingBox(m_cfg.readEntry("globalSnapBoundingBox", defaultConfig.boundingBox()));
1294 config->setImageBounds(m_cfg.readEntry("globalSnapImageBounds", defaultConfig.imageBounds()));
1295 config->setImageCenter(m_cfg.readEntry("globalSnapImageCenter", defaultConfig.imageCenter()));
1296 config->setToPixel(m_cfg.readEntry("globalSnapToPixel", defaultConfig.toPixel()));
1297}
1298
1300{
1301 m_cfg.writeEntry("globalSnapOrthogonal", config.orthogonal());
1302 m_cfg.writeEntry("globalSnapNode", config.node());
1303 m_cfg.writeEntry("globalSnapExtension", config.extension());
1304 m_cfg.writeEntry("globalSnapIntersection", config.intersection());
1305 m_cfg.writeEntry("globalSnapBoundingBox", config.boundingBox());
1306 m_cfg.writeEntry("globalSnapImageBounds", config.imageBounds());
1307 m_cfg.writeEntry("globalSnapImageCenter", config.imageCenter());
1308 m_cfg.writeEntry("globalSnapToPixel", config.toPixel());
1309}
1310
1311qint32 KisConfig::checkSize(bool defaultValue) const
1312{
1313 qint32 size = (defaultValue ? 32 : m_cfg.readEntry("checksize", 32));
1314 if (size == 0) size = 32;
1315 return size;
1316}
1317
1318void KisConfig::setCheckSize(qint32 checksize) const
1319{
1320 if (checksize == 0) {
1321 checksize = 32;
1322 }
1323 m_cfg.writeEntry("checksize", checksize);
1324}
1325
1326bool KisConfig::scrollCheckers(bool defaultValue) const
1327{
1328 return (defaultValue ? false : m_cfg.readEntry("scrollingcheckers", false));
1329}
1330
1332{
1333 m_cfg.writeEntry("scrollingcheckers", sc);
1334}
1335
1336QColor KisConfig::canvasBorderColor(bool defaultValue) const
1337{
1338 QColor color(QColor(128,128,128));
1339 return (defaultValue ? color : m_cfg.readEntry("canvasBorderColor", color));
1340}
1341
1342void KisConfig::setCanvasBorderColor(const QColor& color) const
1343{
1344 m_cfg.writeEntry("canvasBorderColor", color);
1345}
1346
1347bool KisConfig::hideScrollbars(bool defaultValue) const
1348{
1349 return (defaultValue ? false : m_cfg.readEntry("hideScrollbars", false));
1350}
1351
1353{
1354 m_cfg.writeEntry("hideScrollbars", value);
1355}
1356
1357bool KisConfig::scrollbarZoomEnabled(bool defaultValue) const
1358{
1359 return (defaultValue ? true : m_cfg.readEntry("scrollbarZoomEnabled", true));
1360}
1361
1363{
1364 m_cfg.writeEntry("scrollbarZoomEnabled", enabled);
1365}
1366
1367QColor KisConfig::checkersColor1(bool defaultValue) const
1368{
1369 QColor col(220, 220, 220);
1370 return (defaultValue ? col : m_cfg.readEntry("checkerscolor", col));
1371}
1372
1373void KisConfig::setCheckersColor1(const QColor & v) const
1374{
1375 m_cfg.writeEntry("checkerscolor", v);
1376}
1377
1378QColor KisConfig::checkersColor2(bool defaultValue) const
1379{
1380 return (defaultValue ? QColor(Qt::white) : m_cfg.readEntry("checkerscolor2", QColor(Qt::white)));
1381}
1382
1383void KisConfig::setCheckersColor2(const QColor & v) const
1384{
1385 m_cfg.writeEntry("checkerscolor2", v);
1386}
1387
1388bool KisConfig::antialiasCurves(bool defaultValue) const
1389{
1390 return (defaultValue ? true : m_cfg.readEntry("antialiascurves", true));
1391}
1392
1394{
1395 m_cfg.writeEntry("antialiascurves", v);
1396}
1397
1398bool KisConfig::antialiasSelectionOutline(bool defaultValue) const
1399{
1400 return (defaultValue ? false : m_cfg.readEntry("AntialiasSelectionOutline", false));
1401}
1402
1404{
1405 m_cfg.writeEntry("AntialiasSelectionOutline", v);
1406}
1407
1408bool KisConfig::showRootLayer(bool defaultValue) const
1409{
1410 return (defaultValue ? false : m_cfg.readEntry("ShowRootLayer", false));
1411}
1412
1413void KisConfig::setShowRootLayer(bool showRootLayer) const
1414{
1415 m_cfg.writeEntry("ShowRootLayer", showRootLayer);
1416}
1417
1418bool KisConfig::showGlobalSelection(bool defaultValue) const
1419{
1420 return (defaultValue ? false : m_cfg.readEntry("ShowGlobalSelection", false));
1421}
1422
1423void KisConfig::setShowGlobalSelection(bool showGlobalSelection) const
1424{
1425 m_cfg.writeEntry("ShowGlobalSelection", showGlobalSelection);
1426}
1427
1428// brush outline settings
1429
1430bool KisConfig::showOutlineWhilePainting(bool defaultValue) const
1431{
1432 return (defaultValue ? true : m_cfg.readEntry("ShowOutlineWhilePainting", true));
1433}
1434
1435void KisConfig::setShowOutlineWhilePainting(bool showOutlineWhilePainting) const
1436{
1437 m_cfg.writeEntry("ShowOutlineWhilePainting", showOutlineWhilePainting);
1438}
1439
1440bool KisConfig::forceAlwaysFullSizedOutline(bool defaultValue) const
1441{
1442 return (defaultValue ? false : m_cfg.readEntry("forceAlwaysFullSizedOutline", false));
1443}
1444
1446{
1447 m_cfg.writeEntry("forceAlwaysFullSizedOutline", value);
1448}
1449
1450// eraser outline settings
1451
1453{
1454 return (defaultValue ? true : m_cfg.readEntry("ShowEraserOutlineWhilePainting", true));
1455}
1456
1457void KisConfig::setShowEraserOutlineWhilePainting(bool showEraserOutlineWhilePainting) const
1458{
1459 m_cfg.writeEntry("ShowEraserOutlineWhilePainting", showEraserOutlineWhilePainting);
1460}
1461
1463{
1464 return (defaultValue ? false : m_cfg.readEntry("forceAlwaysFullSizedEraserOutline", false));
1465}
1466
1468{
1469 m_cfg.writeEntry("forceAlwaysFullSizedEraserOutline", value);
1470}
1471
1473{
1474 int value = defaultValue ? SOS_BlankSession : m_cfg.readEntry("sessionOnStartup", (int)SOS_BlankSession);
1476}
1478{
1479 m_cfg.writeEntry("sessionOnStartup", (int)value);
1480}
1481
1482bool KisConfig::saveSessionOnQuit(bool defaultValue) const
1483{
1484 return defaultValue ? false : m_cfg.readEntry("saveSessionOnQuit", false);
1485}
1487{
1488 m_cfg.writeEntry("saveSessionOnQuit", value);
1489}
1490
1491bool KisConfig::hideDevFundBanner(bool defaultValue) const
1492{
1493 return defaultValue ? false : m_cfg.readEntry("hideDevFundBanner", false);
1494}
1495
1497{
1498 m_cfg.writeEntry("hideDevFundBanner", value);
1499}
1500
1501qreal KisConfig::outlineSizeMinimum(bool defaultValue) const
1502{
1503 return (defaultValue ? 1.0 : m_cfg.readEntry("OutlineSizeMinimum", 1.0));
1504}
1505
1506void KisConfig::setOutlineSizeMinimum(qreal outlineSizeMinimum) const
1507{
1508 m_cfg.writeEntry("OutlineSizeMinimum", outlineSizeMinimum);
1509}
1510
1511qreal KisConfig::selectionViewSizeMinimum(bool defaultValue) const
1512{
1513 return (defaultValue ? 5.0 : m_cfg.readEntry("SelectionViewSizeMinimum", 5.0));
1514}
1515
1516void KisConfig::setSelectionViewSizeMinimum(qreal outlineSizeMinimum) const
1517{
1518 m_cfg.writeEntry("SelectionViewSizeMinimum", outlineSizeMinimum);
1519}
1520
1521int KisConfig::autoSaveInterval(bool defaultValue) const
1522{
1523 int def = 7 * 60;
1524 return (defaultValue ? def : m_cfg.readEntry("AutoSaveInterval", def));
1525}
1526
1527void KisConfig::setAutoSaveInterval(int seconds) const
1528{
1529 return m_cfg.writeEntry("AutoSaveInterval", seconds);
1530}
1531
1532bool KisConfig::backupFile(bool defaultValue) const
1533{
1534 return (defaultValue ? true : m_cfg.readEntry("CreateBackupFile", true));
1535}
1536
1537void KisConfig::setBackupFile(bool backupFile) const
1538{
1539 m_cfg.writeEntry("CreateBackupFile", backupFile);
1540}
1541
1542bool KisConfig::showFilterGallery(bool defaultValue) const
1543{
1544 return (defaultValue ? false : m_cfg.readEntry("showFilterGallery", false));
1545}
1546
1547void KisConfig::setShowFilterGallery(bool showFilterGallery) const
1548{
1549 m_cfg.writeEntry("showFilterGallery", showFilterGallery);
1550}
1551
1553{
1554 return (defaultValue ? true : m_cfg.readEntry("showFilterGalleryLayerMaskDialog", true));
1555}
1556
1557void KisConfig::setShowFilterGalleryLayerMaskDialog(bool showFilterGallery) const
1558{
1559 m_cfg.writeEntry("setShowFilterGalleryLayerMaskDialog", showFilterGallery);
1560}
1561
1562QString KisConfig::canvasState(bool defaultValue) const
1563{
1564 const QString configPath = QStandardPaths::writableLocation(QStandardPaths::GenericConfigLocation);
1565 QSettings kritarc(configPath + QStringLiteral("/kritadisplayrc"), QSettings::IniFormat);
1566 return (defaultValue ? "OPENGL_NOT_TRIED" : kritarc.value("canvasState", "OPENGL_NOT_TRIED").toString());
1567}
1568
1569void KisConfig::setCanvasState(const QString& state) const
1570{
1571 static QStringList acceptableStates;
1572 if (acceptableStates.isEmpty()) {
1573 acceptableStates << "OPENGL_SUCCESS" << "TRY_OPENGL" << "OPENGL_NOT_TRIED" << "OPENGL_FAILED";
1574 }
1575 if (acceptableStates.contains(state)) {
1576 const QString configPath = QStandardPaths::writableLocation(QStandardPaths::GenericConfigLocation);
1577 QSettings kritarc(configPath + QStringLiteral("/kritadisplayrc"), QSettings::IniFormat);
1578 kritarc.setValue("canvasState", state);
1579 }
1580}
1581
1582bool KisConfig::toolOptionsPopupDetached(bool defaultValue) const
1583{
1584 return (defaultValue ? false : m_cfg.readEntry("ToolOptionsPopupDetached", false));
1585}
1586
1588{
1589 m_cfg.writeEntry("ToolOptionsPopupDetached", detached);
1590}
1591
1592
1593bool KisConfig::paintopPopupDetached(bool defaultValue) const
1594{
1595 return (defaultValue ? true : m_cfg.readEntry("PaintopPopupDetached", true));
1596}
1597
1598void KisConfig::setPaintopPopupDetached(bool detached) const
1599{
1600 m_cfg.writeEntry("PaintopPopupDetached", detached);
1601}
1602
1603QString KisConfig::pressureTabletCurve(bool defaultValue) const
1604{
1605 QString fallback = DEFAULT_CURVE_STRING;
1606#ifdef Q_OS_ANDROID
1607 // Xiaomi styluses need superhuman strength to reach full input pressure.
1608 // We use a much steeper default pressure curve for them by default that
1609 // effectively caps out at 70% pressure to make it at least bearable. A
1610 // note for a possible future: Apple styluses have an even greater range,
1611 // so if we somehow end up on iPads, we'll probably need to make those cap
1612 // out at 50% pressure at most something like: "0,0;0.5,1.0;"
1614 fallback = QStringLiteral("0,0;0.7,1;");
1615 }
1616#endif
1617 return (defaultValue ? fallback : m_cfg.readEntry("tabletPressureCurve", fallback));
1618}
1619
1620void KisConfig::setPressureTabletCurve(const QString& curveString) const
1621{
1622 m_cfg.writeEntry("tabletPressureCurve", curveString);
1623}
1624
1625bool KisConfig::useWin8PointerInput(bool defaultValue) const
1626{
1627#ifdef Q_OS_WIN
1628 const QString configPath = QStandardPaths::writableLocation(QStandardPaths::GenericConfigLocation);
1629 QSettings kritarc(configPath + QStringLiteral("/kritadisplayrc"), QSettings::IniFormat);
1630
1631 return useWin8PointerInputNoApp(&kritarc, defaultValue);
1632#else
1633 Q_UNUSED(defaultValue);
1634 return false;
1635#endif
1636}
1637
1639{
1640#ifdef Q_OS_WIN
1641
1642 // Special handling: Only set value if changed
1643 // I don't want it to be set if the user hasn't touched it
1644 if (useWin8PointerInput() != value) {
1645 const QString configPath = QStandardPaths::writableLocation(QStandardPaths::GenericConfigLocation);
1646 QSettings kritarc(configPath + QStringLiteral("/kritadisplayrc"), QSettings::IniFormat);
1648 }
1649
1650#else
1651 Q_UNUSED(value);
1652#endif
1653}
1654
1655bool KisConfig::useWin8PointerInputNoApp(QSettings *settings, bool defaultValue)
1656{
1657 return defaultValue ? false : settings->value("useWin8PointerInput", false).toBool();
1658}
1659
1660void KisConfig::setUseWin8PointerInputNoApp(QSettings *settings, bool value)
1661{
1662 settings->setValue("useWin8PointerInput", value);
1663}
1664
1666{
1667 return (defaultValue ? false : m_cfg.readEntry("useRightMiddleTabletButtonWorkaround", false));
1668}
1669
1671{
1672 m_cfg.writeEntry("useRightMiddleTabletButtonWorkaround", value);
1673}
1674
1675#ifdef Q_OS_ANDROID
1676bool KisConfig::usePageUpDownMouseButtonEmulationWorkaround(bool defaultValue) const
1677{
1679 if (defaultValue) {
1680 return fallback;
1681 } else {
1682 return m_cfg.readEntry("usePageUpDownMouseButtonEmulationWorkaround", fallback);
1683 }
1684}
1685
1686void KisConfig::setUsePageUpDownMouseButtonEmulationWorkaround(bool value)
1687{
1688 m_cfg.writeEntry("usePageUpDownMouseButtonEmulationWorkaround", value);
1689 KisConfigNotifier::instance()->notifyUsePageUpDownMouseButtonEmulationWorkaroundChanged(value);
1690}
1691
1692bool KisConfig::useHighFunctionKeyMouseButtonEmulationWorkaround(bool defaultValue) const
1693{
1694 // This hack is only relevant for OnePlus devices (as far as we know), but
1695 // it only affects the F21 key, which isn't something a creature of flesh
1696 // and blood would regularly input. So it'll be fine to just enable this b
1697 // default rather than bothering to detect the tablet brand or something.
1698 if (defaultValue) {
1699 return true;
1700 } else {
1701 return m_cfg.readEntry("useHighFunctionKeyMouseButtonEmulationWorkaround", true);
1702 }
1703}
1704
1705void KisConfig::setUseHighFunctionKeyMouseButtonEmulationWorkaround(bool value)
1706{
1707 m_cfg.writeEntry("useHighFunctionKeyMouseButtonEmulationWorkaround", value);
1708 KisConfigNotifier::instance()->notifyUseHighFunctionKeyMouseButtonEmulationWorkaroundChanged(value);
1709}
1710
1711bool KisConfig::useIgnoreHistoricTabletEventsWorkaround(bool defaultValue) const
1712{
1714 if (defaultValue) {
1715 return fallback;
1716 } else {
1717 return m_cfg.readEntry("useIgnoreHistoricTabletEventsWorkaround", fallback);
1718 }
1719}
1720
1721void KisConfig::setUseIgnoreHistoricTabletEventsWorkaround(bool value)
1722{
1723 m_cfg.writeEntry("useIgnoreHistoricTabletEventsWorkaround", value);
1724 KisConfigNotifier::instance()->notifyUseIgnoreHistoricTabletEventsWorkaroundChanged(value);
1725}
1726
1727qreal KisConfig::androidScalingLastInitialScale(bool defaultValue) const
1728{
1729 if (defaultValue) {
1730 return 0.0;
1731 } else {
1732 return m_cfg.readEntry("androidScalingLastInitialScale", 0.0);
1733 }
1734}
1735
1736void KisConfig::setAndroidScalingLastInitialScale(qreal value)
1737{
1738 m_cfg.writeEntry("androidScalingLastInitialScale", value);
1739}
1740
1741qreal KisConfig::androidScalingTargetScale(bool defaultValue) const
1742{
1743 if (defaultValue) {
1744 return 0.0;
1745 } else {
1746 return m_cfg.readEntry("androidScalingTargetScale", 0.0);
1747 }
1748}
1749
1750void KisConfig::setAndroidScalingTargetScale(qreal value)
1751{
1752 m_cfg.writeEntry("androidScalingTargetScale", value);
1753}
1754
1755bool KisConfig::androidScalingAskOnStartup(bool defaultValue) const
1756{
1757 if (defaultValue) {
1758 return true;
1759 } else {
1760 return m_cfg.readEntry("androidScalingAskOnStartup", true);
1761 }
1762}
1763
1764void KisConfig::setAndroidScalingAskOnStartup(bool value)
1765{
1766 m_cfg.writeEntry("androidScalingAskOnStartup", value);
1767}
1768#endif
1769
1770qreal KisConfig::vastScrolling(bool defaultValue) const
1771{
1772 return (defaultValue ? 0.9 : m_cfg.readEntry("vastScrolling", 0.9));
1773}
1774
1775void KisConfig::setVastScrolling(const qreal factor) const
1776{
1777 m_cfg.writeEntry("vastScrolling", factor);
1778}
1779
1780int KisConfig::presetChooserViewMode(bool defaultValue) const
1781{
1782 return (defaultValue ? 0 : m_cfg.readEntry("presetChooserViewMode", 0));
1783}
1784
1785void KisConfig::setPresetChooserViewMode(const int mode) const
1786{
1787 m_cfg.writeEntry("presetChooserViewMode", mode);
1788}
1789
1790int KisConfig::presetIconSize(bool defaultValue) const
1791{
1792 return (defaultValue ? 60 : m_cfg.readEntry("presetIconSize", 60));
1793}
1794
1796{
1797 m_cfg.writeEntry("presetIconSize", value);
1798}
1799
1800bool KisConfig::firstRun(bool defaultValue) const
1801{
1802 return (defaultValue ? true : m_cfg.readEntry("firstRun", true));
1803}
1804
1805void KisConfig::setFirstRun(const bool first) const
1806{
1807 m_cfg.writeEntry("firstRun", first);
1808}
1809
1810int KisConfig::horizontalSplitLines(bool defaultValue) const
1811{
1812 return (defaultValue ? 1 : m_cfg.readEntry("horizontalSplitLines", 1));
1813}
1814void KisConfig::setHorizontalSplitLines(const int numberLines) const
1815{
1816 m_cfg.writeEntry("horizontalSplitLines", numberLines);
1817}
1818
1819int KisConfig::verticalSplitLines(bool defaultValue) const
1820{
1821 return (defaultValue ? 1 : m_cfg.readEntry("verticalSplitLines", 1));
1822}
1823
1824void KisConfig::setVerticalSplitLines(const int numberLines) const
1825{
1826 m_cfg.writeEntry("verticalSplitLines", numberLines);
1827}
1828
1829bool KisConfig::clicklessSpacePan(bool defaultValue) const
1830{
1831 return (defaultValue ? true : m_cfg.readEntry("clicklessSpacePan", true));
1832}
1833
1834void KisConfig::setClicklessSpacePan(const bool toggle) const
1835{
1836 m_cfg.writeEntry("clicklessSpacePan", toggle);
1837}
1838
1839
1840bool KisConfig::hideDockersFullscreen(bool defaultValue) const
1841{
1842 return (defaultValue ? true : m_cfg.readEntry("hideDockersFullScreen", true));
1843}
1844
1846{
1847 m_cfg.writeEntry("hideDockersFullScreen", value);
1848}
1849
1850bool KisConfig::showDockerTitleBars(bool defaultValue) const
1851{
1852 return (defaultValue ? true : m_cfg.readEntry("showDockerTitleBars", true));
1853}
1854
1856{
1857 m_cfg.writeEntry("showDockerTitleBars", value);
1858}
1859
1860bool KisConfig::showDockers(bool defaultValue) const
1861{
1862 return (defaultValue ? true : m_cfg.readEntry("showDockers", true));
1863}
1864
1865void KisConfig::setShowDockers(const bool value) const
1866{
1867 m_cfg.writeEntry("showDockers", value);
1868}
1869
1870bool KisConfig::showStatusBar(bool defaultValue) const
1871{
1872 return (defaultValue ? true : m_cfg.readEntry("showStatusBar", true));
1873}
1874
1876{
1877 m_cfg.writeEntry("showStatusBar", value);
1878}
1879
1880bool KisConfig::hideMenuFullscreen(bool defaultValue) const
1881{
1882 return (defaultValue ? true: m_cfg.readEntry("hideMenuFullScreen", true));
1883}
1884
1886{
1887 m_cfg.writeEntry("hideMenuFullScreen", value);
1888}
1889
1890bool KisConfig::hideScrollbarsFullscreen(bool defaultValue) const
1891{
1892 return (defaultValue ? true : m_cfg.readEntry("hideScrollbarsFullScreen", true));
1893}
1894
1896{
1897 m_cfg.writeEntry("hideScrollbarsFullScreen", value);
1898}
1899
1900bool KisConfig::hideStatusbarFullscreen(bool defaultValue) const
1901{
1902 return (defaultValue ? true: m_cfg.readEntry("hideStatusbarFullScreen", true));
1903}
1904
1906{
1907 m_cfg.writeEntry("hideStatusbarFullScreen", value);
1908}
1909
1910bool KisConfig::hideTitlebarFullscreen(bool defaultValue) const
1911{
1912 return (defaultValue ? true : m_cfg.readEntry("hideTitleBarFullscreen", true));
1913}
1914
1916{
1917 m_cfg.writeEntry("hideTitleBarFullscreen", value);
1918}
1919
1920bool KisConfig::hideToolbarFullscreen(bool defaultValue) const
1921{
1922 return (defaultValue ? true : m_cfg.readEntry("hideToolbarFullscreen", true));
1923}
1924
1926{
1927 m_cfg.writeEntry("hideToolbarFullscreen", value);
1928}
1929
1930bool KisConfig::fullscreenMode(bool defaultValue) const
1931{
1932 return (defaultValue ? true : m_cfg.readEntry("fullscreenMode", false));
1933}
1934
1936{
1937 m_cfg.writeEntry("fullscreenMode", value);
1938}
1939
1941{
1942 return (defaultValue ? QStringList() :
1943 m_cfg.readEntry("favoriteCompositeOps",
1944 QString("normal,erase,multiply,burn,darken,add,dodge,screen,overlay,soft_light_svg,luminize,lighten,saturation,color,divide").split(',')));
1945}
1946
1948{
1949 m_cfg.writeEntry("favoriteCompositeOps", compositeOps);
1950}
1951
1952QString KisConfig::exportConfigurationXML(const QString &filterId, bool defaultValue) const
1953{
1954 return (defaultValue ? QString() : m_cfg.readEntry("ExportConfiguration-" + filterId, QString()));
1955}
1956
1957KisPropertiesConfigurationSP KisConfig::exportConfiguration(const QString &filterId, bool defaultValue) const
1958{
1960 const QString xmlData = exportConfigurationXML(filterId, defaultValue);
1961 cfg->fromXML(xmlData);
1962 return cfg;
1963}
1964
1965void KisConfig::setExportConfiguration(const QString &filterId, KisPropertiesConfigurationSP properties) const
1966{
1967 QString exportConfig = properties->toXML();
1968 m_cfg.writeEntry("ExportConfiguration-" + filterId, exportConfig);
1969}
1970
1971QString KisConfig::importConfiguration(const QString &filterId, bool defaultValue) const
1972{
1973 return (defaultValue ? QString() : m_cfg.readEntry("ImportConfiguration-" + filterId, QString()));
1974}
1975
1976void KisConfig::setImportConfiguration(const QString &filterId, KisPropertiesConfigurationSP properties) const
1977{
1978 QString importConfig = properties->toXML();
1979 m_cfg.writeEntry("ImportConfiguration-" + filterId, importConfig);
1980}
1981
1982bool KisConfig::useOcio(bool defaultValue) const
1983{
1984#ifdef HAVE_OCIO
1985 return (defaultValue ? false : m_cfg.readEntry("Krita/Ocio/UseOcio", false));
1986#else
1987 Q_UNUSED(defaultValue);
1988 return false;
1989#endif
1990}
1991
1992void KisConfig::setUseOcio(bool useOCIO) const
1993{
1994 m_cfg.writeEntry("Krita/Ocio/UseOcio", useOCIO);
1995}
1996
1997int KisConfig::favoritePresets(bool defaultValue) const
1998{
1999 return (defaultValue ? 10: m_cfg.readEntry("numFavoritePresets", 10));
2000}
2001
2003{
2004 m_cfg.writeEntry("numFavoritePresets", value);
2005}
2006
2007bool KisConfig::levelOfDetailEnabled(bool defaultValue) const
2008{
2009 return (defaultValue ? false : m_cfg.readEntry("levelOfDetailEnabled", false));
2010}
2011
2013{
2014 m_cfg.writeEntry("levelOfDetailEnabled", value);
2015}
2016
2018{
2020
2021 if (!defaultValue) {
2022 cfg.mode = (KisOcioConfiguration::Mode)m_cfg.readEntry("Krita/Ocio/OcioColorManagementMode", 0);
2023 cfg.configurationPath = m_cfg.readEntry("Krita/Ocio/OcioConfigPath", QString());
2024 cfg.lutPath = m_cfg.readEntry("Krita/Ocio/OcioLutPath", QString());
2025 cfg.inputColorSpace = m_cfg.readEntry("Krita/Ocio/InputColorSpace", QString());
2026 cfg.displayDevice = m_cfg.readEntry("Krita/Ocio/DisplayDevice", QString());
2027 cfg.displayView = m_cfg.readEntry("Krita/Ocio/DisplayView", QString());
2028 cfg.look = m_cfg.readEntry("Krita/Ocio/DisplayLook", QString());
2029 }
2030
2031 return cfg;
2032}
2033
2035{
2036 m_cfg.writeEntry("Krita/Ocio/OcioColorManagementMode", (int) cfg.mode);
2037 m_cfg.writeEntry("Krita/Ocio/OcioConfigPath", cfg.configurationPath);
2038 m_cfg.writeEntry("Krita/Ocio/OcioLutPath", cfg.lutPath);
2039 m_cfg.writeEntry("Krita/Ocio/InputColorSpace", cfg.inputColorSpace);
2040 m_cfg.writeEntry("Krita/Ocio/DisplayDevice", cfg.displayDevice);
2041 m_cfg.writeEntry("Krita/Ocio/DisplayView", cfg.displayView);
2042 m_cfg.writeEntry("Krita/Ocio/DisplayLook", cfg.look);
2043}
2044
2047{
2048 // FIXME: this option duplicates ocioConfiguration(), please deprecate it
2049 return (OcioColorManagementMode)(defaultValue ? INTERNAL
2050 : m_cfg.readEntry("Krita/Ocio/OcioColorManagementMode", (int) INTERNAL));
2051}
2052
2054{
2055 // FIXME: this option duplicates ocioConfiguration(), please deprecate it
2056 m_cfg.writeEntry("Krita/Ocio/OcioColorManagementMode", (int) mode);
2057}
2058
2059int KisConfig::ocioLutEdgeSize(bool defaultValue) const
2060{
2061 return (defaultValue ? 64 : m_cfg.readEntry("Krita/Ocio/LutEdgeSize", 64));
2062}
2063
2065{
2066 m_cfg.writeEntry("Krita/Ocio/LutEdgeSize", value);
2067}
2068
2070{
2071 return (defaultValue ? false : m_cfg.readEntry("Krita/Ocio/OcioLockColorVisualRepresentation", false));
2072}
2073
2075{
2076 m_cfg.writeEntry("Krita/Ocio/OcioLockColorVisualRepresentation", value);
2077}
2078
2079QString KisConfig::defaultPalette(bool defaultValue) const
2080{
2081 return (defaultValue ? QString() : m_cfg.readEntry("defaultPalette", "Default"));
2082}
2083
2084void KisConfig::setDefaultPalette(const QString& name) const
2085{
2086 m_cfg.writeEntry("defaultPalette", name);
2087}
2088
2089QString KisConfig::toolbarSlider(int sliderNumber, bool defaultValue) const
2090{
2091 QString def = "flow";
2092 if (sliderNumber == 1) {
2093 def = "opacity";
2094 }
2095 if (sliderNumber == 2) {
2096 def = "size";
2097 }
2098 return (defaultValue ? def : m_cfg.readEntry(QString("toolbarslider_%1").arg(sliderNumber), def));
2099}
2100
2101void KisConfig::setToolbarSlider(int sliderNumber, const QString &slider)
2102{
2103 m_cfg.writeEntry(QString("toolbarslider_%1").arg(sliderNumber), slider);
2104}
2105
2106int KisConfig::layerThumbnailSize(bool defaultValue) const
2107{
2108 return (defaultValue ? 20 : m_cfg.readEntry("layerThumbnailSize", 20));
2109}
2110
2112{
2113 m_cfg.writeEntry("layerThumbnailSize", size);
2114}
2115
2116int KisConfig::layerTreeIndentation(bool defaultValue) const
2117{
2118 return (defaultValue ? 50 : m_cfg.readEntry("layerTreeIndentation", 50));
2119}
2120
2122{
2123 m_cfg.writeEntry("layerTreeIndentation", percentage);
2124}
2125
2126bool KisConfig::sliderLabels(bool defaultValue) const
2127{
2128 return (defaultValue ? true : m_cfg.readEntry("sliderLabels", true));
2129}
2130
2132{
2133 m_cfg.writeEntry("sliderLabels", enabled);
2134}
2135
2136QString KisConfig::currentInputProfile(bool defaultValue) const
2137{
2138 return (defaultValue ? QString() : m_cfg.readEntry("currentInputProfile", QString()));
2139}
2140
2141void KisConfig::setCurrentInputProfile(const QString& name)
2142{
2143 m_cfg.writeEntry("currentInputProfile", name);
2144}
2145
2146bool KisConfig::useSystemMonitorProfile(bool defaultValue) const
2147{
2148 return (defaultValue ? false : m_cfg.readEntry("ColorManagement/UseSystemMonitorProfile", false));
2149}
2150
2151void KisConfig::setUseSystemMonitorProfile(bool _useSystemMonitorProfile) const
2152{
2153 m_cfg.writeEntry("ColorManagement/UseSystemMonitorProfile", _useSystemMonitorProfile);
2154}
2155
2156bool KisConfig::presetStripVisible(bool defaultValue) const
2157{
2158 return (defaultValue ? true : m_cfg.readEntry("presetStripVisible", true));
2159}
2160
2162{
2163 m_cfg.writeEntry("presetStripVisible", visible);
2164}
2165
2166bool KisConfig::scratchpadVisible(bool defaultValue) const
2167{
2168 return (defaultValue ? true : m_cfg.readEntry("scratchpadVisible", true));
2169}
2170
2172{
2173 m_cfg.writeEntry("scratchpadVisible", visible);
2174}
2175
2176bool KisConfig::showSingleChannelAsColor(bool defaultValue) const
2177{
2178 return (defaultValue ? false : m_cfg.readEntry("showSingleChannelAsColor", false));
2179}
2180
2182{
2183 m_cfg.writeEntry("showSingleChannelAsColor", asColor);
2184}
2185
2186bool KisConfig::hidePopups(bool defaultValue) const
2187{
2188 return (defaultValue ? false : m_cfg.readEntry("hidePopups", false));
2189}
2190
2191void KisConfig::setHidePopups(bool hidePopups)
2192{
2193 m_cfg.writeEntry("hidePopups", hidePopups);
2194}
2195
2196int KisConfig::numDefaultLayers(bool defaultValue) const
2197{
2198 return (defaultValue ? 2 : m_cfg.readEntry("NumberOfLayersForNewImage", 2));
2199}
2200
2202{
2203 m_cfg.writeEntry("NumberOfLayersForNewImage", num);
2204}
2205
2206quint8 KisConfig::defaultBackgroundOpacity(bool defaultValue) const
2207{
2208 return (defaultValue ? (int)OPACITY_OPAQUE_U8 : m_cfg.readEntry("BackgroundOpacityForNewImage", (int)OPACITY_OPAQUE_U8));
2209}
2210
2212{
2213 m_cfg.writeEntry("BackgroundOpacityForNewImage", (int)value);
2214}
2215
2216QColor KisConfig::defaultBackgroundColor(bool defaultValue) const
2217{
2218 return (defaultValue ? QColor(Qt::white) : m_cfg.readEntry("BackgroundColorForNewImage", QColor(Qt::white)));
2219}
2220
2222{
2223 m_cfg.writeEntry("BackgroundColorForNewImage", value);
2224}
2225
2227{
2228 return (KisConfig::BackgroundStyle)(defaultValue ? RASTER_LAYER : m_cfg.readEntry("BackgroundStyleForNewImage", (int)RASTER_LAYER));
2229}
2230
2232{
2233 m_cfg.writeEntry("BackgroundStyleForNewImage", (int)value);
2234}
2235
2236int KisConfig::lineSmoothingType(bool defaultValue) const
2237{
2238 return (defaultValue ? 1 : m_cfg.readEntry("LineSmoothingType", 1));
2239}
2240
2242{
2243 m_cfg.writeEntry("LineSmoothingType", value);
2244}
2245
2246qreal KisConfig::lineSmoothingDistanceMin(bool defaultValue) const
2247{
2248 return (defaultValue ? 50.0 : m_cfg.readEntry("LineSmoothingDistanceMin", 50.0));
2249}
2250
2252{
2253 m_cfg.writeEntry("LineSmoothingDistanceMin", value);
2254}
2255
2256qreal KisConfig::lineSmoothingDistanceMax(bool defaultValue) const
2257{
2258 return (defaultValue ? 50.0 : m_cfg.readEntry("LineSmoothingDistanceMax", 50.0));
2259}
2260
2262{
2263 m_cfg.writeEntry("LineSmoothingDistanceMax", value);
2264}
2265
2267{
2268 return (defaultValue ? true : m_cfg.readEntry("LineSmoothingDistanceKeepAspectRatio", true));
2269}
2270
2272{
2273 m_cfg.writeEntry("LineSmoothingDistanceKeepAspectRatio", value);
2274}
2275
2277{
2278 return (defaultValue ? 0.15 : m_cfg.readEntry("LineSmoothingTailAggressiveness", 0.15));
2279}
2280
2282{
2283 m_cfg.writeEntry("LineSmoothingTailAggressiveness", value);
2284}
2285
2286bool KisConfig::lineSmoothingSmoothPressure(bool defaultValue) const
2287{
2288 return (defaultValue ? false : m_cfg.readEntry("LineSmoothingSmoothPressure", false));
2289}
2290
2292{
2293 m_cfg.writeEntry("LineSmoothingSmoothPressure", value);
2294}
2295
2296bool KisConfig::lineSmoothingScalableDistance(bool defaultValue) const
2297{
2298 return (defaultValue ? true : m_cfg.readEntry("LineSmoothingScalableDistance", true));
2299}
2300
2302{
2303 m_cfg.writeEntry("LineSmoothingScalableDistance", value);
2304}
2305
2306qreal KisConfig::lineSmoothingDelayDistance(bool defaultValue) const
2307{
2308 return (defaultValue ? 50.0 : m_cfg.readEntry("LineSmoothingDelayDistance", 50.0));
2309}
2310
2312{
2313 m_cfg.writeEntry("LineSmoothingDelayDistance", value);
2314}
2315
2316bool KisConfig::lineSmoothingUseDelayDistance(bool defaultValue) const
2317{
2318 return (defaultValue ? true : m_cfg.readEntry("LineSmoothingUseDelayDistance", true));
2319}
2320
2322{
2323 m_cfg.writeEntry("LineSmoothingUseDelayDistance", value);
2324}
2325
2327{
2328 return (defaultValue ? true : m_cfg.readEntry("LineSmoothingFinishStabilizedCurve", true));
2329}
2330
2332{
2333 m_cfg.writeEntry("LineSmoothingFinishStabilizedCurve", value);
2334}
2335
2336bool KisConfig::lineSmoothingStabilizeSensors(bool defaultValue) const
2337{
2338 return (defaultValue ? true : m_cfg.readEntry("LineSmoothingStabilizeSensors", true));
2339}
2340
2342{
2343 m_cfg.writeEntry("LineSmoothingStabilizeSensors", value);
2344}
2345
2346int KisConfig::tabletEventsDelay(bool defaultValue) const
2347{
2348 return (defaultValue ? 10 : m_cfg.readEntry("tabletEventsDelay", 10));
2349}
2350
2352{
2353 m_cfg.writeEntry("tabletEventsDelay", value);
2354}
2355
2356bool KisConfig::trackTabletEventLatency(bool defaultValue) const
2357{
2358 return (defaultValue ? false : m_cfg.readEntry("trackTabletEventLatency", false));
2359}
2360
2362{
2363 m_cfg.writeEntry("trackTabletEventLatency", value);
2364}
2365
2366bool KisConfig::ignoreHighFunctionKeys(bool defaultValue) const
2367{
2368 return (defaultValue ? true : m_cfg.readEntry("ignoreHighFunctionKeys", true));
2369}
2370
2372{
2373 m_cfg.writeEntry("ignoreHighFunctionKeys", value);
2374}
2375
2377{
2378 return (defaultValue ? false : m_cfg.readEntry("testingAcceptCompressedTabletEvents", false));
2379}
2380
2382{
2383 m_cfg.writeEntry("testingAcceptCompressedTabletEvents", value);
2384}
2385
2386bool KisConfig::shouldEatDriverShortcuts(bool defaultValue) const
2387{
2388 return (defaultValue ? false : m_cfg.readEntry("shouldEatDriverShortcuts", false));
2389}
2390
2391bool KisConfig::testingCompressBrushEvents(bool defaultValue) const
2392{
2393 return (defaultValue ? false : m_cfg.readEntry("testingCompressBrushEvents", false));
2394}
2395
2397{
2398 m_cfg.writeEntry("testingCompressBrushEvents", value);
2399}
2400
2402{
2403 return (defaultValue ? 0 : m_cfg.readEntry("workaroundX11SmoothPressureSteps", 0));
2404}
2405
2406bool KisConfig::showCanvasMessages(bool defaultValue) const
2407{
2408 return (defaultValue ? true : m_cfg.readEntry("showOnCanvasMessages", true));
2409}
2410
2412{
2413 m_cfg.writeEntry("showOnCanvasMessages", show);
2414}
2415
2416bool KisConfig::compressKra(bool defaultValue) const
2417{
2418 return (defaultValue ? false : m_cfg.readEntry("compressLayersInKra", false));
2419}
2420
2421void KisConfig::setCompressKra(bool compress)
2422{
2423 m_cfg.writeEntry("compressLayersInKra", compress);
2424}
2425
2426bool KisConfig::trimKra(bool defaultValue) const
2427{
2428 return (defaultValue ? false : m_cfg.readEntry("TrimKra", false));
2429}
2430
2432{
2433 m_cfg.writeEntry("TrimKra", trim);
2434}
2435
2436bool KisConfig::trimFramesImport(bool defaultValue) const
2437{
2438 return (defaultValue ? false : m_cfg.readEntry("TrimFramesImport", false));
2439}
2441{
2442 m_cfg.writeEntry("TrimFramesImport", trim);
2443}
2444
2445QString KisConfig::exportMimeType(bool defaultValue) const
2446{
2447 return (defaultValue ? 0 : m_cfg.readEntry("defaultExportMimeType", QString()));
2448}
2449
2450void KisConfig::setExportMimeType(const QString &defaultExportMimeType)
2451{
2452 m_cfg.writeEntry("defaultExportMimeType", defaultExportMimeType);
2453}
2454
2455bool KisConfig::toolOptionsInDocker(bool defaultValue) const
2456{
2457 return (defaultValue ? true : m_cfg.readEntry("ToolOptionsInDocker", true));
2458}
2459
2461{
2462 m_cfg.writeEntry("ToolOptionsInDocker", inDocker);
2463}
2464
2465bool KisConfig::kineticScrollingEnabled(bool defaultValue) const
2466{
2467 return (defaultValue ? true : m_cfg.readEntry("KineticScrollingEnabled", true));
2468}
2469
2471{
2472 m_cfg.writeEntry("KineticScrollingEnabled", value);
2473}
2474
2475int KisConfig::kineticScrollingGesture(bool defaultValue) const
2476{
2477#ifdef Q_OS_ANDROID
2478 int defaultGesture = 1; // LeftMouseButtonGesture
2479#else
2480 int defaultGesture = 2; // MiddleMouseButtonGesture
2481#endif
2482
2483 return (defaultValue ? defaultGesture : m_cfg.readEntry("KineticScrollingGesture", defaultGesture));
2484}
2485
2487{
2488 m_cfg.writeEntry("KineticScrollingGesture", gesture);
2489}
2490
2491int KisConfig::kineticScrollingSensitivity(bool defaultValue) const
2492{
2493 return (defaultValue ? 75 : m_cfg.readEntry("KineticScrollingSensitivity", 75));
2494}
2495
2497{
2498 m_cfg.writeEntry("KineticScrollingSensitivity", sensitivity);
2499}
2500
2502{
2503 return (defaultValue ? false : m_cfg.readEntry("KineticScrollingHideScrollbar", false));
2504}
2505
2507{
2508 m_cfg.writeEntry("KineticScrollingHideScrollbar", scrollbar);
2509}
2510
2511int KisConfig::zoomSteps(bool defaultValue) const
2512{
2513 return (defaultValue ? 2 : m_cfg.readEntry("zoomSteps", 2));
2514}
2515
2517{
2518 m_cfg.writeEntry("zoomSteps", steps);
2519}
2520
2521int KisConfig::zoomMarginSize(bool defaultValue) const
2522{
2523 return (defaultValue ? 0 : m_cfg.readEntry("zoomMarginSize", 0));
2524}
2525
2526void KisConfig::setZoomMarginSize(int zoomMarginSize)
2527{
2528 m_cfg.writeEntry("zoomMarginSize", zoomMarginSize);
2529}
2530
2532{
2533 const KoColorSpace *cs = 0;
2534
2535 KConfigGroup cfg = KSharedConfig::openConfig()->group("advancedColorSelector");
2536 if (defaultValue || cfg.readEntry("useCustomColorSpace", true)) {
2538 QString modelID = cfg.readEntry("customColorSpaceModel", "RGBA");
2539 QString depthID = cfg.readEntry("customColorSpaceDepthID", "U8");
2540 QString profile = cfg.readEntry("customColorSpaceProfile", "sRGB built-in - (lcms internal)");
2541 if (profile == "default") {
2542 // qDebug() << "Falling back to default color profile.";
2543 profile = "sRGB built-in - (lcms internal)";
2544 }
2545 cs = csr->colorSpace(modelID, depthID, profile);
2546 }
2547
2548 return cs;
2549}
2550
2552{
2553 KConfigGroup cfg = KSharedConfig::openConfig()->group("advancedColorSelector");
2554 cfg.writeEntry("useCustomColorSpace", bool(cs));
2555 if(cs) {
2556 cfg.writeEntry("customColorSpaceModel", cs->colorModelId().id());
2557 cfg.writeEntry("customColorSpaceDepthID", cs->colorDepthId().id());
2558 cfg.writeEntry("customColorSpaceProfile", cs->profile()->name());
2559 }
2560}
2561
2562bool KisConfig::enableOpenGLFramerateLogging(bool defaultValue) const
2563{
2564 return (defaultValue ? false : m_cfg.readEntry("enableOpenGLFramerateLogging", false));
2565}
2566
2568{
2569 m_cfg.writeEntry("enableOpenGLFramerateLogging", value);
2570}
2571
2572bool KisConfig::enableBrushSpeedLogging(bool defaultValue) const
2573{
2574 return (defaultValue ? false : m_cfg.readEntry("enableBrushSpeedLogging", false));
2575}
2576
2578{
2579 m_cfg.writeEntry("enableBrushSpeedLogging", value);
2580}
2581
2583{
2584 // use the old key name for compatibility
2585 m_cfg.writeEntry("amdDisableVectorWorkaround", value);
2586}
2587
2588bool KisConfig::disableVectorOptimizations(bool defaultValue) const
2589{
2590 // use the old key name for compatibility
2591 return (defaultValue ? false : m_cfg.readEntry("amdDisableVectorWorkaround", false));
2592}
2593
2595{
2596 m_cfg.writeEntry("disableAVXOptimizations", value);
2597}
2598
2599bool KisConfig::disableAVXOptimizations(bool defaultValue) const
2600{
2601 return (defaultValue ? false : m_cfg.readEntry("disableAVXOptimizations", false));
2602}
2603
2605{
2606 m_cfg.writeEntry("animationPlaybackBackend", value);
2607}
2608
2609int KisConfig::animationPlaybackBackend(bool defaultValue) const
2610{
2611 return (defaultValue ? 1 : m_cfg.readEntry("animationPlaybackBackend", 1));
2612}
2613
2615{
2616 bool oldValue = animationDropFrames();
2617
2618 if (value == oldValue) return;
2619
2620 m_cfg.writeEntry("animationDropFrames", value);
2622}
2623
2624bool KisConfig::autoPinLayersToTimeline(bool defaultValue) const
2625{
2626 return (defaultValue ? true : m_cfg.readEntry("autoPinLayers", true));
2627}
2628
2630{
2631 m_cfg.writeEntry("autoPinLayers", value);
2632}
2633
2634bool KisConfig::adaptivePlaybackRange(bool defaultValue) const
2635{
2636 return (defaultValue ? true : m_cfg.readEntry("adaptivePlaybackRange", true));
2637}
2638
2640{
2641 m_cfg.writeEntry("adaptivePlaybackRange", value);
2642}
2643
2645{
2646 return (defaultValue ? true : m_cfg.readEntry("autoZoomTimelineToPlaybackRange", true));
2647}
2648
2650{
2651 m_cfg.writeEntry("autoZoomTimelineToPlaybackRange", value);
2652}
2653
2654QString KisConfig::ffmpegLocation(bool defaultValue) const {
2655 return (defaultValue ? "" : m_cfg.readEntry("ffmpegLocation", ""));
2656}
2657
2659 m_cfg.writeEntry("ffmpegLocation", value);
2660}
2661
2662qreal KisConfig::timelineZoom(bool defaultValue) const
2663{
2664 return (defaultValue ? 1.0f : m_cfg.readEntry("timelineZoom", 1.0f));
2665}
2666
2668{
2669 m_cfg.writeEntry("timelineZoom", value);
2670}
2671
2672bool KisConfig::animationDropFrames(bool defaultValue) const
2673{
2674 return (defaultValue ? true : m_cfg.readEntry("animationDropFrames", true));
2675}
2676
2677int KisConfig::scrubbingUpdatesDelay(bool defaultValue) const
2678{
2679 return (defaultValue ? 30 : m_cfg.readEntry("scrubbingUpdatesDelay", 30));
2680}
2681
2683{
2684 m_cfg.writeEntry("scrubbingUpdatesDelay", value);
2685}
2686
2687int KisConfig::scrubbingAudioUpdatesDelay(bool defaultValue) const
2688{
2689 return (defaultValue ? -1 : m_cfg.readEntry("scrubbingAudioUpdatesDelay", -1));
2690}
2691
2693{
2694 m_cfg.writeEntry("scrubbingAudioUpdatesDelay", value);
2695}
2696
2697int KisConfig::audioOffsetTolerance(bool defaultValue) const
2698{
2699 return (defaultValue ? -1 : m_cfg.readEntry("audioOffsetTolerance", -1));
2700}
2701
2703{
2704 m_cfg.writeEntry("audioOffsetTolerance", value);
2705}
2706
2707bool KisConfig::switchSelectionCtrlAlt(bool defaultValue) const
2708{
2709 return defaultValue ? false : m_cfg.readEntry("switchSelectionCtrlAlt", false);
2710}
2711
2713{
2714 m_cfg.writeEntry("switchSelectionCtrlAlt", value);
2715}
2716
2718{
2719 return defaultValue ? false : m_cfg.readEntry("ConvertToImageColorSpaceOnImport", false);
2720}
2721
2723{
2724 m_cfg.writeEntry("ConvertToImageColorSpaceOnImport", value);
2725}
2726
2727int KisConfig::stabilizerSampleSize(bool defaultValue) const
2728{
2729#ifdef Q_OS_WIN
2730 const int defaultSampleSize = 50;
2731#else
2732 const int defaultSampleSize = 15;
2733#endif
2734
2735 return defaultValue ?
2736 defaultSampleSize : m_cfg.readEntry("stabilizerSampleSize", defaultSampleSize);
2737}
2738
2740{
2741 m_cfg.writeEntry("stabilizerSampleSize", value);
2742}
2743
2744bool KisConfig::stabilizerDelayedPaint(bool defaultValue) const
2745{
2746 const bool defaultEnabled = true;
2747
2748 return defaultValue ?
2749 defaultEnabled : m_cfg.readEntry("stabilizerDelayedPaint", defaultEnabled);
2750}
2751
2753{
2754 m_cfg.writeEntry("stabilizerDelayedPaint", value);
2755}
2756
2757bool KisConfig::showBrushHud(bool defaultValue) const
2758{
2759 return defaultValue ? false : m_cfg.readEntry("showBrushHud", false);
2760}
2761
2763{
2764 m_cfg.writeEntry("showBrushHud", value);
2765}
2766
2767bool KisConfig::showPaletteBottomBar(bool defaultValue) const
2768{
2769 return defaultValue ? true : m_cfg.readEntry("showPaletteBottomBar", true);
2770}
2771
2773{
2774 m_cfg.writeEntry("showPaletteBottomBar", value);
2775}
2776
2777QString KisConfig::brushHudSetting(bool defaultValue) const
2778{
2779 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";
2780 return defaultValue ? defaultDoc : m_cfg.readEntry("brushHudSettings", defaultDoc);
2781}
2782
2783void KisConfig::setBrushHudSetting(const QString &value) const
2784{
2785 m_cfg.writeEntry("brushHudSettings", value);
2786}
2787
2789{
2790 return defaultValue ? true : m_cfg.readEntry("calculateAnimationCacheInBackground", true);
2791}
2792
2794{
2795 m_cfg.writeEntry("calculateAnimationCacheInBackground", value);
2796}
2797
2798QColor KisConfig::defaultAssistantsColor(bool defaultValue) const
2799{
2800 static const QColor defaultColor = QColor(176, 176, 176, 255);
2801 return defaultValue ? defaultColor : m_cfg.readEntry("defaultAssistantsColor", defaultColor);
2802}
2803
2804void KisConfig::setDefaultAssistantsColor(const QColor &color) const
2805{
2806 m_cfg.writeEntry("defaultAssistantsColor", color);
2807}
2808
2809bool KisConfig::autoSmoothBezierCurves(bool defaultValue) const
2810{
2811 return defaultValue ? false : m_cfg.readEntry("autoSmoothBezierCurves", false);
2812}
2813
2815{
2816 m_cfg.writeEntry("autoSmoothBezierCurves", value);
2817}
2818
2820{
2821 return defaultValue ? false : m_cfg.readEntry("activateTransformToolAfterPaste", false);
2822}
2823
2825{
2826 m_cfg.writeEntry("activateTransformToolAfterPaste", value);
2827}
2828
2829bool KisConfig::zoomHorizontal(bool defaultValue) const
2830{
2831 return defaultValue ? false : m_cfg.readEntry("zoomHorizontal", false);
2832}
2833
2835{
2836 m_cfg.writeEntry("zoomHorizontal", value);
2837}
2838
2839bool KisConfig::selectionActionBar(bool defaultValue) const
2840{
2841 return defaultValue ? true : m_cfg.readEntry("selectionActionBar", true);
2842}
2843
2845{
2846 m_cfg.writeEntry("selectionActionBar", value);
2847}
2848
2853
2855{
2856 m_cfg.writeEntry("selectionActionBarBehavior", (int)value);
2857}
2858
2863
2865{
2866 m_cfg.writeEntry("selectionActionBarPosition", (int)value);
2867}
2868
2873
2875{
2876 m_cfg.writeEntry("selectionActionBarOrientation", (int)value);
2877}
2878
2880{
2881 const QString configPath = QStandardPaths::writableLocation(QStandardPaths::GenericConfigLocation);
2882 QSettings kritarc(configPath + QStringLiteral("/kritadisplayrc"), QSettings::IniFormat);
2883
2884 return rootSurfaceFormat(&kritarc, defaultValue);
2885}
2886
2888{
2889 const QString configPath = QStandardPaths::writableLocation(QStandardPaths::GenericConfigLocation);
2890 QSettings kritarc(configPath + QStringLiteral("/kritadisplayrc"), QSettings::IniFormat);
2891
2892 setRootSurfaceFormat(&kritarc, value);
2893}
2894
2895KisConfig::RootSurfaceFormat KisConfig::rootSurfaceFormat(QSettings *displayrc, bool defaultValue)
2896{
2897 QString textValue = "bt709-g22";
2898
2899 if (!defaultValue) {
2900 textValue = displayrc->value("rootSurfaceFormat", textValue).toString();
2901 }
2902
2903 return textValue == "bt709-g10" ? BT709_G10 :
2904 textValue == "bt2020-pq" ? BT2020_PQ :
2905 BT709_G22;
2906}
2907
2909{
2910 const QString textValue =
2911 value == BT709_G10 ? "bt709-g10" :
2912 value == BT2020_PQ ? "bt2020-pq" :
2913 "bt709-g22";
2914
2915 displayrc->setValue("rootSurfaceFormat", textValue);
2916}
2917
2918bool KisConfig::useZip64(bool defaultValue) const
2919{
2920 return defaultValue ? false : m_cfg.readEntry("UseZip64", false);
2921}
2922
2924{
2925 m_cfg.writeEntry("UseZip64", value);
2926}
2927
2929{
2930 return defaultValue ? true : m_cfg.readEntry("convertLayerColorSpaceInProperties", true);
2931}
2932
2934{
2935 m_cfg.writeEntry("convertLayerColorSpaceInProperties", value);
2936}
2937
2938bool KisConfig::renamePastedLayers(bool defaultValue) const
2939{
2940 return defaultValue ? true : m_cfg.readEntry("renamePastedLayers", true);
2941}
2942
2944{
2945 m_cfg.writeEntry("renamePastedLayers", value);
2946}
2947
2949{
2950 return (KisConfig::LayerInfoTextStyle)(defaultValue ? INFOTEXT_NONE : m_cfg.readEntry("layerInfoTextStyle", (int)INFOTEXT_NONE));
2951}
2952
2954{
2955 m_cfg.writeEntry("layerInfoTextStyle", (int)value);
2956}
2957
2958int KisConfig::layerInfoTextOpacity(bool defaultValue) const
2959{
2960 return defaultValue ? 55 : m_cfg.readEntry("layerInfoTextOpacity", 55);
2961}
2962
2964{
2965 m_cfg.writeEntry("layerInfoTextOpacity", value);
2966}
2967
2968bool KisConfig::useInlineLayerInfoText(bool defaultValue) const
2969{
2970 return defaultValue ? false : m_cfg.readEntry("useInlineLayerInfoText", false);
2971}
2972
2974{
2975 m_cfg.writeEntry("useInlineLayerInfoText", value);
2976}
2977
2978bool KisConfig::useLayerSelectionCheckbox(bool defaultValue) const
2979{
2980 return defaultValue ? false : m_cfg.readEntry("useLayerSelectionCheckbox", true);
2981}
2982
2984{
2985 m_cfg.writeEntry("useLayerSelectionCheckbox", value);
2986}
2987
2989{
2990 if (defaultValue) {
2992 }
2993
2994 return static_cast<AssistantsDrawMode>(
2995 m_cfg.readEntry("assistantsDrawMode", static_cast<int>(ASSISTANTS_DRAW_MODE_DIRECT)));
2996}
2997
2999{
3000 m_cfg.writeEntry("assistantsDrawMode", static_cast<int>(value));
3001}
3002
3003bool KisConfig::longPressEnabled(bool defaultValue) const
3004{
3005#ifdef Q_OS_ANDROID
3006 bool defaultEnabled = true;
3007#else
3008 bool defaultEnabled = false;
3009#endif
3010 if (defaultValue) {
3011 return defaultEnabled;
3012 } else {
3013 return m_cfg.readEntry("longPressEnabled", defaultEnabled);
3014 }
3015}
3016
3018{
3019 m_cfg.writeEntry("longPressEnabled", value);
3021}
3022
3024{
3025 return defaultValue ? 40 : m_cfg.readEntry("layerThumbnailGenerationTimeout", 40);
3026}
3027
3029{
3030 m_cfg.writeEntry("layerThumbnailGenerationTimeout", value);
3031}
3032
3033#include <QDomDocument>
3034#include <QDomElement>
3035
3036void KisConfig::writeKoColor(const QString& name, const KoColor& color) const
3037{
3038 QDomDocument doc = QDomDocument(name);
3039 QDomElement el = doc.createElement(name);
3040 doc.appendChild(el);
3041 color.toXML(doc, el);
3042 m_cfg.writeEntry(name, doc.toString());
3043}
3044
3045//ported from kispropertiesconfig.
3046KoColor KisConfig::readKoColor(const QString& name, const KoColor& _color) const
3047{
3048 QDomDocument doc;
3049
3050 KoColor color = _color;
3051
3052 if (!m_cfg.readEntry(name).isNull()) {
3053 doc.setContent(m_cfg.readEntry(name));
3054 QDomElement e = doc.documentElement().firstChild().toElement();
3056 }
3057 else {
3058 QString blackColor = "<!DOCTYPE Color>\n<Color>\n <RGB r=\"0\" space=\"sRGB-elle-V2-srgbtrc.icc\" b=\"0\" g=\"0\"/>\n</Color>\n";
3059 doc.setContent(blackColor);
3060 QDomElement e = doc.documentElement().firstChild().toElement();
3062 }
3063 return color;
3064}
3065
3066void KisConfig::writeKoColors(const QString& name, const QList<KoColor>& colors) const
3067{
3068 QDomDocument doc = QDomDocument(name);
3069 QDomElement colorsElement = doc.createElement("colors");
3070 doc.appendChild(colorsElement);
3071
3072 // Writes like <colors><RGB ../><RGB .. /> ... </colors>
3073 Q_FOREACH(const KoColor & color, colors) {
3074 color.toXML(doc, colorsElement);
3075 }
3076 m_cfg.writeEntry(name, doc.toString());
3077}
3078
3079QList<KoColor> KisConfig::readKoColors(const QString& name) const
3080{
3081 QList<KoColor> colors;
3082 QString colorListXML = m_cfg.readEntry(name);
3083
3084 if (!colorListXML.isNull()) {
3085 QDomDocument doc;
3086 doc.setContent(colorListXML);
3087 QDomElement colorsElement = doc.firstChildElement();
3088 if (!colorsElement.isNull()) {
3089 QDomNodeList colorNodes = colorsElement.childNodes();
3090 colors.reserve(colorNodes.size());
3091
3092 for (int k = 0; k < colorNodes.size(); k++) {
3093 QDomElement colorElement = colorNodes.at(k).toElement();
3094 KoColor color = KoColor::fromXML(colorElement, Integer16BitsColorDepthID.id());
3095 colors.push_back(color);
3096 }
3097 }
3098 }
3099
3100 return colors;
3101}
3102
3103QDebug operator<<(QDebug debug, const KisConfig::CanvasSurfaceMode &mode)
3104{
3105 QDebugStateSaver saver(debug);
3106 debug.nospace() << "CanvasSurfaceMode(";
3107
3108 switch (mode) {
3110 debug.nospace() << "Preferred";
3111 break;
3113 debug.nospace() << "Rec709g22";
3114 break;
3116 debug.nospace() << "Rec709g10";
3117 break;
3119 debug.nospace() << "Rec2020pq";
3120 break;
3122 debug.nospace() << "Unmanaged";
3123 break;
3124 default:
3125 debug.nospace() << "unknown(" << static_cast<int>(mode) << ")";
3126 break;
3127 }
3128
3129 debug.nospace() << ")";
3130
3131 return debug.space();
3132}
3133
3134QDebug operator<<(QDebug debug, const KisConfig::CanvasSurfaceBitDepthMode &mode)
3135{
3136
3137 QDebugStateSaver saver(debug);
3138 debug.nospace() << "CanvasSurfaceBitDepthMode(";
3139
3140 switch (mode) {
3142 debug.nospace() << "DepthAuto";
3143 break;
3145 debug.nospace() << "Depth8Bit";
3146 break;
3148 debug.nospace() << "Depth10Bit";
3149 break;
3150 default:
3151 debug.nospace() << "unknown(" << static_cast<int>(mode) << ")";
3152 break;
3153 }
3154
3155 debug.nospace() << ")";
3156
3157 return debug.space();
3158}
3159
qreal length(const QPointF &vec)
Definition Ellipse.cc:82
float value(const T *src, size_t ch)
qreal v
QList< QString > QStringList
const KoID Integer8BitsColorDepthID("U8", ki18n("8-bit integer/channel"))
const KoID Integer16BitsColorDepthID("U16", ki18n("16-bit integer/channel"))
const KoID RGBAColorModelID("RGBA", ki18n("RGB/Alpha"))
const quint8 OPACITY_OPAQUE_U8
QByteArray displayProfile(const QString &device, int profile=0) const
Return the icc profile for the given device and index (if a device has more than one profile)
static KisColorManager * instance()
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
bool backupFile(bool defaultValue=false) const
void setAntialiasCurves(bool v) const
bool useOcio(bool defaultValue=false) const
void setSwitchSelectionCtrlAlt(bool value)
qint32 defImageHeight(bool defaultValue=false) const
bool antialiasSelectionOutline(bool defaultValue=false) const
void setZoomSteps(int steps)
@ ASSISTANTS_DRAW_MODE_DIRECT
Definition kis_config.h:845
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:893
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 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
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
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 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
BackgroundStyle defaultBackgroundStyle(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:56
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 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
bool hideMenuFullscreen(bool defaultValue=false) const
QString getMDIBackgroundColor(bool defaultValue=false) const
void setMonitorProfile(int screen, const QString &monitorProfile, bool override) 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:894
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:780
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:775
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
void setNumDefaultLayers(int num)
QList< KoColor > readKoColors(const QString &name) const
QColor getGridMainColor(bool defaultValue=false) const
void setUseSystemMonitorProfile(bool _useSystemMonitorProfile) 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 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)
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:77
QString ffmpegLocation(bool defaultValue=false) const
void setImportConfiguration(const QString &filterId, KisPropertiesConfigurationSP properties) const
bool useLayerSelectionCheckbox(bool defaultValue=false) const
QColor guidesColor(bool defaultValue=false) const
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 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)
void setMonitorForScreen(int screen, const QString &monitor)
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 setDefaultBackgroundOpacity(quint8 value)
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
KisCumulativeUndoData cumulativeUndoData(bool defaultValue=false) 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 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)
QColor defaultBackgroundColor(bool defaultValue=false) const
SelectionActionsBarOrientation
Definition kis_config.h:791
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 setPresetIconSize(const int value) const
OcioColorManagementMode
Definition kis_config.h:517
bool hideTitlebarFullscreen(bool defaultValue=false) const
QString defaultPalette(bool defaultValue=false) const
bool useRightMiddleTabletButtonWorkaround(bool defaultValue=false) const
void setDefaultBackgroundStyle(BackgroundStyle value)
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 useSystemMonitorProfile(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:189
bool useEraserBrushSize(bool defaultValue=false) const
void setLayerThumbnailSize(int size)
void setZoomMarginSize(int zoomMarginSize)
@ SOS_BlankSession
Definition kis_config.h:370
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
static const KoColorProfile * getScreenProfile(int screen)
get the profile the color management system has stored for the given screen
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 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 setDefaultBackgroundColor(const QColor &value)
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
int numDefaultLayers(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)
quint8 defaultBackgroundOpacity(bool defaultValue=false) const
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
QString monitorForScreen(int screen, const QString &defaultMonitor, bool defaultValue=true) 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)
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:45
@ 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_PERCEPTUAL
Definition kis_global.h:103
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
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()
const KoColorProfile * createColorProfile(const QString &colorModelId, const QString &colorDepthId, const QByteArray &rawData)