chatgui: rlottie animated emoji with hover-to-animate, drag-to-select
- 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
This commit is contained in:
1 parent
0e2b0e28d8
commit
62b3695a77
42 files changed
+286658
-73
No files matched your search
@@ -0,0 +1,44 @@
|
||||
#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();
|
||||
}
|
||||
Reference in new issue
Block a user