mirror of
https://github.com/wownero/wowlet.git
synced 2026-10-17 07:11:29 +02:00
Reusable SceneWidget (QQuickWidget host) loads scene.qml — dusk sky, tiled grass, running doge, bouncing WOW coins (slowed per feedback), drifting money — and feeds it Config::reducedMotion so it freezes to a still when that's set. First placement: a banner atop the unlock form. Scene rendered & verified at banner + screensaver aspects via local qml6 harness. Assets from wow-lite-wallet (friend's). Home banner / idle screensaver / per-tab idle to follow on the same SceneWidget.
78 lines
2.2 KiB
C++
78 lines
2.2 KiB
C++
// SPDX-License-Identifier: BSD-3-Clause
|
|
// SPDX-FileCopyrightText: The Monero Project
|
|
|
|
#include "WalletUnlockWidget.h"
|
|
#include "ui_WalletUnlockWidget.h"
|
|
|
|
#include <QKeyEvent>
|
|
#include <QPushButton>
|
|
|
|
#include "utils/Utils.h"
|
|
#include "libwalletqt/Wallet.h"
|
|
#include "widgets/SceneWidget.h"
|
|
|
|
WalletUnlockWidget::WalletUnlockWidget(QWidget *parent, Wallet *wallet)
|
|
: QWidget(parent)
|
|
, ui(new Ui::WalletUnlockWidget)
|
|
, m_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).
|
|
auto *scene = new SceneWidget(this);
|
|
scene->setMinimumHeight(120);
|
|
scene->setMaximumHeight(140);
|
|
ui->verticalLayout->insertWidget(0, scene);
|
|
|
|
ui->buttonBox->button(QDialogButtonBox::Ok)->setAutoDefault(true);
|
|
|
|
connect(ui->buttonBox, &QDialogButtonBox::accepted, this, &WalletUnlockWidget::tryUnlock);
|
|
connect(ui->buttonBox, &QDialogButtonBox::rejected, this, &WalletUnlockWidget::closeWallet);
|
|
|
|
ui->frame_sync->hide();
|
|
if (m_wallet) {
|
|
connect(m_wallet, &Wallet::syncStatus, [this](quint64 height, quint64 target, bool daemonSync){
|
|
ui->frame_sync->show();
|
|
ui->label_sync->setText(Utils::formatSyncStatus(height, target, daemonSync));
|
|
});
|
|
}
|
|
}
|
|
|
|
void WalletUnlockWidget::setWalletName(const QString &walletName) {
|
|
ui->label_fileName->setText(walletName);
|
|
}
|
|
|
|
void WalletUnlockWidget::reset() {
|
|
ui->label_incorrectPassword->hide();
|
|
ui->line_password->setText("");
|
|
ui->line_password->setFocus();
|
|
}
|
|
|
|
void WalletUnlockWidget::incorrectPassword() {
|
|
ui->label_incorrectPassword->show();
|
|
ui->line_password->clear();
|
|
}
|
|
|
|
void WalletUnlockWidget::tryUnlock() {
|
|
emit unlockWallet(ui->line_password->text());
|
|
}
|
|
|
|
void WalletUnlockWidget::keyPressEvent(QKeyEvent *e) {
|
|
switch (e->key()) {
|
|
case Qt::Key_Enter:
|
|
case Qt::Key_Return:
|
|
ui->buttonBox->accepted();
|
|
e->ignore();
|
|
break;
|
|
case Qt::Key_Escape:
|
|
ui->buttonBox->rejected();
|
|
e->ignore();
|
|
break;
|
|
default:
|
|
e->ignore();
|
|
}
|
|
}
|
|
|
|
WalletUnlockWidget::~WalletUnlockWidget() = default; |