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 bool keyboardRaised: false
|
||||||
property string searchScopeString: "Featured"
|
property string searchScopeString: "Featured"
|
||||||
property bool isLoggedIn: false;
|
property bool isLoggedIn: false;
|
||||||
|
property bool supports3DHTML: true;
|
||||||
|
|
||||||
anchors.fill: (typeof parent === undefined) ? undefined : parent
|
anchors.fill: (typeof parent === undefined) ? undefined : parent
|
||||||
|
|
||||||
function getMarketplaceItems() {
|
function getMarketplaceItems() {
|
||||||
|
@ -60,6 +61,8 @@ Rectangle {
|
||||||
|
|
||||||
Component.onCompleted: {
|
Component.onCompleted: {
|
||||||
Commerce.getLoginStatus();
|
Commerce.getLoginStatus();
|
||||||
|
|
||||||
|
supports3DHTML = PlatformInfo.has3DHTML();
|
||||||
}
|
}
|
||||||
|
|
||||||
Component.onDestruction: {
|
Component.onDestruction: {
|
||||||
|
@ -103,7 +106,7 @@ Rectangle {
|
||||||
if (result.status !== 'success') {
|
if (result.status !== 'success') {
|
||||||
console.log("Failed to get Marketplace Item", result.data.message);
|
console.log("Failed to get Marketplace Item", result.data.message);
|
||||||
} else {
|
} else {
|
||||||
|
marketplaceItem.supports3DHTML = root.supports3DHTML;
|
||||||
marketplaceItem.item_id = result.data.id;
|
marketplaceItem.item_id = result.data.id;
|
||||||
marketplaceItem.image_url = result.data.thumbnail_url;
|
marketplaceItem.image_url = result.data.thumbnail_url;
|
||||||
marketplaceItem.name = result.data.title;
|
marketplaceItem.name = result.data.title;
|
||||||
|
@ -958,8 +961,16 @@ Rectangle {
|
||||||
}
|
}
|
||||||
|
|
||||||
onShowLicense: {
|
onShowLicense: {
|
||||||
licenseInfoWebView.url = url;
|
var xhr = new XMLHttpRequest;
|
||||||
licenseInfo.visible = true;
|
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: {
|
onCategoryClicked: {
|
||||||
root.categoryString = category;
|
root.categoryString = category;
|
||||||
|
@ -1001,11 +1012,13 @@ Rectangle {
|
||||||
leftMargin: 15
|
leftMargin: 15
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
Item {
|
Item {
|
||||||
id: footerText
|
id: footerText
|
||||||
|
|
||||||
anchors.fill: parent
|
anchors.fill: parent
|
||||||
visible: itemsList.visible
|
visible: root.supports3DHTML && itemsList.visible
|
||||||
|
|
||||||
HiFiGlyphs {
|
HiFiGlyphs {
|
||||||
id: footerGlyph
|
id: footerGlyph
|
||||||
|
@ -1072,6 +1085,8 @@ Rectangle {
|
||||||
rightMargin: 10
|
rightMargin: 10
|
||||||
}
|
}
|
||||||
|
|
||||||
|
visible: root.supports3DHTML
|
||||||
|
|
||||||
text: "SEE ALL MARKETS"
|
text: "SEE ALL MARKETS"
|
||||||
width: 180
|
width: 180
|
||||||
|
|
||||||
|
@ -1100,16 +1115,24 @@ Rectangle {
|
||||||
|
|
||||||
visible: false;
|
visible: false;
|
||||||
|
|
||||||
HifiControlsUit.WebView {
|
ScrollView {
|
||||||
id: licenseInfoWebView
|
|
||||||
|
|
||||||
anchors {
|
anchors {
|
||||||
bottomMargin: 1
|
bottomMargin: 1
|
||||||
topMargin: 60
|
topMargin: 60
|
||||||
leftMargin: 1
|
leftMargin: 15
|
||||||
rightMargin: 1
|
|
||||||
fill: parent
|
fill: parent
|
||||||
}
|
}
|
||||||
|
|
||||||
|
RalewayRegular {
|
||||||
|
id: licenseText
|
||||||
|
|
||||||
|
width:440
|
||||||
|
wrapMode: Text.Wrap
|
||||||
|
|
||||||
|
text: ""
|
||||||
|
size: 18;
|
||||||
|
color: hifi.colors.baseGray
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
Item {
|
Item {
|
||||||
|
|
|
@ -43,6 +43,8 @@ Rectangle {
|
||||||
property string created_at: ""
|
property string created_at: ""
|
||||||
property bool isLoggedIn: false;
|
property bool isLoggedIn: false;
|
||||||
property int edition: -1;
|
property int edition: -1;
|
||||||
|
property bool supports3DHTML: false;
|
||||||
|
|
||||||
|
|
||||||
onCategoriesChanged: {
|
onCategoriesChanged: {
|
||||||
categoriesListModel.clear();
|
categoriesListModel.clear();
|
||||||
|
@ -52,8 +54,13 @@ Rectangle {
|
||||||
}
|
}
|
||||||
|
|
||||||
onDescriptionChanged: {
|
onDescriptionChanged: {
|
||||||
descriptionTextModel.clear();
|
|
||||||
descriptionTextModel.append({text: description})
|
if(root.supports3DHTML) {
|
||||||
|
descriptionTextModel.clear();
|
||||||
|
descriptionTextModel.append({text: description});
|
||||||
|
} else {
|
||||||
|
descriptionText.text = description;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
signal buy()
|
signal buy()
|
||||||
|
@ -410,22 +417,22 @@ Rectangle {
|
||||||
if (root.license === "No Rights Reserved (CC0)") {
|
if (root.license === "No Rights Reserved (CC0)") {
|
||||||
url = "https://creativecommons.org/publicdomain/zero/1.0/"
|
url = "https://creativecommons.org/publicdomain/zero/1.0/"
|
||||||
} else if (root.license === "Attribution (CC BY)") {
|
} 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)") {
|
} 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)") {
|
} 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)") {
|
} 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)") {
|
} 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)") {
|
} 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)") {
|
} else if (root.license === "Proof of Provenance License (PoP License)") {
|
||||||
url = "https://digitalassetregistry.com/PoP-License/v1/"
|
url = "https://digitalassetregistry.com/PoP-License/v1/"
|
||||||
}
|
}
|
||||||
if(url) {
|
if(url) {
|
||||||
licenseInfoWebView.url = url;
|
showLicense(url)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -460,20 +467,21 @@ Rectangle {
|
||||||
verticalAlignment: Text.AlignVCenter
|
verticalAlignment: Text.AlignVCenter
|
||||||
}
|
}
|
||||||
|
|
||||||
//RalewaySemiBold {
|
RalewaySemiBold {
|
||||||
// id: descriptionText
|
id: descriptionText
|
||||||
//
|
|
||||||
// anchors.top: descriptionLabel.bottom
|
anchors.top: descriptionLabel.bottom
|
||||||
// anchors.left: parent.left
|
anchors.left: parent.left
|
||||||
// anchors.topMargin: 5
|
anchors.topMargin: 5
|
||||||
// width: parent.width
|
width: parent.width
|
||||||
//
|
|
||||||
// text: root.description
|
visible: !root.supports3DHTML
|
||||||
// size: 14
|
|
||||||
// color: hifi.colors.lightGray
|
text: root.description
|
||||||
// verticalAlignment: Text.AlignVCenter
|
size: 14
|
||||||
// wrapMode: Text.Wrap
|
color: hifi.colors.lightGray
|
||||||
//}
|
wrapMode: Text.Wrap
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
ListModel {
|
ListModel {
|
||||||
|
|
|
@ -3000,6 +3000,13 @@ void Application::initializeUi() {
|
||||||
QUrl{ "hifi/commerce/marketplace/Marketplace.qml" },
|
QUrl{ "hifi/commerce/marketplace/Marketplace.qml" },
|
||||||
}, marketplaceCallback);
|
}, marketplaceCallback);
|
||||||
|
|
||||||
|
QmlContextCallback platformInfoCallback = [](QQmlContext* context) {
|
||||||
|
context->setContextProperty("PlatformInfo", new PlatformInfoScriptingInterface());
|
||||||
|
};
|
||||||
|
OffscreenQmlSurface::addWhitelistContextHandler({
|
||||||
|
QUrl{ "hifi/commerce/marketplace/Marketplace.qml" },
|
||||||
|
}, platformInfoCallback);
|
||||||
|
|
||||||
QmlContextCallback ttsCallback = [](QQmlContext* context) {
|
QmlContextCallback ttsCallback = [](QQmlContext* context) {
|
||||||
context->setContextProperty("TextToSpeech", DependencyManager::get<TTSScriptingInterface>().data());
|
context->setContextProperty("TextToSpeech", DependencyManager::get<TTSScriptingInterface>().data());
|
||||||
};
|
};
|
||||||
|
|
|
@ -133,3 +133,11 @@ bool PlatformInfoScriptingInterface::hasRiftControllers() {
|
||||||
bool PlatformInfoScriptingInterface::hasViveControllers() {
|
bool PlatformInfoScriptingInterface::hasViveControllers() {
|
||||||
return qApp->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
|
* @function Window.hasRift
|
||||||
* @returns {boolean} <code>true</code> if running on Windows, otherwise <code>false</code>.*/
|
* @returns {boolean} <code>true</code> if running on Windows, otherwise <code>false</code>.*/
|
||||||
bool hasViveControllers();
|
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
|
#endif // hifi_PlatformInfoScriptingInterface_h
|
||||||
|
|
Loading…
Reference in a new issue