kis_config.h 15.1 KB
Newer Older
1
/*
2
 *  Copyright (c) 2002 Patrick Julien <freak@codepimps.org>
3 4 5 6 7 8 9 10 11 12 13 14 15
 *
 *  This program is free software; you can redistribute it and/or modify
 *  it under the terms of the GNU General Public License as published by
 *  the Free Software Foundation; either version 2 of the License, or
 *  (at your option) any later version.
 *
 *  This program is distributed in the hope that it will be useful,
 *  but WITHOUT ANY WARRANTY; without even the implied warranty of
 *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 *  GNU General Public License for more details.
 *
 *  You should have received a copy of the GNU General Public License
 *  along with this program; if not, write to the Free Software
16
 *  Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
17
 */
18
#ifndef KIS_CONFIG_H_
19
#define KIS_CONFIG_H_
20

21
#include <QString>
22
#include <QStringList>
23
#include <QList>
24 25
#include <QColor>

26
#include <ksharedconfig.h>
27
#include <kconfiggroup.h>
28

29
#include "kis_global.h"
30
#include "kis_properties_configuration.h"
31
#include "krita_export.h"
32

33
class KoColorProfile;
34
class KoColorSpace;
35

Boudewijn Rempt's avatar
Boudewijn Rempt committed
36 37
class KRITAUI_EXPORT KisConfig
{
38
public:
39 40
    KisConfig();
    ~KisConfig();
41

42 43 44
    bool disableTouchOnCanvas() const;
    void setDisableTouchOnCanvas(bool value) const;

45
    bool useProjections() const;
46
    void setUseProjections(bool useProj) const;
47

48
    bool undoEnabled() const;
49
    void setUndoEnabled(bool undo) const;
50

51
    int undoStackLimit() const;
52
    void setUndoStackLimit(int limit) const;
53

54 55 56 57 58 59 60 61 62 63 64 65 66
    bool useCumulativeUndoRedo();
    void setCumulativeUndoRedo(bool value);

    double stackT1();
    void setStackT1(int T1);

    double stackT2();
    void setStackT2(int T2);

    int stackN();
    void setStackN(int N);


Boudewijn Rempt's avatar
Boudewijn Rempt committed
67
    qint32 defImageWidth() const;
68
    void defImageWidth(qint32 width) const;
69

Boudewijn Rempt's avatar
Boudewijn Rempt committed
70
    qint32 defImageHeight() const;
71
    void defImageHeight(qint32 height) const;
72

Boudewijn Rempt's avatar
Boudewijn Rempt committed
73
    double defImageResolution() const;
74
    void defImageResolution(double res) const;
75

76 77 78
    bool defAutoFrameBreakEnabled() const;
    void defAutoFrameBreakEnabled(bool state) const;

79 80 81
    bool defOnionSkinningEnabled() const;
    void defOnionSkinningEnabled(bool state) const;

82 83 84
    int defFps() const;
    void defFps(int value) const;

85 86 87
    int defLocalPlaybackRange() const;
    void defLocalPlaybackRange(int value) const;

88 89 90
    bool defLoopingEnabled() const;
    void defLoopingEnabled(bool state) const;

91 92 93 94 95 96 97
    /**
     * @return the id of the default color model used for creating new images.
     */
    QString defColorModel() const;
    /**
     * set the id of the default color model used for creating new images.
     */
98
    void defColorModel(const QString & model) const;
99 100 101 102

    /**
     * @return the id of the default color depth used for creating new images.
     */
103
    QString defaultColorDepth() const;
104 105 106
    /**
     * set the id of the default color depth used for creating new images.
     */
107
    void setDefaultColorDepth(const QString & depth) const;
108 109 110 111 112 113 114 115

    /**
     * @return the id of the default color profile used for creating new images.
     */
    QString defColorProfile() const;
    /**
     * set the id of the default color profile used for creating new images.
     */
116
    void defColorProfile(const QString & depth) const;
117

118 119
    enumCursorStyle cursorStyle() const;
    enumCursorStyle getDefaultCursorStyle() const;
120
    void setCursorStyle(enumCursorStyle style) const;
121

122 123 124 125 126 127 128 129 130 131 132
    /// get the profile the user has selected for the given screen
    QString monitorProfile(int screen) const;
    void setMonitorProfile(int screen, const QString & monitorProfile, bool override) const;

    QString monitorForScreen(int screen, const QString &defaultMonitor) const;
    void setMonitorForScreen(int screen, const QString& monitor);

    /// Get the actual profile to be used for the given screen, which is
    /// either the screen profile set by the color management system or
    /// the custom monitor profile set by the user, depending on the configuration
    const KoColorProfile *displayProfile(int screen) const;
133

134
    QString workingColorSpace() const;
135
    void setWorkingColorSpace(const QString & workingColorSpace) const;
136

137
    QString importProfile() const;
138
    void setImportProfile(const QString & importProfile) const;
139

140
    QString printerColorSpace() const;
141
    void setPrinterColorSpace(const QString & printerColorSpace) const;
142

143
    QString printerProfile() const;
144
    void setPrinterProfile(const QString & printerProfile) const;
145

146
    bool useBlackPointCompensation() const;
147
    void setUseBlackPointCompensation(bool useBlackPointCompensation) const;
148

149 150 151
    bool allowLCMSOptimization() const;
    void setAllowLCMSOptimization(bool allowLCMSOptimization);

152
    bool showRulers() const;
153
    void setShowRulers(bool rulers) const;
154

Laurent Montel's avatar
Laurent Montel committed
155
    qint32 pasteBehaviour() const;
156
    void setPasteBehaviour(qint32 behaviour) const;
157

Laurent Montel's avatar
Laurent Montel committed
158
    qint32 renderIntent() const;
159
    void setRenderIntent(qint32 renderIntent) const;
160

161
    bool useOpenGL() const;
162
    void setUseOpenGL(bool useOpenGL) const;
163

164 165
    int openGLFilteringMode() const;
    void setOpenGLFilteringMode(int filteringMode);
166

167 168 169
    bool useOpenGLTextureBuffer() const;
    void setUseOpenGLTextureBuffer(bool useBuffer);

170 171 172 173 174 175 176 177
    bool disableDoubleBuffering() const;
    void setDisableDoubleBuffering(bool disableDoubleBuffering);

    bool disableVSync() const;
    void setDisableVSync(bool disableVSync);

    bool showAdvancedOpenGLSettings() const;

178 179
    bool forceOpenGLFenceWorkaround() const;

180 181 182 183
    int numMipmapLevels() const;
    int openGLTextureSize() const;
    int textureOverlapBorder() const;

Laurent Montel's avatar
Laurent Montel committed
184 185
    qint32 maxNumberOfThreads();
    void setMaxNumberOfThreads(qint32 numberOfThreads);
186

187
    /// Maximum tiles in memory (this is a guideline, not absolute)
Laurent Montel's avatar
Laurent Montel committed
188
    qint32 maxTilesInMem() const;
189
    void setMaxTilesInMem(qint32 tiles) const;
190

191 192
    quint32 getGridMainStyle() const;
    void setGridMainStyle(quint32 v) const;
193

194 195
    quint32 getGridSubdivisionStyle() const;
    void setGridSubdivisionStyle(quint32 v) const;
196

197 198
    QColor getGridMainColor() const;
    void setGridMainColor(const QColor & v) const;
199

200 201
    QColor getGridSubdivisionColor() const;
    void setGridSubdivisionColor(const QColor & v) const;
202

203 204
    quint32 getGridHSpacing() const;
    void setGridHSpacing(quint32 v) const;
205

206 207
    quint32 getGridVSpacing() const;
    void setGridVSpacing(quint32 v) const;
208

209 210
    bool getGridSpacingAspect() const;
    void setGridSpacingAspect(bool v) const;
211

212 213
    quint32 getGridSubdivisions() const;
    void setGridSubdivisions(quint32 v) const;
214

215 216
    quint32 getGridOffsetX() const;
    void setGridOffsetX(quint32 v) const;
217

218 219
    quint32 getGridOffsetY() const;
    void setGridOffsetY(quint32 v) const;
220

221 222
    bool getGridOffsetAspect() const;
    void setGridOffsetAspect(bool v) const;
223

224 225
    qint32 checkSize() const;
    void setCheckSize(qint32 checkSize) const;
226 227

    bool scrollCheckers() const;
228
    void setScrollingCheckers(bool scollCheckers) const;
229

230 231
    QColor checkersColor1() const;
    void setCheckersColor1(const QColor & v) const;
232

233 234
    QColor checkersColor2() const;
    void setCheckersColor2(const QColor & v) const;
235

236 237
    QColor canvasBorderColor() const;
    void setCanvasBorderColor(const QColor &color) const;
238

239 240 241
    bool hideScrollbars() const;
    void setHideScrollbars(bool value) const;

242 243
    bool antialiasCurves() const;
    void setAntialiasCurves(bool v) const;
244

245 246 247
    QColor selectionOverlayMaskColor() const;
    void setSelectionOverlayMaskColor(const QColor &color);

248 249 250
    bool antialiasSelectionOutline() const;
    void setAntialiasSelectionOutline(bool v) const;

251 252
    bool showRootLayer() const;
    void setShowRootLayer(bool showRootLayer) const;
253

254 255 256
    bool showGlobalSelection() const;
    void setShowGlobalSelection(bool showGlobalSelection) const;

257 258
    bool showOutlineWhilePainting() const;
    void setShowOutlineWhilePainting(bool showOutlineWhilePainting) const;
259

260 261 262
    qreal outlineSizeMinimum() const;
    void setOutlineSizeMinimum(qreal outlineSizeMinimum) const;

263 264
    int autoSaveInterval() const;
    void setAutoSaveInterval(int seconds) const;
265

266 267
    bool backupFile() const;
    void setBackupFile(bool backupFile) const;
268

269 270
    bool showFilterGallery() const;
    void setShowFilterGallery(bool showFilterGallery) const;
271

272 273
    bool showFilterGalleryLayerMaskDialog() const;
    void setShowFilterGalleryLayerMaskDialog(bool showFilterGallery) const;
274

275 276
    QString defaultPainterlyColorModelId() const;
    void setDefaultPainterlyColorModelId(const QString& def) const;
277

278 279
    QString defaultPainterlyColorDepthId() const;
    void setDefaultPainterlyColorDepthId(const QString& def) const;
280

281 282
    // OPENGL_SUCCESS, TRY_OPENGL, OPENGL_NOT_TRIED, OPENGL_FAILED
    QString canvasState() const;
283
    void setCanvasState(const QString& state) const;
284

285
    bool paintopPopupDetached() const;
286
    void setPaintopPopupDetached(bool detached) const;
287

288 289
    QString pressureTabletCurve() const;
    void setPressureTabletCurve(const QString& curveString) const;
290

291 292
    qreal vastScrolling() const;
    void setVastScrolling(const qreal factor) const;
293

294
    int presetChooserViewMode() const;
295
    void setPresetChooserViewMode(const int mode) const;
296

297 298 299
    bool firstRun() const;
    void setFirstRun(const bool firstRun) const;

300 301
    bool clicklessSpacePan() const;
    void setClicklessSpacePan(const bool toggle) const;
302

303 304 305 306 307 308
    int horizontalSplitLines() const;
    void setHorizontalSplitLines(const int numberLines) const;

    int verticalSplitLines() const;
    void setVerticalSplitLines(const int numberLines) const;

309
    int hideDockersFullscreen() const;
310
    void setHideDockersFullscreen(const int value) const;
311

312 313 314
    bool showDockerTitleBars() const;
    void setShowDockerTitleBars(const bool value) const;

315
    int hideMenuFullscreen() const;
316 317
    void setHideMenuFullscreen(const int value) const;

318
    int hideScrollbarsFullscreen() const;
319 320
    void setHideScrollbarsFullscreen(const int value) const;

321
    int hideStatusbarFullscreen() const;
322 323
    void setHideStatusbarFullscreen(const int value) const;

324
    int hideTitlebarFullscreen() const;
325 326
    void setHideTitlebarFullscreen(const int value) const;

327
    int hideToolbarFullscreen() const;
328
    void setHideToolbarFullscreen(const int value) const;
329 330

    QStringList favoriteCompositeOps() const;
331
    void setFavoriteCompositeOps(const QStringList& compositeOps) const;
332

333
    QString exportConfiguration(const QString &filterId) const;
334
    void setExportConfiguration(const QString &filterId, const KisPropertiesConfiguration &properties) const;
335

336 337
    bool useOcio() const;
    void setUseOcio(bool useOCIO) const;
338

339 340 341
    int favoritePresets() const;
    void setFavoritePresets(const int value);

342 343 344 345 346 347 348 349 350

    enum OcioColorManagementMode {
        INTERNAL = 0,
        OCIO_CONFIG,
        OCIO_ENVIRONMENT
    };

    OcioColorManagementMode ocioColorManagementMode() const;
    void setOcioColorManagementMode(OcioColorManagementMode mode) const;
351

352 353
    QString ocioConfigurationPath() const;
    void setOcioConfigurationPath(const QString &path) const;
354

355 356
    QString ocioLutPath() const;
    void setOcioLutPath(const QString &path) const;
Boudewijn Rempt's avatar
Boudewijn Rempt committed
357

358 359 360
    int ocioLutEdgeSize() const;
    void setOcioLutEdgeSize(int value);

361 362 363
    bool ocioLockColorVisualRepresentation() const;
    void setOcioLockColorVisualRepresentation(bool value);

364
    bool useSystemMonitorProfile() const;
365
    void setUseSystemMonitorProfile(bool _useSystemMonitorProfile) const;
366

367 368
    QString defaultPalette() const;
    void setDefaultPalette(const QString& name) const;
369

370 371 372
    QString toolbarSlider(int sliderNumber);
    void setToolbarSlider(int sliderNumber, const QString &slider);

373 374 375
    bool sliderLabels() const;
    void setSliderLabels(bool enabled);

376 377 378
    QString currentInputProfile() const;
    void setCurrentInputProfile(const QString& name);

379 380 381 382 383
    bool presetStripVisible() const;
    void setPresetStripVisible(bool visible);

    bool scratchpadVisible() const;
    void setScratchpadVisible(bool visible);
384 385 386 387

    bool showSingleChannelAsColor() const;
    void setShowSingleChannelAsColor(bool asColor);

388 389 390
    bool hidePopups() const;
    void setHidePopups(bool hidepopups);

391 392 393
    int numDefaultLayers() const;
    void setNumDefaultLayers(int num);

394 395 396 397 398 399 400
    quint8 defaultBackgroundOpacity() const;
    void setDefaultBackgroundOpacity(quint8 value);

    QColor defaultBackgroundColor() const;
    void setDefaultBackgroundColor(QColor value);

    enum BackgroundStyle {
401 402
        LAYER = 0,
        PROJECTION = 1
403 404 405 406 407
    };

    BackgroundStyle defaultBackgroundStyle() const;
    void setDefaultBackgroundStyle(BackgroundStyle value);
    
408 409 410 411 412 413 414 415 416 417 418 419
    int lineSmoothingType() const;
    void setLineSmoothingType(int value);

    qreal lineSmoothingDistance() const;
    void setLineSmoothingDistance(qreal value);

    qreal lineSmoothingTailAggressiveness() const;
    void setLineSmoothingTailAggressiveness(qreal value);

    bool lineSmoothingSmoothPressure() const;
    void setLineSmoothingSmoothPressure(bool value);

420 421 422
    bool lineSmoothingScalableDistance() const;
    void setLineSmoothingScalableDistance(bool value);

423 424 425 426 427 428 429 430 431
    qreal lineSmoothingDelayDistance() const;
    void setLineSmoothingDelayDistance(qreal value);

    bool lineSmoothingUseDelayDistance() const;
    void setLineSmoothingUseDelayDistance(bool value);

    bool lineSmoothingFinishStabilizedCurve() const;
    void setLineSmoothingFinishStabilizedCurve(bool value);

432 433 434
    bool lineSmoothingStabilizeSensors() const;
    void setLineSmoothingStabilizeSensors(bool value);

435 436 437
    int paletteDockerPaletteViewSectionSize() const;
    void setPaletteDockerPaletteViewSectionSize(int value) const;

438 439 440 441 442 443 444 445 446
    int tabletEventsDelay() const;
    void setTabletEventsDelay(int value);

    bool testingAcceptCompressedTabletEvents() const;
    void setTestingAcceptCompressedTabletEvents(bool value);

    bool testingCompressBrushEvents() const;
    void setTestingCompressBrushEvents(bool value);

447 448 449
    const KoColorSpace* customColorSelectorColorSpace() const;
    void setCustomColorSelectorColorSpace(const KoColorSpace *cs);

450 451 452
    bool useDirtyPresets() const;
    void setUseDirtyPresets(bool value);

453 454
    bool useEraserBrushSize() const;
    void setUseEraserBrushSize(bool value);    
455 456 457 458 459 460 461

    QColor getMDIBackgroundColor() const;
    void setMDIBackgroundColor(const QColor & v) const;

    QString getMDIBackgroundImage() const;
    void setMDIBackgroundImage(const QString & fileName) const;

462 463
    bool useVerboseOpenGLDebugOutput() const;

464 465
    int workaroundX11SmoothPressureSteps() const;

466 467 468
    bool showCanvasMessages() const;
    void setShowCanvasMessages(bool show);

469 470 471 472
    template<class T>
    void writeEntry(const QString& name, const T& value) {
        m_cfg.writeEntry(name, value);
    }
473

474 475 476 477
    template<class T>
    void writeList(const QString& name, const QList<T>& value) {
        m_cfg.writeEntry(name, value);
    }
478

479 480 481 482
    template<class T>
    T readEntry(const QString& name, const T& defaultValue=T()) {
        return m_cfg.readEntry(name, defaultValue);
    }
483

484 485 486 487
    template<class T>
    QList<T> readList(const QString& name, const QList<T>& defaultValue=QList<T>()) {
        return m_cfg.readEntry(name, defaultValue);
    }
488

489
private:
490
    KisConfig(const KisConfig&);
491
    KisConfig& operator=(const KisConfig&) const;
492

493 494 495
    /// get the profile the color managment system has stored for the given screen
    static const KoColorProfile* getScreenProfile(int screen);

496
private:
Adrian Page's avatar
Adrian Page committed
497
    mutable KConfigGroup m_cfg;
498 499
};

500
#endif // KIS_CONFIG_H_