mirror of
https://thingvellir.net/git/overte
synced 2025-03-27 23:52:03 +01:00
QmlMarketplace - disable HTML for quest
This commit is contained in:
parent
39ad36a4d0
commit
2b40260953
5 changed files with 85 additions and 33 deletions
|
@ -39,7 +39,8 @@ Rectangle {
|
|||
property bool keyboardRaised: false
|
||||
property string searchScopeString: "Featured"
|
||||
property bool isLoggedIn: false;
|
||||
|
||||
property bool supports3DHTML: true;
|
||||
|
||||
anchors.fill: (typeof parent === undefined) ? undefined : parent
|
||||
|
||||
function getMarketplaceItems() {
|
||||
|
@ -60,6 +61,8 @@ Rectangle {
|
|||
|
||||
Component.onCompleted: {
|
||||
Commerce.getLoginStatus();
|
||||
|
||||
supports3DHTML = PlatformInfo.has3DHTML();
|
||||
}
|
||||
|
||||
Component.onDestruction: {
|
||||
|
@ -103,7 +106,7 @@ Rectangle {
|
|||
if (result.status !== 'success') {
|
||||
console.log("Failed to get Marketplace Item", result.data.message);
|
||||
} else {
|
||||
|
||||
marketplaceItem.supports3DHTML = root.supports3DHTML;
|
||||
marketplaceItem.item_id = result.data.id;
|
||||
marketplaceItem.image_url = result.data.thumbnail_url;
|
||||
marketplaceItem.name = result.data.title;
|
||||
|
@ -958,8 +961,16 @@ Rectangle {
|
|||
}
|
||||
|
||||
onShowLicense: {
|
||||
licenseInfoWebView.url = url;
|
||||
licenseInfo.visible = true;
|
||||
var xhr = new XMLHttpRequest;
|
||||
xhr.open("GET", url);
|
||||
xhr.onreadystatechange = function() {
|
||||
if (xhr.readyState == XMLHttpRequest.DONE) {
|
||||
console.log(xhr.responseText);
|
||||
licenseText.text = xhr.responseText;
|
||||
licenseInfo.visible = true;
|
||||
}
|
||||
};
|
||||
xhr.send();
|
||||
}
|
||||
onCategoryClicked: {
|
||||
root.categoryString = category;
|
||||
|
@ -1001,11 +1012,13 @@ Rectangle {
|
|||
leftMargin: 15
|
||||
}
|
||||
|
||||
|
||||
|
||||
Item {
|
||||
id: footerText
|
||||
|
||||
anchors.fill: parent
|
||||
visible: itemsList.visible
|
||||
visible: root.supports3DHTML && itemsList.visible
|
||||
|
||||
HiFiGlyphs {
|
||||
id: footerGlyph
|
||||
|
@ -1072,6 +1085,8 @@ Rectangle {
|
|||
rightMargin: 10
|
||||
}
|
||||
|
||||
visible: root.supports3DHTML
|
||||
|
||||
text: "SEE ALL MARKETS"
|
||||
width: 180
|
||||
|
||||
|
@ -1100,16 +1115,24 @@ Rectangle {
|
|||
|
||||
visible: false;
|
||||
|
||||
HifiControlsUit.WebView {
|
||||
id: licenseInfoWebView
|
||||
|
||||
ScrollView {
|
||||
anchors {
|
||||
bottomMargin: 1
|
||||
topMargin: 60
|
||||
leftMargin: 1
|
||||
rightMargin: 1
|
||||
leftMargin: 15
|
||||
fill: parent
|
||||
}
|
||||
|
||||
RalewayRegular {
|
||||
id: licenseText
|
||||
|
||||
width:440
|
||||
wrapMode: Text.Wrap
|
||||
|
||||
text: ""
|
||||
size: 18;
|
||||
color: hifi.colors.baseGray
|
||||
}
|
||||
}
|
||||
|
||||
Item {
|
||||
|
|
|
@ -43,6 +43,8 @@ Rectangle {
|
|||
property string created_at: ""
|
||||
property bool isLoggedIn: false;
|
||||
property int edition: -1;
|
||||
property bool supports3DHTML: false;
|
||||
|
||||
|
||||
onCategoriesChanged: {
|
||||
categoriesListModel.clear();
|
||||
|
@ -52,8 +54,13 @@ Rectangle {
|
|||
}
|
||||
|
||||
onDescriptionChanged: {
|
||||
descriptionTextModel.clear();
|
||||
descriptionTextModel.append({text: description})
|
||||
|
||||
if(root.supports3DHTML) {
|
||||
descriptionTextModel.clear();
|
||||
descriptionTextModel.append({text: description});
|
||||
} else {
|
||||
descriptionText.text = description;
|
||||
}
|
||||
}
|
||||
|
||||
signal buy()
|
||||
|
@ -410,22 +417,22 @@ Rectangle {
|
|||
if (root.license === "No Rights Reserved (CC0)") {
|
||||
url = "https://creativecommons.org/publicdomain/zero/1.0/"
|
||||
} else if (root.license === "Attribution (CC BY)") {
|
||||
url = "https://creativecommons.org/licenses/by/4.0/"
|
||||
url = "https://creativecommons.org/licenses/by/4.0/legalcode.txt"
|
||||
} else if (root.license === "Attribution-ShareAlike (CC BY-SA)") {
|
||||
url = "https://creativecommons.org/licenses/by-sa/4.0/"
|
||||
url = "https://creativecommons.org/licenses/by-sa/4.0/legalcode.txt"
|
||||
} else if (root.license === "Attribution-NoDerivs (CC BY-ND)") {
|
||||
url = "https://creativecommons.org/licenses/by-nd/4.0/"
|
||||
url = "https://creativecommons.org/licenses/by-nd/4.0/legalcode.txt"
|
||||
} else if (root.license === "Attribution-NonCommercial (CC BY-NC)") {
|
||||
url = "https://creativecommons.org/licenses/by-nc/4.0/"
|
||||
url = "https://creativecommons.org/licenses/by-nc/4.0/legalcode.txt"
|
||||
} else if (root.license === "Attribution-NonCommercial-ShareAlike (CC BY-NC-SA)") {
|
||||
url = "https://creativecommons.org/licenses/by-nc-sa/4.0/"
|
||||
url = "https://creativecommons.org/licenses/by-nc-sa/4.0/legalcode.txt"
|
||||
} else if (root.license === "Attribution-NonCommercial-NoDerivs (CC BY-NC-ND)") {
|
||||
url = "https://creativecommons.org/licenses/by-nc-nd/4.0/"
|
||||
url = "https://creativecommons.org/licenses/by-nc-nd/4.0/legalcode.txt"
|
||||
} else if (root.license === "Proof of Provenance License (PoP License)") {
|
||||
url = "https://digitalassetregistry.com/PoP-License/v1/"
|
||||
}
|
||||
if(url) {
|
||||
licenseInfoWebView.url = url;
|
||||
showLicense(url)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -460,20 +467,21 @@ Rectangle {
|
|||
verticalAlignment: Text.AlignVCenter
|
||||
}
|
||||
|
||||
//RalewaySemiBold {
|
||||
// id: descriptionText
|
||||
//
|
||||
// anchors.top: descriptionLabel.bottom
|
||||
// anchors.left: parent.left
|
||||
// anchors.topMargin: 5
|
||||
// width: parent.width
|
||||
//
|
||||
// text: root.description
|
||||
// size: 14
|
||||
// color: hifi.colors.lightGray
|
||||
// verticalAlignment: Text.AlignVCenter
|
||||
// wrapMode: Text.Wrap
|
||||
//}
|
||||
RalewaySemiBold {
|
||||
id: descriptionText
|
||||
|
||||
anchors.top: descriptionLabel.bottom
|
||||
anchors.left: parent.left
|
||||
anchors.topMargin: 5
|
||||
width: parent.width
|
||||
|
||||
visible: !root.supports3DHTML
|
||||
|
||||
text: root.description
|
||||
size: 14
|
||||
color: hifi.colors.lightGray
|
||||
wrapMode: Text.Wrap
|
||||
}
|
||||
|
||||
|
||||
ListModel {
|
||||
|
|
|
@ -3000,6 +3000,13 @@ void Application::initializeUi() {
|
|||
QUrl{ "hifi/commerce/marketplace/Marketplace.qml" },
|
||||
}, marketplaceCallback);
|
||||
|
||||
QmlContextCallback platformInfoCallback = [](QQmlContext* context) {
|
||||
context->setContextProperty("PlatformInfo", new PlatformInfoScriptingInterface());
|
||||
};
|
||||
OffscreenQmlSurface::addWhitelistContextHandler({
|
||||
QUrl{ "hifi/commerce/marketplace/Marketplace.qml" },
|
||||
}, platformInfoCallback);
|
||||
|
||||
QmlContextCallback ttsCallback = [](QQmlContext* context) {
|
||||
context->setContextProperty("TextToSpeech", DependencyManager::get<TTSScriptingInterface>().data());
|
||||
};
|
||||
|
|
|
@ -133,3 +133,11 @@ bool PlatformInfoScriptingInterface::hasRiftControllers() {
|
|||
bool PlatformInfoScriptingInterface::hasViveControllers() {
|
||||
return qApp->hasViveControllers();
|
||||
}
|
||||
|
||||
bool PlatformInfoScriptingInterface::has3DHTML() {
|
||||
#if defined(Q_OS_ANDROID)
|
||||
return false;
|
||||
#else
|
||||
return true;
|
||||
#endif
|
||||
}
|
||||
|
|
|
@ -65,6 +65,12 @@ public slots:
|
|||
* @function Window.hasRift
|
||||
* @returns {boolean} <code>true</code> if running on Windows, otherwise <code>false</code>.*/
|
||||
bool hasViveControllers();
|
||||
|
||||
/**jsdoc
|
||||
* Returns true if device supports 3d HTML
|
||||
* @function Window.hasRift
|
||||
* @returns {boolean} <code>true</code> if device supports 3d HTML, otherwise <code>false</code>.*/
|
||||
bool has3DHTML();
|
||||
};
|
||||
|
||||
#endif // hifi_PlatformInfoScriptingInterface_h
|
||||
|
|
Loading…
Reference in a new issue