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 40a1fb8
Showing 1 changed file with 12 additions and 1 deletion.
13 changes: 12 additions & 1 deletion src/kernel/dguiapplicationhelper.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -115,6 +115,7 @@ Q_GLOBAL_STATIC(DFontManager, _globalFM)
#define WINDOW_THEME_KEY "_d_platform_theme"

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

/*!
Expand Down Expand Up @@ -286,6 +287,17 @@ void DGuiApplicationHelperPrivate::initApplication(QGuiApplication *app)

systemSizeMode = static_cast<DGuiApplicationHelper::SizeMode>(systemTheme->sizeMode());
q->connect(systemTheme, SIGNAL(sizeModeChanged(int)), q, SLOT(_q_sizeModeChanged(int)));

if (_d_dconfig.exists())
return;

const QLatin1String env("D_DTK_DISABLE_ANIMATIONS");
const bool shouldEnable = _d_dconfig->value(DTK_ENABLE_ANIMATIONS, false).toBool();
const bool isEnable = !qEnvironmentVariableIsSet(env.data());

if (shouldEnable ^ isEnable) {
shouldEnable ? qunsetenv(env.data()) : qputenv(env.data(), "1");
}
}

void DGuiApplicationHelperPrivate::staticInitApplication()
Expand Down Expand Up @@ -529,7 +541,6 @@ DGuiApplicationHelper::DGuiApplicationHelper()
: QObject(nullptr)
, DObject(*new DGuiApplicationHelperPrivate(this))
{

}

void DGuiApplicationHelper::initialize()
Expand Down

0 comments on commit 40a1fb8

Please sign in to comment.