1 #pragma once
2 
3 #ifndef PREFERENCES_H
4 #define PREFERENCES_H
5 
6 #include <memory>
7 
8 // TnzCore includes
9 #include "tcommon.h"
10 #include "tgeometry.h"
11 #include "tpixel.h"
12 
13 // TnzLib includes
14 #include "toonz/levelproperties.h"
15 #include "toonz/preferencesitemids.h"
16 
17 // Qt includes
18 #include <QString>
19 #include <QObject>
20 #include <QMap>
21 #include <QRegExp>
22 #include <QVariant>
23 #include <QDataStream>
24 
25 #undef DVAPI
26 #undef DVVAR
27 #ifdef TOONZLIB_EXPORTS
28 #define DVAPI DV_EXPORT_API
29 #define DVVAR DV_EXPORT_VAR
30 #else
31 #define DVAPI DV_IMPORT_API
32 #define DVVAR DV_IMPORT_VAR
33 #endif
34 
35 //==============================================================
36 
37 //    Forward declarations
38 
39 class TFilePath;
40 class QSettings;
41 
42 //==============================================================
43 
44 //**********************************************************************************
45 //    Preferences  declaration
46 //**********************************************************************************
47 
48 class Preferences;
49 typedef void (Preferences::*OnEditedFunc)();
50 class DVAPI PreferencesItem final {
51 public:
52   QString idString;
53   QMetaType::Type type;
54   QVariant value;
55   QVariant min              = 0;
56   QVariant max              = -1;
57   OnEditedFunc onEditedFunc = nullptr;
58 
59   PreferencesItem(QString _idString, QMetaType::Type _type, QVariant _value,
60                   QVariant _min = 0, QVariant _max = -1,
61                   OnEditedFunc _onEditedFunc = nullptr)
idString(_idString)62       : idString(_idString)
63       , type(_type)
64       , value(_value)
65       , min(_min)
66       , max(_max)
67       , onEditedFunc(_onEditedFunc) {}
PreferencesItem()68   PreferencesItem() {}
69 };
70 
71 class DVAPI Preferences final : public QObject  // singleton
72 {
73   Q_OBJECT
74 
75 public:
76   struct LevelFormat {
77     QString m_name;  //!< Name displayed for the format.
78     QRegExp
79         m_pathFormat;  //!< <TT>[default: ".*"]</TT>Used to recognize levels in
80                        //!  the format. It's case <I>in</I>sensitive.
81     LevelOptions m_options;  //!< Options associated to levels in the format.
82     int m_priority;  //!< <TT>[default: 1]</TT> Priority value for the format.
83     //!  Higher priority means that the format is matched first.
84   public:
85     LevelFormat(const QString &name = QString())
m_nameLevelFormat86         : m_name(name)
87         , m_pathFormat(".*", Qt::CaseInsensitive)
88         , m_priority(1) {}
89 
90     bool matches(const TFilePath &fp) const;
91   };
92 
93   enum ColumnIconLoadingPolicy {
94     LoadAtOnce,  /**< it tells to load and display column icon
95                             \b at \b once when the scene is opened;      */
96     LoadOnDemand /**< it tells to load display icon \b on
97                             \b demand (generally by clicking on the column
98                     header)     */
99   };
100 
101   enum SnappingTarge { SnapStrokes, SnapGuides, SnapAll };
102 
103   enum PathAliasPriority {
104     ProjectFolderAliases = 0,
105     SceneFolderAlias,
106     ProjectFolderOnly
107   };
108 
109   enum FunctionEditorToggle {
110     ShowGraphEditorInPopup = 0,
111     ShowFunctionSpreadsheetInPopup,
112     ToggleBetweenGraphAndSpreadsheet
113   };
114 
115   //--- callbacks
116   // General
117   void enableAutosave();
118   void setAutosavePeriod();
119   void setUndoMemorySize();
120   // Interface
121   void setPixelsOnly();
122   void setUnits();
123   void setCameraUnits();
124   // Saving
125   void setRasterBackgroundColor();
126 
127 public:
128   static Preferences *instance();
129 
130   QMap<PreferencesItemId, PreferencesItem> m_items;
131   void initializeOptions();
132   void definePreferenceItems();
133   void define(PreferencesItemId id, QString idString, QMetaType::Type type,
134               QVariant defaultValue, QVariant min = 0, QVariant max = -1);
135 
136   void setCallBack(const PreferencesItemId id, OnEditedFunc func);
137   void resolveCompatibility();
138 
139   PreferencesItem &getItem(const PreferencesItemId id);
140   bool getBoolValue(const PreferencesItemId id) const;
141   int getIntValue(const PreferencesItemId id) const;
142   double getDoubleValue(const PreferencesItemId id) const;
143   QString getStringValue(const PreferencesItemId id) const;
144   TPixel getColorValue(const PreferencesItemId id) const;
145   TDimension getSizeValue(const PreferencesItemId id) const;
146 
147   void setValue(const PreferencesItemId id, QVariant value,
148                 bool saveToFile = true);
149 
150   // General settings  tab
isDefaultViewerEnabled()151   bool isDefaultViewerEnabled() const {
152     return getBoolValue(defaultViewerEnabled);
153   }
isRasterOptimizedMemory()154   bool isRasterOptimizedMemory() const {
155     return getBoolValue(rasterOptimizedMemory);
156   }
isAutosaveEnabled()157   bool isAutosaveEnabled() const { return getBoolValue(autosaveEnabled); }
getAutosavePeriod()158   int getAutosavePeriod() const {
159     return getIntValue(autosavePeriod);
160   }  // minutes
isAutosaveSceneEnabled()161   bool isAutosaveSceneEnabled() const {
162     return getBoolValue(autosaveSceneEnabled);
163   }
isAutosaveOtherFilesEnabled()164   bool isAutosaveOtherFilesEnabled() const {
165     return getBoolValue(autosaveOtherFilesEnabled);
166   }
isStartupPopupEnabled()167   bool isStartupPopupEnabled() { return getBoolValue(startupPopupEnabled); }
getUndoMemorySize()168   int getUndoMemorySize() const { return getIntValue(undoMemorySize); }
getDefaultTaskChunkSize()169   int getDefaultTaskChunkSize() const { return getIntValue(taskchunksize); }
isReplaceAfterSaveLevelAsEnabled()170   bool isReplaceAfterSaveLevelAsEnabled() const {
171     return getBoolValue(replaceAfterSaveLevelAs);
172   }
isBackupEnabled()173   bool isBackupEnabled() const { return getBoolValue(backupEnabled); }
getBackupKeepCount()174   int getBackupKeepCount() { return getIntValue(backupKeepCount); }
isSceneNumberingEnabled()175   bool isSceneNumberingEnabled() const {
176     return getBoolValue(sceneNumberingEnabled);
177   }
isWatchFileSystemEnabled()178   bool isWatchFileSystemEnabled() {
179     return getBoolValue(watchFileSystemEnabled);
180   }
getProjectRoot()181   int getProjectRoot() { return getIntValue(projectRoot); }
getCustomProjectRoot()182   QString getCustomProjectRoot() { return getStringValue(customProjectRoot); }
getPathAliasPriority()183   PathAliasPriority getPathAliasPriority() const {
184     return PathAliasPriority(getIntValue(pathAliasPriority));
185   }
186 
187   // Interface  tab
getStyleSheetList()188   QStringList getStyleSheetList() const { return m_styleSheetList; }
getIconTheme()189   bool getIconTheme() const { return getBoolValue(iconTheme); }
190   void storeOldUnits();  // OK
191   void resetOldUnits();  // OK
getLanguageList()192   QStringList getLanguageList() const { return m_languageList; }
getRoomMap()193   QMap<int, QString> getRoomMap() const { return m_roomMaps; }
194 
195   QString getCurrentStyleSheet() const;
getAdditionalStyleSheet()196   QString getAdditionalStyleSheet() const {
197     return getStringValue(additionalStyleSheet);
198   }
getPixelsOnly()199   bool getPixelsOnly() const { return getBoolValue(pixelsOnly); }
getOldUnits()200   QString getOldUnits() const { return getStringValue(oldUnits); }
getOldCameraUnits()201   QString getOldCameraUnits() const { return getStringValue(oldCameraUnits); }
getUnits()202   QString getUnits() const { return getStringValue(linearUnits); }
getCameraUnits()203   QString getCameraUnits() const { return getStringValue(cameraUnits); }
getCurrentRoomChoice()204   QString getCurrentRoomChoice() const {
205     return getStringValue(CurrentRoomChoice);
206   }
getFunctionEditorToggle()207   FunctionEditorToggle getFunctionEditorToggle() {
208     return FunctionEditorToggle(getIntValue(functionEditorToggle));
209   }
isMoveCurrentEnabled()210   bool isMoveCurrentEnabled() const {
211     return getBoolValue(moveCurrentFrameByClickCellArea);
212   }
isActualPixelViewOnSceneEditingModeEnabled()213   bool isActualPixelViewOnSceneEditingModeEnabled() const {
214     return getBoolValue(actualPixelViewOnSceneEditingMode);
215   }
isLevelNameOnEachMarkerEnabled()216   bool isLevelNameOnEachMarkerEnabled() const {
217     return getBoolValue(levelNameOnEachMarkerEnabled);
218   }
isShowRasterImagesDarkenBlendedInViewerEnabled()219   bool isShowRasterImagesDarkenBlendedInViewerEnabled() const {
220     return getBoolValue(showRasterImagesDarkenBlendedInViewer);
221   }
isShowFrameNumberWithLettersEnabled()222   bool isShowFrameNumberWithLettersEnabled() const {
223     return getBoolValue(showFrameNumberWithLetters);
224   }
getIconSize()225   TDimension getIconSize() const { return getSizeValue(iconSize); }
getViewValues(int & shrink,int & step)226   void getViewValues(int &shrink, int &step) const {
227     shrink = getIntValue(viewShrink), step = getIntValue(viewStep);
228   }
getViewerZoomCenter()229   int getViewerZoomCenter() const { return getIntValue(viewerZoomCenter); }
230   QString getCurrentLanguage() const;
getInterfaceFont()231   QString getInterfaceFont() { return getStringValue(interfaceFont); }
getInterfaceFontStyle()232   QString getInterfaceFontStyle() { return getStringValue(interfaceFontStyle); }
isColorCalibrationEnabled()233   bool isColorCalibrationEnabled() const {
234     return getBoolValue(colorCalibrationEnabled);
235   }
236   void setColorCalibrationLutPath(QString monitorName, QString path);
237   QString getColorCalibrationLutPath(QString &monitorName) const;
238 
239   // Visualization  tab
getShow0ThickLines()240   bool getShow0ThickLines() const { return getBoolValue(show0ThickLines); }
getRegionAntialias()241   bool getRegionAntialias() const { return getBoolValue(regionAntialias); }
242 
243   // Loading  tab
getDefaultImportPolicy()244   int getDefaultImportPolicy() { return getIntValue(importPolicy); }
isAutoExposeEnabled()245   bool isAutoExposeEnabled() const { return getBoolValue(autoExposeEnabled); }
isSubsceneFolderEnabled()246   bool isSubsceneFolderEnabled() const {
247     return getBoolValue(subsceneFolderEnabled);
248   }
isRemoveSceneNumberFromLoadedLevelNameEnabled()249   bool isRemoveSceneNumberFromLoadedLevelNameEnabled() const {
250     return getBoolValue(removeSceneNumberFromLoadedLevelName);
251   }
isIgnoreImageDpiEnabled()252   bool isIgnoreImageDpiEnabled() const { return getBoolValue(IgnoreImageDpi); }
getInitialLoadTlvCachingBehavior()253   int getInitialLoadTlvCachingBehavior() const {
254     return getIntValue(initialLoadTlvCachingBehavior);
255   }
getColumnIconLoadingPolicy()256   ColumnIconLoadingPolicy getColumnIconLoadingPolicy() const {
257     return ColumnIconLoadingPolicy(getIntValue(columnIconLoadingPolicy));
258   }
259 
260   int addLevelFormat(const LevelFormat &format);  //!< Inserts a new level
261                                                   //! format.  \return  The
262                                                   //! associated format index.
263   void removeLevelFormat(int formatIdx);          //!< Removes a level format.
264   const LevelFormat &levelFormat(
265       int formatIdx) const;  //!< Retrieves a level format.
266   int levelFormatsCount()
267       const;  //!< Returns the number of stored level formats.
268   /*! \return     Either the index of a matching format, or \p -1 if none
269   was found.                                                        */
270   int matchLevelFormat(const TFilePath &fp)
271       const;  //!< Returns the \a nonnegative index of the first level format
272               //!  matching the specified file path, <I>or \p -1 if none</I>.
273 
274   // Saving tab
getRasterBackgroundColor()275   TPixel getRasterBackgroundColor() const {
276     return getColorValue(rasterBackgroundColor);
277   }
278 
279   // Import Export Tab
getFfmpegPath()280   QString getFfmpegPath() const { return getStringValue(ffmpegPath); }
getFfmpegTimeout()281   int getFfmpegTimeout() { return getIntValue(ffmpegTimeout); }
getFastRenderPath()282   QString getFastRenderPath() const { return getStringValue(fastRenderPath); }
283 
284   // Drawing  tab
getScanLevelType()285   QString getScanLevelType() const { return getStringValue(scanLevelType); }
getDefLevelType()286   int getDefLevelType() const { return getIntValue(DefLevelType); }
isNewLevelSizeToCameraSizeEnabled()287   bool isNewLevelSizeToCameraSizeEnabled() const {
288     return getBoolValue(newLevelSizeToCameraSizeEnabled);
289   }
getDefLevelWidth()290   double getDefLevelWidth() const { return getDoubleValue(DefLevelWidth); }
getDefLevelHeight()291   double getDefLevelHeight() const { return getDoubleValue(DefLevelHeight); }
getDefLevelDpi()292   double getDefLevelDpi() const { return getDoubleValue(DefLevelDpi); }
isAutoCreateEnabled()293   bool isAutoCreateEnabled() const { return getBoolValue(EnableAutocreation); }
getNumberingSystem()294   int getNumberingSystem() const { return getIntValue(NumberingSystem); }
isAutoStretchEnabled()295   bool isAutoStretchEnabled() const { return getBoolValue(EnableAutoStretch); }
isCreationInHoldCellsEnabled()296   bool isCreationInHoldCellsEnabled() const {
297     return getBoolValue(EnableCreationInHoldCells);
298   }
isAutorenumberEnabled()299   bool isAutorenumberEnabled() const {
300     return getBoolValue(EnableAutoRenumber);
301   }
getVectorSnappingTarget()302   int getVectorSnappingTarget() { return getIntValue(vectorSnappingTarget); }
isSaveUnpaintedInCleanupEnable()303   bool isSaveUnpaintedInCleanupEnable() const {
304     return getBoolValue(saveUnpaintedInCleanup);
305   }
isMinimizeSaveboxAfterEditing()306   bool isMinimizeSaveboxAfterEditing() const {
307     return getBoolValue(minimizeSaveboxAfterEditing);
308   }
isUseNumpadForSwitchingStylesEnabled()309   bool isUseNumpadForSwitchingStylesEnabled() const {
310     return getBoolValue(useNumpadForSwitchingStyles);
311   }
getDownArrowLevelStripNewFrame()312   bool getDownArrowLevelStripNewFrame() {
313     return getBoolValue(downArrowInLevelStripCreatesNewFrame);
314   }
getKeepFillOnVectorSimplify()315   bool getKeepFillOnVectorSimplify() {
316     return getBoolValue(keepFillOnVectorSimplify);
317   }
getUseHigherDpiOnVectorSimplify()318   bool getUseHigherDpiOnVectorSimplify() {
319     return getBoolValue(useHigherDpiOnVectorSimplify);
320   }
321 
322   // Tools Tab
getDropdownShortcutsCycleOptions()323   bool getDropdownShortcutsCycleOptions() {
324     return getIntValue(dropdownShortcutsCycleOptions) == 1;
325   }
getFillOnlySavebox()326   bool getFillOnlySavebox() const { return getBoolValue(FillOnlysavebox); }
isMultiLayerStylePickerEnabled()327   bool isMultiLayerStylePickerEnabled() const {
328     return getBoolValue(multiLayerStylePickerEnabled);
329   }
getCursorBrushType()330   QString getCursorBrushType() const { return getStringValue(cursorBrushType); }
getCursorBrushStyle()331   QString getCursorBrushStyle() const {
332     return getStringValue(cursorBrushStyle);
333   }
isCursorOutlineEnabled()334   bool isCursorOutlineEnabled() const {
335     return getBoolValue(cursorOutlineEnabled);
336   }
getLevelBasedToolsDisplay()337   int getLevelBasedToolsDisplay() const {
338     return getIntValue(levelBasedToolsDisplay);
339   }
useCtrlAltToResizeBrushEnabled()340   bool useCtrlAltToResizeBrushEnabled() const {
341     return getBoolValue(useCtrlAltToResizeBrush);
342   }
getTempToolSwitchTimer()343   int getTempToolSwitchTimer() const {
344     return getIntValue(tempToolSwitchTimer);
345   }
346 
347   // Xsheet  tab
getXsheetLayoutPreference()348   QString getXsheetLayoutPreference() const {
349     return getStringValue(xsheetLayoutPreference);
350   }
getLoadedXsheetLayout()351   QString getLoadedXsheetLayout() const {
352     return getStringValue(xsheetLayoutPreference);
353   }
getXsheetStep()354   int getXsheetStep() const {
355     return getIntValue(xsheetStep);
356   }  //!< Returns the step used for the <I>next/prev step</I> commands.
isXsheetAutopanEnabled()357   bool isXsheetAutopanEnabled() const {
358     return getBoolValue(xsheetAutopanEnabled);
359   }  //!< Returns whether xsheet pans during playback.
getDragCellsBehaviour()360   int getDragCellsBehaviour() const { return getIntValue(DragCellsBehaviour); }
isIgnoreAlphaonColumn1Enabled()361   bool isIgnoreAlphaonColumn1Enabled() const {
362     return getBoolValue(ignoreAlphaonColumn1Enabled);
363   }
isShowKeyframesOnXsheetCellAreaEnabled()364   bool isShowKeyframesOnXsheetCellAreaEnabled() const {
365     return getBoolValue(showKeyframesOnXsheetCellArea);
366   }
isXsheetCameraColumnEnabled()367   bool isXsheetCameraColumnEnabled() const {
368     return getBoolValue(showXsheetCameraColumn);
369   }
isUseArrowKeyToShiftCellSelectionEnabled()370   bool isUseArrowKeyToShiftCellSelectionEnabled() const {
371     return getBoolValue(useArrowKeyToShiftCellSelection);
372   }
isInputCellsWithoutDoubleClickingEnabled()373   bool isInputCellsWithoutDoubleClickingEnabled() const {
374     return getBoolValue(inputCellsWithoutDoubleClickingEnabled);
375   }
isShortcutCommandsWhileRenamingCellEnabled()376   bool isShortcutCommandsWhileRenamingCellEnabled() const {
377     return getBoolValue(shortcutCommandsWhileRenamingCellEnabled);
378   }
isShowXSheetToolbarEnabled()379   bool isShowXSheetToolbarEnabled() const {
380     return getBoolValue(showXSheetToolbar);
381   }
isExpandFunctionHeaderEnabled()382   bool isExpandFunctionHeaderEnabled() const {
383     return getBoolValue(expandFunctionHeader);
384   }
isShowColumnNumbersEnabled()385   bool isShowColumnNumbersEnabled() const {
386     return getBoolValue(showColumnNumbers);
387   }
isSyncLevelRenumberWithXsheetEnabled()388   bool isSyncLevelRenumberWithXsheetEnabled() const {
389     return getBoolValue(syncLevelRenumberWithXsheet);
390   }
isCurrentTimelineIndicatorEnabled()391   bool isCurrentTimelineIndicatorEnabled() const {
392     return getBoolValue(currentTimelineEnabled);
393   }
getCurrentColumnData(TPixel & color)394   void getCurrentColumnData(TPixel &color) const {
395     color = getColorValue(currentColumnColor);
396   }
397 
398   // Animation  tab
getKeyframeType()399   int getKeyframeType() const { return getIntValue(keyframeType); }
getAnimationStep()400   int getAnimationStep() const { return getIntValue(animationStep); }
isModifyExpressionOnMovingReferencesEnabled()401   bool isModifyExpressionOnMovingReferencesEnabled() const {
402     return getBoolValue(modifyExpressionOnMovingReferences);
403   }
404 
405   // Preview  tab
getBlankValues(int & bCount,TPixel32 & bColor)406   void getBlankValues(int &bCount, TPixel32 &bColor) const {
407     bCount = getIntValue(blanksCount), bColor = getColorValue(blankColor);
408   }
rewindAfterPlaybackEnabled()409   bool rewindAfterPlaybackEnabled() const {
410     return getBoolValue(rewindAfterPlayback);
411   }
getShortPlayFrameCount()412   int getShortPlayFrameCount() const {
413     return getIntValue(shortPlayFrameCount);
414   }
previewAlwaysOpenNewFlipEnabled()415   bool previewAlwaysOpenNewFlipEnabled() const {
416     return getBoolValue(previewAlwaysOpenNewFlip);
417   }
fitToFlipbookEnabled()418   bool fitToFlipbookEnabled() const { return getBoolValue(fitToFlipbook); }
isGeneratedMovieViewEnabled()419   bool isGeneratedMovieViewEnabled() const {
420     return getBoolValue(generatedMovieViewEnabled);
421   }
422 
423   // Onion Skin  tab
isOnionSkinEnabled()424   bool isOnionSkinEnabled() const { return getBoolValue(onionSkinEnabled); }
getOnionPaperThickness()425   int getOnionPaperThickness() const {
426     return getIntValue(onionPaperThickness);
427   }
428 
getOnionData(TPixel & frontColor,TPixel & backColor,bool & inksOnly)429   void getOnionData(TPixel &frontColor, TPixel &backColor,
430                     bool &inksOnly) const {
431     frontColor = getColorValue(frontOnionColor),
432     backColor  = getColorValue(backOnionColor),
433     inksOnly   = getBoolValue(onionInksOnly);
434   }
getOnionSkinDuringPlayback()435   bool getOnionSkinDuringPlayback() {
436     return getBoolValue(onionSkinDuringPlayback);
437   }
areOnionColorsUsedForShiftAndTraceGhosts()438   bool areOnionColorsUsedForShiftAndTraceGhosts() const {
439     return getBoolValue(useOnionColorsForShiftAndTraceGhosts);
440   }
getAnimatedGuidedDrawing()441   bool getAnimatedGuidedDrawing() const {
442     return getIntValue(animatedGuidedDrawing) == 1;
443   }
444 
445   // Colors  tab
getViewerBgColor()446   TPixel getViewerBgColor() const { return getColorValue(viewerBGColor); }
getPreviewBgColor()447   TPixel getPreviewBgColor() const { return getColorValue(previewBGColor); }
getLevelEditorBoxColor()448   TPixel getLevelEditorBoxColor() const {
449     return getColorValue(levelEditorBoxColor);
450   }
getChessboardColors(TPixel32 & col1,TPixel32 & col2)451   void getChessboardColors(TPixel32 &col1, TPixel32 &col2) const {
452     col1 = getColorValue(chessboardColor1);
453     col2 = getColorValue(chessboardColor2);
454   }
getTranspCheckData(TPixel & bg,TPixel & ink,TPixel & paint)455   void getTranspCheckData(TPixel &bg, TPixel &ink, TPixel &paint) const {
456     bg    = getColorValue(transpCheckInkOnBlack);
457     ink   = getColorValue(transpCheckInkOnWhite);
458     paint = getColorValue(transpCheckPaint);
459   }
460 
461   // Version Control  tab
isSVNEnabled()462   bool isSVNEnabled() const { return getBoolValue(SVNEnabled); }
isAutomaticSVNFolderRefreshEnabled()463   bool isAutomaticSVNFolderRefreshEnabled() const {
464     return getBoolValue(automaticSVNFolderRefreshEnabled);
465   }
isLatestVersionCheckEnabled()466   bool isLatestVersionCheckEnabled() const {
467     return getBoolValue(latestVersionCheckEnabled);
468   }
469 
470   // Tablet tab
isWinInkEnabled()471   bool isWinInkEnabled() const { return getBoolValue(winInkEnabled); }
isQtNativeWinInkEnabled()472   bool isQtNativeWinInkEnabled() const {
473     return getBoolValue(useQtNativeWinInk);
474   }
475 
476   // Others (not appeared in the popup)
477   // Shortcut popup settings
getShortcutPreset()478   QString getShortcutPreset() { return getStringValue(shortcutPreset); }
479   // Viewer context menu
isGuidedDrawingEnabled()480   bool isGuidedDrawingEnabled() { return getIntValue(guidedDrawingType) > 0; }
getGuidedDrawingType()481   int getGuidedDrawingType() { return getIntValue(guidedDrawingType); }
getGuidedAutoInbetween()482   bool getGuidedAutoInbetween() { return getBoolValue(guidedAutoInbetween); }
getGuidedInterpolation()483   int getGuidedInterpolation() { return getIntValue(guidedInterpolationType); }
484 #if defined(MACOSX) && defined(__LP64__)
getShmMax()485   int getShmMax() const {
486     return getIntValue(shmmax);
487   }  //! \sa The \p sysctl unix command.
getShmSeg()488   int getShmSeg() const {
489     return getIntValue(shmseg);
490   }  //! \sa The \p sysctl unix command.
getShmAll()491   int getShmAll() const {
492     return getIntValue(shmall);
493   }  //! \sa The \p sysctl unix command.
getShmMni()494   int getShmMni() const {
495     return getIntValue(shmmni);
496   }  //! \sa The \p sysctl unix command.
497 #endif
498 
499   void setPrecompute(bool enabled);
getPrecompute()500   bool getPrecompute() { return m_precompute; }
isAnimationSheetEnabled()501   bool isAnimationSheetEnabled() const {
502     return getIntValue(NumberingSystem) == 1;
503   }
isXsheetCameraColumnVisible()504   bool isXsheetCameraColumnVisible() const {
505     return getBoolValue(showXsheetCameraColumn) &&
506            getBoolValue(showKeyframesOnXsheetCellArea);
507   }
getTextureSize()508   int getTextureSize() const { return m_textureSize; }
useDrawPixel()509   bool useDrawPixel() { return m_textureSize == 0; }
getLayerNameEncoding()510   std::string getLayerNameEncoding() const { return m_layerNameEncoding; };
511 
512 Q_SIGNALS:
513 
514   void stopAutoSave();
515   void startAutoSave();
516   void autoSavePeriodChanged();
517 
518 private:
519   std::unique_ptr<QSettings> m_settings;
520 
521   QStringList m_languageList, m_styleSheetList;
522   QMap<int, QString> m_roomMaps;
523 
524   std::vector<LevelFormat> m_levelFormats;
525 
526   bool m_precompute = true;
527   int m_textureSize = 0;
528 
529   std::string m_layerNameEncoding = "SJIS";  // Fixed to SJIS for now. You can
530 
531 private:
532   Preferences();
533   ~Preferences();
534 };
535 
536 #endif  // PREFERENCES_H
537