mirror of
https://github.com/HifiExperiments/overte.git
synced 2025-07-23 10:54:26 +02:00
Merge branch 'master' of github.com:highfidelity/hifi into scale-wearables-with-avatar-3
This commit is contained in:
commit
86f58c1353
16 changed files with 263 additions and 62 deletions
|
@ -29,10 +29,6 @@ macro(GENERATE_INSTALLERS)
|
||||||
|
|
||||||
|
|
||||||
if (WIN32)
|
if (WIN32)
|
||||||
# Do not install the Visual Studio C runtime libraries. The installer will do this automatically
|
|
||||||
set(CMAKE_INSTALL_SYSTEM_RUNTIME_LIBS_SKIP TRUE)
|
|
||||||
|
|
||||||
include(InstallRequiredSystemLibraries)
|
|
||||||
set(CPACK_NSIS_MUI_ICON "${HF_CMAKE_DIR}/installer/installer.ico")
|
set(CPACK_NSIS_MUI_ICON "${HF_CMAKE_DIR}/installer/installer.ico")
|
||||||
|
|
||||||
# install and reference the Add/Remove icon
|
# install and reference the Add/Remove icon
|
||||||
|
@ -49,6 +45,10 @@ macro(GENERATE_INSTALLERS)
|
||||||
set(_UNINSTALLER_HEADER_BAD_PATH "${HF_CMAKE_DIR}/installer/uninstaller-header.bmp")
|
set(_UNINSTALLER_HEADER_BAD_PATH "${HF_CMAKE_DIR}/installer/uninstaller-header.bmp")
|
||||||
set(UNINSTALLER_HEADER_IMAGE "")
|
set(UNINSTALLER_HEADER_IMAGE "")
|
||||||
fix_path_for_nsis(${_UNINSTALLER_HEADER_BAD_PATH} UNINSTALLER_HEADER_IMAGE)
|
fix_path_for_nsis(${_UNINSTALLER_HEADER_BAD_PATH} UNINSTALLER_HEADER_IMAGE)
|
||||||
|
|
||||||
|
# grab the latest VC redist (2017) and add it to the installer, our NSIS template
|
||||||
|
# will call it during the install
|
||||||
|
install(CODE "file(DOWNLOAD https://go.microsoft.com/fwlink/?LinkId=746572 \"\${CMAKE_INSTALL_PREFIX}/vcredist_x64.exe\")")
|
||||||
elseif (APPLE)
|
elseif (APPLE)
|
||||||
# produce a drag and drop DMG on OS X
|
# produce a drag and drop DMG on OS X
|
||||||
set(CPACK_GENERATOR "DragNDrop")
|
set(CPACK_GENERATOR "DragNDrop")
|
||||||
|
@ -84,4 +84,3 @@ macro(GENERATE_INSTALLERS)
|
||||||
|
|
||||||
include(CPack)
|
include(CPack)
|
||||||
endmacro()
|
endmacro()
|
||||||
|
|
||||||
|
|
|
@ -45,5 +45,4 @@ else()
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
file(GLOB EXTRA_PLUGINS "${BUNDLE_PLUGIN_DIR}/*.${PLUGIN_EXTENSION}")
|
file(GLOB EXTRA_PLUGINS "${BUNDLE_PLUGIN_DIR}/*.${PLUGIN_EXTENSION}")
|
||||||
fixup_bundle("${BUNDLE_EXECUTABLE}" "${EXTRA_PLUGINS}" "@FIXUP_LIBS@")
|
fixup_bundle("${BUNDLE_EXECUTABLE}" "${EXTRA_PLUGINS}" "@FIXUP_LIBS@" IGNORE_ITEM "vcredist_x86.exe;vcredist_x64.exe")
|
||||||
|
|
||||||
|
|
|
@ -79,10 +79,12 @@ Rectangle {
|
||||||
if (result.status !== 'success') {
|
if (result.status !== 'success') {
|
||||||
failureErrorText.text = result.message;
|
failureErrorText.text = result.message;
|
||||||
root.activeView = "checkoutFailure";
|
root.activeView = "checkoutFailure";
|
||||||
|
UserActivityLogger.commercePurchaseFailure(root.itemId, root.itemPrice, !root.alreadyOwned, result.message);
|
||||||
} else {
|
} else {
|
||||||
root.itemHref = result.data.download_url;
|
root.itemHref = result.data.download_url;
|
||||||
root.isWearable = result.data.categories.indexOf("Wearables") > -1;
|
root.isWearable = result.data.categories.indexOf("Wearables") > -1;
|
||||||
root.activeView = "checkoutSuccess";
|
root.activeView = "checkoutSuccess";
|
||||||
|
UserActivityLogger.commercePurchaseSuccess(root.itemId, root.itemPrice, !root.alreadyOwned);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -599,6 +601,7 @@ Rectangle {
|
||||||
sendToScript({method: 'checkout_rezClicked', itemHref: root.itemHref, isWearable: root.isWearable});
|
sendToScript({method: 'checkout_rezClicked', itemHref: root.itemHref, isWearable: root.isWearable});
|
||||||
rezzedNotifContainer.visible = true;
|
rezzedNotifContainer.visible = true;
|
||||||
rezzedNotifContainerTimer.start();
|
rezzedNotifContainerTimer.start();
|
||||||
|
UserActivityLogger.commerceEntityRezzed(root.itemId, "checkout", root.isWearable ? "rez" : "wear");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
RalewaySemiBold {
|
RalewaySemiBold {
|
||||||
|
|
|
@ -349,6 +349,7 @@ Item {
|
||||||
sendToPurchases({method: 'purchases_rezClicked', itemHref: root.itemHref, isWearable: root.isWearable});
|
sendToPurchases({method: 'purchases_rezClicked', itemHref: root.itemHref, isWearable: root.isWearable});
|
||||||
rezzedNotifContainer.visible = true;
|
rezzedNotifContainer.visible = true;
|
||||||
rezzedNotifContainerTimer.start();
|
rezzedNotifContainerTimer.start();
|
||||||
|
UserActivityLogger.commerceEntityRezzed(root.itemId, "purchases", root.isWearable ? "rez" : "wear");
|
||||||
}
|
}
|
||||||
|
|
||||||
style: ButtonStyle {
|
style: ButtonStyle {
|
||||||
|
|
|
@ -48,6 +48,11 @@ Rectangle {
|
||||||
if (root.activeView !== "walletSetup") {
|
if (root.activeView !== "walletSetup") {
|
||||||
root.activeView = "walletSetup";
|
root.activeView = "walletSetup";
|
||||||
commerce.resetLocalWalletOnly();
|
commerce.resetLocalWalletOnly();
|
||||||
|
var timestamp = new Date();
|
||||||
|
walletSetup.startingTimestamp = timestamp;
|
||||||
|
walletSetup.setupAttemptID = generateUUID();
|
||||||
|
UserActivityLogger.commerceWalletSetupStarted(timestamp, setupAttemptID, walletSetup.setupFlowVersion, walletSetup.referrer ? walletSetup.referrer : "wallet app",
|
||||||
|
(AddressManager.placename || AddressManager.hostname || '') + (AddressManager.pathname ? AddressManager.pathname.match(/\/[^\/]+/)[0] : ''));
|
||||||
}
|
}
|
||||||
} else if (walletStatus === 2) {
|
} else if (walletStatus === 2) {
|
||||||
if (root.activeView !== "passphraseModal") {
|
if (root.activeView !== "passphraseModal") {
|
||||||
|
@ -173,7 +178,7 @@ Rectangle {
|
||||||
Connections {
|
Connections {
|
||||||
onSendSignalToWallet: {
|
onSendSignalToWallet: {
|
||||||
if (msg.method === 'walletSetup_finished') {
|
if (msg.method === 'walletSetup_finished') {
|
||||||
if (msg.referrer === '') {
|
if (msg.referrer === '' || msg.referrer === 'marketplace cta') {
|
||||||
root.activeView = "initialize";
|
root.activeView = "initialize";
|
||||||
commerce.getWalletStatus();
|
commerce.getWalletStatus();
|
||||||
} else if (msg.referrer === 'purchases') {
|
} else if (msg.referrer === 'purchases') {
|
||||||
|
@ -701,12 +706,28 @@ Rectangle {
|
||||||
case 'updateWalletReferrer':
|
case 'updateWalletReferrer':
|
||||||
walletSetup.referrer = message.referrer;
|
walletSetup.referrer = message.referrer;
|
||||||
break;
|
break;
|
||||||
|
case 'inspectionCertificate_resetCert':
|
||||||
|
// NOP
|
||||||
|
break;
|
||||||
default:
|
default:
|
||||||
console.log('Unrecognized message from wallet.js:', JSON.stringify(message));
|
console.log('Unrecognized message from wallet.js:', JSON.stringify(message));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
signal sendToScript(var message);
|
signal sendToScript(var message);
|
||||||
|
|
||||||
|
// generateUUID() taken from:
|
||||||
|
// https://stackoverflow.com/a/8809472
|
||||||
|
function generateUUID() { // Public Domain/MIT
|
||||||
|
var d = new Date().getTime();
|
||||||
|
if (typeof performance !== 'undefined' && typeof performance.now === 'function'){
|
||||||
|
d += performance.now(); //use high-precision timer if available
|
||||||
|
}
|
||||||
|
return 'xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx'.replace(/[xy]/g, function (c) {
|
||||||
|
var r = (d + Math.random() * 16) % 16 | 0;
|
||||||
|
d = Math.floor(d / 16);
|
||||||
|
return (c === 'x' ? r : (r & 0x3 | 0x8)).toString(16);
|
||||||
|
});
|
||||||
|
}
|
||||||
//
|
//
|
||||||
// FUNCTION DEFINITIONS END
|
// FUNCTION DEFINITIONS END
|
||||||
//
|
//
|
||||||
|
|
|
@ -31,6 +31,10 @@ Item {
|
||||||
property bool hasShownSecurityImageTip: false;
|
property bool hasShownSecurityImageTip: false;
|
||||||
property string referrer;
|
property string referrer;
|
||||||
property string keyFilePath;
|
property string keyFilePath;
|
||||||
|
property date startingTimestamp;
|
||||||
|
property string setupAttemptID;
|
||||||
|
readonly property int setupFlowVersion: 1;
|
||||||
|
readonly property var setupStepNames: [ "Setup Prompt", "Security Image Selection", "Passphrase Selection", "Private Keys Ready" ];
|
||||||
|
|
||||||
Image {
|
Image {
|
||||||
anchors.fill: parent;
|
anchors.fill: parent;
|
||||||
|
@ -67,6 +71,13 @@ Item {
|
||||||
anchors.fill: parent;
|
anchors.fill: parent;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
onActiveViewChanged: {
|
||||||
|
var timestamp = new Date();
|
||||||
|
var currentStepNumber = root.activeView.substring(5);
|
||||||
|
UserActivityLogger.commerceWalletSetupProgress(timestamp, root.setupAttemptID,
|
||||||
|
Math.round((timestamp - root.startingTimestamp)/1000), currentStepNumber, root.setupStepNames[currentStepNumber - 1]);
|
||||||
|
}
|
||||||
|
|
||||||
//
|
//
|
||||||
// TITLE BAR START
|
// TITLE BAR START
|
||||||
//
|
//
|
||||||
|
@ -730,6 +741,9 @@ Item {
|
||||||
root.visible = false;
|
root.visible = false;
|
||||||
root.hasShownSecurityImageTip = false;
|
root.hasShownSecurityImageTip = false;
|
||||||
sendSignalToWallet({method: 'walletSetup_finished', referrer: root.referrer ? root.referrer : ""});
|
sendSignalToWallet({method: 'walletSetup_finished', referrer: root.referrer ? root.referrer : ""});
|
||||||
|
|
||||||
|
var timestamp = new Date();
|
||||||
|
UserActivityLogger.commerceWalletSetupFinished(timestamp, setupAttemptID, Math.round((timestamp - root.startingTimestamp)/1000));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -7075,11 +7075,11 @@ QRect Application::getRecommendedHUDRect() const {
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
QSize Application::getDeviceSize() const {
|
glm::vec2 Application::getDeviceSize() const {
|
||||||
static const int MIN_SIZE = 1;
|
static const int MIN_SIZE = 1;
|
||||||
QSize result(MIN_SIZE, MIN_SIZE);
|
glm::vec2 result(MIN_SIZE);
|
||||||
if (_displayPlugin) {
|
if (_displayPlugin) {
|
||||||
result = fromGlm(getActiveDisplayPlugin()->getRecommendedRenderSize());
|
result = getActiveDisplayPlugin()->getRecommendedRenderSize();
|
||||||
}
|
}
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
@ -7098,10 +7098,6 @@ bool Application::hasFocus() const {
|
||||||
return (QApplication::activeWindow() != nullptr);
|
return (QApplication::activeWindow() != nullptr);
|
||||||
}
|
}
|
||||||
|
|
||||||
glm::vec2 Application::getViewportDimensions() const {
|
|
||||||
return toGlm(getDeviceSize());
|
|
||||||
}
|
|
||||||
|
|
||||||
void Application::setMaxOctreePacketsPerSecond(int maxOctreePPS) {
|
void Application::setMaxOctreePacketsPerSecond(int maxOctreePPS) {
|
||||||
if (maxOctreePPS != _maxOctreePPS) {
|
if (maxOctreePPS != _maxOctreePPS) {
|
||||||
_maxOctreePPS = maxOctreePPS;
|
_maxOctreePPS = maxOctreePPS;
|
||||||
|
|
|
@ -158,7 +158,7 @@ public:
|
||||||
|
|
||||||
glm::uvec2 getUiSize() const;
|
glm::uvec2 getUiSize() const;
|
||||||
QRect getRecommendedHUDRect() const;
|
QRect getRecommendedHUDRect() const;
|
||||||
QSize getDeviceSize() const;
|
glm::vec2 getDeviceSize() const;
|
||||||
bool hasFocus() const;
|
bool hasFocus() const;
|
||||||
|
|
||||||
void showCursor(const Cursor::Icon& cursor);
|
void showCursor(const Cursor::Icon& cursor);
|
||||||
|
@ -228,8 +228,6 @@ public:
|
||||||
|
|
||||||
FileLogger* getLogger() const { return _logger; }
|
FileLogger* getLogger() const { return _logger; }
|
||||||
|
|
||||||
glm::vec2 getViewportDimensions() const;
|
|
||||||
|
|
||||||
NodeToJurisdictionMap& getEntityServerJurisdictions() { return _entityServerJurisdictions; }
|
NodeToJurisdictionMap& getEntityServerJurisdictions() { return _entityServerJurisdictions; }
|
||||||
|
|
||||||
float getRenderResolutionScale() const;
|
float getRenderResolutionScale() const;
|
||||||
|
|
|
@ -104,8 +104,7 @@ void Application::paintGL() {
|
||||||
PerformanceTimer perfTimer("renderOverlay");
|
PerformanceTimer perfTimer("renderOverlay");
|
||||||
// NOTE: There is no batch associated with this renderArgs
|
// NOTE: There is no batch associated with this renderArgs
|
||||||
// the ApplicationOverlay class assumes it's viewport is setup to be the device size
|
// the ApplicationOverlay class assumes it's viewport is setup to be the device size
|
||||||
QSize size = getDeviceSize();
|
renderArgs._viewport = glm::ivec4(0, 0, getDeviceSize());
|
||||||
renderArgs._viewport = glm::ivec4(0, 0, size.width(), size.height());
|
|
||||||
_applicationOverlay.renderOverlay(&renderArgs);
|
_applicationOverlay.renderOverlay(&renderArgs);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -176,6 +176,10 @@ bool WindowScriptingInterface::isPointOnDesktopWindow(QVariant point) {
|
||||||
return offscreenUi->isPointOnDesktopWindow(point);
|
return offscreenUi->isPointOnDesktopWindow(point);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
glm::vec2 WindowScriptingInterface::getDeviceSize() const {
|
||||||
|
return qApp->getDeviceSize();
|
||||||
|
}
|
||||||
|
|
||||||
/// Makes sure that the reticle is visible, use this in blocking forms that require a reticle and
|
/// Makes sure that the reticle is visible, use this in blocking forms that require a reticle and
|
||||||
/// might be in same thread as a script that sets the reticle to invisible
|
/// might be in same thread as a script that sets the reticle to invisible
|
||||||
void WindowScriptingInterface::ensureReticleVisible() const {
|
void WindowScriptingInterface::ensureReticleVisible() const {
|
||||||
|
|
|
@ -12,6 +12,8 @@
|
||||||
#ifndef hifi_WindowScriptingInterface_h
|
#ifndef hifi_WindowScriptingInterface_h
|
||||||
#define hifi_WindowScriptingInterface_h
|
#define hifi_WindowScriptingInterface_h
|
||||||
|
|
||||||
|
#include <glm/glm.hpp>
|
||||||
|
|
||||||
#include <QtCore/QObject>
|
#include <QtCore/QObject>
|
||||||
#include <QtCore/QString>
|
#include <QtCore/QString>
|
||||||
#include <QtQuick/QQuickItem>
|
#include <QtQuick/QQuickItem>
|
||||||
|
@ -73,6 +75,7 @@ public slots:
|
||||||
bool isPhysicsEnabled();
|
bool isPhysicsEnabled();
|
||||||
bool setDisplayTexture(const QString& name);
|
bool setDisplayTexture(const QString& name);
|
||||||
bool isPointOnDesktopWindow(QVariant point);
|
bool isPointOnDesktopWindow(QVariant point);
|
||||||
|
glm::vec2 getDeviceSize() const;
|
||||||
|
|
||||||
int openMessageBox(QString title, QString text, int buttons, int defaultButton);
|
int openMessageBox(QString title, QString text, int buttons, int defaultButton);
|
||||||
void updateMessageBox(int id, QString title, QString text, int buttons, int defaultButton);
|
void updateMessageBox(int id, QString title, QString text, int buttons, int defaultButton);
|
||||||
|
|
|
@ -88,3 +88,56 @@ void UserActivityLoggerScriptingInterface::doLogAction(QString action, QJsonObje
|
||||||
Q_ARG(QString, action),
|
Q_ARG(QString, action),
|
||||||
Q_ARG(QJsonObject, details));
|
Q_ARG(QJsonObject, details));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void UserActivityLoggerScriptingInterface::commercePurchaseSuccess(QString marketplaceID, int cost, bool firstPurchaseOfThisItem) {
|
||||||
|
QJsonObject payload;
|
||||||
|
payload["marketplaceID"] = marketplaceID;
|
||||||
|
payload["cost"] = cost;
|
||||||
|
payload["firstPurchaseOfThisItem"] = firstPurchaseOfThisItem;
|
||||||
|
doLogAction("commercePurchaseSuccess", payload);
|
||||||
|
}
|
||||||
|
|
||||||
|
void UserActivityLoggerScriptingInterface::commercePurchaseFailure(QString marketplaceID, int cost, bool firstPurchaseOfThisItem, QString errorDetails) {
|
||||||
|
QJsonObject payload;
|
||||||
|
payload["marketplaceID"] = marketplaceID;
|
||||||
|
payload["cost"] = cost;
|
||||||
|
payload["firstPurchaseOfThisItem"] = firstPurchaseOfThisItem;
|
||||||
|
payload["errorDetails"] = errorDetails;
|
||||||
|
doLogAction("commercePurchaseFailure", payload);
|
||||||
|
}
|
||||||
|
|
||||||
|
void UserActivityLoggerScriptingInterface::commerceEntityRezzed(QString marketplaceID, QString source, QString type) {
|
||||||
|
QJsonObject payload;
|
||||||
|
payload["marketplaceID"] = marketplaceID;
|
||||||
|
payload["source"] = source;
|
||||||
|
payload["type"] = type;
|
||||||
|
doLogAction("commerceEntityRezzed", payload);
|
||||||
|
}
|
||||||
|
|
||||||
|
void UserActivityLoggerScriptingInterface::commerceWalletSetupStarted(int timestamp, QString setupAttemptID, int setupFlowVersion, QString referrer, QString currentDomain) {
|
||||||
|
QJsonObject payload;
|
||||||
|
payload["timestamp"] = timestamp;
|
||||||
|
payload["setupAttemptID"] = setupAttemptID;
|
||||||
|
payload["setupFlowVersion"] = setupFlowVersion;
|
||||||
|
payload["referrer"] = referrer;
|
||||||
|
payload["currentDomain"] = currentDomain;
|
||||||
|
doLogAction("commerceWalletSetupStarted", payload);
|
||||||
|
}
|
||||||
|
|
||||||
|
void UserActivityLoggerScriptingInterface::commerceWalletSetupProgress(int timestamp, QString setupAttemptID, int secondsElapsed, int currentStepNumber, QString currentStepName) {
|
||||||
|
QJsonObject payload;
|
||||||
|
payload["timestamp"] = timestamp;
|
||||||
|
payload["setupAttemptID"] = setupAttemptID;
|
||||||
|
payload["secondsElapsed"] = secondsElapsed;
|
||||||
|
payload["currentStepNumber"] = currentStepNumber;
|
||||||
|
payload["currentStepName"] = currentStepName;
|
||||||
|
doLogAction("commerceWalletSetupProgress", payload);
|
||||||
|
}
|
||||||
|
|
||||||
|
void UserActivityLoggerScriptingInterface::commerceWalletSetupFinished(int timestamp, QString setupAttemptID, int secondsToComplete) {
|
||||||
|
QJsonObject payload;
|
||||||
|
payload["timestamp"] = timestamp;
|
||||||
|
payload["setupAttemptID"] = setupAttemptID;
|
||||||
|
payload["secondsToComplete"] = secondsToComplete;
|
||||||
|
doLogAction("commerceWalletSetupFinished", payload);
|
||||||
|
}
|
||||||
|
|
|
@ -33,6 +33,12 @@ public:
|
||||||
Q_INVOKABLE void bubbleToggled(bool newValue);
|
Q_INVOKABLE void bubbleToggled(bool newValue);
|
||||||
Q_INVOKABLE void bubbleActivated();
|
Q_INVOKABLE void bubbleActivated();
|
||||||
Q_INVOKABLE void logAction(QString action, QVariantMap details = QVariantMap{});
|
Q_INVOKABLE void logAction(QString action, QVariantMap details = QVariantMap{});
|
||||||
|
Q_INVOKABLE void commercePurchaseSuccess(QString marketplaceID, int cost, bool firstPurchaseOfThisItem);
|
||||||
|
Q_INVOKABLE void commercePurchaseFailure(QString marketplaceID, int cost, bool firstPurchaseOfThisItem, QString errorDetails);
|
||||||
|
Q_INVOKABLE void commerceEntityRezzed(QString marketplaceID, QString source, QString type);
|
||||||
|
Q_INVOKABLE void commerceWalletSetupStarted(int timestamp, QString setupAttemptID, int setupFlowVersion, QString referrer, QString currentDomain);
|
||||||
|
Q_INVOKABLE void commerceWalletSetupProgress(int timestamp, QString setupAttemptID, int secondsElapsed, int currentStepNumber, QString currentStepName);
|
||||||
|
Q_INVOKABLE void commerceWalletSetupFinished(int timestamp, QString setupAttemptID, int secondsToComplete);
|
||||||
private:
|
private:
|
||||||
void doLogAction(QString action, QJsonObject details = {});
|
void doLogAction(QString action, QJsonObject details = {});
|
||||||
};
|
};
|
||||||
|
|
|
@ -32,23 +32,23 @@ void Transaction::removeItem(ItemID id) {
|
||||||
}
|
}
|
||||||
|
|
||||||
void Transaction::addTransitionToItem(ItemID id, Transition::Type transition, ItemID boundId) {
|
void Transaction::addTransitionToItem(ItemID id, Transition::Type transition, ItemID boundId) {
|
||||||
_addedTransitions.emplace_back(TransitionAdd{ id, transition, boundId });
|
_addedTransitions.emplace_back(id, transition, boundId);
|
||||||
}
|
}
|
||||||
|
|
||||||
void Transaction::removeTransitionFromItem(ItemID id) {
|
void Transaction::removeTransitionFromItem(ItemID id) {
|
||||||
_addedTransitions.emplace_back(TransitionAdd{ id, Transition::NONE, render::Item::INVALID_ITEM_ID });
|
_addedTransitions.emplace_back(id, Transition::NONE, render::Item::INVALID_ITEM_ID);
|
||||||
}
|
}
|
||||||
|
|
||||||
void Transaction::reApplyTransitionToItem(ItemID id) {
|
void Transaction::reApplyTransitionToItem(ItemID id) {
|
||||||
_reAppliedTransitions.emplace_back(TransitionReApply{ id });
|
_reAppliedTransitions.emplace_back(id);
|
||||||
}
|
}
|
||||||
|
|
||||||
void Transaction::queryTransitionOnItem(ItemID id, TransitionQueryFunc func) {
|
void Transaction::queryTransitionOnItem(ItemID id, TransitionQueryFunc func) {
|
||||||
_queriedTransitions.emplace_back(TransitionQuery{ id, func });
|
_queriedTransitions.emplace_back(id, func);
|
||||||
}
|
}
|
||||||
|
|
||||||
void Transaction::updateItem(ItemID id, const UpdateFunctorPointer& functor) {
|
void Transaction::updateItem(ItemID id, const UpdateFunctorPointer& functor) {
|
||||||
_updatedItems.emplace_back(Update{ id, functor });
|
_updatedItems.emplace_back(id, functor);
|
||||||
}
|
}
|
||||||
|
|
||||||
void Transaction::resetSelection(const Selection& selection) {
|
void Transaction::resetSelection(const Selection& selection) {
|
||||||
|
@ -56,28 +56,122 @@ void Transaction::resetSelection(const Selection& selection) {
|
||||||
}
|
}
|
||||||
|
|
||||||
void Transaction::resetSelectionHighlight(const std::string& selectionName, const HighlightStyle& style) {
|
void Transaction::resetSelectionHighlight(const std::string& selectionName, const HighlightStyle& style) {
|
||||||
_highlightResets.emplace_back(HighlightReset{ selectionName, style });
|
_highlightResets.emplace_back(selectionName, style );
|
||||||
}
|
}
|
||||||
|
|
||||||
void Transaction::removeHighlightFromSelection(const std::string& selectionName) {
|
void Transaction::removeHighlightFromSelection(const std::string& selectionName) {
|
||||||
_highlightRemoves.emplace_back(selectionName);
|
_highlightRemoves.emplace_back(selectionName);
|
||||||
}
|
}
|
||||||
|
|
||||||
void Transaction::querySelectionHighlight(const std::string& selectionName, SelectionHighlightQueryFunc func) {
|
void Transaction::querySelectionHighlight(const std::string& selectionName, const SelectionHighlightQueryFunc& func) {
|
||||||
_highlightQueries.emplace_back(HighlightQuery{ selectionName, func });
|
_highlightQueries.emplace_back(selectionName, func);
|
||||||
|
}
|
||||||
|
|
||||||
|
void Transaction::reserve(const std::vector<Transaction>& transactionContainer) {
|
||||||
|
size_t resetItemsCount = 0;
|
||||||
|
size_t removedItemsCount = 0;
|
||||||
|
size_t updatedItemsCount = 0;
|
||||||
|
size_t resetSelectionsCount = 0;
|
||||||
|
size_t addedTransitionsCount = 0;
|
||||||
|
size_t queriedTransitionsCount = 0;
|
||||||
|
size_t reAppliedTransitionsCount = 0;
|
||||||
|
size_t highlightResetsCount = 0;
|
||||||
|
size_t highlightRemovesCount = 0;
|
||||||
|
size_t highlightQueriesCount = 0;
|
||||||
|
|
||||||
|
for (const auto& transaction : transactionContainer) {
|
||||||
|
resetItemsCount += transaction._resetItems.size();
|
||||||
|
removedItemsCount += transaction._removedItems.size();
|
||||||
|
updatedItemsCount += transaction._updatedItems.size();
|
||||||
|
resetSelectionsCount += transaction._resetSelections.size();
|
||||||
|
addedTransitionsCount += transaction._addedTransitions.size();
|
||||||
|
queriedTransitionsCount += transaction._queriedTransitions.size();
|
||||||
|
reAppliedTransitionsCount += transaction._reAppliedTransitions.size();
|
||||||
|
highlightResetsCount += transaction._highlightResets.size();
|
||||||
|
highlightRemovesCount += transaction._highlightRemoves.size();
|
||||||
|
highlightQueriesCount += transaction._highlightQueries.size();
|
||||||
|
}
|
||||||
|
|
||||||
|
_resetItems.reserve(resetItemsCount);
|
||||||
|
_removedItems.reserve(removedItemsCount);
|
||||||
|
_updatedItems.reserve(updatedItemsCount);
|
||||||
|
_resetSelections.reserve(resetSelectionsCount);
|
||||||
|
_addedTransitions.reserve(addedTransitionsCount);
|
||||||
|
_queriedTransitions.reserve(queriedTransitionsCount);
|
||||||
|
_reAppliedTransitions.reserve(reAppliedTransitionsCount);
|
||||||
|
_highlightResets.reserve(highlightResetsCount);
|
||||||
|
_highlightRemoves.reserve(highlightRemovesCount);
|
||||||
|
_highlightQueries.reserve(highlightQueriesCount);
|
||||||
|
}
|
||||||
|
|
||||||
|
void Transaction::merge(const std::vector<Transaction>& transactionContainer) {
|
||||||
|
reserve(transactionContainer);
|
||||||
|
for (const auto& transaction : transactionContainer) {
|
||||||
|
merge(transaction);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void Transaction::merge(std::vector<Transaction>&& transactionContainer) {
|
||||||
|
reserve(transactionContainer);
|
||||||
|
auto begin = std::make_move_iterator(transactionContainer.begin());
|
||||||
|
auto end = std::make_move_iterator(transactionContainer.end());
|
||||||
|
for (auto itr = begin; itr != end; ++itr) {
|
||||||
|
merge(*itr);
|
||||||
|
}
|
||||||
|
transactionContainer.clear();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
template <typename T>
|
||||||
|
void moveElements(T& target, T& source) {
|
||||||
|
target.insert(target.end(), std::make_move_iterator(source.begin()), std::make_move_iterator(source.end()));
|
||||||
|
source.clear();
|
||||||
|
}
|
||||||
|
|
||||||
|
template <typename T>
|
||||||
|
void copyElements(T& target, const T& source) {
|
||||||
|
target.insert(target.end(), source.begin(), source.end());
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void Transaction::merge(Transaction&& transaction) {
|
||||||
|
moveElements(_resetItems, transaction._resetItems);
|
||||||
|
moveElements(_removedItems, transaction._removedItems);
|
||||||
|
moveElements(_updatedItems, transaction._updatedItems);
|
||||||
|
moveElements(_resetSelections, transaction._resetSelections);
|
||||||
|
moveElements(_addedTransitions, transaction._addedTransitions);
|
||||||
|
moveElements(_queriedTransitions, transaction._queriedTransitions);
|
||||||
|
moveElements(_reAppliedTransitions, transaction._reAppliedTransitions);
|
||||||
|
moveElements(_highlightResets, transaction._highlightResets);
|
||||||
|
moveElements(_highlightRemoves, transaction._highlightRemoves);
|
||||||
|
moveElements(_highlightQueries, transaction._highlightQueries);
|
||||||
}
|
}
|
||||||
|
|
||||||
void Transaction::merge(const Transaction& transaction) {
|
void Transaction::merge(const Transaction& transaction) {
|
||||||
_resetItems.insert(_resetItems.end(), transaction._resetItems.begin(), transaction._resetItems.end());
|
copyElements(_resetItems, transaction._resetItems);
|
||||||
_removedItems.insert(_removedItems.end(), transaction._removedItems.begin(), transaction._removedItems.end());
|
copyElements(_removedItems, transaction._removedItems);
|
||||||
_updatedItems.insert(_updatedItems.end(), transaction._updatedItems.begin(), transaction._updatedItems.end());
|
copyElements(_updatedItems, transaction._updatedItems);
|
||||||
_resetSelections.insert(_resetSelections.end(), transaction._resetSelections.begin(), transaction._resetSelections.end());
|
copyElements(_resetSelections, transaction._resetSelections);
|
||||||
_addedTransitions.insert(_addedTransitions.end(), transaction._addedTransitions.begin(), transaction._addedTransitions.end());
|
copyElements(_addedTransitions, transaction._addedTransitions);
|
||||||
_queriedTransitions.insert(_queriedTransitions.end(), transaction._queriedTransitions.begin(), transaction._queriedTransitions.end());
|
copyElements(_queriedTransitions, transaction._queriedTransitions);
|
||||||
_reAppliedTransitions.insert(_reAppliedTransitions.end(), transaction._reAppliedTransitions.begin(), transaction._reAppliedTransitions.end());
|
copyElements(_reAppliedTransitions, transaction._reAppliedTransitions);
|
||||||
_highlightResets.insert(_highlightResets.end(), transaction._highlightResets.begin(), transaction._highlightResets.end());
|
copyElements(_highlightResets, transaction._highlightResets);
|
||||||
_highlightRemoves.insert(_highlightRemoves.end(), transaction._highlightRemoves.begin(), transaction._highlightRemoves.end());
|
copyElements(_highlightRemoves, transaction._highlightRemoves);
|
||||||
_highlightQueries.insert(_highlightQueries.end(), transaction._highlightQueries.begin(), transaction._highlightQueries.end());
|
copyElements(_highlightQueries, transaction._highlightQueries);
|
||||||
|
}
|
||||||
|
|
||||||
|
void Transaction::clear() {
|
||||||
|
_resetItems.clear();
|
||||||
|
_removedItems.clear();
|
||||||
|
_updatedItems.clear();
|
||||||
|
_resetSelections.clear();
|
||||||
|
_addedTransitions.clear();
|
||||||
|
_queriedTransitions.clear();
|
||||||
|
_reAppliedTransitions.clear();
|
||||||
|
_highlightResets.clear();
|
||||||
|
_highlightRemoves.clear();
|
||||||
|
_highlightQueries.clear();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -102,54 +196,50 @@ bool Scene::isAllocatedID(const ItemID& id) const {
|
||||||
|
|
||||||
/// Enqueue change batch to the scene
|
/// Enqueue change batch to the scene
|
||||||
void Scene::enqueueTransaction(const Transaction& transaction) {
|
void Scene::enqueueTransaction(const Transaction& transaction) {
|
||||||
_transactionQueueMutex.lock();
|
std::unique_lock<std::mutex> lock(_transactionQueueMutex);
|
||||||
_transactionQueue.push(transaction);
|
_transactionQueue.emplace_back(transaction);
|
||||||
_transactionQueueMutex.unlock();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void consolidateTransaction(TransactionQueue& queue, Transaction& singleBatch) {
|
void Scene::enqueueTransaction(Transaction&& transaction) {
|
||||||
while (!queue.empty()) {
|
std::unique_lock<std::mutex> lock(_transactionQueueMutex);
|
||||||
const auto& transaction = queue.front();
|
_transactionQueue.emplace_back(std::move(transaction));
|
||||||
singleBatch.merge(transaction);
|
|
||||||
queue.pop();
|
|
||||||
};
|
|
||||||
}
|
}
|
||||||
|
|
||||||
uint32_t Scene::enqueueFrame() {
|
uint32_t Scene::enqueueFrame() {
|
||||||
PROFILE_RANGE(render, __FUNCTION__);
|
PROFILE_RANGE(render, __FUNCTION__);
|
||||||
Transaction consolidatedTransaction;
|
TransactionQueue localTransactionQueue;
|
||||||
{
|
{
|
||||||
std::unique_lock<std::mutex> lock(_transactionQueueMutex);
|
std::unique_lock<std::mutex> lock(_transactionQueueMutex);
|
||||||
consolidateTransaction(_transactionQueue, consolidatedTransaction);
|
localTransactionQueue.swap(_transactionQueue);
|
||||||
}
|
}
|
||||||
|
|
||||||
uint32_t frameNumber = 0;
|
Transaction consolidatedTransaction;
|
||||||
|
consolidatedTransaction.merge(std::move(localTransactionQueue));
|
||||||
{
|
{
|
||||||
std::unique_lock<std::mutex> lock(_transactionFramesMutex);
|
std::unique_lock<std::mutex> lock(_transactionFramesMutex);
|
||||||
_transactionFrames.push_back(consolidatedTransaction);
|
_transactionFrames.push_back(consolidatedTransaction);
|
||||||
_transactionFrameNumber++;
|
|
||||||
frameNumber = _transactionFrameNumber;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return frameNumber;
|
return ++_transactionFrameNumber;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void Scene::processTransactionQueue() {
|
void Scene::processTransactionQueue() {
|
||||||
PROFILE_RANGE(render, __FUNCTION__);
|
PROFILE_RANGE(render, __FUNCTION__);
|
||||||
|
|
||||||
TransactionFrames queuedFrames;
|
static TransactionFrames queuedFrames;
|
||||||
{
|
{
|
||||||
// capture the queued frames and clear the queue
|
// capture the queued frames and clear the queue
|
||||||
std::unique_lock<std::mutex> lock(_transactionFramesMutex);
|
std::unique_lock<std::mutex> lock(_transactionFramesMutex);
|
||||||
queuedFrames = _transactionFrames;
|
queuedFrames.swap(_transactionFrames);
|
||||||
_transactionFrames.clear();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// go through the queue of frames and process them
|
// go through the queue of frames and process them
|
||||||
for (auto& frame : queuedFrames) {
|
for (auto& frame : queuedFrames) {
|
||||||
processTransactionFrame(frame);
|
processTransactionFrame(frame);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
queuedFrames.clear();
|
||||||
}
|
}
|
||||||
|
|
||||||
void Scene::processTransactionFrame(const Transaction& transaction) {
|
void Scene::processTransactionFrame(const Transaction& transaction) {
|
||||||
|
|
|
@ -65,9 +65,14 @@ public:
|
||||||
|
|
||||||
void resetSelectionHighlight(const std::string& selectionName, const HighlightStyle& style = HighlightStyle());
|
void resetSelectionHighlight(const std::string& selectionName, const HighlightStyle& style = HighlightStyle());
|
||||||
void removeHighlightFromSelection(const std::string& selectionName);
|
void removeHighlightFromSelection(const std::string& selectionName);
|
||||||
void querySelectionHighlight(const std::string& selectionName, SelectionHighlightQueryFunc func);
|
void querySelectionHighlight(const std::string& selectionName, const SelectionHighlightQueryFunc& func);
|
||||||
|
|
||||||
|
void reserve(const std::vector<Transaction>& transactionContainer);
|
||||||
|
void merge(const std::vector<Transaction>& transactionContainer);
|
||||||
|
void merge(std::vector<Transaction>&& transactionContainer);
|
||||||
void merge(const Transaction& transaction);
|
void merge(const Transaction& transaction);
|
||||||
|
void merge(Transaction&& transaction);
|
||||||
|
void clear();
|
||||||
|
|
||||||
// Checkers if there is work to do when processing the transaction
|
// Checkers if there is work to do when processing the transaction
|
||||||
bool touchTransactions() const { return !_resetSelections.empty(); }
|
bool touchTransactions() const { return !_resetSelections.empty(); }
|
||||||
|
@ -107,7 +112,7 @@ protected:
|
||||||
HighlightRemoves _highlightRemoves;
|
HighlightRemoves _highlightRemoves;
|
||||||
HighlightQueries _highlightQueries;
|
HighlightQueries _highlightQueries;
|
||||||
};
|
};
|
||||||
typedef std::queue<Transaction> TransactionQueue;
|
typedef std::vector<Transaction> TransactionQueue;
|
||||||
|
|
||||||
|
|
||||||
// Scene is a container for Items
|
// Scene is a container for Items
|
||||||
|
@ -133,6 +138,9 @@ public:
|
||||||
// Enqueue transaction to the scene
|
// Enqueue transaction to the scene
|
||||||
void enqueueTransaction(const Transaction& transaction);
|
void enqueueTransaction(const Transaction& transaction);
|
||||||
|
|
||||||
|
// Enqueue transaction to the scene
|
||||||
|
void enqueueTransaction(Transaction&& transaction);
|
||||||
|
|
||||||
// Enqueue end of frame transactions boundary
|
// Enqueue end of frame transactions boundary
|
||||||
uint32_t enqueueFrame();
|
uint32_t enqueueFrame();
|
||||||
|
|
||||||
|
@ -187,7 +195,7 @@ protected:
|
||||||
|
|
||||||
|
|
||||||
std::mutex _transactionFramesMutex;
|
std::mutex _transactionFramesMutex;
|
||||||
using TransactionFrames = std::list<Transaction>;
|
using TransactionFrames = std::vector<Transaction>;
|
||||||
TransactionFrames _transactionFrames;
|
TransactionFrames _transactionFrames;
|
||||||
uint32_t _transactionFrameNumber{ 0 };
|
uint32_t _transactionFrameNumber{ 0 };
|
||||||
|
|
||||||
|
|
|
@ -113,8 +113,10 @@
|
||||||
var filterText; // Used for updating Purchases QML
|
var filterText; // Used for updating Purchases QML
|
||||||
function onScreenChanged(type, url) {
|
function onScreenChanged(type, url) {
|
||||||
onMarketplaceScreen = type === "Web" && url.indexOf(MARKETPLACE_URL) !== -1;
|
onMarketplaceScreen = type === "Web" && url.indexOf(MARKETPLACE_URL) !== -1;
|
||||||
onCommerceScreen = type === "QML" && (url.indexOf(MARKETPLACE_CHECKOUT_QML_PATH_BASE) !== -1 || url === MARKETPLACE_PURCHASES_QML_PATH || url.indexOf(MARKETPLACE_INSPECTIONCERTIFICATE_QML_PATH) !== -1);
|
onWalletScreen = url.indexOf(MARKETPLACE_WALLET_QML_PATH) !== -1;
|
||||||
wireEventBridge(onCommerceScreen);
|
onCommerceScreen = type === "QML" && (url.indexOf(MARKETPLACE_CHECKOUT_QML_PATH_BASE) !== -1 || url === MARKETPLACE_PURCHASES_QML_PATH
|
||||||
|
|| url.indexOf(MARKETPLACE_INSPECTIONCERTIFICATE_QML_PATH) !== -1);
|
||||||
|
wireEventBridge(onMarketplaceScreen || onCommerceScreen || onWalletScreen);
|
||||||
|
|
||||||
if (url === MARKETPLACE_PURCHASES_QML_PATH) {
|
if (url === MARKETPLACE_PURCHASES_QML_PATH) {
|
||||||
tablet.sendToQml({
|
tablet.sendToQml({
|
||||||
|
@ -125,7 +127,7 @@
|
||||||
}
|
}
|
||||||
|
|
||||||
// for toolbar mode: change button to active when window is first openend, false otherwise.
|
// for toolbar mode: change button to active when window is first openend, false otherwise.
|
||||||
marketplaceButton.editProperties({ isActive: onMarketplaceScreen || onCommerceScreen });
|
marketplaceButton.editProperties({ isActive: (onMarketplaceScreen || onCommerceScreen) && !onWalletScreen });
|
||||||
if (type === "Web" && url.indexOf(MARKETPLACE_URL) !== -1) {
|
if (type === "Web" && url.indexOf(MARKETPLACE_URL) !== -1) {
|
||||||
ContextOverlay.isInMarketplaceInspectionMode = true;
|
ContextOverlay.isInMarketplaceInspectionMode = true;
|
||||||
} else {
|
} else {
|
||||||
|
@ -401,6 +403,11 @@
|
||||||
} else if (parsedJsonMessage.type === "LOGIN") {
|
} else if (parsedJsonMessage.type === "LOGIN") {
|
||||||
openLoginWindow();
|
openLoginWindow();
|
||||||
} else if (parsedJsonMessage.type === "WALLET_SETUP") {
|
} else if (parsedJsonMessage.type === "WALLET_SETUP") {
|
||||||
|
wireEventBridge(true);
|
||||||
|
tablet.sendToQml({
|
||||||
|
method: 'updateWalletReferrer',
|
||||||
|
referrer: "marketplace cta"
|
||||||
|
});
|
||||||
openWallet();
|
openWallet();
|
||||||
} else if (parsedJsonMessage.type === "MY_ITEMS") {
|
} else if (parsedJsonMessage.type === "MY_ITEMS") {
|
||||||
referrerURL = MARKETPLACE_URL_INITIAL;
|
referrerURL = MARKETPLACE_URL_INITIAL;
|
||||||
|
|
Loading…
Reference in a new issue