mirror of
https://github.com/lubosz/overte.git
synced 2025-04-14 03:06:20 +02:00
Use persistent object id counter
This commit is contained in:
parent
ca1da9c830
commit
ff83713365
2 changed files with 17 additions and 21 deletions
|
@ -26,13 +26,11 @@ Rectangle {
|
|||
id: root
|
||||
|
||||
property string installedApps
|
||||
property var nextResourceObjectId: 0
|
||||
signal sendToScript(var message)
|
||||
|
||||
HifiStylesUit.HifiConstants { id: hifi }
|
||||
ListModel {
|
||||
id: resourceListModel
|
||||
property var nextId: 0
|
||||
}
|
||||
ListModel { id: resourceListModel }
|
||||
|
||||
color: hifi.colors.white
|
||||
|
||||
|
@ -52,7 +50,8 @@ Rectangle {
|
|||
resourceListModel.append(resourceObject);
|
||||
spinner.visible = false;
|
||||
break;
|
||||
case "marketplaceTestBackendIsAlive":
|
||||
case "nextObjectIdInTest":
|
||||
nextResourceObjectId = message.id;
|
||||
spinner.visible = false;
|
||||
break;
|
||||
}
|
||||
|
@ -65,14 +64,14 @@ Rectangle {
|
|||
resource.match(/\.json\.gz$/) ? "content set" :
|
||||
resource.match(/\.json$/) ? "entity or wearable" :
|
||||
"unknown");
|
||||
return { "id": resourceListModel.nextId++,
|
||||
return { "id": nextResourceObjectId++,
|
||||
"resource": resource,
|
||||
"assetType": assetType };
|
||||
}
|
||||
|
||||
function installResourceObj(resourceObj) {
|
||||
if ("application" == resourceObj["assetType"]) {
|
||||
Commerce.installApp(resourceObj["resource"]);
|
||||
if ("application" == resourceObj.assetType) {
|
||||
Commerce.installApp(resourceObj.resource);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -269,7 +268,7 @@ Rectangle {
|
|||
sendToScript({
|
||||
method: 'tester_newResourceObject',
|
||||
resourceObject: resourceObj });
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Repeater {
|
||||
|
|
|
@ -980,19 +980,16 @@ var onQmlMessageReceived = function onQmlMessageReceived(message) {
|
|||
};
|
||||
|
||||
function pushResourceObjectsInTest() {
|
||||
var isQmlSignaled = false;
|
||||
for (var i = 0, size = resourceObjectsInTest.length; i < size; ++i) {
|
||||
if (i in resourceObjectsInTest) {
|
||||
signalNewResourceObjectInTest(resourceObjectsInTest[i]);
|
||||
isQmlSignaled = true;
|
||||
}
|
||||
}
|
||||
// Be sure that the QML has heard from us, at least so that it
|
||||
// can indicate to the user that all of the resoruce objects in
|
||||
// test have been transmitted to it.
|
||||
if (!isQmlSignaled) {
|
||||
ui.tablet.sendToQml({ method: "marketplaceTestBackendIsAlive" });
|
||||
var maxObjectId = -1;
|
||||
for (var objectId in resourceObjectsInTest) {
|
||||
signalNewResourceObjectInTest(resourceObjectsInTest[objectId]);
|
||||
maxObjectId = (maxObjectId < objectId) ? parseInt(objectId) : maxObjectId;
|
||||
}
|
||||
// N.B. Thinking about removing the following sendToQml? Be sure
|
||||
// that the marketplace item tester QML has heard from us, at least
|
||||
// so that it can indicate to the user that all of the resoruce
|
||||
// objects in test have been transmitted to it.
|
||||
ui.tablet.sendToQml({ method: "nextObjectIdInTest", id: maxObjectId + 1 });
|
||||
}
|
||||
|
||||
// Function Name: onTabletScreenChanged()
|
||||
|
|
Loading…
Reference in a new issue