From acb0bf8d20d49233edac518eede808ec61f3ae03 Mon Sep 17 00:00:00 2001 From: Atlante45 Date: Mon, 25 Sep 2017 20:22:44 -0700 Subject: [PATCH 1/7] Asset Browser tweaks --- .../resources/qml/{ => hifi}/AssetServer.qml | 189 +++++++++++++++--- interface/src/Application.cpp | 2 +- .../AssetMappingsScriptingInterface.cpp | 9 + .../AssetMappingsScriptingInterface.h | 5 + 4 files changed, 180 insertions(+), 25 deletions(-) rename interface/resources/qml/{ => hifi}/AssetServer.qml (80%) diff --git a/interface/resources/qml/AssetServer.qml b/interface/resources/qml/hifi/AssetServer.qml similarity index 80% rename from interface/resources/qml/AssetServer.qml rename to interface/resources/qml/hifi/AssetServer.qml index 649ea49153..e54d4048ec 100644 --- a/interface/resources/qml/AssetServer.qml +++ b/interface/resources/qml/hifi/AssetServer.qml @@ -14,10 +14,10 @@ import QtQuick.Controls.Styles 1.4 import QtQuick.Dialogs 1.2 as OriginalDialogs import Qt.labs.settings 1.0 -import "styles-uit" -import "controls-uit" as HifiControls -import "windows" -import "dialogs" +import "../styles-uit" +import "../controls-uit" as HifiControls +import "../windows" +import "../dialogs" ScrollingWindow { id: root @@ -58,6 +58,14 @@ ScrollingWindow { assetMappingsModel.autoRefreshEnabled = false; } + function letterbox(headerGlyph, headerText, message) { + letterboxMessage.headerGlyph = headerGlyph; + letterboxMessage.headerText = headerText; + letterboxMessage.text = message; + letterboxMessage.visible = true; + letterboxMessage.popupRadius = 0; + } + function doDeleteFile(path) { console.log("Deleting " + path); @@ -154,10 +162,7 @@ ScrollingWindow { } function handleGetMappingsError(errorString) { - errorMessageBox( - "There was a problem retreiving the list of assets from your Asset Server.\n" - + errorString - ); + errorMessageBox("There was a problem retreiving the list of assets from your Asset Server.\n" + errorString); } function addToWorld() { @@ -457,10 +462,16 @@ ScrollingWindow { text: message }); } - + Item { width: pane.contentWidth height: pane.height + + // The letterbox used for popup messages + LetterboxMessage { + id: letterboxMessage; + z: 999; // Force the popup on top of everything else + } HifiControls.ContentSection { id: assetDirectory @@ -476,7 +487,7 @@ ScrollingWindow { HifiControls.Button { text: "Add To World" - color: hifi.buttons.black + color: hifi.buttons.blue colorScheme: root.colorScheme width: 120 @@ -513,6 +524,7 @@ ScrollingWindow { id: treeView anchors.top: assetDirectory.bottom anchors.bottom: infoRow.top + anchors.bottomMargin: 2 * hifi.dimensions.contentSpacing.y anchors.margins: hifi.dimensions.contentMargin.x + 2 // Extra for border anchors.left: parent.left anchors.right: parent.right @@ -584,8 +596,24 @@ ScrollingWindow { ? (styleData.selected ? hifi.colors.black : hifi.colors.baseGrayHighlight) : (styleData.selected ? hifi.colors.black : hifi.colors.lightGrayText) - elide: Text.ElideRight horizontalAlignment: styleData.column === 1 ? TextInput.AlignHCenter : TextInput.AlignLeft + + elide: Text.ElideMiddle + + MouseArea { + id: mouseArea + anchors.fill: parent + + acceptedButtons: Qt.NoButton + hoverEnabled: true + + onEntered: { + if (parent.truncated) { + treeLabelToolTip.show(parent); + } + } + onExited: treeLabelToolTip.hide(); + } } } Component { @@ -668,6 +696,42 @@ ScrollingWindow { } } + Rectangle { + id: treeLabelToolTip + visible: false + z: 100 // Render on top + + width: toolTipText.width + 2 * hifi.dimensions.textPadding + height: hifi.dimensions.tableRowHeight + color: colorScheme == hifi.colorSchemes.light ? hifi.colors.tableRowLightOdd : hifi.colors.tableRowDarkOdd + border.color: colorScheme == hifi.colorSchemes.light ? hifi.colors.black : hifi.colors.lightGrayText + + FiraSansSemiBold { + id: toolTipText + anchors.centerIn: parent + + size: hifi.fontSizes.tableText + color: colorScheme == hifi.colorSchemes.light ? hifi.colors.black : hifi.colors.lightGrayText + } + + Timer { + id: showTimer + interval: 1000 + onTriggered: { treeLabelToolTip.visible = true; } + } + function show(item) { + var coord = item.mapToItem(parent, item.x, item.y); + + toolTipText.text = item.text; + treeLabelToolTip.x = coord.x - hifi.dimensions.textPadding; + treeLabelToolTip.y = coord.y; + showTimer.start(); + } + function hide() { + showTimer.stop(); + treeLabelToolTip.visible = false; + } + } MouseArea { propagateComposedEvents: true @@ -712,31 +776,43 @@ ScrollingWindow { } } - Row { + Item { id: infoRow anchors.left: treeView.left anchors.right: treeView.right anchors.bottom: uploadSection.top - anchors.bottomMargin: hifi.dimensions.contentSpacing.y - spacing: hifi.dimensions.contentSpacing.x + anchors.topMargin: 2 * hifi.dimensions.contentSpacing.y + anchors.bottomMargin: 2 * hifi.dimensions.contentSpacing.y RalewayRegular { + id: treeInfo + anchors.left: parent.left + anchors.verticalCenter: parent.verticalCenter + + function makeText() { + var pendingBakes = assetMappingsModel.bakesPendingCount; + if (selectedItems > 1 || pendingBakes === 0) { + return selectedItems + " items selected"; + } else { + return pendingBakes + " bakes pending" + } + } + size: hifi.fontSizes.sectionName font.capitalization: Font.AllUppercase - text: selectedItems + " items selected" + text: makeText() color: hifi.colors.lightGrayText } HifiControls.CheckBox { - function isChecked() { - var status = assetProxyModel.data(treeView.selection.currentIndex, 0x105); - var bakingDisabled = (status === "Not Baked" || status === "--"); - return selectedItems === 1 && !bakingDisabled; - } + id: bakingCheckbox + anchors.left: treeInfo.right + anchors.leftMargin: 2 * hifi.dimensions.contentSpacing.x + anchors.verticalCenter: parent.verticalCenter - text: "Use baked (optimized) versions" + text: " Use baked version" colorScheme: root.colorScheme - enabled: selectedItems === 1 && assetProxyModel.data(treeView.selection.currentIndex, 0x105) !== "--" + enabled: isEnabled() checked: isChecked() onClicked: { var mappings = []; @@ -752,7 +828,72 @@ ScrollingWindow { checked = Qt.binding(isChecked); } + + function isEnabled() { + if (!treeView.selection.hasSelection) { + return false; + } + + var status = assetProxyModel.data(treeView.selection.currentIndex, 0x105); + if (status === "--") { + return false; + } + var bakingEnabled = status !== "Not Baked"; + + for (var i in treeView.selection.selectedIndexes) { + var thisStatus = assetProxyModel.data(treeView.selection.selectedIndexes[i], 0x105); + if (thisStatus === "--") { + return false; + } + var thisBakingEnalbed = (thisStatus !== "Not Baked"); + + if (bakingEnabled !== thisBakingEnalbed) { + return false; + } + } + + return true; + } + function isChecked() { + if (!treeView.selection.hasSelection) { + return false; + } + + var status = assetProxyModel.data(treeView.selection.currentIndex, 0x105); + return isEnabled() && status !== "Not Baked"; + } } + + Item { + anchors.left: bakingCheckbox.right + anchors.leftMargin: hifi.dimensions.contentSpacing.x + anchors.verticalCenter: parent.verticalCenter + width: infoGlyph.size; + height: infoGlyph.size; + + HiFiGlyphs { + id: infoGlyph; + anchors.fill: parent; + horizontalAlignment: Text.AlignHCenter; + verticalAlignment: Text.AlignVCenter; + text: hifi.glyphs.question; + size: 35; + color: hifi.colors.lightGrayText; + } + MouseArea { + anchors.fill: parent; + hoverEnabled: true; + onEntered: infoGlyph.color = hifi.colors.blueHighlight; + onExited: infoGlyph.color = hifi.colors.lightGrayText; + onClicked: letterbox(hifi.glyphs.question, + "What is baking?", + "Baking is a process we use to compress geometric meshes and textures.
" + + "We do this for efficient storage and transmission of models.
" + + "In some cases, we have been able to achieve 60% compression of original models.

" + + "We highly recommend you leave baking on to enable faster transmission decode of models" + + "in interface resulting in better experience for users visiting your domain."); + } + } } HifiControls.ContentSection { @@ -790,7 +931,7 @@ ScrollingWindow { id: image width: 24 height: 24 - source: "../images/Loading-Outer-Ring.png" + source: "../../images/Loading-Outer-Ring.png" RotationAnimation on rotation { loops: Animation.Infinite from: 0 @@ -801,7 +942,7 @@ ScrollingWindow { Image { width: 24 height: 24 - source: "../images/Loading-Inner-H.png" + source: "../../images/Loading-Inner-H.png" } HifiControls.Label { id: uploadProgressLabel diff --git a/interface/src/Application.cpp b/interface/src/Application.cpp index e1c3af1939..d538472450 100644 --- a/interface/src/Application.cpp +++ b/interface/src/Application.cpp @@ -6398,7 +6398,7 @@ void Application::showAssetServerWidget(QString filePath) { if (!DependencyManager::get()->getThisNodeCanWriteAssets()) { return; } - static const QUrl url { "AssetServer.qml" }; + static const QUrl url { "hifi/AssetServer.qml" }; auto startUpload = [=](QQmlContext* context, QObject* newObject){ if (!filePath.isEmpty()) { diff --git a/interface/src/scripting/AssetMappingsScriptingInterface.cpp b/interface/src/scripting/AssetMappingsScriptingInterface.cpp index 5031016c3f..6c6f6dc244 100644 --- a/interface/src/scripting/AssetMappingsScriptingInterface.cpp +++ b/interface/src/scripting/AssetMappingsScriptingInterface.cpp @@ -239,6 +239,7 @@ void AssetMappingModel::refresh() { connect(request, &GetAllMappingsRequest::finished, this, [this](GetAllMappingsRequest* request) mutable { if (request->getError() == MappingRequest::NoError) { + int bakesPendingCount = 0; auto mappings = request->getMappings(); auto existingPaths = _pathToItemMap.keys(); for (auto& mapping : mappings) { @@ -287,6 +288,9 @@ void AssetMappingModel::refresh() { auto statusString = isFolder ? "--" : bakingStatusToString(mapping.second.status); lastItem->setData(statusString, Qt::UserRole + 5); lastItem->setData(mapping.second.bakingErrors, Qt::UserRole + 6); + if (mapping.second.status == Pending) { + ++bakesPendingCount; + } } Q_ASSERT(fullPath == path); @@ -334,6 +338,11 @@ void AssetMappingModel::refresh() { item = nextItem; } } + + if (bakesPendingCount != _bakesPendingCount) { + _bakesPendingCount = bakesPendingCount; + emit bakesPendingCountChanged(_bakesPendingCount); + } } else { emit errorGettingMappings(request->getErrorString()); } diff --git a/interface/src/scripting/AssetMappingsScriptingInterface.h b/interface/src/scripting/AssetMappingsScriptingInterface.h index 04ab488838..49d92ec070 100644 --- a/interface/src/scripting/AssetMappingsScriptingInterface.h +++ b/interface/src/scripting/AssetMappingsScriptingInterface.h @@ -26,6 +26,7 @@ class AssetMappingModel : public QStandardItemModel { Q_OBJECT Q_PROPERTY(bool autoRefreshEnabled READ isAutoRefreshEnabled WRITE setAutoRefreshEnabled) + Q_PROPERTY(int bakesPendingCount READ getBakesPendingCount NOTIFY bakesPendingCountChanged) public: AssetMappingModel(); @@ -38,10 +39,13 @@ public: bool isKnownMapping(QString path) const { return _pathToItemMap.contains(path); } bool isKnownFolder(QString path) const; + int getBakesPendingCount() const { return _bakesPendingCount; } + public slots: void clear(); signals: + void bakesPendingCountChanged(int newCount); void errorGettingMappings(QString errorString); void updated(); @@ -50,6 +54,7 @@ private: QHash _pathToItemMap; QTimer _autoRefreshTimer; + int _bakesPendingCount{ 0 }; }; Q_DECLARE_METATYPE(AssetMappingModel*) From dda715e17139ae2aa4ee77aac5bd7fe7992787d6 Mon Sep 17 00:00:00 2001 From: Atlante45 Date: Tue, 26 Sep 2017 18:01:25 -0700 Subject: [PATCH 2/7] Update TabletAssetServer --- interface/resources/qml/hifi/AssetServer.qml | 15 +- .../qml/hifi/dialogs/TabletAssetServer.qml | 165 ++++++++++++++++-- 2 files changed, 156 insertions(+), 24 deletions(-) diff --git a/interface/resources/qml/hifi/AssetServer.qml b/interface/resources/qml/hifi/AssetServer.qml index e54d4048ec..86b5229474 100644 --- a/interface/resources/qml/hifi/AssetServer.qml +++ b/interface/resources/qml/hifi/AssetServer.qml @@ -38,7 +38,7 @@ ScrollingWindow { property var assetMappingsModel: Assets.mappingModel; property var currentDirectory; property var selectedItems: treeView.selection.selectedIndexes.length; - + Settings { category: "Overlay.AssetServer" property alias x: root.x @@ -337,7 +337,7 @@ ScrollingWindow { if (!path) { return; } - + var modalMessage = ""; var items = selectedItems.toString(); var isFolder = assetProxyModel.data(treeView.selection.currentIndex, 0x101); @@ -490,18 +490,18 @@ ScrollingWindow { color: hifi.buttons.blue colorScheme: root.colorScheme width: 120 - + enabled: canAddToWorld(assetProxyModel.data(treeView.selection.currentIndex, 0x100)) - + onClicked: root.addToWorld() } - + HifiControls.Button { text: "Rename" color: hifi.buttons.black colorScheme: root.colorScheme width: 80 - + onClicked: root.renameFile() enabled: canRename() } @@ -952,10 +952,9 @@ ScrollingWindow { text: "In progress..." colorScheme: root.colorScheme } - } } - } } } + diff --git a/interface/resources/qml/hifi/dialogs/TabletAssetServer.qml b/interface/resources/qml/hifi/dialogs/TabletAssetServer.qml index 3f1fcf6bda..8d8fb75199 100644 --- a/interface/resources/qml/hifi/dialogs/TabletAssetServer.qml +++ b/interface/resources/qml/hifi/dialogs/TabletAssetServer.qml @@ -17,6 +17,7 @@ import Qt.labs.settings 1.0 import "../../styles-uit" import "../../controls-uit" as HifiControls import "../../windows" +import ".." Rectangle { id: root @@ -57,6 +58,14 @@ Rectangle { Component.onDestruction: { assetMappingsModel.autoRefreshEnabled = false; } + + function letterbox(headerGlyph, headerText, message) { + letterboxMessage.headerGlyph = headerGlyph; + letterboxMessage.headerText = headerText; + letterboxMessage.text = message; + letterboxMessage.visible = true; + letterboxMessage.popupRadius = 0; + } function doDeleteFile(path) { console.log("Deleting " + path); @@ -154,10 +163,7 @@ Rectangle { } function handleGetMappingsError(errorString) { - errorMessageBox( - "There was a problem retreiving the list of assets from your Asset Server.\n" - + errorString - ); + errorMessageBox("There was a problem retreiving the list of assets from your Asset Server.\n" + errorString); } function addToWorld() { @@ -477,7 +483,7 @@ Rectangle { HifiControls.Button { text: "Add To World" - color: hifi.buttons.black + color: hifi.buttons.blue colorScheme: root.colorScheme width: 120 @@ -583,8 +589,24 @@ Rectangle { ? (styleData.selected ? hifi.colors.black : hifi.colors.baseGrayHighlight) : (styleData.selected ? hifi.colors.black : hifi.colors.lightGrayText) - elide: Text.ElideRight horizontalAlignment: styleData.column === 1 ? TextInput.AlignHCenter : TextInput.AlignLeft + + elide: Text.ElideMiddle + + MouseArea { + id: mouseArea + anchors.fill: parent + + acceptedButtons: Qt.NoButton + hoverEnabled: true + + onEntered: { + if (parent.truncated) { + treeLabelToolTip.show(parent); + } + } + onExited: treeLabelToolTip.hide(); + } } } Component { @@ -667,6 +689,42 @@ Rectangle { } } + Rectangle { + id: treeLabelToolTip + visible: false + z: 100 // Render on top + + width: toolTipText.width + 2 * hifi.dimensions.textPadding + height: hifi.dimensions.tableRowHeight + color: colorScheme == hifi.colorSchemes.light ? hifi.colors.tableRowLightOdd : hifi.colors.tableRowDarkOdd + border.color: colorScheme == hifi.colorSchemes.light ? hifi.colors.black : hifi.colors.lightGrayText + + FiraSansSemiBold { + id: toolTipText + anchors.centerIn: parent + + size: hifi.fontSizes.tableText + color: colorScheme == hifi.colorSchemes.light ? hifi.colors.black : hifi.colors.lightGrayText + } + + Timer { + id: showTimer + interval: 1000 + onTriggered: { treeLabelToolTip.visible = true; } + } + function show(item) { + var coord = item.mapToItem(parent, item.x, item.y); + + toolTipText.text = item.text; + treeLabelToolTip.x = coord.x - hifi.dimensions.textPadding; + treeLabelToolTip.y = coord.y; + showTimer.start(); + } + function hide() { + showTimer.stop(); + treeLabelToolTip.visible = false; + } + } MouseArea { propagateComposedEvents: true @@ -715,26 +773,36 @@ Rectangle { id: infoRow anchors.left: treeView.left anchors.right: treeView.right - anchors.bottomMargin: hifi.dimensions.contentSpacing.y - spacing: hifi.dimensions.contentSpacing.x + anchors.topMargin: 2 * hifi.dimensions.contentSpacing.y + anchors.bottomMargin: 2 * hifi.dimensions.contentSpacing.y RalewayRegular { + anchors.verticalCenter: parent.verticalCenter + + function makeText() { + var pendingBakes = assetMappingsModel.bakesPendingCount; + if (selectedItems > 1 || pendingBakes === 0) { + return selectedItems + " items selected"; + } else { + return pendingBakes + " bakes pending" + } + } + size: hifi.fontSizes.sectionName font.capitalization: Font.AllUppercase - text: selectedItems + " items selected" + text: makeText() color: hifi.colors.lightGrayText } HifiControls.CheckBox { - function isChecked() { - var status = assetProxyModel.data(treeView.selection.currentIndex, 0x105); - var bakingDisabled = (status === "Not Baked" || status === "--"); - return selectedItems === 1 && !bakingDisabled; - } + id: bakingCheckbox + anchors.left: treeInfo.right + anchors.leftMargin: 2 * hifi.dimensions.contentSpacing.x + anchors.verticalCenter: parent.verticalCenter - text: "Use baked (optimized) versions" + text: " Use baked version" colorScheme: root.colorScheme - enabled: selectedItems === 1 && assetProxyModel.data(treeView.selection.currentIndex, 0x105) !== "--" + enabled: isEnabled() checked: isChecked() onClicked: { var mappings = []; @@ -750,7 +818,72 @@ Rectangle { checked = Qt.binding(isChecked); } + + function isEnabled() { + if (!treeView.selection.hasSelection) { + return false; + } + + var status = assetProxyModel.data(treeView.selection.currentIndex, 0x105); + if (status === "--") { + return false; + } + var bakingEnabled = status !== "Not Baked"; + + for (var i in treeView.selection.selectedIndexes) { + var thisStatus = assetProxyModel.data(treeView.selection.selectedIndexes[i], 0x105); + if (thisStatus === "--") { + return false; + } + var thisBakingEnalbed = (thisStatus !== "Not Baked"); + + if (bakingEnabled !== thisBakingEnalbed) { + return false; + } + } + + return true; + } + function isChecked() { + if (!treeView.selection.hasSelection) { + return false; + } + + var status = assetProxyModel.data(treeView.selection.currentIndex, 0x105); + return isEnabled() && status !== "Not Baked"; + } } + + Item { + anchors.left: bakingCheckbox.right + anchors.leftMargin: hifi.dimensions.contentSpacing.x + anchors.verticalCenter: parent.verticalCenter + width: infoGlyph.size; + height: infoGlyph.size; + + HiFiGlyphs { + id: infoGlyph; + anchors.fill: parent; + horizontalAlignment: Text.AlignHCenter; + verticalAlignment: Text.AlignVCenter; + text: hifi.glyphs.question; + size: 35; + color: hifi.colors.lightGrayText; + } + MouseArea { + anchors.fill: parent; + hoverEnabled: true; + onEntered: infoGlyph.color = hifi.colors.blueHighlight; + onExited: infoGlyph.color = hifi.colors.lightGrayText; + onClicked: letterbox(hifi.glyphs.question, + "What is baking?", + "Baking is a process we use to compress geometric meshes and textures.
" + + "We do this for efficient storage and transmission of models.
" + + "In some cases, we have been able to achieve 60% compression of original models.

" + + "We highly recommend you leave baking on to enable faster transmission decode of models" + + "in interface resulting in better experience for users visiting your domain."); + } + } } HifiControls.TabletContentSection { From 03bd887f9ab7b6a06bd4745e6c0c4d92c01a5d76 Mon Sep 17 00:00:00 2001 From: Atlante45 Date: Tue, 26 Sep 2017 18:42:50 -0700 Subject: [PATCH 3/7] Re-sync files --- interface/resources/qml/hifi/AssetServer.qml | 11 +++-------- .../resources/qml/hifi/dialogs/TabletAssetServer.qml | 8 +++----- 2 files changed, 6 insertions(+), 13 deletions(-) diff --git a/interface/resources/qml/hifi/AssetServer.qml b/interface/resources/qml/hifi/AssetServer.qml index 86b5229474..d2866d8262 100644 --- a/interface/resources/qml/hifi/AssetServer.qml +++ b/interface/resources/qml/hifi/AssetServer.qml @@ -776,17 +776,13 @@ ScrollingWindow { } } - Item { + Row { id: infoRow anchors.left: treeView.left anchors.right: treeView.right anchors.bottom: uploadSection.top - anchors.topMargin: 2 * hifi.dimensions.contentSpacing.y - anchors.bottomMargin: 2 * hifi.dimensions.contentSpacing.y RalewayRegular { - id: treeInfo - anchors.left: parent.left anchors.verticalCenter: parent.verticalCenter function makeText() { @@ -804,9 +800,10 @@ ScrollingWindow { color: hifi.colors.lightGrayText } + HifiControls.HorizontalSpacer { } + HifiControls.CheckBox { id: bakingCheckbox - anchors.left: treeInfo.right anchors.leftMargin: 2 * hifi.dimensions.contentSpacing.x anchors.verticalCenter: parent.verticalCenter @@ -865,8 +862,6 @@ ScrollingWindow { } Item { - anchors.left: bakingCheckbox.right - anchors.leftMargin: hifi.dimensions.contentSpacing.x anchors.verticalCenter: parent.verticalCenter width: infoGlyph.size; height: infoGlyph.size; diff --git a/interface/resources/qml/hifi/dialogs/TabletAssetServer.qml b/interface/resources/qml/hifi/dialogs/TabletAssetServer.qml index 8d8fb75199..ee38c278a5 100644 --- a/interface/resources/qml/hifi/dialogs/TabletAssetServer.qml +++ b/interface/resources/qml/hifi/dialogs/TabletAssetServer.qml @@ -773,8 +773,7 @@ Rectangle { id: infoRow anchors.left: treeView.left anchors.right: treeView.right - anchors.topMargin: 2 * hifi.dimensions.contentSpacing.y - anchors.bottomMargin: 2 * hifi.dimensions.contentSpacing.y + anchors.bottom: uploadSection.top RalewayRegular { anchors.verticalCenter: parent.verticalCenter @@ -794,9 +793,10 @@ Rectangle { color: hifi.colors.lightGrayText } + HifiControls.HorizontalSpacer { } + HifiControls.CheckBox { id: bakingCheckbox - anchors.left: treeInfo.right anchors.leftMargin: 2 * hifi.dimensions.contentSpacing.x anchors.verticalCenter: parent.verticalCenter @@ -855,8 +855,6 @@ Rectangle { } Item { - anchors.left: bakingCheckbox.right - anchors.leftMargin: hifi.dimensions.contentSpacing.x anchors.verticalCenter: parent.verticalCenter width: infoGlyph.size; height: infoGlyph.size; From bf984e8d1ae01f8bf8c219fff77faa87017561c9 Mon Sep 17 00:00:00 2001 From: Atlante45 Date: Tue, 26 Sep 2017 19:05:36 -0700 Subject: [PATCH 4/7] Fix tablet asset browser --- interface/resources/qml/hifi/AssetServer.qml | 18 +++++++------- .../qml/hifi/dialogs/TabletAssetServer.qml | 24 ++++++++++++------- 2 files changed, 24 insertions(+), 18 deletions(-) diff --git a/interface/resources/qml/hifi/AssetServer.qml b/interface/resources/qml/hifi/AssetServer.qml index d2866d8262..276c93d8dd 100644 --- a/interface/resources/qml/hifi/AssetServer.qml +++ b/interface/resources/qml/hifi/AssetServer.qml @@ -66,6 +66,15 @@ ScrollingWindow { letterboxMessage.popupRadius = 0; } + function errorMessageBox(message) { + return desktop.messageBox({ + icon: hifi.icons.warning, + defaultButton: OriginalDialogs.StandardButton.Ok, + title: "Error", + text: message + }); + } + function doDeleteFile(path) { console.log("Deleting " + path); @@ -453,15 +462,6 @@ ScrollingWindow { }); } } - - function errorMessageBox(message) { - return desktop.messageBox({ - icon: hifi.icons.warning, - defaultButton: OriginalDialogs.StandardButton.Ok, - title: "Error", - text: message - }); - } Item { width: pane.contentWidth diff --git a/interface/resources/qml/hifi/dialogs/TabletAssetServer.qml b/interface/resources/qml/hifi/dialogs/TabletAssetServer.qml index ee38c278a5..24267f3a96 100644 --- a/interface/resources/qml/hifi/dialogs/TabletAssetServer.qml +++ b/interface/resources/qml/hifi/dialogs/TabletAssetServer.qml @@ -66,6 +66,15 @@ Rectangle { letterboxMessage.visible = true; letterboxMessage.popupRadius = 0; } + + function errorMessageBox(message) { + return tabletRoot.messageBox({ + icon: hifi.icons.warning, + defaultButton: OriginalDialogs.StandardButton.Ok, + title: "Error", + text: message + }); + } function doDeleteFile(path) { console.log("Deleting " + path); @@ -454,14 +463,11 @@ Rectangle { }); } } - - function errorMessageBox(message) { - return tabletRoot.messageBox({ - icon: hifi.icons.warning, - defaultButton: OriginalDialogs.StandardButton.Ok, - title: "Error", - text: message - }); + + // The letterbox used for popup messages + LetterboxMessage { + id: letterboxMessage; + z: 999; // Force the popup on top of everything else } Column { @@ -773,7 +779,7 @@ Rectangle { id: infoRow anchors.left: treeView.left anchors.right: treeView.right - anchors.bottom: uploadSection.top + anchors.bottomMargin: hifi.dimensions.contentSpacing.y RalewayRegular { anchors.verticalCenter: parent.verticalCenter From 73483eef945e4d1a419d6b05977cda28661a3e91 Mon Sep 17 00:00:00 2001 From: Atlante45 Date: Tue, 26 Sep 2017 19:19:34 -0700 Subject: [PATCH 5/7] Update information sentence --- interface/resources/qml/hifi/AssetServer.qml | 6 +----- interface/resources/qml/hifi/dialogs/TabletAssetServer.qml | 6 +----- 2 files changed, 2 insertions(+), 10 deletions(-) diff --git a/interface/resources/qml/hifi/AssetServer.qml b/interface/resources/qml/hifi/AssetServer.qml index 276c93d8dd..9ec61e0057 100644 --- a/interface/resources/qml/hifi/AssetServer.qml +++ b/interface/resources/qml/hifi/AssetServer.qml @@ -882,11 +882,7 @@ ScrollingWindow { onExited: infoGlyph.color = hifi.colors.lightGrayText; onClicked: letterbox(hifi.glyphs.question, "What is baking?", - "Baking is a process we use to compress geometric meshes and textures.
" + - "We do this for efficient storage and transmission of models.
" + - "In some cases, we have been able to achieve 60% compression of original models.

" + - "We highly recommend you leave baking on to enable faster transmission decode of models" + - "in interface resulting in better experience for users visiting your domain."); + "Baking compresses and optimizes files for faster network transfer and display. We recommend you bake your content to reduce initial load times for your visitors."); } } } diff --git a/interface/resources/qml/hifi/dialogs/TabletAssetServer.qml b/interface/resources/qml/hifi/dialogs/TabletAssetServer.qml index 24267f3a96..2018433be6 100644 --- a/interface/resources/qml/hifi/dialogs/TabletAssetServer.qml +++ b/interface/resources/qml/hifi/dialogs/TabletAssetServer.qml @@ -881,11 +881,7 @@ Rectangle { onExited: infoGlyph.color = hifi.colors.lightGrayText; onClicked: letterbox(hifi.glyphs.question, "What is baking?", - "Baking is a process we use to compress geometric meshes and textures.
" + - "We do this for efficient storage and transmission of models.
" + - "In some cases, we have been able to achieve 60% compression of original models.

" + - "We highly recommend you leave baking on to enable faster transmission decode of models" + - "in interface resulting in better experience for users visiting your domain."); + "Baking compresses and optimizes files for faster network transfer and display. We recommend you bake your content to reduce initial load times for your visitors."); } } } From eb06c33187533d5bb8a822a32cfc621e9424640f Mon Sep 17 00:00:00 2001 From: Atlante45 Date: Wed, 27 Sep 2017 15:31:29 -0700 Subject: [PATCH 6/7] Naming coding standard fix --- interface/resources/qml/hifi/AssetServer.qml | 6 +++--- .../resources/qml/hifi/dialogs/TabletAssetServer.qml | 6 +++--- .../scripting/AssetMappingsScriptingInterface.cpp | 12 ++++++------ .../src/scripting/AssetMappingsScriptingInterface.h | 8 ++++---- 4 files changed, 16 insertions(+), 16 deletions(-) diff --git a/interface/resources/qml/hifi/AssetServer.qml b/interface/resources/qml/hifi/AssetServer.qml index 9ec61e0057..46df421d08 100644 --- a/interface/resources/qml/hifi/AssetServer.qml +++ b/interface/resources/qml/hifi/AssetServer.qml @@ -786,11 +786,11 @@ ScrollingWindow { anchors.verticalCenter: parent.verticalCenter function makeText() { - var pendingBakes = assetMappingsModel.bakesPendingCount; - if (selectedItems > 1 || pendingBakes === 0) { + var numPendingBakes = assetMappingsModel.numPendingBakes; + if (selectedItems > 1 || numPendingBakes === 0) { return selectedItems + " items selected"; } else { - return pendingBakes + " bakes pending" + return numPendingBakes + " bakes pending" } } diff --git a/interface/resources/qml/hifi/dialogs/TabletAssetServer.qml b/interface/resources/qml/hifi/dialogs/TabletAssetServer.qml index 2018433be6..95ccc61d27 100644 --- a/interface/resources/qml/hifi/dialogs/TabletAssetServer.qml +++ b/interface/resources/qml/hifi/dialogs/TabletAssetServer.qml @@ -785,11 +785,11 @@ Rectangle { anchors.verticalCenter: parent.verticalCenter function makeText() { - var pendingBakes = assetMappingsModel.bakesPendingCount; - if (selectedItems > 1 || pendingBakes === 0) { + var numPendingBakes = assetMappingsModel.numPendingBakes; + if (selectedItems > 1 || numPendingBakes === 0) { return selectedItems + " items selected"; } else { - return pendingBakes + " bakes pending" + return numPendingBakes + " bakes pending" } } diff --git a/interface/src/scripting/AssetMappingsScriptingInterface.cpp b/interface/src/scripting/AssetMappingsScriptingInterface.cpp index 6c6f6dc244..5308be59bf 100644 --- a/interface/src/scripting/AssetMappingsScriptingInterface.cpp +++ b/interface/src/scripting/AssetMappingsScriptingInterface.cpp @@ -239,7 +239,7 @@ void AssetMappingModel::refresh() { connect(request, &GetAllMappingsRequest::finished, this, [this](GetAllMappingsRequest* request) mutable { if (request->getError() == MappingRequest::NoError) { - int bakesPendingCount = 0; + int numPendingBakes = 0; auto mappings = request->getMappings(); auto existingPaths = _pathToItemMap.keys(); for (auto& mapping : mappings) { @@ -289,7 +289,7 @@ void AssetMappingModel::refresh() { lastItem->setData(statusString, Qt::UserRole + 5); lastItem->setData(mapping.second.bakingErrors, Qt::UserRole + 6); if (mapping.second.status == Pending) { - ++bakesPendingCount; + ++numPendingBakes; } } @@ -339,9 +339,9 @@ void AssetMappingModel::refresh() { } } - if (bakesPendingCount != _bakesPendingCount) { - _bakesPendingCount = bakesPendingCount; - emit bakesPendingCountChanged(_bakesPendingCount); + if (numPendingBakes != _numPendingBakes) { + _numPendingBakes = numPendingBakes; + emit numPendingBakesChanged(_numPendingBakes); } } else { emit errorGettingMappings(request->getErrorString()); @@ -373,4 +373,4 @@ void AssetMappingModel::setupRoles() { roleNames[Qt::DisplayRole] = "name"; roleNames[Qt::UserRole + 5] = "baked"; setItemRoleNames(roleNames); -} \ No newline at end of file +} diff --git a/interface/src/scripting/AssetMappingsScriptingInterface.h b/interface/src/scripting/AssetMappingsScriptingInterface.h index 49d92ec070..1a4c7dae48 100644 --- a/interface/src/scripting/AssetMappingsScriptingInterface.h +++ b/interface/src/scripting/AssetMappingsScriptingInterface.h @@ -26,7 +26,7 @@ class AssetMappingModel : public QStandardItemModel { Q_OBJECT Q_PROPERTY(bool autoRefreshEnabled READ isAutoRefreshEnabled WRITE setAutoRefreshEnabled) - Q_PROPERTY(int bakesPendingCount READ getBakesPendingCount NOTIFY bakesPendingCountChanged) + Q_PROPERTY(int numPendingBakes READ getNumPendingBakes NOTIFY numPendingBakesChanged) public: AssetMappingModel(); @@ -39,13 +39,13 @@ public: bool isKnownMapping(QString path) const { return _pathToItemMap.contains(path); } bool isKnownFolder(QString path) const; - int getBakesPendingCount() const { return _bakesPendingCount; } + int getNumPendingBakes() const { return _numPendingBakes; } public slots: void clear(); signals: - void bakesPendingCountChanged(int newCount); + void numPendingBakesChanged(int newCount); void errorGettingMappings(QString errorString); void updated(); @@ -54,7 +54,7 @@ private: QHash _pathToItemMap; QTimer _autoRefreshTimer; - int _bakesPendingCount{ 0 }; + int _numPendingBakes{ 0 }; }; Q_DECLARE_METATYPE(AssetMappingModel*) From af69222fdb236d041db696660ba49dadd34d2463 Mon Sep 17 00:00:00 2001 From: Atlante45 Date: Thu, 28 Sep 2017 18:34:42 -0700 Subject: [PATCH 7/7] Fix icon name change --- interface/resources/qml/hifi/AssetServer.qml | 2 +- interface/resources/qml/hifi/dialogs/TabletAssetServer.qml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/interface/resources/qml/hifi/AssetServer.qml b/interface/resources/qml/hifi/AssetServer.qml index 46df421d08..6b60cbff7b 100644 --- a/interface/resources/qml/hifi/AssetServer.qml +++ b/interface/resources/qml/hifi/AssetServer.qml @@ -567,7 +567,7 @@ ScrollingWindow { case "Not Baked": return hifi.glyphs.circleSlash; case "Baked": - return hifi.glyphs.check_2_01; + return hifi.glyphs.checkmark; case "Error": return hifi.glyphs.alert; default: diff --git a/interface/resources/qml/hifi/dialogs/TabletAssetServer.qml b/interface/resources/qml/hifi/dialogs/TabletAssetServer.qml index 95ccc61d27..44cd700eac 100644 --- a/interface/resources/qml/hifi/dialogs/TabletAssetServer.qml +++ b/interface/resources/qml/hifi/dialogs/TabletAssetServer.qml @@ -566,7 +566,7 @@ Rectangle { case "Not Baked": return hifi.glyphs.circleSlash; case "Baked": - return hifi.glyphs.check_2_01; + return hifi.glyphs.checkmark; case "Error": return hifi.glyphs.alert; default: