- Add LottieIcon class (TGS gzip decompress + rlottie C API render) - Add AnimTimer singleton (33ms tick, activate/deactivate refcount) - Add EmojiButton (hover-triggered animation in emoji picker) - Add AnimatedEmoji support to EmojiData (5 TGS mappings) - MessageDelegate: QTextLayout-based animated emoji overlay (text + reactions) - ChatView: drag-to-select (click deselects, 5px drag starts selection) - ChatView: hoveredIndexChanged signal for hover-triggered animations - MessageList: wire AnimTimer tick to viewport update, hover → activate - CMake: AUTORCC, rlottie, zlib dependencies - Add 5 TGS animations as Qt resources
45 lines
932 B
C++
45 lines
932 B
C++
#include "animtimer.h"
|
|
#include "lottieicon.h"
|
|
|
|
AnimTimer::AnimTimer() {
|
|
m_timer.setInterval(33);
|
|
connect(&m_timer, &QTimer::timeout, this, &AnimTimer::onTimer);
|
|
m_timer.start();
|
|
}
|
|
|
|
AnimTimer *AnimTimer::instance() {
|
|
static AnimTimer s;
|
|
return &s;
|
|
}
|
|
|
|
void AnimTimer::registerIcon(const QString &key, LottieIcon *icon) {
|
|
m_icons.insert(key, icon);
|
|
}
|
|
|
|
void AnimTimer::unregisterIcon(const QString &key) {
|
|
m_icons.remove(key);
|
|
}
|
|
|
|
LottieIcon *AnimTimer::icon(const QString &key) const {
|
|
return m_icons.value(key, nullptr);
|
|
}
|
|
|
|
void AnimTimer::activate() {
|
|
if (m_activeRef++ == 0) {
|
|
for (auto *icon : m_icons)
|
|
icon->advanceFrame();
|
|
emit ticked();
|
|
}
|
|
}
|
|
|
|
void AnimTimer::deactivate() {
|
|
if (m_activeRef > 0) m_activeRef--;
|
|
}
|
|
|
|
void AnimTimer::onTimer() {
|
|
if (m_activeRef <= 0) return;
|
|
for (auto *icon : m_icons)
|
|
icon->advanceFrame();
|
|
emit ticked();
|
|
}
|