diff --git a/launcher/ui/themes/CatPainter.cpp b/launcher/ui/themes/CatPainter.cpp index 7ff24932b..7c152fdc9 100644 --- a/launcher/ui/themes/CatPainter.cpp +++ b/launcher/ui/themes/CatPainter.cpp @@ -22,12 +22,27 @@ CatPainter::CatPainter(const QString& path, QObject* parent) : QObject(parent) { - m_image = QPixmap(path); + // Attempt to load as a movie + m_movie = new QMovie(path, QByteArray(), this); + if (m_movie->isValid()) { + // Start the animation if it's a valid movie file + connect(m_movie, &QMovie::frameChanged, this, &CatPainter::updateFrame); + m_movie->start(); + } else { + // Otherwise, load it as a static image + delete m_movie; + m_movie = nullptr; + + m_image = QPixmap(path); + } } void CatPainter::paint(QPainter* painter, const QRect& viewport) { QPixmap frame = m_image; + if (m_movie && m_movie->isValid()) { + frame = m_movie->currentPixmap(); + } auto fit = APPLICATION->settings()->get("CatFit").toString(); painter->setOpacity(APPLICATION->settings()->get("CatOpacity").toFloat() / 100); diff --git a/launcher/ui/themes/CatPainter.h b/launcher/ui/themes/CatPainter.h index 3b790c640..c36cb7617 100644 --- a/launcher/ui/themes/CatPainter.h +++ b/launcher/ui/themes/CatPainter.h @@ -34,5 +34,6 @@ class CatPainter : public QObject { void updateFrame(); private: + QMovie* m_movie = nullptr; QPixmap m_image; };