mirror of
https://github.com/HifiExperiments/overte.git
synced 2025-06-03 13:01:10 +02:00
fix image provider, couple other things
This commit is contained in:
parent
b8da08ca42
commit
988ee8c8d1
6 changed files with 50 additions and 10 deletions
|
@ -54,6 +54,7 @@ Item {
|
||||||
text: "Testing: Reset Wallet!";
|
text: "Testing: Reset Wallet!";
|
||||||
onClicked: {
|
onClicked: {
|
||||||
commerce.reset();
|
commerce.reset();
|
||||||
|
sendSignalToWallet({method: 'walletReset'});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -107,7 +107,7 @@ Rectangle {
|
||||||
anchors.centerIn: walletSetupLightboxContainer;
|
anchors.centerIn: walletSetupLightboxContainer;
|
||||||
width: walletSetupLightboxContainer.width - 50;
|
width: walletSetupLightboxContainer.width - 50;
|
||||||
height: walletSetupLightboxContainer.height - 50;
|
height: walletSetupLightboxContainer.height - 50;
|
||||||
|
|
||||||
Connections {
|
Connections {
|
||||||
onSendSignalToWallet: {
|
onSendSignalToWallet: {
|
||||||
if (msg.method === 'walletSetup_raiseKeyboard') {
|
if (msg.method === 'walletSetup_raiseKeyboard') {
|
||||||
|
@ -127,7 +127,7 @@ Rectangle {
|
||||||
anchors.centerIn: walletSetupLightboxContainer;
|
anchors.centerIn: walletSetupLightboxContainer;
|
||||||
width: walletSetupLightboxContainer.width - 50;
|
width: walletSetupLightboxContainer.width - 50;
|
||||||
height: walletSetupLightboxContainer.height - 50;
|
height: walletSetupLightboxContainer.height - 50;
|
||||||
|
|
||||||
Connections {
|
Connections {
|
||||||
onSendSignalToWallet: {
|
onSendSignalToWallet: {
|
||||||
sendToScript(msg);
|
sendToScript(msg);
|
||||||
|
@ -196,7 +196,7 @@ Rectangle {
|
||||||
commerce.getLoginStatus();
|
commerce.getLoginStatus();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
NeedsLogIn {
|
NeedsLogIn {
|
||||||
id: needsLogIn;
|
id: needsLogIn;
|
||||||
visible: root.activeView === "needsLogIn";
|
visible: root.activeView === "needsLogIn";
|
||||||
|
@ -225,7 +225,7 @@ Rectangle {
|
||||||
anchors.bottom: tabButtonsContainer.top;
|
anchors.bottom: tabButtonsContainer.top;
|
||||||
anchors.left: parent.left;
|
anchors.left: parent.left;
|
||||||
anchors.right: parent.right;
|
anchors.right: parent.right;
|
||||||
|
|
||||||
Connections {
|
Connections {
|
||||||
onSendSignalToWallet: {
|
onSendSignalToWallet: {
|
||||||
if (msg.method === 'setUpClicked') {
|
if (msg.method === 'setUpClicked') {
|
||||||
|
@ -295,6 +295,14 @@ Rectangle {
|
||||||
anchors.leftMargin: 16;
|
anchors.leftMargin: 16;
|
||||||
anchors.right: parent.right;
|
anchors.right: parent.right;
|
||||||
anchors.rightMargin: 16;
|
anchors.rightMargin: 16;
|
||||||
|
|
||||||
|
Connections {
|
||||||
|
onSendSignalToWallet: {
|
||||||
|
if (msg.method === 'walletReset') {
|
||||||
|
sendToScript(msg);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -509,7 +517,7 @@ Rectangle {
|
||||||
}
|
}
|
||||||
//
|
//
|
||||||
// TAB BUTTONS END
|
// TAB BUTTONS END
|
||||||
//
|
//
|
||||||
|
|
||||||
Item {
|
Item {
|
||||||
id: keyboardContainer;
|
id: keyboardContainer;
|
||||||
|
|
|
@ -14,6 +14,7 @@
|
||||||
#include "Wallet.h"
|
#include "Wallet.h"
|
||||||
#include "Application.h"
|
#include "Application.h"
|
||||||
#include "ui/ImageProvider.h"
|
#include "ui/ImageProvider.h"
|
||||||
|
#include "scripting/HMDScriptingInterface.h"
|
||||||
|
|
||||||
#include <PathUtils.h>
|
#include <PathUtils.h>
|
||||||
#include <OffscreenUi.h>
|
#include <OffscreenUi.h>
|
||||||
|
@ -493,10 +494,21 @@ void Wallet::sendKeyFilePathIfExists() {
|
||||||
|
|
||||||
void Wallet::reset() {
|
void Wallet::reset() {
|
||||||
_publicKeys.clear();
|
_publicKeys.clear();
|
||||||
|
|
||||||
delete _securityImage;
|
delete _securityImage;
|
||||||
|
_securityImage = nullptr;
|
||||||
|
|
||||||
|
// tell the provider we got nothing
|
||||||
|
updateImageProvider();
|
||||||
delete _passphrase;
|
delete _passphrase;
|
||||||
|
|
||||||
|
// for now we need to maintain the hard-coded passphrase.
|
||||||
|
// FIXME: remove this line as part of wiring up the passphrase
|
||||||
|
// and probably set it to nullptr
|
||||||
|
_passphrase = new QString("pwd");
|
||||||
|
|
||||||
QFile keyFile(keyFilePath());
|
QFile keyFile(keyFilePath());
|
||||||
QFile imageFile(imageFilePath());
|
QFile imageFile(imageFilePath());
|
||||||
keyFile.remove();
|
keyFile.remove();
|
||||||
imageFile.remove();
|
imageFile.remove();
|
||||||
}
|
}
|
||||||
|
|
|
@ -18,10 +18,25 @@ const QString ImageProvider::PROVIDER_NAME = "security";
|
||||||
QReadWriteLock ImageProvider::_rwLock;
|
QReadWriteLock ImageProvider::_rwLock;
|
||||||
QPixmap* ImageProvider::_securityImage = nullptr;
|
QPixmap* ImageProvider::_securityImage = nullptr;
|
||||||
|
|
||||||
void ImageProvider::setSecurityImage(QPixmap* pixmap) {
|
ImageProvider::~ImageProvider() {
|
||||||
|
QWriteLocker lock(&_rwLock);
|
||||||
|
if (_securityImage) {
|
||||||
|
delete _securityImage;
|
||||||
|
_securityImage = nullptr;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void ImageProvider::setSecurityImage(const QPixmap* pixmap) {
|
||||||
// no need to delete old one, that is managed by the wallet
|
// no need to delete old one, that is managed by the wallet
|
||||||
QWriteLocker lock(&_rwLock);
|
QWriteLocker lock(&_rwLock);
|
||||||
_securityImage = pixmap;
|
if (_securityImage) {
|
||||||
|
delete _securityImage;
|
||||||
|
}
|
||||||
|
if (pixmap) {
|
||||||
|
_securityImage = new QPixmap(*pixmap);
|
||||||
|
} else {
|
||||||
|
_securityImage = nullptr;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
QPixmap ImageProvider::requestPixmap(const QString& id, QSize* size, const QSize& requestedSize) {
|
QPixmap ImageProvider::requestPixmap(const QString& id, QSize* size, const QSize& requestedSize) {
|
||||||
|
|
|
@ -20,10 +20,10 @@ public:
|
||||||
static const QString PROVIDER_NAME;
|
static const QString PROVIDER_NAME;
|
||||||
|
|
||||||
ImageProvider() : QQuickImageProvider(QQuickImageProvider::Pixmap) {}
|
ImageProvider() : QQuickImageProvider(QQuickImageProvider::Pixmap) {}
|
||||||
|
virtual ~ImageProvider();
|
||||||
QPixmap requestPixmap(const QString& id, QSize* size, const QSize& requestedSize) override;
|
QPixmap requestPixmap(const QString& id, QSize* size, const QSize& requestedSize) override;
|
||||||
|
|
||||||
void setSecurityImage(QPixmap* pixmap);
|
void setSecurityImage(const QPixmap* pixmap);
|
||||||
protected:
|
protected:
|
||||||
static QReadWriteLock _rwLock;
|
static QReadWriteLock _rwLock;
|
||||||
static QPixmap* _securityImage;
|
static QPixmap* _securityImage;
|
||||||
|
|
|
@ -70,6 +70,10 @@
|
||||||
case 'maybeEnableHmdPreview':
|
case 'maybeEnableHmdPreview':
|
||||||
Menu.setIsOptionChecked("Disable Preview", isHmdPreviewDisabled);
|
Menu.setIsOptionChecked("Disable Preview", isHmdPreviewDisabled);
|
||||||
break;
|
break;
|
||||||
|
case 'walletReset':
|
||||||
|
onButtonClicked();
|
||||||
|
onButtonClicked();
|
||||||
|
break;
|
||||||
default:
|
default:
|
||||||
print('Unrecognized message from QML:', JSON.stringify(message));
|
print('Unrecognized message from QML:', JSON.stringify(message));
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue