mirror of
https://github.com/wownero/wowlet.git
synced 2026-10-17 07:11:29 +02:00
feat: 'Prefer reduced motion' setting (accessibility / animation opt-out)
Config::reducedMotion (default false = playful animations ON). Surfaced as a checkbox on first run (wizard PageMenu) and in Settings → Appearance — unchecked by default, matching the OS 'Reduce Motion' convention. The mining tab's AnimatedImages now freeze when it's set (MiningBackend exposes it to mining.qml). Foundation for gating the ambient silliness to come.
This commit is contained in:
@@ -139,6 +139,12 @@ void Settings::setupAppearanceTab() {
|
|||||||
emit updateBalance();
|
emit updateBalance();
|
||||||
});
|
});
|
||||||
|
|
||||||
|
// [Prefer reduced motion] wowlet: gate playful animations (mining tab, loaders, ...)
|
||||||
|
ui->checkBox_reducedMotion->setChecked(conf()->get(Config::reducedMotion).toBool());
|
||||||
|
connect(ui->checkBox_reducedMotion, &QCheckBox::toggled, [this](bool toggled){
|
||||||
|
conf()->set(Config::reducedMotion, toggled);
|
||||||
|
});
|
||||||
|
|
||||||
// [Preferred fiat currency]
|
// [Preferred fiat currency]
|
||||||
QStringList availableFiatCurrencies = appData()->prices.rates.keys();
|
QStringList availableFiatCurrencies = appData()->prices.rates.keys();
|
||||||
for (const auto ¤cy : availableFiatCurrencies) {
|
for (const auto ¤cy : availableFiatCurrencies) {
|
||||||
|
|||||||
@@ -159,6 +159,13 @@
|
|||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
|
<item row="6" column="1">
|
||||||
|
<widget class="QCheckBox" name="checkBox_reducedMotion">
|
||||||
|
<property name="text">
|
||||||
|
<string>Prefer reduced motion (disable playful animations)</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
</layout>
|
</layout>
|
||||||
</item>
|
</item>
|
||||||
</layout>
|
</layout>
|
||||||
|
|||||||
@@ -35,6 +35,7 @@ Rectangle {
|
|||||||
}
|
}
|
||||||
|
|
||||||
AnimatedImage {
|
AnimatedImage {
|
||||||
|
playing: !mining.reducedMotion // wowlet: respect reduced-motion
|
||||||
//visible: mining.daemonMiningState === 0
|
//visible: mining.daemonMiningState === 0
|
||||||
source: "qrc:/mining/bg1.gif"
|
source: "qrc:/mining/bg1.gif"
|
||||||
fillMode: Image.PreserveAspectCrop
|
fillMode: Image.PreserveAspectCrop
|
||||||
@@ -195,6 +196,7 @@ Rectangle {
|
|||||||
}
|
}
|
||||||
|
|
||||||
AnimatedImage {
|
AnimatedImage {
|
||||||
|
playing: !mining.reducedMotion // wowlet: respect reduced-motion
|
||||||
visible: mining.daemonMiningState !== 0
|
visible: mining.daemonMiningState !== 0
|
||||||
source: "qrc:/mining/mining.webp"
|
source: "qrc:/mining/mining.webp"
|
||||||
fillMode: Image.PreserveAspectCrop
|
fillMode: Image.PreserveAspectCrop
|
||||||
@@ -436,6 +438,7 @@ Rectangle {
|
|||||||
smooth: false
|
smooth: false
|
||||||
|
|
||||||
AnimatedImage {
|
AnimatedImage {
|
||||||
|
playing: !mining.reducedMotion // wowlet: respect reduced-motion
|
||||||
source: mining.daemonMiningState === 0 ? "qrc:/assets/images/dog_sitting.gif" : "qrc:/assets/images/dog_running.gif"
|
source: mining.daemonMiningState === 0 ? "qrc:/assets/images/dog_sitting.gif" : "qrc:/assets/images/dog_running.gif"
|
||||||
width: 80
|
width: 80
|
||||||
height: 60
|
height: 60
|
||||||
@@ -546,6 +549,7 @@ Rectangle {
|
|||||||
}
|
}
|
||||||
|
|
||||||
AnimatedImage {
|
AnimatedImage {
|
||||||
|
playing: !mining.reducedMotion // wowlet: respect reduced-motion
|
||||||
visible: mining.daemonMiningState !== 0
|
visible: mining.daemonMiningState !== 0
|
||||||
source: "qrc:/mining/elmo.gif"
|
source: "qrc:/mining/elmo.gif"
|
||||||
width: 106
|
width: 106
|
||||||
|
|||||||
@@ -30,6 +30,7 @@ static const QHash<Config::ConfigKey, ConfigDirective> configStrings = {
|
|||||||
{Config::homeWidget,{QS("homeWidget"), "ccs"}},
|
{Config::homeWidget,{QS("homeWidget"), "ccs"}},
|
||||||
{Config::donateBeg,{QS("donateBeg"), 1}},
|
{Config::donateBeg,{QS("donateBeg"), 1}},
|
||||||
{Config::showHistorySyncNotice, {QS("showHistorySyncNotice"), true}},
|
{Config::showHistorySyncNotice, {QS("showHistorySyncNotice"), true}},
|
||||||
|
{Config::reducedMotion, {QS("reducedMotion"), false}},
|
||||||
|
|
||||||
{Config::geometry, {QS("geometry"), {}}},
|
{Config::geometry, {QS("geometry"), {}}},
|
||||||
{Config::windowState, {QS("windowState"), {}}},
|
{Config::windowState, {QS("windowState"), {}}},
|
||||||
|
|||||||
@@ -29,6 +29,7 @@ public:
|
|||||||
homeWidget,
|
homeWidget,
|
||||||
donateBeg,
|
donateBeg,
|
||||||
showHistorySyncNotice,
|
showHistorySyncNotice,
|
||||||
|
reducedMotion, // wowlet: disable playful animations (accessibility / preference)
|
||||||
|
|
||||||
geometry,
|
geometry,
|
||||||
windowState,
|
windowState,
|
||||||
|
|||||||
@@ -11,6 +11,8 @@
|
|||||||
#include <QThread>
|
#include <QThread>
|
||||||
#include <QDateTime>
|
#include <QDateTime>
|
||||||
|
|
||||||
|
#include "utils/config.h"
|
||||||
|
|
||||||
static QString formatUptime(qint64 secs) {
|
static QString formatUptime(qint64 secs) {
|
||||||
return QString("%1:%2:%3")
|
return QString("%1:%2:%3")
|
||||||
.arg(secs / 3600, 2, 10, QChar('0'))
|
.arg(secs / 3600, 2, 10, QChar('0'))
|
||||||
@@ -29,6 +31,7 @@ MiningWidget::MiningWidget(Wallet *wallet, QWidget *parent)
|
|||||||
layout->setContentsMargins(0, 0, 0, 0);
|
layout->setContentsMargins(0, 0, 0, 0);
|
||||||
layout->addWidget(m_quickWidget);
|
layout->addWidget(m_quickWidget);
|
||||||
|
|
||||||
|
m_backend->setReducedMotion(conf()->get(Config::reducedMotion).toBool());
|
||||||
m_quickWidget->rootContext()->setContextProperty("mining", m_backend);
|
m_quickWidget->rootContext()->setContextProperty("mining", m_backend);
|
||||||
m_quickWidget->setResizeMode(QQuickWidget::SizeRootObjectToView);
|
m_quickWidget->setResizeMode(QQuickWidget::SizeRootObjectToView);
|
||||||
m_quickWidget->setSource(QUrl("qrc:/qml/mining.qml"));
|
m_quickWidget->setSource(QUrl("qrc:/qml/mining.qml"));
|
||||||
|
|||||||
@@ -15,13 +15,17 @@
|
|||||||
class MiningBackend : public QObject {
|
class MiningBackend : public QObject {
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
Q_PROPERTY(int daemonMiningState READ daemonMiningState NOTIFY daemonMiningStateChanged)
|
Q_PROPERTY(int daemonMiningState READ daemonMiningState NOTIFY daemonMiningStateChanged)
|
||||||
|
Q_PROPERTY(bool reducedMotion READ reducedMotion NOTIFY reducedMotionChanged)
|
||||||
public:
|
public:
|
||||||
explicit MiningBackend(QObject *parent = nullptr) : QObject(parent) {}
|
explicit MiningBackend(QObject *parent = nullptr) : QObject(parent) {}
|
||||||
int daemonMiningState() const { return m_state; }
|
int daemonMiningState() const { return m_state; }
|
||||||
void setState(int s) { if (m_state != s) { m_state = s; emit daemonMiningStateChanged(); } }
|
void setState(int s) { if (m_state != s) { m_state = s; emit daemonMiningStateChanged(); } }
|
||||||
|
bool reducedMotion() const { return m_reducedMotion; }
|
||||||
|
void setReducedMotion(bool r) { if (m_reducedMotion != r) { m_reducedMotion = r; emit reducedMotionChanged(); } }
|
||||||
|
|
||||||
signals:
|
signals:
|
||||||
void daemonMiningStateChanged();
|
void daemonMiningStateChanged();
|
||||||
|
void reducedMotionChanged();
|
||||||
void daemonOutput(const QString &line);
|
void daemonOutput(const QString &line);
|
||||||
void syncStatus(int from, int to, int pct);
|
void syncStatus(int from, int to, int pct);
|
||||||
void uptimeChanged(const QString &uptime);
|
void uptimeChanged(const QString &uptime);
|
||||||
@@ -29,6 +33,7 @@ signals:
|
|||||||
|
|
||||||
private:
|
private:
|
||||||
int m_state = 0; // 0:idle 1:startup 2:syncing 3:mining
|
int m_state = 0; // 0:idle 1:startup 2:syncing 3:mining
|
||||||
|
bool m_reducedMotion = false;
|
||||||
};
|
};
|
||||||
|
|
||||||
// wowlet: the pixel-art mining tab. Hosts mining.qml and wires its pick-axe to the wallet's solo
|
// wowlet: the pixel-art mining tab. Hosts mining.qml and wires its pick-axe to the wallet's solo
|
||||||
|
|||||||
@@ -27,6 +27,13 @@ PageMenu::PageMenu(WizardFields *fields, WalletKeysFilesModel *wallets, QWidget
|
|||||||
});
|
});
|
||||||
|
|
||||||
QString settingsSkin = conf()->get(Config::skin).toString();
|
QString settingsSkin = conf()->get(Config::skin).toString();
|
||||||
|
|
||||||
|
// wowlet: reduced-motion opt-out, surfaced on first run (unchecked = playful
|
||||||
|
// animations on, the default). Also lives in Settings → Appearance.
|
||||||
|
ui->checkBox_reducedMotion->setChecked(conf()->get(Config::reducedMotion).toBool());
|
||||||
|
connect(ui->checkBox_reducedMotion, &QCheckBox::toggled, [](bool toggled){
|
||||||
|
conf()->set(Config::reducedMotion, toggled);
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
void PageMenu::initializePage() {
|
void PageMenu::initializePage() {
|
||||||
|
|||||||
@@ -192,6 +192,13 @@
|
|||||||
</layout>
|
</layout>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
|
<item>
|
||||||
|
<widget class="QCheckBox" name="checkBox_reducedMotion">
|
||||||
|
<property name="text">
|
||||||
|
<string>Prefer reduced motion (disable playful animations)</string>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
<item>
|
<item>
|
||||||
<layout class="QVBoxLayout" name="verticalLayout_2">
|
<layout class="QVBoxLayout" name="verticalLayout_2">
|
||||||
<item>
|
<item>
|
||||||
|
|||||||
Reference in New Issue
Block a user