Add Show/Toggle Check Indicators preference, command and shortcut

This commit is contained in:
manongjohn 2021-08-22 14:22:31 -04:00
parent 6bba272bae
commit 7fb91e07d6
10 changed files with 69 additions and 0 deletions

View file

@ -235,6 +235,10 @@ public:
void setColorCalibrationLutPath(QString monitorName, QString path);
QString getColorCalibrationLutPath(QString &monitorName) const;
bool isCheckIndicatorEnabled() const {
return getBoolValue(checkIndicatorEnabled);
}
// Visualization tab
bool getShow0ThickLines() const { return getBoolValue(show0ThickLines); }
bool getRegionAntialias() const { return getBoolValue(regionAntialias); }

View file

@ -46,6 +46,7 @@ enum PreferencesItemId {
interfaceFontStyle,
colorCalibrationEnabled,
colorCalibrationLutPaths,
checkIndicatorEnabled,
//----------
// Visualization

View file

@ -2475,6 +2475,9 @@ void MainWindow::defineActions() {
Preferences::instance()->isAutoStretchEnabled(),
MiscCommandType, "auto_stretch",
tr("Toggles the auto-stretch of a frame to the next frame"));
createToggle(MI_CheckIndicator, QT_TR_NOOP("Toggle Check Indicators"), "",
Preferences::instance()->isCheckIndicatorEnabled(),
RightClickMenuCommandType);
// Tools

View file

@ -244,6 +244,7 @@
#define MI_OnionSkin "MI_OnionSkin"
#define MI_ZeroThick "MI_ZeroThick"
#define MI_CursorOutline "MI_CursorOutline"
#define MI_CheckIndicator "MI_CheckIndicator"
//#define MI_LoadResourceFile "MI_LoadResourceFile"
#define MI_DuplicateFile "MI_DuplicateFile"

View file

@ -1019,6 +1019,7 @@ QString PreferencesPopup::getUIString(PreferencesItemId id) {
{colorCalibrationLutPaths,
tr("3DLUT File for [%1]:")
.arg(LutManager::instance()->getMonitorName())},
{checkIndicatorEnabled, tr("Show Check Indicators")},
// Visualization
{show0ThickLines, tr("Show Lines with Thickness 0")},
@ -1462,6 +1463,7 @@ QWidget* PreferencesPopup::createInterfacePage() {
insertUI(moveCurrentFrameByClickCellArea, lay);
insertUI(actualPixelViewOnSceneEditingMode, lay);
// insertUI(levelNameOnEachMarkerEnabled, lay);
insertUI(checkIndicatorEnabled, lay);
insertUI(showRasterImagesDarkenBlendedInViewer, lay);
// insertUI(showFrameNumberWithLetters, lay);
insertUI(iconSize, lay);

View file

@ -1854,6 +1854,8 @@ void SceneViewer::drawOverlay() {
void SceneViewer::drawCheckNotices() {
if (m_previewMode) return;
if (!Preferences::instance()->isCheckIndicatorEnabled()) return;
ToonzCheck *tc = ToonzCheck::instance();
int mask = tc->getChecks();

View file

@ -168,6 +168,7 @@ class SceneViewer final : public GLWidgetForHighDpi,
bool m_isPicking;
bool m_canShowPerspectiveGrids = false;
bool m_showCheckIndicators = true;
TRaster32P m_3DSideL;
TRaster32P m_3DSideR;

View file

@ -226,6 +226,8 @@ SceneViewerContextMenu::SceneViewerContextMenu(SceneViewer *parent)
// Brush size outline
CursorOutlineToggleGui::addCursorOutlineCommand(this);
CheckIndicatorToggleGui::addCheckIndicatorCommand(this);
// preview
if (parent->isPreviewEnabled()) {
addSeparator();
@ -547,3 +549,41 @@ void CursorOutlineToggleGui::CursorOutlineToggleHandler::activate() {
void CursorOutlineToggleGui::CursorOutlineToggleHandler::deactivate() {
CursorOutlineToggle::enableCursorOutline(false);
}
class CheckIndicatorToggle : public MenuItemHandler {
public:
CheckIndicatorToggle() : MenuItemHandler(MI_CheckIndicator) {}
void execute() {
QAction *action = CommandManager::instance()->getAction(MI_CheckIndicator);
if (!action) return;
bool checked = action->isChecked();
enableCheckIndicator(checked);
}
static void enableCheckIndicator(bool enable = true) {
Preferences::instance()->setValue(checkIndicatorEnabled, enable);
}
} CheckIndicatorToggle;
void CheckIndicatorToggleGui::addCheckIndicatorCommand(QMenu *menu) {
static CheckIndicatorToggleHandler switcher;
if (Preferences::instance()->isCheckIndicatorEnabled()) {
QAction *hideCheckIndicator =
menu->addAction(QString(QObject::tr("Hide Check Indicators")));
menu->connect(hideCheckIndicator, SIGNAL(triggered()), &switcher,
SLOT(deactivate()));
} else {
QAction *showCheckIndicator =
menu->addAction(QString(QObject::tr("Show Check Indicators")));
menu->connect(showCheckIndicator, SIGNAL(triggered()), &switcher,
SLOT(activate()));
}
}
void CheckIndicatorToggleGui::CheckIndicatorToggleHandler::activate() {
CheckIndicatorToggle::enableCheckIndicator(true);
}
void CheckIndicatorToggleGui::CheckIndicatorToggleHandler::deactivate() {
CheckIndicatorToggle::enableCheckIndicator(false);
}

View file

@ -65,4 +65,17 @@ public slots:
} // Namespace CursorOutlineToggleGui
namespace CheckIndicatorToggleGui {
void addCheckIndicatorCommand(QMenu *menu);
class CheckIndicatorToggleHandler : public QObject {
Q_OBJECT
public slots:
void activate();
void deactivate();
};
} // Namespace CheckIndicatorToggleGui
#endif

View file

@ -441,6 +441,8 @@ void Preferences::definePreferenceItems() {
setCallBack(linearUnits, &Preferences::setUnits);
setCallBack(cameraUnits, &Preferences::setCameraUnits);
define(checkIndicatorEnabled, "checkIndicatorEnabled", QMetaType::Bool, true);
// Visualization
define(show0ThickLines, "show0ThickLines", QMetaType::Bool, true);
define(regionAntialias, "regionAntialias", QMetaType::Bool, false);