ui/components/animation_factory_manager.h¶
Animation Factory Manager Interface. More...
Namespaces¶
| Name |
|---|
| cf |
| cf::ui |
| cf::ui::components |
Classes¶
| Name | |
|---|---|
| class | cf::ui::components::ICFAnimationManagerFactory Animation Factory Manager Interface. |
Detailed Description¶
Animation Factory Manager Interface.
Author: Charliechen114514 (chengh1922@mails.jlu.edu.cn)
Version: 0.1
Date: 2026-02-28
Copyright: Copyright © 2026
Defines the interface for animation factory managers that create and manage animations. This interface provides token-based animation lookup and supports both string-based and typed animation registration.
The manager maintains ownership of created animations and provides WeakPtr access to users for safe, non-owning references.
Source code¶
#pragma once
#include "animation.h"
#include "base/weak_ptr/weak_ptr.h"
#include <QObject>
#include <functional>
namespace cf::ui::components {
using AnimationCreator = std::function<ICFAbstractAnimation*(QObject*)>;
class CF_UI_EXPORT ICFAnimationManagerFactory : public QObject {
Q_OBJECT
public:
explicit ICFAnimationManagerFactory(QObject* parent);
~ICFAnimationManagerFactory() override = default;
// =========================================================================
// Enumeration Types
// =========================================================================
enum class RegisteredResult {
OK,
DUP_NAME,
UNSUPPORT_TYPE
};
Q_ENUM(RegisteredResult)
virtual cf::WeakPtr<ICFAnimationManagerFactory> GetWeakPtr() = 0;
// =========================================================================
// Animation Registration
// =========================================================================
virtual RegisteredResult registerOneAnimation(const QString& name, const QString& type) = 0;
virtual RegisteredResult registerAnimationCreator(const QString& name,
AnimationCreator creator) = 0;
// =========================================================================
// Animation Retrieval
// =========================================================================
virtual cf::WeakPtr<ICFAbstractAnimation> getAnimation(const char* name) = 0;
// =========================================================================
// Global Settings
// =========================================================================
void setTargetFps(const float fps);
void setTargetEnabled(const QString& which, const bool enabled);
bool targetEnabled(const QString& which);
virtual void setEnabledAll(bool enabled) = 0;
virtual bool isAllEnabled() = 0;
signals:
void animationRegistered(const QString& name);
void animationEnabledChanged(const QString& name, bool enabled);
};
} // namespace cf::ui::components
Updated on 2026-03-09 at 10:14:01 +0000