diff --git a/src/HistoryWidget.cpp b/src/HistoryWidget.cpp index 6f2433b7..b0085b8f 100644 --- a/src/HistoryWidget.cpp +++ b/src/HistoryWidget.cpp @@ -14,6 +14,7 @@ #include "utils/config.h" #include "utils/Icons.h" #include "WebsocketNotifier.h" +#include "widgets/SceneWidget.h" HistoryWidget::HistoryWidget(Wallet *wallet, QWidget *parent) : QWidget(parent) @@ -24,6 +25,13 @@ HistoryWidget::HistoryWidget(Wallet *wallet, QWidget *parent) , m_model(wallet->historyModel()) { ui->setupUi(this); + + // wowlet: History is "home" — the full ambient scene as a top banner. + auto *scene = new SceneWidget(this); + scene->setMinimumHeight(120); + scene->setMaximumHeight(150); + ui->verticalLayout->insertWidget(0, scene); + m_contextMenu->addMenu(m_copyMenu); m_contextMenu->addAction(icons()->icon("info2.svg"), "Show details", this, &HistoryWidget::showTxDetails); m_contextMenu->addAction("View on block explorer", this, &HistoryWidget::onViewOnBlockExplorer); diff --git a/src/ReceiveWidget.cpp b/src/ReceiveWidget.cpp index 01219c0e..45ad3b71 100644 --- a/src/ReceiveWidget.cpp +++ b/src/ReceiveWidget.cpp @@ -12,6 +12,7 @@ #include "utils/config.h" #include "utils/Icons.h" #include "utils/Utils.h" +#include "widgets/IdleDoge.h" ReceiveWidget::ReceiveWidget(Wallet *wallet, QWidget *parent) : QWidget(parent) @@ -20,6 +21,8 @@ ReceiveWidget::ReceiveWidget(Wallet *wallet, QWidget *parent) { ui->setupUi(this); + new IdleDoge(this); // wowlet: whisper-quiet corner critter (freezes when reduced-motion) + m_model = m_wallet->subaddressModel(); m_proxyModel = new SubaddressProxyModel(this, m_wallet->subaddress()); m_proxyModel->setSourceModel(m_model); diff --git a/src/SendWidget.cpp b/src/SendWidget.cpp index dff189e6..1b29a6fa 100644 --- a/src/SendWidget.cpp +++ b/src/SendWidget.cpp @@ -11,6 +11,7 @@ #include "Icons.h" #include "libwalletqt/Wallet.h" #include "libwalletqt/WalletManager.h" +#include "widgets/IdleDoge.h" #if defined(WITH_SCANNER) #include "wizard/offline_tx_signing/OfflineTxSigningWizard.h" @@ -25,6 +26,8 @@ SendWidget::SendWidget(Wallet *wallet, QWidget *parent) { ui->setupUi(this); + new IdleDoge(this); // wowlet: whisper-quiet corner critter (freezes when reduced-motion) + QString amount_rx = R"(^\d{0,8}[\.,]\d{0,12}|(all)$)"; QRegularExpression rx; rx.setPattern(amount_rx); diff --git a/src/widgets/IdleDoge.cpp b/src/widgets/IdleDoge.cpp new file mode 100644 index 00000000..4abd5fb8 --- /dev/null +++ b/src/widgets/IdleDoge.cpp @@ -0,0 +1,46 @@ +// SPDX-License-Identifier: BSD-3-Clause +// SPDX-FileCopyrightText: The Monero Project + +#include "IdleDoge.h" + +#include +#include + +#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); +} diff --git a/src/widgets/IdleDoge.h b/src/widgets/IdleDoge.h new file mode 100644 index 00000000..8f09d241 --- /dev/null +++ b/src/widgets/IdleDoge.h @@ -0,0 +1,25 @@ +// SPDX-License-Identifier: BSD-3-Clause +// SPDX-FileCopyrightText: The Monero Project + +#ifndef WOWLET_IDLEDOGE_H +#define WOWLET_IDLEDOGE_H + +#include + +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 diff --git a/src/widgets/WalletUnlockWidget.cpp b/src/widgets/WalletUnlockWidget.cpp index 6157113f..be4d7530 100644 --- a/src/widgets/WalletUnlockWidget.cpp +++ b/src/widgets/WalletUnlockWidget.cpp @@ -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);