Skip to content

OpenToonz - An open-source full-featured 2D animation creation software

C

Overhaul the Preferences (#2894)

shun-iwasawa8fb291659894
diff --git a/toonz/sources/image/ffmpeg/tiio_ffmpeg.cpp b/toonz/sources/image/ffmpeg/tiio_ffmpeg.cpp
index 1c536524a..796543a51 100644
--- a/toonz/sources/image/ffmpeg/tiio_ffmpeg.cpp
+++ b/toonz/sources/image/ffmpeg/tiio_ffmpeg.cpp
@@ -33,7 +33,7 @@ bool Ffmpeg::checkFfmpeg() {
path = path + ".exe";
#endif
if (TSystem::doesExistFileOrLevel(TFilePath(path))) {
- Preferences::instance()->setFfmpegPath(QDir::currentPath().toStdString());
+ Preferences::instance()->setValue(ffmpegPath, QDir::currentPath());
return true;
}
@@ -55,7 +55,7 @@ bool Ffmpeg::checkFfprobe() {
path = path + ".exe";
#endif
if (TSystem::doesExistFileOrLevel(TFilePath(path))) {
- Preferences::instance()->setFfmpegPath(QDir::currentPath().toStdString());
+ Preferences::instance()->setValue(ffmpegPath, QDir::currentPath());
return true;
}
@@ -153,7 +153,7 @@ void Ffmpeg::runFfmpeg(QStringList preIArgs, QStringList postIArgs,
args << tempName;
}
if (m_hasSoundTrack) args = args + m_audioArgs;
- args = args + postIArgs;
+ args = args + postIArgs;
if (overWriteFiles && !includesOutPath) { // if includesOutPath is true, you
// need to include the overwrite in
// your postIArgs.
@@ -208,7 +208,7 @@ void Ffmpeg::saveSoundTrack(TSoundTrack *st) {
QString::fromStdString(m_path.getName()) + "tempOut.raw";
m_audioFormat = "s" + QString::number(m_bitsPerSample);
if (m_bitsPerSample > 8) m_audioFormat = m_audioFormat + "le";
- std::string strPath = m_audioPath.toStdString();
+ std::string strPath = m_audioPath.toStdString();
QByteArray data;
data.insert(0, (char *)buffer, bufSize);
diff --git a/toonz/sources/include/toonz/preferences.h b/toonz/sources/include/toonz/preferences.h
index 2f6572865..ba939e9ac 100644
--- a/toonz/sources/include/toonz/preferences.h
+++ b/toonz/sources/include/toonz/preferences.h
@@ -12,12 +12,15 @@
// TnzLib includes
#include "toonz/levelproperties.h"
+#include "toonz/preferencesitemids.h"
// Qt includes
#include <QString>
#include <QObject>
#include <QMap>
#include <QRegExp>
+#include <QVariant>
+#include <QDataStream>
#undef DVAPI
#undef DVVAR
@@ -42,9 +45,28 @@ class QSettings;
// Preferences declaration
//**********************************************************************************
-/*!
- \brief Stores application-wide preferences used throughout Toonz.
-*/
+class Preferences;
+typedef void (Preferences::*OnEditedFunc)();
+class DVAPI PreferencesItem final {
+public:
+ QString idString;
+ QMetaType::Type type;
+ QVariant value;
+ QVariant min = 0;
+ QVariant max = -1;
+ OnEditedFunc onEditedFunc = nullptr;
+
+ PreferencesItem(QString _idString, QMetaType::Type _type, QVariant _value,
+ QVariant _min = 0, QVariant _max = -1,
+ OnEditedFunc _onEditedFunc = nullptr)
+ : idString(_idString)
+ , type(_type)
+ , value(_value)
+ , min(_min)
+ , max(_max)
+ , onEditedFunc(_onEditedFunc) {}
+ PreferencesItem() {}
+};
class DVAPI Preferences final : public QObject // singleton
{
@@ -90,521 +112,373 @@ public:
ToggleBetweenGraphAndSpreadsheet
};
+ //--- callbacks
+ // General
+ void enableAutosave();
+ void setAutosavePeriod();
+ void setUndoMemorySize();
+ // Interface
+ void setPixelsOnly();
+ void setUnits();
+ void setCameraUnits();
+ // Saving
+ void setRasterBackgroundColor();
+
public:
static Preferences *instance();
- // General settings tab
-
- void setUndoMemorySize(int memorySize);
- int getUndoMemorySize() const { return m_undoMemorySize; }
-
- void setDefaultTaskChunkSize(int chunkSize);
- int getDefaultTaskChunkSize() const { return m_chunkSize; }
-
- void enableDefaultViewer(bool on);
- bool isDefaultViewerEnabled() const { return m_defaultViewerEnabled; }
+ QMap<PreferencesItemId, PreferencesItem> m_items;
+ void initializeOptions();
+ void definePreferenceItems();
+ void define(PreferencesItemId id, QString idString, QMetaType::Type type,
+ QVariant defaultValue, QVariant min = 0, QVariant max = -1);
- void enableRasterOptimizedMemory(bool on);
- bool isRasterOptimizedMemory() const { return m_rasterOptimizedMemory; }
+ void setCallBack(const PreferencesItemId id, OnEditedFunc func);
- void enableAutosave(bool on);
- bool isAutosaveEnabled() const { return m_autosaveEnabled; }
+ PreferencesItem &getItem(const PreferencesItemId id);
+ bool getBoolValue(const PreferencesItemId id) const;
+ int getIntValue(const PreferencesItemId id) const;
+ double getDoubleValue(const PreferencesItemId id) const;
+ QString getStringValue(const PreferencesItemId id) const;
+ TPixel getColorValue(const PreferencesItemId id) const;
+ TDimension getSizeValue(const PreferencesItemId id) const;
- void setAutosavePeriod(int minutes);
- int getAutosavePeriod() const { return m_autosavePeriod; } // minutes
+ void setValue(const PreferencesItemId id, QVariant value,
+ bool saveToFile = true);
- void enableAutosaveScene(bool on);
- bool isAutosaveSceneEnabled() const { return m_autosaveSceneEnabled; }
-
- void enableAutosaveOtherFiles(bool on);
+ // General settings tab
+ bool isDefaultViewerEnabled() const {
+ return getBoolValue(defaultViewerEnabled);
+ }
+ bool isRasterOptimizedMemory() const {
+ return getBoolValue(rasterOptimizedMemory);
+ }
+ bool isAutosaveEnabled() const { return getBoolValue(autosaveEnabled); }
+ int getAutosavePeriod() const {
+ return getIntValue(autosavePeriod);
+ } // minutes
+ bool isAutosaveSceneEnabled() const {
+ return getBoolValue(autosaveSceneEnabled);
+ }
bool isAutosaveOtherFilesEnabled() const {
- return m_autosaveOtherFilesEnabled;
+ return getBoolValue(autosaveOtherFilesEnabled);
}
-
- void enableBackup(bool enabled);
- bool isBackupEnabled() const { return m_backupEnabled; }
-
- void setBackupKeepCount(int count);
- int getBackupKeepCount() { return m_backupKeepCount; }
-
- void enableSceneNumbering(bool enabled);
- bool isSceneNumberingEnabled() const { return m_sceneNumberingEnabled; }
-
- void enableReplaceAfterSaveLevelAs(bool on);
+ bool isStartupPopupEnabled() { return getBoolValue(startupPopupEnabled); }
+ int getUndoMemorySize() const { return getIntValue(undoMemorySize); }
+ int getDefaultTaskChunkSize() const { return getIntValue(taskchunksize); }
bool isReplaceAfterSaveLevelAsEnabled() const {
- return m_replaceAfterSaveLevelAs;
+ return getBoolValue(replaceAfterSaveLevelAs);
}
-
- void enableStartupPopup(bool on);
- bool isStartupPopupEnabled() { return m_startupPopupEnabled; }
-
- void setProjectRoot(int index);
- int getProjectRoot() { return m_projectRoot; }
-
- void setCustomProjectRoot(std::wstring path);
- QString getCustomProjectRoot() { return m_customProjectRoot; }
-
- void enableWatchFileSystem(bool on);
- bool isWatchFileSystemEnabled() { return m_watchFileSystem; }
-
- void setPathAliasPriority(PathAliasPriority priority);
- PathAliasPriority getPathAliasPriority() const { return m_pathAliasPriority; }
-
- // Interface tab
-
- void setCurrentLanguage(const QString &currentLanguage);
- QString getCurrentLanguage() const;
- QString getLanguage(int index) const;
- int getLanguageCount() const;
-
- void setCurrentStyleSheet(const QString &currentStyleSheet);
- QString getCurrentStyleSheetName() const;
- QString getCurrentStyleSheetPath() const;
- QString getStyleSheet(int index) const;
- int getStyleSheetCount() const;
-
- void setPixelsOnly(bool state);
- bool getPixelsOnly() const { return m_pixelsOnly; }
-
- void storeOldUnits();
- void resetOldUnits();
- QString getOldUnits() const { return m_oldUnits; }
- QString getOldCameraUnits() const { return m_oldCameraUnits; }
-
- void setUnits(std::string s);
- QString getUnits() const { return m_units; }
-
- void setCameraUnits(std::string s);
- QString getCameraUnits() const { return m_cameraUnits; }
-
- void setCurrentRoomChoice(int currentRoomChoice);
- void setCurrentRoomChoice(QString currentRoomChoice);
- QString getCurrentRoomChoice() const;
- int getRoomChoiceCount() const;
- QString getRoomChoice(int index) const;
-
- void enableGeneratedMovieView(bool on);
- bool isGeneratedMovieViewEnabled() const {
- return m_generatedMovieViewEnabled;
+ bool isBackupEnabled() const { return getBoolValue(backupEnabled); }
+ int getBackupKeepCount() { return getIntValue(backupKeepCount); }
+ bool isSceneNumberingEnabled() const {
+ return getBoolValue(sceneNumberingEnabled);
}
-
- void setViewValues(int shrink, int step);
- void getViewValues(int &shrink, int &step) const {
- shrink = m_shrink, step = m_step;
+ bool isWatchFileSystemEnabled() {
+ return getBoolValue(watchFileSystemEnabled);
}
-
- void setIconSize(const TDimension &dim);
- TDimension getIconSize() const { return m_iconSize; }
-
- void setViewerBGColor(const TPixel32 &color, bool isDragging);
- TPixel getViewerBgColor() const { return m_viewerBGColor; }
-
- void setPreviewBGColor(const TPixel32 &color, bool isDragging);
- TPixel getPreviewBgColor() const { return m_previewBGColor; }
-
- void setLevelEditorBoxColor(const TPixel32 &color, bool isDragging);
- TPixel getLevelEditorBoxColor() const { return m_levelEditorBoxColor; }
-
- void setChessboardColor1(const TPixel32 &color, bool isDragging);
- void setChessboardColor2(const TPixel32 &color, bool isDragging);
- void getChessboardColors(TPixel32 &col1, TPixel32 &col2) const {
- col1 = m_chessboardColor1;
- col2 = m_chessboardColor2;
+ int getProjectRoot() { return getIntValue(projectRoot); }
+ QString getCustomProjectRoot() { return getStringValue(customProjectRoot); }
+ PathAliasPriority getPathAliasPriority() const {
+ return PathAliasPriority(getIntValue(pathAliasPriority));
}
- void enableShowRasterImagesDarkenBlendedInViewer(bool on);
- bool isShowRasterImagesDarkenBlendedInViewerEnabled() const {
- return m_showRasterImagesDarkenBlendedInViewer;
+ // Interface tab
+ QStringList getStyleSheetList() const { return m_styleSheetList; }
+ void storeOldUnits(); // OK
+ void resetOldUnits(); // OK
+ QStringList getLanguageList() const { return m_languageList; }
+ QMap<int, QString> getRoomMap() const { return m_roomMaps; }
+
+ QString getCurrentStyleSheetPath() const; // OK
+ bool getPixelsOnly() const { return getBoolValue(pixelsOnly); }
+ QString getOldUnits() const { return getStringValue(oldUnits); }
+ QString getOldCameraUnits() const { return getStringValue(oldCameraUnits); }
+ QString getUnits() const { return getStringValue(linearUnits); }
+ QString getCameraUnits() const { return getStringValue(cameraUnits); }
+ QString getCurrentRoomChoice() const {
+ return getStringValue(CurrentRoomChoice);
}
-
- void enableActualPixelViewOnSceneEditingMode(bool on);
- bool isActualPixelViewOnSceneEditingModeEnabled() const {
- return m_actualPixelViewOnSceneEditingMode;
+ FunctionEditorToggle getFunctionEditorToggle() {
+ return FunctionEditorToggle(getIntValue(functionEditorToggle));
}
-
- void setViewerZoomCenter(int type);
- int getViewerZoomCenter() const { return m_viewerZoomCenter; }
-
- void enableShowFrameNumberWithLetters(bool on);
- bool isShowFrameNumberWithLettersEnabled() const {
- return m_showFrameNumberWithLetters;
+ bool isMoveCurrentEnabled() const {
+ return getBoolValue(moveCurrentFrameByClickCellArea);
+ }
+ bool isActualPixelViewOnSceneEditingModeEnabled() const {
+ return getBoolValue(actualPixelViewOnSceneEditingMode);
}
- void enableLevelNameOnEachMarker(bool on);
bool isLevelNameOnEachMarkerEnabled() const {
- return m_levelNameOnEachMarker;
+ return getBoolValue(levelNameOnEachMarkerEnabled);
}
- void setColumnIconLoadingPolicy(ColumnIconLoadingPolicy cilp);
- ColumnIconLoadingPolicy getColumnIconLoadingPolicy() const {
- return (ColumnIconLoadingPolicy)m_columnIconLoadingPolicy;
+ bool isShowRasterImagesDarkenBlendedInViewerEnabled() const {
+ return getBoolValue(showRasterImagesDarkenBlendedInViewer);
}
- void enableMoveCurrent(bool on);
- bool isMoveCurrentEnabled() const {
- return m_moveCurrentFrameByClickCellArea;
+ bool isShowFrameNumberWithLettersEnabled() const {
+ return getBoolValue(showFrameNumberWithLetters);
}
-
- void setInterfaceFont(std::string font);
- QString getInterfaceFont() { return m_interfaceFont; }
- void setInterfaceFontStyle(std::string style);
- QString getInterfaceFontStyle() { return m_interfaceFontStyle; }
- void setInterfaceFontWeight(int weight);
- int getInterfaceFontWeight() { return m_interfaceFontWeight; }
-
- void setFunctionEditorToggle(FunctionEditorToggle status);
- FunctionEditorToggle getFunctionEditorToggle() {
- return m_functionEditorToggle;
+ TDimension getIconSize() const { return getSizeValue(iconSize); }
+ void getViewValues(int &shrink, int &step) const {
+ shrink = getIntValue(viewShrink), step = getIntValue(viewStep);
}
-
- // color calibration using 3DLUT
- void enableColorCalibration(bool on);
- bool isColorCalibrationEnabled() const { return m_colorCalibrationEnabled; }
- void setColorCalibrationLutPath(QString monitorName, QString path);
- QMap<QString, QString> &getColorCalibrationLutPathMap() {
- return m_colorCalibrationLutPaths;
+ int getViewerZoomCenter() const { return getIntValue(viewerZoomCenter); }
+ QString getCurrentLanguage() const;
+ QString getInterfaceFont() { return getStringValue(interfaceFont); }
+ QString getInterfaceFontStyle() { return getStringValue(interfaceFontStyle); }
+ bool isColorCalibrationEnabled() const {
+ return getBoolValue(colorCalibrationEnabled);
}
+ void setColorCalibrationLutPath(QString monitorName, QString path);
QString getColorCalibrationLutPath(QString &monitorName) const;
// Visualization tab
-
- void setShow0ThickLines(bool on);
- bool getShow0ThickLines() const { return m_show0ThickLines; }
-
- void setRegionAntialias(bool on);
- bool getRegionAntialias() const { return m_regionAntialias; }
+ bool getShow0ThickLines() const { return getBoolValue(show0ThickLines); }
+ bool getRegionAntialias() const { return getBoolValue(regionAntialias); }
// Loading tab
-
- void enableAutoExpose(bool on);
- bool isAutoExposeEnabled() const { return m_autoExposeEnabled; }
-
- void enableSubsceneFolder(bool on);
- bool isSubsceneFolderEnabled() const { return m_subsceneFolderEnabled; }
+ int getDefaultImportPolicy() { return getIntValue(importPolicy); }
+ bool isAutoExposeEnabled() const { return getBoolValue(autoExposeEnabled); }
+ bool isSubsceneFolderEnabled() const {
+ return getBoolValue(subsceneFolderEnabled);
+ }
+ bool isRemoveSceneNumberFromLoadedLevelNameEnabled() const {
+ return getBoolValue(removeSceneNumberFromLoadedLevelName);
+ }
+ bool isIgnoreImageDpiEnabled() const { return getBoolValue(IgnoreImageDpi); }
+ int getInitialLoadTlvCachingBehavior() const {
+ return getIntValue(initialLoadTlvCachingBehavior);
+ }
+ ColumnIconLoadingPolicy getColumnIconLoadingPolicy() const {
+ return ColumnIconLoadingPolicy(getIntValue(columnIconLoadingPolicy));
+ }
int addLevelFormat(const LevelFormat &format); //!< Inserts a new level
//! format. \return The
- //! associated format index.
- void removeLevelFormat(int formatIdx); //!< Removes a level format.
-
+ //! associated format index.
+ void removeLevelFormat(int formatIdx); //!< Removes a level format.
const LevelFormat &levelFormat(
int formatIdx) const; //!< Retrieves a level format.
int levelFormatsCount()
const; //!< Returns the number of stored level formats.
-
/*! \return Either the index of a matching format, or \p -1 if none
- was found. */
-
+ was found. */
int matchLevelFormat(const TFilePath &fp)
const; //!< Returns the \a nonnegative index of the first level format
//! matching the specified file path, <I>or \p -1 if none</I>.
- void setInitialLoadTlvCachingBehavior(int type);
- int getInitialLoadTlvCachingBehavior() const {
- return m_initialLoadTlvCachingBehavior;
- }
-
- void enableRemoveSceneNumberFromLoadedLevelName(bool on);
- bool isRemoveSceneNumberFromLoadedLevelNameEnabled() const {
- return m_removeSceneNumberFromLoadedLevelName;
- }
-
- void setDefaultImportPolicy(int policy);
- int getDefaultImportPolicy() { return m_importPolicy; }
-
- void setIgnoreImageDpi(bool on);
- bool isIgnoreImageDpiEnabled() const { return m_ignoreImageDpi; }
-
// Saving tab
+ TPixel getRasterBackgroundColor() const {
+ return getColorValue(rasterBackgroundColor);
+ }
- void setRasterBackgroundColor(const TPixel32 &color);
- TPixel getRasterBackgroundColor() const { return m_rasterBackgroundColor; }
+ // Import Export Tab
+ QString getFfmpegPath() const { return getStringValue(ffmpegPath); }
+ int getFfmpegTimeout() { return getIntValue(ffmpegTimeout); }
+ QString getFastRenderPath() const { return getStringValue(fastRenderPath); }
// Drawing tab
-
- void setScanLevelType(std::string s);
- QString getScanLevelType() const { return m_scanLevelType; }
-
- void setDefLevelType(int levelType);
- int getDefLevelType() const { return m_defLevelType; }
-
- void setDefLevelWidth(double width);
- double getDefLevelWidth() const { return m_defLevelWidth; }
-
- void setDefLevelHeight(double height);
- double getDefLevelHeight() const { return m_defLevelHeight; }
-
- void setDefLevelDpi(double dpi);
- double getDefLevelDpi() const { return m_defLevelDpi; }
-
- void setAutocreationType(int s);
- int getAutocreationType() const { return m_autocreationType; }
-
- bool isAutoCreateEnabled() const { return m_autocreationType > 0; }
- bool isAnimationSheetEnabled() const { return m_autocreationType == 2; }
-
- void enableAutoStretch(bool on);
- bool isAutoStretchEnabled() const { return m_enableAutoStretch; }
-
- void enableSaveUnpaintedInCleanup(bool on);
+ QString getScanLevelType() const { return getStringValue(scanLevelType); }
+ int getDefLevelType() const { return getIntValue(DefLevelType); }
+ bool isNewLevelSizeToCameraSizeEnabled() const {
+ return getBoolValue(newLevelSizeToCameraSizeEnabled);
+ }
+ double getDefLevelWidth() const { return getDoubleValue(DefLevelWidth); }
+ double getDefLevelHeight() const { return getDoubleValue(DefLevelHeight); }
+ double getDefLevelDpi() const { return getDoubleValue(DefLevelDpi); }
+ int getAutocreationType() const { return getIntValue(AutocreationType); }
+ bool isAutoStretchEnabled() const { return getBoolValue(EnableAutoStretch); }
+ int getVectorSnappingTarget() { return getIntValue(vectorSnappingTarget); }
bool isSaveUnpaintedInCleanupEnable() const {
- return m_saveUnpaintedInCleanup;
+ return getBoolValue(saveUnpaintedInCleanup);
}
-
- void enableMinimizeSaveboxAfterEditing(bool on);
bool isMinimizeSaveboxAfterEditing() const {
- return m_minimizeSaveboxAfterEditing;
+ return getBoolValue(minimizeSaveboxAfterEditing);
}
-
- void setFillOnlySavebox(bool on);
- bool getFillOnlySavebox() const { return m_fillOnlySavebox; }
-
- void enableMultiLayerStylePicker(bool on);
- bool isMultiLayerStylePickerEnabled() const {
- return m_multiLayerStylePickerEnabled;
- }
-
- void enableUseNumpadForSwitchingStyles(bool on);
bool isUseNumpadForSwitchingStylesEnabled() const {
- return m_useNumpadForSwitchingStyles;
+ return getBoolValue(useNumpadForSwitchingStyles);
}
-
- void setGuidedDrawing(int status);
- int getGuidedDrawing() { return m_guidedDrawingType; }
- void setAnimatedGuidedDrawing(bool status);
- bool getAnimatedGuidedDrawing() const { return m_animatedGuidedDrawing; }
-
- void enableNewLevelSizeToCameraSize(bool on);
- bool isNewLevelSizeToCameraSizeEnabled() const {
- return m_newLevelSizeToCameraSizeEnabled;
+ bool getDownArrowLevelStripNewFrame() {
+ return getBoolValue(downArrowInLevelStripCreatesNewFrame);
}
-
- void setVectorSnappingTarget(int target);
- int getVectorSnappingTarget() { return m_vectorSnappingTarget; }
-
- void setKeepFillOnVectorSimplify(bool on);
- bool getKeepFillOnVectorSimplify() { return m_keepFillOnVectorSimplify; }
-
- void setUseHigherDpiOnVectorSimplify(bool on);
- bool getUseHigherDpiOnVectorSimplify() {
- return m_useHigherDpiOnVectorSimplify;
+ bool getKeepFillOnVectorSimplify() {
+ return getBoolValue(keepFillOnVectorSimplify);
}
-
- void setDownArrowLevelStripNewFrame(bool on);
- bool getDownArrowLevelStripNewFrame() {
- return m_downArrowInLevelStripCreatesNewFrame;
+ bool getUseHigherDpiOnVectorSimplify() {
+ return getBoolValue(useHigherDpiOnVectorSimplify);
}
// Tools Tab
- void setDropdownShortcutsCycleOptions(bool on);
bool getDropdownShortcutsCycleOptions() {
- return m_dropdownShortcutsCycleOptions;
+ return getBoolValue(dropdownShortcutsCycleOptions);
+ }
+ bool getFillOnlySavebox() const { return getBoolValue(FillOnlysavebox); }
+ bool isMultiLayerStylePickerEnabled() const {
+ return getBoolValue(multiLayerStylePickerEnabled);
+ }
+ QString getCursorBrushType() const { return getStringValue(cursorBrushType); }
+ QString getCursorBrushStyle() const {
+ return getStringValue(cursorBrushStyle);
+ }
+ bool isCursorOutlineEnabled() const {
+ return getBoolValue(cursorOutlineEnabled);
+ }
+ int getLevelBasedToolsDisplay() const {
+ return getIntValue(levelBasedToolsDisplay);
}
-
- void setCursorBrushType(std::string brushType);
- QString getCursorBrushType() const { return m_cursorBrushType; }
-
- void setCursorBrushStyle(std::string brushStyle);
- QString getCursorBrushStyle() const { return m_cursorBrushStyle; }
-
- void enableCursorOutline(bool on);
- bool isCursorOutlineEnabled() const { return m_cursorOutlineEnabled; }
-
- void setLevelBasedToolsDisplay(int displayType);
- int getLevelBasedToolsDisplay() const { return m_levelBasedToolsDisplay; }
// Xsheet tab
- void setXsheetStep(int step); //!< Sets the step used for the <I>next/prev
- //! step</I> commands.
+ QString getXsheetLayoutPreference() const {
+ return getStringValue(xsheetLayoutPreference);
+ }
+ QString getLoadedXsheetLayout() const {
+ return getStringValue(xsheetLayoutPreference);
+ }
int getXsheetStep() const {
- return m_xsheetStep;
+ return getIntValue(xsheetStep);
} //!< Returns the step used for the <I>next/prev step</I> commands.
-
- void enableXsheetAutopan(
- bool on); //!< Enables/disables xsheet panning during playback.
bool isXsheetAutopanEnabled() const {
- return m_xsheetAutopanEnabled;
+ return getBoolValue(xsheetAutopanEnabled);
} //!< Returns whether xsheet pans during playback.
-
- void enableIgnoreAlphaonColumn1(
- bool on); //!< Enables/disables xsheet panning during playback.
+ int getDragCellsBehaviour() const { return getIntValue(DragCellsBehaviour); }
bool isIgnoreAlphaonColumn1Enabled() const {
- return m_ignoreAlphaonColumn1Enabled;
- } //!< Returns whether xsheet pans during playback.
-
- void setDragCellsBehaviour(int dragCellsBehaviour);
- int getDragCellsBehaviour() const { return m_dragCellsBehaviour; }
-
- void enableShowKeyframesOnXsheetCellArea(bool on);
+ return getBoolValue(ignoreAlphaonColumn1Enabled);
+ }
bool isShowKeyframesOnXsheetCellAreaEnabled() const {
- return m_showKeyframesOnXsheetCellArea;
+ return getBoolValue(showKeyframesOnXsheetCellArea);
+ }
+ bool isXsheetCameraColumnEnabled() const {
+ return getBoolValue(showXsheetCameraColumn);
}
-
- void enableUseArrowKeyToShiftCellSelection(bool on);
bool isUseArrowKeyToShiftCellSelectionEnabled() const {
- return m_useArrowKeyToShiftCellSelection;
+ return getBoolValue(useArrowKeyToShiftCellSelection);
}
-
- void enableInputCellsWithoutDoubleClicking(bool on);
bool isInputCellsWithoutDoubleClickingEnabled() const {
- return m_inputCellsWithoutDoubleClickingEnabled;
+ return getBoolValue(inputCellsWithoutDoubleClickingEnabled);
}
-
- void enableShowXSheetToolbar(bool on);
- bool isShowXSheetToolbarEnabled() const { return m_showXSheetToolbar; }
-
- void enableExpandFunctionHeader(bool on);
- bool isExpandFunctionHeaderEnabled() const { return m_expandFunctionHeader; }
-
- void enableShowColumnNumbers(bool on);
- bool isShowColumnNumbersEnabled() const { return m_showColumnNumbers; }
-
- void enableSyncLevelRenumberWithXsheet(bool on);
- bool isSyncLevelRenumberWithXsheetEnabled() const {
- return m_syncLevelRenumberWithXsheet;
- }
-
- void enableShortcutCommandsWhileRenamingCell(bool on);
bool isShortcutCommandsWhileRenamingCellEnabled() const {
- return m_shortcutCommandsWhileRenamingCellEnabled;
+ return getBoolValue(shortcutCommandsWhileRenamingCellEnabled);
}
-
- void setXsheetLayoutPreference(std::string layout);
- QString getXsheetLayoutPreference() const { return m_xsheetLayoutPreference; }
-
- void setLoadedXsheetLayout(std::string layout);
- QString getLoadedXsheetLayout() const { return m_loadedXsheetLayout; }
-
- void setCurrentColumnData(const TPixel &currentColumnColor);
- void getCurrentColumnData(TPixel &currentColumnColor) const {
- currentColumnColor = m_currentColumnColor;
+ bool isShowXSheetToolbarEnabled() const {
+ return getBoolValue(showXSheetToolbar);
}
-
- void enableXsheetCameraColumn(bool on);
- bool isXsheetCameraColumnEnabled() const { return m_showXsheetCameraColumn; }
-
- bool isXsheetCameraColumnVisible() const {
- return m_showXsheetCameraColumn && m_showKeyframesOnXsheetCellArea;
+ bool isExpandFunctionHeaderEnabled() const {
+ return getBoolValue(expandFunctionHeader);
+ }
+ bool isShowColumnNumbersEnabled() const {
+ return getBoolValue(showColumnNumbers);
+ }
+ bool isSyncLevelRenumberWithXsheetEnabled() const {
+ return getBoolValue(syncLevelRenumberWithXsheet);
+ }
+ bool isCurrentTimelineIndicatorEnabled() const {
+ return getBoolValue(currentTimelineEnabled);
+ }
+ void getCurrentColumnData(TPixel &color) const {
+ color = getColorValue(currentColumnColor);
}
// Animation tab
-
- void setKeyframeType(int s);
- int getKeyframeType() const { return m_keyframeType; }
-
- void setAnimationStep(int s);
- int getAnimationStep() const { return m_animationStep; }
+ int getKeyframeType() const { return getIntValue(keyframeType); }
+ int getAnimationStep() const { return getIntValue(animationStep); }
// Preview tab
-
- void setBlankValues(int blanksCount, TPixel32 blankColor);
- void getBlankValues(int &blanksCount, TPixel32 &blankColor) const {
- blanksCount = m_blanksCount, blankColor = m_blankColor;
+ void getBlankValues(int &bCount, TPixel32 &bColor) const {
+ bCount = getIntValue(blanksCount), bColor = getColorValue(blankColor);
+ }
+ bool rewindAfterPlaybackEnabled() const {
+ return getBoolValue(rewindAfterPlayback);
}
-
- void enablePreviewAlwaysOpenNewFlip(bool on);
bool previewAlwaysOpenNewFlipEnabled() const {
- return m_previewAlwaysOpenNewFlipEnabled;
+ return getBoolValue(previewAlwaysOpenNewFlip);
}
-
- void enableRewindAfterPlayback(bool on);
- bool rewindAfterPlaybackEnabled() const {
- return m_rewindAfterPlaybackEnabled;
+ bool fitToFlipbookEnabled() const { return getBoolValue(fitToFlipbook); }
+ bool isGeneratedMovieViewEnabled() const {
+ return getBoolValue(generatedMovieViewEnabled);
}
- void enableFitToFlipbook(bool on);
- bool fitToFlipbookEnabled() const { return m_fitToFlipbookEnabled; }
-
// Onion Skin tab
+ bool isOnionSkinEnabled() const { return getBoolValue(onionSkinEnabled); }
+ int getOnionPaperThickness() const {
+ return getIntValue(onionPaperThickness);
+ }
- void enableOnionSkin(bool on);
- bool isOnionSkinEnabled() const { return m_onionSkinEnabled; }
- void setOnionPaperThickness(int thickness);
- int getOnionPaperThickness() const { return m_onionPaperThickness; }
-
- void setOnionData(const TPixel &frontOnionColor, const TPixel &backOnionColor,
- bool inksOnly);
- void getOnionData(TPixel &frontOnionColor, TPixel &backOnionColor,
+ void getOnionData(TPixel &frontColor, TPixel &backColor,
bool &inksOnly) const {
- frontOnionColor = m_frontOnionColor, backOnionColor = m_backOnionColor,
- inksOnly = m_inksOnly;
+ frontColor = getColorValue(frontOnionColor),
+ backColor = getColorValue(backOnionColor),
+ inksOnly = getBoolValue(onionInksOnly);
+ }
+ bool getOnionSkinDuringPlayback() {
+ return getBoolValue(onionSkinDuringPlayback);
}
- bool getOnionSkinDuringPlayback() { return m_onionSkinDuringPlayback; }
- void setOnionSkinDuringPlayback(bool on);
-
- void useOnionColorsForShiftAndTraceGhosts(bool on);
bool areOnionColorsUsedForShiftAndTraceGhosts() const {
- return m_useOnionColorsForShiftAndTraceGhosts;
+ return getBoolValue(useOnionColorsForShiftAndTraceGhosts);
}
- // Transparency Check tab
-
- void setTranspCheckData(const TPixel &bg, const TPixel &ink,
- const TPixel &paint);
- void getTranspCheckData(TPixel &bg, TPixel &ink, TPixel &paint) const {
- bg = m_transpCheckBg;
- ink = m_transpCheckInk;
- paint = m_transpCheckPaint;
+ bool getAnimatedGuidedDrawing() const {
+ return getBoolValue(animatedGuidedDrawing);
}
- void enableCurrentTimelineIndicator(bool on);
- bool isCurrentTimelineIndicatorEnabled() const {
- return m_currentTimelineEnabled;
+ // Colors tab
+ TPixel getViewerBgColor() const { return getColorValue(viewerBGColor); }
+ TPixel getPreviewBgColor() const { return getColorValue(previewBGColor); }
+ TPixel getLevelEditorBoxColor() const {
+ return getColorValue(levelEditorBoxColor);
+ }
+ void getChessboardColors(TPixel32 &col1, TPixel32 &col2) const {
+ col1 = getColorValue(chessboardColor1);
+ col2 = getColorValue(chessboardColor2);
+ }
+ void getTranspCheckData(TPixel &bg, TPixel &ink, TPixel &paint) const {
+ bg = getColorValue(transpCheckInkOnBlack);
+ ink = getColorValue(transpCheckInkOnWhite);
+ paint = getColorValue(transpCheckPaint);
}
// Version Control tab
-
- void enableSVN(bool on);
- bool isSVNEnabled() const { return m_SVNEnabled; }
-
- void enableAutomaticSVNFolderRefresh(bool on);
+ bool isSVNEnabled() const { return getBoolValue(SVNEnabled); }
bool isAutomaticSVNFolderRefreshEnabled() const {
- return m_automaticSVNFolderRefreshEnabled;
+ return getBoolValue(automaticSVNFolderRefreshEnabled);
}
-
- void enableLatestVersionCheck(bool on);
bool isLatestVersionCheckEnabled() const {
- return m_latestVersionCheckEnabled;
+ return getBoolValue(latestVersionCheckEnabled);
}
- // Import Export Tab
-
- void setFfmpegPath(std::string path);
- QString getFfmpegPath() const { return m_ffmpegPath; }
- void setPrecompute(bool enabled);
- bool getPrecompute() { return m_precompute; }
- void setFfmpegTimeout(int seconds);
- int getFfmpegTimeout() { return m_ffmpegTimeout; }
- void setFastRenderPath(std::string path);
- QString getFastRenderPath() const { return m_fastRenderPath; }
- // Uncategorized - internals
-
- void setAskForOverrideRender(bool on);
- bool askForOverrideRender() const { return m_askForOverrideRender; }
-
- void setLineTestFpsCapture(int lineTestFpsCapture);
- int getLineTestFpsCapture() const { return m_lineTestFpsCapture; }
-
- int getTextureSize() const { return m_textureSize; }
- bool useDrawPixel() { return m_textureSize == 0; }
-
- void setShortcutPreset(std::string preset);
- QString getShortcutPreset() { return m_shortcutPreset; }
-
+ // Tablet tab
+ bool isWinInkEnabled() const { return getBoolValue(winInkEnabled); }
+
+ // Others (not appeared in the popup)
+ // Shortcut popup settings
+ QString getShortcutPreset() { return getStringValue(shortcutPreset); }
+ // Viewer context menu
+ int getGuidedDrawing() { return getIntValue(guidedDrawingType); }
+#if defined(MACOSX) && defined(__LP64__)
int getShmMax() const {
- return m_shmmax;
+ return getIntValue(shmmax);
} //! \sa The \p sysctl unix command.
int getShmSeg() const {
- return m_shmseg;
+ return getIntValue(shmseg);
} //! \sa The \p sysctl unix command.
int getShmAll() const {
- return m_shmall;
+ return getIntValue(shmall);
} //! \sa The \p sysctl unix command.
int getShmMni() const {
- return m_shmmni;
+ return getIntValue(shmmni);
} //! \sa The \p sysctl unix command.
- std::string getLayerNameEncoding() const { return m_layerNameEncoding; };
-
- // Tablet tab
+#endif
- void enableWinInk(bool on);
- bool isWinInkEnabled() const { return m_enableWinInk; }
+ void setPrecompute(bool enabled);
+ bool getPrecompute() { return m_precompute; }
+ bool isAutoCreateEnabled() const { return getIntValue(AutocreationType) > 0; }
+ bool isAnimationSheetEnabled() const {
+ return getIntValue(AutocreationType) == 2;
+ }
+ bool isXsheetCameraColumnVisible() const {
+ return getBoolValue(showXsheetCameraColumn) &&
+ getBoolValue(showKeyframesOnXsheetCellArea);
+ }
+ int getTextureSize() const { return m_textureSize; }
+ bool useDrawPixel() { return m_textureSize == 0; }
+ std::string getLayerNameEncoding() const { return m_layerNameEncoding; };
Q_SIGNALS:
@@ -620,130 +494,10 @@ private:
std::vector<LevelFormat> m_levelFormats;
- QString m_units, m_cameraUnits, m_scanLevelType, m_currentRoomChoice,
- m_oldUnits, m_oldCameraUnits, m_ffmpegPath, m_shortcutPreset,
- m_customProjectRoot, m_interfaceFont, m_interfaceFontStyle;
- QString m_fastRenderPath;
-
- double m_defLevelWidth, m_defLevelHeight, m_defLevelDpi;
-
- TDimension m_iconSize;
-
- TPixel32 m_blankColor, m_frontOnionColor, m_backOnionColor, m_transpCheckBg,
- m_transpCheckInk, m_transpCheckPaint;
-
- int m_autosavePeriod, // minutes
- m_chunkSize, m_blanksCount, m_onionPaperThickness, m_step, m_shrink,
- m_textureSize, m_autocreationType, m_keyframeType, m_animationStep,
- m_ffmpegTimeout; // seconds
- int m_projectRoot, m_importPolicy, m_interfaceFontWeight, m_guidedDrawingType;
- QString m_currentLanguage, m_currentStyleSheet;
- int m_undoMemorySize, // in megabytes
- m_dragCellsBehaviour, m_lineTestFpsCapture, m_defLevelType, m_xsheetStep,
- m_shmmax, m_shmseg, m_shmall, m_shmmni, m_vectorSnappingTarget;
-
- bool m_autoExposeEnabled, m_autoCreateEnabled, m_subsceneFolderEnabled,
- m_generatedMovieViewEnabled, m_xsheetAutopanEnabled,
- m_ignoreAlphaonColumn1Enabled, m_previewAlwaysOpenNewFlipEnabled,
- m_rewindAfterPlaybackEnabled, m_fitToFlipbookEnabled, m_autosaveEnabled,
- m_autosaveSceneEnabled, m_autosaveOtherFilesEnabled,
- m_defaultViewerEnabled, m_pixelsOnly, m_showXSheetToolbar,
- m_expandFunctionHeader, m_showColumnNumbers, m_animatedGuidedDrawing;
- bool m_rasterOptimizedMemory, m_saveUnpaintedInCleanup,
- m_askForOverrideRender, m_automaticSVNFolderRefreshEnabled, m_SVNEnabled,
- m_backupEnabled, m_minimizeSaveboxAfterEditing, m_sceneNumberingEnabled,
- m_animationSheetEnabled, m_inksOnly, m_startupPopupEnabled;
- bool m_fillOnlySavebox, m_show0ThickLines, m_regionAntialias;
- bool m_onionSkinDuringPlayback, m_ignoreImageDpi,
- m_syncLevelRenumberWithXsheet;
- bool m_keepFillOnVectorSimplify, m_useHigherDpiOnVectorSimplify;
- bool m_downArrowInLevelStripCreatesNewFrame;
- TPixel32 m_viewerBGColor, m_previewBGColor, m_chessboardColor1,
- m_chessboardColor2, m_levelEditorBoxColor;
- bool m_showRasterImagesDarkenBlendedInViewer,
- m_actualPixelViewOnSceneEditingMode;
- bool m_dropdownShortcutsCycleOptions;
- int m_viewerZoomCenter; // MOUSE_CURSOR = 0, VIEWER_CENTER = 1
- // used in the load level popup. ON_DEMAND = 0, ALL_ICONS = 1,
- // ALL_ICONS_AND_IMAGES = 2
- int m_initialLoadTlvCachingBehavior;
- // automatically remove 6 letters of scene number from the level name
- // ("c0001_A.tlv" -> "A")
- bool m_removeSceneNumberFromLoadedLevelName;
- // after save level as command, replace the level with "save-as"ed level
- bool m_replaceAfterSaveLevelAs;
- // convert the last one digit of the frame number to alphabet
- // Ex. 12 -> 1B 21 -> 2A 30 -> 3
- bool m_showFrameNumberWithLetters;
- // display level name on each marker in the xsheet cell area
- bool m_levelNameOnEachMarker;
- // whether to load the column icon(thumbnail) at once / on demand
- int m_columnIconLoadingPolicy;
- bool m_moveCurrentFrameByClickCellArea;
- bool m_onionSkinEnabled;
- bool m_multiLayerStylePickerEnabled;
- bool m_precompute;
-
- bool m_showKeyframesOnXsheetCellArea;
- std::string m_layerNameEncoding = "SJIS"; // Fixed to SJIS for now. You can
- // add interface if you wanna
- // change encoding.
- // whether to use numpad and tab key shortcut for selecting styles
- bool m_useNumpadForSwitchingStyles;
-
- // whether to set the new level size to be the same as the camera size by
- // default
- bool m_newLevelSizeToCameraSizeEnabled;
-
- // use arrow key to shift cel selection, ctrl + arrow key to resize the
- // selection range.
- bool m_useArrowKeyToShiftCellSelection;
-
- // enable to input drawing numbers into cells without double-clicking
- bool m_inputCellsWithoutDoubleClickingEnabled;
-
- // enable to watch file system in order to update file browser automatically
- bool m_watchFileSystem;
+ bool m_precompute = true;
+ int m_textureSize = 0;
- // enable OT command shortcut keys while renaming xsheet cell
- bool m_shortcutCommandsWhileRenamingCellEnabled;
-
- QString m_xsheetLayoutPreference,
- m_loadedXsheetLayout; // Classic, Classic-revised, compact
-
- // defines which alias to be used if both are possible on coding file path
- PathAliasPriority m_pathAliasPriority;
-
- // defines behavior of toggle switch in function editor
- FunctionEditorToggle m_functionEditorToggle;
-
- bool m_currentTimelineEnabled;
- bool m_enableAutoStretch;
-
- // color calibration using 3DLUT
- bool m_colorCalibrationEnabled = false;
- // map of [monitor name]-[path to the lut file].
- // for now non-Windows accepts only one lut path for all kinds of monitors
- QMap<QString, QString> m_colorCalibrationLutPaths;
-
- // release version check
- bool m_latestVersionCheckEnabled = true;
-
- // Cursor settings
- QString m_cursorBrushType;
- QString m_cursorBrushStyle;
- bool m_cursorOutlineEnabled = false;
-
- TPixel32 m_currentColumnColor, m_rasterBackgroundColor;
-
- bool m_enableWinInk = false;
- bool m_useOnionColorsForShiftAndTraceGhosts = false;
-
- int m_backupKeepCount;
-
- bool m_showXsheetCameraColumn = true;
-
- int m_levelBasedToolsDisplay;
+ std::string m_layerNameEncoding = "SJIS"; // Fixed to SJIS for now. You can
private:
Preferences();
diff --git a/toonz/sources/include/toonz/preferencesitemids.h b/toonz/sources/include/toonz/preferencesitemids.h
new file mode 100644
index 000000000..320a36d69
--- /dev/null
+++ b/toonz/sources/include/toonz/preferencesitemids.h
@@ -0,0 +1,193 @@
+#ifndef PREFERENCESITEMIDS_H
+#define PREFERENCESITEMIDS_H
+
+enum PreferencesItemId {
+ // General
+ defaultViewerEnabled,
+ rasterOptimizedMemory,
+ autosaveEnabled,
+ autosavePeriod,
+ autosaveSceneEnabled,
+ autosaveOtherFilesEnabled,
+ startupPopupEnabled,
+ undoMemorySize,
+ taskchunksize,
+ replaceAfterSaveLevelAs,
+ backupEnabled,
+ backupKeepCount,
+ sceneNumberingEnabled,
+ watchFileSystemEnabled,
+ projectRoot,
+ customProjectRoot,
+ pathAliasPriority,
+
+ //----------
+ // Interface
+ CurrentStyleSheetName,
+ pixelsOnly,
+ oldUnits,
+ oldCameraUnits,
+ linearUnits,
+ cameraUnits,
+ CurrentRoomChoice,
+ functionEditorToggle,
+ moveCurrentFrameByClickCellArea,
+ actualPixelViewOnSceneEditingMode,
+ levelNameOnEachMarkerEnabled,
+ showRasterImagesDarkenBlendedInViewer,
+ showFrameNumberWithLetters,
+ iconSize,
+ viewShrink,
+ viewStep,
+ viewerZoomCenter,
+ CurrentLanguageName,
+ interfaceFont,
+ interfaceFontStyle,
+ colorCalibrationEnabled,
+ colorCalibrationLutPaths,
+
+ //----------
+ // Visualization
+ show0ThickLines,
+ regionAntialias,
+
+ //----------
+ // Loading
+ importPolicy,
+ autoExposeEnabled,
+ subsceneFolderEnabled,
+ removeSceneNumberFromLoadedLevelName,
+ IgnoreImageDpi,
+ initialLoadTlvCachingBehavior,
+ columnIconLoadingPolicy,
+ levelFormats, // need to be handle separately
+
+ //----------
+ // Saving
+ rasterBackgroundColor,
+
+ //----------
+ // Import / Export
+ ffmpegPath,
+ ffmpegTimeout,
+ fastRenderPath,
+
+ //----------
+ // Drawing
+ scanLevelType,
+ DefLevelType,
+ newLevelSizeToCameraSizeEnabled,
+ DefLevelWidth,
+ DefLevelHeight,
+ DefLevelDpi,
+ AutocreationType,
+ EnableAutoStretch,
+ vectorSnappingTarget,
+ saveUnpaintedInCleanup,
+ minimizeSaveboxAfterEditing,
+ useNumpadForSwitchingStyles,
+ downArrowInLevelStripCreatesNewFrame,
+ keepFillOnVectorSimplify,
+ useHigherDpiOnVectorSimplify,
+
+ //----------
+ // Tools
+ dropdownShortcutsCycleOptions,
+ FillOnlysavebox,
+ multiLayerStylePickerEnabled,
+ cursorBrushType,
+ cursorBrushStyle,
+ cursorOutlineEnabled,
+ levelBasedToolsDisplay,
+
+ //----------
+ // Xsheet
+ xsheetLayoutPreference,
+ xsheetStep,
+ xsheetAutopanEnabled,
+ DragCellsBehaviour,
+ ignoreAlphaonColumn1Enabled,
+ showKeyframesOnXsheetCellArea,
+ showXsheetCameraColumn,
+ useArrowKeyToShiftCellSelection,
+ inputCellsWithoutDoubleClickingEnabled,
+ shortcutCommandsWhileRenamingCellEnabled,
+ showXSheetToolbar,
+ expandFunctionHeader,
+ showColumnNumbers,
+ syncLevelRenumberWithXsheet,
+ currentTimelineEnabled,
+ currentColumnColor,
+
+ //----------
+ // Animation
+ keyframeType,
+ animationStep,
+
+ //----------
+ // Preview
+ blanksCount,
+ blankColor,
+ rewindAfterPlayback,
+ previewAlwaysOpenNewFlip,
+ fitToFlipbook,
+ generatedMovieViewEnabled,
+
+ //----------
+ // Onion Skin
+ onionSkinEnabled,
+ onionPaperThickness,
+ backOnionColor,
+ frontOnionColor,
+ onionInksOnly,
+ onionSkinDuringPlayback,
+ useOnionColorsForShiftAndTraceGhosts,
+ animatedGuidedDrawing,
+
+ //----------
+ // Colors
+ viewerBGColor,
+ previewBGColor,
+ levelEditorBoxColor,
+ chessboardColor1,
+ chessboardColor2,
+ transpCheckInkOnWhite,
+ transpCheckInkOnBlack,
+ transpCheckPaint,
+
+ //----------
+ // Version Control
+ SVNEnabled,
+ automaticSVNFolderRefreshEnabled,
+ latestVersionCheckEnabled,
+
+ //----------
+ // Touch / Tablet Settings
+ // TounchGestureControl // Touch Gesture is a checkable command and not in
+ // preferences.ini
+ winInkEnabled,
+
+ //----------
+ // Others (not appeared in the popup)
+ // Shortcut popup settings
+ shortcutPreset,
+ // Viewer context menu
+ guidedDrawingType,
+ // OSX shared memory settings
+ shmmax,
+ shmseg,
+ shmall,
+ shmmni,
+ //- obsoleted / unused members
+ // interfaceFontWeight,
+ // autoCreateEnabled,
+ // animationSheetEnabled,
+ // askForOverrideRender,
+ // textureSize, // set to 0
+ // LineTestFpsCapture,
+ // guidedDrawingType,
+
+ PreferencesItemCount
+};
+
+#endif
\ No newline at end of file
diff --git a/toonz/sources/sound/mp3/tsio_mp3.cpp b/toonz/sources/sound/mp3/tsio_mp3.cpp
index e53d337bd..cba3ceff2 100644
--- a/toonz/sources/sound/mp3/tsio_mp3.cpp
+++ b/toonz/sources/sound/mp3/tsio_mp3.cpp
@@ -50,7 +50,7 @@ bool FfmpegAudio::checkFfmpeg() {
path = path + ".exe";
#endif
if (TSystem::doesExistFileOrLevel(TFilePath(path))) {
- Preferences::instance()->setFfmpegPath(QDir::currentPath().toStdString());
+ Preferences::instance()->setValue(ffmpegPath, QDir::currentPath());
return true;
}
diff --git a/toonz/sources/toonz/iocommand.cpp b/toonz/sources/toonz/iocommand.cpp
index 9f78aa796..36690fbff 100644
--- a/toonz/sources/toonz/iocommand.cpp
+++ b/toonz/sources/toonz/iocommand.cpp
@@ -166,10 +166,10 @@ public:
return A_CANCEL;
}
if (ret == 1 && checked > 0) {
- Preferences::instance()->setDefaultImportPolicy(1);
+ Preferences::instance()->setValue(importPolicy, 1);
TApp::instance()->getCurrentScene()->notifyImportPolicyChanged(1);
} else if (ret == 2 && checked > 0) {
- Preferences::instance()->setDefaultImportPolicy(2);
+ Preferences::instance()->setValue(importPolicy, 2);
TApp::instance()->getCurrentScene()->notifyImportPolicyChanged(2);
}
m_importEnabled = (ret == 1);
@@ -1953,7 +1953,7 @@ bool IoCmd::loadScene(const TFilePath &path, bool updateRecentFile,
if (ret == 0) {
} // do nothing
else if (ret == 1) { // Turn off pixels only mode
- Preferences::instance()->setPixelsOnly(false);
+ Preferences::instance()->setValue(pixelsOnly, false);
app->getCurrentScene()->notifyPixelUnitSelected(false);
} else { // ret = 2 : Resize the scene
TDimensionD camSize = scene->getCurrentCamera()->getSize();
@@ -2727,8 +2727,8 @@ bool IoCmd::takeCareSceneFolderItemsOnSaveSceneAs(
} else if (ret == 2) { // decode $scenefolder aliases case
Preferences::PathAliasPriority oldPriority =
Preferences::instance()->getPathAliasPriority();
- Preferences::instance()->setPathAliasPriority(
- Preferences::ProjectFolderOnly);
+ Preferences::instance()->setValue(pathAliasPriority,
+ Preferences::ProjectFolderOnly);
for (int i = 0; i < sceneFolderLevels.size(); i++) {
TXshLevel *level = sceneFolderLevels.at(i);
@@ -2737,7 +2737,7 @@ bool IoCmd::takeCareSceneFolderItemsOnSaveSceneAs(
scene->codeFilePath(scene->decodeFilePath(level->getPath()));
setPathToLevel(level, fp);
}
- Preferences::instance()->setPathAliasPriority(oldPriority);
+ Preferences::instance()->setValue(pathAliasPriority, oldPriority);
}
// Save the scene only case (ret == 3), do nothing
diff --git a/toonz/sources/toonz/mainwindow.cpp b/toonz/sources/toonz/mainwindow.cpp
index 0c50e2f20..8228404db 100644
--- a/toonz/sources/toonz/mainwindow.cpp
+++ b/toonz/sources/toonz/mainwindow.cpp
@@ -1162,7 +1162,7 @@ void MainWindow::onMenuCheckboxChanged() {
#endif
else if (cm->getAction(MI_RasterizePli) == action) {
if (!QGLPixelBuffer::hasOpenGLPbuffers()) isChecked = 0;
- RasterizePliToggleAction = isChecked;
+ RasterizePliToggleAction = isChecked;
} else if (cm->getAction(MI_SafeArea) == action)
SafeAreaToggleAction = isChecked;
else if (cm->getAction(MI_ViewColorcard) == action)
@@ -1249,7 +1249,7 @@ void MainWindow::onUpdateCheckerDone(bool error) {
Qt::Checked);
int ret = dialog->exec();
if (dialog->getChecked() == Qt::Unchecked)
- Preferences::instance()->enableLatestVersionCheck(false);
+ Preferences::instance()->setValue(latestVersionCheckEnabled, false);
dialog->deleteLater();
if (ret == 1) {
// Write the new last date to file
@@ -2337,27 +2337,27 @@ void MainWindow::togglePickStyleLines() {
void MainWindow::onNewVectorLevelButtonPressed() {
int defaultLevelType = Preferences::instance()->getDefLevelType();
- Preferences::instance()->setDefLevelType(PLI_XSHLEVEL);
+ Preferences::instance()->setValue(DefLevelType, PLI_XSHLEVEL);
CommandManager::instance()->execute("MI_NewLevel");
- Preferences::instance()->setDefLevelType(defaultLevelType);
+ Preferences::instance()->setValue(DefLevelType, defaultLevelType);
}
//-----------------------------------------------------------------------------
void MainWindow::onNewToonzRasterLevelButtonPressed() {
int defaultLevelType = Preferences::instance()->getDefLevelType();
- Preferences::instance()->setDefLevelType(TZP_XSHLEVEL);
+ Preferences::instance()->setValue(DefLevelType, TZP_XSHLEVEL);
CommandManager::instance()->execute("MI_NewLevel");
- Preferences::instance()->setDefLevelType(defaultLevelType);
+ Preferences::instance()->setValue(DefLevelType, defaultLevelType);
}
//-----------------------------------------------------------------------------
void MainWindow::onNewRasterLevelButtonPressed() {
int defaultLevelType = Preferences::instance()->getDefLevelType();
- Preferences::instance()->setDefLevelType(OVL_XSHLEVEL);
+ Preferences::instance()->setValue(DefLevelType, OVL_XSHLEVEL);
CommandManager::instance()->execute("MI_NewLevel");
- Preferences::instance()->setDefLevelType(defaultLevelType);
+ Preferences::instance()->setValue(DefLevelType, defaultLevelType);
}
//-----------------------------------------------------------------------------
@@ -2376,7 +2376,7 @@ void MainWindow::clearCacheFolder() {
// 1. $CACHE/[Current ProcessID]
// 2. $CACHE/temp/[Current scene folder] if the current scene is untitled
- TFilePath cacheRoot = ToonzFolder::getCacheRootFolder();
+ TFilePath cacheRoot = ToonzFolder::getCacheRootFolder();
if (cacheRoot.isEmpty()) cacheRoot = TEnv::getStuffDir() + "cache";
TFilePathSet filesToBeRemoved;
@@ -2490,9 +2490,9 @@ RecentFiles::~RecentFiles() {}
void RecentFiles::addFilePath(QString path, FileType fileType,
QString projectName) {
QList<QString> files =
- (fileType == Scene) ? m_recentScenes : (fileType == Level)
- ? m_recentLevels
- : m_recentFlipbookImages;
+ (fileType == Scene)
+ ? m_recentScenes
+ : (fileType == Level) ? m_recentLevels : m_recentFlipbookImages;
int i;
for (i = 0; i < files.size(); i++)
if (files.at(i) == path) {
@@ -2659,9 +2659,9 @@ void RecentFiles::saveRecentFiles() {
QList<QString> RecentFiles::getFilesNameList(FileType fileType) {
QList<QString> files =
- (fileType == Scene) ? m_recentScenes : (fileType == Level)
- ? m_recentLevels
- : m_recentFlipbookImages;
+ (fileType == Scene)
+ ? m_recentScenes
+ : (fileType == Level) ? m_recentLevels : m_recentFlipbookImages;
QList<QString> names;
int i;
for (i = 0; i < files.size(); i++) {
@@ -2688,9 +2688,9 @@ void RecentFiles::refreshRecentFilesMenu(FileType fileType) {
menu->setEnabled(false);
else {
CommandId clearActionId =
- (fileType == Scene) ? MI_ClearRecentScene : (fileType == Level)
- ? MI_ClearRecentLevel
- : MI_ClearRecentImage;
+ (fileType == Scene)
+ ? MI_ClearRecentScene
+ : (fileType == Level) ? MI_ClearRecentLevel : MI_ClearRecentImage;
menu->setActions(names);
menu->addSeparator();
QAction *clearAction = CommandManager::instance()->getAction(clearActionId);
diff --git a/toonz/sources/toonz/preferencespopup.cpp b/toonz/sources/toonz/preferencespopup.cpp
index 34cfe2be1..c1a617495 100644
--- a/toonz/sources/toonz/preferencespopup.cpp
+++ b/toonz/sources/toonz/preferencespopup.cpp
@@ -59,19 +59,68 @@ using namespace DVGui;
//*******************************************************************************************
namespace {
-
-static const int unitsCount = 5, inchIdx = 2;
-static const QString units[unitsCount] = {"cm", "mm", "inch", "field", "pixel"};
-static const QString rooms[2] = {"standard", "studioGhibli"};
enum DpiPolicy { DP_ImageDpi, DP_CustomDpi };
+inline void setupLayout(QGridLayout* lay, int margin = 15) {
+ lay->setMargin(margin);
+ lay->setHorizontalSpacing(5);
+ lay->setVerticalSpacing(10);
+ lay->setColumnStretch(2, 1);
+}
+
+QGridLayout* insertGroupBox(const QString label, QGridLayout* layout) {
+ QGroupBox* box = new QGroupBox(label);
+ QGridLayout* lay = new QGridLayout();
+ setupLayout(lay, 5);
+ box->setLayout(lay);
+ layout->addWidget(box, layout->rowCount(), 0, 1, 3);
+ return lay;
+}
+
+inline TPixel colorToTPixel(const QColor& color) {
+ return TPixel(color.red(), color.green(), color.blue(), color.alpha());
+}
} // namespace
+//-----------------------------------------------------------------------------
+
+SizeField::SizeField(QSize min, QSize max, QSize value, QWidget* parent)
+ : QWidget(parent) {
+ m_fieldX =
+ new DVGui::IntLineEdit(this, value.width(), min.width(), max.width());
+ m_fieldY =
+ new DVGui::IntLineEdit(this, value.height(), min.height(), max.height());
+ QHBoxLayout* lay = new QHBoxLayout();
+ lay->setSpacing(5);
+ lay->setMargin(0);
+ lay->addWidget(m_fieldX, 1);
+ lay->addWidget(new QLabel("X", this), 0);
+ lay->addWidget(m_fieldY, 1);
+ lay->addStretch(1);
+ setLayout(lay);
+
+ bool ret = true;
+ ret = ret && connect(m_fieldX, SIGNAL(editingFinished()), this,
+ SIGNAL(editingFinished()));
+ ret = ret && connect(m_fieldY, SIGNAL(editingFinished()), this,
+ SIGNAL(editingFinished()));
+ assert(ret);
+}
+
+QSize SizeField::getValue() const {
+ return QSize(m_fieldX->getValue(), m_fieldY->getValue());
+}
+
+void SizeField::setValue(const QSize& size) {
+ m_fieldX->setValue(size.width());
+ m_fieldY->setValue(size.height());
+}
+
//**********************************************************************************
// PreferencesPopup::FormatProperties implementation
//**********************************************************************************
-PreferencesPopup::FormatProperties::FormatProperties(PreferencesPopup *parent)
+PreferencesPopup::FormatProperties::FormatProperties(PreferencesPopup* parent)
: DVGui::Dialog(parent, false, true) {
setWindowTitle(tr("Level Settings by File Format"));
setModal(true); // The underlying selected format should not
@@ -80,24 +129,24 @@ PreferencesPopup::FormatProperties::FormatProperties(PreferencesPopup *parent)
// Main layout
beginVLayout();
- QGridLayout *gridLayout = new QGridLayout;
+ QGridLayout* gridLayout = new QGridLayout;
int row = 0;
// Key values
- QLabel *nameLabel = new QLabel(tr("Name:"));
+ QLabel* nameLabel = new QLabel(tr("Name:"));
nameLabel->setFixedHeight(20); // Due to DVGui::Dialog's quirky behavior
gridLayout->addWidget(nameLabel, row, 0, Qt::AlignRight);
m_name = new DVGui::LineEdit;
gridLayout->addWidget(m_name, row++, 1);
- QLabel *regExpLabel = new QLabel(tr("Regular Expression:"));
+ QLabel* regExpLabel = new QLabel(tr("Regular Expression:"));
gridLayout->addWidget(regExpLabel, row, 0, Qt::AlignRight);
m_regExp = new DVGui::LineEdit;
gridLayout->addWidget(m_regExp, row++, 1);
- QLabel *priorityLabel = new QLabel(tr("Priority"));
+ QLabel* priorityLabel = new QLabel(tr("Priority"));
gridLayout->addWidget(priorityLabel, row, 0, Qt::AlignRight);
m_priority = new DVGui::IntLineEdit;
@@ -112,7 +161,7 @@ PreferencesPopup::FormatProperties::FormatProperties(PreferencesPopup *parent)
m_dpiPolicy->addItem(QObject::tr("Image DPI"));
m_dpiPolicy->addItem(QObject::tr("Custom DPI"));
- QLabel *dpiLabel = new QLabel(LevelSettingsPopup::tr("DPI:"));
+ QLabel* dpiLabel = new QLabel(LevelSettingsPopup::tr("DPI:"));
gridLayout->addWidget(dpiLabel, row, 0, Qt::AlignRight);
m_dpi = new DVGui::DoubleLineEdit;
@@ -133,7 +182,7 @@ PreferencesPopup::FormatProperties::FormatProperties(PreferencesPopup *parent)
new DVGui::CheckBox(LevelSettingsPopup::tr("Add Antialiasing"));
gridLayout->addWidget(m_doAntialias, row++, 1);
- QLabel *antialiasLabel =
+ QLabel* antialiasLabel =
new QLabel(LevelSettingsPopup::tr("Antialias Softness:"));
gridLayout->addWidget(antialiasLabel, row, 0, Qt::AlignRight);
@@ -141,7 +190,7 @@ PreferencesPopup::FormatProperties::FormatProperties(PreferencesPopup *parent)
this, 10, 0, 100); // Tried 1, but then m_doAntialias was forcedly
gridLayout->addWidget(m_antialias, row++, 1); // initialized to true
- QLabel *subsamplingLabel = new QLabel(LevelSettingsPopup::tr("Subsampling:"));
+ QLabel* subsamplingLabel = new QLabel(LevelSettingsPopup::tr("Subsampling:"));
gridLayout->addWidget(subsamplingLabel, row, 0, Qt::AlignRight);
m_subsampling = new DVGui::IntLineEdit(this, 1, 1);
@@ -174,8 +223,8 @@ void PreferencesPopup::FormatProperties::updateEnabledStatus() {
//-----------------------------------------------------------------------------
void PreferencesPopup::FormatProperties::setLevelFormat(
- const Preferences::LevelFormat &lf) {
- const LevelOptions &lo = lf.m_options;
+ const Preferences::LevelFormat& lf) {
+ const LevelOptions& lo = lf.m_options;
m_name->setText(lf.m_name);
m_regExp->setText(lf.m_pathFormat.pattern());
@@ -221,294 +270,281 @@ Preferences::LevelFormat PreferencesPopup::FormatProperties::levelFormat()
// PreferencesPopup implementation
//**********************************************************************************
-void PreferencesPopup::onPixelsOnlyChanged(int index) {
- bool enabled = index == Qt::Checked;
- if (enabled) {
- m_pref->setDefLevelDpi(Stage::standardDpi);
- m_pref->setPixelsOnly(true);
- TCamera *camera;
- camera =
- TApp::instance()->getCurrentScene()->getScene()->getCurrentCamera();
- TDimension camRes = camera->getRes();
- TDimensionD camSize;
- camSize.lx = camRes.lx / Stage::standardDpi;
- camSize.ly = camRes.ly / Stage::standardDpi;
- camera->setSize(camSize);
- TDimension cleanupRes = CleanupSettingsModel::instance()
- ->getCurrentParameters()
- ->m_camera.getRes();
- TDimensionD cleanupSize;
- cleanupSize.lx = cleanupRes.lx / Stage::standardDpi;
- cleanupSize.ly = cleanupRes.ly / Stage::standardDpi;
- CleanupSettingsModel::instance()->getCurrentParameters()->m_camera.setSize(
- cleanupSize);
- m_pref->storeOldUnits();
- if (m_unitOm->currentIndex() != 4) m_unitOm->setCurrentIndex(4);
- if (m_cameraUnitOm->currentIndex() != 4) m_cameraUnitOm->setCurrentIndex(4);
- m_unitOm->setDisabled(true);
- m_cameraUnitOm->setDisabled(true);
- m_defLevelDpi->setDisabled(true);
- m_defLevelDpi->setValue(Stage::standardDpi);
- m_defLevelWidth->setMeasure("camera.lx");
- m_defLevelHeight->setMeasure("camera.ly");
- m_defLevelWidth->setValue(m_pref->getDefLevelWidth());
- m_defLevelHeight->setValue(m_pref->getDefLevelHeight());
- m_defLevelHeight->setDecimals(0);
- m_defLevelWidth->setDecimals(0);
-
- } else {
- QString tempUnit;
- int unitIndex;
- tempUnit = m_pref->getOldUnits();
- unitIndex = std::find(::units, ::units + ::unitsCount, tempUnit) - ::units;
- m_unitOm->setCurrentIndex(unitIndex);
- tempUnit = m_pref->getOldCameraUnits();
- unitIndex = std::find(::units, ::units + ::unitsCount, tempUnit) - ::units;
- m_cameraUnitOm->setCurrentIndex(unitIndex);
- m_unitOm->setDisabled(false);
- m_cameraUnitOm->setDisabled(false);
- m_pref->setPixelsOnly(false);
- int levelType = m_pref->getDefLevelType();
- bool isRaster = levelType != PLI_XSHLEVEL;
- if (isRaster) {
- m_defLevelDpi->setDisabled(false);
- }
- m_defLevelHeight->setMeasure("level.ly");
- m_defLevelWidth->setMeasure("level.lx");
- m_defLevelWidth->setValue(m_pref->getDefLevelWidth());
- m_defLevelHeight->setValue(m_pref->getDefLevelHeight());
- m_defLevelHeight->setDecimals(4);
- m_defLevelWidth->setDecimals(4);
- }
-}
-
-//-----------------------------------------------------------------------------
+void PreferencesPopup::rebuildFormatsList() {
+ const Preferences& prefs = *Preferences::instance();
-void PreferencesPopup::onProjectRootChanged() {
- int index = 0;
- if (m_projectRootStuff->isChecked()) index |= 0x08;
- if (m_projectRootDocuments->isChecked()) index |= 0x04;
- if (m_projectRootDesktop->isChecked()) index |= 0x02;
- if (m_projectRootCustom->isChecked()) index |= 0x01;
- m_pref->setProjectRoot(index);
- if (index & 0x01) {
- m_customProjectRootFileField->show();
- m_customProjectRootLabel->show();
- m_projectRootDirections->show();
- } else {
- m_customProjectRootFileField->hide();
- m_customProjectRootLabel->hide();
- m_projectRootDirections->hide();
- }
-}
+ m_levelFormatNames->clear();
-//-----------------------------------------------------------------------------
+ int lf, lfCount = prefs.levelFormatsCount();
+ for (lf = 0; lf != lfCount; ++lf)
+ m_levelFormatNames->addItem(prefs.levelFormat(lf).m_name);
-void PreferencesPopup::onCustomProjectRootChanged() {
- QString text = m_customProjectRootFileField->getPath();
- m_pref->setCustomProjectRoot(text.toStdWString());
+ m_editLevelFormat->setEnabled(m_levelFormatNames->count() > 0);
}
//-----------------------------------------------------------------------------
-void PreferencesPopup::onPixelUnitExternallySelected(bool on) {
- // call slot function onPixelsOnlyChanged() accordingly
- m_pixelsOnlyCB->setCheckState((on) ? Qt::Checked : Qt::Unchecked);
+QList<ComboBoxItem> PreferencesPopup::buildFontStyleList() const {
+ TFontManager* instance = TFontManager::instance();
+ std::vector<std::wstring> typefaces;
+ std::vector<std::wstring>::iterator it;
+ QString font = m_pref->getStringValue(interfaceFont);
+ QString style = m_pref->getStringValue(interfaceFontStyle);
+ try {
+ instance->loadFontNames();
+ instance->setFamily(font.toStdWString());
+ instance->getAllTypefaces(typefaces);
+ } catch (TFontCreationError&) {
+ it = typefaces.begin();
+ typefaces.insert(it, style.toStdWString());
+ }
+ QList<ComboBoxItem> styleList;
+ for (it = typefaces.begin(); it != typefaces.end(); ++it)
+ styleList.append(ComboBoxItem(QString::fromStdWString(*it),
+ QString::fromStdWString(*it)));
+ return styleList;
}
//-----------------------------------------------------------------------------
-void PreferencesPopup::onUnitChanged(int index) {
- if (index == 4 && m_pixelsOnlyCB->isChecked() == false) {
- m_pixelsOnlyCB->setCheckState(Qt::Checked);
+void PreferencesPopup::onAutoSaveChanged() {
+ bool on = getUI<QGroupBox*>(autosaveEnabled)->isChecked();
+ if (!on) return;
+ CheckBox* autoSaveSceneCB = getUI<CheckBox*>(autosaveSceneEnabled);
+ CheckBox* autoSaveOtherFilesCB = getUI<CheckBox*>(autosaveOtherFilesEnabled);
+ if (!autoSaveSceneCB->isChecked() && !autoSaveOtherFilesCB->isChecked()) {
+ autoSaveSceneCB->setChecked(true);
+ autoSaveOtherFilesCB->setChecked(true);
}
- m_pref->setUnits(::units[index].toStdString());
}
//-----------------------------------------------------------------------------
-void PreferencesPopup::onCameraUnitChanged(int index) {
- if (index == 4 && m_pixelsOnlyCB->isChecked() == false) {
- m_pixelsOnlyCB->setChecked(true);
+void PreferencesPopup::onAutoSaveOptionsChanged() {
+ bool autoSaveScene = getUI<CheckBox*>(autosaveSceneEnabled)->isChecked();
+ bool autoSaveOtherFiles =
+ getUI<CheckBox*>(autosaveOtherFilesEnabled)->isChecked();
+ if (!autoSaveScene && !autoSaveOtherFiles) {
+ getUI<QGroupBox*>(autosaveEnabled)->setChecked(false);
}
- m_pref->setCameraUnits(::units[index].toStdString());
}
//-----------------------------------------------------------------------------
-void PreferencesPopup::onFunctionEditorToggleChanged(int index) {
- m_pref->setFunctionEditorToggle(
- static_cast<Preferences::FunctionEditorToggle>(index));
+void PreferencesPopup::onWatchFileSystemClicked() {
+ // emit signal to update behavior of the File browser
+ TApp::instance()->getCurrentScene()->notifyPreferenceChanged(
+ "WatchFileSystem");
}
//-----------------------------------------------------------------------------
-void PreferencesPopup::onRoomChoiceChanged(int index) {
- TApp::instance()->writeSettings();
- m_pref->setCurrentRoomChoice(index);
+void PreferencesPopup::onPathAliasPriorityChanged() {
+ TApp::instance()->getCurrentScene()->notifyPreferenceChanged(
+ "PathAliasPriority");
}
//-----------------------------------------------------------------------------
-void PreferencesPopup::onDropdownShortcutsCycleOptionsChanged(int index) {
- m_pref->setDropdownShortcutsCycleOptions(index);
+void PreferencesPopup::onStyleSheetTypeChanged() {
+ QApplication::setOverrideCursor(Qt::WaitCursor);
+ QString currentStyle = m_pref->getCurrentStyleSheetPath();
+ qApp->setStyleSheet(currentStyle);
+ QApplication::restoreOverrideCursor();
}
//-----------------------------------------------------------------------------
-void PreferencesPopup::rebuilldFontStyleList() {
- TFontManager *instance = TFontManager::instance();
- std::vector<std::wstring> typefaces;
- std::vector<std::wstring>::iterator it;
- QString font = m_interfaceFont->currentText();
- QString style = m_pref->getInterfaceFontStyle();
- try {
- instance->loadFontNames();
- instance->setFamily(font.toStdWString());
- instance->getAllTypefaces(typefaces);
- } catch (TFontCreationError &) {
- it = typefaces.begin();
- typefaces.insert(it, style.toStdWString());
- }
- m_interfaceFontStyle->clear();
- for (it = typefaces.begin(); it != typefaces.end(); ++it)
- m_interfaceFontStyle->addItem(QString::fromStdWString(*it));
-}
-
-void PreferencesPopup::onInterfaceFontChanged(int index) {
- QString font = m_interfaceFont->currentText();
- m_pref->setInterfaceFont(font.toStdString());
-
- QString oldTypeface = m_interfaceFontStyle->currentText();
- rebuilldFontStyleList();
- if (!oldTypeface.isEmpty()) {
- int newIndex = m_interfaceFontStyle->findText(oldTypeface);
- if (newIndex < 0) newIndex = 0;
- m_interfaceFontStyle->setCurrentIndex(newIndex);
- }
-
- if (font.contains("Comic Sans"))
- DVGui::warning(tr("Life is too short for Comic Sans"));
- if (font.contains("Wingdings"))
- DVGui::warning(tr("Good luck. You're on your own from here."));
-}
-//-----------------------------------------------------------------------------
+void PreferencesPopup::onPixelsOnlyChanged() {
+ QComboBox* unitOm = getUI<QComboBox*>(linearUnits);
+ QComboBox* cameraUnitOm = getUI<QComboBox*>(cameraUnits);
+ DoubleLineEdit* defLevelDpi = getUI<DoubleLineEdit*>(DefLevelDpi);
+ MeasuredDoubleLineEdit* defLevelWidth =
+ getUI<MeasuredDoubleLineEdit*>(DefLevelWidth);
+ MeasuredDoubleLineEdit* defLevelHeight =
+ getUI<MeasuredDoubleLineEdit*>(DefLevelHeight);
-void PreferencesPopup::onInterfaceFontStyleChanged(int index) {
- QString style = m_interfaceFontStyle->itemText(index);
- m_pref->setInterfaceFontStyle(style.toStdString());
-}
+ bool isPixel = m_pref->getBoolValue(pixelsOnly);
+ if (isPixel) {
+ m_pref->setValue(DefLevelDpi, Stage::standardDpi);
+ TCamera* camera =
+ TApp::instance()->getCurrentScene()->getScene()->getCurrentCamera();
+ TDimension camRes = camera->getRes();
+ TDimensionD camSize;
+ camSize.lx = camRes.lx / Stage::standardDpi;
+ camSize.ly = camRes.ly / Stage::standardDpi;
+ camera->setSize(camSize);
+ TDimension cleanupRes = CleanupSettingsModel::instance()
+ ->getCurrentParameters()
+ ->m_camera.getRes();
+ TDimensionD cleanupSize;
+ cleanupSize.lx = cleanupRes.lx / Stage::standardDpi;
+ cleanupSize.ly = cleanupRes.ly / Stage::standardDpi;
+ CleanupSettingsModel::instance()->getCurrentParameters()->m_camera.setSize(
+ cleanupSize);
-//-----------------------------------------------------------------------------
+ m_pref->storeOldUnits();
-void PreferencesPopup::onImportPolicyChanged(int index) {
- m_pref->setDefaultImportPolicy(index);
+ if (unitOm->currentText() != tr("pixel"))
+ unitOm->setCurrentText(tr("pixel"));
+ if (cameraUnitOm->currentText() != tr("pixel"))
+ cameraUnitOm->setCurrentText(tr("pixel"));
+ unitOm->setDisabled(true);
+ cameraUnitOm->setDisabled(true);
+ defLevelDpi->setDisabled(true);
+ defLevelDpi->setValue(Stage::standardDpi);
+ defLevelWidth->setMeasure("camera.lx");
+ defLevelHeight->setMeasure("camera.ly");
+ defLevelWidth->setValue(m_pref->getDoubleValue(DefLevelWidth));
+ defLevelHeight->setValue(m_pref->getDoubleValue(DefLevelHeight));
+ defLevelHeight->setDecimals(0);
+ defLevelWidth->setDecimals(0);
+ } else {
+ QString tempUnit = m_pref->getStringValue(oldUnits);
+ unitOm->setCurrentIndex(unitOm->findData(tempUnit));
+ tempUnit = m_pref->getStringValue(oldCameraUnits);
+ cameraUnitOm->setCurrentIndex(cameraUnitOm->findData(tempUnit));
+ unitOm->setDisabled(false);
+ cameraUnitOm->setDisabled(false);
+ bool isRaster = m_pref->getIntValue(DefLevelType) != PLI_XSHLEVEL;
+ if (isRaster) {
+ defLevelDpi->setDisabled(false);
+ }
+ defLevelHeight->setMeasure("level.ly");
+ defLevelWidth->setMeasure("level.lx");
+ defLevelWidth->setValue(m_pref->getDoubleValue(DefLevelWidth));
+ defLevelHeight->setValue(m_pref->getDoubleValue(DefLevelHeight));
+ defLevelHeight->setDecimals(4);
+ defLevelWidth->setDecimals(4);
+ }
}
//-----------------------------------------------------------------------------
-void PreferencesPopup::onImportPolicyExternallyChanged(int policy) {
- // call slot function onImportPolicyChanged() accordingly
- m_importPolicy->setCurrentIndex(policy);
+void PreferencesPopup::onUnitChanged() {
+ CheckBox* pixelsOnlyCB = getUI<CheckBox*>(pixelsOnly);
+ if (!pixelsOnlyCB->isChecked() &&
+ (m_pref->getStringValue(linearUnits) == "pixel" ||
+ m_pref->getStringValue(cameraUnits) == "pixel")) {
+ pixelsOnlyCB->setCheckState(Qt::Checked);
+ }
}
//-----------------------------------------------------------------------------
-void PreferencesPopup::onScanLevelTypeChanged(const QString &text) {
- m_pref->setScanLevelType(text.toStdString());
+void PreferencesPopup::beforeRoomChoiceChanged() {
+ TApp::instance()->writeSettings();
}
//-----------------------------------------------------------------------------
-void PreferencesPopup::onMinuteChanged() {
- if (m_minuteFld->getValue() != m_pref->getAutosavePeriod())
- m_pref->setAutosavePeriod(m_minuteFld->getValue());
+void PreferencesPopup::onDefLevelTypeChanged() {
+ bool isRaster = m_pref->getIntValue(DefLevelType) != PLI_XSHLEVEL &&
+ !m_pref->getBoolValue(newLevelSizeToCameraSizeEnabled);
+ m_controlIdMap.key(DefLevelWidth)->setEnabled(isRaster);
+ m_controlIdMap.key(DefLevelHeight)->setEnabled(isRaster);
+ if (!m_pref->getBoolValue(pixelsOnly))
+ m_controlIdMap.key(DefLevelDpi)->setEnabled(isRaster);
}
//-----------------------------------------------------------------------------
-void PreferencesPopup::onChunkSizeChanged() {
- m_pref->setDefaultTaskChunkSize(m_chunkSizeFld->getValue());
+void PreferencesPopup::onAutocreationTypeChanged() {
+ int autoCreationType = m_pref->getIntValue(AutocreationType);
+ m_controlIdMap.key(EnableAutoStretch)->setEnabled(autoCreationType == 2);
}
//-----------------------------------------------------------------------------
-void PreferencesPopup::onBlankCountChanged() {
- if (m_blanksCount && m_blankColor)
- m_pref->setBlankValues(m_blanksCount->getValue(), m_blankColor->getColor());
- TApp::instance()->getCurrentScene()->notifyPreferenceChanged("BlankCount");
+void PreferencesPopup::onUseNumpadForSwitchingStylesClicked() {
+ bool checked = m_pref->getBoolValue(useNumpadForSwitchingStyles);
+ if (checked) {
+ // check if there are any commands with numpadkey shortcuts
+ CommandManager* cm = CommandManager::instance();
+ QList<QAction*> actionsList;
+ for (int key = Qt::Key_0; key <= Qt::Key_9; key++) {
+ std::string str = QKeySequence(key).toString().toStdString();
+ QAction* action = cm->getActionFromShortcut(str);
+ if (action) actionsList.append(action);
+ }
+ QAction* tabAction = cm->getActionFromShortcut("Tab");
+ if (tabAction) actionsList.append(tabAction);
+ tabAction = cm->getActionFromShortcut("Shift+Tab");
+ if (tabAction) actionsList.append(tabAction);
+ // if there are actions using numpad shortcuts, notify to release them.
+ if (!actionsList.isEmpty()) {
+ QString msgStr =
+ tr("Numpad keys are assigned to the following commands.\nIs it OK to "
+ "release these shortcuts?");
+ for (int a = 0; a < actionsList.size(); a++) {
+ msgStr += "\n" + actionsList.at(a)->iconText() + " (" +
+ actionsList.at(a)->shortcut().toString() + ")";
+ }
+ int ret = DVGui::MsgBox(msgStr, tr("OK"), tr("Cancel"), 1);
+ if (ret == 2 || ret == 0) { // canceled
+ getUI<CheckBox*>(useNumpadForSwitchingStyles)->setChecked(false);
+ return;
+ } else { // accepted, then release shortcuts
+ for (int a = 0; a < actionsList.size(); a++)
+ cm->setShortcut(actionsList[a], "");
+ }
+ }
+ }
+ // emit signal to update Palette and Viewer
+ TApp::instance()->getCurrentScene()->notifyPreferenceChanged(
+ "NumpadForSwitchingStyles");
}
//-----------------------------------------------------------------------------
-void PreferencesPopup::onOnionPaperThicknessChanged() {
- if (m_onionPaperThickness) {
- m_pref->setOnionPaperThickness(m_onionPaperThickness->getValue());
- TApp::instance()->getCurrentScene()->notifySceneChanged();
- }
+void PreferencesPopup::onLevelBasedToolsDisplayChanged() {
+ TApp::instance()->getCurrentScene()->notifyPreferenceChanged(
+ "ToolbarDisplay");
}
//-----------------------------------------------------------------------------
-void PreferencesPopup::onBlankColorChanged(const TPixel32 &, bool isDragging) {
- if (isDragging) return;
-
- if (m_blanksCount && m_blankColor)
- m_pref->setBlankValues(m_blanksCount->getValue(), m_blankColor->getColor());
- TApp::instance()->getCurrentScene()->notifyPreferenceChanged("BlankColor");
+void PreferencesPopup::onShowKeyframesOnCellAreaChanged() {
+ TApp::instance()->getCurrentScene()->notifyPreferenceChanged("XsheetCamera");
}
//-----------------------------------------------------------------------------
-void PreferencesPopup::onAutomaticSVNRefreshChanged(int index) {
- m_pref->enableAutomaticSVNFolderRefresh(index == Qt::Checked);
+void PreferencesPopup::onShowXSheetToolbarClicked() {
+ TApp::instance()->getCurrentScene()->notifyPreferenceChanged("XSheetToolbar");
}
//-----------------------------------------------------------------------------
-void PreferencesPopup::onCheckLatestVersionChanged(bool on) {
- m_pref->enableLatestVersionCheck(on);
+void PreferencesPopup::onBlankCountChanged() {
+ TApp::instance()->getCurrentScene()->notifyPreferenceChanged("BlankCount");
}
//-----------------------------------------------------------------------------
-void PreferencesPopup::onSVNEnabledChanged(int index) {
- bool enabled = index == Qt::Checked;
- if (enabled) {
- if (VersionControl::instance()->testSetup())
- m_pref->enableSVN(true);
- else {
- if (m_enableVersionControl) m_enableVersionControl->setChecked(false);
- }
- } else
- m_pref->enableSVN(false);
+void PreferencesPopup::onBlankColorChanged() {
+ TApp::instance()->getCurrentScene()->notifyPreferenceChanged("BlankColor");
}
//-----------------------------------------------------------------------------
-void invalidateIcons(); // implemented in sceneviewer.cpp; in which fucking
- // header I can put this declaration?!
-
-void PreferencesPopup::onTranspCheckDataChanged(const TPixel32 &,
- bool isDragging) {
- if (isDragging) return;
+void PreferencesPopup::onOnionSkinVisibilityChanged() {
+ bool onionActive = m_pref->getBoolValue(onionSkinEnabled);
+ m_controlIdMap.key(onionPaperThickness)->setEnabled(onionActive);
+ m_controlIdMap.key(backOnionColor)->setEnabled(onionActive);
+ m_controlIdMap.key(frontOnionColor)->setEnabled(onionActive);
+ m_controlIdMap.key(onionInksOnly)->setEnabled(onionActive);
- m_pref->setTranspCheckData(m_transpCheckBgColor->getColor(),
- m_transpCheckInkColor->getColor(),
- m_transpCheckPaintColor->getColor());
-
- invalidateIcons();
+ OnionSkinMask osm =
+ TApp::instance()->getCurrentOnionSkin()->getOnionSkinMask();
+ osm.enable(onionActive);
+ TApp::instance()->getCurrentOnionSkin()->setOnionSkinMask(osm);
+ TApp::instance()->getCurrentOnionSkin()->notifyOnionSkinMaskChanged();
}
//---------------------------------------------------------------------------------------
-void PreferencesPopup::onOnionDataChanged(const TPixel32 &, bool isDragging) {
- if (isDragging) return;
- bool inksOnly = false;
- if (m_inksOnly) inksOnly = m_inksOnly->isChecked();
- m_pref->setOnionData(m_frontOnionColor->getColor(),
- m_backOnionColor->getColor(), inksOnly);
-
+void PreferencesPopup::onOnionColorChanged() {
TApp::instance()->getCurrentScene()->notifySceneChanged();
TApp::instance()->getCurrentLevel()->notifyLevelViewChange();
TApp::instance()->getCurrentOnionSkin()->notifyOnionSkinMaskChanged();
@@ -516,2690 +552,1373 @@ void PreferencesPopup::onOnionDataChanged(const TPixel32 &, bool isDragging) {
//-----------------------------------------------------------------------------
-void PreferencesPopup::onOnionDataChanged(int) {
- bool inksOnly = false;
- if (m_inksOnly) inksOnly = m_inksOnly->isChecked();
- m_pref->setOnionData(m_frontOnionColor->getColor(),
- m_backOnionColor->getColor(), inksOnly);
+void invalidateIcons(); // implemented in sceneviewer.cpp; in which fucking
+ // header I can put this declaration?!
- TApp::instance()->getCurrentScene()->notifySceneChanged();
-}
+void PreferencesPopup::onTranspCheckDataChanged() { invalidateIcons(); }
//-----------------------------------------------------------------------------
-void PreferencesPopup::onViewValuesChanged() {
- m_pref->setViewValues(m_viewShrink->getValue(), m_viewStep->getValue());
+void PreferencesPopup::onSVNEnabledChanged() {
+ if (m_pref->getBoolValue(SVNEnabled)) {
+ if (!VersionControl::instance()->testSetup())
+ getUI<CheckBox*>(SVNEnabled)->setChecked(false);
+ }
}
//-----------------------------------------------------------------------------
-void PreferencesPopup::onIconSizeChanged() {
- TDimension size(m_iconSizeLx->getValue(), m_iconSizeLy->getValue());
- if (m_pref->getIconSize() == size) return;
-
- m_pref->setIconSize(size);
+void PreferencesPopup::notifySceneChanged() {
+ TApp::instance()->getCurrentScene()->notifySceneChanged();
}
//-----------------------------------------------------------------------------
-void PreferencesPopup::onAutoExposeChanged(int index) {
- m_pref->enableAutoExpose(index == Qt::Checked);
+void PreferencesPopup::onAutoSaveExternallyChanged() {
+ QGroupBox* autoSaveGroup = getUI<QGroupBox*>(autosaveEnabled);
+ autoSaveGroup->setChecked(m_pref->getBoolValue(autosaveEnabled));
}
//-----------------------------------------------------------------------------
-void PreferencesPopup::onIgnoreImageDpiChanged(int index) {
- m_pref->setIgnoreImageDpi(index == Qt::Checked);
+void PreferencesPopup::onAutoSavePeriodExternallyChanged() {
+ IntLineEdit* minuteFld = getUI<IntLineEdit*>(autosavePeriod);
+ minuteFld->setValue(m_pref->getIntValue(autosavePeriod));
}
//-----------------------------------------------------------------------------
-void PreferencesPopup::onKeepFillOnVectorSimplifyChanged(int index) {
- m_pref->setKeepFillOnVectorSimplify(index == Qt::Checked);
+void PreferencesPopup::onProjectRootChanged() {
+ int index = 0;
+ // if (m_projectRootStuff->isChecked())
+ index |= 0x08;
+ if (m_projectRootDocuments->isChecked()) index |= 0x04;
+ if (m_projectRootDesktop->isChecked()) index |= 0x02;
+ if (m_projectRootCustom->isChecked()) index |= 0x01;
+ m_pref->setValue(projectRoot, index);
}
-
//-----------------------------------------------------------------------------
-void PreferencesPopup::onUseHigherDpiOnVectorSimplifyChanged(int index) {
- m_pref->setUseHigherDpiOnVectorSimplify(index == Qt::Checked);
+void PreferencesPopup::onPixelUnitExternallySelected(bool on) {
+ CheckBox* pixelsOnlyCB = getUI<CheckBox*>(pixelsOnly);
+ // call slot function onPixelsOnlyChanged() accordingly
+ pixelsOnlyCB->setCheckState((on) ? Qt::Checked : Qt::Unchecked);
}
//-----------------------------------------------------------------------------
-void PreferencesPopup::onDownArrowInLevelStripCreatesNewFrame(int index) {
- m_pref->setDownArrowLevelStripNewFrame(index == Qt::Checked);
-}
+void PreferencesPopup::onInterfaceFontChanged(const QString& text) {
+ m_pref->setValue(interfaceFont, text);
-//-----------------------------------------------------------------------------
+ // rebuild font styles
+ QComboBox* fontStyleCombo = getUI<QComboBox*>(interfaceFontStyle);
+ QString oldTypeface = fontStyleCombo->currentText();
+ QList<ComboBoxItem> newStyleItems = buildFontStyleList();
+ fontStyleCombo->clear();
+ for (ComboBoxItem& item : newStyleItems)
+ fontStyleCombo->addItem(item.first, item.second);
+ if (!oldTypeface.isEmpty()) {
+ int newIndex = fontStyleCombo->findText(oldTypeface);
+ if (newIndex < 0) newIndex = 0;
+ fontStyleCombo->setCurrentIndex(newIndex);
+ }
-void PreferencesPopup::onSubsceneFolderChanged(int index) {
- m_pref->enableSubsceneFolder(index == Qt::Checked);
+ if (text.contains("Comic Sans"))
+ DVGui::warning(tr("Life is too short for Comic Sans"));
+ if (text.contains("Wingdings"))
+ DVGui::warning(tr("Good luck. You're on your own from here."));
}
//-----------------------------------------------------------------------------
-void PreferencesPopup::onViewGeneratedMovieChanged(int index) {
- m_pref->enableGeneratedMovieView(index == Qt::Checked);
+void PreferencesPopup::onLutPathChanged() {
+ FileField* lutPathFileField = getUI<FileField*>(colorCalibrationLutPaths);
+ m_pref->setColorCalibrationLutPath(LutManager::instance()->getMonitorName(),
+ lutPathFileField->getPath());
}
//-----------------------------------------------------------------------------
-void PreferencesPopup::onXsheetStepChanged() {
- m_pref->setXsheetStep(m_xsheetStep->getValue());
-}
+void PreferencesPopup::onAddLevelFormat() {
+ bool ok = true;
+ QString formatName = DVGui::getText(tr("New Level Format"),
+ tr("Assign the new level format name:"),
+ tr("New Format"), &ok);
-//-----------------------------------------------------------------------------
+ if (ok) {
+ int formatIdx = Preferences::instance()->addLevelFormat(formatName);
+ rebuildFormatsList();
-void PreferencesPopup::onXsheetAutopanChanged(int index) {
- m_pref->enableXsheetAutopan(index == Qt::Checked);
+ m_levelFormatNames->setCurrentIndex(formatIdx);
+ }
}
//-----------------------------------------------------------------------------
-void PreferencesPopup::onIgnoreAlphaonColumn1Changed(int index) {
- m_pref->enableIgnoreAlphaonColumn1(index == Qt::Checked);
+void PreferencesPopup::onRemoveLevelFormat() {
+ Preferences::instance()->removeLevelFormat(
+ m_levelFormatNames->currentIndex());
+ rebuildFormatsList();
}
+
//-----------------------------------------------------------------------------
-void PreferencesPopup::onRewindAfterPlayback(int index) {
- m_pref->enableRewindAfterPlayback(index == Qt::Checked);
-}
+void PreferencesPopup::onEditLevelFormat() {
+ if (!m_formatProperties) {
+ m_formatProperties = new FormatProperties(this);
-//-----------------------------------------------------------------------------
+ bool ret = connect(m_formatProperties, SIGNAL(dialogClosed()),
+ SLOT(onLevelFormatEdited()));
+ assert(ret);
+ }
+
+ const Preferences::LevelFormat& lf =
+ Preferences::instance()->levelFormat(m_levelFormatNames->currentIndex());
-void PreferencesPopup::onFitToFlipbook(int index) {
- m_pref->enableFitToFlipbook(index == Qt::Checked);
+ m_formatProperties->setLevelFormat(lf);
+ m_formatProperties->show();
}
//-----------------------------------------------------------------------------
-void PreferencesPopup::onPreviewAlwaysOpenNewFlip(int index) {
- m_pref->enablePreviewAlwaysOpenNewFlip(index == Qt::Checked);
-}
+void PreferencesPopup::onLevelFormatEdited() {
+ assert(m_formatProperties);
-//-----------------------------------------------------------------------------
+ Preferences& prefs = *Preferences::instance();
+ int formatIdx = m_levelFormatNames->currentIndex();
-void PreferencesPopup::onAskForOverrideRender(int index) {
- m_pref->setAskForOverrideRender(index == Qt::Checked);
-}
-//-----------------------------------------------------------------------------
+ prefs.removeLevelFormat(formatIdx);
+ formatIdx = prefs.addLevelFormat(m_formatProperties->levelFormat());
-void PreferencesPopup::onRasterOptimizedMemoryChanged(int index) {
- if (m_pref->isRasterOptimizedMemory() == (index == Qt::Checked)) return;
+ rebuildFormatsList();
- m_pref->enableRasterOptimizedMemory(index == Qt::Checked);
+ m_levelFormatNames->setCurrentIndex(formatIdx);
}
//-----------------------------------------------------------------------------
-void PreferencesPopup::onGetFillOnlySavebox(int index) {
- if (m_pref->getFillOnlySavebox() == (index == Qt::Checked)) return;
-
- m_pref->setFillOnlySavebox(index == Qt::Checked);
- TApp::instance()->getCurrentScene()->notifySceneChanged();
+void PreferencesPopup::onImportPolicyExternallyChanged(int policy) {
+ QComboBox* importPolicyCombo = getUI<QComboBox*>(importPolicy);
+ // update preferences data accordingly
+ importPolicyCombo->setCurrentIndex(policy);
}
-
//-----------------------------------------------------------------------------
-void PreferencesPopup::onSaveUnpaintedInCleanupChanged(int index) {
- if (m_pref->isSaveUnpaintedInCleanupEnable() == (index == Qt::Checked))
- return;
-
- m_pref->enableSaveUnpaintedInCleanup(index == Qt::Checked);
+#ifdef LINETEST
+void PreferencesPopup::onLineTestFpsCapture(int index) {
+ if (index == 0) m_pref->setLineTestFpsCapture(0);
+ if (index == 1)
+ m_pref->setLineTestFpsCapture(25);
+ else if (index == 2)
+ m_pref->setLineTestFpsCapture(30);
}
+#endif
//-----------------------------------------------------------------------------
-void PreferencesPopup::onMinimizeSaveboxAfterEditing(int index) {
- m_pref->enableMinimizeSaveboxAfterEditing(index == Qt::Checked);
-}
+QWidget* PreferencesPopup::createUI(PreferencesItemId id,
+ const QList<ComboBoxItem>& comboItems) {
+ PreferencesItem item = m_pref->getItem(id);
+ // create widget depends on the parameter types
+ QWidget* widget = nullptr;
+ bool ret = false;
+ switch (item.type) {
+ case QMetaType::Bool: // create CheckBox
+ {
+ CheckBox* cb = new CheckBox(getUIString(id), this);
+ cb->setChecked(item.value.toBool());
+ ret = connect(cb, SIGNAL(stateChanged(int)), this, SLOT(onChange()));
+ widget = cb;
+ } break;
+
+ case QMetaType::Int: // create either QComboBox or IntLineEdit
+ if (!comboItems.isEmpty()) { // create QComboBox
+ QComboBox* combo = new QComboBox(this);
+ for (const ComboBoxItem& item : comboItems)
+ combo->addItem(item.first, item.second);
+ combo->setCurrentIndex(combo->findData(item.value));
+ ret = connect(combo, SIGNAL(currentIndexChanged(int)), this,
+ SLOT(onChange()));
+ widget = combo;
+ } else { // create IntLineEdit
+ assert(item.max.toInt() != -1);
+ DVGui::IntLineEdit* field = new DVGui::IntLineEdit(
+ this, item.value.toInt(), item.min.toInt(), item.max.toInt());
+ ret = connect(field, SIGNAL(editingFinished()), this, SLOT(onChange()));
+ widget = field;
+ }
+ break;
+
+ case QMetaType::Double: // create either MeasuredDoubleLineEdit or
+ // DoubleLineEdit
+ if (id == DefLevelDpi) { // currently DoubleLineEdit is only used in the
+ // dpi field
+ DoubleLineEdit* field = new DoubleLineEdit(this, item.value.toDouble());
+ field->setRange(item.min.toDouble(), item.max.toDouble());
+ ret = connect(field, SIGNAL(valueChanged()), this, SLOT(onChange()));
+ widget = field;
+ } else {
+ MeasuredDoubleLineEdit* field = new MeasuredDoubleLineEdit(this);
+ field->setRange(item.min.toDouble(), item.max.toDouble());
+ if (m_pref->getStringValue(linearUnits) == "pixel")
+ field->setMeasure((id == DefLevelWidth) ? "camera.lx" : "camera.ly");
+ else
+ field->setMeasure((id == DefLevelWidth) ? "level.lx" : "level.ly");
+ field->setValue(item.value.toDouble());
+ ret = connect(field, SIGNAL(valueChanged()), this, SLOT(onChange()));
+ widget = field;
+ }
+ break;
+
+ case QMetaType::QString: // create QFontComboBox, QComboBox or FileField
+ if (id == interfaceFont) { // create QFontComboBox
+ QFontComboBox* combo = new QFontComboBox(this);
+ combo->setCurrentText(item.value.toString());
+ ret = connect(combo, SIGNAL(currentIndexChanged(const QString&)), this,
+ SLOT(onInterfaceFontChanged(const QString&)));
+ widget = combo;
+ } else if (!comboItems.isEmpty()) { // create QComboBox
+ QComboBox* combo = new QComboBox(this);
+ for (const ComboBoxItem& item : comboItems)
+ combo->addItem(item.first, item.second);
+ combo->setCurrentIndex(combo->findData(item.value));
+ ret = connect(combo, SIGNAL(currentIndexChanged(int)), this,
+ SLOT(onChange()));
+ widget = combo;
+ } else { // create FileField
+ DVGui::FileField* field =
+ new DVGui::FileField(this, item.value.toString());
+ ret = connect(field, SIGNAL(pathChanged()), this, SLOT(onChange()));
+ widget = field;
+ }
+ break;
-//-----------------------------------------------------------------------------
+ case QMetaType::QSize: // create SizeField
+ {
+ SizeField* field = new SizeField(item.min.toSize(), item.max.toSize(),
+ item.value.toSize(), this);
+ ret = connect(field, SIGNAL(editingFinished()), this, SLOT(onChange()));
+ widget = field;
+ } break;
-void PreferencesPopup::onDefaultViewerChanged(int index) {
- m_pref->enableDefaultViewer(index == Qt::Checked);
+ case QMetaType::QColor: // create ColorField
+ {
+ ColorField* field =
+ new ColorField(this, false, colorToTPixel(item.value.value<QColor>()));
+ ret = connect(field, SIGNAL(colorChanged(const TPixel32&, bool)), this,
+ SLOT(onColorFieldChanged(const TPixel32&, bool)));
+ widget = field;
+ } break;
+
+ case QMetaType::QVariantMap: // used in colorCalibrationLutPaths
+ {
+ assert(id == colorCalibrationLutPaths);
+ DVGui::FileField* field = new DVGui::FileField(
+ this, QString("- Please specify 3DLUT file (.3dl) -"), false, true);
+ QString lutPath = m_pref->getColorCalibrationLutPath(
+ LutManager::instance()->getMonitorName());
+ if (!lutPath.isEmpty()) field->setPath(lutPath);
+ field->setFileMode(QFileDialog::ExistingFile);
+ QStringList lutFileTypes = {"3dl"};
+ field->setFilters(lutFileTypes);
+ ret = connect(field, SIGNAL(pathChanged()), this, SLOT(onLutPathChanged()));
+ widget = field;
+ } break;
+
+ default:
+ std::cout << "unsupported value type" << std::endl;
+ break;
+ }
+ assert(ret);
+ m_controlIdMap[widget] = id;
+ return widget;
}
//-----------------------------------------------------------------------------
-void PreferencesPopup::onAutoSaveChanged(bool on) {
- if (m_autoSaveGroup->isChecked() != m_pref->isAutosaveEnabled())
- m_pref->enableAutosave(on);
- if (on && !m_autoSaveSceneCB->isChecked() &&
- !m_autoSaveOtherFilesCB->isChecked()) {
- m_autoSaveSceneCB->setChecked(true);
- m_autoSaveOtherFilesCB->setChecked(true);
- }
-}
+QGridLayout* PreferencesPopup::insertGroupBoxUI(PreferencesItemId id,
+ QGridLayout* layout) {
+ PreferencesItem item = m_pref->getItem(id);
+ assert(item.type == QMetaType::Bool);
+ QGroupBox* box = new QGroupBox(getUIString(id), this);
+ box->setCheckable(true);
+ box->setChecked(item.value.toBool());
-//-----------------------------------------------------------------------------
+ QGridLayout* lay = new QGridLayout();
+ setupLayout(lay, 5);
+ box->setLayout(lay);
-void PreferencesPopup::onAutoSaveExternallyChanged() {
- m_autoSaveGroup->setChecked(Preferences::instance()->isAutosaveEnabled());
+ layout->addWidget(box, layout->rowCount(), 0, 1, 3);
+
+ bool ret = connect(box, SIGNAL(clicked(bool)), this, SLOT(onChange()));
+ // bool ret = connect(box, SIGNAL(clicked(bool)), this,
+ // SLOT(onGroupBoxChanged(bool)));
+ assert(ret);
+ m_controlIdMap[box] = id;
+ return lay;
}
//-----------------------------------------------------------------------------
-void PreferencesPopup::onAutoSavePeriodExternallyChanged() {
- m_minuteFld->setValue(m_pref->getAutosavePeriod());
-}
+void PreferencesPopup::insertUI(PreferencesItemId id, QGridLayout* layout,
+ const QList<ComboBoxItem>& comboItems) {
+ PreferencesItem item = m_pref->getItem(id);
-//-----------------------------------------------------------------------------
+ QWidget* widget = createUI(id, comboItems);
+ if (!widget) return;
+
+ bool isFileField = false;
+ if (item.type == QMetaType::QVariantMap ||
+ (item.type == QMetaType::QString && dynamic_cast<FileField*>(widget)))
+ isFileField = true;
-void PreferencesPopup::onAutoSaveSceneChanged(int index) {
- m_pref->enableAutosaveScene(index == Qt::Checked);
- if (!m_autoSaveOtherFilesCB->isChecked() && index == Qt::Unchecked) {
- m_autoSaveGroup->setChecked(false);
+ // CheckBox contains label in itself
+ if (item.type == QMetaType::Bool)
+ layout->addWidget(widget, layout->rowCount(), 0, 1, 2);
+ else { // insert labels for other types
+ int row = layout->rowCount();
+ layout->addWidget(new QLabel(getUIString(id), this), row, 0,
+ Qt::AlignRight | Qt::AlignVCenter);
+ if (isFileField)
+ layout->addWidget(widget, row, 1, 1, 2);
+ else
+ layout->addWidget(widget, row, 1, Qt::AlignLeft | Qt::AlignVCenter);
}
}
//-----------------------------------------------------------------------------
-void PreferencesPopup::onAutoSaveOtherFilesChanged(int index) {
- m_pref->enableAutosaveOtherFiles(index == Qt::Checked);
- if (!m_autoSaveSceneCB->isChecked() && index == Qt::Unchecked) {
- m_autoSaveGroup->setChecked(false);
+void PreferencesPopup::insertDualUIs(
+ PreferencesItemId leftId, PreferencesItemId rightId, QGridLayout* layout,
+ const QList<ComboBoxItem>& leftComboItems,
+ const QList<ComboBoxItem>& rightComboItems) {
+ // currently this function does not suppose that the checkbox is on the left
+ assert(m_pref->getItem(leftId).type != QMetaType::Bool);
+ int row = layout->rowCount();
+ layout->addWidget(new QLabel(getUIString(leftId), this), row, 0,
+ Qt::AlignRight | Qt::AlignVCenter);
+ QHBoxLayout* innerLay = new QHBoxLayout();
+ innerLay->setMargin(0);
+ innerLay->setSpacing(10);
+ {
+ innerLay->addWidget(createUI(leftId, leftComboItems), 0);
+ if (m_pref->getItem(rightId).type != QMetaType::Bool)
+ innerLay->addWidget(new QLabel(getUIString(rightId), this), 0,
+ Qt::AlignRight | Qt::AlignVCenter);
+ innerLay->addWidget(createUI(rightId, rightComboItems), 0);
+ innerLay->addStretch(1);
}
+ layout->addLayout(innerLay, row, 1, 1, 2);
}
//-----------------------------------------------------------------------------
-void PreferencesPopup::onStartupPopupChanged(int index) {
- m_pref->enableStartupPopup(index == Qt::Checked);
+void PreferencesPopup::insertFootNote(QGridLayout* layout) {
+ QLabel* note =
+ new QLabel(tr("* Changes will take effect the next time you run Toonz"));
+ note->setStyleSheet("font-size: 10px; font: italic;");
+ layout->addWidget(note, layout->rowCount(), 0, 1, 2,
+ Qt::AlignLeft | Qt::AlignVCenter);
+}
+
+//-----------------------------------------------------------------------------
+
+QString PreferencesPopup::getUIString(PreferencesItemId id) {
+ const static QMap<PreferencesItemId, QString> uiStringTable = {
+ // General
+ {defaultViewerEnabled, tr("Use Default Viewer for Movie Formats")},
+ {rasterOptimizedMemory, tr("Minimize Raster Memory Fragmentation *")},
+ {autosaveEnabled, tr("Save Automatically")},
+ {autosavePeriod, tr("Interval(Minutes): ")},
+ {autosaveSceneEnabled, tr("Automatically Save the Scene File")},
+ {autosaveOtherFilesEnabled, tr("Automatically Save Non-Scene Files")},
+ {startupPopupEnabled, tr("Show Startup Window when OpenToonz Starts")},
+ {undoMemorySize, tr("Undo Memory Size (MB)")},
+ {taskchunksize, tr("Render Task Chunk Size:")},
+ {replaceAfterSaveLevelAs,
+ tr("Replace Toonz Level after SaveLevelAs command")},
+ {backupEnabled, tr("Backup Scene and Animation Levels when Saving")},
+ {backupKeepCount, tr("# of backups to keep: ")},
+ {sceneNumberingEnabled, tr("Show Info in Rendered Frames")},
+ {watchFileSystemEnabled,
+ tr("Watch File System and Update File Browser Automatically")},
+ //{ projectRoot, tr("") },
+ {customProjectRoot, tr("Custom Project Path(s): ")},
+ {pathAliasPriority, tr("Path Alias Priority:")},
+
+ // Interface
+ {CurrentStyleSheetName, tr("Theme:")},
+ {pixelsOnly, tr("All imported images will use the same DPI")},
+ //{ oldUnits, tr("") },
+ //{ oldCameraUnits, tr("") },
+ {linearUnits, tr("Unit:")},
+ {cameraUnits, tr("Camera Unit:")},
+ {CurrentRoomChoice, tr("Rooms*:")},
+ {functionEditorToggle, tr("Function Editor*:")},
+ {moveCurrentFrameByClickCellArea,
+ tr("Move Current Frame by Clicking on Xsheet / Numerical Columns Cell "
+ "Area")},
+ {actualPixelViewOnSceneEditingMode,
+ tr("Enable Actual Pixel View on Scene Editing Mode")},
+ {levelNameOnEachMarkerEnabled, tr("Display Level Name on Each Marker")},
+ {showRasterImagesDarkenBlendedInViewer,
+ tr("Show Raster Images Darken Blended")},
+ {showFrameNumberWithLetters,
+ tr("Show \"ABC\" Appendix to the Frame Number in Xsheet Cell")},
+ {iconSize, tr("Icon Size *")},
+ {viewShrink, tr("Viewer Shrink")},
+ {viewStep, tr("Step")},
+ {viewerZoomCenter, tr("Viewer Zoom Center")},
+ {CurrentLanguageName, tr("Language *:")},
+ {interfaceFont, tr("Font *:")},
+ {interfaceFontStyle, tr("Style *:")},
+ {colorCalibrationEnabled,
+ tr("Color Calibration using 3D Look-up Table *")},
+ {colorCalibrationLutPaths,
+ tr("3DLUT File for [%1] *:")
+ .arg(LutManager::instance()->getMonitorName())},
+
+ // Visualization
+ {show0ThickLines, tr("Show Lines with Thickness 0")},
+ {regionAntialias, tr("Antialiased Region Boundaries")},
+
+ // Loading
+ {importPolicy, tr("Default File Import Behavior:")},
+ {autoExposeEnabled, tr("Expose Loaded Levels in Xsheet")},
+ {subsceneFolderEnabled,
+ tr("Create Sub-folder when Importing Sub-xsheet")},
+ {removeSceneNumberFromLoadedLevelName,
+ tr("Automatically Remove Scene Number from Loaded Level Name")},
+ {IgnoreImageDpi, tr("Use Camera DPI for All Imported Images")},
+ {initialLoadTlvCachingBehavior, tr("Default TLV Caching Behavior:")},
+ {columnIconLoadingPolicy, tr("Column Icon:")},
+ //{ levelFormats, tr("") },
+
+ // Saving
+ {rasterBackgroundColor, tr("Matte color: ")},
+
+ // Import / Export
+ {ffmpegPath, tr("FFmpeg Path: ")},
+ {ffmpegTimeout, tr("FFmpeg Timeout:")},
+ {fastRenderPath, tr("Fast Render Path: ")},
+
+ // Drawing
+ {scanLevelType, tr("Scan File Format:")},
+ {DefLevelType, tr("Default Level Type:")},
+ {newLevelSizeToCameraSizeEnabled,
+ tr("New Levels Default to the Current Camera Size")},
+ {DefLevelWidth, tr("Width:")},
+ {DefLevelHeight, tr(" Height:")},
+ {DefLevelDpi, tr("DPI:")},
+ {AutocreationType, tr("Autocreation:")},
+ {EnableAutoStretch, tr("Enable auto-stretch frame")},
+ {vectorSnappingTarget, tr("Vector Snapping:")},
+ {saveUnpaintedInCleanup,
+ tr("Keep Original Cleaned Up Drawings As Backup")},
+ {minimizeSaveboxAfterEditing, tr("Minimize Savebox after Editing")},
+ {useNumpadForSwitchingStyles,
+ tr("Use Numpad and Tab keys for Switching Styles")},
+ {downArrowInLevelStripCreatesNewFrame,
+ tr("Down Arrow at End of Level Strip Creates a New Frame")},
+ {keepFillOnVectorSimplify,
+ tr("Keep fill when using \"Replace Vectors\" command")},
+ {useHigherDpiOnVectorSimplify,
+ tr("Use higher DPI for calculations - Slower but more accurate")},
+
+ // Tools
+ {dropdownShortcutsCycleOptions, tr("Dropdown Shortcuts:")},
+ {FillOnlysavebox, tr("Use the TLV Savebox to Limit Filling Operations")},
+ {multiLayerStylePickerEnabled,
+ tr("Multi Layer Style Picker : Switch Levels by Picking")},
+ {cursorBrushType, tr("Basic Cursor Type:")},
+ {cursorBrushStyle, tr("Cursor Style:")},
+ {cursorOutlineEnabled, tr("Show Cursor Size Outlines")},
+ {levelBasedToolsDisplay, tr("Toolbar Display Behaviour:")},
+
+ // Xsheet
+ {xsheetLayoutPreference, tr("Column Header Layout*:")},
+ {xsheetStep, tr("Next/Previous Step Frames:")},
+ {xsheetAutopanEnabled, tr("Xsheet Autopan during Playback")},
+ {DragCellsBehaviour, tr("Cell-dragging Behaviour:")},
+ {ignoreAlphaonColumn1Enabled,
+ tr("Ignore Alpha Channel on Levels in Column 1")},
+ {showKeyframesOnXsheetCellArea, tr("Show Keyframes on Cell Area")},
+ {showXsheetCameraColumn, tr("Show Camera Column")},
+ {useArrowKeyToShiftCellSelection,
+ tr("Use Arrow Key to Shift Cell Selection")},
+ {inputCellsWithoutDoubleClickingEnabled,
+ tr("Enable to Input Cells without Double Clicking")},
+ {shortcutCommandsWhileRenamingCellEnabled,
+ tr("Enable OpenToonz Commands' Shortcut Keys While Renaming Cell")},
+ {showXSheetToolbar, tr("Show Toolbar in the XSheet ")},
+ {expandFunctionHeader,
+ tr("Expand Function Editor Header to Match Xsheet Toolbar Height*")},
+ {showColumnNumbers, tr("Show Column Numbers in Column Headers")},
+ {syncLevelRenumberWithXsheet,
+ tr("Sync Level Strip Drawing Number Changes with the Xsheet")},
+ {currentTimelineEnabled,
+ tr("Show Current Time Indicator (Timeline Mode only)")},
+ {currentColumnColor, tr("Current Column Color:")},
+
+ // Animation
+ {keyframeType, tr("Default Interpolation:")},
+ {animationStep, tr("Animation Step:")},
+
+ // Preview
+ {blanksCount, tr("Blank Frames:")},
+ {blankColor, tr("Blank Frames Color:")},
+ {rewindAfterPlayback, tr("Rewind after Playback")},
+ {previewAlwaysOpenNewFlip, tr("Display in a New Flipbook Window")},
+ {fitToFlipbook, tr("Fit to Flipbook")},
+ {generatedMovieViewEnabled, tr("Open Flipbook after Rendering")},
+
+ // Onion Skin
+ {onionSkinEnabled, tr("Onion Skin ON")},
+ {onionPaperThickness, tr("Paper Thickness:")},
+ {backOnionColor, tr("Previous Frames Correction:")},
+ {frontOnionColor, tr("Following Frames Correction:")},
+ {onionInksOnly, tr("Display Lines Only ")},
+ {onionSkinDuringPlayback, tr("Show Onion Skin During Playback")},
+ {useOnionColorsForShiftAndTraceGhosts,
+ tr("Use Onion Skin Colors for Reference Drawings of Shift and Trace")},
+ {animatedGuidedDrawing, tr("Vector Guided Style:")},
+
+ // Colors
+ {viewerBGColor, tr("Viewer BG Color")},
+ {previewBGColor, tr("Preview BG Color")},
+ {levelEditorBoxColor, tr("Level Editor Box Color")},
+ {chessboardColor1, tr("ChessBoard Color 1")},
+ {chessboardColor2, tr("Chessboard Color 2")},
+ {transpCheckInkOnWhite, tr("Ink Color on White Bg:")},
+ {transpCheckInkOnBlack, tr("Ink Color on Black Bg:")},
+ {transpCheckPaint, tr("Paint Color:")},
+
+ // Version Control
+ {SVNEnabled, tr("Enable Version Control*")},
+ {automaticSVNFolderRefreshEnabled,
+ tr("Automatically Refresh Folder Contents")},
+ {latestVersionCheckEnabled,
+ tr("Check for the Latest Version of OpenToonz on Launch")},
+
+ // Touch / Tablet Settings
+ // TounchGestureControl // Touch Gesture is a checkable command and not in
+ // preferences.ini
+ {winInkEnabled, tr("Enable Windows Ink Support* (EXPERIMENTAL)")}};
+
+ return uiStringTable.value(id, QString());
+}
+
+//-----------------------------------------------------------------------------
+// returns list for combo items
+// ComboBoxItem consists of an item label string and data to be stored in
+// preferences
+
+QList<ComboBoxItem> PreferencesPopup::getComboItemList(
+ PreferencesItemId id) const {
+ const static QMap<PreferencesItemId, QList<ComboBoxItem>> comboItemsTable = {
+ {pathAliasPriority,
+ {{tr("Project Folder Aliases (+drawings, +scenes, etc.)"),
+ Preferences::ProjectFolderAliases},
+ {tr("Scene Folder Alias ($scenefolder)"),
+ Preferences::SceneFolderAlias},
+ {tr("Use Project Folder Aliases Only"),
+ Preferences::ProjectFolderOnly}}},
+ {linearUnits, // cameraUnits shares items with linearUnits
+ {{tr("cm"), "cm"},
+ {tr("mm"), "mm"},
+ {tr("inch"), "inch"},
+ {tr("field"), "field"},
+ {tr("pixel"), "pixel"}}},
+ {functionEditorToggle,
+ {{tr("Graph Editor Opens in Popup"),
+ Preferences::ShowGraphEditorInPopup},
+ {tr("Spreadsheet Opens in Popup"),
+ Preferences::ShowFunctionSpreadsheetInPopup},
+ {tr("Toggle Between Graph Editor and Spreadsheet"),
+ Preferences::ToggleBetweenGraphAndSpreadsheet}}},
+ {viewerZoomCenter, {{tr("Mouse Cursor"), 0}, {tr("Viewer Center"), 1}}},
+ {importPolicy,
+ {{tr("Always ask before loading or importing"), 0},
+ {tr("Always import the file to the current project"), 1},
+ {tr("Always load the file from the current location"), 2}}},
+ {initialLoadTlvCachingBehavior,
+ {{tr("On Demand"), 0},
+ {tr("All Icons"), 1},
+ {tr("All Icons & Images"), 2}}},
+ {columnIconLoadingPolicy,
+ {{tr("At Once"), Preferences::LoadAtOnce},
+ {tr("On Demand"), Preferences::LoadOnDemand}}},
+ {scanLevelType, {{"tif", "tif"}, {"png", "png"}}},
+ {DefLevelType,
+ {{tr("Toonz Vector Level"), PLI_XSHLEVEL},
+ {tr("Toonz Raster Level"), TZP_XSHLEVEL},
+ {tr("Raster Level"), OVL_XSHLEVEL}}},
+ {AutocreationType,
+ {{tr("Disabled"), 0},
+ {tr("Enabled"), 1},
+ {tr("Use Xsheet as Animation Sheet"), 2}}},
+ {vectorSnappingTarget,
+ {{tr("Strokes"), 0}, {tr("Guides"), 1}, {tr("All"), 2}}},
+ {dropdownShortcutsCycleOptions,
+ {{tr("Open the dropdown to display all options"), 0},
+ {tr("Cycle through the available options"), 1}}},
+ {cursorBrushType,
+ {{tr("Small"), "Small"},
+ {tr("Large"), "Large"},
+ {tr("Crosshair"), "Crosshair"}}},
+ {cursorBrushStyle,
+ {{tr("Default"), "Default"},
+ {tr("Left-Handed"), "Left-Handed"},
+ {tr("Simple"), "Simple"}}},
+ {levelBasedToolsDisplay,
+ {{tr("Default"), 0},
+ {tr("Enable Tools For Level Only"), 1},
+ {tr("Show Tools For Level Only"), 2}}},
+ {xsheetLayoutPreference,
+ {{tr("Classic"), "Classic"},
+ {tr("Classic-revised"), "Classic-revised"},
+ {tr("Compact"), "Compact"}}},
+ {DragCellsBehaviour,
+ {{tr("Cells Only"), 0}, {tr("Cells and Column Data"), 1}}},
+ {keyframeType, // note that the value starts from 1, not 0
+ {{tr("Constant"), 1},
+ {tr("Linear"), 2},
+ {tr("Speed In / Speed Out"), 3},
+ {tr("Ease In / Ease Out"), 4},
+ {tr("Ease In / Ease Out %"), 5},
+ {tr("Exponential"), 6},
+ {tr("Expression "), 7},
+ {tr("File"), 8}}},
+ {animatedGuidedDrawing,
+ {{tr("Arrow Markers"), 0}, {tr("Animated Guide"), 1}}}};
+ assert(comboItemsTable.contains(id));
+ return comboItemsTable.value(id, QList<ComboBoxItem>());
+}
+
+template <typename T>
+inline T PreferencesPopup::getUI(PreferencesItemId id) {
+ assert(m_controlIdMap.keys(id).count() == 1);
+ T ret = dynamic_cast<T>(m_controlIdMap.key(id));
+ assert(ret);
+ return ret;
}
-//-----------------------------------------------------------------------------
-
-void PreferencesPopup::onKeyframeTypeChanged(int index) {
- m_pref->setKeyframeType(index + 1);
-}
-//-----------------------------------------------------------------------------
+//**********************************************************************************
+// PrefencesPopup's constructor
+//**********************************************************************************
-void PreferencesPopup::onAutocreationTypeChanged(int index) {
- m_pref->setAutocreationType(index);
- if (index == 2)
- m_enableAutoStretch->setDisabled(false);
- else
- m_enableAutoStretch->setDisabled(true);
-}
-//-----------------------------------------------------------------------------
+PreferencesPopup::PreferencesPopup()
+ : QDialog(TApp::instance()->getMainWindow()), m_formatProperties() {
+ setWindowTitle(tr("Preferences"));
+ setObjectName("PreferencesPopup");
-void PreferencesPopup::onAnimationStepChanged() {
- m_pref->setAnimationStep(m_animationStepField->getValue());
-}
+ m_pref = Preferences::instance();
-//-----------------------------------------------------------------------------
+ // Category List
+ QListWidget* categoryList = new QListWidget(this);
+ QStringList categories;
+ categories << tr("General") << tr("Interface") << tr("Visualization")
+ << tr("Loading") << tr("Saving") << tr("Import/Export")
+ << tr("Drawing") << tr("Tools") << tr("Xsheet") << tr("Animation")
+ << tr("Preview") << tr("Onion Skin") << tr("Colors")
+ << tr("Version Control") << tr("Touch/Tablet Settings");
+ categoryList->addItems(categories);
+ categoryList->setFixedWidth(160);
+ categoryList->setCurrentRow(0);
+ categoryList->setAlternatingRowColors(true);
-void PreferencesPopup::onLanguageTypeChanged(const QString &langName) {
- m_pref->setCurrentLanguage(langName);
- QString currentLanguage = m_pref->getCurrentLanguage();
-}
+ QStackedWidget* stackedWidget = new QStackedWidget(this);
+ stackedWidget->addWidget(createGeneralPage());
+ stackedWidget->addWidget(createInterfacePage());
+ stackedWidget->addWidget(createVisualizationPage());
+ stackedWidget->addWidget(createLoadingPage());
+ stackedWidget->addWidget(createSavingPage());
+ stackedWidget->addWidget(createImportExportPage());
+ stackedWidget->addWidget(createDrawingPage());
+ stackedWidget->addWidget(createToolsPage());
+ stackedWidget->addWidget(createXsheetPage());
+ stackedWidget->addWidget(createAnimationPage());
+ stackedWidget->addWidget(createPreviewPage());
+ stackedWidget->addWidget(createOnionSkinPage());
+ stackedWidget->addWidget(createColorsPage());
+ stackedWidget->addWidget(createVersionControlPage());
+ stackedWidget->addWidget(createTouchTabletPage());
+
+ QHBoxLayout* mainLayout = new QHBoxLayout();
+ mainLayout->setMargin(0);
+ mainLayout->setSpacing(0);
+ {
+ // Category
+ QVBoxLayout* categoryLayout = new QVBoxLayout();
+ categoryLayout->setMargin(5);
+ categoryLayout->setSpacing(10);
+ {
+ categoryLayout->addWidget(new QLabel(tr("Category"), this), 0,
+ Qt::AlignLeft | Qt::AlignVCenter);
+ categoryLayout->addWidget(categoryList, 1);
+ }
+ mainLayout->addLayout(categoryLayout, 0);
+ mainLayout->addWidget(stackedWidget, 1);
+ }
+ setLayout(mainLayout);
-//-----------------------------------------------------------------------------
+ bool ret = connect(categoryList, SIGNAL(currentRowChanged(int)),
+ stackedWidget, SLOT(setCurrentIndex(int)));
-void PreferencesPopup::onMoveCurrentFrameChanged(int index) {
- m_pref->enableMoveCurrent(index == Qt::Checked);
+ assert(ret);
}
//-----------------------------------------------------------------------------
-void PreferencesPopup::onReplaceAfterSaveLevelAsChanged(int index) {
- m_pref->enableReplaceAfterSaveLevelAs(index == Qt::Checked);
-}
+QWidget* PreferencesPopup::createGeneralPage() {
+ m_projectRootDocuments = new CheckBox(tr("My Documents/OpenToonz*"), this);
+ m_projectRootDesktop = new CheckBox(tr("Desktop/OpenToonz*"), this);
+ m_projectRootCustom = new CheckBox(tr("Custom*"), this);
+ QWidget* customField = new QWidget(this);
+ QGridLayout* customLay = new QGridLayout();
+ setupLayout(customLay, 5);
+ {
+ insertUI(customProjectRoot, customLay);
+ customLay->addWidget(
+ new QLabel(
+ tr("Advanced: Multiple paths can be separated by ** (No Spaces)"),
+ this),
+ customLay->rowCount(), 0, 1, 2, Qt::AlignLeft | Qt::AlignVCenter);
+ }
+ customField->setLayout(customLay);
-//-----------------------------------------------------------------------------
+ QWidget* widget = new QWidget(this);
+ QGridLayout* lay = new QGridLayout();
+ setupLayout(lay);
-void PreferencesPopup::setViewerBgColor(const TPixel32 &color,
- bool isDragging) {
- m_pref->setViewerBGColor(color, isDragging);
- TApp::instance()->getCurrentScene()->notifySceneChanged();
-}
+ insertUI(defaultViewerEnabled, lay);
+ insertUI(rasterOptimizedMemory, lay);
+ QGridLayout* autoSaveLay = insertGroupBoxUI(autosaveEnabled, lay);
+ {
+ insertUI(autosavePeriod, autoSaveLay);
+ insertUI(autosaveSceneEnabled, autoSaveLay);
+ insertUI(autosaveOtherFilesEnabled, autoSaveLay);
+ }
+ insertUI(startupPopupEnabled, lay);
+ insertUI(undoMemorySize, lay);
+ insertUI(taskchunksize, lay);
+ insertUI(replaceAfterSaveLevelAs, lay);
+ QGridLayout* backupLay = insertGroupBoxUI(backupEnabled, lay);
+ { insertUI(backupKeepCount, backupLay); }
+ insertUI(sceneNumberingEnabled, lay);
+ insertUI(watchFileSystemEnabled, lay);
+
+ QGridLayout* projectRootLay =
+ insertGroupBox(tr("Additional Project Locations"), lay);
+ {
+ projectRootLay->addWidget(m_projectRootDocuments, 0, 0, 1, 2);
+ projectRootLay->addWidget(m_projectRootDesktop, 1, 0, 1, 2);
+ projectRootLay->addWidget(m_projectRootCustom, 2, 0, 1, 2);
+ projectRootLay->addWidget(customField, 3, 0, 1, 2);
+ }
-//-----------------------------------------------------------------------------
+ insertUI(pathAliasPriority, lay, getComboItemList(pathAliasPriority));
-void PreferencesPopup::setPreviewBgColor(const TPixel32 &color,
- bool isDragging) {
- m_pref->setPreviewBGColor(color, isDragging);
- TApp::instance()->getCurrentScene()->notifySceneChanged();
-}
+ lay->setRowStretch(lay->rowCount(), 1);
+ insertFootNote(lay);
+ widget->setLayout(lay);
-//-----------------------------------------------------------------------------
+ int projectPaths = m_pref->getIntValue(projectRoot);
+ m_projectRootDocuments->setChecked(projectPaths & 0x04);
+ m_projectRootDesktop->setChecked(projectPaths & 0x02);
+ m_projectRootCustom->setChecked(projectPaths & 0x01);
+ if (!(projectPaths & 0x01)) customField->hide();
-void PreferencesPopup::setLevelEditorBoxColor(const TPixel32 &color,
- bool isDragging) {
- m_pref->setLevelEditorBoxColor(color, isDragging);
- TApp::instance()->getCurrentScene()->notifySceneChanged();
-}
+ QComboBox* pathAliasPriorityCB = getUI<QComboBox*>(pathAliasPriority);
+ pathAliasPriorityCB->setToolTip(
+ tr("This option defines which alias to be used\nif both are possible on "
+ "coding file path."));
+ pathAliasPriorityCB->setItemData(0, QString(" "), Qt::ToolTipRole);
+ QString scenefolderTooltip =
+ tr("Choosing this option will set initial location of all file browsers "
+ "to $scenefolder.\n"
+ "Also the initial output destination for new scenes will be set to "
+ "$scenefolder as well.");
+ pathAliasPriorityCB->setItemData(1, scenefolderTooltip, Qt::ToolTipRole);
+ pathAliasPriorityCB->setItemData(2, QString(" "), Qt::ToolTipRole);
+
+ m_onEditedFuncMap.insert(autosaveEnabled,
+ &PreferencesPopup::onAutoSaveChanged);
+ m_onEditedFuncMap.insert(autosaveSceneEnabled,
+ &PreferencesPopup::onAutoSaveOptionsChanged);
+ m_onEditedFuncMap.insert(autosaveOtherFilesEnabled,
+ &PreferencesPopup::onAutoSaveOptionsChanged);
+ m_onEditedFuncMap.insert(watchFileSystemEnabled,
+ &PreferencesPopup::onWatchFileSystemClicked);
-//-----------------------------------------------------------------------------
+ bool ret = true;
+ ret = ret && connect(m_pref, SIGNAL(stopAutoSave()), this,
+ SLOT(onAutoSaveExternallyChanged()));
+ ret = ret && connect(m_pref, SIGNAL(startAutoSave()), this,
+ SLOT(onAutoSaveExternallyChanged()));
+ ret = ret && connect(m_pref, SIGNAL(autoSavePeriodChanged()), this,
+ SLOT(onAutoSavePeriodExternallyChanged()));
-void PreferencesPopup::setChessboardColor1(const TPixel32 &color,
- bool isDragging) {
- m_pref->setChessboardColor1(color, isDragging);
- TApp::instance()->getCurrentScene()->notifySceneChanged();
+ ret = ret && connect(m_projectRootDocuments, SIGNAL(stateChanged(int)),
+ SLOT(onProjectRootChanged()));
+ ret = ret && connect(m_projectRootDesktop, SIGNAL(stateChanged(int)),
+ SLOT(onProjectRootChanged()));
+ ret = ret && connect(m_projectRootCustom, SIGNAL(stateChanged(int)),
+ SLOT(onProjectRootChanged()));
+ ret = ret && connect(m_projectRootCustom, SIGNAL(clicked(bool)), customField,
+ SLOT(setVisible(bool)));
+ assert(ret);
+
+ return widget;
}
//-----------------------------------------------------------------------------
-void PreferencesPopup::setChessboardColor2(const TPixel32 &color,
- bool isDragging) {
- m_pref->setChessboardColor2(color, isDragging);
- TApp::instance()->getCurrentScene()->notifySceneChanged();
-}
+QWidget* PreferencesPopup::createInterfacePage() {
+ QList<ComboBoxItem> styleSheetItemList;
+ for (const QString& str : m_pref->getStyleSheetList()) {
+ TFilePath path(str.toStdWString());
+ QString name = QString::fromStdWString(path.getWideName());
+ styleSheetItemList.push_back(ComboBoxItem(name, name));
+ }
-//-----------------------------------------------------------------------------
+ QList<ComboBoxItem> roomItemList;
+ foreach (QString roomName, m_pref->getRoomMap())
+ roomItemList.push_back(ComboBoxItem(roomName, roomName));
+
+ QList<ComboBoxItem> languageItemList;
+ for (const QString& name : m_pref->getLanguageList())
+ languageItemList.push_back(ComboBoxItem(name, name));
+
+ QWidget* widget = new QWidget(this);
+ QGridLayout* lay = new QGridLayout();
+ setupLayout(lay);
+
+ insertUI(CurrentStyleSheetName, lay, styleSheetItemList);
+
+ int row = lay->rowCount();
+ lay->addWidget(new QLabel(tr("Pixels Only:"), this), row, 0,
+ Qt::AlignRight | Qt::AlignVCenter);
+ lay->addWidget(createUI(pixelsOnly), row, 1);
+
+ insertUI(linearUnits, lay, getComboItemList(linearUnits));
+ insertUI(cameraUnits, lay,
+ getComboItemList(linearUnits)); // share items with linearUnits
+ insertUI(CurrentRoomChoice, lay, roomItemList);
+ insertUI(functionEditorToggle, lay, getComboItemList(functionEditorToggle));
+ insertUI(moveCurrentFrameByClickCellArea, lay);
+ insertUI(actualPixelViewOnSceneEditingMode, lay);
+ insertUI(levelNameOnEachMarkerEnabled, lay);
+ insertUI(showRasterImagesDarkenBlendedInViewer, lay);
+ insertUI(showFrameNumberWithLetters, lay);
+ insertUI(iconSize, lay);
+ insertDualUIs(viewShrink, viewStep, lay);
+ insertUI(viewerZoomCenter, lay, getComboItemList(viewerZoomCenter));
+ insertUI(CurrentLanguageName, lay, languageItemList);
+ insertUI(interfaceFont, lay); // creates QFontComboBox
+ insertUI(interfaceFontStyle, lay, buildFontStyleList());
+ QGridLayout* colorCalibLay = insertGroupBoxUI(colorCalibrationEnabled, lay);
+ { insertUI(colorCalibrationLutPaths, colorCalibLay); }
+
+ lay->setRowStretch(lay->rowCount(), 1);
+ insertFootNote(lay);
+ widget->setLayout(lay);
+
+ if (m_pref->getBoolValue(pixelsOnly)) {
+ m_controlIdMap.key(linearUnits)->setDisabled(true);
+ m_controlIdMap.key(cameraUnits)->setDisabled(true);
+ }
+ // pixels unit may deactivated externally on loading scene (see
+ // IoCmd::loadScene())
+ bool ret = true;
+ ret = ret && connect(TApp::instance()->getCurrentScene(),
+ SIGNAL(pixelUnitSelected(bool)), this,
+ SLOT(onPixelUnitExternallySelected(bool)));
+ assert(ret);
-void PreferencesPopup::onColumnIconChange(const QString &value) {
- m_pref->setColumnIconLoadingPolicy(value == tr("At Once")
- ? Preferences::LoadAtOnce
- : Preferences::LoadOnDemand);
+ m_onEditedFuncMap.insert(CurrentStyleSheetName,
+ &PreferencesPopup::onStyleSheetTypeChanged);
+ m_onEditedFuncMap.insert(pixelsOnly, &PreferencesPopup::onPixelsOnlyChanged);
+ m_onEditedFuncMap.insert(linearUnits, &PreferencesPopup::onUnitChanged);
+ m_onEditedFuncMap.insert(cameraUnits, &PreferencesPopup::onUnitChanged);
+ m_preEditedFuncMap.insert(CurrentRoomChoice,
+ &PreferencesPopup::beforeRoomChoiceChanged);
+
+ return widget;
}
//-----------------------------------------------------------------------------
-void PreferencesPopup::onOnionSkinVisibilityChanged(int index) {
- m_pref->enableOnionSkin(index == Qt::Checked);
+QWidget* PreferencesPopup::createVisualizationPage() {
+ QWidget* widget = new QWidget(this);
+ QGridLayout* lay = new QGridLayout();
+ setupLayout(lay);
- m_frontOnionColor->setEnabled(index == Qt::Checked);
- m_backOnionColor->setEnabled(index == Qt::Checked);
- m_inksOnly->setEnabled(index == Qt::Checked);
- m_onionPaperThickness->setEnabled(index == Qt::Checked);
+ insertUI(show0ThickLines, lay);
+ insertUI(regionAntialias, lay);
- OnionSkinMask osm =
- TApp::instance()->getCurrentOnionSkin()->getOnionSkinMask();
- osm.enable(index == Qt::Checked);
- TApp::instance()->getCurrentOnionSkin()->setOnionSkinMask(osm);
- TApp::instance()->getCurrentOnionSkin()->notifyOnionSkinMaskChanged();
+ lay->setRowStretch(lay->rowCount(), 1);
+ widget->setLayout(lay);
+ return widget;
}
//-----------------------------------------------------------------------------
-void PreferencesPopup::onOnionSkinDuringPlaybackChanged(int index) {
- m_pref->setOnionSkinDuringPlayback(index == Qt::Checked);
-}
+QWidget* PreferencesPopup::createLoadingPage() {
+ m_levelFormatNames = new QComboBox;
+ m_editLevelFormat = new QPushButton(tr("Edit"));
-//-----------------------------------------------------------------------------
+ QPushButton* addLevelFormat = new QPushButton("+");
+ QPushButton* removeLevelFormat = new QPushButton("-");
+ addLevelFormat->setFixedSize(20, 20);
+ removeLevelFormat->setFixedSize(20, 20);
+ rebuildFormatsList();
-void PreferencesPopup::onOnionColorsForShiftAndTraceChanged(int index) {
- m_pref->useOnionColorsForShiftAndTraceGhosts(index == Qt::Checked);
-}
+ QWidget* widget = new QWidget(this);
+ QGridLayout* lay = new QGridLayout();
+ setupLayout(lay);
+
+ insertUI(importPolicy, lay, getComboItemList(importPolicy));
+ insertUI(autoExposeEnabled, lay);
+ insertUI(subsceneFolderEnabled, lay);
+ insertUI(removeSceneNumberFromLoadedLevelName, lay);
+ insertUI(IgnoreImageDpi, lay);
+ insertUI(initialLoadTlvCachingBehavior, lay,
+ getComboItemList(initialLoadTlvCachingBehavior));
+ insertUI(columnIconLoadingPolicy, lay,
+ getComboItemList(columnIconLoadingPolicy));
+
+ // levelFormats,// need to be handle separately
+ int row = lay->rowCount();
+ lay->addWidget(new QLabel(tr("Level Settings by File Format:")), row, 0,
+ Qt::AlignRight | Qt::AlignVCenter);
+ QHBoxLayout* levelFormatLay = new QHBoxLayout();
+ levelFormatLay->setMargin(0);
+ levelFormatLay->setSpacing(5);
+ {
+ levelFormatLay->addWidget(m_levelFormatNames);
+ levelFormatLay->addWidget(addLevelFormat);
+ levelFormatLay->addWidget(removeLevelFormat);
+ levelFormatLay->addWidget(m_editLevelFormat);
+ levelFormatLay->addStretch(1);
+ }
+ lay->addLayout(levelFormatLay, row, 1, 1, 2);
-//-----------------------------------------------------------------------------
+ lay->setRowStretch(lay->rowCount(), 1);
+ widget->setLayout(lay);
+
+ bool ret = true;
+ ret = ret &&
+ connect(addLevelFormat, SIGNAL(clicked()), SLOT(onAddLevelFormat()));
+ ret = ret && connect(removeLevelFormat, SIGNAL(clicked()),
+ SLOT(onRemoveLevelFormat()));
+ ret = ret && connect(m_editLevelFormat, SIGNAL(clicked()),
+ SLOT(onEditLevelFormat()));
+ ret = ret && connect(TApp::instance()->getCurrentScene(),
+ SIGNAL(importPolicyChanged(int)), this,
+ SLOT(onImportPolicyExternallyChanged(int)));
+ assert(ret);
-void PreferencesPopup::onGuidedDrawingStyleChanged(int index) {
- m_pref->setAnimatedGuidedDrawing(index == 1);
+ return widget;
}
//-----------------------------------------------------------------------------
-void PreferencesPopup::onActualPixelOnSceneModeChanged(int index) {
- m_pref->enableActualPixelViewOnSceneEditingMode(index == Qt::Checked);
-}
+QWidget* PreferencesPopup::createSavingPage() {
+ QWidget* widget = new QWidget(this);
+ QGridLayout* lay = new QGridLayout();
+ setupLayout(lay);
-//-----------------------------------------------------------------------------
+ QLabel* matteColorLabel =
+ new QLabel(tr("Matte color is used for background when overwriting "
+ "raster levels with transparent pixels\nin non "
+ "alpha-enabled image format."),
+ this);
+ lay->addWidget(matteColorLabel, 0, 0, 1, 3, Qt::AlignLeft);
+ insertUI(rasterBackgroundColor, lay);
-void PreferencesPopup::onMultiLayerStylePickerChanged(int index) {
- m_pref->enableMultiLayerStylePicker(index == Qt::Checked);
+ lay->setRowStretch(lay->rowCount(), 1);
+ widget->setLayout(lay);
+ return widget;
}
//-----------------------------------------------------------------------------
-void PreferencesPopup::onLevelNameOnEachMarkerChanged(int index) {
- m_pref->enableLevelNameOnEachMarker(index == Qt::Checked);
-}
+QWidget* PreferencesPopup::createImportExportPage() {
+ auto putLabel = [&](const QString& labelStr, QGridLayout* lay) {
+ lay->addWidget(new QLabel(labelStr, this), lay->rowCount(), 0, 1, 3,
+ Qt::AlignLeft | Qt::AlignVCenter);
+ };
-//-----------------------------------------------------------------------------
+ QWidget* widget = new QWidget(this);
+ QGridLayout* lay = new QGridLayout();
+ setupLayout(lay);
-void PreferencesPopup::onInitialLoadTlvCachingBehaviorChanged(int index) {
- m_pref->setInitialLoadTlvCachingBehavior(index);
-}
+ putLabel(tr("OpenToonz can use FFmpeg for additional file formats.\n") +
+ tr("FFmpeg is not bundled with OpenToonz.\n") +
+ tr("Please provide the path where FFmpeg is located on your "
+ "computer."),
+ lay);
+ insertUI(ffmpegPath, lay);
-//-----------------------------------------------------------------------------
+ putLabel(tr("Number of seconds to wait for FFmpeg to complete processing the "
+ "output:"),
+ lay);
+ putLabel(
+ tr("Note: FFmpeg begins working once all images have been processed."),
+ lay);
+ insertUI(ffmpegTimeout, lay);
+
+ putLabel(tr("Please indicate where you would like exports from Fast "
+ "Render(MP4) to go."),
+ lay);
+ insertUI(fastRenderPath, lay);
-void PreferencesPopup::onViewerZoomCenterChanged(int index) {
- m_pref->setViewerZoomCenter(index);
+ lay->setRowStretch(lay->rowCount(), 1);
+ insertFootNote(lay);
+ widget->setLayout(lay);
+ return widget;
}
//-----------------------------------------------------------------------------
-void PreferencesPopup::onRemoveSceneNumberFromLoadedLevelNameChanged(
- int index) {
- m_pref->enableRemoveSceneNumberFromLoadedLevelName(index == Qt::Checked);
-}
+QWidget* PreferencesPopup::createDrawingPage() {
+ QWidget* widget = new QWidget(this);
+ QGridLayout* lay = new QGridLayout();
+ setupLayout(lay);
-//-----------------------------------------------------------------------------
+ insertUI(scanLevelType, lay, getComboItemList(scanLevelType));
+ insertUI(DefLevelType, lay, getComboItemList(DefLevelType));
+ insertUI(newLevelSizeToCameraSizeEnabled, lay);
+ insertDualUIs(DefLevelWidth, DefLevelHeight, lay);
+ insertUI(DefLevelDpi, lay);
+ insertDualUIs(AutocreationType, EnableAutoStretch, lay,
+ getComboItemList(AutocreationType));
+ insertUI(vectorSnappingTarget, lay, getComboItemList(vectorSnappingTarget));
+ insertUI(saveUnpaintedInCleanup, lay);
+ insertUI(minimizeSaveboxAfterEditing, lay);
+ insertUI(useNumpadForSwitchingStyles, lay);
+ insertUI(downArrowInLevelStripCreatesNewFrame, lay);
+ QGridLayout* replaceVectorsLay = insertGroupBox(
+ tr("Replace Vectors with Simplified Vectors Command"), lay);
+ {
+ insertUI(keepFillOnVectorSimplify, replaceVectorsLay);
+ insertUI(useHigherDpiOnVectorSimplify, replaceVectorsLay);
+ }
+ lay->setRowStretch(lay->rowCount(), 1);
+ widget->setLayout(lay);
+
+ m_onEditedFuncMap.insert(DefLevelType,
+ &PreferencesPopup::onDefLevelTypeChanged);
+ m_onEditedFuncMap.insert(newLevelSizeToCameraSizeEnabled,
+ &PreferencesPopup::onDefLevelTypeChanged);
+ m_onEditedFuncMap.insert(AutocreationType,
+ &PreferencesPopup::onAutocreationTypeChanged);
+
+ onDefLevelTypeChanged();
+
+ if (m_pref->getBoolValue(pixelsOnly)) {
+ m_controlIdMap.key(DefLevelDpi)->setDisabled(true);
+ getUI<MeasuredDoubleLineEdit*>(DefLevelWidth)->setDecimals(0);
+ getUI<MeasuredDoubleLineEdit*>(DefLevelHeight)->setDecimals(0);
+ }
+
+ if (m_pref->getIntValue(AutocreationType) != 2)
+ m_controlIdMap.key(EnableAutoStretch)->setDisabled(true);
-void PreferencesPopup::onShowRasterImageDarkenBlendedInViewerChanged(
- int index) {
- m_pref->enableShowRasterImagesDarkenBlendedInViewer(index == Qt::Checked);
+ return widget;
}
//-----------------------------------------------------------------------------
-void PreferencesPopup::onShowFrameNumberWithLettersChanged(int index) {
- m_pref->enableShowFrameNumberWithLetters(index == Qt::Checked);
-}
+QWidget* PreferencesPopup::createToolsPage() {
+ QWidget* widget = new QWidget(this);
+ QGridLayout* lay = new QGridLayout();
+ setupLayout(lay);
-//-----------------------------------------------------------------------------
+ insertUI(dropdownShortcutsCycleOptions, lay,
+ getComboItemList(dropdownShortcutsCycleOptions));
+ insertUI(FillOnlysavebox, lay);
+ insertUI(multiLayerStylePickerEnabled, lay);
+ QGridLayout* cursorOptionsLay = insertGroupBox(tr("Cursor Options"), lay);
+ {
+ insertUI(cursorBrushType, cursorOptionsLay,
+ getComboItemList(cursorBrushType));
+ insertUI(cursorBrushStyle, cursorOptionsLay,
+ getComboItemList(cursorBrushStyle));
+ insertUI(cursorOutlineEnabled, cursorOptionsLay);
+ }
+ insertUI(levelBasedToolsDisplay, lay,
+ getComboItemList(levelBasedToolsDisplay));
-void PreferencesPopup::onShowKeyframesOnCellAreaChanged(bool checked) {
- m_pref->enableShowKeyframesOnXsheetCellArea(checked);
- TApp::instance()->getCurrentScene()->notifyPreferenceChanged("XsheetCamera");
-}
+ lay->setRowStretch(lay->rowCount(), 1);
+ widget->setLayout(lay);
-//-----------------------------------------------------------------------------
+ m_onEditedFuncMap.insert(FillOnlysavebox,
+ &PreferencesPopup::notifySceneChanged);
+ m_onEditedFuncMap.insert(levelBasedToolsDisplay,
+ &PreferencesPopup::onLevelBasedToolsDisplayChanged);
-void PreferencesPopup::onStyleSheetTypeChanged(const QString &styleSheetName) {
- m_pref->setCurrentStyleSheet(styleSheetName);
- QApplication::setOverrideCursor(Qt::WaitCursor);
- QString currentStyle = m_pref->getCurrentStyleSheetPath();
- qApp->setStyleSheet(currentStyle);
- QApplication::restoreOverrideCursor();
+ return widget;
}
-//-----------------------------------------------------------------------------
-/*
-QWidget* PreferencesPopup::create(const QString &lbl, bool def, const char*slot)
-{
- DVGui::CheckBox* cb = new DVGui::CheckBox(lbl);
- cb->setMaximumHeight(WidgetHeight);
- cb->setChecked(def);
- bool ret = connect(cb, SIGNAL(stateChanged (int)), slot);
- assert(ret);
- return cb;
-}
-*/
//-----------------------------------------------------------------------------
-void PreferencesPopup::onUndoMemorySizeChanged() {
- int value = m_undoMemorySize->getValue();
- m_pref->setUndoMemorySize(value);
-}
+QWidget* PreferencesPopup::createXsheetPage() {
+ QWidget* widget = new QWidget(this);
+ QGridLayout* lay = new QGridLayout();
+ setupLayout(lay);
-//-----------------------------------------------------------------------------
+ insertUI(xsheetLayoutPreference, lay,
+ getComboItemList(xsheetLayoutPreference));
+ insertUI(xsheetStep, lay);
+ insertUI(xsheetAutopanEnabled, lay);
+ insertUI(DragCellsBehaviour, lay, getComboItemList(DragCellsBehaviour));
+ insertUI(ignoreAlphaonColumn1Enabled, lay);
+ QGridLayout* showKeyLay =
+ insertGroupBoxUI(showKeyframesOnXsheetCellArea, lay);
+ { insertUI(showXsheetCameraColumn, showKeyLay); }
+ insertUI(useArrowKeyToShiftCellSelection, lay);
+ insertUI(inputCellsWithoutDoubleClickingEnabled, lay);
+ insertUI(shortcutCommandsWhileRenamingCellEnabled, lay);
+ QGridLayout* xshToolbarLay = insertGroupBoxUI(showXSheetToolbar, lay);
+ { insertUI(expandFunctionHeader, xshToolbarLay); }
+ insertUI(showColumnNumbers, lay);
+ insertUI(syncLevelRenumberWithXsheet, lay);
+ insertUI(currentTimelineEnabled, lay);
+ insertUI(currentColumnColor, lay);
-void PreferencesPopup::onDragCellsBehaviourChanged(int index) {
- m_pref->setDragCellsBehaviour(index);
-}
+ lay->setRowStretch(lay->rowCount(), 1);
+ insertFootNote(lay);
+ widget->setLayout(lay);
-//-----------------------------------------------------------------------------
+ m_onEditedFuncMap.insert(showKeyframesOnXsheetCellArea,
+ &PreferencesPopup::onShowKeyframesOnCellAreaChanged);
+ m_onEditedFuncMap.insert(showXsheetCameraColumn,
+ &PreferencesPopup::onShowKeyframesOnCellAreaChanged);
-#ifdef LINETEST
-void PreferencesPopup::onLineTestFpsCapture(int index) {
- if (index == 0) m_pref->setLineTestFpsCapture(0);
- if (index == 1)
- m_pref->setLineTestFpsCapture(25);
- else if (index == 2)
- m_pref->setLineTestFpsCapture(30);
+ return widget;
}
-#endif
//-----------------------------------------------------------------------------
-void PreferencesPopup::onBackupChanged(bool enabled) {
- m_pref->enableBackup(enabled);
-}
+QWidget* PreferencesPopup::createAnimationPage() {
+ QWidget* widget = new QWidget(this);
+ QGridLayout* lay = new QGridLayout();
+ setupLayout(lay);
-//-----------------------------------------------------------------------------
+ insertUI(keyframeType, lay, getComboItemList(keyframeType));
+ insertUI(animationStep, lay);
-void PreferencesPopup::onBackupKeepCountChanged() {
- m_pref->setBackupKeepCount(m_backupKeepCount->getValue());
+ lay->setRowStretch(lay->rowCount(), 1);
+ widget->setLayout(lay);
+ return widget;
}
//-----------------------------------------------------------------------------
-void PreferencesPopup::onSceneNumberingChanged(int index) {
- m_pref->enableSceneNumbering(index == Qt::Checked);
-}
+QWidget* PreferencesPopup::createPreviewPage() {
+ QWidget* widget = new QWidget(this);
+ QGridLayout* lay = new QGridLayout();
+ setupLayout(lay);
-//-----------------------------------------------------------------------------
+ insertUI(blanksCount, lay);
+ insertUI(blankColor, lay);
+ insertUI(rewindAfterPlayback, lay);
+ insertUI(previewAlwaysOpenNewFlip, lay);
+ insertUI(fitToFlipbook, lay);
+ insertUI(generatedMovieViewEnabled, lay);
-void PreferencesPopup::onDefLevelTypeChanged(int index) {
- if (0 <= index && index < m_defLevelType->count()) {
- int levelType = m_defLevelType->itemData(index).toInt();
- m_pref->setDefLevelType(levelType);
- bool isRaster =
- levelType != PLI_XSHLEVEL && !m_newLevelToCameraSizeCB->isChecked();
- m_defLevelWidth->setEnabled(isRaster);
- m_defLevelHeight->setEnabled(isRaster);
- if (!m_pixelsOnlyCB->isChecked()) m_defLevelDpi->setEnabled(isRaster);
- }
-}
+ lay->setRowStretch(lay->rowCount(), 1);
+ widget->setLayout(lay);
-//-----------------------------------------------------------------------------
+ m_onEditedFuncMap.insert(blanksCount, &PreferencesPopup::onBlankCountChanged);
+ m_onEditedFuncMap.insert(blankColor, &PreferencesPopup::onBlankColorChanged);
-void PreferencesPopup::onDefLevelParameterChanged() {
- double w = m_defLevelWidth->getValue();
- double h = m_defLevelHeight->getValue();
- double dpi = m_defLevelDpi->getValue();
- m_pref->setDefLevelWidth(w);
- m_pref->setDefLevelHeight(h);
- m_pref->setDefLevelDpi(dpi);
+ return widget;
}
//-----------------------------------------------------------------------------
-void PreferencesPopup::onVectorSnappingTargetChanged(int index) {
- m_vectorSnappingTargetCB->setCurrentIndex(index);
- m_pref->setVectorSnappingTarget(index);
-}
+QWidget* PreferencesPopup::createOnionSkinPage() {
+ QWidget* widget = new QWidget(this);
+ QGridLayout* lay = new QGridLayout();
+ setupLayout(lay);
-//-----------------------------------------------------------------------------
+ insertUI(onionSkinEnabled, lay);
+ insertUI(onionPaperThickness, lay);
+ insertUI(backOnionColor, lay);
+ insertUI(frontOnionColor, lay);
+ insertUI(onionInksOnly, lay);
+ insertUI(onionSkinDuringPlayback, lay);
+ insertUI(useOnionColorsForShiftAndTraceGhosts, lay);
+ insertUI(animatedGuidedDrawing, lay, getComboItemList(animatedGuidedDrawing));
-void PreferencesPopup::rebuildFormatsList() {
- const Preferences &prefs = *Preferences::instance();
+ lay->setRowStretch(lay->rowCount(), 1);
+ widget->setLayout(lay);
- m_levelFormatNames->clear();
+ m_onEditedFuncMap.insert(onionSkinEnabled,
+ &PreferencesPopup::onOnionSkinVisibilityChanged);
+ m_onEditedFuncMap.insert(onionPaperThickness,
+ &PreferencesPopup::notifySceneChanged);
+ m_onEditedFuncMap.insert(backOnionColor,
+ &PreferencesPopup::onOnionColorChanged);
+ m_onEditedFuncMap.insert(frontOnionColor,
+ &PreferencesPopup::onOnionColorChanged);
+ m_onEditedFuncMap.insert(onionInksOnly,
+ &PreferencesPopup::notifySceneChanged);
- int lf, lfCount = prefs.levelFormatsCount();
- for (lf = 0; lf != lfCount; ++lf)
- m_levelFormatNames->addItem(prefs.levelFormat(lf).m_name);
+ bool onionActive = m_pref->getBoolValue(onionSkinEnabled);
+ if (!onionActive) {
+ m_controlIdMap.key(onionPaperThickness)->setDisabled(true);
+ m_controlIdMap.key(backOnionColor)->setDisabled(true);
+ m_controlIdMap.key(frontOnionColor)->setDisabled(true);
+ m_controlIdMap.key(onionInksOnly)->setDisabled(true);
+ }
- m_editLevelFormat->setEnabled(m_levelFormatNames->count() > 0);
+ return widget;
}
//-----------------------------------------------------------------------------
-void PreferencesPopup::onAddLevelFormat() {
- bool ok = true;
- QString formatName = DVGui::getText(tr("New Level Format"),
- tr("Assign the new level format name:"),
- tr("New Format"), &ok);
-
- if (ok) {
- int formatIdx = Preferences::instance()->addLevelFormat(formatName);
- rebuildFormatsList();
+QWidget* PreferencesPopup::createColorsPage() {
+ QWidget* widget = new QWidget(this);
+ QGridLayout* lay = new QGridLayout();
+ setupLayout(lay);
- m_levelFormatNames->setCurrentIndex(formatIdx);
+ insertUI(viewerBGColor, lay);
+ insertUI(previewBGColor, lay);
+ insertUI(levelEditorBoxColor, lay);
+ insertUI(chessboardColor1, lay);
+ insertUI(chessboardColor2, lay);
+ QGridLayout* tcLay = insertGroupBox(tr("Transparency Check"), lay);
+ {
+ insertUI(transpCheckInkOnWhite, tcLay);
+ insertUI(transpCheckInkOnBlack, tcLay);
+ insertUI(transpCheckPaint, tcLay);
}
-}
+ lay->setRowStretch(lay->rowCount(), 1);
+ widget->setLayout(lay);
-//-----------------------------------------------------------------------------
+ m_onEditedFuncMap.insert(viewerBGColor,
+ &PreferencesPopup::notifySceneChanged);
+ m_onEditedFuncMap.insert(previewBGColor,
+ &PreferencesPopup::notifySceneChanged);
+ m_onEditedFuncMap.insert(levelEditorBoxColor,
+ &PreferencesPopup::notifySceneChanged);
+ m_onEditedFuncMap.insert(chessboardColor1,
+ &PreferencesPopup::notifySceneChanged);
+ m_onEditedFuncMap.insert(chessboardColor2,
+ &PreferencesPopup::notifySceneChanged);
-void PreferencesPopup::onRemoveLevelFormat() {
- Preferences::instance()->removeLevelFormat(
- m_levelFormatNames->currentIndex());
- rebuildFormatsList();
+ return widget;
}
//-----------------------------------------------------------------------------
-void PreferencesPopup::onEditLevelFormat() {
- if (!m_formatProperties) {
- m_formatProperties = new FormatProperties(this);
+QWidget* PreferencesPopup::createVersionControlPage() {
+ QWidget* widget = new QWidget(this);
+ QGridLayout* lay = new QGridLayout();
+ setupLayout(lay);
- bool ret = connect(m_formatProperties, SIGNAL(dialogClosed()),
- SLOT(onLevelFormatEdited()));
- assert(ret);
- }
+ insertUI(SVNEnabled, lay);
+ insertUI(automaticSVNFolderRefreshEnabled, lay);
+ insertUI(latestVersionCheckEnabled, lay);
- const Preferences::LevelFormat &lf =
- Preferences::instance()->levelFormat(m_levelFormatNames->currentIndex());
+ lay->setRowStretch(lay->rowCount(), 1);
+ insertFootNote(lay);
+ widget->setLayout(lay);
- m_formatProperties->setLevelFormat(lf);
- m_formatProperties->show();
+ m_onEditedFuncMap.insert(SVNEnabled, &PreferencesPopup::onSVNEnabledChanged);
+
+ return widget;
}
//-----------------------------------------------------------------------------
-void PreferencesPopup::onLevelFormatEdited() {
- assert(m_formatProperties);
+QWidget* PreferencesPopup::createTouchTabletPage() {
+ bool winInkAvailable = false;
+#ifdef _WIN32
+ winInkAvailable = KisTabletSupportWin8::isAvailable();
+#endif
- Preferences &prefs = *Preferences::instance();
- int formatIdx = m_levelFormatNames->currentIndex();
+ QAction* touchAction =
+ CommandManager::instance()->getAction(MI_TouchGestureControl);
+ CheckBox* enableTouchGestures =
+ new CheckBox(tr("Enable Touch Gesture Controls"));
+ enableTouchGestures->setChecked(touchAction->isChecked());
- prefs.removeLevelFormat(formatIdx);
- formatIdx = prefs.addLevelFormat(m_formatProperties->levelFormat());
+ QWidget* widget = new QWidget(this);
+ QGridLayout* lay = new QGridLayout();
+ setupLayout(lay);
- rebuildFormatsList();
+ lay->addWidget(enableTouchGestures, 0, 0, 1, 2);
+ if (winInkAvailable) insertUI(winInkEnabled, lay);
- m_levelFormatNames->setCurrentIndex(formatIdx);
-}
+ lay->setRowStretch(lay->rowCount(), 1);
+ if (winInkAvailable) insertFootNote(lay);
+ widget->setLayout(lay);
-//-----------------------------------------------------------------------------
+ bool ret = true;
+ ret = ret && connect(enableTouchGestures, SIGNAL(clicked(bool)), touchAction,
+ SLOT(setChecked(bool)));
+ ret = ret && connect(touchAction, SIGNAL(triggered(bool)),
+ enableTouchGestures, SLOT(setChecked(bool)));
+ assert(ret);
-void PreferencesPopup::onShow0ThickLinesChanged(int on) {
- m_pref->setShow0ThickLines(on);
+ return widget;
}
//-----------------------------------------------------------------------------
-void PreferencesPopup::onRegionAntialiasChanged(int on) {
- m_pref->setRegionAntialias(on);
-}
+void PreferencesPopup::onChange() {
+ QWidget* senderWidget = qobject_cast<QWidget*>(sender());
+ if (!senderWidget) return;
+ PreferencesItemId id = m_controlIdMap.value(senderWidget);
-//-----------------------------------------------------------------------------
+ if (m_preEditedFuncMap.contains(id)) (this->*m_preEditedFuncMap[id])();
-void PreferencesPopup::onFfmpegPathChanged() {
- QString text = m_ffmpegPathFileFld->getPath();
- m_pref->setFfmpegPath(text.toStdString());
+ if (CheckBox* cb = dynamic_cast<CheckBox*>(senderWidget))
+ m_pref->setValue(id, cb->isChecked());
+ else if (IntLineEdit* edit = dynamic_cast<IntLineEdit*>(senderWidget))
+ m_pref->setValue(id, edit->getValue());
+ else if (QComboBox* comboBox = dynamic_cast<QComboBox*>(senderWidget))
+ m_pref->setValue(id, comboBox->currentData());
+ else if (DoubleValueLineEdit* field =
+ dynamic_cast<DoubleValueLineEdit*>(senderWidget))
+ m_pref->setValue(id, field->getValue());
+ else if (FileField* field = dynamic_cast<FileField*>(senderWidget))
+ m_pref->setValue(id, field->getPath());
+ else if (SizeField* field = dynamic_cast<SizeField*>(senderWidget))
+ m_pref->setValue(id, field->getValue());
+ else if (QGroupBox* groupBox = dynamic_cast<QGroupBox*>(senderWidget))
+ m_pref->setValue(id, groupBox->isChecked());
+ else
+ return;
+
+ if (m_onEditedFuncMap.contains(id)) (this->*m_onEditedFuncMap[id])();
}
//-----------------------------------------------------------------------------
-void PreferencesPopup::onFastRenderPathChanged() {
- QString text = m_fastRenderPathFileField->getPath();
- m_pref->setFastRenderPath(text.toStdString());
-}
+void PreferencesPopup::onColorFieldChanged(const TPixel32& color,
+ bool isDragging) {
+ QWidget* senderWidget = qobject_cast<QWidget*>(sender());
+ if (!senderWidget) return;
+ PreferencesItemId id = m_controlIdMap.value(senderWidget);
-//-----------------------------------------------------------------------------
+ if (m_preEditedFuncMap.contains(id)) (this->*m_preEditedFuncMap[id])();
-void PreferencesPopup::onFfmpegTimeoutChanged() {
- m_pref->setFfmpegTimeout(m_ffmpegTimeout->getValue());
-}
+ // do not save to file while dragging
+ m_pref->setValue(id, QColor(color.r, color.g, color.b, color.m), !isDragging);
-//-----------------------------------------------------------------------------
+ // very dirty implementation but I want to avoid calling invalidateIcons
+ // while dragging transparency colors sliders..!
+ if (id == transpCheckInkOnWhite || id == transpCheckInkOnBlack ||
+ id == transpCheckPaint)
+ return;
-void PreferencesPopup::onUseNumpadForSwitchingStylesClicked(bool checked) {
- if (checked) {
- // check if there are any commands with numpadkey shortcuts
- CommandManager *cm = CommandManager::instance();
- QList<QAction *> actionsList;
- for (int key = Qt::Key_0; key <= Qt::Key_9; key++) {
- std::string str = QKeySequence(key).toString().toStdString();
- QAction *action = cm->getActionFromShortcut(str);
- if (action) actionsList.append(action);
- }
- QAction *tabAction = cm->getActionFromShortcut("Tab");
- if (tabAction) actionsList.append(tabAction);
- tabAction = cm->getActionFromShortcut("Shift+Tab");
- if (tabAction) actionsList.append(tabAction);
- // if there are actions using numpad shortcuts, notify to release them.
- if (!actionsList.isEmpty()) {
- QString msgStr =
- tr("Numpad keys are assigned to the following commands.\nIs it OK to "
- "release these shortcuts?");
- for (int a = 0; a < actionsList.size(); a++) {
- msgStr += "\n" + actionsList.at(a)->iconText() + " (" +
- actionsList.at(a)->shortcut().toString() + ")";
- }
- int ret = DVGui::MsgBox(msgStr, tr("OK"), tr("Cancel"), 1);
- if (ret == 2 || ret == 0) { // canceled
- m_useNumpadForSwitchingStyles->setChecked(false);
- return;
- } else { // accepted, then release shortcuts
- for (int a = 0; a < actionsList.size(); a++)
- cm->setShortcut(actionsList[a], "");
- }
- }
- }
- m_pref->enableUseNumpadForSwitchingStyles(checked);
- // emit signal to update Palette and Viewer
- TApp::instance()->getCurrentScene()->notifyPreferenceChanged(
- "NumpadForSwitchingStyles");
-}
-
-//-----------------------------------------------------------------------------
-
-void PreferencesPopup::onNewLevelToCameraSizeChanged(bool checked) {
- m_pref->enableNewLevelSizeToCameraSize(checked);
- onDefLevelTypeChanged(m_defLevelType->currentIndex());
-}
-
-//-----------------------------------------------------------------------------
-
-void PreferencesPopup::onShowXSheetToolbarClicked(bool checked) {
- m_pref->enableShowXSheetToolbar(checked);
- TApp::instance()->getCurrentScene()->notifyPreferenceChanged("XSheetToolbar");
-}
-
-//-----------------------------------------------------------------------------
-
-void PreferencesPopup::onSyncLevelRenumberWithXsheetChanged(int checked) {
- m_pref->enableSyncLevelRenumberWithXsheet(checked);
-}
-
-//-----------------------------------------------------------------------------
-
-void PreferencesPopup::onExpandFunctionHeaderClicked(bool checked) {
- m_pref->enableExpandFunctionHeader(checked);
-}
-
-//-----------------------------------------------------------------------------
-
-void PreferencesPopup::onShowColumnNumbersChanged(int index) {
- m_pref->enableShowColumnNumbers(index == Qt::Checked);
-}
-
-//-----------------------------------------------------------------------------
-
-void PreferencesPopup::onXsheetLayoutChanged(int index) {
- m_pref->setXsheetLayoutPreference(
- m_xsheetLayout->itemData(index).toString().toStdString());
-}
-
-//-----------------------------------------------------------------------------
-
-void PreferencesPopup::onUseArrowKeyToShiftCellSelectionClicked(int on) {
- m_pref->enableUseArrowKeyToShiftCellSelection(on);
-}
-
-//-----------------------------------------------------------------------------
-
-void PreferencesPopup::onInputCellsWithoutDoubleClickingClicked(int on) {
- m_pref->enableInputCellsWithoutDoubleClicking(on);
-}
-
-//-----------------------------------------------------------------------------
-
-void PreferencesPopup::onShortcutCommandsWhileRenamingCellClicked(int on) {
- m_pref->enableShortcutCommandsWhileRenamingCell(on);
-}
-
-//-----------------------------------------------------------------------------
-
-void PreferencesPopup::onWatchFileSystemClicked(int on) {
- m_pref->enableWatchFileSystem(on);
- // emit signal to update behavior of the File browser
- TApp::instance()->getCurrentScene()->notifyPreferenceChanged(
- "WatchFileSystem");
-}
-
-//-----------------------------------------------------------------------------
-
-void PreferencesPopup::onPathAliasPriorityChanged(int index) {
- m_pref->setPathAliasPriority(
- static_cast<Preferences::PathAliasPriority>(index));
- TApp::instance()->getCurrentScene()->notifyPreferenceChanged(
- "PathAliasPriority");
-}
-
-//-----------------------------------------------------------------------------
-
-void PreferencesPopup::onShowCurrentTimelineChanged(int index) {
- m_pref->enableCurrentTimelineIndicator(index == Qt::Checked);
-}
-
-//-----------------------------------------------------------------------------
-
-void PreferencesPopup::onColorCalibrationChanged(bool on) {
- m_pref->enableColorCalibration(on);
-}
-
-//-----------------------------------------------------------------------------
-
-void PreferencesPopup::onLutPathChanged() {
- m_pref->setColorCalibrationLutPath(LutManager::instance()->getMonitorName(),
- m_lutPathFileField->getPath());
-}
-
-//-----------------------------------------------------------------------------
-
-void PreferencesPopup::onEnableAutoStretch(int index) {
- m_pref->enableAutoStretch(index == Qt::Checked);
-}
-
-//-----------------------------------------------------------------------------
-
-void PreferencesPopup::onCursorBrushTypeChanged(int index) {
- m_pref->setCursorBrushType(
- m_cursorBrushType->itemData(index).toString().toStdString());
-}
-
-void PreferencesPopup::onCursorBrushStyleChanged(int index) {
- m_pref->setCursorBrushStyle(
- m_cursorBrushStyle->itemData(index).toString().toStdString());
-}
-
-void PreferencesPopup::onCursorOutlineChanged(int index) {
- m_pref->enableCursorOutline(index == Qt::Checked);
-}
-
-//---------------------------------------------------------------------------------------
-
-void PreferencesPopup::onCurrentColumnDataChanged(const TPixel32 &,
- bool isDragging) {
- if (isDragging) return;
- m_pref->setCurrentColumnData(m_currentColumnColor->getColor());
-}
-
-//---------------------------------------------------------------------------------------
-
-void PreferencesPopup::onEnableTouchGesturesChanged(int index) {
- QAction *action =
- CommandManager::instance()->getAction(MI_TouchGestureControl);
- action->setChecked(index == Qt::Checked);
-}
-
-//---------------------------------------------------------------------------------------
-
-void PreferencesPopup::onEnableTouchGesturesTriggered(bool checked) {
- m_enableTouchGestures->setChecked(checked);
-}
-
-//---------------------------------------------------------------------------------------
-
-void PreferencesPopup::onEnableWinInkChanged(int index) {
- m_pref->enableWinInk(index == Qt::Checked);
-}
-
-//---------------------------------------------------------------------------------------
-
-void PreferencesPopup::onRasterBackgroundColorChanged(const TPixel32 &color,
- bool isDragging) {
- if (isDragging) return;
- m_pref->setRasterBackgroundColor(color);
-}
-
-//---------------------------------------------------------------------------------------
-
-void PreferencesPopup::onShowXsheetCameraColumnChanged(int index) {
- m_pref->enableXsheetCameraColumn(index == Qt::Checked);
- TApp::instance()->getCurrentScene()->notifyPreferenceChanged("XsheetCamera");
-}
-
-//-----------------------------------------------------------------------------
-
-void PreferencesPopup::onLevelBasedToolsDisplayChanged(int index) {
- m_pref->setLevelBasedToolsDisplay(index);
- TApp::instance()->getCurrentScene()->notifyPreferenceChanged(
- "ToolbarDisplay");
-}
-
-//**********************************************************************************
-// PrefencesPopup's constructor
-//**********************************************************************************
-
-PreferencesPopup::PreferencesPopup()
- : QDialog(TApp::instance()->getMainWindow())
- , m_formatProperties()
- , m_inksOnly(0)
- , m_blanksCount(0)
- , m_blankColor(0) {
- bool winInkAvailable = false;
-
-#ifdef _WIN32
- winInkAvailable = KisTabletSupportWin8::isAvailable();
-#endif
-
- setWindowTitle(tr("Preferences"));
- setObjectName("PreferencesPopup");
-
- m_pref = Preferences::instance();
-
- // Category List
- QListWidget *categoryList = new QListWidget(this);
-
- QStackedWidget *stackedWidget = new QStackedWidget(this);
-
- //---General ------------------------------
- categoryList->addItem(tr("General"));
-
- CheckBox *useDefaultViewerCB =
- new CheckBox(tr("Use Default Viewer for Movie Formats"), this);
- CheckBox *minimizeRasterMemoryCB =
- new CheckBox(tr("Minimize Raster Memory Fragmentation *"), this);
- m_autoSaveGroup = new QGroupBox(tr("Save Automatically"), this);
- m_autoSaveGroup->setCheckable(true);
- m_autoSaveSceneCB = new CheckBox(tr("Automatically Save the Scene File"));
- m_autoSaveOtherFilesCB =
- new CheckBox(tr("Automatically Save Non-Scene Files"));
- CheckBox *startupPopupCB =
- new CheckBox(tr("Show Startup Window when OpenToonz Starts"));
- m_minuteFld = new DVGui::IntLineEdit(this, 15, 1, 60);
- CheckBox *replaceAfterSaveLevelAsCB =
- new CheckBox(tr("Replace Toonz Level after SaveLevelAs command"), this);
-
- m_undoMemorySize =
- new DVGui::IntLineEdit(this, m_pref->getUndoMemorySize(), 0, 2000);
- m_backup = new QGroupBox(tr("Backup Scene and Animation Levels when Saving"));
- m_backup->setCheckable(true);
- m_backupKeepCount =
- new DVGui::IntLineEdit(this, m_pref->getBackupKeepCount(), 1);
- m_chunkSizeFld =
- new DVGui::IntLineEdit(this, m_pref->getDefaultTaskChunkSize(), 1, 2000);
- CheckBox *sceneNumberingCB = new CheckBox(tr("Show Info in Rendered Frames"));
- CheckBox *watchFileSystemCB = new CheckBox(
- tr("Watch File System and Update File Browser Automatically"), this);
-
- m_projectRootDocuments = new CheckBox(tr("My Documents/OpenToonz*"), this);
- m_projectRootDesktop = new CheckBox(tr("Desktop/OpenToonz*"), this);
- m_projectRootStuff = new CheckBox(tr("Stuff Folder*"), this);
- m_projectRootCustom = new CheckBox(tr("Custom*"), this);
- m_customProjectRootFileField = new DVGui::FileField(this, QString(""));
- m_customProjectRootLabel = new QLabel(tr("Custom Project Path(s): "));
- m_projectRootDirections = new QLabel(
- tr("Advanced: Multiple paths can be separated by ** (No Spaces)"));
-
- QComboBox *pathAliasPriority = new QComboBox();
-
- QLabel *note_general =
- new QLabel(tr("* Changes will take effect the next time you run Toonz"));
- note_general->setStyleSheet("font-size: 10px; font: italic;");
-
- //--- Interface ------------------------------
- categoryList->addItem(tr("Interface"));
-
- QComboBox *languageType = 0;
- QStringList languageList;
- int currentIndex = 0;
- for (int i = 0; i < m_pref->getLanguageCount(); i++) {
- QString string = m_pref->getLanguage(i);
- if (string == m_pref->getCurrentLanguage()) currentIndex = i;
- languageList.push_back(string);
- }
-
- if (languageList.size() > 1) {
- languageType = new QComboBox(this);
- languageType->addItems(languageList);
- languageType->setCurrentIndex(currentIndex);
- }
- QComboBox *styleSheetType = new QComboBox(this);
- m_pixelsOnlyCB =
- new CheckBox(tr("All imported images will use the same DPI"), this);
- m_unitOm = new QComboBox(this);
- m_cameraUnitOm = new QComboBox(this);
- m_functionEditorToggle = new QComboBox(this);
-
- // Choose between standard and Studio Ghibli rooms
- QComboBox *roomChoice = new QComboBox(this);
-
- m_iconSizeLx = new DVGui::IntLineEdit(this, 80, 10, 400);
- m_iconSizeLy = new DVGui::IntLineEdit(this, 60, 10, 400);
- m_viewShrink = new DVGui::IntLineEdit(this, 1, 1, 20);
- m_viewStep = new DVGui::IntLineEdit(this, 1, 1, 20);
-
- CheckBox *moveCurrentFrameCB =
- new CheckBox(tr("Move Current Frame by Clicking on Xsheet / Numerical "
- "Columns Cell Area"),
- this);
- CheckBox *actualPixelOnSceneModeCB =
- new CheckBox(tr("Enable Actual Pixel View on Scene Editing Mode"), this);
- CheckBox *levelNameOnEachMarkerCB =
- new CheckBox(tr("Display Level Name on Each Marker"), this);
- CheckBox *showRasterImageDarkenBlendedInViewerCB =
- new CheckBox(tr("Show Raster Images Darken Blended"), this);
- CheckBox *showShowFrameNumberWithLettersCB = new CheckBox(
- tr("Show \"ABC\" Appendix to the Frame Number in Xsheet Cell"), this);
- QComboBox *viewerZoomCenterComboBox = new QComboBox(this);
-
- QLabel *note_interface =
- new QLabel(tr("* Changes will take effect the next time you run Toonz"));
- note_interface->setStyleSheet("font-size: 10px; font: italic;");
-
- m_interfaceFont = new QFontComboBox(this);
- m_interfaceFontStyle = new QComboBox(this);
-
- m_colorCalibration =
- new QGroupBox(tr("Color Calibration using 3D Look-up Table *"));
- m_lutPathFileField = new DVGui::FileField(
- this, QString("- Please specify 3DLUT file (.3dl) -"), false, true);
-
- //--- Visualization ------------------------------
- categoryList->addItem(tr("Visualization"));
- CheckBox *show0ThickLinesCB =
- new CheckBox(tr("Show Lines with Thickness 0"), this);
- CheckBox *regionAntialiasCB =
- new CheckBox(tr("Antialiased Region Boundaries"), this);
-
- //--- Loading ------------------------------
- categoryList->addItem(tr("Loading"));
-
- CheckBox *exposeLoadedLevelsCB =
- new CheckBox(tr("Expose Loaded Levels in Xsheet"), this);
- CheckBox *createSubfolderCB =
- new CheckBox(tr("Create Sub-folder when Importing Sub-xsheet"), this);
- CheckBox *m_ignoreImageDpiCB =
- new CheckBox(tr("Use Camera DPI for All Imported Images"), this);
- // Column Icon
- m_columnIconOm = new QComboBox(this);
- QComboBox *initialLoadTlvCachingBehaviorComboBox = new QComboBox(this);
- CheckBox *removeSceneNumberFromLoadedLevelNameCB = new CheckBox(
- tr("Automatically Remove Scene Number from Loaded Level Name"), this);
-
- m_levelFormatNames = new QComboBox;
- m_addLevelFormat = new QPushButton("+");
- m_removeLevelFormat = new QPushButton("-");
- m_editLevelFormat = new QPushButton(tr("Edit"));
-
- m_importPolicy = new QComboBox;
-
- //--- Saving ------------------------------
- categoryList->addItem(tr("Saving"));
-
- ColorField *rasterBackgroundColor =
- new ColorField(this, false, m_pref->getRasterBackgroundColor());
-
- //--- Import/Export ------------------------------
- categoryList->addItem(tr("Import/Export"));
- m_ffmpegPathFileFld = new DVGui::FileField(this, QString(""));
- m_fastRenderPathFileField =
- new DVGui::FileField(this, QString("desktop"), false, true);
- m_ffmpegTimeout = new DVGui::IntLineEdit(this, 30, 1);
-
- QLabel *note_io =
- new QLabel(tr("* Changes will take effect the next time you run Toonz"));
- note_io->setStyleSheet("font-size: 10px; font: italic;");
-
- //--- Drawing ------------------------------
- categoryList->addItem(tr("Drawing"));
-
- m_defScanLevelType = new QComboBox(this);
- m_defLevelType = new QComboBox(this);
- m_defLevelWidth = new MeasuredDoubleLineEdit(0);
- m_defLevelHeight = new MeasuredDoubleLineEdit(0);
- m_defLevelDpi = new DoubleLineEdit(0, 66.76);
- m_autocreationType = new QComboBox(this);
- m_dpiLabel = new QLabel(tr("DPI:"), this);
- m_vectorSnappingTargetCB = new QComboBox(this);
- m_newLevelToCameraSizeCB =
- new CheckBox(tr("New Levels Default to the Current Camera Size"), this);
-
- CheckBox *keepOriginalCleanedUpCB =
- new CheckBox(tr("Keep Original Cleaned Up Drawings As Backup"), this);
- CheckBox *minimizeSaveboxAfterEditingCB =
- new CheckBox(tr("Minimize Savebox after Editing"), this);
- m_useNumpadForSwitchingStyles =
- new CheckBox(tr("Use Numpad and Tab keys for Switching Styles"), this);
- m_keepFillOnVectorSimplifyCB = new CheckBox(
- tr("Keep fill when using \"Replace Vectors\" command"), this);
- m_useHigherDpiOnVectorSimplifyCB = new CheckBox(
- tr("Use higher DPI for calculations - Slower but more accurate"), this);
- m_downArrowInLevelStripCreatesNewFrame = new CheckBox(
- tr("Down Arrow at End of Level Strip Creates a New Frame"), this);
- m_enableAutoStretch = new CheckBox(tr("Enable auto-stretch frame"), this);
-
- //--- Tools -------------------------------
- categoryList->addItem(tr("Tools"));
-
- m_dropdownShortcutsCycleOptionsCB = new QComboBox(this);
- CheckBox *multiLayerStylePickerCB = new CheckBox(
- tr("Multi Layer Style Picker : Switch Levels by Picking"), this);
- CheckBox *useSaveboxToLimitFillingOpCB =
- new CheckBox(tr("Use the TLV Savebox to Limit Filling Operations"), this);
-
- QStringList brushTypes;
- // options should not be translatable as they are used as key strings
- brushTypes << tr("Small") << tr("Large") << tr("Crosshair");
- m_cursorBrushType = new QComboBox(this);
- m_cursorBrushType->addItems(brushTypes);
- m_cursorBrushType->setItemData(0, "Small");
- m_cursorBrushType->setItemData(1, "Large");
- m_cursorBrushType->setItemData(2, "Crosshair");
-
- QStringList brushStyles;
- brushStyles << tr("Default") << tr("Left-Handed") << tr("Simple");
- m_cursorBrushStyle = new QComboBox(this);
- m_cursorBrushStyle->addItems(brushStyles);
- m_cursorBrushStyle->setItemData(0, "Default");
- m_cursorBrushStyle->setItemData(1, "Left-Handed");
- m_cursorBrushStyle->setItemData(2, "Simple");
-
- CheckBox *cursorOutlineCB =
- new CheckBox(tr("Show Cursor Size Outlines"), this);
-
- QStringList leveBasedToolsDisplayTypes;
- leveBasedToolsDisplayTypes << tr("Default")
- << tr("Enable Tools For Level Only")
- << tr("Show Tools For Level Only");
- m_levelBasedToolsDisplayCB = new QComboBox(this);
- m_levelBasedToolsDisplayCB->addItems(leveBasedToolsDisplayTypes);
-
- //--- Xsheet ------------------------------
- categoryList->addItem(tr("Xsheet"));
-
- CheckBox *xsheetAutopanDuringPlaybackCB =
- new CheckBox(tr("Xsheet Autopan during Playback"), this);
- m_xsheetStep =
- new DVGui::IntLineEdit(this, Preferences::instance()->getXsheetStep(), 0);
- m_cellsDragBehaviour = new QComboBox();
- CheckBox *ignoreAlphaonColumn1CB =
- new CheckBox(tr("Ignore Alpha Channel on Levels in Column 1"), this);
- m_showKeyframesOnCellAreaCB =
- new QGroupBox(tr("Show Keyframes on Cell Area"), this);
- m_showKeyframesOnCellAreaCB->setCheckable(true);
- CheckBox *useArrowKeyToShiftCellSelectionCB =
- new CheckBox(tr("Use Arrow Key to Shift Cell Selection"), this);
- CheckBox *inputCellsWithoutDoubleClickingCB =
- new CheckBox(tr("Enable to Input Cells without Double Clicking"), this);
- CheckBox *shortcutCommandsWhileRenamingCellCB = new CheckBox(
- tr("Enable OpenToonz Commands' Shortcut Keys While Renaming Cell"), this);
- m_showXSheetToolbar = new QGroupBox(tr("Show Toolbar in the XSheet "), this);
- m_showXSheetToolbar->setCheckable(true);
- m_expandFunctionHeader = new CheckBox(
- tr("Expand Function Editor Header to Match Xsheet Toolbar Height*"),
- this);
- CheckBox *showColumnNumbersCB =
- new CheckBox(tr("Show Column Numbers in Column Headers"), this);
- m_syncLevelRenumberWithXsheet = new CheckBox(
- tr("Sync Level Strip Drawing Number Changes with the Xsheet"));
-
- QStringList xsheetLayouts;
- // options should not be translatable as they are used as key strings
- xsheetLayouts << tr("Classic") << tr("Classic-revised") << tr("Compact");
- m_xsheetLayout = new QComboBox(this);
- m_xsheetLayout->addItems(xsheetLayouts);
- m_xsheetLayout->setItemData(0, "Classic");
- m_xsheetLayout->setItemData(1, "Classic-revised");
- m_xsheetLayout->setItemData(2, "Compact");
-
- m_xsheetLayout->setCurrentIndex(
- m_xsheetLayout->findData(m_pref->getXsheetLayoutPreference()));
- CheckBox *showCurrentTimelineCB = new CheckBox(
- tr("Show Current Time Indicator (Timeline Mode only)"), this);
-
- QLabel *note_xsheet =
- new QLabel(tr("* Changes will take effect the next time you run Toonz"));
- note_xsheet->setStyleSheet("font-size: 10px; font: italic;");
-
- TPixel32 currectColumnColor;
- m_pref->getCurrentColumnData(currectColumnColor);
- m_currentColumnColor = new ColorField(this, false, currectColumnColor);
-
- CheckBox *showXsheetCameraCB = new CheckBox(tr("Show Camera Column"), this);
-
- //--- Animation ------------------------------
- categoryList->addItem(tr("Animation"));
-
- m_keyframeType = new QComboBox(this);
- m_animationStepField = new DVGui::IntLineEdit(this, 1, 1, 500);
-
- //--- Preview ------------------------------
- categoryList->addItem(tr("Preview"));
-
- m_blanksCount = new DVGui::IntLineEdit(this, 0, 0, 1000);
- m_blankColor = new ColorField(this, false, TPixel::Black);
- CheckBox *rewindAfterPlaybackCB =
- new CheckBox(tr("Rewind after Playback"), this);
- CheckBox *displayInNewFlipBookCB =
- new CheckBox(tr("Display in a New Flipbook Window"), this);
- CheckBox *fitToFlipbookCB = new CheckBox(tr("Fit to Flipbook"), this);
- CheckBox *openFlipbookAfterCB =
- new CheckBox(tr("Open Flipbook after Rendering"), this);
-
- //--- Onion Skin ------------------------------
- categoryList->addItem(tr("Onion Skin"));
-
- TPixel32 frontColor, backColor;
- bool onlyInks;
- m_pref->getOnionData(frontColor, backColor, onlyInks);
- m_onionSkinVisibility = new CheckBox(tr("Onion Skin ON"));
- m_onionSkinDuringPlayback =
- new CheckBox(tr("Show Onion Skin During Playback"));
- m_frontOnionColor = new ColorField(this, false, frontColor);
- m_backOnionColor = new ColorField(this, false, backColor);
- m_useOnionColorsForShiftAndTraceCB = new CheckBox(
- tr("Use Onion Skin Colors for Reference Drawings of Shift and Trace"));
- m_inksOnly = new DVGui::CheckBox(tr("Display Lines Only "));
- m_inksOnly->setChecked(onlyInks);
-
- int thickness = m_pref->getOnionPaperThickness();
- m_onionPaperThickness = new DVGui::IntLineEdit(this, thickness, 0, 100);
- m_guidedDrawingStyle = new QComboBox(this);
-
- //--- Colors ------------------------------
- categoryList->addItem(tr("Colors"));
-
- // Viewer BG color
- m_viewerBgColorFld = new ColorField(this, false, m_pref->getViewerBgColor());
- // Preview BG color
- m_previewBgColorFld =
- new ColorField(this, false, m_pref->getPreviewBgColor());
- // Level Editor Box color
- m_levelEditorBoxColorFld =
- new ColorField(this, false, m_pref->getLevelEditorBoxColor());
- // bg chessboard colors
- TPixel32 col1, col2;
- m_pref->getChessboardColors(col1, col2);
- m_chessboardColor1Fld = new ColorField(this, false, col1);
- m_chessboardColor2Fld = new ColorField(this, false, col2);
-
- TPixel32 bgColor, inkColor, paintColor;
- m_pref->getTranspCheckData(bgColor, inkColor, paintColor);
- m_transpCheckInkColor = new ColorField(this, false, inkColor);
- m_transpCheckBgColor = new ColorField(this, false, bgColor);
- m_transpCheckPaintColor = new ColorField(this, false, paintColor);
-
- //--- Version Control ------------------------------
- categoryList->addItem(tr("Version Control"));
- m_enableVersionControl = new DVGui::CheckBox(tr("Enable Version Control*"));
- CheckBox *autoRefreshFolderContentsCB =
- new CheckBox(tr("Automatically Refresh Folder Contents"), this);
-
- CheckBox *checkForTheLatestVersionCB = new CheckBox(
- tr("Check for the Latest Version of OpenToonz on Launch"), this);
-
- QLabel *note_version =
- new QLabel(tr("* Changes will take effect the next time you run Toonz"));
- note_version->setStyleSheet("font-size: 10px; font: italic;");
-
- QLabel *note_tablet;
- //--- Tablet Settings ------------------------------
-
- categoryList->addItem(tr("Touch/Tablet Settings"));
-
- m_enableTouchGestures =
- new DVGui::CheckBox(tr("Enable Touch Gesture Controls"));
-
- if (winInkAvailable) {
- m_enableWinInk =
- new DVGui::CheckBox(tr("Enable Windows Ink Support* (EXPERIMENTAL)"));
-
- note_tablet = new QLabel(
- tr("* Changes will take effect the next time you run Toonz"));
- note_tablet->setStyleSheet("font-size: 10px; font: italic;");
- }
-
- /*--- set default parameters ---*/
- categoryList->setFixedWidth(160);
- categoryList->setCurrentRow(0);
- categoryList->setAlternatingRowColors(true);
- //--- General ------------------------------
- useDefaultViewerCB->setChecked(m_pref->isDefaultViewerEnabled());
- minimizeRasterMemoryCB->setChecked(m_pref->isRasterOptimizedMemory());
- m_autoSaveGroup->setChecked(m_pref->isAutosaveEnabled());
- m_autoSaveSceneCB->setChecked(m_pref->isAutosaveSceneEnabled());
- m_autoSaveOtherFilesCB->setChecked(m_pref->isAutosaveOtherFilesEnabled());
- m_minuteFld->setValue(m_pref->getAutosavePeriod());
- startupPopupCB->setChecked(m_pref->isStartupPopupEnabled());
- replaceAfterSaveLevelAsCB->setChecked(
- m_pref->isReplaceAfterSaveLevelAsEnabled());
-
- m_backup->setChecked(m_pref->isBackupEnabled());
- sceneNumberingCB->setChecked(m_pref->isSceneNumberingEnabled());
- watchFileSystemCB->setChecked(m_pref->isWatchFileSystemEnabled());
-
- m_customProjectRootFileField->setPath(m_pref->getCustomProjectRoot());
-
- int projectPaths = m_pref->getProjectRoot();
- m_projectRootStuff->setChecked(projectPaths & 0x08);
- m_projectRootDocuments->setChecked(projectPaths & 0x04);
- m_projectRootDesktop->setChecked(projectPaths & 0x02);
- m_projectRootCustom->setChecked(projectPaths & 0x01);
-
- m_projectRootStuff->hide();
- if (!(projectPaths & 0x01)) {
- m_customProjectRootFileField->hide();
- m_customProjectRootLabel->hide();
- m_projectRootDirections->hide();
- }
-
- QStringList pathAliasPriorityList;
- pathAliasPriorityList
- << tr("Project Folder Aliases (+drawings, +scenes, etc.)")
- << tr("Scene Folder Alias ($scenefolder)")
- << tr("Use Project Folder Aliases Only");
- pathAliasPriority->addItems(pathAliasPriorityList);
- pathAliasPriority->setCurrentIndex(
- static_cast<int>(m_pref->getPathAliasPriority()));
- pathAliasPriority->setToolTip(
- tr("This option defines which alias to be used\nif both are possible on "
- "coding file path."));
- pathAliasPriority->setItemData(0, QString(" "), Qt::ToolTipRole);
- QString scenefolderTooltip =
- tr("Choosing this option will set initial location of all file browsers "
- "to $scenefolder.\n"
- "Also the initial output destination for new scenes will be set to "
- "$scenefolder as well.");
- pathAliasPriority->setItemData(1, scenefolderTooltip, Qt::ToolTipRole);
- pathAliasPriority->setItemData(2, QString(" "), Qt::ToolTipRole);
-
- //--- Interface ------------------------------
- QStringList styleSheetList;
- currentIndex = 0;
- for (int i = 0; i < m_pref->getStyleSheetCount(); i++) {
- QString string = m_pref->getStyleSheet(i);
- if (string == m_pref->getCurrentStyleSheetName()) currentIndex = i;
- TFilePath path(string.toStdWString());
- styleSheetList.push_back(QString::fromStdWString(path.getWideName()));
- }
- styleSheetType->addItems(styleSheetList);
- styleSheetType->setCurrentIndex(currentIndex);
- bool po = m_pref->getPixelsOnly();
- m_pixelsOnlyCB->setChecked(po);
- // m_pixelsOnlyCB->setChecked(true);
- if (po) {
- m_unitOm->setDisabled(true);
- m_cameraUnitOm->setDisabled(true);
- }
- QStringList type;
- type << tr("cm") << tr("mm") << tr("inch") << tr("field") << tr("pixel");
- m_unitOm->addItems(type);
- int idx =
- std::find(::units, ::units + ::unitsCount, m_pref->getUnits()) - ::units;
- m_unitOm->setCurrentIndex((idx < ::unitsCount) ? idx : ::inchIdx);
- m_cameraUnitOm->addItems(type);
-
- idx = std::find(::units, ::units + ::unitsCount, m_pref->getCameraUnits()) -
- ::units;
- m_cameraUnitOm->setCurrentIndex((idx < ::unitsCount) ? idx : ::inchIdx);
-
- QStringList functionEditorList;
- functionEditorList << tr("Graph Editor Opens in Popup")
- << tr("Spreadsheet Opens in Popup")
- << tr("Toggle Between Graph Editor and Spreadsheet");
- m_functionEditorToggle->addItems(functionEditorList);
- m_functionEditorToggle->setCurrentIndex(
- static_cast<int>(m_pref->getFunctionEditorToggle()));
- QStringList roomList;
- int currentRoomIndex = 0;
- for (int i = 0; i < m_pref->getRoomChoiceCount(); i++) {
- QString string = m_pref->getRoomChoice(i);
- if (string == m_pref->getCurrentRoomChoice()) currentRoomIndex = i;
- roomList.push_back(string);
- }
-
- if (roomList.size() > 1) {
- roomChoice->addItems(roomList);
- roomChoice->setCurrentIndex(currentRoomIndex);
- }
-
- m_iconSizeLx->setValue(m_pref->getIconSize().lx);
- m_iconSizeLy->setValue(m_pref->getIconSize().ly);
- int shrink, step;
- m_pref->getViewValues(shrink, step);
- m_viewShrink->setValue(shrink);
- m_viewStep->setValue(step);
- moveCurrentFrameCB->setChecked(m_pref->isMoveCurrentEnabled());
- actualPixelOnSceneModeCB->setChecked(
- m_pref->isActualPixelViewOnSceneEditingModeEnabled());
- levelNameOnEachMarkerCB->setChecked(m_pref->isLevelNameOnEachMarkerEnabled());
- showRasterImageDarkenBlendedInViewerCB->setChecked(
- m_pref->isShowRasterImagesDarkenBlendedInViewerEnabled());
- showShowFrameNumberWithLettersCB->setChecked(
- m_pref->isShowFrameNumberWithLettersEnabled());
- QStringList zoomCenters;
- zoomCenters << tr("Mouse Cursor") << tr("Viewer Center");
- viewerZoomCenterComboBox->addItems(zoomCenters);
- viewerZoomCenterComboBox->setCurrentIndex(m_pref->getViewerZoomCenter());
-
- m_interfaceFont->setCurrentText(m_pref->getInterfaceFont());
-
- rebuilldFontStyleList();
- m_interfaceFontStyle->setCurrentText(m_pref->getInterfaceFontStyle());
-
- m_colorCalibration->setCheckable(true);
- m_colorCalibration->setChecked(m_pref->isColorCalibrationEnabled());
- QString lutPath = m_pref->getColorCalibrationLutPath(
- LutManager::instance()->getMonitorName());
- if (!lutPath.isEmpty()) m_lutPathFileField->setPath(lutPath);
- m_lutPathFileField->setFileMode(QFileDialog::ExistingFile);
- QStringList lutFileTypes;
- lutFileTypes << "3dl";
- m_lutPathFileField->setFilters(lutFileTypes);
-
- //--- Visualization ------------------------------
- show0ThickLinesCB->setChecked(m_pref->getShow0ThickLines());
- regionAntialiasCB->setChecked(m_pref->getRegionAntialias());
-
- //--- Loading ------------------------------
- exposeLoadedLevelsCB->setChecked(m_pref->isAutoExposeEnabled());
- m_ignoreImageDpiCB->setChecked(m_pref->isIgnoreImageDpiEnabled());
- QStringList behaviors;
- behaviors << tr("On Demand") << tr("All Icons") << tr("All Icons & Images");
- initialLoadTlvCachingBehaviorComboBox->addItems(behaviors);
- initialLoadTlvCachingBehaviorComboBox->setCurrentIndex(
- m_pref->getInitialLoadTlvCachingBehavior());
- QStringList formats;
- formats << tr("At Once") << tr("On Demand");
- m_columnIconOm->addItems(formats);
- if (m_pref->getColumnIconLoadingPolicy() == Preferences::LoadAtOnce)
- m_columnIconOm->setCurrentIndex(m_columnIconOm->findText(tr("At Once")));
- else
- m_columnIconOm->setCurrentIndex(m_columnIconOm->findText(tr("On Demand")));
- removeSceneNumberFromLoadedLevelNameCB->setChecked(
- m_pref->isRemoveSceneNumberFromLoadedLevelNameEnabled());
- createSubfolderCB->setChecked(m_pref->isSubsceneFolderEnabled());
-
- m_addLevelFormat->setFixedSize(20, 20);
- m_removeLevelFormat->setFixedSize(20, 20);
-
- rebuildFormatsList();
-
- QStringList policies;
- policies << tr("Always ask before loading or importing")
- << tr("Always import the file to the current project")
- << tr("Always load the file from the current location");
- m_importPolicy->addItems(policies);
- m_importPolicy->setCurrentIndex(m_pref->getDefaultImportPolicy());
-
- //--- Import/Export ------------------------------
- QString path = m_pref->getFfmpegPath();
- m_ffmpegPathFileFld->setPath(path);
- path = m_pref->getFastRenderPath();
- m_fastRenderPathFileField->setPath(path);
- m_ffmpegTimeout->setValue(m_pref->getFfmpegTimeout());
-
- //--- Drawing ------------------------------
- keepOriginalCleanedUpCB->setChecked(m_pref->isSaveUnpaintedInCleanupEnable());
- minimizeSaveboxAfterEditingCB->setChecked(
- m_pref->isMinimizeSaveboxAfterEditing());
- m_useNumpadForSwitchingStyles->setChecked(
- m_pref->isUseNumpadForSwitchingStylesEnabled());
- m_keepFillOnVectorSimplifyCB->setChecked(
- m_pref->getKeepFillOnVectorSimplify());
- m_useHigherDpiOnVectorSimplifyCB->setChecked(
- m_pref->getUseHigherDpiOnVectorSimplify());
- m_downArrowInLevelStripCreatesNewFrame->setChecked(
- m_pref->getDownArrowLevelStripNewFrame());
- m_newLevelToCameraSizeCB->setChecked(
- m_pref->isNewLevelSizeToCameraSizeEnabled());
- QStringList scanLevelTypes;
- scanLevelTypes << "tif"
- << "png";
- m_defScanLevelType->addItems(scanLevelTypes);
- m_defScanLevelType->setCurrentIndex(
- m_defScanLevelType->findText(m_pref->getScanLevelType()));
- QStringList levelTypes;
- m_defLevelType->addItem((tr("Toonz Vector Level")), PLI_XSHLEVEL);
- m_defLevelType->addItem((tr("Toonz Raster Level")), TZP_XSHLEVEL);
- m_defLevelType->addItem((tr("Raster Level")), OVL_XSHLEVEL);
- m_defLevelType->setCurrentIndex(0);
-
- for (int i = 0; i < m_defLevelType->count(); i++) {
- if (m_defLevelType->itemData(i).toInt() == m_pref->getDefLevelType()) {
- m_defLevelType->setCurrentIndex(i);
- onDefLevelTypeChanged(i);
- break;
- }
- }
-
- if (Preferences::instance()->getUnits() == "pixel") {
- m_defLevelWidth->setRange(0.1, (std::numeric_limits<double>::max)());
- m_defLevelWidth->setMeasure("camera.lx");
- m_defLevelWidth->setValue(m_pref->getDefLevelWidth());
- m_defLevelHeight->setRange(0.1, (std::numeric_limits<double>::max)());
- m_defLevelHeight->setMeasure("camera.ly");
- m_defLevelHeight->setValue(m_pref->getDefLevelHeight());
- } else {
- m_defLevelWidth->setRange(0.1, (std::numeric_limits<double>::max)());
- m_defLevelWidth->setMeasure("level.lx");
- m_defLevelWidth->setValue(m_pref->getDefLevelWidth());
- m_defLevelHeight->setRange(0.1, (std::numeric_limits<double>::max)());
- m_defLevelHeight->setMeasure("level.ly");
- m_defLevelHeight->setValue(m_pref->getDefLevelHeight());
- }
- m_defLevelDpi->setRange(0.1, (std::numeric_limits<double>::max)());
- m_defLevelDpi->setValue(m_pref->getDefLevelDpi());
- QStringList autocreationTypes;
- autocreationTypes << tr("Disabled") << tr("Enabled")
- << tr("Use Xsheet as Animation Sheet");
- m_autocreationType->addItems(autocreationTypes);
- int autocreationType = m_pref->getAutocreationType();
- m_autocreationType->setCurrentIndex(autocreationType);
- m_enableAutoStretch->setChecked(m_pref->isAutoStretchEnabled());
- if (autocreationType != 2) m_enableAutoStretch->setDisabled(true);
-
- QStringList vectorSnappingTargets;
- vectorSnappingTargets << tr("Strokes") << tr("Guides") << tr("All");
- m_vectorSnappingTargetCB->addItems(vectorSnappingTargets);
- m_vectorSnappingTargetCB->setCurrentIndex(m_pref->getVectorSnappingTarget());
-
- //--- Tools -------------------------------
-
- QStringList dropdownBehaviorTypes;
- dropdownBehaviorTypes << tr("Open the dropdown to display all options")
- << tr("Cycle through the available options");
- m_dropdownShortcutsCycleOptionsCB->addItems(dropdownBehaviorTypes);
- m_dropdownShortcutsCycleOptionsCB->setCurrentIndex(
- m_pref->getDropdownShortcutsCycleOptions() ? 1 : 0);
- multiLayerStylePickerCB->setChecked(m_pref->isMultiLayerStylePickerEnabled());
- useSaveboxToLimitFillingOpCB->setChecked(m_pref->getFillOnlySavebox());
-
- m_cursorBrushType->setCurrentIndex(
- m_cursorBrushType->findData(m_pref->getCursorBrushType()));
- m_cursorBrushStyle->setCurrentIndex(
- m_cursorBrushStyle->findData(m_pref->getCursorBrushStyle()));
- cursorOutlineCB->setChecked(m_pref->isCursorOutlineEnabled());
-
- m_levelBasedToolsDisplayCB->setCurrentIndex(
- m_pref->getLevelBasedToolsDisplay());
-
- //--- Xsheet ------------------------------
- xsheetAutopanDuringPlaybackCB->setChecked(m_pref->isXsheetAutopanEnabled());
- m_cellsDragBehaviour->addItem(tr("Cells Only"));
- m_cellsDragBehaviour->addItem(tr("Cells and Column Data"));
- m_cellsDragBehaviour->setCurrentIndex(m_pref->getDragCellsBehaviour());
- ignoreAlphaonColumn1CB->setChecked(m_pref->isIgnoreAlphaonColumn1Enabled());
- m_showKeyframesOnCellAreaCB->setChecked(
- m_pref->isShowKeyframesOnXsheetCellAreaEnabled());
- useArrowKeyToShiftCellSelectionCB->setChecked(
- m_pref->isUseArrowKeyToShiftCellSelectionEnabled());
- inputCellsWithoutDoubleClickingCB->setChecked(
- m_pref->isInputCellsWithoutDoubleClickingEnabled());
- shortcutCommandsWhileRenamingCellCB->setChecked(
- m_pref->isShortcutCommandsWhileRenamingCellEnabled());
- m_showXSheetToolbar->setChecked(m_pref->isShowXSheetToolbarEnabled());
- m_expandFunctionHeader->setChecked(m_pref->isExpandFunctionHeaderEnabled());
- showColumnNumbersCB->setChecked(m_pref->isShowColumnNumbersEnabled());
- m_syncLevelRenumberWithXsheet->setChecked(
- m_pref->isSyncLevelRenumberWithXsheetEnabled());
- showCurrentTimelineCB->setChecked(
- m_pref->isCurrentTimelineIndicatorEnabled());
- showXsheetCameraCB->setChecked(m_pref->isXsheetCameraColumnEnabled());
-
- //--- Animation ------------------------------
- QStringList list;
- list << tr("Constant") << tr("Linear") << tr("Speed In / Speed Out")
- << tr("Ease In / Ease Out") << tr("Ease In / Ease Out %")
- << tr("Exponential") << tr("Expression ") << tr("File");
- m_keyframeType->addItems(list);
- int keyframeType = m_pref->getKeyframeType();
- m_keyframeType->setCurrentIndex(keyframeType - 1);
- m_animationStepField->setValue(m_pref->getAnimationStep());
-
- //--- Preview ------------------------------
- int blanksCount;
- TPixel32 blankColor;
- m_pref->getBlankValues(blanksCount, blankColor);
- m_blanksCount->setValue(blanksCount);
- m_blankColor->setColor(blankColor);
-
- rewindAfterPlaybackCB->setChecked(m_pref->rewindAfterPlaybackEnabled());
- displayInNewFlipBookCB->setChecked(m_pref->previewAlwaysOpenNewFlipEnabled());
- fitToFlipbookCB->setChecked(m_pref->fitToFlipbookEnabled());
- openFlipbookAfterCB->setChecked(m_pref->isGeneratedMovieViewEnabled());
-
- //--- Onion Skin ------------------------------
- m_onionSkinVisibility->setChecked(m_pref->isOnionSkinEnabled());
- m_onionSkinDuringPlayback->setChecked(m_pref->getOnionSkinDuringPlayback());
- m_frontOnionColor->setEnabled(m_pref->isOnionSkinEnabled());
- m_backOnionColor->setEnabled(m_pref->isOnionSkinEnabled());
- m_useOnionColorsForShiftAndTraceCB->setChecked(
- m_pref->areOnionColorsUsedForShiftAndTraceGhosts());
- m_inksOnly->setEnabled(m_pref->isOnionSkinEnabled());
- QStringList guidedDrawingStyles;
- guidedDrawingStyles << tr("Arrow Markers") << tr("Animated Guide");
- m_guidedDrawingStyle->addItems(guidedDrawingStyles);
- m_guidedDrawingStyle->setCurrentIndex(m_pref->getAnimatedGuidedDrawing() ? 1
- : 0);
-
- //--- Version Control ------------------------------
- m_enableVersionControl->setChecked(m_pref->isSVNEnabled());
- autoRefreshFolderContentsCB->setChecked(
- m_pref->isAutomaticSVNFolderRefreshEnabled());
- checkForTheLatestVersionCB->setChecked(m_pref->isLatestVersionCheckEnabled());
-
- //--- Tablet Settings ------------------------------
- m_enableTouchGestures->setChecked(CommandManager::instance()
- ->getAction(MI_TouchGestureControl)
- ->isChecked());
-
- if (winInkAvailable) m_enableWinInk->setChecked(m_pref->isWinInkEnabled());
-
- /*--- layout ---*/
-
- QHBoxLayout *mainLayout = new QHBoxLayout();
- mainLayout->setMargin(0);
- mainLayout->setSpacing(0);
- {
- // Category
- QVBoxLayout *categoryLayout = new QVBoxLayout();
- categoryLayout->setMargin(5);
- categoryLayout->setSpacing(10);
- {
- categoryLayout->addWidget(new QLabel(tr("Category"), this), 0,
- Qt::AlignLeft | Qt::AlignVCenter);
- categoryLayout->addWidget(categoryList, 1);
- }
- mainLayout->addLayout(categoryLayout, 0);
-
- //--- General --------------------------
- QWidget *generalBox = new QWidget(this);
- QVBoxLayout *generalFrameLay = new QVBoxLayout();
- generalFrameLay->setMargin(15);
- generalFrameLay->setSpacing(10);
- {
- generalFrameLay->addWidget(useDefaultViewerCB, 0,
- Qt::AlignLeft | Qt::AlignVCenter);
- generalFrameLay->addWidget(minimizeRasterMemoryCB, 0,
- Qt::AlignLeft | Qt::AlignVCenter);
-
- QVBoxLayout *autoSaveOptionsLay = new QVBoxLayout();
- autoSaveOptionsLay->setMargin(10);
- {
- QHBoxLayout *saveAutoLay = new QHBoxLayout();
- saveAutoLay->setMargin(0);
- saveAutoLay->setSpacing(5);
- {
- saveAutoLay->addWidget(new QLabel(tr("Interval(Minutes): "), this));
- saveAutoLay->addWidget(m_minuteFld, 0);
- saveAutoLay->addStretch(1);
- }
- autoSaveOptionsLay->addLayout(saveAutoLay, 0);
-
- autoSaveOptionsLay->addWidget(m_autoSaveSceneCB, 0,
- Qt::AlignLeft | Qt::AlignVCenter);
- autoSaveOptionsLay->addWidget(m_autoSaveOtherFilesCB, 0,
- Qt::AlignLeft | Qt::AlignVCenter);
- }
- m_autoSaveGroup->setLayout(autoSaveOptionsLay);
- generalFrameLay->addWidget(m_autoSaveGroup);
- generalFrameLay->addWidget(startupPopupCB, 0,
- Qt::AlignLeft | Qt::AlignVCenter);
- // Unit, CameraUnit
- QGridLayout *unitLay = new QGridLayout();
- unitLay->setMargin(0);
- unitLay->setHorizontalSpacing(5);
- unitLay->setVerticalSpacing(10);
- {
- unitLay->addWidget(new QLabel(tr("Undo Memory Size (MB)"), this), 0, 0,
- Qt::AlignRight | Qt::AlignVCenter);
- unitLay->addWidget(m_undoMemorySize, 0, 1);
-
- unitLay->addWidget(new QLabel(tr("Render Task Chunk Size:"), this), 1,
- 0, Qt::AlignRight | Qt::AlignVCenter);
- unitLay->addWidget(m_chunkSizeFld, 1, 1);
- }
- unitLay->setColumnStretch(0, 0);
- unitLay->setColumnStretch(1, 0);
- unitLay->setColumnStretch(2, 1);
-
- generalFrameLay->addLayout(unitLay, 0);
-
- generalFrameLay->addWidget(replaceAfterSaveLevelAsCB, 0,
- Qt::AlignLeft | Qt::AlignVCenter);
-
- QVBoxLayout *backupLay = new QVBoxLayout();
- backupLay->setMargin(10);
- {
- QHBoxLayout *backupCountLay = new QHBoxLayout();
- backupCountLay->setMargin(0);
- backupCountLay->setSpacing(5);
- {
- backupCountLay->addWidget(
- new QLabel(tr("# of backups to keep: "), this));
- backupCountLay->addWidget(m_backupKeepCount, 0);
- backupCountLay->addStretch(1);
- }
- backupLay->addLayout(backupCountLay, 0);
- }
- m_backup->setLayout(backupLay);
- generalFrameLay->addWidget(m_backup);
-
- generalFrameLay->addWidget(sceneNumberingCB, 0,
- Qt::AlignLeft | Qt::AlignVCenter);
- generalFrameLay->addWidget(watchFileSystemCB, 0,
- Qt::AlignLeft | Qt::AlignVCenter);
-
- QGroupBox *projectGroupBox =
- new QGroupBox(tr("Additional Project Locations"), this);
- QGridLayout *projectRootLay = new QGridLayout();
- projectRootLay->setMargin(10);
- projectRootLay->setHorizontalSpacing(5);
- projectRootLay->setVerticalSpacing(10);
- {
- projectRootLay->addWidget(m_projectRootStuff, 0, 0);
- projectRootLay->addWidget(m_projectRootDocuments, 1, 0);
- projectRootLay->addWidget(m_projectRootDesktop, 2, 0);
- projectRootLay->addWidget(m_projectRootCustom, 3, 0);
- projectRootLay->addWidget(m_customProjectRootLabel, 4, 0,
- Qt::AlignRight | Qt::AlignVCenter);
- projectRootLay->addWidget(m_customProjectRootFileField, 4, 1, 1, 3);
- projectRootLay->addWidget(m_projectRootDirections, 5, 0, 1, 4);
- }
- projectGroupBox->setLayout(projectRootLay);
- generalFrameLay->addWidget(projectGroupBox, 0);
-
- QHBoxLayout *pathAliasLay = new QHBoxLayout();
- pathAliasLay->setMargin(0);
- pathAliasLay->setSpacing(5);
- {
- QLabel *PAPLabel = new QLabel(tr("Path Alias Priority:"), this);
- PAPLabel->setToolTip(pathAliasPriority->toolTip());
- pathAliasLay->addWidget(PAPLabel, 0);
- pathAliasLay->addWidget(pathAliasPriority, 0);
- pathAliasLay->addStretch(1);
- }
- generalFrameLay->addLayout(pathAliasLay, 0);
- generalFrameLay->addStretch(1);
-
- generalFrameLay->addWidget(note_general, 0);
- }
- generalBox->setLayout(generalFrameLay);
- stackedWidget->addWidget(generalBox);
-
- //--- Interface --------------------------
- QWidget *userInterfaceBox = new QWidget(this);
- QVBoxLayout *userInterfaceFrameLay = new QVBoxLayout();
- userInterfaceFrameLay->setMargin(15);
- userInterfaceFrameLay->setSpacing(10);
- {
- QGridLayout *styleLay = new QGridLayout();
- styleLay->setMargin(0);
- styleLay->setHorizontalSpacing(5);
- styleLay->setVerticalSpacing(10);
- {
- styleLay->addWidget(new QLabel(tr("Theme:")), 0, 0,
- Qt::AlignRight | Qt::AlignVCenter);
- styleLay->addWidget(styleSheetType, 0, 1,
- Qt::AlignLeft | Qt::AlignVCenter);
-
- styleLay->addWidget(new QLabel(tr("Pixels Only:"), this), 1, 0,
- Qt::AlignRight | Qt::AlignVCenter);
- styleLay->addWidget(m_pixelsOnlyCB, 1, 1);
-
- styleLay->addWidget(new QLabel(tr("Unit:"), this), 2, 0,
- Qt::AlignRight | Qt::AlignVCenter);
- styleLay->addWidget(m_unitOm, 2, 1, Qt::AlignLeft | Qt::AlignVCenter);
-
- styleLay->addWidget(new QLabel(tr("Camera Unit:"), this), 3, 0,
- Qt::AlignRight | Qt::AlignVCenter);
- styleLay->addWidget(m_cameraUnitOm, 3, 1,
- Qt::AlignLeft | Qt::AlignVCenter);
-
- styleLay->addWidget(new QLabel(tr("Rooms*:"), this), 4, 0,
- Qt::AlignRight | Qt::AlignVCenter);
- styleLay->addWidget(roomChoice, 4, 1, Qt::AlignLeft | Qt::AlignVCenter);
-
- styleLay->addWidget(new QLabel(tr("Function Editor*:"), this), 5, 0,
- Qt::AlignRight | Qt::AlignVCenter);
- styleLay->addWidget(m_functionEditorToggle, 5, 1,
- Qt::AlignLeft | Qt::AlignVCenter);
- }
- styleLay->setColumnStretch(0, 0);
- styleLay->setColumnStretch(1, 0);
- styleLay->setColumnStretch(2, 1);
- userInterfaceFrameLay->addLayout(styleLay, 0);
-
- userInterfaceFrameLay->addWidget(moveCurrentFrameCB, 0,
- Qt::AlignLeft | Qt::AlignVCenter);
- userInterfaceFrameLay->addWidget(actualPixelOnSceneModeCB, 0,
- Qt::AlignLeft | Qt::AlignVCenter);
- userInterfaceFrameLay->addWidget(levelNameOnEachMarkerCB, 0,
- Qt::AlignLeft | Qt::AlignVCenter);
- userInterfaceFrameLay->addWidget(showRasterImageDarkenBlendedInViewerCB,
- 0, Qt::AlignLeft | Qt::AlignVCenter);
- userInterfaceFrameLay->addWidget(showShowFrameNumberWithLettersCB, 0,
- Qt::AlignLeft | Qt::AlignVCenter);
-
- QGridLayout *interfaceBottomLay = new QGridLayout();
- interfaceBottomLay->setMargin(0);
- interfaceBottomLay->setHorizontalSpacing(5);
- interfaceBottomLay->setVerticalSpacing(10);
- {
- interfaceBottomLay->addWidget(new QLabel(tr("Icon Size *"), this), 0, 0,
- Qt::AlignRight | Qt::AlignVCenter);
- interfaceBottomLay->addWidget(m_iconSizeLx, 0, 1);
- interfaceBottomLay->addWidget(new QLabel(tr("X"), this), 0, 2,
- Qt::AlignCenter);
- interfaceBottomLay->addWidget(m_iconSizeLy, 0, 3);
-
- interfaceBottomLay->addWidget(new QLabel(tr("Viewer Shrink"), this), 1,
- 0, Qt::AlignRight | Qt::AlignVCenter);
- interfaceBottomLay->addWidget(m_viewShrink, 1, 1);
- interfaceBottomLay->addWidget(new QLabel(tr("Step"), this), 1, 3,
- Qt::AlignRight | Qt::AlignVCenter);
- interfaceBottomLay->addWidget(m_viewStep, 1, 4);
-
- interfaceBottomLay->addWidget(
- new QLabel(tr("Viewer Zoom Center"), this), 2, 0,
- Qt::AlignRight | Qt::AlignVCenter);
- interfaceBottomLay->addWidget(viewerZoomCenterComboBox, 2, 1, 1, 5,
- Qt::AlignLeft | Qt::AlignVCenter);
-
- if (languageType) {
- interfaceBottomLay->addWidget(new QLabel(tr("Language *:")), 3, 0,
- Qt::AlignRight | Qt::AlignVCenter);
- interfaceBottomLay->addWidget(languageType, 3, 1, 1, 5,
- Qt::AlignLeft | Qt::AlignVCenter);
- }
- if (m_interfaceFont->count() > 0) {
- interfaceBottomLay->addWidget(new QLabel(tr("Font *:")), 4, 0,
- Qt::AlignRight | Qt::AlignVCenter);
- QHBoxLayout *fontLay = new QHBoxLayout();
- fontLay->setSpacing(5);
- fontLay->setMargin(0);
- {
- fontLay->addWidget(m_interfaceFont);
- fontLay->addSpacing(10);
- fontLay->addWidget(new QLabel(tr("Style *:")));
- fontLay->addWidget(m_interfaceFontStyle);
- fontLay->addStretch(1);
- }
- interfaceBottomLay->addLayout(fontLay, 4, 1, 1, 5);
- }
- }
- interfaceBottomLay->setColumnStretch(0, 0);
- interfaceBottomLay->setColumnStretch(1, 0);
- interfaceBottomLay->setColumnStretch(2, 0);
- interfaceBottomLay->setColumnStretch(3, 0);
- interfaceBottomLay->setColumnStretch(4, 0);
- interfaceBottomLay->setColumnStretch(5, 1);
- userInterfaceFrameLay->addLayout(interfaceBottomLay, 0);
-
- QHBoxLayout *lutLayout = new QHBoxLayout();
- lutLayout->setMargin(10);
- lutLayout->setSpacing(5);
- {
- lutLayout->addWidget(
- new QLabel(tr("3DLUT File for [%1] *:")
- .arg(LutManager::instance()->getMonitorName()),
- this),
- 0);
- lutLayout->addWidget(m_lutPathFileField, 1);
- }
- m_colorCalibration->setLayout(lutLayout);
- userInterfaceFrameLay->addWidget(m_colorCalibration);
-
- userInterfaceFrameLay->addStretch(1);
-
- userInterfaceFrameLay->addWidget(note_interface, 0);
- }
- userInterfaceBox->setLayout(userInterfaceFrameLay);
- stackedWidget->addWidget(userInterfaceBox);
-
- //--- Visualization ---------------------
- QWidget *visualizatonBox = new QWidget(this);
- QVBoxLayout *visualizatonFrameLay = new QVBoxLayout();
- visualizatonFrameLay->setMargin(15);
- visualizatonFrameLay->setSpacing(10);
- {
- visualizatonFrameLay->addWidget(show0ThickLinesCB, 0);
- visualizatonFrameLay->addWidget(regionAntialiasCB, 0);
- visualizatonFrameLay->addStretch(1);
- }
- visualizatonBox->setLayout(visualizatonFrameLay);
- stackedWidget->addWidget(visualizatonBox);
-
- //--- Loading --------------------------
- QWidget *loadingBox = new QWidget(this);
- QVBoxLayout *loadingFrameLay = new QVBoxLayout();
- loadingFrameLay->setMargin(15);
- loadingFrameLay->setSpacing(10);
- {
- QHBoxLayout *importLay = new QHBoxLayout();
- importLay->setMargin(0);
- importLay->setSpacing(5);
- {
- importLay->addWidget(new QLabel(tr("Default File Import Behavior:")));
- importLay->addWidget(m_importPolicy);
- }
- importLay->addStretch(0);
- loadingFrameLay->addLayout(importLay, 0);
- loadingFrameLay->addWidget(exposeLoadedLevelsCB, 0,
- Qt::AlignLeft | Qt::AlignVCenter);
- loadingFrameLay->addWidget(createSubfolderCB, 0,
- Qt::AlignLeft | Qt::AlignVCenter);
- loadingFrameLay->addWidget(removeSceneNumberFromLoadedLevelNameCB, 0,
- Qt::AlignLeft | Qt::AlignVCenter);
- loadingFrameLay->addWidget(m_ignoreImageDpiCB, 0,
- Qt::AlignLeft | Qt::AlignVCenter);
-
- QGridLayout *cacheLay = new QGridLayout();
- cacheLay->setMargin(0);
- cacheLay->setHorizontalSpacing(5);
- cacheLay->setVerticalSpacing(10);
- {
- cacheLay->addWidget(new QLabel(tr("Default TLV Caching Behavior:")), 0,
- 0, Qt::AlignRight | Qt::AlignVCenter);
- cacheLay->addWidget(initialLoadTlvCachingBehaviorComboBox, 0, 1);
-
- cacheLay->addWidget(new QLabel(tr("Column Icon:"), this), 1, 0,
- Qt::AlignRight | Qt::AlignVCenter);
- cacheLay->addWidget(m_columnIconOm, 1, 1);
-
- cacheLay->addWidget(new QLabel(tr("Level Settings by File Format:")), 2,
- 0, Qt::AlignRight | Qt::AlignVCenter);
- cacheLay->addWidget(m_levelFormatNames, 2, 1);
- cacheLay->addWidget(m_addLevelFormat, 2, 2);
- cacheLay->addWidget(m_removeLevelFormat, 2, 3);
- cacheLay->addWidget(m_editLevelFormat, 2, 4);
- }
- cacheLay->setColumnStretch(0, 0);
- cacheLay->setColumnStretch(1, 0);
- cacheLay->setColumnStretch(2, 0);
- cacheLay->setColumnStretch(3, 0);
- cacheLay->setColumnStretch(4, 0);
- cacheLay->setColumnStretch(5, 1);
- loadingFrameLay->addLayout(cacheLay, 0);
-
- loadingFrameLay->addStretch(1);
- }
- loadingBox->setLayout(loadingFrameLay);
- stackedWidget->addWidget(loadingBox);
-
- //--- Saving --------------------------
- QWidget *savingBox = new QWidget(this);
- QVBoxLayout *savingFrameLay = new QVBoxLayout();
- savingFrameLay->setMargin(15);
- savingFrameLay->setSpacing(10);
- {
- QLabel *matteColorLabel =
- new QLabel(tr("Matte color is used for background when overwriting "
- "raster levels with transparent pixels\nin non "
- "alpha-enabled image format."),
- this);
- savingFrameLay->addWidget(matteColorLabel, 0, Qt::AlignLeft);
-
- QGridLayout *savingGridLay = new QGridLayout();
- savingGridLay->setVerticalSpacing(10);
- savingGridLay->setHorizontalSpacing(15);
- savingGridLay->setMargin(0);
- {
- savingGridLay->addWidget(new QLabel(tr("Matte color: "), this), 0, 0,
- Qt::AlignRight);
- savingGridLay->addWidget(rasterBackgroundColor, 0, 1, Qt::AlignLeft);
- }
- savingGridLay->setColumnStretch(0, 0);
- savingGridLay->setColumnStretch(1, 1);
- savingFrameLay->addLayout(savingGridLay, 0);
-
- savingFrameLay->addStretch(1);
- }
- savingBox->setLayout(savingFrameLay);
- stackedWidget->addWidget(savingBox);
-
- //--- Import/Export --------------------------
- QWidget *ioBox = new QWidget(this);
- QVBoxLayout *ioLay = new QVBoxLayout();
- ioLay->setMargin(15);
- ioLay->setSpacing(10);
- {
- ioLay->addWidget(
- new QLabel(
- tr("OpenToonz can use FFmpeg for additional file formats.\n") +
- tr("FFmpeg is not bundled with OpenToonz.\n") +
- tr("Please provide the path where FFmpeg is located on your "
- "computer.")),
- 0, Qt::AlignLeft | Qt::AlignVCenter);
-
- QGridLayout *ioGridLay = new QGridLayout();
- ioGridLay->setVerticalSpacing(10);
- ioGridLay->setHorizontalSpacing(15);
- ioGridLay->setMargin(0);
- {
- ioGridLay->addWidget(new QLabel(tr("FFmpeg Path: ")), 0, 0,
- Qt::AlignRight);
- ioGridLay->addWidget(m_ffmpegPathFileFld, 0, 1, 1, 3);
- ioGridLay->addWidget(new QLabel(" "), 1, 0);
- ioGridLay->addWidget(
- new QLabel(tr("Number of seconds to wait for FFmpeg to complete "
- "processing the output:")),
- 2, 0, 1, 4);
- ioGridLay->addWidget(new QLabel(tr("Note: FFmpeg begins working once "
- "all images have been processed.")),
- 3, 0, 1, 4);
- ioGridLay->addWidget(new QLabel(tr("FFmpeg Timeout:")), 4, 0,
- Qt::AlignRight);
- ioGridLay->addWidget(m_ffmpegTimeout, 4, 1, 1, 3);
- ioGridLay->addWidget(new QLabel(" "), 5, 0);
- ioGridLay->addWidget(
- new QLabel(tr("Please indicate where you would like exports from "
- "Fast Render(MP4) to go.")),
- 6, 0, 1, 4);
- ioGridLay->addWidget(new QLabel(tr("Fast Render Path: ")), 7, 0,
- Qt::AlignRight);
- ioGridLay->addWidget(m_fastRenderPathFileField, 7, 1, 1, 3);
- }
- ioLay->addLayout(ioGridLay);
- ioLay->addStretch(1);
-
- ioLay->addWidget(note_io, 0);
- }
- ioBox->setLayout(ioLay);
- stackedWidget->addWidget(ioBox);
-
- //--- Drawing --------------------------
- QWidget *drawingBox = new QWidget(this);
- QVBoxLayout *drawingFrameLay = new QVBoxLayout();
- drawingFrameLay->setMargin(15);
- drawingFrameLay->setSpacing(10);
- {
- QGridLayout *drawingTopLay = new QGridLayout();
- drawingTopLay->setVerticalSpacing(10);
- drawingTopLay->setHorizontalSpacing(15);
- drawingTopLay->setMargin(0);
- {
- drawingTopLay->addWidget(new QLabel(tr("Scan File Format:")), 0, 0,
- Qt::AlignRight);
- drawingTopLay->addWidget(m_defScanLevelType, 0, 1, 1, 3,
- Qt::AlignLeft | Qt::AlignVCenter);
-
- drawingTopLay->addWidget(new QLabel(tr("Default Level Type:")), 1, 0,
- Qt::AlignRight);
- drawingTopLay->addWidget(m_defLevelType, 1, 1, 1, 3,
- Qt::AlignLeft | Qt::AlignVCenter);
- drawingTopLay->addWidget(m_newLevelToCameraSizeCB, 2, 0, 1, 3);
- drawingTopLay->addWidget(new QLabel(tr("Width:")), 3, 0,
- Qt::AlignRight);
- drawingTopLay->addWidget(m_defLevelWidth, 3, 1);
- drawingTopLay->addWidget(new QLabel(tr(" Height:")), 3, 2,
- Qt::AlignRight);
- drawingTopLay->addWidget(m_defLevelHeight, 3, 3);
- drawingTopLay->addWidget(m_dpiLabel, 4, 0, Qt::AlignRight);
- drawingTopLay->addWidget(m_defLevelDpi, 4, 1);
- drawingTopLay->addWidget(new QLabel(tr("Autocreation:")), 5, 0,
- Qt::AlignRight);
- drawingTopLay->addWidget(m_autocreationType, 5, 1, 1, 3,
- Qt::AlignLeft | Qt::AlignVCenter);
- drawingTopLay->addWidget(m_enableAutoStretch, 5, 3);
- drawingTopLay->addWidget(new QLabel(tr("Vector Snapping:")), 6, 0,
- Qt::AlignRight);
- drawingTopLay->addWidget(m_vectorSnappingTargetCB, 6, 1, 1, 3,
- Qt::AlignLeft | Qt::AlignVCenter);
- }
- drawingFrameLay->addLayout(drawingTopLay, 0);
-
- drawingFrameLay->addWidget(keepOriginalCleanedUpCB, 0,
- Qt::AlignLeft | Qt::AlignVCenter);
- drawingFrameLay->addWidget(minimizeSaveboxAfterEditingCB, 0,
- Qt::AlignLeft | Qt::AlignVCenter); // 6.4
- drawingFrameLay->addWidget(m_useNumpadForSwitchingStyles, 0,
- Qt::AlignLeft | Qt::AlignVCenter);
- drawingFrameLay->addWidget(m_downArrowInLevelStripCreatesNewFrame, 0,
- Qt::AlignLeft | Qt::AlignVCenter);
- QGroupBox *replaceVectorGroupBox = new QGroupBox(
- tr("Replace Vectors with Simplified Vectors Command"), this);
- QVBoxLayout *replaceVectorsLay = new QVBoxLayout();
- replaceVectorsLay->setMargin(10);
- replaceVectorsLay->setSpacing(10);
- replaceVectorsLay->addWidget(m_keepFillOnVectorSimplifyCB);
- replaceVectorsLay->addWidget(m_useHigherDpiOnVectorSimplifyCB);
- replaceVectorGroupBox->setLayout(replaceVectorsLay);
- drawingFrameLay->addWidget(replaceVectorGroupBox, 0);
- drawingFrameLay->addStretch(1);
- }
- drawingBox->setLayout(drawingFrameLay);
- stackedWidget->addWidget(drawingBox);
- if (m_pixelsOnlyCB->isChecked()) {
- m_defLevelDpi->setDisabled(true);
- m_defLevelWidth->setDecimals(0);
- m_defLevelHeight->setDecimals(0);
- }
-
- //--- Tools ---------------------------
- QWidget *toolsBox = new QWidget(this);
- QVBoxLayout *toolsFrameLay = new QVBoxLayout();
- toolsFrameLay->setMargin(15);
- toolsFrameLay->setSpacing(10);
- {
- QGridLayout *ToolsTopLay = new QGridLayout();
- ToolsTopLay->setVerticalSpacing(10);
- ToolsTopLay->setHorizontalSpacing(15);
- ToolsTopLay->setMargin(0);
- {
- ToolsTopLay->addWidget(new QLabel(tr("Dropdown Shortcuts:")), 0, 0,
- Qt::AlignRight | Qt::AlignVCenter);
- ToolsTopLay->addWidget(m_dropdownShortcutsCycleOptionsCB, 0, 1);
- ToolsTopLay->addWidget(useSaveboxToLimitFillingOpCB, 1, 0, 1, 3,
- Qt::AlignLeft | Qt::AlignVCenter);
- ToolsTopLay->addWidget(multiLayerStylePickerCB, 2, 0, 1, 3,
- Qt::AlignLeft | Qt::AlignVCenter);
-
- toolsFrameLay->addLayout(ToolsTopLay, 0);
-
- QGroupBox *cursorStyleGroupBox =
- new QGroupBox(tr("Cursor Options"), this);
- QVBoxLayout *cursorStylesLay = new QVBoxLayout();
- cursorStylesLay->setMargin(10);
- cursorStylesLay->setSpacing(10);
- {
- QGridLayout *cursorStylesGridLay = new QGridLayout();
- cursorStylesGridLay->setMargin(0);
- cursorStylesGridLay->setHorizontalSpacing(15);
- cursorStylesGridLay->setVerticalSpacing(10);
- {
- cursorStylesGridLay->addWidget(new QLabel(tr("Basic Cursor Type:")),
- 0, 0,
- Qt::AlignRight | Qt::AlignVCenter);
- cursorStylesGridLay->addWidget(m_cursorBrushType, 0, 1);
-
- cursorStylesGridLay->addWidget(new QLabel(tr("Cursor Style:")), 1,
- 0,
- Qt::AlignRight | Qt::AlignVCenter);
- cursorStylesGridLay->addWidget(m_cursorBrushStyle, 1, 1);
-
- cursorStylesGridLay->addWidget(cursorOutlineCB, 2, 0, 1, 3,
- Qt::AlignLeft | Qt::AlignVCenter);
- }
- cursorStylesLay->addLayout(cursorStylesGridLay, 0);
-
- cursorStyleGroupBox->setLayout(cursorStylesLay);
- }
- ToolsTopLay->addWidget(cursorStyleGroupBox, 3, 0, 1, 3);
-
- ToolsTopLay->addWidget(new QLabel(tr("Toolbar Display Behaviour:")), 4,
- 0, Qt::AlignRight | Qt::AlignVCenter);
- ToolsTopLay->addWidget(m_levelBasedToolsDisplayCB, 4, 1);
- }
- toolsFrameLay->addLayout(ToolsTopLay, 0);
-
- toolsFrameLay->addStretch(1);
- }
- toolsBox->setLayout(toolsFrameLay);
- stackedWidget->addWidget(toolsBox);
-
- //--- Xsheet --------------------------
- QWidget *xsheetBox = new QWidget(this);
- QVBoxLayout *xsheetBoxFrameLay = new QVBoxLayout();
- xsheetBoxFrameLay->setMargin(15);
- xsheetBoxFrameLay->setSpacing(10);
- {
- QGridLayout *xsheetFrameLay = new QGridLayout();
- xsheetFrameLay->setMargin(0);
- xsheetFrameLay->setHorizontalSpacing(15);
- xsheetFrameLay->setVerticalSpacing(10);
- {
- xsheetFrameLay->addWidget(new QLabel(tr("Column Header Layout*:")), 0,
- 0, Qt::AlignRight | Qt::AlignVCenter);
- xsheetFrameLay->addWidget(m_xsheetLayout, 0, 1, 1, 2,
- Qt::AlignLeft | Qt::AlignVCenter);
-
- xsheetFrameLay->addWidget(new QLabel(tr("Next/Previous Step Frames:")),
- 1, 0, Qt::AlignRight | Qt::AlignVCenter);
- xsheetFrameLay->addWidget(m_xsheetStep, 1, 1, 1, 2,
- Qt::AlignLeft | Qt::AlignVCenter);
-
- xsheetFrameLay->addWidget(xsheetAutopanDuringPlaybackCB, 2, 0, 1, 3);
-
- xsheetFrameLay->addWidget(new QLabel(tr("Cell-dragging Behaviour:")), 3,
- 0, Qt::AlignRight | Qt::AlignVCenter);
- xsheetFrameLay->addWidget(m_cellsDragBehaviour, 3, 1, 1, 2,
- Qt::AlignLeft | Qt::AlignVCenter);
-
- xsheetFrameLay->addWidget(ignoreAlphaonColumn1CB, 4, 0, 1, 2);
-
- QVBoxLayout *showKeyframesOnCellAreaCBLay = new QVBoxLayout();
- showKeyframesOnCellAreaCBLay->setMargin(11);
- {
- showKeyframesOnCellAreaCBLay->addWidget(
- showXsheetCameraCB, 0, Qt::AlignLeft | Qt::AlignVCenter);
- }
- m_showKeyframesOnCellAreaCB->setLayout(showKeyframesOnCellAreaCBLay);
-
- xsheetFrameLay->addWidget(m_showKeyframesOnCellAreaCB, 5, 0, 1, 2);
- xsheetFrameLay->addWidget(useArrowKeyToShiftCellSelectionCB, 6, 0, 1,
- 2);
- xsheetFrameLay->addWidget(inputCellsWithoutDoubleClickingCB, 7, 0, 1,
- 2);
- xsheetFrameLay->addWidget(shortcutCommandsWhileRenamingCellCB, 8, 0, 1,
- 2);
-
- QVBoxLayout *xSheetToolbarLay = new QVBoxLayout();
- xSheetToolbarLay->setMargin(11);
- {
- xSheetToolbarLay->addWidget(m_expandFunctionHeader, 0,
- Qt::AlignLeft | Qt::AlignVCenter);
- }
- m_showXSheetToolbar->setLayout(xSheetToolbarLay);
-
- xsheetFrameLay->addWidget(m_showXSheetToolbar, 9, 0, 3, 3);
- xsheetFrameLay->addWidget(showColumnNumbersCB, 12, 0, 1, 2);
- xsheetFrameLay->addWidget(m_syncLevelRenumberWithXsheet, 13, 0, 1, 2);
- xsheetFrameLay->addWidget(showCurrentTimelineCB, 14, 0, 1, 2);
-
- xsheetFrameLay->addWidget(new QLabel(tr("Current Column Color:")), 15,
- 0, Qt::AlignRight | Qt::AlignVCenter);
- xsheetFrameLay->addWidget(m_currentColumnColor, 15, 1);
- }
- xsheetFrameLay->setColumnStretch(0, 0);
- xsheetFrameLay->setColumnStretch(1, 0);
- xsheetFrameLay->setColumnStretch(2, 1);
- xsheetFrameLay->setRowStretch(15, 1);
-
- xsheetBoxFrameLay->addLayout(xsheetFrameLay);
- xsheetBoxFrameLay->addStretch(1);
-
- xsheetBoxFrameLay->addWidget(note_xsheet, 0);
- }
- xsheetBox->setLayout(xsheetBoxFrameLay);
- stackedWidget->addWidget(xsheetBox);
-
- //--- Animation --------------------------
- QWidget *animationBox = new QWidget(this);
- QGridLayout *animationFrameLay = new QGridLayout();
- animationFrameLay->setMargin(15);
- animationFrameLay->setHorizontalSpacing(15);
- animationFrameLay->setVerticalSpacing(10);
- {
- animationFrameLay->addWidget(new QLabel(tr("Default Interpolation:")), 0,
- 0, Qt::AlignRight | Qt::AlignVCenter);
- animationFrameLay->addWidget(m_keyframeType, 0, 1);
-
- animationFrameLay->addWidget(new QLabel(tr("Animation Step:")), 1, 0,
- Qt::AlignRight | Qt::AlignVCenter);
- animationFrameLay->addWidget(m_animationStepField, 1, 1);
- }
- animationFrameLay->setColumnStretch(0, 0);
- animationFrameLay->setColumnStretch(1, 0);
- animationFrameLay->setColumnStretch(2, 1);
- animationFrameLay->setRowStretch(0, 0);
- animationFrameLay->setRowStretch(1, 0);
- animationFrameLay->setRowStretch(2, 1);
- animationBox->setLayout(animationFrameLay);
- stackedWidget->addWidget(animationBox);
-
- //--- Preview --------------------------
- QWidget *previewBox = new QWidget(this);
- QGridLayout *previewLayout = new QGridLayout();
- previewLayout->setMargin(15);
- previewLayout->setHorizontalSpacing(15);
- previewLayout->setVerticalSpacing(10);
- {
- previewLayout->addWidget(new QLabel(tr("Blank Frames:")), 0, 0,
- Qt::AlignRight | Qt::AlignVCenter);
- previewLayout->addWidget(m_blanksCount, 0, 1);
-
- previewLayout->addWidget(new QLabel(tr("Blank Frames Color:")), 1, 0,
- Qt::AlignRight | Qt::AlignVCenter);
- previewLayout->addWidget(m_blankColor, 1, 1, 1, 2);
-
- previewLayout->addWidget(rewindAfterPlaybackCB, 2, 0, 1, 3,
- Qt::AlignLeft | Qt::AlignVCenter);
- previewLayout->addWidget(displayInNewFlipBookCB, 3, 0, 1, 3,
- Qt::AlignLeft | Qt::AlignVCenter);
- previewLayout->addWidget(fitToFlipbookCB, 4, 0, 1, 3,
- Qt::AlignLeft | Qt::AlignVCenter);
- previewLayout->addWidget(openFlipbookAfterCB, 5, 0, 1, 3,
- Qt::AlignLeft | Qt::AlignVCenter);
- }
- previewLayout->setColumnStretch(0, 0);
- previewLayout->setColumnStretch(1, 0);
- previewLayout->setColumnStretch(2, 1);
- for (int i = 0; i <= 5; i++) previewLayout->setRowStretch(i, 0);
- previewLayout->setRowStretch(6, 1);
- previewBox->setLayout(previewLayout);
- stackedWidget->addWidget(previewBox);
-
- //--- Onion Skin --------------------------
- QWidget *onionBox = new QWidget(this);
- QVBoxLayout *onionLay = new QVBoxLayout();
- onionLay->setMargin(15);
- onionLay->setSpacing(10);
- {
- onionLay->addWidget(m_onionSkinVisibility, 0,
- Qt::AlignLeft | Qt::AlignVCenter);
- QGridLayout *onionColorLay = new QGridLayout();
- {
- onionColorLay->addWidget(new QLabel(tr("Paper Thickness:")), 0, 0,
- Qt::AlignRight | Qt::AlignVCenter);
- onionColorLay->addWidget(m_onionPaperThickness, 0, 1);
-
- onionColorLay->addWidget(new QLabel(tr("Previous Frames Correction:")),
- 1, 0, Qt::AlignRight | Qt::AlignVCenter);
- onionColorLay->addWidget(m_backOnionColor, 1, 1);
-
- onionColorLay->addWidget(new QLabel(tr("Following Frames Correction:")),
- 2, 0, Qt::AlignRight | Qt::AlignVCenter);
- onionColorLay->addWidget(m_frontOnionColor, 2, 1);
- }
- onionColorLay->setColumnStretch(0, 0);
- onionColorLay->setColumnStretch(1, 0);
- onionColorLay->setColumnStretch(2, 1);
- onionLay->addLayout(onionColorLay, 0);
-
- onionLay->addWidget(m_inksOnly, 0, Qt::AlignLeft | Qt::AlignVCenter);
- onionLay->addWidget(m_onionSkinDuringPlayback, 0,
- Qt::AlignLeft | Qt::AlignVCenter);
- onionLay->addWidget(m_useOnionColorsForShiftAndTraceCB, 0,
- Qt::AlignLeft | Qt::AlignVCenter);
- QGridLayout *guidedDrawingLay = new QGridLayout();
- {
- guidedDrawingLay->addWidget(new QLabel(tr("Vector Guided Style:")), 0,
- 0, Qt::AlignLeft | Qt::AlignVCenter);
- guidedDrawingLay->addWidget(m_guidedDrawingStyle, 0, 1,
- Qt::AlignLeft | Qt::AlignVCenter);
- guidedDrawingLay->setColumnStretch(0, 0);
- guidedDrawingLay->setColumnStretch(1, 0);
- guidedDrawingLay->setColumnStretch(2, 1);
- }
- onionLay->addLayout(guidedDrawingLay, 0);
- onionLay->addStretch(1);
- }
- onionBox->setLayout(onionLay);
- stackedWidget->addWidget(onionBox);
-
- //--- Colors --------------------------
- QWidget *colorBox = new QWidget(this);
- QGridLayout *colorLay = new QGridLayout();
- colorLay->setMargin(15);
- colorLay->setHorizontalSpacing(10);
- colorLay->setVerticalSpacing(10);
- {
- colorLay->addWidget(new QLabel(tr("Viewer BG Color"), this), 0, 0,
- Qt::AlignRight | Qt::AlignVCenter);
- colorLay->addWidget(m_viewerBgColorFld, 0, 1);
-
- colorLay->addWidget(new QLabel(tr("Preview BG Color"), this), 1, 0,
- Qt::AlignRight | Qt::AlignVCenter);
- colorLay->addWidget(m_previewBgColorFld, 1, 1);
-
- colorLay->addWidget(new QLabel(tr("Level Editor Box Color"), this), 2, 0,
- Qt::AlignRight | Qt::AlignVCenter);
- colorLay->addWidget(m_levelEditorBoxColorFld, 2, 1);
-
- colorLay->addWidget(new QLabel(tr("ChessBoard Color 1"), this), 3, 0,
- Qt::AlignRight | Qt::AlignVCenter);
- colorLay->addWidget(m_chessboardColor1Fld, 3, 1);
-
- colorLay->addWidget(new QLabel(tr("Chessboard Color 2"), this), 4, 0,
- Qt::AlignRight | Qt::AlignVCenter);
- colorLay->addWidget(m_chessboardColor2Fld, 4, 1);
-
- QGroupBox *tcBox = new QGroupBox(tr("Transparency Check"), this);
- QGridLayout *tcLay = new QGridLayout();
- tcLay->setMargin(15);
- tcLay->setHorizontalSpacing(10);
- tcLay->setVerticalSpacing(10);
- {
- tcLay->addWidget(new QLabel(tr("Ink Color on White Bg:")), 0, 0,
- Qt::AlignRight);
- tcLay->addWidget(m_transpCheckInkColor, 0, 1);
-
- tcLay->addWidget(new QLabel(tr("Ink Color on Black Bg:")), 1, 0,
- Qt::AlignRight);
- tcLay->addWidget(m_transpCheckBgColor, 1, 1);
-
- tcLay->addWidget(new QLabel(tr("Paint Color:")), 2, 0, Qt::AlignRight);
- tcLay->addWidget(m_transpCheckPaintColor, 2, 1);
- }
- tcLay->setColumnStretch(0, 0);
- tcLay->setColumnStretch(1, 0);
- tcLay->setColumnStretch(2, 1);
- for (int i = 0; i <= 2; i++) tcLay->setRowStretch(i, 0);
- tcLay->setRowStretch(5, 1);
- tcBox->setLayout(tcLay);
-
- colorLay->addWidget(tcBox, 5, 0, 1, 3);
- }
- colorLay->setColumnStretch(0, 0);
- colorLay->setColumnStretch(1, 0);
- colorLay->setColumnStretch(2, 1);
- for (int i = 0; i <= 4; i++) colorLay->setRowStretch(i, 0);
- colorLay->setRowStretch(6, 1);
- colorBox->setLayout(colorLay);
- stackedWidget->addWidget(colorBox);
-
- //--- Version Control --------------------------
- QWidget *versionControlBox = new QWidget(this);
- QVBoxLayout *vcLay = new QVBoxLayout();
- vcLay->setMargin(15);
- vcLay->setSpacing(10);
- {
- vcLay->addWidget(m_enableVersionControl, 0,
- Qt::AlignLeft | Qt::AlignVCenter);
- vcLay->addWidget(autoRefreshFolderContentsCB, 0,
- Qt::AlignLeft | Qt::AlignVCenter);
- vcLay->addWidget(checkForTheLatestVersionCB, 0,
- Qt::AlignLeft | Qt::AlignVCenter);
-
- vcLay->addStretch(1);
-
- vcLay->addWidget(note_version, 0);
- }
- versionControlBox->setLayout(vcLay);
- stackedWidget->addWidget(versionControlBox);
-
- //--- Tablet Settings --------------------------
- QWidget *tabletSettingsBox = new QWidget(this);
- QVBoxLayout *tsLay = new QVBoxLayout();
- tsLay->setMargin(15);
- tsLay->setSpacing(10);
- {
- tsLay->addWidget(m_enableTouchGestures, 0,
- Qt::AlignLeft | Qt::AlignVCenter);
-
- if (winInkAvailable)
- tsLay->addWidget(m_enableWinInk, 0, Qt::AlignLeft | Qt::AlignVCenter);
-
- tsLay->addStretch(1);
-
- if (winInkAvailable) tsLay->addWidget(note_tablet, 0);
- }
- tabletSettingsBox->setLayout(tsLay);
- stackedWidget->addWidget(tabletSettingsBox);
-
- mainLayout->addWidget(stackedWidget, 1);
- }
- setLayout(mainLayout);
-
- /*---- signal-slot connections -----*/
-
- bool ret = true;
- ret = ret && connect(categoryList, SIGNAL(currentRowChanged(int)),
- stackedWidget, SLOT(setCurrentIndex(int)));
-
- //--- General ----------------------
- ret = ret && connect(useDefaultViewerCB, SIGNAL(stateChanged(int)), this,
- SLOT(onDefaultViewerChanged(int)));
- ret = ret && connect(minimizeRasterMemoryCB, SIGNAL(stateChanged(int)), this,
- SLOT(onRasterOptimizedMemoryChanged(int)));
- ret = ret && connect(m_autoSaveGroup, SIGNAL(toggled(bool)),
- SLOT(onAutoSaveChanged(bool)));
- ret = ret && connect(m_pref, SIGNAL(stopAutoSave()), this,
- SLOT(onAutoSaveExternallyChanged()));
- ret = ret && connect(m_pref, SIGNAL(startAutoSave()), this,
- SLOT(onAutoSaveExternallyChanged()));
- ret = ret && connect(m_pref, SIGNAL(autoSavePeriodChanged()), this,
- SLOT(onAutoSavePeriodExternallyChanged()));
- ret = ret && connect(m_autoSaveSceneCB, SIGNAL(stateChanged(int)),
- SLOT(onAutoSaveSceneChanged(int)));
- ret = ret && connect(m_autoSaveOtherFilesCB, SIGNAL(stateChanged(int)),
- SLOT(onAutoSaveOtherFilesChanged(int)));
- ret = ret && connect(m_minuteFld, SIGNAL(editingFinished()),
- SLOT(onMinuteChanged()));
- ret = ret && connect(startupPopupCB, SIGNAL(stateChanged(int)),
- SLOT(onStartupPopupChanged(int)));
- ret = ret && connect(m_cellsDragBehaviour, SIGNAL(currentIndexChanged(int)),
- SLOT(onDragCellsBehaviourChanged(int)));
- ret = ret && connect(m_undoMemorySize, SIGNAL(editingFinished()),
- SLOT(onUndoMemorySizeChanged()));
- ret = ret &&
- connect(m_backup, SIGNAL(toggled(bool)), SLOT(onBackupChanged(bool)));
- ret = ret && connect(m_backupKeepCount, SIGNAL(editingFinished()), this,
- SLOT(onBackupKeepCountChanged()));
- ret = ret && connect(sceneNumberingCB, SIGNAL(stateChanged(int)),
- SLOT(onSceneNumberingChanged(int)));
- ret = ret && connect(watchFileSystemCB, SIGNAL(stateChanged(int)),
- SLOT(onWatchFileSystemClicked(int)));
- ret = ret && connect(m_chunkSizeFld, SIGNAL(editingFinished()), this,
- SLOT(onChunkSizeChanged()));
- ret = ret && connect(m_customProjectRootFileField, SIGNAL(pathChanged()),
- this, SLOT(onCustomProjectRootChanged()));
- ret = ret && connect(m_projectRootDocuments, SIGNAL(stateChanged(int)),
- SLOT(onProjectRootChanged()));
- ret = ret && connect(m_projectRootDesktop, SIGNAL(stateChanged(int)),
- SLOT(onProjectRootChanged()));
- ret = ret && connect(m_projectRootStuff, SIGNAL(stateChanged(int)),
- SLOT(onProjectRootChanged()));
- ret = ret && connect(m_projectRootCustom, SIGNAL(stateChanged(int)),
- SLOT(onProjectRootChanged()));
- ret = ret && connect(pathAliasPriority, SIGNAL(currentIndexChanged(int)),
- SLOT(onPathAliasPriorityChanged(int)));
-
- //--- Interface ----------------------
- ret = ret &&
- connect(styleSheetType, SIGNAL(currentIndexChanged(const QString &)),
- SLOT(onStyleSheetTypeChanged(const QString &)));
- ret = ret && connect(m_pixelsOnlyCB, SIGNAL(stateChanged(int)),
- SLOT(onPixelsOnlyChanged(int)));
- // pixels unit may deactivated externally on loading scene (see
- // IoCmd::loadScene())
- ret = ret && connect(TApp::instance()->getCurrentScene(),
- SIGNAL(pixelUnitSelected(bool)), this,
- SLOT(onPixelUnitExternallySelected(bool)));
- ret = ret && connect(m_unitOm, SIGNAL(currentIndexChanged(int)),
- SLOT(onUnitChanged(int)));
- ret = ret && connect(m_cameraUnitOm, SIGNAL(currentIndexChanged(int)),
- SLOT(onCameraUnitChanged(int)));
- ret = ret && connect(m_functionEditorToggle, SIGNAL(currentIndexChanged(int)),
- SLOT(onFunctionEditorToggleChanged(int)));
- ret = ret && connect(roomChoice, SIGNAL(currentIndexChanged(int)),
- SLOT(onRoomChoiceChanged(int)));
- ret = ret && connect(m_iconSizeLx, SIGNAL(editingFinished()),
- SLOT(onIconSizeChanged()));
- ret = ret && connect(m_iconSizeLy, SIGNAL(editingFinished()),
- SLOT(onIconSizeChanged()));
- ret = ret && connect(m_viewShrink, SIGNAL(editingFinished()),
- SLOT(onViewValuesChanged()));
- ret = ret && connect(m_viewStep, SIGNAL(editingFinished()),
- SLOT(onViewValuesChanged()));
- if (languageList.size() > 1)
- ret = ret &&
- connect(languageType, SIGNAL(currentIndexChanged(const QString &)),
- SLOT(onLanguageTypeChanged(const QString &)));
- ret = ret && connect(moveCurrentFrameCB, SIGNAL(stateChanged(int)), this,
- SLOT(onMoveCurrentFrameChanged(int)));
- ret =
- ret && connect(viewerZoomCenterComboBox, SIGNAL(currentIndexChanged(int)),
- this, SLOT(onViewerZoomCenterChanged(int)));
- ret = ret && connect(m_interfaceFont, SIGNAL(currentIndexChanged(int)), this,
- SLOT(onInterfaceFontChanged(int)));
- ret = ret && connect(m_interfaceFontStyle, SIGNAL(currentIndexChanged(int)),
- this, SLOT(onInterfaceFontStyleChanged(int)));
- ret = ret && connect(replaceAfterSaveLevelAsCB, SIGNAL(stateChanged(int)),
- this, SLOT(onReplaceAfterSaveLevelAsChanged(int)));
- ret =
- ret &&
- connect(showRasterImageDarkenBlendedInViewerCB, SIGNAL(stateChanged(int)),
- this, SLOT(onShowRasterImageDarkenBlendedInViewerChanged(int)));
- ret = ret &&
- connect(showShowFrameNumberWithLettersCB, SIGNAL(stateChanged(int)),
- this, SLOT(onShowFrameNumberWithLettersChanged(int)));
- // Column Icon
- ret = ret &&
- connect(m_columnIconOm, SIGNAL(currentIndexChanged(const QString &)),
- this, SLOT(onColumnIconChange(const QString &)));
- ret = ret && connect(actualPixelOnSceneModeCB, SIGNAL(stateChanged(int)),
- SLOT(onActualPixelOnSceneModeChanged(int)));
- ret = ret && connect(levelNameOnEachMarkerCB, SIGNAL(stateChanged(int)),
- SLOT(onLevelNameOnEachMarkerChanged(int)));
-
- ret = ret && connect(m_colorCalibration, SIGNAL(clicked(bool)), this,
- SLOT(onColorCalibrationChanged(bool)));
- ret = ret && connect(m_lutPathFileField, SIGNAL(pathChanged()), this,
- SLOT(onLutPathChanged()));
-
- //--- Visualization ---------------------
- ret = ret && connect(show0ThickLinesCB, SIGNAL(stateChanged(int)), this,
- SLOT(onShow0ThickLinesChanged(int)));
- ret = ret && connect(regionAntialiasCB, SIGNAL(stateChanged(int)), this,
- SLOT(onRegionAntialiasChanged(int)));
-
- //--- Loading ----------------------
- ret = ret && connect(exposeLoadedLevelsCB, SIGNAL(stateChanged(int)), this,
- SLOT(onAutoExposeChanged(int)));
- ret = ret && connect(m_ignoreImageDpiCB, SIGNAL(stateChanged(int)), this,
- SLOT(onIgnoreImageDpiChanged(int)));
- ret = ret && connect(initialLoadTlvCachingBehaviorComboBox,
- SIGNAL(currentIndexChanged(int)), this,
- SLOT(onInitialLoadTlvCachingBehaviorChanged(int)));
- ret = ret && connect(createSubfolderCB, SIGNAL(stateChanged(int)), this,
- SLOT(onSubsceneFolderChanged(int)));
- ret =
- ret &&
- connect(removeSceneNumberFromLoadedLevelNameCB, SIGNAL(stateChanged(int)),
- this, SLOT(onRemoveSceneNumberFromLoadedLevelNameChanged(int)));
- ret = ret &&
- connect(m_addLevelFormat, SIGNAL(clicked()), SLOT(onAddLevelFormat()));
- ret = ret && connect(m_removeLevelFormat, SIGNAL(clicked()),
- SLOT(onRemoveLevelFormat()));
- ret = ret && connect(m_editLevelFormat, SIGNAL(clicked()),
- SLOT(onEditLevelFormat()));
- ret = ret && connect(m_importPolicy, SIGNAL(currentIndexChanged(int)),
- SLOT(onImportPolicyChanged(int)));
- ret = ret && connect(TApp::instance()->getCurrentScene(),
- SIGNAL(importPolicyChanged(int)), this,
- SLOT(onImportPolicyExternallyChanged(int)));
-
- //--- Saving ----------------------
- ret = ret &&
- connect(rasterBackgroundColor,
- SIGNAL(colorChanged(const TPixel32 &, bool)),
- SLOT(onRasterBackgroundColorChanged(const TPixel32 &, bool)));
-
- //--- Import/Export ----------------------
- ret = ret && connect(m_ffmpegPathFileFld, SIGNAL(pathChanged()), this,
- SLOT(onFfmpegPathChanged()));
- ret = ret && connect(m_fastRenderPathFileField, SIGNAL(pathChanged()), this,
- SLOT(onFastRenderPathChanged()));
- ret = ret && connect(m_ffmpegTimeout, SIGNAL(editingFinished()), this,
- SLOT(onFfmpegTimeoutChanged()));
-
- //--- Drawing ----------------------
- ret = ret && connect(keepOriginalCleanedUpCB, SIGNAL(stateChanged(int)), this,
- SLOT(onSaveUnpaintedInCleanupChanged(int)));
- ret = ret && connect(m_defScanLevelType,
- SIGNAL(currentIndexChanged(const QString &)),
- SLOT(onScanLevelTypeChanged(const QString &)));
- ret = ret && connect(minimizeSaveboxAfterEditingCB, SIGNAL(stateChanged(int)),
- this, SLOT(onMinimizeSaveboxAfterEditing(int)));
- ret = ret && connect(m_defLevelType, SIGNAL(currentIndexChanged(int)),
- SLOT(onDefLevelTypeChanged(int)));
- ret = ret && connect(m_autocreationType, SIGNAL(currentIndexChanged(int)),
- SLOT(onAutocreationTypeChanged(int)));
- ret =
- ret && connect(m_vectorSnappingTargetCB, SIGNAL(currentIndexChanged(int)),
- SLOT(onVectorSnappingTargetChanged(int)));
- ret = ret && connect(m_defLevelWidth, SIGNAL(valueChanged()),
- SLOT(onDefLevelParameterChanged()));
- ret = ret && connect(m_defLevelHeight, SIGNAL(valueChanged()),
- SLOT(onDefLevelParameterChanged()));
- ret = ret && connect(m_defLevelDpi, SIGNAL(valueChanged()),
- SLOT(onDefLevelParameterChanged()));
- ret = ret && connect(m_useNumpadForSwitchingStyles, SIGNAL(clicked(bool)),
- SLOT(onUseNumpadForSwitchingStylesClicked(bool)));
- ret = ret && connect(m_keepFillOnVectorSimplifyCB, SIGNAL(stateChanged(int)),
- SLOT(onKeepFillOnVectorSimplifyChanged(int)));
- ret = ret &&
- connect(m_useHigherDpiOnVectorSimplifyCB, SIGNAL(stateChanged(int)),
- SLOT(onUseHigherDpiOnVectorSimplifyChanged(int)));
- ret = ret && connect(m_downArrowInLevelStripCreatesNewFrame,
- SIGNAL(stateChanged(int)),
- SLOT(onDownArrowInLevelStripCreatesNewFrame(int)));
- ret = ret && connect(m_newLevelToCameraSizeCB, SIGNAL(clicked(bool)),
- SLOT(onNewLevelToCameraSizeChanged(bool)));
- ret = ret && connect(m_enableAutoStretch, SIGNAL(stateChanged(int)), this,
- SLOT(onEnableAutoStretch(int)));
-
- //--- Tools -----------------------
-
- ret = ret && connect(m_dropdownShortcutsCycleOptionsCB,
- SIGNAL(currentIndexChanged(int)),
- SLOT(onDropdownShortcutsCycleOptionsChanged(int)));
- ret = ret && connect(multiLayerStylePickerCB, SIGNAL(stateChanged(int)), this,
- SLOT(onMultiLayerStylePickerChanged(int)));
- ret = ret && connect(useSaveboxToLimitFillingOpCB, SIGNAL(stateChanged(int)),
- this, SLOT(onGetFillOnlySavebox(int)));
- ret = ret && connect(m_cursorBrushType, SIGNAL(currentIndexChanged(int)),
- this, SLOT(onCursorBrushTypeChanged(int)));
- ret = ret && connect(m_cursorBrushStyle, SIGNAL(currentIndexChanged(int)),
- this, SLOT(onCursorBrushStyleChanged(int)));
- ret = ret && connect(cursorOutlineCB, SIGNAL(stateChanged(int)), this,
- SLOT(onCursorOutlineChanged(int)));
- ret = ret &&
- connect(m_levelBasedToolsDisplayCB, SIGNAL(currentIndexChanged(int)),
- SLOT(onLevelBasedToolsDisplayChanged(int)));
-
- //--- Xsheet ----------------------
- ret = ret && connect(xsheetAutopanDuringPlaybackCB, SIGNAL(stateChanged(int)),
- this, SLOT(onXsheetAutopanChanged(int)));
- ret = ret && connect(ignoreAlphaonColumn1CB, SIGNAL(stateChanged(int)), this,
- SLOT(onIgnoreAlphaonColumn1Changed(int)));
- ret = ret && connect(m_xsheetStep, SIGNAL(editingFinished()),
- SLOT(onXsheetStepChanged()));
- ret = ret && connect(m_cellsDragBehaviour, SIGNAL(currentIndexChanged(int)),
- SLOT(onDragCellsBehaviourChanged(int)));
- ret = ret && connect(m_showKeyframesOnCellAreaCB, SIGNAL(clicked(bool)), this,
- SLOT(onShowKeyframesOnCellAreaChanged(bool)));
- ret = ret &&
- connect(useArrowKeyToShiftCellSelectionCB, SIGNAL(stateChanged(int)),
- SLOT(onUseArrowKeyToShiftCellSelectionClicked(int)));
- ret = ret &&
- connect(inputCellsWithoutDoubleClickingCB, SIGNAL(stateChanged(int)),
- SLOT(onInputCellsWithoutDoubleClickingClicked(int)));
- ret = ret &&
- connect(shortcutCommandsWhileRenamingCellCB, SIGNAL(stateChanged(int)),
- SLOT(onShortcutCommandsWhileRenamingCellClicked(int)));
- ret = ret && connect(m_showXSheetToolbar, SIGNAL(clicked(bool)),
- SLOT(onShowXSheetToolbarClicked(bool)));
- ret = ret && connect(m_expandFunctionHeader, SIGNAL(clicked(bool)),
- SLOT(onExpandFunctionHeaderClicked(bool)));
-
- ret = ret && connect(showColumnNumbersCB, SIGNAL(stateChanged(int)), this,
- SLOT(onShowColumnNumbersChanged(int)));
-
- ret = ret && connect(m_syncLevelRenumberWithXsheet, SIGNAL(stateChanged(int)),
- this, SLOT(onSyncLevelRenumberWithXsheetChanged(int)));
-
- ret = ret && connect(m_xsheetLayout, SIGNAL(currentIndexChanged(int)), this,
- SLOT(onXsheetLayoutChanged(int)));
-
- ret =
- ret && connect(m_currentColumnColor,
- SIGNAL(colorChanged(const TPixel32 &, bool)),
- SLOT(onCurrentColumnDataChanged(const TPixel32 &, bool)));
-
- ret = ret && connect(showXsheetCameraCB, SIGNAL(stateChanged(int)), this,
- SLOT(onShowXsheetCameraColumnChanged(int)));
-
- //--- Animation ----------------------
- ret = ret && connect(m_keyframeType, SIGNAL(currentIndexChanged(int)),
- SLOT(onKeyframeTypeChanged(int)));
- ret = ret && connect(m_animationStepField, SIGNAL(editingFinished()),
- SLOT(onAnimationStepChanged()));
-
- //--- Preview ----------------------
- ret = ret && connect(m_blanksCount, SIGNAL(editingFinished()),
- SLOT(onBlankCountChanged()));
- ret =
- ret && connect(m_blankColor, SIGNAL(colorChanged(const TPixel32 &, bool)),
- SLOT(onBlankColorChanged(const TPixel32 &, bool)));
- ret = ret && connect(rewindAfterPlaybackCB, SIGNAL(stateChanged(int)), this,
- SLOT(onRewindAfterPlayback(int)));
- ret = ret && connect(displayInNewFlipBookCB, SIGNAL(stateChanged(int)), this,
- SLOT(onPreviewAlwaysOpenNewFlip(int)));
- ret = ret && connect(fitToFlipbookCB, SIGNAL(stateChanged(int)), this,
- SLOT(onFitToFlipbook(int)));
- ret = ret && connect(openFlipbookAfterCB, SIGNAL(stateChanged(int)), this,
- SLOT(onViewGeneratedMovieChanged(int)));
-
- //--- Onion Skin ----------------------
- ret = ret &&
- connect(m_frontOnionColor, SIGNAL(colorChanged(const TPixel32 &, bool)),
- SLOT(onOnionDataChanged(const TPixel32 &, bool)));
- ret = ret &&
- connect(m_backOnionColor, SIGNAL(colorChanged(const TPixel32 &, bool)),
- SLOT(onOnionDataChanged(const TPixel32 &, bool)));
- ret = ret && connect(m_inksOnly, SIGNAL(stateChanged(int)),
- SLOT(onOnionDataChanged(int)));
- ret = ret && connect(m_onionSkinVisibility, SIGNAL(stateChanged(int)),
- SLOT(onOnionSkinVisibilityChanged(int)));
- ret = ret && connect(m_onionSkinDuringPlayback, SIGNAL(stateChanged(int)),
- SLOT(onOnionSkinDuringPlaybackChanged(int)));
- ret = ret &&
- connect(m_useOnionColorsForShiftAndTraceCB, SIGNAL(stateChanged(int)),
- SLOT(onOnionColorsForShiftAndTraceChanged(int)));
- ret = ret && connect(m_onionPaperThickness, SIGNAL(editingFinished()),
- SLOT(onOnionPaperThicknessChanged()));
- ret = ret && connect(m_guidedDrawingStyle, SIGNAL(currentIndexChanged(int)),
- SLOT(onGuidedDrawingStyleChanged(int)));
- ret = ret && connect(showCurrentTimelineCB, SIGNAL(stateChanged(int)), this,
- SLOT(onShowCurrentTimelineChanged(int)));
-
- //--- Colors ----------------------
- // Viewer BG color
- ret = ret && connect(m_viewerBgColorFld,
- SIGNAL(colorChanged(const TPixel32 &, bool)), this,
- SLOT(setViewerBgColor(const TPixel32 &, bool)));
- // Preview BG color
- ret = ret && connect(m_previewBgColorFld,
- SIGNAL(colorChanged(const TPixel32 &, bool)), this,
- SLOT(setPreviewBgColor(const TPixel32 &, bool)));
- // Level Editor Box color
- ret = ret && connect(m_levelEditorBoxColorFld,
- SIGNAL(colorChanged(const TPixel32 &, bool)), this,
- SLOT(setLevelEditorBoxColor(const TPixel32 &, bool)));
- // bg chessboard colors
- ret = ret && connect(m_chessboardColor1Fld,
- SIGNAL(colorChanged(const TPixel32 &, bool)), this,
- SLOT(setChessboardColor1(const TPixel32 &, bool)));
- ret = ret && connect(m_chessboardColor2Fld,
- SIGNAL(colorChanged(const TPixel32 &, bool)), this,
- SLOT(setChessboardColor2(const TPixel32 &, bool)));
- ret = ret && connect(m_transpCheckBgColor,
- SIGNAL(colorChanged(const TPixel32 &, bool)),
- SLOT(onTranspCheckDataChanged(const TPixel32 &, bool)));
- ret = ret && connect(m_transpCheckInkColor,
- SIGNAL(colorChanged(const TPixel32 &, bool)),
- SLOT(onTranspCheckDataChanged(const TPixel32 &, bool)));
- ret = ret && connect(m_transpCheckPaintColor,
- SIGNAL(colorChanged(const TPixel32 &, bool)),
- SLOT(onTranspCheckDataChanged(const TPixel32 &, bool)));
-
- //--- Version Control ----------------------
- ret = ret && connect(m_enableVersionControl, SIGNAL(stateChanged(int)),
- SLOT(onSVNEnabledChanged(int)));
- ret = ret && connect(autoRefreshFolderContentsCB, SIGNAL(stateChanged(int)),
- SLOT(onAutomaticSVNRefreshChanged(int)));
- ret = ret && connect(checkForTheLatestVersionCB, SIGNAL(clicked(bool)),
- SLOT(onCheckLatestVersionChanged(bool)));
-
- //--- Touch/Tablet Settings ----------------------
- ret = ret && connect(m_enableTouchGestures, SIGNAL(stateChanged(int)),
- SLOT(onEnableTouchGesturesChanged(int)));
-
- QAction *action =
- CommandManager::instance()->getAction(MI_TouchGestureControl);
- ret = ret && connect(action, SIGNAL(triggered(bool)),
- SLOT(onEnableTouchGesturesTriggered(bool)));
-
- if (winInkAvailable)
- ret = ret && connect(m_enableWinInk, SIGNAL(stateChanged(int)),
- SLOT(onEnableWinInkChanged(int)));
-
- assert(ret);
+ if (m_onEditedFuncMap.contains(id)) (this->*m_onEditedFuncMap[id])();
}
//-----------------------------------------------------------------------------
diff --git a/toonz/sources/toonz/preferencespopup.h b/toonz/sources/toonz/preferencespopup.h
index 142b19a52..b950f0486 100644
--- a/toonz/sources/toonz/preferencespopup.h
+++ b/toonz/sources/toonz/preferencespopup.h
@@ -32,203 +32,136 @@ class QGroupBox;
//**********************************************************************************
// PreferencesPopup definition
//**********************************************************************************
+typedef QPair<QString, QVariant> ComboBoxItem;
-class PreferencesPopup final : public QDialog {
+class SizeField final : public QWidget {
Q_OBJECT
+ DVGui::IntLineEdit *m_fieldX, *m_fieldY;
public:
- PreferencesPopup();
-
-private:
- class FormatProperties;
-
-private:
- Preferences *m_pref;
-
- FormatProperties *m_formatProperties;
-
- DVGui::ColorField *m_blankColor, *m_frontOnionColor, *m_backOnionColor,
- *m_transpCheckBgColor, *m_transpCheckInkColor, *m_transpCheckPaintColor,
- *m_viewerBgColorFld, *m_previewBgColorFld, *m_chessboardColor1Fld,
- *m_chessboardColor2Fld, *m_levelEditorBoxColorFld;
-
- QComboBox *m_keyframeType, *m_cellsDragBehaviour, *m_defScanLevelType,
- *m_defLevelType, *m_autocreationType, *m_levelFormatNames,
- *m_columnIconOm, *m_unitOm, *m_cameraUnitOm, *m_importPolicy,
- *m_vectorSnappingTargetCB, *m_dropdownShortcutsCycleOptionsCB,
- *m_guidedDrawingStyle, *m_functionEditorToggle, *m_cursorBrushType,
- *m_cursorBrushStyle, *m_xsheetLayout, *m_interfaceFontStyle,
- *m_levelBasedToolsDisplayCB;
-
- QFontComboBox *m_interfaceFont;
-
- DVGui::MeasuredDoubleLineEdit *m_defLevelWidth, *m_defLevelHeight;
-
- DVGui::DoubleLineEdit *m_defLevelDpi;
+ SizeField(QSize min, QSize max, QSize value = QSize(),
+ QWidget* parent = nullptr);
+ QSize getValue() const;
+ void setValue(const QSize&);
+signals:
+ void editingFinished();
+};
- QLabel *m_dpiLabel, *m_customProjectRootLabel, *m_projectRootDirections;
+class PreferencesPopup;
- DVGui::IntLineEdit *m_minuteFld, *m_chunkSizeFld, *m_iconSizeLx,
- *m_iconSizeLy, *m_viewShrink, *m_viewStep, *m_blanksCount,
- *m_onionPaperThickness, *m_animationStepField, *m_undoMemorySize,
- *m_xsheetStep, *m_ffmpegTimeout, *m_backupKeepCount;
+typedef void (PreferencesPopup::*OnEditedPopupFunc)();
- QPushButton *m_addLevelFormat, *m_removeLevelFormat, *m_editLevelFormat;
+class PreferencesPopup final : public QDialog {
+ Q_OBJECT
- DVGui::CheckBox *m_inksOnly, *m_enableVersionControl, *m_onionSkinVisibility,
- *m_pixelsOnlyCB, *m_projectRootDocuments, *m_projectRootDesktop,
- *m_projectRootCustom, *m_projectRootStuff, *m_onionSkinDuringPlayback,
- *m_autoSaveSceneCB, *m_autoSaveOtherFilesCB,
- *m_useNumpadForSwitchingStyles, *m_expandFunctionHeader,
- *m_useHigherDpiOnVectorSimplifyCB, *m_keepFillOnVectorSimplifyCB,
- *m_newLevelToCameraSizeCB, *m_ignoreImageDpiCB,
- *m_syncLevelRenumberWithXsheet, *m_downArrowInLevelStripCreatesNewFrame,
- *m_enableAutoStretch, *m_enableWinInk, *m_enableTouchGestures,
- *m_useOnionColorsForShiftAndTraceCB, *m_showXsheetCameraColCB;
+ QMap<QWidget*, PreferencesItemId> m_controlIdMap;
+ QMap<PreferencesItemId, OnEditedPopupFunc> m_onEditedFuncMap;
+ QMap<PreferencesItemId, OnEditedPopupFunc> m_preEditedFuncMap;
- DVGui::FileField *m_customProjectRootFileField;
+public:
+ PreferencesPopup();
- DVGui::FileField *m_ffmpegPathFileFld, *m_fastRenderPathFileField,
- *m_lutPathFileField;
+private:
+ class FormatProperties;
- QGroupBox *m_autoSaveGroup, *m_showXSheetToolbar, *m_colorCalibration,
- *m_backup, *m_showKeyframesOnCellAreaCB;
+private:
+ Preferences* m_pref;
+ FormatProperties* m_formatProperties;
- DVGui::ColorField *m_currentColumnColor;
+ DVGui::CheckBox *m_projectRootDocuments, *m_projectRootDesktop,
+ *m_projectRootCustom;
+ QPushButton* m_editLevelFormat;
+ QComboBox* m_levelFormatNames;
private:
- // QWidget* create(const QString& lbl, bool def, const char* slot);
void rebuildFormatsList();
- void rebuilldFontStyleList();
+ QList<ComboBoxItem> buildFontStyleList() const;
+
+ QWidget* createUI(
+ PreferencesItemId id,
+ const QList<ComboBoxItem>& comboItems = QList<ComboBoxItem>());
+ QGridLayout* insertGroupBoxUI(PreferencesItemId id, QGridLayout* layout);
+ void insertUI(PreferencesItemId id, QGridLayout* layout,
+ const QList<ComboBoxItem>& comboItems = QList<ComboBoxItem>());
+ void insertDualUIs(
+ PreferencesItemId leftId, PreferencesItemId rightId, QGridLayout* layout,
+ const QList<ComboBoxItem>& leftComboItems = QList<ComboBoxItem>(),
+ const QList<ComboBoxItem>& rightComboItems = QList<ComboBoxItem>());
+ void insertFootNote(QGridLayout* layout);
+ QString getUIString(PreferencesItemId id);
+ QList<ComboBoxItem> getComboItemList(PreferencesItemId id) const;
+ template <typename T>
+ inline T getUI(PreferencesItemId id);
+
+ QWidget* createGeneralPage();
+ QWidget* createInterfacePage();
+ QWidget* createVisualizationPage();
+ QWidget* createLoadingPage();
+ QWidget* createSavingPage();
+ QWidget* createImportExportPage();
+ QWidget* createDrawingPage();
+ QWidget* createToolsPage();
+ QWidget* createXsheetPage();
+ QWidget* createAnimationPage();
+ QWidget* createPreviewPage();
+ QWidget* createOnionSkinPage();
+ QWidget* createColorsPage();
+ QWidget* createVersionControlPage();
+ QWidget* createTouchTabletPage();
+
+ //--- callbacks ---
+ // General
+ void onAutoSaveChanged();
+ void onAutoSaveOptionsChanged();
+ void onWatchFileSystemClicked();
+ void onPathAliasPriorityChanged();
+ // Interface
+ void onStyleSheetTypeChanged();
+ void onPixelsOnlyChanged();
+ void onUnitChanged();
+ void beforeRoomChoiceChanged();
+ // Drawing
+ void onDefLevelTypeChanged();
+ void onAutocreationTypeChanged();
+ void onUseNumpadForSwitchingStylesClicked();
+ // Tools
+ void onLevelBasedToolsDisplayChanged();
+ // Xsheet
+ void onShowKeyframesOnCellAreaChanged();
+ void onShowXSheetToolbarClicked();
+ // Preview
+ void onBlankCountChanged();
+ void onBlankColorChanged();
+ // Onion Skin
+ void onOnionSkinVisibilityChanged();
+ void onOnionColorChanged();
+ // Colors
+ void onTranspCheckDataChanged();
+ // Version Control
+ void onSVNEnabledChanged();
+ // Commonly used
+ void notifySceneChanged();
private slots:
+ void onChange();
+ void onColorFieldChanged(const TPixel32&, bool);
- void onPixelsOnlyChanged(int index);
- void onProjectRootChanged();
- void onCustomProjectRootChanged();
- void onPixelUnitExternallySelected(bool on);
void onAutoSaveExternallyChanged();
void onAutoSavePeriodExternallyChanged();
- void onUnitChanged(int index);
- void onCameraUnitChanged(int index);
- void onRoomChoiceChanged(int index);
- void onFunctionEditorToggleChanged(int index);
- void onScanLevelTypeChanged(const QString &text);
- void onMinuteChanged();
- void onIconSizeChanged();
- void onViewValuesChanged();
- void onAutoExposeChanged(int index);
- void onSubsceneFolderChanged(int index);
- void onViewGeneratedMovieChanged(int index);
- void onXsheetStepChanged();
- void onXsheetAutopanChanged(int index);
- void onIgnoreAlphaonColumn1Changed(int index);
- void onRewindAfterPlayback(int index);
- void onPreviewAlwaysOpenNewFlip(int index);
- void onRasterOptimizedMemoryChanged(int index);
- void onSaveUnpaintedInCleanupChanged(int index);
- void onMinimizeSaveboxAfterEditing(int index);
- void onAutoSaveChanged(bool on);
- void onAutoSaveSceneChanged(int index);
- void onAutoSaveOtherFilesChanged(int index);
- void onStartupPopupChanged(int index);
- void onDefaultViewerChanged(int index);
- void onBlankCountChanged();
- void onBlankColorChanged(const TPixel32 &, bool isDragging);
- void onAskForOverrideRender(int index);
- void onKeyframeTypeChanged(int index);
- void onAutocreationTypeChanged(int index);
- void onAnimationStepChanged();
- void onOnionPaperThicknessChanged();
- void onTranspCheckDataChanged(const TPixel32 &, bool isDragging);
- void onOnionDataChanged(const TPixel32 &, bool isDragging);
- void onOnionDataChanged(int);
- void onLanguageTypeChanged(const QString &);
- void onStyleSheetTypeChanged(const QString &);
- void onUndoMemorySizeChanged();
- void onSVNEnabledChanged(int);
- void onAutomaticSVNRefreshChanged(int);
- void onDragCellsBehaviourChanged(int);
- void onBackupChanged(bool enabled);
- void onSceneNumberingChanged(int);
- void onChunkSizeChanged();
- void onDefLevelTypeChanged(int);
- void onDefLevelParameterChanged();
- void onGetFillOnlySavebox(int index);
- void onFitToFlipbook(int);
- void onDropdownShortcutsCycleOptionsChanged(int);
- void onDownArrowInLevelStripCreatesNewFrame(int);
+ void onProjectRootChanged();
+ void onPixelUnitExternallySelected(bool on);
+ void onInterfaceFontChanged(const QString& text);
+ void onLutPathChanged();
+
void onAddLevelFormat();
void onRemoveLevelFormat();
void onEditLevelFormat();
void onLevelFormatEdited();
- void onIgnoreImageDpiChanged(int index);
- void onShow0ThickLinesChanged(int);
- void onKeepFillOnVectorSimplifyChanged(int);
- void onUseHigherDpiOnVectorSimplifyChanged(int);
- void onRegionAntialiasChanged(int);
- void onImportPolicyChanged(int);
void onImportPolicyExternallyChanged(int policy);
- void onNewLevelToCameraSizeChanged(bool checked);
- void onVectorSnappingTargetChanged(int index);
#ifdef LINETEST
void onLineTestFpsCapture(int);
#endif
-
- void onMoveCurrentFrameChanged(int index);
- void setViewerBgColor(const TPixel32 &, bool);
- void setPreviewBgColor(const TPixel32 &, bool);
- void setLevelEditorBoxColor(const TPixel32 &, bool);
- void setChessboardColor1(const TPixel32 &, bool);
- void setChessboardColor2(const TPixel32 &, bool);
- void onColumnIconChange(const QString &);
- void onReplaceAfterSaveLevelAsChanged(int index);
- void onOnionSkinVisibilityChanged(int);
- void onOnionSkinDuringPlaybackChanged(int);
- void onOnionColorsForShiftAndTraceChanged(int);
- void onGuidedDrawingStyleChanged(int);
- void onActualPixelOnSceneModeChanged(int);
- void onMultiLayerStylePickerChanged(int);
- void onLevelNameOnEachMarkerChanged(int);
- void onInitialLoadTlvCachingBehaviorChanged(int index);
- void onViewerZoomCenterChanged(int index);
- void onRemoveSceneNumberFromLoadedLevelNameChanged(int index);
- void onShowRasterImageDarkenBlendedInViewerChanged(int index);
- void onShowFrameNumberWithLettersChanged(int index);
- void onShowKeyframesOnCellAreaChanged(bool);
- void onFfmpegPathChanged();
- void onFfmpegTimeoutChanged();
- void onFastRenderPathChanged();
- void onUseNumpadForSwitchingStylesClicked(bool);
- void onShowXSheetToolbarClicked(bool);
- void onSyncLevelRenumberWithXsheetChanged(int);
- void onExpandFunctionHeaderClicked(bool);
- void onShowColumnNumbersChanged(int);
- void onUseArrowKeyToShiftCellSelectionClicked(int);
- void onInputCellsWithoutDoubleClickingClicked(int);
- void onShortcutCommandsWhileRenamingCellClicked(int);
- void onWatchFileSystemClicked(int);
- void onInterfaceFontChanged(int index);
- void onInterfaceFontStyleChanged(int index);
- void onXsheetLayoutChanged(int index);
- void onPathAliasPriorityChanged(int index);
- void onShowCurrentTimelineChanged(int);
- void onColorCalibrationChanged(bool);
- void onLutPathChanged();
- void onCheckLatestVersionChanged(bool);
- void onEnableAutoStretch(int index);
- void onCursorBrushTypeChanged(int index);
- void onCursorBrushStyleChanged(int index);
- void onCursorOutlineChanged(int);
- void onCurrentColumnDataChanged(const TPixel32 &, bool isDragging);
- void onEnableTouchGesturesChanged(int index);
- void onEnableTouchGesturesTriggered(bool checked);
- void onEnableWinInkChanged(int index);
- void onRasterBackgroundColorChanged(const TPixel32 &, bool isDragging);
- void onBackupKeepCountChanged();
- void onShowXsheetCameraColumnChanged(int index);
- void onLevelBasedToolsDisplayChanged(int);
};
//**********************************************************************************
@@ -239,17 +172,17 @@ class PreferencesPopup::FormatProperties final : public DVGui::Dialog {
Q_OBJECT
public:
- FormatProperties(PreferencesPopup *parent);
+ FormatProperties(PreferencesPopup* parent);
- void setLevelFormat(const Preferences::LevelFormat &lf);
+ void setLevelFormat(const Preferences::LevelFormat& lf);
Preferences::LevelFormat levelFormat() const;
private:
- QComboBox *m_dpiPolicy;
+ QComboBox* m_dpiPolicy;
DVGui::LineEdit *m_name, *m_regExp;
- DVGui::DoubleLineEdit *m_dpi;
+ DVGui::DoubleLineEdit* m_dpi;
DVGui::IntLineEdit *m_priority, *m_subsampling, *m_antialias;
diff --git a/toonz/sources/toonz/sceneviewercontextmenu.cpp b/toonz/sources/toonz/sceneviewercontextmenu.cpp
index 5a6c703fe..97b3f47d4 100644
--- a/toonz/sources/toonz/sceneviewercontextmenu.cpp
+++ b/toonz/sources/toonz/sceneviewercontextmenu.cpp
@@ -50,9 +50,8 @@ SceneViewerContextMenu::SceneViewerContextMenu(SceneViewer *parent)
/*- サブカメラの消去 -*/
if (parent->isEditPreviewSubcamera()) {
action = addAction(tr("Reset Subcamera"));
- ret =
- ret &&
- parent->connect(action, SIGNAL(triggered()), SLOT(doDeleteSubCamera()));
+ ret = ret && parent->connect(action, SIGNAL(triggered()),
+ SLOT(doDeleteSubCamera()));
addSeparator();
}
@@ -69,9 +68,8 @@ SceneViewerContextMenu::SceneViewerContextMenu(SceneViewer *parent)
action =
commandManager->createAction(V_ShowHideFullScreen, this, !isFullScreen);
addAction(action);
- ret = ret &&
- parent->connect(action, SIGNAL(triggered()), fsWidget,
- SLOT(toggleFullScreen()));
+ ret = ret && parent->connect(action, SIGNAL(triggered()), fsWidget,
+ SLOT(toggleFullScreen()));
}
// swap compared
@@ -129,9 +127,8 @@ SceneViewerContextMenu::SceneViewerContextMenu(SceneViewer *parent)
// actual pixel size
action = commandManager->createAction(V_ActualPixelSize, this);
addAction(action);
- ret =
- ret &&
- parent->connect(action, SIGNAL(triggered()), SLOT(setActualPixelSize()));
+ ret = ret && parent->connect(action, SIGNAL(triggered()),
+ SLOT(setActualPixelSize()));
// onion skin
if (Preferences::instance()->isOnionSkinEnabled() &&
@@ -142,27 +139,23 @@ SceneViewerContextMenu::SceneViewerContextMenu(SceneViewer *parent)
action = guidedDrawingMenu->addAction(tr("Off"));
action->setCheckable(true);
action->setChecked(guidedDrawingStatus == 0);
- ret = ret &&
- parent->connect(action, SIGNAL(triggered()), this,
- SLOT(setGuidedDrawingOff()));
+ ret = ret && parent->connect(action, SIGNAL(triggered()), this,
+ SLOT(setGuidedDrawingOff()));
action = guidedDrawingMenu->addAction(tr("Closest Drawing"));
action->setCheckable(true);
action->setChecked(guidedDrawingStatus == 1);
- ret = ret &&
- parent->connect(action, SIGNAL(triggered()), this,
- SLOT(setGuidedDrawingClosest()));
+ ret = ret && parent->connect(action, SIGNAL(triggered()), this,
+ SLOT(setGuidedDrawingClosest()));
action = guidedDrawingMenu->addAction(tr("Farthest Drawing"));
action->setCheckable(true);
action->setChecked(guidedDrawingStatus == 2);
- ret = ret &&
- parent->connect(action, SIGNAL(triggered()), this,
- SLOT(setGuidedDrawingFarthest()));
+ ret = ret && parent->connect(action, SIGNAL(triggered()), this,
+ SLOT(setGuidedDrawingFarthest()));
action = guidedDrawingMenu->addAction(tr("All Drawings"));
action->setCheckable(true);
action->setChecked(guidedDrawingStatus == 3);
- ret = ret &&
- parent->connect(action, SIGNAL(triggered()), this,
- SLOT(setGuidedDrawingAll()));
+ ret = ret && parent->connect(action, SIGNAL(triggered()), this,
+ SLOT(setGuidedDrawingAll()));
// Zero Thick
if (!parent->isPreviewEnabled())
ZeroThickToggleGui::addZeroThickCommand(this);
@@ -178,25 +171,22 @@ SceneViewerContextMenu::SceneViewerContextMenu(SceneViewer *parent)
action = addAction(tr("Save Previewed Frames"));
action->setShortcut(QKeySequence(
CommandManager::instance()->getKeyFromId(MI_SavePreviewedFrames)));
- ret = ret &&
- parent->connect(action, SIGNAL(triggered()), this,
- SLOT(savePreviewedFrames()));
+ ret = ret && parent->connect(action, SIGNAL(triggered()), this,
+ SLOT(savePreviewedFrames()));
// regenerate preview
action = addAction(tr("Regenerate Preview"));
action->setShortcut(QKeySequence(
CommandManager::instance()->getKeyFromId(MI_RegeneratePreview)));
- ret =
- ret &&
- parent->connect(action, SIGNAL(triggered()), SLOT(regeneratePreview()));
+ ret = ret && parent->connect(action, SIGNAL(triggered()),
+ SLOT(regeneratePreview()));
// regenerate frame preview
action = addAction(tr("Regenerate Frame Preview"));
action->setShortcut(QKeySequence(
CommandManager::instance()->getKeyFromId(MI_RegenerateFramePr)));
- ret = ret &&
- parent->connect(action, SIGNAL(triggered()),
- SLOT(regeneratePreviewFrame()));
+ ret = ret && parent->connect(action, SIGNAL(triggered()),
+ SLOT(regeneratePreviewFrame()));
}
assert(ret);
@@ -250,9 +240,9 @@ void SceneViewerContextMenu::addSelectCommand(QMenu *menu,
TXsheet *xsh = TApp::instance()->getCurrentXsheet()->getXsheet();
TStageObject *stageObject = xsh->getStageObject(id);
if (!stageObject) return;
- QString text = (id.isTable()) ? tr("Table") : getName(stageObject);
+ QString text = (id.isTable()) ? tr("Table") : getName(stageObject);
if (menu == this) text = tr("Select %1").arg(text);
- QAction *action = new QAction(text, this);
+ QAction *action = new QAction(text, this);
action->setData(id.getCode());
connect(action, SIGNAL(triggered()), this, SLOT(onSetCurrent()));
menu->addAction(action);
@@ -377,22 +367,22 @@ void SceneViewerContextMenu::onSetCurrent() {
//-----------------------------------------------------------------------------
void SceneViewerContextMenu::setGuidedDrawingOff() {
- Preferences::instance()->setGuidedDrawing(0);
+ Preferences::instance()->setValue(guidedDrawingType, 0);
}
//-----------------------------------------------------------------------------
void SceneViewerContextMenu::setGuidedDrawingClosest() {
- Preferences::instance()->setGuidedDrawing(1);
+ Preferences::instance()->setValue(guidedDrawingType, 1);
}
//-----------------------------------------------------------------------------
void SceneViewerContextMenu::setGuidedDrawingFarthest() {
- Preferences::instance()->setGuidedDrawing(2);
+ Preferences::instance()->setValue(guidedDrawingType, 2);
}
//-----------------------------------------------------------------------------
void SceneViewerContextMenu::setGuidedDrawingAll() {
- Preferences::instance()->setGuidedDrawing(3);
+ Preferences::instance()->setValue(guidedDrawingType, 3);
}
//-----------------------------------------------------------------------------
@@ -414,7 +404,7 @@ public:
}
static void enableZeroThick(bool enable = true) {
- Preferences::instance()->setShow0ThickLines(enable);
+ Preferences::instance()->setValue(show0ThickLines, enable);
TApp::instance()->getCurrentScene()->notifySceneChanged();
}
} ZeroThickToggle;
@@ -453,7 +443,7 @@ public:
}
static void enableCursorOutline(bool enable = true) {
- Preferences::instance()->enableCursorOutline(enable);
+ Preferences::instance()->setValue(cursorOutlineEnabled, enable);
}
} CursorOutlineToggle;
diff --git a/toonz/sources/toonz/shortcutpopup.cpp b/toonz/sources/toonz/shortcutpopup.cpp
index a44c2ee2f..a808b91bc 100644
--- a/toonz/sources/toonz/shortcutpopup.cpp
+++ b/toonz/sources/toonz/shortcutpopup.cpp
@@ -786,7 +786,7 @@ void ShortcutPopup::showEvent(QShowEvent *se) { getCurrentPresetPref(); }
//-----------------------------------------------------------------------------
void ShortcutPopup::setCurrentPresetPref(QString name) {
- Preferences::instance()->setShortcutPreset(name.toStdString());
+ Preferences::instance()->setValue(shortcutPreset, name);
getCurrentPresetPref();
}
diff --git a/toonz/sources/toonz/startuppopup.cpp b/toonz/sources/toonz/startuppopup.cpp
index a965ea75d..f80d4d923 100644
--- a/toonz/sources/toonz/startuppopup.cpp
+++ b/toonz/sources/toonz/startuppopup.cpp
@@ -923,13 +923,18 @@ void StartupPopup::onRecentSceneClicked(int index) {
void StartupPopup::onCameraUnitChanged(int index) {
Preferences *pref = Preferences::instance();
QStringList type;
- type << tr("pixel") << tr("cm") << tr("mm") << tr("inch") << tr("field");
+ // preference value should not be translated
+ type << "pixel"
+ << "cm"
+ << "mm"
+ << "inch"
+ << "field";
double width = m_widthFld->getValue();
double height = m_heightFld->getValue();
if (index != 0) {
- pref->setPixelsOnly(false);
- pref->setCameraUnits(type[index].toStdString());
+ pref->setValue(pixelsOnly, false);
+ pref->setValue(cameraUnits, type[index]);
m_widthFld->setDecimals(4);
m_heightFld->setDecimals(4);
m_resTextLabel->show();
@@ -943,9 +948,9 @@ void StartupPopup::onCameraUnitChanged(int index) {
m_widthFld->setValue(width);
m_heightFld->setValue(height);
} else {
- pref->setPixelsOnly(true);
- pref->setUnits("pixel");
- pref->setCameraUnits("pixel");
+ pref->setValue(pixelsOnly, true);
+ pref->setValue(linearUnits, "pixel");
+ pref->setValue(cameraUnits, "pixel");
m_widthFld->setDecimals(0);
m_heightFld->setDecimals(0);
m_resTextLabel->hide();
@@ -965,20 +970,21 @@ void StartupPopup::onCameraUnitChanged(int index) {
//-----------------------------------------------------------------------------
void StartupPopup::onShowAtStartChanged(int index) {
- Preferences::instance()->enableStartupPopup(index);
+ Preferences::instance()->setValue(startupPopupEnabled, index == Qt::Checked);
}
//-----------------------------------------------------------------------------
void StartupPopup::onAutoSaveOnChanged(int index) {
- Preferences::instance()->enableAutosave(index);
+ Preferences::instance()->setValue(autosaveEnabled, index == Qt::Checked);
m_autoSaveTimeFld->setEnabled(index);
}
//-----------------------------------------------------------------------------
void StartupPopup::onAutoSaveTimeChanged() {
- Preferences::instance()->setAutosavePeriod(m_autoSaveTimeFld->getValue());
+ Preferences::instance()->setValue(autosavePeriod,
+ m_autoSaveTimeFld->getValue());
}
//-----------------------------------------------------------------------------
diff --git a/toonz/sources/toonz/xsheetcmd.cpp b/toonz/sources/toonz/xsheetcmd.cpp
index 2c4c2570a..7f29ef76a 100644
--- a/toonz/sources/toonz/xsheetcmd.cpp
+++ b/toonz/sources/toonz/xsheetcmd.cpp
@@ -218,8 +218,8 @@ public:
void execute() override {
bool currentTimeIndEnabled =
Preferences::instance()->isCurrentTimelineIndicatorEnabled();
- Preferences::instance()->enableCurrentTimelineIndicator(
- !currentTimeIndEnabled);
+ Preferences::instance()->setValue(currentTimelineEnabled,
+ !currentTimeIndEnabled);
}
} toggleCurrentTimeIndicatorComman;
@@ -803,19 +803,17 @@ bool DrawingSubtitutionUndo::changeDrawing(int delta, int row, int col) {
bool usePrevCell = false;
if (cell.isEmpty()) {
TXshCell prevCell = xsh->getCell(row - 1, col);
- if (prevCell.isEmpty() ||
- !(prevCell.m_level->getSimpleLevel() ||
- prevCell.m_level->getChildLevel() ||
- prevCell.m_level->getSoundTextLevel()))
+ if (prevCell.isEmpty() || !(prevCell.m_level->getSimpleLevel() ||
+ prevCell.m_level->getChildLevel() ||
+ prevCell.m_level->getSoundTextLevel()))
return false;
cell = prevCell;
usePrevCell = true;
- } else if (!cell.m_level ||
- !(cell.m_level->getSimpleLevel() ||
- cell.m_level->getChildLevel() ||
- cell.m_level->getSoundTextLevel()))
+ } else if (!cell.m_level || !(cell.m_level->getSimpleLevel() ||
+ cell.m_level->getChildLevel() ||
+ cell.m_level->getSoundTextLevel()))
return false;
- TXshLevel *level = cell.m_level->getSimpleLevel();
+ TXshLevel *level = cell.m_level->getSimpleLevel();
if (!level) level = cell.m_level->getChildLevel();
if (!level) level = cell.m_level->getSoundTextLevel();
@@ -893,7 +891,7 @@ static void drawingSubstituion(int dir) {
TCellSelection::Range range;
bool selected = false;
if (selection) {
- range = selection->getSelectedCells();
+ range = selection->getSelectedCells();
if (!(range.isEmpty())) selected = true;
}
int row = TTool::getApplication()->getCurrentFrame()->getFrame();
@@ -912,7 +910,7 @@ static void drawingSubstituionGroup(int dir) {
TCellSelection::Range range;
bool selected = false;
if (selection) {
- range = selection->getSelectedCells();
+ range = selection->getSelectedCells();
if (!(range.isEmpty())) selected = true;
}
int row = TTool::getApplication()->getCurrentFrame()->getFrame();
@@ -1101,7 +1099,7 @@ public:
if (col == -1 && Preferences::instance()->isXsheetCameraColumnVisible())
objectId = TStageObjectId::CameraId(xsh->getCameraColumnIndex());
else
- objectId = TStageObjectId::ColumnId(col);
+ objectId = TStageObjectId::ColumnId(col);
TStageObject *pegbar = xsh->getStageObject(objectId);
if (pegbar->isKeyframe(row)) selection->select(row, col);
}
@@ -1163,7 +1161,7 @@ public:
if (col == -1 && Preferences::instance()->isXsheetCameraColumnVisible())
objectId = TStageObjectId::CameraId(xsh->getCameraColumnIndex());
else
- objectId = TStageObjectId::ColumnId(col);
+ objectId = TStageObjectId::ColumnId(col);
TStageObject *pegbar = xsh->getStageObject(objectId);
TStageObject::KeyframeMap keyframes;
pegbar->getKeyframes(keyframes);
@@ -1200,7 +1198,7 @@ public:
if (col == -1 && Preferences::instance()->isXsheetCameraColumnVisible())
objectId = TStageObjectId::CameraId(xsh->getCameraColumnIndex());
else
- objectId = TStageObjectId::ColumnId(col);
+ objectId = TStageObjectId::ColumnId(col);
TStageObject *pegbar = xsh->getStageObject(objectId);
TStageObject::KeyframeMap keyframes;
pegbar->getKeyframes(keyframes);
@@ -1239,7 +1237,7 @@ public:
if (col == -1 && Preferences::instance()->isXsheetCameraColumnVisible())
objectId = TStageObjectId::CameraId(xsh->getCameraColumnIndex());
else
- objectId = TStageObjectId::ColumnId(col);
+ objectId = TStageObjectId::ColumnId(col);
TStageObject *pegbar = xsh->getStageObject(objectId);
TStageObject::KeyframeMap keyframes;
pegbar->getKeyframes(keyframes);
@@ -1278,7 +1276,7 @@ public:
TApp::instance()->getCurrentObject()->getObjectId();
if (objectId == TStageObjectId::CameraId(xsh->getCameraColumnIndex()) &&
Preferences::instance()->isXsheetCameraColumnVisible())
- currentColumn = -1;
+ currentColumn = -1;
TStageObject *pegbar = xsh->getStageObject(objectId);
TStageObject::KeyframeMap keyframes;
pegbar->getKeyframes(keyframes);
@@ -1315,7 +1313,7 @@ public:
TApp::instance()->getCurrentObject()->getObjectId();
if (objectId == TStageObjectId::CameraId(xsh->getCameraColumnIndex()) &&
Preferences::instance()->isXsheetCameraColumnVisible())
- currentColumn = -1;
+ currentColumn = -1;
TStageObject *pegbar = xsh->getStageObject(objectId);
TStageObject::KeyframeMap keyframes;
pegbar->getKeyframes(keyframes);
@@ -1354,7 +1352,7 @@ public:
if (col == -1 && Preferences::instance()->isXsheetCameraColumnVisible())
objectId = TStageObjectId::CameraId(xsh->getCameraColumnIndex());
else
- objectId = TStageObjectId::ColumnId(col);
+ objectId = TStageObjectId::ColumnId(col);
TStageObject *pegbar = xsh->getStageObject(objectId);
TStageObject::KeyframeMap keyframes;
pegbar->getKeyframes(keyframes);
@@ -1402,7 +1400,7 @@ public:
if (col == -1)
objectId = TStageObjectId::CameraId(xsh->getCameraColumnIndex());
else
- objectId = TStageObjectId::ColumnId(col);
+ objectId = TStageObjectId::ColumnId(col);
TStageObject *pegbar = xsh->getStageObject(objectId);
TStageObject::KeyframeMap keyframes;
pegbar->getKeyframes(keyframes);
@@ -1439,7 +1437,7 @@ public:
if (col == -1 && Preferences::instance()->isXsheetCameraColumnVisible())
objectId = TStageObjectId::CameraId(xsh->getCameraColumnIndex());
else
- objectId = TStageObjectId::ColumnId(col);
+ objectId = TStageObjectId::ColumnId(col);
TStageObject *pegbar = xsh->getStageObject(objectId);
TStageObject::KeyframeMap keyframes;
pegbar->getKeyframes(keyframes);
@@ -1789,9 +1787,9 @@ void readParameters() {
while (is.matchTag(tagName)) {
if (tagName == "page") {
std::string s;
- s = is.getTagAttribute("rows");
- if (s != "" && isInt(s)) rowsPerPage = std::stoi(s);
- s = is.getTagAttribute("columns");
+ s = is.getTagAttribute("rows");
+ if (s != "" && isInt(s)) rowsPerPage = std::stoi(s);
+ s = is.getTagAttribute("columns");
if (s != "" && isInt(s)) columnsPerPage = std::stoi(s);
} else if (tagName == "info") {
std::string name = is.getTagAttribute("name");
@@ -1947,7 +1945,7 @@ void XsheetWriter::numericColumnHeader(ostream &os, int c) {
void XsheetWriter::cell(ostream &os, int r, int c) {
TXshCell prevCell;
if (r > 0) prevCell = m_xsh->getCell(r - 1, c);
- TXshCell cell = m_xsh->getCell(r, c);
+ TXshCell cell = m_xsh->getCell(r, c);
if (cell.isEmpty())
os << "<td class='emptycell'>&nbsp;</td>";
else {
@@ -1992,7 +1990,7 @@ void XsheetWriter::numericCell(ostream &os, int r, int c) {
TMeasure *measure = curve->getMeasure();
if (measure) {
const TUnit *unit = measure->getCurrentUnit();
- if (unit) v = unit->convertTo(v);
+ if (unit) v = unit->convertTo(v);
}
os << "<td class='" << (c > 0 ? "numeric" : "first_numeric") << "'>";
@@ -2148,7 +2146,8 @@ public:
return;
}
- pref->enableXsheetCameraColumn(!pref->isXsheetCameraColumnVisible());
+ pref->setValue(showXsheetCameraColumn,
+ !pref->isXsheetCameraColumnVisible());
TApp::instance()->getCurrentXsheet()->notifyXsheetChanged();
}
diff --git a/toonz/sources/toonz/xsheetdragtool.cpp b/toonz/sources/toonz/xsheetdragtool.cpp
index 9fd30a1c5..ea52e50a9 100644
--- a/toonz/sources/toonz/xsheetdragtool.cpp
+++ b/toonz/sources/toonz/xsheetdragtool.cpp
@@ -1696,7 +1696,6 @@ public:
col = 0;
else if (!getViewer()->orientation()->isVerticalTimeline() && col > currEnd)
col = currEnd;
-
int dCol = col - (m_lastCol - m_offset);
// ignore if the cursor moves in the drag-starting column
diff --git a/toonz/sources/toonz/xshtoolbar.cpp b/toonz/sources/toonz/xshtoolbar.cpp
index b56249e5a..d5b02164d 100644
--- a/toonz/sources/toonz/xshtoolbar.cpp
+++ b/toonz/sources/toonz/xshtoolbar.cpp
@@ -46,7 +46,7 @@ void XSheetToolbar::showToolbar(bool show) {
void XSheetToolbar::toggleXSheetToolbar() {
bool toolbarEnabled = Preferences::instance()->isShowXSheetToolbarEnabled();
- Preferences::instance()->enableShowXSheetToolbar(!toolbarEnabled);
+ Preferences::instance()->setValue(showXSheetToolbar, !toolbarEnabled);
TApp::instance()->getCurrentScene()->notifyPreferenceChanged("XSheetToolbar");
}
@@ -92,4 +92,4 @@ public:
//============================================================
-} // namespace XsheetGUI;
+} // namespace XsheetGUI
diff --git a/toonz/sources/toonzlib/CMakeLists.txt b/toonz/sources/toonzlib/CMakeLists.txt
index ca5f21c54..56d6743ff 100644
--- a/toonz/sources/toonzlib/CMakeLists.txt
+++ b/toonz/sources/toonzlib/CMakeLists.txt
@@ -160,6 +160,7 @@ set(HEADERS
../include/toonz/txshzeraryfxlevel.h
../include/toonz/vectorizerparameters.h
../include/toutputproperties.h
+ ../include/toonz/preferencesitemids.h
)
set(SOURCES
diff --git a/toonz/sources/toonzlib/preferences.cpp b/toonz/sources/toonzlib/preferences.cpp
index 820da8180..4ede0ab6f 100644
--- a/toonz/sources/toonzlib/preferences.cpp
+++ b/toonz/sources/toonzlib/preferences.cpp
@@ -25,6 +25,7 @@
#include <QSettings>
#include <QStringList>
#include <QAction>
+#include <QColor>
// boost includes
#include <boost/bind.hpp>
@@ -40,11 +41,7 @@ typedef std::vector<LevelFormat> LevelFormatVector;
//-----------------------------------------------------------------
-const char *s_bool[2] = {"0", "1"};
-
-const char *s_show0ThickLines = "show0ThickLines",
- *s_regionAntialias = "regionAntialias",
- *s_levelFormats = "levelFormats";
+const char *s_levelFormats = "levelFormats";
const char *s_name = "name", *s_regexp = "regexp", *s_priority = "priority";
@@ -54,40 +51,32 @@ const char *s_dpiPolicy = "dpiPolicy", *s_dpi = "dpi",
//=================================================================
-inline void getValue(const QSettings &s, const QString &key, bool &ret) {
- QString val;
- val = s.value(key).toString();
- if (val != "") ret = (val.toInt() != 0);
+inline QString colorToString(const QColor &color) {
+ return QString("%1 %2 %3 %4")
+ .arg(color.red())
+ .arg(color.green())
+ .arg(color.blue())
+ .arg(color.alpha());
}
-//-----------------------------------------------------------------
-
-inline void getValue(const QSettings &s, const QString &key, int &ret) {
- QString val;
- val = s.value(key).toString();
- if (val != "") ret = val.toInt();
+inline QColor stringToColor(const QString &str) {
+ QStringList values = str.split(' ');
+ return QColor(values[0].toInt(), values[1].toInt(), values[2].toInt(),
+ values[3].toInt());
}
-//-----------------------------------------------------------------
-
-inline void getValue(const QSettings &s, const QString &key, double &ret) {
- QString val;
- val = s.value(key).toString();
- if (val != "") ret = val.toDouble();
+inline TPixel colorToTPixel(const QColor &color) {
+ return TPixel(color.red(), color.green(), color.blue(), color.alpha());
}
//-----------------------------------------------------------------
-inline void getValue(const QSettings &s, QString key, TPixel32 &ret) {
- QString val;
- val = s.value(QString(key).append("_R")).toString();
- if (val != "") ret.r = val.toInt();
- val = s.value(QString(key).append("_G")).toString();
- if (val != "") ret.g = val.toInt();
- val = s.value(QString(key).append("_B")).toString();
- if (val != "") ret.b = val.toInt();
- val = s.value(QString(key).append("_M")).toString();
- if (val != "") ret.m = val.toInt();
+static void setCurrentUnits(std::string measureName, std::string units) {
+ TMeasure *m = TMeasureManager::instance()->get(measureName);
+ if (!m) return;
+ TUnit *u = m->getUnit(::to_wstring(units));
+ if (!u) return;
+ m->setCurrentUnit(u);
}
//-----------------------------------------------------------------
@@ -172,7 +161,7 @@ void getValue(const QSettings &settings, LevelFormat &lf) {
//-----------------------------------------------------------------
-void setValue(QSettings &settings, const LevelFormatVector &lfv) {
+void _setValue(QSettings &settings, const LevelFormatVector &lfv) {
int lf, lfCount = int(lfv.size());
settings.remove(s_levelFormats);
@@ -219,150 +208,10 @@ bool Preferences::LevelFormat::matches(const TFilePath &fp) const {
// Preferences implementation
//**********************************************************************************
-Preferences::Preferences()
- : m_pixelsOnly(false)
- , m_units("mm")
- , m_cameraUnits("inch")
- , m_currentRoomChoice("Default")
- , m_scanLevelType("tif")
-#ifdef _WIN32
- , m_interfaceFont("Segoe UI")
-#elif defined Q_OS_MACOS
- , m_interfaceFont("Helvetica Neue")
-#else
- , m_interfaceFont("Helvetica")
-#endif
- , m_interfaceFontStyle("Regular")
- , m_interfaceFontWeight(0)
- , m_defLevelWidth(0.0)
- , m_defLevelHeight(0.0)
- , m_defLevelDpi(0.0)
- , m_iconSize(80, 45)
- , m_blankColor(TPixel32::White)
- , m_frontOnionColor(TPixel::Black)
- , m_backOnionColor(TPixel::Black)
- , m_transpCheckBg(TPixel::White)
- , m_transpCheckInk(TPixel::Black)
- , m_transpCheckPaint(TPixel(127, 127, 127))
- , m_autosavePeriod(15)
- , m_chunkSize(10)
- , m_rasterOptimizedMemory(0)
- , m_shrink(1)
- , m_step(1)
- , m_blanksCount(0)
- , m_keyframeType(2)
- , m_animationStep(1)
- , m_textureSize(0)
- , m_xsheetStep(10)
- , m_shmmax(-1)
- , m_shmseg(-1)
- , m_shmall(-1)
- , m_shmmni(-1)
- , m_onionPaperThickness(50)
- , m_currentLanguage("English")
- , m_currentStyleSheet("Default")
- , m_undoMemorySize(100)
- , m_dragCellsBehaviour(1)
- , m_lineTestFpsCapture(25)
- , m_defLevelType(0)
- , m_vectorSnappingTarget(SnapAll)
- , m_autocreationType(2)
- , m_autoExposeEnabled(true)
- , m_autoCreateEnabled(true)
- , m_subsceneFolderEnabled(true)
- , m_generatedMovieViewEnabled(true)
- , m_xsheetAutopanEnabled(true)
- , m_ignoreAlphaonColumn1Enabled(false)
- , m_rewindAfterPlaybackEnabled(true)
- , m_fitToFlipbookEnabled(false)
- , m_previewAlwaysOpenNewFlipEnabled(false)
- , m_autosaveEnabled(false)
- , m_autosaveSceneEnabled(true)
- , m_autosaveOtherFilesEnabled(true)
- , m_startupPopupEnabled(true)
- , m_defaultViewerEnabled(false)
- , m_saveUnpaintedInCleanup(true)
- , m_askForOverrideRender(true)
- , m_automaticSVNFolderRefreshEnabled(true)
- , m_SVNEnabled(false)
- , m_minimizeSaveboxAfterEditing(true)
- , m_backupEnabled(true)
- , m_sceneNumberingEnabled(false)
- , m_animationSheetEnabled(false)
- , m_inksOnly(false)
- , m_fillOnlySavebox(false)
- , m_show0ThickLines(true)
- , m_regionAntialias(false)
- , m_keepFillOnVectorSimplify(true)
- , m_useHigherDpiOnVectorSimplify(false)
- , m_downArrowInLevelStripCreatesNewFrame(true)
- , m_viewerBGColor(128, 128, 128, 255)
- , m_previewBGColor(64, 64, 64, 255)
- , m_levelEditorBoxColor(128, 128, 128, 255)
- , m_chessboardColor1(180, 180, 180)
- , m_chessboardColor2(230, 230, 230)
- , m_showRasterImagesDarkenBlendedInViewer(false)
- , m_actualPixelViewOnSceneEditingMode(false)
- , m_viewerZoomCenter(0)
- , m_initialLoadTlvCachingBehavior(0)
- , m_removeSceneNumberFromLoadedLevelName(false)
- , m_replaceAfterSaveLevelAs(true)
- , m_showFrameNumberWithLetters(false)
- , m_levelNameOnEachMarker(false)
- , m_columnIconLoadingPolicy((int)LoadAtOnce)
- , m_moveCurrentFrameByClickCellArea(true)
- , m_onionSkinEnabled(true)
- , m_onionSkinDuringPlayback(false)
- , m_dropdownShortcutsCycleOptions(true)
- , m_multiLayerStylePickerEnabled(false)
- , m_showKeyframesOnXsheetCellArea(true)
- , m_projectRoot(0x08)
- , m_customProjectRoot("")
- , m_precompute(true)
- , m_fastRenderPath("desktop")
- , m_ffmpegTimeout(600)
- , m_shortcutPreset("defopentoonz")
- , m_useNumpadForSwitchingStyles(true)
- , m_newLevelSizeToCameraSizeEnabled(false)
- , m_showXSheetToolbar(true)
- , m_syncLevelRenumberWithXsheet(true)
- , m_expandFunctionHeader(false)
- , m_showColumnNumbers(false)
- , m_useArrowKeyToShiftCellSelection(true)
- , m_inputCellsWithoutDoubleClickingEnabled(false)
- , m_importPolicy(0)
- , m_guidedDrawingType(0)
- , m_animatedGuidedDrawing(false)
- , m_ignoreImageDpi(false)
- , m_watchFileSystem(true)
- , m_shortcutCommandsWhileRenamingCellEnabled(false)
- , m_xsheetLayoutPreference("Classic-revised")
- , m_loadedXsheetLayout("Classic-revised")
- , m_pathAliasPriority(ProjectFolderOnly)
- , m_functionEditorToggle(ShowGraphEditorInPopup)
- , m_currentTimelineEnabled(true)
- , m_enableAutoStretch(true)
- , m_cursorBrushType("Small")
- , m_cursorBrushStyle("Default")
- , m_cursorOutlineEnabled(true)
- , m_currentColumnColor(TPixel::Black)
- , m_enableWinInk(false)
- , m_useOnionColorsForShiftAndTraceGhosts(true)
- , m_rasterBackgroundColor(TPixel::White)
- , m_backupKeepCount(1)
- , m_showXsheetCameraColumn(true)
- , m_levelBasedToolsDisplay(0) {
- TCamera camera;
- m_defLevelType = TZP_XSHLEVEL;
- m_defLevelWidth = camera.getSize().lx;
- m_defLevelHeight = camera.getSize().ly;
- m_defLevelDpi = camera.getDpi().x;
-
+Preferences::Preferences() {
+ // load preference file
TFilePath layoutDir = ToonzFolder::getMyModuleDir();
TFilePath prefPath = layoutDir + TFilePath("preferences.ini");
-
- bool existingUser = true;
-
// In case the personal settings is not exist (for new users)
if (!TFileStatus(prefPath).doesExist()) {
TFilePath templatePath =
@@ -370,136 +219,17 @@ Preferences::Preferences()
// If there is the template, copy it to the personal one
if (TFileStatus(templatePath).doesExist())
TSystem::copyFile(prefPath, templatePath);
-
- existingUser = false;
}
-
m_settings.reset(new QSettings(
QString::fromStdWString(prefPath.getWideString()), QSettings::IniFormat));
- getValue(*m_settings, "autoExposeEnabled", m_autoExposeEnabled);
- getValue(*m_settings, "autoCreateEnabled", m_autoCreateEnabled);
- getValue(*m_settings, "subsceneFolderEnabled", m_subsceneFolderEnabled);
- getValue(*m_settings, "generatedMovieViewEnabled",
- m_generatedMovieViewEnabled);
- getValue(*m_settings, "xsheetAutopanEnabled", m_xsheetAutopanEnabled);
- getValue(*m_settings, "ignoreAlphaonColumn1Enabled",
- m_ignoreAlphaonColumn1Enabled);
- getValue(*m_settings, "rewindAfterPlayback", m_rewindAfterPlaybackEnabled);
- getValue(*m_settings, "previewAlwaysOpenNewFlip",
- m_previewAlwaysOpenNewFlipEnabled);
- getValue(*m_settings, "fitToFlipbook", m_fitToFlipbookEnabled);
- getValue(*m_settings, "automaticSVNFolderRefreshEnabled",
- m_automaticSVNFolderRefreshEnabled);
- getValue(*m_settings, "SVNEnabled", m_SVNEnabled);
- getValue(*m_settings, "minimizeSaveboxAfterEditing",
- m_minimizeSaveboxAfterEditing);
- getValue(*m_settings, "backupEnabled", m_backupEnabled);
- getValue(*m_settings, "backupKeepCount", m_backupKeepCount);
- getValue(*m_settings, "sceneNumberingEnabled", m_sceneNumberingEnabled);
- getValue(*m_settings, "animationSheetEnabled", m_animationSheetEnabled);
- getValue(*m_settings, "autosaveEnabled", m_autosaveEnabled);
- getValue(*m_settings, "autosaveSceneEnabled", m_autosaveSceneEnabled);
- getValue(*m_settings, "autosaveOtherFilesEnabled",
- m_autosaveOtherFilesEnabled);
- getValue(*m_settings, "startupPopupEnabled", m_startupPopupEnabled);
- getValue(*m_settings, "dropdownShortcutsCycleOptions",
- m_dropdownShortcutsCycleOptions);
- getValue(*m_settings, "defaultViewerEnabled", m_defaultViewerEnabled);
- getValue(*m_settings, "rasterOptimizedMemory", m_rasterOptimizedMemory);
- getValue(*m_settings, "saveUnpaintedInCleanup", m_saveUnpaintedInCleanup);
- getValue(*m_settings, "autosavePeriod", m_autosavePeriod);
- getValue(*m_settings, "taskchunksize", m_chunkSize);
- getValue(*m_settings, "xsheetStep", m_xsheetStep);
- getValue(*m_settings, "vectorSnappingTarget", m_vectorSnappingTarget);
- int r = 0, g = 255, b = 0;
- getValue(*m_settings, "frontOnionColor.r", r);
- getValue(*m_settings, "frontOnionColor.g", g);
- getValue(*m_settings, "frontOnionColor.b", b);
- m_frontOnionColor = TPixel32(r, g, b);
-
- getValue(*m_settings, "onionPaperThickness", m_onionPaperThickness);
-
- r = 255, g = 0, b = 0;
- getValue(*m_settings, "backOnionColor.r", r);
- getValue(*m_settings, "backOnionColor.g", g);
- getValue(*m_settings, "backOnionColor.b", b);
- m_backOnionColor = TPixel32(r, g, b);
-
- r = m_transpCheckBg.r, g = m_transpCheckBg.g, b = m_transpCheckBg.b;
- getValue(*m_settings, "transpCheckInkOnBlack.r", r);
- getValue(*m_settings, "transpCheckInkOnBlack.g", g);
- getValue(*m_settings, "transpCheckInkOnBlack.b", b);
- m_transpCheckBg = TPixel32(r, g, b);
-
- r = m_transpCheckInk.r, g = m_transpCheckInk.g, b = m_transpCheckInk.b;
- getValue(*m_settings, "transpCheckInkOnWhite.r", r);
- getValue(*m_settings, "transpCheckInkOnWhite.g", g);
- getValue(*m_settings, "transpCheckInkOnWhite.b", b);
- m_transpCheckInk = TPixel32(r, g, b);
- r = m_transpCheckPaint.r, g = m_transpCheckPaint.g, b = m_transpCheckPaint.b;
- getValue(*m_settings, "transpCheckPaint.r", r);
- getValue(*m_settings, "transpCheckPaint.g", g);
- getValue(*m_settings, "transpCheckPaint.b", b);
- m_transpCheckPaint = TPixel32(r, g, b);
-
- getValue(*m_settings, "onionInksOnly", m_inksOnly);
- getValue(*m_settings, "iconSizeX", m_iconSize.lx);
- getValue(*m_settings, "iconSizeY", m_iconSize.ly);
- getValue(*m_settings, s_show0ThickLines, m_show0ThickLines);
- getValue(*m_settings, s_regionAntialias, m_regionAntialias);
- getValue(*m_settings, "viewShrink", m_shrink);
- getValue(*m_settings, "viewStep", m_step);
- getValue(*m_settings, "blanksCount", m_blanksCount);
- getValue(*m_settings, "askForOverrideRender", m_askForOverrideRender);
- r = 255, g = 255, b = 255;
- getValue(*m_settings, "blankColor.r", r);
- getValue(*m_settings, "blankColor.g", g);
- getValue(*m_settings, "blankColor.b", b);
- getValue(*m_settings, "undoMemorySize", m_undoMemorySize);
- setUndoMemorySize(m_undoMemorySize);
- m_blankColor = TPixel32(r, g, b);
-
- // for Pixels only
-
- getValue(*m_settings, "pixelsOnly",
- m_pixelsOnly); // doesn't work for some reason.
- QString pos = m_settings->value("pixelsOnly").toString();
- if (pos == "true") m_pixelsOnly = true;
-
- QString units;
- units = m_settings->value("oldUnits", m_units).toString();
- m_oldUnits = units;
-
- units = m_settings->value("oldCameraUnits", m_cameraUnits).toString();
- m_oldCameraUnits = units;
- // end for pixels only
-
- getValue(*m_settings, "projectRoot", m_projectRoot);
- m_customProjectRoot = m_settings->value("customProjectRoot").toString();
-
- units = m_settings->value("linearUnits").toString();
- if (units != "") m_units = units;
- setUnits(m_units.toStdString());
-
- units = m_settings->value("cameraUnits").toString();
- if (units != "") m_cameraUnits = units;
- setCameraUnits(m_cameraUnits.toStdString());
-
- getValue(*m_settings, "keyframeType", m_keyframeType);
-
- getValue(*m_settings, "animationStep", m_animationStep);
-
- getValue(*m_settings, "textureSize", m_textureSize);
- QString scanLevelType;
- scanLevelType = m_settings->value("scanLevelType").toString();
- if (scanLevelType != "") m_scanLevelType = scanLevelType;
- setScanLevelType(m_scanLevelType.toStdString());
-
- getValue(*m_settings, "shmmax", m_shmmax);
- getValue(*m_settings, "shmseg", m_shmseg);
- getValue(*m_settings, "shmall", m_shmall);
- getValue(*m_settings, "shmmni", m_shmmni);
+ initializeOptions();
+
+ definePreferenceItems();
+
+ // initialize environment based on loaded preferences
+ setUnits();
+ setCameraUnits();
// Load level formats
getDefaultLevelFormats(m_levelFormats);
@@ -508,6 +238,37 @@ Preferences::Preferences()
m_levelFormats.end(), // Format sorting must be
formatLess); // enforced
+ if (m_roomMaps.key(getStringValue(CurrentRoomChoice), -1) == -1) {
+ assert(!m_roomMaps.isEmpty());
+ setValue(CurrentRoomChoice, m_roomMaps[0]);
+ }
+
+ if (!m_styleSheetList.contains(getStringValue(CurrentStyleSheetName)))
+ setValue(CurrentStyleSheetName, "Default");
+
+ if (!m_languageList.contains(getStringValue(CurrentLanguageName)))
+ setValue(CurrentLanguageName, "English");
+
+ TImageWriter::setBackgroundColor(getColorValue(rasterBackgroundColor));
+}
+
+//-----------------------------------------------------------------
+
+Preferences::~Preferences() {
+ // DO NOT REMOVE
+}
+
+//-----------------------------------------------------------------
+
+Preferences *Preferences::instance() {
+ static Preferences _instance;
+ return &_instance;
+}
+
+//-----------------------------------------------------------------
+// load and initialize options for languages, styles and rooms
+
+void Preferences::initializeOptions() {
// load languages
TFilePath lang_path = TEnv::getConfigDir() + "loc";
TFilePathSet lang_fpset;
@@ -548,10 +309,6 @@ Preferences::Preferences()
}
// load rooms or layouts
- QString rooms;
- bool roomsExist = false;
- rooms = m_settings->value("CurrentRoomChoice").toString();
-
TFilePath room_path(ToonzFolder::getRoomsDir());
TFilePathSet room_fpset;
try {
@@ -563,351 +320,464 @@ Preferences::Preferences()
if (newPath == room_path) continue;
if (TFileStatus(newPath).isDirectory()) {
QString string = QString::fromStdWString(newPath.getWideName());
- if (string == rooms) roomsExist = true;
- m_roomMaps[i] = string;
+ m_roomMaps[i] = string;
i++;
}
}
} catch (...) {
}
- // make sure the selected rooms exists
- if (rooms != "" && roomsExist) {
- m_currentRoomChoice = rooms;
- setCurrentRoomChoice(rooms);
- }
- // or set the selected rooms to the first ones in the folder
- else {
- m_currentRoomChoice = m_roomMaps[0];
- setCurrentRoomChoice(0);
- }
-
- QString currentLanguage;
- currentLanguage = m_settings->value("CurrentLanguageName").toString();
- if (!currentLanguage.isEmpty() && m_languageList.contains(currentLanguage))
- m_currentLanguage = currentLanguage;
- QString currentStyleSheet;
- currentStyleSheet = m_settings->value("CurrentStyleSheetName").toString();
- if (!currentStyleSheet.isEmpty() &&
- m_styleSheetList.contains(currentStyleSheet))
- m_currentStyleSheet = currentStyleSheet;
- getValue(*m_settings, "useHigherDpiOnVectorSimplify",
- m_useHigherDpiOnVectorSimplify);
- getValue(*m_settings, "keepFillOnVectorSimplify", m_keepFillOnVectorSimplify);
- getValue(*m_settings, "downArrowInLevelStripCreatesNewFrame",
- m_downArrowInLevelStripCreatesNewFrame);
- getValue(*m_settings, "DragCellsBehaviour", m_dragCellsBehaviour);
-
- getValue(*m_settings, "LineTestFpsCapture", m_lineTestFpsCapture);
- getValue(*m_settings, "FillOnlysavebox", m_fillOnlySavebox);
- getValue(*m_settings, "AutocreationType", m_autocreationType);
- getValue(*m_settings, "DefLevelType", m_defLevelType);
- getValue(*m_settings, "DefLevelWidth", m_defLevelWidth);
- getValue(*m_settings, "DefLevelHeight", m_defLevelHeight);
- getValue(*m_settings, "DefLevelDpi", m_defLevelDpi);
- getValue(*m_settings, "IgnoreImageDpi", m_ignoreImageDpi);
- getValue(*m_settings, "viewerBGColor", m_viewerBGColor);
- getValue(*m_settings, "previewBGColor", m_previewBGColor);
- getValue(*m_settings, "levelEditorBoxColor", m_levelEditorBoxColor);
- getValue(*m_settings, "chessboardColor1", m_chessboardColor1);
- getValue(*m_settings, "chessboardColor2", m_chessboardColor2);
- getValue(*m_settings, "showRasterImagesDarkenBlendedInViewer",
- m_showRasterImagesDarkenBlendedInViewer);
- getValue(*m_settings, "actualPixelViewOnSceneEditingMode",
- m_actualPixelViewOnSceneEditingMode);
- getValue(*m_settings, "viewerZoomCenter", m_viewerZoomCenter);
- getValue(*m_settings, "initialLoadTlvCachingBehavior",
- m_initialLoadTlvCachingBehavior);
- getValue(*m_settings, "removeSceneNumberFromLoadedLevelName",
- m_removeSceneNumberFromLoadedLevelName);
- getValue(*m_settings, "replaceAfterSaveLevelAs", m_replaceAfterSaveLevelAs);
- getValue(*m_settings, "showFrameNumberWithLetters",
- m_showFrameNumberWithLetters);
- getValue(*m_settings, "levelNameOnEachMarkerEnabled",
- m_levelNameOnEachMarker);
- getValue(*m_settings, "columnIconLoadingPolicy", m_columnIconLoadingPolicy);
- getValue(*m_settings, "moveCurrentFrameByClickCellArea",
- m_moveCurrentFrameByClickCellArea);
- getValue(*m_settings, "onionSkinEnabled", m_onionSkinEnabled);
- getValue(*m_settings, "onionSkinDuringPlayback", m_onionSkinDuringPlayback);
- getValue(*m_settings, "useOnionColorsForShiftAndTraceGhosts",
- m_useOnionColorsForShiftAndTraceGhosts);
- getValue(*m_settings, "multiLayerStylePickerEnabled",
- m_multiLayerStylePickerEnabled);
- getValue(*m_settings, "showKeyframesOnXsheetCellArea",
- m_showKeyframesOnXsheetCellArea);
- QString ffmpegPath = m_settings->value("ffmpegPath").toString();
- if (ffmpegPath != "") m_ffmpegPath = ffmpegPath;
- setFfmpegPath(m_ffmpegPath.toStdString());
- QString fastRenderPath = m_settings->value("fastRenderPath").toString();
- if (fastRenderPath != "") m_fastRenderPath = fastRenderPath;
- setFastRenderPath(m_fastRenderPath.toStdString());
- getValue(*m_settings, "ffmpegTimeout", m_ffmpegTimeout);
- QString shortcutPreset = m_settings->value("shortcutPreset").toString();
- if (shortcutPreset != "") m_shortcutPreset = shortcutPreset;
- setShortcutPreset(m_shortcutPreset.toStdString());
- QString interfaceFont = m_settings->value("interfaceFont").toString();
- if (interfaceFont != "") m_interfaceFont = interfaceFont;
- setInterfaceFont(m_interfaceFont.toStdString());
- QString interfaceFontStyle =
- m_settings->value("interfaceFontStyle").toString();
- if (interfaceFontStyle != "") m_interfaceFontStyle = interfaceFontStyle;
- setInterfaceFontStyle(m_interfaceFontStyle.toStdString());
- getValue(*m_settings, "interfaceFontWeight", m_interfaceFontWeight);
- getValue(*m_settings, "useNumpadForSwitchingStyles",
- m_useNumpadForSwitchingStyles);
- getValue(*m_settings, "guidedDrawingType", m_guidedDrawingType);
- getValue(*m_settings, "animatedGuidedDrawing", m_animatedGuidedDrawing);
- getValue(*m_settings, "newLevelSizeToCameraSizeEnabled",
- m_newLevelSizeToCameraSizeEnabled);
- getValue(*m_settings, "showXSheetToolbar", m_showXSheetToolbar);
- getValue(*m_settings, "syncLevelRenumberWithXsheet",
- m_syncLevelRenumberWithXsheet);
- getValue(*m_settings, "expandFunctionHeader", m_expandFunctionHeader);
- getValue(*m_settings, "showColumnNumbers", m_showColumnNumbers);
- getValue(*m_settings, "useArrowKeyToShiftCellSelection",
- m_useArrowKeyToShiftCellSelection);
- getValue(*m_settings, "inputCellsWithoutDoubleClickingEnabled",
- m_inputCellsWithoutDoubleClickingEnabled);
- getValue(*m_settings, "importPolicy", m_importPolicy);
- getValue(*m_settings, "watchFileSystemEnabled", m_watchFileSystem);
- getValue(*m_settings, "shortcutCommandsWhileRenamingCellEnabled",
- m_shortcutCommandsWhileRenamingCellEnabled);
- int pathAliasPriority = static_cast<int>(m_pathAliasPriority);
- getValue(*m_settings, "pathAliasPriority", pathAliasPriority);
- m_pathAliasPriority = static_cast<PathAliasPriority>(pathAliasPriority);
-
- int functionEditorToggle = static_cast<int>(m_functionEditorToggle);
- getValue(*m_settings, "functionEditorToggle", functionEditorToggle);
- m_functionEditorToggle =
- static_cast<FunctionEditorToggle>(functionEditorToggle);
-
- QString xsheetLayoutPreference;
- xsheetLayoutPreference =
- m_settings->value("xsheetLayoutPreference").toString();
- if (xsheetLayoutPreference != "")
- m_xsheetLayoutPreference = xsheetLayoutPreference;
- else if (existingUser) // Existing users with missing preference defaults to
- // Classic. New users will be Classic-revised
- m_xsheetLayoutPreference = QString("Classic");
- setXsheetLayoutPreference(m_xsheetLayoutPreference.toStdString());
- m_loadedXsheetLayout = m_xsheetLayoutPreference;
-
- getValue(*m_settings, "currentTimelineEnabled", m_currentTimelineEnabled);
-
- getValue(*m_settings, "colorCalibrationEnabled", m_colorCalibrationEnabled);
- QVariant val = m_settings->value("colorCalibrationLutPaths");
- if (val.canConvert<QVariantMap>()) {
- QAssociativeIterable iterable = val.value<QAssociativeIterable>();
- QAssociativeIterable::const_iterator it = iterable.begin();
- const QAssociativeIterable::const_iterator end = iterable.end();
- for (; it != end; ++it) {
- m_colorCalibrationLutPaths.insert(it.key().toString(),
- it.value().toString());
- }
- }
- getValue(*m_settings, "latestVersionCheckEnabled",
- m_latestVersionCheckEnabled);
-
- getValue(*m_settings, "EnableAutoStretch", m_enableAutoStretch);
-
- QString brushType;
- brushType = m_settings->value("cursorBrushType").toString();
- if (brushType != "") m_cursorBrushType = brushType;
- setCursorBrushType(m_cursorBrushType.toStdString());
-
- QString brushStyle;
- brushStyle = m_settings->value("cursorBrushStyle").toString();
- if (brushStyle != "") m_cursorBrushStyle = brushStyle;
- setCursorBrushStyle(m_cursorBrushStyle.toStdString());
-
- getValue(*m_settings, "cursorOutlineEnabled", m_cursorOutlineEnabled);
-
- r = 255, g = 255, b = 0;
- getValue(*m_settings, "currentColumnColor.r", r);
- getValue(*m_settings, "currentColumnColor.g", g);
- getValue(*m_settings, "currentColumnColor.b", b);
- m_currentColumnColor = TPixel32(r, g, b);
-
- getValue(*m_settings, "winInkEnabled", m_enableWinInk);
-
- getValue(*m_settings, "rasterBackgroundColor", m_rasterBackgroundColor);
- TImageWriter::setBackgroundColor(m_rasterBackgroundColor);
-
- getValue(*m_settings, "showXsheetCameraColumn", m_showXsheetCameraColumn);
-
- getValue(*m_settings, "levelBasedToolsDisplay", m_levelBasedToolsDisplay);
-}
-
-//-----------------------------------------------------------------
-
-Preferences::~Preferences() {
- // DO NOT REMOVE
-}
-
-//-----------------------------------------------------------------
-
-Preferences *Preferences::instance() {
- static Preferences _instance;
- return &_instance;
-}
-
-//-----------------------------------------------------------------
-
-void Preferences::enableAutoExpose(bool on) {
- m_autoExposeEnabled = on;
- m_settings->setValue("autoExposeEnabled", on ? "1" : "0");
-}
-
-//-----------------------------------------------------------------
-
-void Preferences::enableSubsceneFolder(bool on) {
- m_subsceneFolderEnabled = on;
- m_settings->setValue("subsceneFolderEnabled", on ? "1" : "0");
}
//-----------------------------------------------------------------
-void Preferences::enableGeneratedMovieView(bool on) {
- m_generatedMovieViewEnabled = on;
- m_settings->setValue("generatedMovieViewEnabled", on ? "1" : "0");
+void Preferences::definePreferenceItems() {
+ // General
+ define(defaultViewerEnabled, "defaultViewerEnabled", QMetaType::Bool, false);
+ define(rasterOptimizedMemory, "rasterOptimizedMemory", QMetaType::Bool,
+ false);
+ define(autosaveEnabled, "autosaveEnabled", QMetaType::Bool, false);
+ define(autosavePeriod, "autosavePeriod", QMetaType::Int, 15, 1, 60);
+ define(autosaveSceneEnabled, "autosaveSceneEnabled", QMetaType::Bool, true);
+ define(autosaveOtherFilesEnabled, "autosaveOtherFilesEnabled",
+ QMetaType::Bool, true);
+ define(startupPopupEnabled, "startupPopupEnabled", QMetaType::Bool, true);
+ define(undoMemorySize, "undoMemorySize", QMetaType::Int, 100, 0, 2000);
+ define(taskchunksize, "taskchunksize", QMetaType::Int, 10, 1, 2000);
+ define(replaceAfterSaveLevelAs, "replaceAfterSaveLevelAs", QMetaType::Bool,
+ true);
+ define(backupEnabled, "backupEnabled", QMetaType::Bool, true);
+ define(backupKeepCount, "backupKeepCount", QMetaType::Int, 1, 1,
+ std::numeric_limits<int>::max());
+ define(sceneNumberingEnabled, "sceneNumberingEnabled", QMetaType::Bool,
+ false);
+ define(watchFileSystemEnabled, "watchFileSystemEnabled", QMetaType::Bool,
+ true);
+ define(projectRoot, "projectRoot", QMetaType::Int, 0x08);
+ define(customProjectRoot, "customProjectRoot", QMetaType::QString, "");
+ define(pathAliasPriority, "pathAliasPriority", QMetaType::Int,
+ (int)ProjectFolderOnly);
+
+ setCallBack(autosaveEnabled, &Preferences::enableAutosave);
+ setCallBack(autosavePeriod, &Preferences::setAutosavePeriod);
+ setCallBack(undoMemorySize, &Preferences::setUndoMemorySize);
+
+ // Interface
+ define(CurrentStyleSheetName, "CurrentStyleSheetName", QMetaType::QString,
+ "Default");
+ define(pixelsOnly, "pixelsOnly", QMetaType::Bool, false);
+ define(oldUnits, "oldUnits", QMetaType::QString, "mm");
+ define(oldCameraUnits, "oldCameraUnits", QMetaType::QString, "inch");
+ define(linearUnits, "linearUnits", QMetaType::QString, "mm");
+ define(cameraUnits, "cameraUnits", QMetaType::QString, "inch");
+ define(CurrentRoomChoice, "CurrentRoomChoice", QMetaType::QString, "Default");
+ define(functionEditorToggle, "functionEditorToggle", QMetaType::Int,
+ (int)ShowGraphEditorInPopup);
+ define(moveCurrentFrameByClickCellArea, "moveCurrentFrameByClickCellArea",
+ QMetaType::Bool, true);
+ define(actualPixelViewOnSceneEditingMode, "actualPixelViewOnSceneEditingMode",
+ QMetaType::Bool, false);
+ define(levelNameOnEachMarkerEnabled, "levelNameOnEachMarkerEnabled",
+ QMetaType::Bool, false);
+ define(showRasterImagesDarkenBlendedInViewer,
+ "showRasterImagesDarkenBlendedInViewer", QMetaType::Bool, false);
+ define(showFrameNumberWithLetters, "showFrameNumberWithLetters",
+ QMetaType::Bool, false);
+ define(iconSize, "iconSize", QMetaType::QSize, QSize(80, 45), QSize(10, 10),
+ QSize(400, 400));
+ define(viewShrink, "viewShrink", QMetaType::Int, 1, 1, 20);
+ define(viewStep, "viewStep", QMetaType::Int, 1, 1, 20);
+ define(viewerZoomCenter, "viewerZoomCenter", QMetaType::Int,
+ 0); // Mouse Cursor
+ define(CurrentLanguageName, "CurrentLanguageName", QMetaType::QString,
+ "English");
+#ifdef _WIN32
+ QString defaultFont("Segoe UI");
+#elif defined Q_OS_MACOS
+ QString defaultFont("Helvetica Neue");
+#else
+ QString defaultFont("Helvetica");
+#endif
+ define(interfaceFont, "interfaceFont", QMetaType::QString, defaultFont);
+ define(interfaceFontStyle, "interfaceFontStyle", QMetaType::QString,
+ "Regular");
+ define(colorCalibrationEnabled, "colorCalibrationEnabled", QMetaType::Bool,
+ false);
+ define(colorCalibrationLutPaths, "colorCalibrationLutPaths",
+ QMetaType::QVariantMap, QVariantMap());
+
+ setCallBack(pixelsOnly, &Preferences::setPixelsOnly);
+ setCallBack(linearUnits, &Preferences::setUnits);
+ setCallBack(cameraUnits, &Preferences::setCameraUnits);
+
+ // Visualization
+ define(show0ThickLines, "show0ThickLines", QMetaType::Bool, true);
+ define(regionAntialias, "regionAntialias", QMetaType::Bool, false);
+
+ // Loading
+ define(importPolicy, "importPolicy", QMetaType::Int, 0); // Always ask
+ define(autoExposeEnabled, "autoExposeEnabled", QMetaType::Bool, true);
+ define(subsceneFolderEnabled, "subsceneFolderEnabled", QMetaType::Bool, true);
+ define(removeSceneNumberFromLoadedLevelName,
+ "removeSceneNumberFromLoadedLevelName", QMetaType::Bool, false);
+ define(IgnoreImageDpi, "IgnoreImageDpi", QMetaType::Bool, false);
+ define(initialLoadTlvCachingBehavior, "initialLoadTlvCachingBehavior",
+ QMetaType::Int, 0); // On Demand
+ define(columnIconLoadingPolicy, "columnIconLoadingPolicy", QMetaType::Int,
+ (int)LoadAtOnce);
+ //"levelFormats" need to be handle separately
+
+ // Saving
+ define(rasterBackgroundColor, "rasterBackgroundColor", QMetaType::QColor,
+ QColor(Qt::white));
+
+ setCallBack(rasterBackgroundColor, &Preferences::setRasterBackgroundColor);
+
+ // Import / Export
+ define(ffmpegPath, "ffmpegPath", QMetaType::QString, "");
+ define(ffmpegTimeout, "ffmpegTimeout", QMetaType::Int, 600, 1,
+ std::numeric_limits<int>::max());
+ define(fastRenderPath, "fastRenderPath", QMetaType::QString, "desktop");
+
+ // Drawing
+ define(scanLevelType, "scanLevelType", QMetaType::QString, "tif");
+ define(DefLevelType, "DefLevelType", QMetaType::Int, TZP_XSHLEVEL);
+ define(newLevelSizeToCameraSizeEnabled, "newLevelSizeToCameraSizeEnabled",
+ QMetaType::Bool, false);
+ define(DefLevelWidth, "DefLevelWidth", QMetaType::Double,
+ TCamera().getSize().lx, 0.1, std::numeric_limits<double>::max());
+ define(DefLevelHeight, "DefLevelHeight", QMetaType::Double,
+ TCamera().getSize().ly, 0.1, std::numeric_limits<double>::max());
+ define(DefLevelDpi, "DefLevelDpi", QMetaType::Double, TCamera().getDpi().x,
+ 0.1, std::numeric_limits<double>::max());
+ define(AutocreationType, "AutocreationType", QMetaType::Int,
+ 2); // Use Xsheet as Animation Sheet
+ define(EnableAutoStretch, "EnableAutoStretch", QMetaType::Bool, true);
+ define(vectorSnappingTarget, "vectorSnappingTarget", QMetaType::Int,
+ (int)SnapAll);
+ define(saveUnpaintedInCleanup, "saveUnpaintedInCleanup", QMetaType::Bool,
+ true);
+ define(minimizeSaveboxAfterEditing, "minimizeSaveboxAfterEditing",
+ QMetaType::Bool, true);
+ define(useNumpadForSwitchingStyles, "useNumpadForSwitchingStyles",
+ QMetaType::Bool, true);
+ define(downArrowInLevelStripCreatesNewFrame,
+ "downArrowInLevelStripCreatesNewFrame", QMetaType::Bool, true);
+ define(keepFillOnVectorSimplify, "keepFillOnVectorSimplify", QMetaType::Bool,
+ true);
+ define(useHigherDpiOnVectorSimplify, "useHigherDpiOnVectorSimplify",
+ QMetaType::Bool, false);
+
+ // Tools
+ define(dropdownShortcutsCycleOptions, "dropdownShortcutsCycleOptions",
+ QMetaType::Int,
+ 1); // Cycle through the available options (changed from bool to int)
+ define(FillOnlysavebox, "FillOnlysavebox", QMetaType::Bool, false);
+ define(multiLayerStylePickerEnabled, "multiLayerStylePickerEnabled",
+ QMetaType::Bool, false);
+ define(cursorBrushType, "cursorBrushType", QMetaType::QString, "Small");
+ define(cursorBrushStyle, "cursorBrushStyle", QMetaType::QString, "Default");
+ define(cursorOutlineEnabled, "cursorOutlineEnabled", QMetaType::Bool, true);
+ define(levelBasedToolsDisplay, "levelBasedToolsDisplay", QMetaType::Int,
+ 0); // Default
+
+ // Xsheet
+ define(xsheetLayoutPreference, "xsheetLayoutPreference", QMetaType::QString,
+ "Classic-revised");
+ define(xsheetStep, "xsheetStep", QMetaType::Int, 10, 0,
+ std::numeric_limits<int>::max());
+ define(xsheetAutopanEnabled, "xsheetAutopanEnabled", QMetaType::Bool, true);
+ define(DragCellsBehaviour, "DragCellsBehaviour", QMetaType::Int,
+ 1); // Cells and Column Data
+ define(ignoreAlphaonColumn1Enabled, "ignoreAlphaonColumn1Enabled",
+ QMetaType::Bool, false);
+ define(showKeyframesOnXsheetCellArea, "showKeyframesOnXsheetCellArea",
+ QMetaType::Bool, true);
+ define(showXsheetCameraColumn, "showXsheetCameraColumn", QMetaType::Bool,
+ true);
+ define(useArrowKeyToShiftCellSelection, "useArrowKeyToShiftCellSelection",
+ QMetaType::Bool, true);
+ define(inputCellsWithoutDoubleClickingEnabled,
+ "inputCellsWithoutDoubleClickingEnabled", QMetaType::Bool, false);
+ define(shortcutCommandsWhileRenamingCellEnabled,
+ "shortcutCommandsWhileRenamingCellEnabled", QMetaType::Bool, false);
+ define(showXSheetToolbar, "showXSheetToolbar", QMetaType::Bool, true);
+ define(expandFunctionHeader, "expandFunctionHeader", QMetaType::Bool, false);
+ define(showColumnNumbers, "showColumnNumbers", QMetaType::Bool, false);
+ define(syncLevelRenumberWithXsheet, "syncLevelRenumberWithXsheet",
+ QMetaType::Bool, true);
+ define(currentTimelineEnabled, "currentTimelineEnabled", QMetaType::Bool,
+ true);
+ define(currentColumnColor, "currentColumnColor", QMetaType::QColor,
+ QColor(Qt::yellow));
+
+ // Animation
+ define(keyframeType, "keyframeType", QMetaType::Int, 2); // Linear
+ define(animationStep, "animationStep", QMetaType::Int, 1, 1, 500);
+
+ // Preview
+ define(blanksCount, "blanksCount", QMetaType::Int, 0, 0, 1000);
+ define(blankColor, "blankColor", QMetaType::QColor, QColor(Qt::white));
+ define(rewindAfterPlayback, "rewindAfterPlayback", QMetaType::Bool, true);
+ define(previewAlwaysOpenNewFlip, "previewAlwaysOpenNewFlip", QMetaType::Bool,
+ false);
+ define(fitToFlipbook, "fitToFlipbook", QMetaType::Bool, false);
+ define(generatedMovieViewEnabled, "generatedMovieViewEnabled",
+ QMetaType::Bool, true);
+
+ // Onion Skin
+ define(onionSkinEnabled, "onionSkinEnabled", QMetaType::Bool, true);
+ define(onionPaperThickness, "onionPaperThickness", QMetaType::Int, 50, 0,
+ 100);
+ define(backOnionColor, "backOnionColor", QMetaType::QColor, QColor(Qt::red));
+ define(frontOnionColor, "frontOnionColor", QMetaType::QColor,
+ QColor(Qt::green));
+ define(onionInksOnly, "onionInksOnly", QMetaType::Bool, false);
+ define(onionSkinDuringPlayback, "onionSkinDuringPlayback", QMetaType::Bool,
+ false);
+ define(useOnionColorsForShiftAndTraceGhosts,
+ "useOnionColorsForShiftAndTraceGhosts", QMetaType::Bool, true);
+ define(animatedGuidedDrawing, "animatedGuidedDrawing", QMetaType::Int,
+ 0); // Arrow Markers (changed from bool to int)
+
+ // Colors
+ define(viewerBGColor, "viewerBGColor", QMetaType::QColor,
+ QColor(128, 128, 128));
+ define(previewBGColor, "previewBGColor", QMetaType::QColor,
+ QColor(64, 64, 64));
+ define(levelEditorBoxColor, "levelEditorBoxColor", QMetaType::QColor,
+ QColor(128, 128, 128));
+ define(chessboardColor1, "chessboardColor1", QMetaType::QColor,
+ QColor(180, 180, 180));
+ define(chessboardColor2, "chessboardColor2", QMetaType::QColor,
+ QColor(230, 230, 230));
+ define(transpCheckInkOnWhite, "transpCheckInkOnWhite", QMetaType::QColor,
+ QColor(Qt::black));
+ define(transpCheckInkOnBlack, "transpCheckInkOnBlack", QMetaType::QColor,
+ QColor(Qt::white));
+ define(transpCheckPaint, "transpCheckPaint", QMetaType::QColor,
+ QColor(127, 127, 127));
+
+ // Version Control
+ define(SVNEnabled, "SVNEnabled", QMetaType::Bool, false);
+ define(automaticSVNFolderRefreshEnabled, "automaticSVNFolderRefreshEnabled",
+ QMetaType::Bool, true);
+ define(latestVersionCheckEnabled, "latestVersionCheckEnabled",
+ QMetaType::Bool, true);
+
+ // Touch / Tablet Settings
+ // TounchGestureControl // Touch Gesture is a checkable command and not in
+ // preferences.ini
+ define(winInkEnabled, "winInkEnabled", QMetaType::Bool, false);
+
+ // Others (not appeared in the popup)
+ // Shortcut popup settings
+ define(shortcutPreset, "shortcutPreset", QMetaType::QString, "defopentoonz");
+ // Viewer context menu
+ define(guidedDrawingType, "guidedDrawingType", QMetaType::Int, 0); // Off
+#if defined(MACOSX) && defined(__LP64__)
+ // OSX shared memory settings
+ define(shmmax, "shmmax", QMetaType::Int, -1);
+ define(shmseg, "shmseg", QMetaType::Int, -1);
+ define(shmall, "shmall", QMetaType::Int, -1);
+ define(shmmni, "shmmni", QMetaType::Int, -1);
+#endif
}
//-----------------------------------------------------------------
-void Preferences::enableXsheetAutopan(bool on) {
- m_xsheetAutopanEnabled = on;
- m_settings->setValue("xsheetAutopanEnabled", on ? "1" : "0");
-}
-
-//------------------------------------------------------------------
-
-void Preferences::enableIgnoreAlphaonColumn1(bool on) {
- m_ignoreAlphaonColumn1Enabled = on;
- m_settings->setValue("ignoreAlphaonColumn1Enabled", on ? "1" : "0");
-}
-
-//------------------------------------------------------------------
-
-void Preferences::enableShowKeyframesOnXsheetCellArea(bool on) {
- m_showKeyframesOnXsheetCellArea = on;
- m_settings->setValue("showKeyframesOnXsheetCellArea", on ? "1" : "0");
-}
-
-//-----------------------------------------------------------------
+void Preferences::define(PreferencesItemId id, QString idString,
+ QMetaType::Type type, QVariant defaultValue,
+ QVariant min, QVariant max) {
+ // load value
+ QVariant value(defaultValue);
+ switch (type) {
+ case QMetaType::Bool:
+ case QMetaType::Int:
+ case QMetaType::Double:
+ case QMetaType::QString:
+ if (m_settings->contains(idString) &&
+ m_settings->value(idString).canConvert(type))
+ value = m_settings->value(idString);
+ break;
+ case QMetaType::QSize: // used in iconSize
+ if (m_settings->contains(idString) &&
+ m_settings->value(idString).canConvert(QMetaType::QSize))
+ value = m_settings->value(idString);
+ // to keep compatibility with older versions
+ else if (m_settings->contains(idString + "X")) {
+ QSize size = value.toSize();
+ size.setWidth(m_settings->value(idString + "X", size.width()).toInt());
+ size.setHeight(m_settings->value(idString + "Y", size.height()).toInt());
+ value.setValue(size);
+ }
+ break;
+ case QMetaType::QMetaType::QColor:
+ if (m_settings->contains(idString)) {
+ QString str = m_settings->value(idString).toString();
+ value.setValue(stringToColor(str));
+ }
+ // following two conditions are to keep compatibility with older versions
+ else if (m_settings->contains(idString + "_R")) {
+ QColor color = value.value<QColor>();
+ color.setRed(m_settings->value(idString + "_R", color.red()).toInt());
+ color.setGreen(m_settings->value(idString + "_G", color.green()).toInt());
+ color.setBlue(m_settings->value(idString + "_B", color.blue()).toInt());
+ color.setAlpha(m_settings->value(idString + "_M", color.alpha()).toInt());
+ value.setValue(color);
+ } else if (m_settings->contains(idString + ".r")) {
+ QColor color = value.value<QColor>();
+ color.setRed(m_settings->value(idString + ".r", color.red()).toInt());
+ color.setGreen(m_settings->value(idString + ".g", color.green()).toInt());
+ color.setBlue(m_settings->value(idString + ".b", color.blue()).toInt());
+ color.setAlpha(255);
+ value.setValue(color);
+ }
+ break;
+ case QMetaType::QVariantMap: // used in colorCalibrationLutPaths
+ if (m_settings->contains(idString) &&
+ m_settings->value(idString).canConvert(type)) {
+ QMap<QString, QString> pathMap;
+ QAssociativeIterable iterable =
+ m_settings->value(idString).value<QAssociativeIterable>();
+ QAssociativeIterable::const_iterator it = iterable.begin();
+ const QAssociativeIterable::const_iterator end = iterable.end();
+ for (; it != end; ++it)
+ pathMap.insert(it.key().toString(), it.value().toString());
+ value.setValue(pathMap);
+ }
+ break;
+ default:
+ std::cout << "Unsupported type detected" << std::endl;
+ // load anyway
+ value = m_settings->value(idString, value);
+ break;
+ }
-void Preferences::enableRewindAfterPlayback(bool on) {
- m_rewindAfterPlaybackEnabled = on;
- m_settings->setValue("rewindAfterPlayback", on ? "1" : "0");
+ m_items.insert(id, PreferencesItem(idString, type, value, min, max));
}
//-----------------------------------------------------------------
-void Preferences::enableFitToFlipbook(bool on) {
- m_fitToFlipbookEnabled = on;
- m_settings->setValue("fitToFlipbook", on ? "1" : "0");
+void Preferences::setCallBack(const PreferencesItemId id, OnEditedFunc func) {
+ getItem(id).onEditedFunc = func;
}
//-----------------------------------------------------------------
-void Preferences::enablePreviewAlwaysOpenNewFlip(bool on) {
- m_previewAlwaysOpenNewFlipEnabled = on;
- m_settings->setValue("previewAlwaysOpenNewFlip", on ? "1" : "0");
+PreferencesItem &Preferences::getItem(const PreferencesItemId id) {
+ assert(m_items.contains(id));
+ return m_items[id];
}
//-----------------------------------------------------------------
-void Preferences::enableAutosave(bool on) {
- m_autosaveEnabled = on;
- m_settings->setValue("autosaveEnabled", on ? "1" : "0");
+bool Preferences::getBoolValue(const PreferencesItemId id) const {
+ assert(m_items.contains(id));
+ if (!m_items.contains(id)) return false;
+ PreferencesItem item = m_items.value(id);
+ assert(item.type == QMetaType::Bool);
+ if (item.type != QMetaType::Bool) return false;
- if (!on)
- emit stopAutoSave();
- else
- emit startAutoSave();
+ return item.value.toBool();
}
//-----------------------------------------------------------------
-void Preferences::enableAutosaveScene(bool on) {
- m_autosaveSceneEnabled = on;
- m_settings->setValue("autosaveSceneEnabled", on ? "1" : "0");
-}
-
-//-----------------------------------------------------------------
+int Preferences::getIntValue(const PreferencesItemId id) const {
+ assert(m_items.contains(id));
+ if (!m_items.contains(id)) return -1;
+ PreferencesItem item = m_items.value(id);
+ assert(item.type == QMetaType::Int);
+ if (item.type != QMetaType::Int) return -1;
-void Preferences::enableAutosaveOtherFiles(bool on) {
- m_autosaveOtherFilesEnabled = on;
- m_settings->setValue("autosaveOtherFilesEnabled", on ? "1" : "0");
+ return item.value.toInt();
}
//-----------------------------------------------------------------
-void Preferences::enableStartupPopup(bool on) {
- m_startupPopupEnabled = on;
- m_settings->setValue("startupPopupEnabled", on ? "1" : "0");
-}
-
-//-----------------------------------------------------------------
+double Preferences::getDoubleValue(const PreferencesItemId id) const {
+ assert(m_items.contains(id));
+ if (!m_items.contains(id)) return -1.0;
+ PreferencesItem item = m_items.value(id);
+ assert(item.type == QMetaType::Double);
+ if (item.type != QMetaType::Double) return -1.0;
-void Preferences::setAskForOverrideRender(bool on) {
- m_autosaveEnabled = on;
- m_settings->setValue("askForOverrideRender", on ? "1" : "0");
+ return item.value.toDouble();
}
//-----------------------------------------------------------------
-void Preferences::enableDefaultViewer(bool on) {
- m_defaultViewerEnabled = on;
- m_settings->setValue("defaultViewerEnabled", on ? "1" : "0");
-}
-
-//-----------------------------------------------------------------
+QString Preferences::getStringValue(const PreferencesItemId id) const {
+ assert(m_items.contains(id));
+ if (!m_items.contains(id)) return QString();
+ PreferencesItem item = m_items.value(id);
+ assert(item.type == QMetaType::QString);
+ if (item.type != QMetaType::QString) return QString();
-void Preferences::enableRasterOptimizedMemory(bool on) {
- m_rasterOptimizedMemory = on;
- m_settings->setValue("rasterOptimizedMemory", on ? "1" : "0");
+ return item.value.toString();
}
//-----------------------------------------------------------------
-void Preferences::enableSaveUnpaintedInCleanup(bool on) {
- m_saveUnpaintedInCleanup = on;
- m_settings->setValue("saveUnpaintedInCleanup", on ? "1" : "0");
-}
+TPixel Preferences::getColorValue(const PreferencesItemId id) const {
+ assert(m_items.contains(id));
+ if (!m_items.contains(id)) return TPixel();
+ PreferencesItem item = m_items.value(id);
+ assert(item.type == QMetaType::QColor);
+ if (item.type != QMetaType::QColor) return TPixel();
-//-----------------------------------------------------------------
-
-void Preferences::enableAutomaticSVNFolderRefresh(bool on) {
- m_automaticSVNFolderRefreshEnabled = on;
- m_settings->setValue("automaticSVNFolderRefreshEnabled", on ? "1" : "0");
+ return colorToTPixel(item.value.value<QColor>());
}
//-----------------------------------------------------------------
-void Preferences::enableSVN(bool on) {
- m_SVNEnabled = on;
- m_settings->setValue("SVNEnabled", on ? "1" : "0");
+TDimension Preferences::getSizeValue(const PreferencesItemId id) const {
+ assert(m_items.contains(id));
+ if (!m_items.contains(id)) return TDimension();
+ PreferencesItem item = m_items.value(id);
+ assert(item.type == QMetaType::QSize);
+ if (item.type != QMetaType::QSize) return TDimension();
+ QSize size = item.value.toSize();
+ return TDimension(size.width(), size.height());
}
//-----------------------------------------------------------------
+// saveToFile is true by default, becomes false when dragging color field
+void Preferences::setValue(const PreferencesItemId id, QVariant value,
+ bool saveToFile) {
+ assert(m_items.contains(id));
+ if (!m_items.contains(id)) return;
+ m_items[id].value = value;
+ if (saveToFile) {
+ if (m_items[id].type ==
+ QMetaType::QColor) // write in human-readable format
+ m_settings->setValue(m_items[id].idString,
+ colorToString(value.value<QColor>()));
+ else if (m_items[id].type ==
+ QMetaType::Bool) // write 1/0 instead of true/false to keep
+ // compatibility
+ m_settings->setValue(m_items[id].idString, value.toBool() ? "1" : "0");
+ else
+ m_settings->setValue(m_items[id].idString, value);
+ }
-void Preferences::enableLatestVersionCheck(bool on) {
- m_latestVersionCheckEnabled = on;
- m_settings->setValue("latestVersionCheckEnabled", on ? "1" : "0");
+ // execute callback
+ if (m_items[id].onEditedFunc) (this->*(m_items[id].onEditedFunc))();
}
//-----------------------------------------------------------------
-void Preferences::enableMinimizeSaveboxAfterEditing(bool on) {
- m_minimizeSaveboxAfterEditing = on;
- m_settings->setValue("minimizeSaveboxAfterEditing", on ? "1" : "0");
+void Preferences::enableAutosave() {
+ bool autoSaveOn = getBoolValue(autosaveEnabled);
+ if (autoSaveOn)
+ emit startAutoSave();
+ else
+ emit stopAutoSave();
}
//-----------------------------------------------------------------
-void Preferences::setAutosavePeriod(int minutes) {
- m_autosavePeriod = minutes;
- m_settings->setValue("autosavePeriod", QString::number(minutes));
+void Preferences::setAutosavePeriod() {
emit stopAutoSave();
emit startAutoSave();
emit autoSavePeriodChanged();
@@ -915,323 +785,25 @@ void Preferences::setAutosavePeriod(int minutes) {
//-----------------------------------------------------------------
-void Preferences::setDefaultTaskChunkSize(int chunkSize) {
- m_chunkSize = chunkSize;
- m_settings->setValue("taskchunksize", QString::number(chunkSize));
-}
-
-//-----------------------------------------------------------------
-
-void Preferences::setXsheetStep(int step) {
- m_xsheetStep = step;
- m_settings->setValue("xsheetStep", QString::number(m_xsheetStep));
-}
-
-//-----------------------------------------------------------------
-
-void Preferences::setTranspCheckData(const TPixel &bg, const TPixel &ink,
- const TPixel &paint) {
- m_transpCheckBg = bg;
- m_transpCheckInk = ink;
- m_transpCheckPaint = paint;
-
- m_settings->setValue("transpCheckInkOnBlack.r",
- QString::number(m_transpCheckBg.r));
- m_settings->setValue("transpCheckInkOnBlack.g",
- QString::number(m_transpCheckBg.g));
- m_settings->setValue("transpCheckInkOnBlack.b",
- QString::number(m_transpCheckBg.b));
-
- m_settings->setValue("transpCheckInkOnWhite.r",
- QString::number(m_transpCheckInk.r));
- m_settings->setValue("transpCheckInkOnWhite.g",
- QString::number(m_transpCheckInk.g));
- m_settings->setValue("transpCheckInkOnWhite.b",
- QString::number(m_transpCheckInk.b));
-
- m_settings->setValue("transpCheckPaint.r",
- QString::number(m_transpCheckPaint.r));
- m_settings->setValue("transpCheckPaint.g",
- QString::number(m_transpCheckPaint.g));
- m_settings->setValue("transpCheckPaint.b",
- QString::number(m_transpCheckPaint.b));
-}
-
-//-----------------------------------------------------------
-
-void Preferences::setOnionData(const TPixel &frontOnionColor,
- const TPixel &backOnionColor, bool inksOnly) {
- m_frontOnionColor = frontOnionColor;
- m_backOnionColor = backOnionColor;
- m_inksOnly = inksOnly;
-
- m_settings->setValue("frontOnionColor.r", QString::number(frontOnionColor.r));
- m_settings->setValue("frontOnionColor.g", QString::number(frontOnionColor.g));
- m_settings->setValue("frontOnionColor.b", QString::number(frontOnionColor.b));
- m_settings->setValue("backOnionColor.r", QString::number(backOnionColor.r));
- m_settings->setValue("backOnionColor.g", QString::number(backOnionColor.g));
- m_settings->setValue("backOnionColor.b", QString::number(backOnionColor.b));
- m_settings->setValue("onionInksOnly", QString::number(m_inksOnly));
-}
-
-//-----------------------------------------------------------------
-
-void Preferences::setIconSize(const TDimension &dim) {
- m_iconSize = dim;
-
- m_settings->setValue("iconSizeX", QString::number(dim.lx));
- m_settings->setValue("iconSizeY", QString::number(dim.ly));
-}
-
-//-----------------------------------------------------------------
-
-void Preferences::setViewerBGColor(const TPixel32 &color, bool isDragging) {
- m_viewerBGColor = color;
- if (!isDragging) {
- m_settings->setValue("viewerBGColor_R", QString::number((int)color.r));
- m_settings->setValue("viewerBGColor_G", QString::number((int)color.g));
- m_settings->setValue("viewerBGColor_B", QString::number((int)color.b));
- m_settings->setValue("viewerBGColor_M", QString::number((int)color.m));
- }
-}
-
-//-----------------------------------------------------------------
-
-void Preferences::setPreviewBGColor(const TPixel32 &color, bool isDragging) {
- m_previewBGColor = color;
- if (!isDragging) {
- m_settings->setValue("previewBGColor_R", QString::number((int)color.r));
- m_settings->setValue("previewBGColor_G", QString::number((int)color.g));
- m_settings->setValue("previewBGColor_B", QString::number((int)color.b));
- m_settings->setValue("previewBGColor_M", QString::number((int)color.m));
- }
-}
-
-//-----------------------------------------------------------------
-
-void Preferences::setLevelEditorBoxColor(const TPixel32 &color,
- bool isDragging) {
- m_levelEditorBoxColor = color;
- if (!isDragging) {
- m_settings->setValue("levelEditorBoxColor_R",
- QString::number((int)color.r));
- m_settings->setValue("levelEditorBoxColor_G",
- QString::number((int)color.g));
- m_settings->setValue("levelEditorBoxColor_B",
- QString::number((int)color.b));
- m_settings->setValue("levelEditorBoxColor_M",
- QString::number((int)color.m));
- }
-}
-
-//-----------------------------------------------------------------
-
-void Preferences::setChessboardColor1(const TPixel32 &color, bool isDragging) {
- m_chessboardColor1 = color;
- if (!isDragging) {
- m_settings->setValue("chessboardColor1_R", QString::number((int)color.r));
- m_settings->setValue("chessboardColor1_G", QString::number((int)color.g));
- m_settings->setValue("chessboardColor1_B", QString::number((int)color.b));
- m_settings->setValue("chessboardColor1_M", QString::number((int)color.m));
- }
-}
-
-//-----------------------------------------------------------------
-
-void Preferences::setChessboardColor2(const TPixel32 &color, bool isDragging) {
- m_chessboardColor2 = color;
- if (!isDragging) {
- m_settings->setValue("chessboardColor2_R", QString::number((int)color.r));
- m_settings->setValue("chessboardColor2_G", QString::number((int)color.g));
- m_settings->setValue("chessboardColor2_B", QString::number((int)color.b));
- m_settings->setValue("chessboardColor2_M", QString::number((int)color.m));
- }
-}
-
-//-----------------------------------------------------------------
-
-void Preferences::enableShowRasterImagesDarkenBlendedInViewer(bool on) {
- m_showRasterImagesDarkenBlendedInViewer = on;
- m_settings->setValue("showRasterImagesDarkenBlendedInViewer", on ? "1" : "0");
-}
-
-//-----------------------------------------------------------------
-
-void Preferences::enableActualPixelViewOnSceneEditingMode(bool on) {
- m_actualPixelViewOnSceneEditingMode = on;
- m_settings->setValue("actualPixelViewOnSceneEditingMode", on ? "1" : "0");
-}
-
-//-----------------------------------------------------------------
-
-void Preferences::enableMultiLayerStylePicker(bool on) {
- m_multiLayerStylePickerEnabled = on;
- m_settings->setValue("multiLayerStylePickerEnabled", on ? "1" : "0");
-}
-
-//-----------------------------------------------------------------
-
-void Preferences::setViewerZoomCenter(int type) {
- m_viewerZoomCenter = type;
- m_settings->setValue("viewerZoomCenter", type);
-}
-
-//-----------------------------------------------------------------
-
-void Preferences::setInitialLoadTlvCachingBehavior(int type) {
- m_initialLoadTlvCachingBehavior = type;
- m_settings->setValue("initialLoadTlvCachingBehavior", type);
-}
-
-//-----------------------------------------------------------------
-
-void Preferences::enableShowFrameNumberWithLetters(bool on) {
- m_showFrameNumberWithLetters = on;
- m_settings->setValue("showFrameNumberWithLetters", on ? "1" : "0");
-}
-
-//-----------------------------------------------------------------
-
-void Preferences::enableLevelNameOnEachMarker(bool on) {
- m_levelNameOnEachMarker = on;
- m_settings->setValue("levelNameOnEachMarkerEnabled", on ? "1" : "0");
-}
-
-//-----------------------------------------------------------------
-
-void Preferences::setColumnIconLoadingPolicy(ColumnIconLoadingPolicy cilp) {
- assert(cilp == LoadAtOnce || cilp == LoadOnDemand);
- m_columnIconLoadingPolicy = cilp;
- m_settings->setValue("columnIconLoadingPolicy", QString::number((int)cilp));
-}
-
-//-----------------------------------------------------------------
-
-void Preferences::enableMoveCurrent(bool on) {
- m_moveCurrentFrameByClickCellArea = on;
- m_settings->setValue("moveCurrentFrameByClickCellArea", on ? "1" : "0");
-}
-
-//-----------------------------------------------------------------
-
-void Preferences::enableRemoveSceneNumberFromLoadedLevelName(bool on) {
- m_removeSceneNumberFromLoadedLevelName = on;
- m_settings->setValue("removeSceneNumberFromLoadedLevelName", on ? "1" : "0");
-}
-
-//-----------------------------------------------------------------
-
-void Preferences::enableReplaceAfterSaveLevelAs(bool on) {
- m_replaceAfterSaveLevelAs = on;
- m_settings->setValue("replaceAfterSaveLevelAs", on ? "1" : "0");
-}
-
-//-----------------------------------------------------------------
-
-void Preferences::enableOnionSkin(bool on) {
- m_onionSkinEnabled = on;
- m_settings->setValue("onionSkinEnabled", on ? "1" : "0");
-}
-
-//-----------------------------------------------------------------
-
-void Preferences::setOnionSkinDuringPlayback(bool on) {
- m_onionSkinDuringPlayback = on;
- m_settings->setValue("onionSkinDuringPlayback", on ? "1" : "0");
-}
-
-//-----------------------------------------------------------------
-
-void Preferences::useOnionColorsForShiftAndTraceGhosts(bool on) {
- m_useOnionColorsForShiftAndTraceGhosts = on;
- m_settings->setValue("useOnionColorsForShiftAndTraceGhosts", on ? "1" : "0");
-}
-
-//-----------------------------------------------------------------
-
-void Preferences::setShow0ThickLines(bool on) {
- m_show0ThickLines = on;
- m_settings->setValue(s_show0ThickLines, s_bool[on]);
-}
-
-//-----------------------------------------------------------------
-
-void Preferences::setRegionAntialias(bool on) {
- m_regionAntialias = on;
- m_settings->setValue(s_regionAntialias, s_bool[on]);
-}
-
-//-----------------------------------------------------------------
-
-void Preferences::setBlankValues(int blanksCount, TPixel32 blankColor) {
- m_blanksCount = blanksCount;
- m_blankColor = blankColor;
- m_settings->setValue("blanksCount", QString::number(blanksCount));
- m_settings->setValue("blankColor.r", QString::number(blankColor.r));
- m_settings->setValue("blankColor.g", QString::number(blankColor.g));
- m_settings->setValue("blankColor.b", QString::number(blankColor.b));
-}
-
-//-----------------------------------------------------------------
-
-void Preferences::setOnionPaperThickness(int thickness) {
- m_onionPaperThickness = thickness;
- m_settings->setValue("onionPaperThickness", QString::number(thickness));
-}
-
-//-----------------------------------------------------------------
-
-void Preferences::setViewValues(int shrink, int step) {
- m_shrink = shrink;
- m_step = step;
-
- m_settings->setValue("viewShrink", QString::number(shrink));
- m_settings->setValue("viewStep", QString::number(step));
-}
-
-//-----------------------------------------------------------------
-
-static void setCurrentUnits(std::string measureName, std::string units) {
- TMeasure *m = TMeasureManager::instance()->get(measureName);
- if (!m) return;
- TUnit *u = m->getUnit(::to_wstring(units));
- if (!u) return;
- m->setCurrentUnit(u);
+void Preferences::setUndoMemorySize() {
+ int memorySize = getIntValue(undoMemorySize);
+ TUndoManager::manager()->setUndoMemorySize(memorySize);
}
//-----------------------------------------------------------------
-void Preferences::setPixelsOnly(bool state) {
- m_pixelsOnly = state;
- m_settings->setValue("pixelsOnly", m_pixelsOnly);
- if (state) {
+void Preferences::setPixelsOnly() {
+ bool pixelSelected = getBoolValue(pixelsOnly);
+ if (pixelSelected)
storeOldUnits();
- } else {
+ else
resetOldUnits();
- }
}
//-----------------------------------------------------------------
-void Preferences::setProjectRoot(int index) {
- // storing the index of the selection instead of the text
- // to make translation work
- m_projectRoot = index;
- m_settings->setValue("projectRoot", m_projectRoot);
-}
-
-//-----------------------------------------------------------------
-
-void Preferences::setCustomProjectRoot(std::wstring customProjectRoot) {
- m_customProjectRoot = QString::fromStdWString(customProjectRoot);
- m_settings->setValue("customProjectRoot", m_customProjectRoot);
-}
-
-//-----------------------------------------------------------------
-
-void Preferences::setUnits(std::string units) {
- m_units = QString::fromStdString(units);
- m_settings->setValue("linearUnits", m_units);
+void Preferences::setUnits() {
+ std::string units = getStringValue(linearUnits).toStdString();
setCurrentUnits("length", units);
setCurrentUnits("length.x", units);
setCurrentUnits("length.y", units);
@@ -1243,334 +815,63 @@ void Preferences::setUnits(std::string units) {
//-----------------------------------------------------------------
-void Preferences::setCameraUnits(std::string units) {
- m_cameraUnits = QString::fromStdString(units);
- m_settings->setValue("cameraUnits", m_cameraUnits);
+void Preferences::setCameraUnits() {
+ std::string units = getStringValue(cameraUnits).toStdString();
setCurrentUnits("camera.lx", units);
setCurrentUnits("camera.ly", units);
}
//-----------------------------------------------------------------
-void Preferences::storeOldUnits() {
- m_oldUnits = getUnits();
- m_oldCameraUnits = getCameraUnits();
- m_settings->setValue("oldUnits", m_oldUnits);
- m_settings->setValue("oldCameraUnits", m_oldCameraUnits);
-}
-
-//-----------------------------------------------------------------
-
-void Preferences::resetOldUnits() {
- if (m_oldUnits != "" && m_oldCameraUnits != "") {
- setUnits(m_oldUnits.toStdString());
- setCameraUnits(m_oldCameraUnits.toStdString());
- }
-}
-
-//-----------------------------------------------------------------
-
-void Preferences::setCurrentRoomChoice(int currentRoomChoice) {
- m_currentRoomChoice = getRoomChoice(currentRoomChoice);
- m_settings->setValue("CurrentRoomChoice", m_currentRoomChoice);
-}
-
-//-----------------------------------------------------------------
-
-void Preferences::setCurrentRoomChoice(QString currentRoomChoice) {
- m_currentRoomChoice = currentRoomChoice;
- m_settings->setValue("CurrentRoomChoice", m_currentRoomChoice);
-}
-
-//-----------------------------------------------------------------
-
-QString Preferences::getCurrentRoomChoice() const {
- return m_currentRoomChoice;
-}
-
-//-----------------------------------------------------------------
-
-int Preferences::getRoomChoiceCount() const { return m_roomMaps.size(); }
-
-//-----------------------------------------------------------------
-
-QString Preferences::getRoomChoice(int index) const {
- return m_roomMaps[index];
+void Preferences::setRasterBackgroundColor() {
+ TPixel color = getColorValue(rasterBackgroundColor);
+ TImageWriter::setBackgroundColor(color);
}
//-----------------------------------------------------------------
-void Preferences::setScanLevelType(std::string type) {
- m_scanLevelType = QString::fromStdString(type);
- m_settings->setValue("scanLevelType", m_scanLevelType);
-}
-
-//-----------------------------------------------------------------
-
-void Preferences::setKeyframeType(int s) {
- m_keyframeType = s;
- m_settings->setValue("keyframeType", s);
-}
-//-----------------------------------------------------------------
-
-void Preferences::setAnimationStep(int s) {
- m_animationStep = s;
- m_settings->setValue("animationStep", s);
+void Preferences::storeOldUnits() {
+ setValue(oldUnits, getStringValue(linearUnits));
+ setValue(oldCameraUnits, getStringValue(cameraUnits));
}
//-----------------------------------------------------------------
-void Preferences::setUndoMemorySize(int memorySize) {
- m_undoMemorySize = memorySize;
- TUndoManager::manager()->setUndoMemorySize(memorySize);
- m_settings->setValue("undoMemorySize", memorySize);
+void Preferences::resetOldUnits() {
+ QString oldLinearU = getStringValue(oldUnits);
+ QString oldCameraU = getStringValue(oldCameraUnits);
+ if (oldLinearU != "" && oldCameraU != "") {
+ setValue(linearUnits, oldLinearU);
+ setValue(cameraUnits, oldCameraU);
+ }
}
//-----------------------------------------------------------------
QString Preferences::getCurrentLanguage() const {
- if (m_languageList.contains(m_currentLanguage)) return m_currentLanguage;
+ QString lang = getStringValue(CurrentLanguageName);
+ if (m_languageList.contains(lang)) return lang;
// If no valid option selected, then return English
return m_languageList[0];
}
//-----------------------------------------------------------------
-QString Preferences::getLanguage(int index) const {
- return m_languageList[index];
-}
-
-//-----------------------------------------------------------------
-
-int Preferences::getLanguageCount() const { return (int)m_languageList.size(); }
-
-//-----------------------------------------------------------------
-
-void Preferences::setCurrentLanguage(const QString &currentLanguage) {
- m_currentLanguage = currentLanguage;
- m_settings->setValue("CurrentLanguageName", m_currentLanguage);
-}
-
-//-----------------------------------------------------------------
-
-QString Preferences::getCurrentStyleSheetName() const {
- if (m_styleSheetList.contains(m_currentStyleSheet))
- return m_currentStyleSheet;
- // If no valid option selected, then return the first oprion
- return m_styleSheetList.isEmpty() ? QString() : m_styleSheetList[0];
-}
-
-//-----------------------------------------------------------------
-
-void Preferences::setInterfaceFont(std::string font) {
- m_interfaceFont = QString::fromStdString(font);
- m_settings->setValue("interfaceFont", m_interfaceFont);
-}
-
-//-----------------------------------------------------------------
-
-void Preferences::setInterfaceFontStyle(std::string style) {
- m_interfaceFontStyle = QString::fromStdString(style);
- m_settings->setValue("interfaceFontStyle", m_interfaceFontStyle);
-}
-
-//-----------------------------------------------------------------
-
-void Preferences::setInterfaceFontWeight(int weight) {
- m_interfaceFontWeight = weight;
- m_settings->setValue("interfaceFontWeight", m_interfaceFontWeight);
-}
-
-//-----------------------------------------------------------------
-
QString Preferences::getCurrentStyleSheetPath() const {
- if (m_currentStyleSheet.isEmpty()) return QString();
+ QString currentStyleSheetName = getStringValue(CurrentStyleSheetName);
+ if (currentStyleSheetName.isEmpty()) return QString();
TFilePath path(TEnv::getConfigDir() + "qss");
- QString string = m_currentStyleSheet + QString("/") + m_currentStyleSheet +
- QString(".qss");
+ QString string = currentStyleSheetName + QString("/") +
+ currentStyleSheetName + QString(".qss");
return QString("file:///" + path.getQString() + "/" + string);
}
//-----------------------------------------------------------------
-QString Preferences::getStyleSheet(int index) const {
- return m_styleSheetList[index];
-}
-
-//-----------------------------------------------------------------
-
-int Preferences::getStyleSheetCount() const {
- return (int)m_styleSheetList.size();
-}
-
-//-----------------------------------------------------------------
-
-void Preferences::setCurrentStyleSheet(const QString &currentStyleSheet) {
- m_currentStyleSheet = currentStyleSheet;
- m_settings->setValue("CurrentStyleSheetName", m_currentStyleSheet);
-}
-//-----------------------------------------------------------------
-
-void Preferences::setAutocreationType(int autocreationType) {
- m_autocreationType = autocreationType;
- m_settings->setValue("AutocreationType", m_autocreationType);
-}
-
-//-----------------------------------------------------------------
-
-void Preferences::setDragCellsBehaviour(int dragCellsBehaviour) {
- m_dragCellsBehaviour = dragCellsBehaviour;
- m_settings->setValue("DragCellsBehaviour", m_dragCellsBehaviour);
-}
-
-//-----------------------------------------------------------------
-
-void Preferences::setLineTestFpsCapture(int lineTestFpsCapture) {
- m_lineTestFpsCapture = lineTestFpsCapture;
- m_settings->setValue("LineTestFpsCapture", m_lineTestFpsCapture);
-}
-
-//-----------------------------------------------------------------
-
-void Preferences::setFillOnlySavebox(bool on) {
- m_fillOnlySavebox = on;
- m_settings->setValue("FillOnlysavebox", on ? "1" : "0");
-}
-
-//-----------------------------------------------------------------
-
-void Preferences::setKeepFillOnVectorSimplify(bool on) {
- m_keepFillOnVectorSimplify = on;
- m_settings->setValue("keepFillOnVectorSimplify", on ? "1" : "0");
-}
-
-//-----------------------------------------------------------------
-
-void Preferences::setUseHigherDpiOnVectorSimplify(bool on) {
- m_useHigherDpiOnVectorSimplify = on;
- m_settings->setValue("useHigherDpiOnVectorSimplify", on ? "1" : "0");
-}
-
-//-----------------------------------------------------------------
-
-void Preferences::setDownArrowLevelStripNewFrame(bool on) {
- m_downArrowInLevelStripCreatesNewFrame = on;
- m_settings->setValue("downArrowInLevelStripCreatesNewFrame", on ? "1" : "0");
-}
-
-//-----------------------------------------------------------------
-
-void Preferences::enableBackup(bool enabled) {
- m_backupEnabled = enabled;
- m_settings->setValue("backupEnabled", enabled ? "1" : "0");
-}
-
-//-----------------------------------------------------------------
-
-void Preferences::setBackupKeepCount(int count) {
- m_backupKeepCount = count;
- m_settings->setValue("backupKeepCount", count);
-}
-
-//-----------------------------------------------------------------
-
-void Preferences::enableSceneNumbering(bool enabled) {
- m_sceneNumberingEnabled = enabled;
- m_settings->setValue("sceneNumberingEnabled", enabled ? "1" : "0");
-}
-
-//-----------------------------------------------------------------
-
-void Preferences::setDropdownShortcutsCycleOptions(bool on) {
- m_dropdownShortcutsCycleOptions = on;
- m_settings->setValue("dropdownShortcutsCycleOptions", on ? "1" : "0");
-}
-
-//-----------------------------------------------------------------
-
-void Preferences::setDefLevelType(int levelType) {
- m_defLevelType = levelType;
- m_settings->setValue("DefLevelType", levelType);
-}
-
-//-----------------------------------------------------------------
-
-void Preferences::setDefLevelWidth(double width) {
- m_defLevelWidth = width;
- m_settings->setValue("DefLevelWidth", width);
-}
-
-//-----------------------------------------------------------------
-
-void Preferences::setDefLevelHeight(double height) {
- m_defLevelHeight = height;
- m_settings->setValue("DefLevelHeight", height);
-}
-
-//-----------------------------------------------------------------
-
-void Preferences::setDefLevelDpi(double dpi) {
- m_defLevelDpi = dpi;
- m_settings->setValue("DefLevelDpi", dpi);
-}
-
-//-----------------------------------------------------------------
-
-void Preferences::setIgnoreImageDpi(bool on) {
- m_ignoreImageDpi = on;
- m_settings->setValue("IgnoreImageDpi", on ? "1" : "0");
-}
-
-//-----------------------------------------------------------------
-
-void Preferences::setVectorSnappingTarget(int target) {
- m_vectorSnappingTarget = target;
- m_settings->setValue("vectorSnappingTarget", target);
-}
-
-//-----------------------------------------------------------------
-
-void Preferences::setFfmpegPath(std::string path) {
- m_ffmpegPath = QString::fromStdString(path);
- std::string strPath = m_ffmpegPath.toStdString();
- m_settings->setValue("ffmpegPath", m_ffmpegPath);
-}
-
-//-----------------------------------------------------------------
-
-void Preferences::setFastRenderPath(std::string path) {
- m_fastRenderPath = QString::fromStdString(path);
- std::string strPath = m_ffmpegPath.toStdString();
- m_settings->setValue("fastRenderPath", m_fastRenderPath);
-}
-
-//-----------------------------------------------------------------
-
-void Preferences::setShortcutPreset(std::string preset) {
- m_shortcutPreset = QString::fromStdString(preset);
- m_settings->setValue("shortcutPreset", m_shortcutPreset);
-}
-
-//-----------------------------------------------------------------
-
void Preferences::setPrecompute(bool enabled) { m_precompute = enabled; }
//-----------------------------------------------------------------
-void Preferences::setFfmpegTimeout(int seconds) {
- m_ffmpegTimeout = seconds;
- m_settings->setValue("ffmpegTimeout", seconds);
-}
-
-//-----------------------------------------------------------------
-
-void Preferences::setDefaultImportPolicy(int policy) {
- m_importPolicy = policy;
- m_settings->setValue("importPolicy", policy);
-}
-
-//-----------------------------------------------------------------
-
int Preferences::addLevelFormat(const LevelFormat &format) {
LevelFormatVector::iterator lft = m_levelFormats.insert(
std::upper_bound(m_levelFormats.begin(), m_levelFormats.end(), format,
@@ -1582,7 +883,7 @@ int Preferences::addLevelFormat(const LevelFormat &format) {
m_levelFormats.begin()); // NOTE: Must be disjoint from the instruction
// above, since operator-'s param evaluation
// order is unspecified
- setValue(*m_settings, m_levelFormats);
+ _setValue(*m_settings, m_levelFormats);
return formatIdx;
}
@@ -1593,7 +894,7 @@ void Preferences::removeLevelFormat(int formatIdx) {
assert(0 <= formatIdx && formatIdx < int(m_levelFormats.size()));
m_levelFormats.erase(m_levelFormats.begin() + formatIdx);
- setValue(*m_settings, m_levelFormats);
+ _setValue(*m_settings, m_levelFormats);
}
//-----------------------------------------------------------------
@@ -1621,201 +922,21 @@ int Preferences::matchLevelFormat(const TFilePath &fp) const {
//-----------------------------------------------------------------
-void Preferences::enableUseNumpadForSwitchingStyles(bool on) {
- m_useNumpadForSwitchingStyles = on;
- m_settings->setValue("useNumpadForSwitchingStyles", on ? "1" : "0");
-}
-
-//-----------------------------------------------------------------
-
-void Preferences::setGuidedDrawing(int status) {
- m_guidedDrawingType = status;
- m_settings->setValue("guidedDrawingType", status);
-}
-
-//-----------------------------------------------------------------
-
-void Preferences::setAnimatedGuidedDrawing(bool status) {
- m_animatedGuidedDrawing = status;
- m_settings->setValue("animatedGuidedDrawing", status ? "1" : "0");
-}
-
-//-----------------------------------------------------------------
-
-void Preferences::enableNewLevelSizeToCameraSize(bool on) {
- m_newLevelSizeToCameraSizeEnabled = on;
- m_settings->setValue("newLevelSizeToCameraSizeEnabled", on ? "1" : "0");
-}
-
-//-----------------------------------------------------------------
-
-void Preferences::enableShowXSheetToolbar(bool on) {
- m_showXSheetToolbar = on;
- m_settings->setValue("showXSheetToolbar", on ? "1" : "0");
-}
-
-//-----------------------------------------------------------------
-
-void Preferences::enableSyncLevelRenumberWithXsheet(bool on) {
- m_syncLevelRenumberWithXsheet = on;
- m_settings->setValue("syncLevelRenumberWithXsheet", on ? "1" : "0");
-}
-
-//-----------------------------------------------------------------
-
-void Preferences::enableExpandFunctionHeader(bool on) {
- m_expandFunctionHeader = on;
- m_settings->setValue("expandFunctionHeader", on ? "1" : "0");
-}
-
-void Preferences::enableShowColumnNumbers(bool on) {
- m_showColumnNumbers = on;
- m_settings->setValue("showColumnNumbers", on ? "1" : "0");
-}
-
-void Preferences::setXsheetLayoutPreference(std::string layout) {
- m_xsheetLayoutPreference = QString::fromStdString(layout);
- m_settings->setValue("xsheetLayoutPreference", m_xsheetLayoutPreference);
-}
-
-void Preferences::setLoadedXsheetLayout(std::string layout) {
- m_loadedXsheetLayout = QString::fromStdString(layout);
-}
-
-//-----------------------------------------------------------------
-
-void Preferences::enableUseArrowKeyToShiftCellSelection(bool on) {
- m_useArrowKeyToShiftCellSelection = on;
- m_settings->setValue("useArrowKeyToShiftCellSelection", on ? "1" : "0");
-}
-
-//-----------------------------------------------------------------
-
-void Preferences::enableInputCellsWithoutDoubleClicking(bool on) {
- m_inputCellsWithoutDoubleClickingEnabled = on;
- m_settings->setValue("inputCellsWithoutDoubleClickingEnabled",
- on ? "1" : "0");
-}
-
-//-----------------------------------------------------------------
-
-void Preferences::enableWatchFileSystem(bool on) {
- m_watchFileSystem = on;
- m_settings->setValue("watchFileSystemEnabled", on ? "1" : "0");
-}
-
-//-----------------------------------------------------------------
-
-void Preferences::enableShortcutCommandsWhileRenamingCell(bool on) {
- m_shortcutCommandsWhileRenamingCellEnabled = on;
- m_settings->setValue("shortcutCommandsWhileRenamingCellEnabled",
- on ? "1" : "0");
-}
-
-//-----------------------------------------------------------------
-
-void Preferences::setPathAliasPriority(PathAliasPriority priority) {
- m_pathAliasPriority = priority;
- m_settings->setValue("pathAliasPriority", static_cast<int>(priority));
-}
-
-//-----------------------------------------------------------------
-
-void Preferences::setFunctionEditorToggle(FunctionEditorToggle status) {
- m_functionEditorToggle = status;
- m_settings->setValue("functionEditorToggle", static_cast<int>(status));
-}
-
-//-----------------------------------------------------------------
-
-void Preferences::enableCurrentTimelineIndicator(bool on) {
- m_currentTimelineEnabled = on;
- m_settings->setValue("currentTimelineEnabled", on ? "1" : "0");
-}
-
-//-----------------------------------------------------------------
-// color calibration using 3DLUT
-
-void Preferences::enableColorCalibration(bool on) {
- m_colorCalibrationEnabled = on;
- m_settings->setValue("colorCalibrationEnabled", on ? "1" : "0");
-}
-
void Preferences::setColorCalibrationLutPath(QString monitorName,
QString path) {
- m_colorCalibrationLutPaths.insert(monitorName, path);
- QMap<QString, QVariant> map;
- QMap<QString, QString>::const_iterator i =
- m_colorCalibrationLutPaths.constBegin();
- while (i != m_colorCalibrationLutPaths.constEnd()) {
- map.insert(i.key(), i.value());
- i++;
- }
- m_settings->setValue("colorCalibrationLutPaths", map);
-}
-
-QString Preferences::getColorCalibrationLutPath(QString &monitorName) const {
- return m_colorCalibrationLutPaths.value(monitorName);
+ PreferencesItem item = m_items.value(colorCalibrationLutPaths);
+ QMap<QString, QVariant> lutPathMap =
+ item.value.value<QMap<QString, QVariant>>();
+ lutPathMap.insert(monitorName, path);
+ setValue(colorCalibrationLutPaths, lutPathMap);
}
//-----------------------------------------------------------------
-void Preferences::enableAutoStretch(bool on) {
- m_enableAutoStretch = on;
- m_settings->setValue("EnableAutoStretch", on ? "1" : "0");
-}
-
-void Preferences::setCursorBrushType(std::string brushType) {
- m_cursorBrushType = QString::fromStdString(brushType);
- m_settings->setValue("cursorBrushType", m_cursorBrushType);
-}
-
-void Preferences::setCursorBrushStyle(std::string brushStyle) {
- m_cursorBrushStyle = QString::fromStdString(brushStyle);
- m_settings->setValue("cursorBrushStyle", m_cursorBrushStyle);
-}
-
-void Preferences::enableCursorOutline(bool on) {
- m_cursorOutlineEnabled = on;
- m_settings->setValue("cursorOutlineEnabled", on ? "1" : "0");
-}
-
-void Preferences::setCurrentColumnData(const TPixel &currentColumnColor) {
- m_currentColumnColor = currentColumnColor;
- m_settings->setValue("currentColumnColor.r",
- QString::number(currentColumnColor.r));
- m_settings->setValue("currentColumnColor.g",
- QString::number(currentColumnColor.g));
- m_settings->setValue("currentColumnColor.b",
- QString::number(currentColumnColor.b));
-}
-
-void Preferences::enableWinInk(bool on) {
- m_enableWinInk = on;
- m_settings->setValue("winInkEnabled", on ? "1" : "0");
-}
-
-void Preferences::setRasterBackgroundColor(const TPixel32 &color) {
- m_rasterBackgroundColor = color;
- TImageWriter::setBackgroundColor(m_rasterBackgroundColor);
- m_settings->setValue("rasterBackgroundColor_R",
- QString::number((int)color.r));
- m_settings->setValue("rasterBackgroundColor_G",
- QString::number((int)color.g));
- m_settings->setValue("rasterBackgroundColor_B",
- QString::number((int)color.b));
- m_settings->setValue("rasterBackgroundColor_M",
- QString::number((int)color.m));
-}
-
-//-----------------------------------------------------------------
+QString Preferences::getColorCalibrationLutPath(QString &monitorName) const {
+ PreferencesItem item = m_items.value(colorCalibrationLutPaths);
+ QMap<QString, QString> lutPathMap =
+ item.value.value<QMap<QString, QString>>();
-void Preferences::enableXsheetCameraColumn(bool on) {
- m_showXsheetCameraColumn = on;
- m_settings->setValue("showXsheetCameraColumn", on ? "1" : "0");
+ return lutPathMap.value(monitorName);
}
-
-void Preferences::setLevelBasedToolsDisplay(int displayType) {
- m_levelBasedToolsDisplay = displayType;
- m_settings->setValue("levelBasedToolsDisplay", displayType);
-}
\ No newline at end of file