From ea716f2a1e650cb5ec99ceafbebc0c77ed743f81 Mon Sep 17 00:00:00 2001 From: Zach Fox Date: Fri, 27 Apr 2018 14:08:53 -0700 Subject: [PATCH 1/4] Enable sideloading .app.json Apps from local disk --- .../qml/hifi/commerce/purchases/Purchases.qml | 186 +++++++++++++++++- 1 file changed, 183 insertions(+), 3 deletions(-) diff --git a/interface/resources/qml/hifi/commerce/purchases/Purchases.qml b/interface/resources/qml/hifi/commerce/purchases/Purchases.qml index 08e3e7a552..90a8ef011d 100644 --- a/interface/resources/qml/hifi/commerce/purchases/Purchases.qml +++ b/interface/resources/qml/hifi/commerce/purchases/Purchases.qml @@ -124,6 +124,14 @@ Rectangle { root.numUpdatesAvailable = result.data.updates.length; } } + + onAppInstalled: { + root.installedApps = Commerce.getInstalledApps(); + } + + onAppUninstalled: { + root.installedApps = Commerce.getInstalledApps(); + } } Timer { @@ -249,6 +257,145 @@ Rectangle { Commerce.getWalletStatus(); } } + + Item { + id: installedAppsContainer; + z: 998; + visible: false; + anchors.top: titleBarContainer.bottom; + anchors.topMargin: -titleBarContainer.additionalDropdownHeight; + anchors.left: parent.left; + anchors.bottom: parent.bottom; + width: parent.width; + + RalewayRegular { + id: installedAppsHeader; + anchors.top: parent.top; + anchors.topMargin: 10; + anchors.left: parent.left; + anchors.leftMargin: 12; + height: 80; + width: paintedWidth; + text: "All Installed Marketplace Apps"; + color: hifi.colors.black; + size: 22; + } + + ListView { + id: installedAppsList; + clip: true; + model: installedAppsModel; + snapMode: ListView.SnapToItem; + // Anchors + anchors.top: installedAppsHeader.bottom; + anchors.left: parent.left; + anchors.bottom: sideloadAppButton.top; + width: parent.width; + delegate: Item { + width: parent.width; + height: 40; + + RalewaySemiBold { + text: model.appUrl; + // Text size + size: 18; + // Anchors + anchors.left: parent.left; + anchors.leftMargin: 12; + height: parent.height; + anchors.right: sideloadAppOpenButton.left; + anchors.rightMargin: 8; + elide: Text.ElideRight; + // Style + color: hifi.colors.black; + // Alignment + verticalAlignment: Text.AlignVCenter; + + MouseArea { + anchors.fill: parent; + onClicked: { + Window.copyToClipboard((model.appUrl).slice(0, -9)); + } + } + } + + HifiControlsUit.Button { + id: sideloadAppOpenButton; + text: "OPEN"; + color: hifi.buttons.blue; + colorScheme: hifi.colorSchemes.dark; + anchors.top: parent.top; + anchors.topMargin: 2; + anchors.bottom: parent.bottom; + anchors.bottomMargin: 2; + anchors.right: uninstallGlyph.left; + anchors.rightMargin: 8; + width: 80; + onClicked: { + Commerce.openApp(model.appUrl); + } + } + + HiFiGlyphs { + id: uninstallGlyph; + text: hifi.glyphs.close; + color: hifi.colors.black; + size: 22; + anchors.top: parent.top; + anchors.right: parent.right; + anchors.rightMargin: 6; + width: 35; + height: parent.height; + horizontalAlignment: Text.AlignHCenter; + MouseArea { + anchors.fill: parent; + hoverEnabled: true; + onEntered: { + parent.text = hifi.glyphs.closeInverted; + } + onExited: { + parent.text = hifi.glyphs.close; + } + onClicked: { + Commerce.uninstallApp(model.appUrl); + } + } + } + } + } + HifiControlsUit.Button { + id: sideloadAppButton; + color: hifi.buttons.blue; + colorScheme: hifi.colorSchemes.dark; + anchors.bottom: parent.bottom; + anchors.bottomMargin: 8; + anchors.left: parent.left; + anchors.leftMargin: 8; + anchors.right: closeAppListButton.left; + anchors.rightMargin: 8; + height: 40; + text: "SIDELOAD APP FROM LOCAL DISK"; + onClicked: { + Window.browseChanged.connect(onFileOpenChanged); + Window.browseAsync("Locate your app's .app.json file", "", "*.app.json"); + } + } + HifiControlsUit.Button { + id: closeAppListButton; + color: hifi.buttons.white; + colorScheme: hifi.colorSchemes.dark; + anchors.bottom: parent.bottom; + anchors.bottomMargin: 8; + anchors.right: parent.right; + anchors.rightMargin: 8; + width: 100; + height: 40; + text: "BACK"; + onClicked: { + installedAppsContainer.visible = false; + } + } + } HifiWallet.NeedsLogIn { id: needsLogIn; @@ -317,7 +464,7 @@ Rectangle { // Item { id: purchasesContentsContainer; - visible: root.activeView === "purchasesMain"; + visible: root.activeView === "purchasesMain" && !installedAppsList.visible; // Anchors anchors.left: parent.left; anchors.right: parent.right; @@ -442,7 +589,7 @@ Rectangle { ListView { id: purchasesContentsList; - visible: (root.isShowingMyItems && filteredPurchasesModel.count !== 0) || (!root.isShowingMyItems && filteredPurchasesModel.count !== 0); + visible: ((root.isShowingMyItems && filteredPurchasesModel.count !== 0) || (!root.isShowingMyItems && filteredPurchasesModel.count !== 0)) && !installedAppsList.visible; clip: true; model: filteredPurchasesModel; snapMode: ListView.SnapToItem; @@ -629,7 +776,7 @@ Rectangle { Rectangle { id: updatesAvailableBanner; - visible: root.numUpdatesAvailable > 0 && !root.isShowingMyItems; + visible: root.numUpdatesAvailable > 0 && !root.isShowingMyItems && !installedAppsContainer.visible; anchors.bottom: parent.bottom; anchors.left: parent.left; anchors.right: parent.right; @@ -959,6 +1106,39 @@ Rectangle { } } + Keys.onPressed: { + if ((event.key == Qt.Key_F) && (event.modifiers & Qt.ControlModifier)) { + installedAppsContainer.visible = !installedAppsContainer.visible; + console.log("User changed visibility of installedAppsContainer to " + installedAppsContainer.visible); + } + } + function onFileOpenChanged(filename) { + // disconnect the event, otherwise the requests will stack up + try { // Not all calls to onFileOpenChanged() connect an event. + Window.browseChanged.disconnect(onFileOpenChanged); + } catch (e) { + console.log('Purchases.qml ignoring', e); + } + if (filename) { + Commerce.installApp(filename); + } + } + ListModel { + id: installedAppsModel; + } + onInstalledAppsChanged: { + installedAppsModel.clear(); + var installedAppsArray = root.installedApps.split(","); + var installedAppsObject = []; + // "- 1" because the last app string ends with "," + for (var i = 0; i < installedAppsArray.length - 1; i++) { + installedAppsObject[i] = { + "appUrl": installedAppsArray[i] + } + } + installedAppsModel.append(installedAppsObject); + } + // // Function Name: fromScript() // From dbd7d7e2b4872ed16e4c0862f662daed369e2a77 Mon Sep 17 00:00:00 2001 From: Zach Fox Date: Fri, 27 Apr 2018 14:19:05 -0700 Subject: [PATCH 2/4] Small cleanup --- .../resources/qml/hifi/commerce/purchases/Purchases.qml | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/interface/resources/qml/hifi/commerce/purchases/Purchases.qml b/interface/resources/qml/hifi/commerce/purchases/Purchases.qml index 90a8ef011d..6b48f8d51d 100644 --- a/interface/resources/qml/hifi/commerce/purchases/Purchases.qml +++ b/interface/resources/qml/hifi/commerce/purchases/Purchases.qml @@ -295,10 +295,10 @@ Rectangle { width: parent.width; height: 40; - RalewaySemiBold { + RalewayRegular { text: model.appUrl; // Text size - size: 18; + size: 16; // Anchors anchors.left: parent.left; anchors.leftMargin: 12; @@ -589,7 +589,7 @@ Rectangle { ListView { id: purchasesContentsList; - visible: ((root.isShowingMyItems && filteredPurchasesModel.count !== 0) || (!root.isShowingMyItems && filteredPurchasesModel.count !== 0)) && !installedAppsList.visible; + visible: (root.isShowingMyItems && filteredPurchasesModel.count !== 0) || (!root.isShowingMyItems && filteredPurchasesModel.count !== 0); clip: true; model: filteredPurchasesModel; snapMode: ListView.SnapToItem; @@ -776,7 +776,7 @@ Rectangle { Rectangle { id: updatesAvailableBanner; - visible: root.numUpdatesAvailable > 0 && !root.isShowingMyItems && !installedAppsContainer.visible; + visible: root.numUpdatesAvailable > 0 && !root.isShowingMyItems; anchors.bottom: parent.bottom; anchors.left: parent.left; anchors.right: parent.right; From 8d71d72258a7de488b4a4a8f3e1aab6d4441599f Mon Sep 17 00:00:00 2001 From: David Rowe Date: Sat, 28 Apr 2018 13:16:26 +1200 Subject: [PATCH 3/4] Fix JSDoc for Entities.findEntitiesByName --- libraries/entities/src/EntityScriptingInterface.h | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/libraries/entities/src/EntityScriptingInterface.h b/libraries/entities/src/EntityScriptingInterface.h index d4a8b11453..5e76d18515 100644 --- a/libraries/entities/src/EntityScriptingInterface.h +++ b/libraries/entities/src/EntityScriptingInterface.h @@ -390,17 +390,18 @@ public slots: /**jsdoc * Find all entities of a particular name that intersect a sphere defined by a center point and radius. * @function Entities.findEntitiesByName - * @param {Entities.EntityType} entityName - The name of the entity to search for. + * @param {string} entityName - The name of the entity to search for. * @param {Vec3} center - The point about which to search. * @param {number} radius - The radius within which to search. - * @param {boolean} caseSensitiveSearch - Choose whether to to return case sensitive results back. - * @returns {Uuid[]} An array of entity IDs of the specified type that intersect the search sphere. The array is empty if - * no entities could be found. - * @example Get back a list of entities + * @param {boolean} [caseSensitive=false] - If true then the search is case-sensitive. + * @returns {Uuid[]} An array of entity IDs that have the specified name and intersect the search sphere. The array is empty + * if no entities could be found. + * @example Report the number of entities with the name, "Light-Target". * var entityIDs = Entities.findEntitiesByName("Light-Target", MyAvatar.position, 10, false); - * print("Number of Entities with the name Light-Target " + entityIDs.length); + * print("Number of entities with the name "Light-Target": " + entityIDs.length); */ - Q_INVOKABLE QVector findEntitiesByName(const QString entityName, const glm::vec3& center, float radius, bool caseSensitiveSearch = false ) const; + Q_INVOKABLE QVector findEntitiesByName(const QString entityName, const glm::vec3& center, float radius, + bool caseSensitiveSearch = false ) const; /**jsdoc * Find the first entity intersected by a {@link PickRay}. Light and Zone entities are not From a245bb2174de3e4509c97d6de37ab483c4e1f89a Mon Sep 17 00:00:00 2001 From: Seth Alves Date: Sat, 28 Apr 2018 13:30:02 -0700 Subject: [PATCH 4/4] fix libquazip debug filename. link libatomic where needed --- cmake/externals/quazip/CMakeLists.txt | 3 +++ tests/controllers/CMakeLists.txt | 6 +++++- tests/render-perf/CMakeLists.txt | 4 ++++ 3 files changed, 12 insertions(+), 1 deletion(-) diff --git a/cmake/externals/quazip/CMakeLists.txt b/cmake/externals/quazip/CMakeLists.txt index f2690e0a7d..7bf6f05d9f 100644 --- a/cmake/externals/quazip/CMakeLists.txt +++ b/cmake/externals/quazip/CMakeLists.txt @@ -41,6 +41,9 @@ if (APPLE) elseif (WIN32) set(${EXTERNAL_NAME_UPPER}_LIBRARY_RELEASE ${INSTALL_DIR}/lib/quazip5.lib CACHE FILEPATH "Location of QuaZip release library") set(${EXTERNAL_NAME_UPPER}_LIBRARY_DEBUG ${INSTALL_DIR}/lib/quazip5d.lib CACHE FILEPATH "Location of QuaZip release library") +elseif (CMAKE_SYSTEM_NAME MATCHES "Linux") + set(${EXTERNAL_NAME_UPPER}_LIBRARY_RELEASE ${INSTALL_DIR}/lib/libquazip5.so CACHE FILEPATH "Location of QuaZip release library") + set(${EXTERNAL_NAME_UPPER}_LIBRARY_DEBUG ${INSTALL_DIR}/lib/libquazip5d.so CACHE FILEPATH "Location of QuaZip release library") else () set(${EXTERNAL_NAME_UPPER}_LIBRARY_RELEASE ${INSTALL_DIR}/lib/libquazip5.so CACHE FILEPATH "Location of QuaZip release library") set(${EXTERNAL_NAME_UPPER}_LIBRARY_DEBUG ${INSTALL_DIR}/lib/libquazip5.so CACHE FILEPATH "Location of QuaZip release library") diff --git a/tests/controllers/CMakeLists.txt b/tests/controllers/CMakeLists.txt index b5e866ccce..ce1c150ed4 100644 --- a/tests/controllers/CMakeLists.txt +++ b/tests/controllers/CMakeLists.txt @@ -23,5 +23,9 @@ if (WIN32) add_dependency_external_projects(wasapi) endif() +if (CMAKE_SYSTEM_NAME MATCHES "Linux") + target_link_libraries(${TARGET_NAME} atomic) +endif() + package_libraries_for_deployment() -endif() \ No newline at end of file +endif() diff --git a/tests/render-perf/CMakeLists.txt b/tests/render-perf/CMakeLists.txt index fd4d8d88dd..d688474379 100644 --- a/tests/render-perf/CMakeLists.txt +++ b/tests/render-perf/CMakeLists.txt @@ -27,6 +27,10 @@ if (WIN32) add_dependency_external_projects(wasapi) endif() +if (CMAKE_SYSTEM_NAME MATCHES "Linux") + target_link_libraries(${TARGET_NAME} atomic) +endif() + package_libraries_for_deployment()