From ac33f33828f1fcdb0d103533b2fe62739de67f35 Mon Sep 17 00:00:00 2001 From: David Back Date: Thu, 31 May 2018 09:24:16 -0700 Subject: [PATCH 1/6] update version from json in toByteArray --- libraries/octree/src/OctreeDataUtils.cpp | 14 +++++++------- libraries/octree/src/OctreeDataUtils.h | 1 + libraries/octree/src/OctreePersistThread.cpp | 4 ++-- 3 files changed, 10 insertions(+), 9 deletions(-) diff --git a/libraries/octree/src/OctreeDataUtils.cpp b/libraries/octree/src/OctreeDataUtils.cpp index b57ab8db31..44a56fe97a 100644 --- a/libraries/octree/src/OctreeDataUtils.cpp +++ b/libraries/octree/src/OctreeDataUtils.cpp @@ -40,9 +40,10 @@ bool readOctreeFile(QString path, QJsonDocument* doc) { } bool OctreeUtils::RawOctreeData::readOctreeDataInfoFromJSON(QJsonObject root) { - if (root.contains("Id") && root.contains("DataVersion")) { + if (root.contains("Id") && root.contains("DataVersion") && root.contains("Version")) { id = root["Id"].toVariant().toUuid(); - version = root["DataVersion"].toInt(); + dataVersion = root["DataVersion"].toInt(); + version = root["Version"].toInt(); } readSubclassData(root); return true; @@ -76,11 +77,10 @@ bool OctreeUtils::RawOctreeData::readOctreeDataInfoFromFile(QString path) { } QByteArray OctreeUtils::RawOctreeData::toByteArray() { - const auto protocolVersion = (int)versionForPacketType((PacketTypeEnum::Value)dataPacketType()); QJsonObject obj { - { "DataVersion", QJsonValue((qint64)version) }, + { "DataVersion", QJsonValue((qint64)dataVersion) }, { "Id", QJsonValue(id.toString()) }, - { "Version", protocolVersion }, + { "Version", QJsonValue((qint64)version) }, }; writeSubclassData(obj); @@ -111,8 +111,8 @@ PacketType OctreeUtils::RawOctreeData::dataPacketType() const { void OctreeUtils::RawOctreeData::resetIdAndVersion() { id = QUuid::createUuid(); - version = OctreeUtils::INITIAL_VERSION; - qDebug() << "Reset octree data to: " << id << version; + dataVersion = OctreeUtils::INITIAL_VERSION; + qDebug() << "Reset octree data to: " << id << dataVersion; } void OctreeUtils::RawEntityData::readSubclassData(const QJsonObject& root) { diff --git a/libraries/octree/src/OctreeDataUtils.h b/libraries/octree/src/OctreeDataUtils.h index 485599096d..9060e7b460 100644 --- a/libraries/octree/src/OctreeDataUtils.h +++ b/libraries/octree/src/OctreeDataUtils.h @@ -28,6 +28,7 @@ constexpr Version INITIAL_VERSION = 0; class RawOctreeData { public: QUuid id { QUuid() }; + Version dataVersion { -1 }; Version version { -1 }; virtual PacketType dataPacketType() const; diff --git a/libraries/octree/src/OctreePersistThread.cpp b/libraries/octree/src/OctreePersistThread.cpp index e6afccab47..3dc051675d 100644 --- a/libraries/octree/src/OctreePersistThread.cpp +++ b/libraries/octree/src/OctreePersistThread.cpp @@ -179,8 +179,8 @@ bool OctreePersistThread::process() { OctreeUtils::RawOctreeData data; if (data.readOctreeDataInfoFromFile(_filename)) { - qDebug() << "Setting entity version info to: " << data.id << data.version; - _tree->setOctreeVersionInfo(data.id, data.version); + qDebug() << "Setting entity version info to: " << data.id << data.dataVersion; + _tree->setOctreeVersionInfo(data.id, data.dataVersion); } bool persistentFileRead; From cf7a3d1af6f07e2d396495c05d2fd524c74f7584 Mon Sep 17 00:00:00 2001 From: Zach Fox Date: Mon, 4 Jun 2018 11:30:29 -0700 Subject: [PATCH 2/6] Fix MS7224: Add dimensions to printed Snapshot entity --- scripts/system/snapshot.js | 1 + 1 file changed, 1 insertion(+) diff --git a/scripts/system/snapshot.js b/scripts/system/snapshot.js index 29089e6597..f7e590c6f9 100644 --- a/scripts/system/snapshot.js +++ b/scripts/system/snapshot.js @@ -295,6 +295,7 @@ function printToPolaroid(image_url) { "description": "Printed from Snaps", "modelURL": POLAROID_MODEL_URL, + "dimensions": { "x": 0.5667, "y": 0.0212, "z": 0.4176 }, "position": model_pos, "rotation": model_rot, From 7407507f0bdf976c28c30f450bcf9fc7660f080e Mon Sep 17 00:00:00 2001 From: Zach Fox Date: Mon, 4 Jun 2018 14:13:25 -0700 Subject: [PATCH 3/6] Fix MS15574: Tiny memory leak in Wallet.h --- interface/src/commerce/Wallet.cpp | 2 ++ interface/src/commerce/Wallet.h | 2 +- 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/interface/src/commerce/Wallet.cpp b/interface/src/commerce/Wallet.cpp index 982adb4b5e..f427c3c6b0 100644 --- a/interface/src/commerce/Wallet.cpp +++ b/interface/src/commerce/Wallet.cpp @@ -314,6 +314,7 @@ Wallet::Wallet() { auto nodeList = DependencyManager::get(); auto ledger = DependencyManager::get(); auto& packetReceiver = nodeList->getPacketReceiver(); + _passphrase = new QString(""); packetReceiver.registerListener(PacketType::ChallengeOwnership, this, "handleChallengeOwnershipPacket"); packetReceiver.registerListener(PacketType::ChallengeOwnershipRequest, this, "handleChallengeOwnershipPacket"); @@ -359,6 +360,7 @@ void Wallet::clear() { // tell the provider we got nothing updateImageProvider(); _passphrase->clear(); + delete _passphrase; } Wallet::~Wallet() { diff --git a/interface/src/commerce/Wallet.h b/interface/src/commerce/Wallet.h index 8a7d6b8c07..665afd9a23 100644 --- a/interface/src/commerce/Wallet.h +++ b/interface/src/commerce/Wallet.h @@ -78,7 +78,7 @@ private: QByteArray _salt; QByteArray _iv; QByteArray _ckey; - QString* _passphrase { new QString("") }; + QString* _passphrase { nullptr }; bool _isOverridingServer { false }; bool writeWallet(const QString& newPassphrase = QString("")); From 60aff7a224d0dd1bf2c353528cceec911d965b44 Mon Sep 17 00:00:00 2001 From: Zach Fox Date: Mon, 4 Jun 2018 14:41:18 -0700 Subject: [PATCH 4/6] Whoops --- interface/src/commerce/Wallet.cpp | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/interface/src/commerce/Wallet.cpp b/interface/src/commerce/Wallet.cpp index f427c3c6b0..f7e749317d 100644 --- a/interface/src/commerce/Wallet.cpp +++ b/interface/src/commerce/Wallet.cpp @@ -360,13 +360,16 @@ void Wallet::clear() { // tell the provider we got nothing updateImageProvider(); _passphrase->clear(); - delete _passphrase; } Wallet::~Wallet() { if (_securityImage) { delete _securityImage; } + + if (_passphrase) { + delete _passphrase; + } } bool Wallet::setPassphrase(const QString& passphrase) { From c5ef5cfccbf0c0e02e072359fbed795f8e0db3aa Mon Sep 17 00:00:00 2001 From: Zach Fox Date: Mon, 4 Jun 2018 16:13:18 -0700 Subject: [PATCH 5/6] Fix MS15582: In My Purchases, invisible buttons shouldn't be clickable --- .../qml/hifi/commerce/purchases/PurchasedItem.qml | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/interface/resources/qml/hifi/commerce/purchases/PurchasedItem.qml b/interface/resources/qml/hifi/commerce/purchases/PurchasedItem.qml index 19b57354dc..b43372da5c 100644 --- a/interface/resources/qml/hifi/commerce/purchases/PurchasedItem.qml +++ b/interface/resources/qml/hifi/commerce/purchases/PurchasedItem.qml @@ -163,7 +163,6 @@ Item { Rectangle { id: contextCard; - z: 2; anchors.left: parent.left; anchors.leftMargin: 30; anchors.top: parent.top; @@ -337,7 +336,6 @@ Item { Rectangle { id: permissionExplanationCard; - z: 1; anchors.left: parent.left; anchors.leftMargin: 30; anchors.top: parent.top; @@ -596,8 +594,8 @@ Item { anchors.fill: parent; hoverEnabled: enabled; onClicked: { - contextCard.z = 1; - permissionExplanationCard.z = 0; + contextCard.visible = true; + permissionExplanationCard.visible = false; root.sendToPurchases({ method: 'flipCard' }); } onEntered: { @@ -779,8 +777,8 @@ Item { noPermissionGlyph.color = hifi.colors.redAccent; } onClicked: { - contextCard.z = 0; - permissionExplanationCard.z = 1; + contextCard.visible = false; + permissionExplanationCard.visible = true; root.sendToPurchases({ method: 'flipCard' }); } } From c1dceda4ac43f7d4d0afec5772e35f979ea2867c Mon Sep 17 00:00:00 2001 From: David Back Date: Tue, 5 Jun 2018 12:01:06 -0700 Subject: [PATCH 6/6] enable gamepad by default --- plugins/hifiSdl2/src/SDL2Manager.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/plugins/hifiSdl2/src/SDL2Manager.cpp b/plugins/hifiSdl2/src/SDL2Manager.cpp index 664e53d115..df0cef06c8 100644 --- a/plugins/hifiSdl2/src/SDL2Manager.cpp +++ b/plugins/hifiSdl2/src/SDL2Manager.cpp @@ -47,7 +47,7 @@ static_assert( const char* SDL2Manager::NAME = "SDL2"; const char* SDL2Manager::SDL2_ID_STRING = "SDL2"; -const bool DEFAULT_ENABLED = false; +const bool DEFAULT_ENABLED = true; SDL_JoystickID SDL2Manager::getInstanceId(SDL_GameController* controller) { SDL_Joystick* joystick = SDL_GameControllerGetJoystick(controller);