Skip to content

Commit

Permalink
chore: config dtk animations
Browse files Browse the repository at this point in the history
set/unset `D_DTK_DISABLE_ANIMATIONS` according to the dconfig
  • Loading branch information
kegechen committed Oct 25, 2024
1 parent 316a3e7 commit 6038e6f
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 1 deletion.
3 changes: 2 additions & 1 deletion include/kernel/dguiapplicationhelper.h
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,8 @@ class DGuiApplicationHelper : public QObject, public DCORE_NAMESPACE::DObject
IsTableEnvironment = ReadOnlyLimit << 3,
IsDeepinEnvironment = ReadOnlyLimit << 4,
IsSpecialEffectsEnvironment = ReadOnlyLimit << 5,
IsTreelandPlatform = ReadOnlyLimit << 6
IsTreelandPlatform = ReadOnlyLimit << 6,
HasAnimations = ReadOnlyLimit << 7,
};
Q_ENUM(Attribute)
Q_DECLARE_FLAGS(Attributes, Attribute)
Expand Down
10 changes: 10 additions & 0 deletions src/kernel/dguiapplicationhelper.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -115,6 +115,8 @@ Q_GLOBAL_STATIC(DFontManager, _globalFM)
#define WINDOW_THEME_KEY "_d_platform_theme"

#define APP_THEME_TYPE "themeType"
#define DTK_ENABLE_ANIMATIONS "enableDtkAnimations"
#define DTK_ANIMATIONS_ENV "D_DTK_DISABLE_ANIMATIONS"
Q_GLOBAL_STATIC_WITH_ARGS(DTK_CORE_NAMESPACE::DConfig, _d_dconfig, ("org.deepin.dtk.preference"));

/*!
Expand Down Expand Up @@ -1744,6 +1746,14 @@ bool DGuiApplicationHelper::testAttribute(DGuiApplicationHelper::Attribute attri
&& qApp->platformName() == QByteArrayLiteral("wayland");
return isTreeland;
}
case HasAnimations: {
static bool isDisable = qEnvironmentVariableIsSet(DTK_ANIMATIONS_ENV);
if (isDisable)
return false;

static bool shouldEnable = _d_dconfig->value(DTK_ENABLE_ANIMATIONS, false).toBool();
return shouldEnable;
}
default:
return DGuiApplicationHelperPrivate::attributes.testFlag(attribute);
}
Expand Down

0 comments on commit 6038e6f

Please sign in to comment.