mirror of
https://github.com/wownero/wowlet.git
synced 2026-11-24 17:15:12 +01:00
feat: ambient silliness across the app (reduced-motion aware)
- Lock screen: full ambient scene above the unlock form (the idle 'screensaver'
— wallet auto-locks here) instead of a thin banner.
- History ('home'): full scene as a top banner.
- Send/Receive: IdleDoge — a small click-through sitting doge in the corner,
the 'most quiet' idle for task screens.
- Mining keeps its own scene.
All gated by Config::reducedMotion (scenes freeze, doge shows a still frame).
This commit is contained in:
@@ -0,0 +1,46 @@
|
||||
// SPDX-License-Identifier: BSD-3-Clause
|
||||
// SPDX-FileCopyrightText: The Monero Project
|
||||
|
||||
#include "IdleDoge.h"
|
||||
|
||||
#include <QEvent>
|
||||
#include <QMovie>
|
||||
|
||||
#include "utils/config.h"
|
||||
|
||||
IdleDoge::IdleDoge(QWidget *parent, int height)
|
||||
: QLabel(parent)
|
||||
, m_movie(new QMovie(":/assets/images/dog_sitting.gif", QByteArray(), this))
|
||||
{
|
||||
m_movie->jumpToFrame(0);
|
||||
const QSize frame = m_movie->currentImage().size();
|
||||
if (frame.height() > 0)
|
||||
m_movie->setScaledSize(QSize(frame.width() * height / frame.height(), height));
|
||||
this->setMovie(m_movie);
|
||||
this->setAttribute(Qt::WA_TransparentForMouseEvents); // never block the form
|
||||
this->adjustSize();
|
||||
|
||||
if (conf()->get(Config::reducedMotion).toBool())
|
||||
m_movie->jumpToFrame(0); // still frame
|
||||
else
|
||||
m_movie->start();
|
||||
|
||||
if (parent) {
|
||||
parent->installEventFilter(this);
|
||||
this->reposition();
|
||||
this->raise();
|
||||
}
|
||||
}
|
||||
|
||||
void IdleDoge::reposition() {
|
||||
if (auto *p = parentWidget())
|
||||
this->move(p->width() - this->width() - 14, p->height() - this->height() - 14);
|
||||
}
|
||||
|
||||
bool IdleDoge::eventFilter(QObject *o, QEvent *e) {
|
||||
if (o == parentWidget() && (e->type() == QEvent::Resize || e->type() == QEvent::Show)) {
|
||||
this->reposition();
|
||||
this->raise();
|
||||
}
|
||||
return QLabel::eventFilter(o, e);
|
||||
}
|
||||
@@ -0,0 +1,25 @@
|
||||
// SPDX-License-Identifier: BSD-3-Clause
|
||||
// SPDX-FileCopyrightText: The Monero Project
|
||||
|
||||
#ifndef WOWLET_IDLEDOGE_H
|
||||
#define WOWLET_IDLEDOGE_H
|
||||
|
||||
#include <QLabel>
|
||||
|
||||
class QMovie;
|
||||
|
||||
// wowlet: a small sitting doge that floats, click-through, in the bottom-right
|
||||
// corner of its parent — the "most quiet" ambient idle for task screens (Send,
|
||||
// Receive). Freezes to a still frame when "Prefer reduced motion" is set.
|
||||
class IdleDoge : public QLabel {
|
||||
Q_OBJECT
|
||||
public:
|
||||
explicit IdleDoge(QWidget *parent, int height = 44);
|
||||
protected:
|
||||
bool eventFilter(QObject *o, QEvent *e) override;
|
||||
private:
|
||||
void reposition();
|
||||
QMovie *m_movie;
|
||||
};
|
||||
|
||||
#endif //WOWLET_IDLEDOGE_H
|
||||
@@ -19,12 +19,13 @@ WalletUnlockWidget::WalletUnlockWidget(QWidget *parent, Wallet *wallet)
|
||||
ui->setupUi(this);
|
||||
this->reset();
|
||||
|
||||
// wowlet: ambient scene banner above the unlock form (freezes itself into a
|
||||
// still when "Prefer reduced motion" is set).
|
||||
// wowlet: the lock screen shows the full ambient scene above the unlock form
|
||||
// (this is the idle "screensaver" — the wallet auto-locks here on inactivity).
|
||||
// It freezes into a still when "Prefer reduced motion" is set.
|
||||
auto *scene = new SceneWidget(this);
|
||||
scene->setMinimumHeight(120);
|
||||
scene->setMaximumHeight(140);
|
||||
ui->verticalLayout->insertWidget(0, scene);
|
||||
scene->setMinimumHeight(200);
|
||||
scene->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding);
|
||||
ui->verticalLayout->insertWidget(0, scene, 1);
|
||||
|
||||
ui->buttonBox->button(QDialogButtonBox::Ok)->setAutoDefault(true);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user