/* SPDX-FileCopyrightText: 2023 Fushan Wen SPDX-License-Identifier: LGPL-2.1-or-later */ #pragma once #include #ifdef Q_OS_UNIX #include #include #endif #ifdef Q_OS_WIN #include #endif class AnimationSpeedProvider { public: explicit AnimationSpeedProvider(); virtual ~AnimationSpeedProvider(); Q_DISABLE_COPY_MOVE(AnimationSpeedProvider) QBindable animationSpeedModifier() const; protected: QProperty m_animationSpeedModifier{1.0}; }; #ifdef Q_OS_UNIX class KConfigAnimationSpeedProvider : public QObject, public AnimationSpeedProvider { Q_OBJECT public: explicit KConfigAnimationSpeedProvider(QObject *parent = nullptr); ~KConfigAnimationSpeedProvider() override; Q_DISABLE_COPY_MOVE(KConfigAnimationSpeedProvider) private: KConfigWatcher::Ptr m_animationSpeedWatcher; }; #endif #ifdef Q_OS_WIN class WindowsAnimationSpeedProvider : public QAbstractNativeEventFilter, public AnimationSpeedProvider { public: explicit WindowsAnimationSpeedProvider(); ~WindowsAnimationSpeedProvider() override; Q_DISABLE_COPY_MOVE(WindowsAnimationSpeedProvider) private: void update(); bool nativeEventFilter(const QByteArray &eventType, void *message, qintptr *result) override; }; #endif