Files
utun2/tools/chatgui/src/animtimer.h
T
evgeny a97e8bcc1f docs: update file inventory and module header contracts
Refresh both AGENTS guides and clarify module purpose, usage, ownership, threading, return values and wire formats in headers. Remove the unused timeout_heap freed_count field and unimplemented getter.
2026-10-04 13:10:01 +02:00

39 lines
1.1 KiB
C++

/* Общий GUI-таймер анимированных emoji: регистрирует LottieIcon и выдаёт ticked.
* play запускает минимум PlaybackMs; shutdown останавливает таймер и очищает регистрацию. */
#pragma once
#include <QObject>
#include <QTimer>
#include <QHash>
#include <QElapsedTimer>
class LottieIcon;
class AnimTimer : public QObject {
Q_OBJECT
public:
static AnimTimer *instance();
void registerIcon(const QString &key, LottieIcon *icon);
void unregisterIcon(const QString &key);
LottieIcon *icon(const QString &key) const;
void logRegisteredIcons() const;
// Наведение запускает минимум две секунды воспроизведения, затем каждый значок завершает свой цикл.
static constexpr int PlaybackMs = 2000;
void play();
static void shutdown();
signals:
void ticked();
private slots:
void onTimer();
private:
AnimTimer();
QTimer m_timer;
QHash<QString, LottieIcon *> m_icons;
QElapsedTimer m_playback;
};