mirror of
https://github.com/wownero/wowlet.git
synced 2026-10-29 12:18:44 +01:00
feat(splash): random silly loading GIF (wow-lite-wallet tradition)
The wallet-open splash now shows a random loader from a bundled set (13 curated GIFs from wownero/wow-lite-wallet, ~2.2MB) instead of the static key icon — auto-discovered from :/silly, aspect-scaled to 56px, falls back to the key pixmap if none present. Assets by a friend (same Wownero family).
This commit is contained in:
@@ -4,6 +4,10 @@
|
||||
#include "SplashDialog.h"
|
||||
#include "ui_SplashDialog.h"
|
||||
|
||||
#include <QDir>
|
||||
#include <QMovie>
|
||||
#include <QRandomGenerator>
|
||||
|
||||
#include "utils/Icons.h"
|
||||
|
||||
SplashDialog::SplashDialog(QWidget *parent)
|
||||
@@ -14,8 +18,25 @@ SplashDialog::SplashDialog(QWidget *parent)
|
||||
|
||||
this->setWindowIcon(icons()->icon("appicon/64x64"));
|
||||
|
||||
QPixmap pixmap = QPixmap(":/assets/images/key.png");
|
||||
ui->icon->setPixmap(pixmap.scaledToWidth(32, Qt::SmoothTransformation));
|
||||
// wowlet: a random silly loading GIF (wow-lite-wallet tradition) instead of
|
||||
// a static key icon. Auto-discovers whatever loaders are bundled under
|
||||
// :/silly so the set can grow without touching this code; falls back to the
|
||||
// key pixmap if none are present.
|
||||
const QStringList loaders = QDir(":/silly").entryList(QStringList() << "*.gif", QDir::Files);
|
||||
if (!loaders.isEmpty()) {
|
||||
const QString pick = ":/silly/" + loaders.at(QRandomGenerator::global()->bounded(loaders.size()));
|
||||
auto *movie = new QMovie(pick, QByteArray(), this);
|
||||
movie->jumpToFrame(0);
|
||||
const QSize frame = movie->currentImage().size();
|
||||
const int h = 56;
|
||||
if (frame.height() > 0)
|
||||
movie->setScaledSize(QSize(frame.width() * h / frame.height(), h));
|
||||
ui->icon->setMovie(movie);
|
||||
movie->start();
|
||||
} else {
|
||||
QPixmap pixmap = QPixmap(":/assets/images/key.png");
|
||||
ui->icon->setPixmap(pixmap.scaledToWidth(32, Qt::SmoothTransformation));
|
||||
}
|
||||
|
||||
this->setWindowFlags(Qt::Dialog | Qt::FramelessWindowHint);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user