Krita Source Code Documentation
Loading...
Searching...
No Matches
kis_image_config.h
Go to the documentation of this file.
1/*
2 * SPDX-FileCopyrightText: 2010 Dmitry Kazakov <dimula73@gmail.com>
3 *
4 * SPDX-License-Identifier: GPL-2.0-or-later
5 */
6
7#ifndef KIS_IMAGE_CONFIG_H_
8#define KIS_IMAGE_CONFIG_H_
9
10#include <kconfiggroup.h>
11#include "kritaimage_export.h"
13#include "kis_types.h"
14
15class KRITAIMAGE_EXPORT KisImageConfig
16{
17public:
18 KisImageConfig(bool readOnly);
20
21 bool enableProgressReporting(bool requestDefault = false) const;
22 void setEnableProgressReporting(bool value);
23
24 bool enablePerfLog(bool requestDefault = false) const;
25 void setEnablePerfLog(bool value);
26
27 qreal transformMaskOffBoundsReadArea() const;
28
29 int updatePatchHeight() const;
30 void setUpdatePatchHeight(int value);
31 int updatePatchWidth() const;
32 void setUpdatePatchWidth(int value);
33
34 qreal maxCollectAlpha() const;
35 qreal maxMergeAlpha() const;
36 qreal maxMergeCollectAlpha() const;
37 qreal schedulerBalancingRatio() const;
38 void setSchedulerBalancingRatio(qreal value);
39
40 int maxSwapSize(bool requestDefault = false) const;
41 void setMaxSwapSize(int value);
42
43 int swapSlabSize() const;
44 void setSwapSlabSize(int value);
45
46 int swapWindowSize() const;
47 void setSwapWindowSize(int value);
48
49 int tilesHardLimit() const; // MiB
50 int tilesSoftLimit() const; // MiB
51 int poolLimit() const; // MiB
52
53 qreal memoryHardLimitPercent(bool requestDefault = false) const; // % of total RAM
54 qreal memorySoftLimitPercent(bool requestDefault = false) const; // % of memoryHardLimitPercent() * (1 - 0.01 * memoryPoolLimitPercent())
55 qreal memoryPoolLimitPercent(bool requestDefault = false) const; // % of memoryHardLimitPercent()
56 void setMemoryHardLimitPercent(qreal value);
57 void setMemorySoftLimitPercent(qreal value);
58 void setMemoryPoolLimitPercent(qreal value);
59
60 static int totalRAM(); // MiB
61
66 QString swapDir(bool requestDefault = false);
67 void setSwapDir(const QString &swapDir);
68
69 int numberOfOnionSkins() const;
70 void setNumberOfOnionSkins(int value);
71
72 int onionSkinTintFactor() const;
73 void setOnionSkinTintFactor(int value);
74
75 int onionSkinOpacity(int offset, bool requestDefault = false) const;
76 void setOnionSkinOpacity(int offset, int value);
77
78 bool onionSkinState(int offset) const;
79 void setOnionSkinState(int offset, bool value);
80
81 QColor onionSkinTintColorBackward() const;
82 void setOnionSkinTintColorBackward(const QColor &value);
83
84 QColor onionSkinTintColorForward() const;
85 void setOnionSkinTintColorForward(const QColor &value);
86
87 bool autoKeyEnabled(bool requestDefault = false) const;
88 void setAutoKeyEnabled(bool value);
89
90 bool autoKeyModeDuplicate(bool requestDefault = false) const;
91 void setAutoKeyModeDuplicate(bool value);
92
93 bool showAdditionalOnionSkinsSettings(bool requestDefault = false) const;
94 void setShowAdditionalOnionSkinsSettings(bool value);
95
96 int defaultFrameColorLabel() const;
97 void setDefaultFrameColorLabel(int label);
98
99 KisProofingConfigurationSP defaultProofingconfiguration(bool requestDefault = false);
100 void setDefaultProofingConfig(const KisProofingConfiguration &config);
101
102 bool useLodForColorizeMask(bool requestDefault = false) const;
103 void setUseLodForColorizeMask(bool value);
104
105 int maxNumberOfThreads(bool defaultValue = false) const;
106 void setMaxNumberOfThreads(int value);
107
108 int frameRenderingClones(bool defaultValue = false) const;
109 void setFrameRenderingClones(int value);
110
111 int frameRenderingTimeout(bool defaultValue = false) const;
112 void setFrameRenderingTimeout(int value);
113
114 int fpsLimit(bool defaultValue = false) const;
115 void setFpsLimit(int value);
116
117 bool detectFpsLimit(bool defaultValue = false) const;
118 void setDetectFpsLimit(bool value);
119
120 bool useOnDiskAnimationCacheSwapping(bool defaultValue = false) const;
121 void setUseOnDiskAnimationCacheSwapping(bool value);
122
123 QString animationCacheDir(bool defaultValue = false) const;
124 void setAnimationCacheDir(const QString &value);
125
126 bool useAnimationCacheFrameSizeLimit(bool defaultValue = false) const;
127 void setUseAnimationCacheFrameSizeLimit(bool value);
128
129 int animationCacheFrameSizeLimit(bool defaultValue = false) const;
130 void setAnimationCacheFrameSizeLimit(int value);
131
132 bool useAnimationCacheRegionOfInterest(bool defaultValue = false) const;
133 void setUseAnimationCacheRegionOfInterest(bool value);
134
135 qreal animationCacheRegionOfInterestMargin(bool defaultValue = false) const;
136 void setAnimationCacheRegionOfInterestMargin(qreal value);
137
138 qreal selectionOutlineOpacity(bool defaultValue = false) const;
139 void setSelectionOutlineOpacity(qreal value);
140
141 QColor selectionOverlayMaskColor(bool defaultValue = false) const;
142 void setSelectionOverlayMaskColor(const QColor &color);
143
144 int maxBrushSize(bool defaultValue = false) const;
145 void setMaxBrushSize(int value);
146
147 int maxMaskingBrushSize() const;
148
149 bool renameMergedLayers(bool defaultValue = false) const;
150 void setRenameMergedLayers(bool value);
151 bool renameDuplicatedLayers(bool defaultValue = false) const;
152 void setRenameDuplicatedLayers(bool value);
153
154 template<class T>
155 void writeEntry(const QString& name, const T& value) {
156 m_config.writeEntry(name, value);
157 }
158
159 template<class T>
160 void writeList(const QString& name, const QList<T>& value) {
161 m_config.writeEntry(name, value);
162 }
163
164 template<class T>
165 T readEntry(const QString& name, const T& defaultValue=T()) {
166 return m_config.readEntry(name, defaultValue);
167 }
168
169 template<class T>
170 QList<T> readList(const QString& name, const QList<T>& defaultValue=QList<T>()) {
171 return m_config.readEntry(name, defaultValue);
172 }
173
174 /* Per-File Export Configurations
175 * Export configurations can optionally be saved into the file. If no configuration exists,
176 * the user should try loading a configuration from the global system instead.
177 */
178 QString exportConfigurationXML(const QString &exportConfigId, bool defaultValue = false) const;
179 bool hasExportConfiguration(const QString& exportConfigID);
180 KisPropertiesConfigurationSP exportConfiguration(const QString &exportConfigId, bool defaultValue = false) const;
181 void setExportConfiguration(const QString &exportConfigId, KisPropertiesConfigurationSP properties);
182
183 static void resetConfig();
184private:
185 Q_DISABLE_COPY(KisImageConfig)
186
187 QString safelyGetWritableTempLocation(const QString &suffix, const QString &configKey, bool requestDefault) const;
188
189private:
190 KConfigGroup m_config;
192};
193
194
195#endif /* KIS_IMAGE_CONFIG_H_ */
float value(const T *src, size_t ch)
T readEntry(const QString &name, const T &defaultValue=T())
void writeList(const QString &name, const QList< T > &value)
void writeEntry(const QString &name, const T &value)
QList< T > readList(const QString &name, const QList< T > &defaultValue=QList< T >())
KConfigGroup m_config
The KisProofingConfiguration struct Little struct that stores the proofing configuration for a given ...