From 70fd954ef492461ab6b720792a82ef68d0bb442d Mon Sep 17 00:00:00 2001 From: David Rowe Date: Mon, 17 Aug 2020 11:34:58 +1200 Subject: [PATCH] Replace the "HifiAbout" API with a new "About" API --- .../qml/hifi/dialogs/TabletAboutDialog.qml | 15 ++++---- .../qml/hifi/tablet/OpenVrConfiguration.qml | 2 +- interface/src/AboutUtil.h | 34 +++++++++++++++---- interface/src/Application.cpp | 9 +++-- scripts/system/interstitialPage.js | 2 +- 5 files changed, 43 insertions(+), 19 deletions(-) diff --git a/interface/resources/qml/hifi/dialogs/TabletAboutDialog.qml b/interface/resources/qml/hifi/dialogs/TabletAboutDialog.qml index e7a9e0cef2..a943da32a0 100644 --- a/interface/resources/qml/hifi/dialogs/TabletAboutDialog.qml +++ b/interface/resources/qml/hifi/dialogs/TabletAboutDialog.qml @@ -3,6 +3,7 @@ // // Created by David Rowe on 18 Apr 2017 // Copyright 2017 High Fidelity, Inc. +// Copyright 2020 Vircadia contributors. // // Distributed under the Apache License, Version 2.0. // See the accompanying file LICENSE or http://www.apache.org/licenses/LICENSE-2.0.html @@ -33,12 +34,12 @@ Rectangle { anchors.left: parent.left anchors.leftMargin: 70 RalewayRegular { - text: "Build " + HiFiAbout.buildVersion + text: "Build " + About.buildVersion size: 16 color: "white" } RalewayRegular { - text: "Released " + HiFiAbout.buildDate + text: "Released " + About.buildDate size: 16 color: "white" } @@ -56,7 +57,7 @@ Rectangle { text: "Vircadia Github." size: 20 onLinkActivated: { - HiFiAbout.openUrl("https:/github.com/kasenvr/project-athena"); + About.openUrl("https:/github.com/kasenvr/project-athena"); } } @@ -70,13 +71,13 @@ Rectangle { MouseArea { anchors.fill: parent onClicked: { - HiFiAbout.openUrl("https://www.qt.io/"); + About.openUrl("https://www.qt.io/"); } } } RalewayRegular { color: "white" - text: "Built using Qt " + HiFiAbout.qtVersion + text: "Built using Qt " + About.qtVersion size: 12 anchors.verticalCenter: parent.verticalCenter } @@ -102,7 +103,7 @@ Rectangle { MouseArea { anchors.fill: parent onClicked: { - HiFiAbout.openUrl("http://opus-codec.org/"); + About.openUrl("http://opus-codec.org/"); } } } @@ -131,7 +132,7 @@ Rectangle { text: "Distributed under the Apache License, Version 2.0.." size: 14 onLinkActivated: { - HiFiAbout.openUrl("http://www.apache.org/licenses/LICENSE-2.0.html"); + About.openUrl("http://www.apache.org/licenses/LICENSE-2.0.html"); } } } diff --git a/interface/resources/qml/hifi/tablet/OpenVrConfiguration.qml b/interface/resources/qml/hifi/tablet/OpenVrConfiguration.qml index f1275a39fb..6d5c388457 100644 --- a/interface/resources/qml/hifi/tablet/OpenVrConfiguration.qml +++ b/interface/resources/qml/hifi/tablet/OpenVrConfiguration.qml @@ -894,7 +894,7 @@ Flickable { hoverEnabled: true onEntered: privacyPolicyUnderline.visible = true; onExited: privacyPolicyUnderline.visible = false; - onClicked: HiFiAbout.openUrl("https://vircadia.com/privacy-policy"); + onClicked: About.openUrl("https://vircadia.com/privacy-policy"); } } diff --git a/interface/src/AboutUtil.h b/interface/src/AboutUtil.h index 4a5074857d..b4a318cf63 100644 --- a/interface/src/AboutUtil.h +++ b/interface/src/AboutUtil.h @@ -4,6 +4,7 @@ // // Created by Vlad Stelmahovsky on 15/5/2018. // Copyright 2018 High Fidelity, Inc. +// Copyright 2020 Vircadia Contributors. // // Distributed under the Apache License, Version 2.0. // See the accompanying file LICENSE or http://www.apache.org/licenses/LICENSE-2.0.html @@ -16,10 +17,10 @@ #include /**jsdoc - * The HifiAbout API provides information about the version of Interface that is currently running. It also - * has the functionality to open a web page in an Interface browser window. + * The About API provides information about the version of Interface that is currently running. It also has the + * functionality to open a web page in an Interface browser window. * - * @namespace HifiAbout + * @namespace About * * @hifi-interface * @hifi-client-entity @@ -30,9 +31,28 @@ * @property {string} qtVersion - The Qt version used in Interface that is currently running. Read-only. * * @example Report build information for the version of Interface currently running. - * print("HiFi build date: " + HifiAbout.buildDate); // Returns the build date of the version of Interface currently running on your machine. - * print("HiFi version: " + HifiAbout.buildVersion); // Returns the build version of Interface currently running on your machine. - * print("Qt version: " + HifiAbout.qtVersion); // Returns the Qt version details of the version of Interface currently running on your machine. + * print("Interface build date: " + About.buildDate); + * print("Interface version: " + About.buildVersion); + * print("Qt version: " + About.qtVersion); + */ + + /**jsdoc + * The HifiAbout API provides information about the version of Interface that is currently running. It also + * has the functionality to open a web page in an Interface browser window. + * + * @namespace HifiAbout + * + * @hifi-interface + * @hifi-client-entity + * @hifi-avatar + * + * @deprecated This API is deprecated and will be removed. Use the {@link About} API instead. + * + * @property {string} buildDate - The build date of Interface that is currently running. Read-only. + * @property {string} buildVersion - The build version of Interface that is currently running. Read-only. + * @property {string} qtVersion - The Qt version used in Interface that is currently running. Read-only. + * + * @borrows About.openUrl as openUrl */ class AboutUtil : public QObject { @@ -53,7 +73,7 @@ public slots: /**jsdoc * Display a web page in an Interface browser window. - * @function HifiAbout.openUrl + * @function About.openUrl * @param {string} url - The URL of the web page you want to view in Interface. */ void openUrl(const QString &url) const; diff --git a/interface/src/Application.cpp b/interface/src/Application.cpp index cc2aed7f53..80af7900ac 100644 --- a/interface/src/Application.cpp +++ b/interface/src/Application.cpp @@ -3512,7 +3512,8 @@ void Application::onDesktopRootContextCreated(QQmlContext* surfaceContext) { surfaceContext->setContextProperty("Selection", DependencyManager::get().data()); surfaceContext->setContextProperty("ContextOverlay", DependencyManager::get().data()); surfaceContext->setContextProperty("WalletScriptingInterface", DependencyManager::get().data()); - surfaceContext->setContextProperty("HiFiAbout", AboutUtil::getInstance()); + surfaceContext->setContextProperty("About", AboutUtil::getInstance()); + surfaceContext->setContextProperty("HiFiAbout", AboutUtil::getInstance()); // Deprecated surfaceContext->setContextProperty("ResourceRequestObserver", DependencyManager::get().data()); if (auto steamClient = PluginManager::getInstance()->getSteamClientPlugin()) { @@ -3623,7 +3624,8 @@ void Application::setupQmlSurface(QQmlContext* surfaceContext, bool setAdditiona surfaceContext->setContextProperty("Pointers", DependencyManager::get().data()); surfaceContext->setContextProperty("Window", DependencyManager::get().data()); surfaceContext->setContextProperty("Reticle", qApp->getApplicationCompositor().getReticleInterface()); - surfaceContext->setContextProperty("HiFiAbout", AboutUtil::getInstance()); + surfaceContext->setContextProperty("About", AboutUtil::getInstance()); + surfaceContext->setContextProperty("HiFiAbout", AboutUtil::getInstance()); // Deprecated. surfaceContext->setContextProperty("WalletScriptingInterface", DependencyManager::get().data()); surfaceContext->setContextProperty("ResourceRequestObserver", DependencyManager::get().data()); surfaceContext->setContextProperty("PlatformInfo", PlatformInfoScriptingInterface::getInstance()); @@ -7520,7 +7522,8 @@ void Application::registerScriptEngineWithApplicationServices(const ScriptEngine scriptEngine->registerGlobalObject("ContextOverlay", DependencyManager::get().data()); scriptEngine->registerGlobalObject("WalletScriptingInterface", DependencyManager::get().data()); scriptEngine->registerGlobalObject("AddressManager", DependencyManager::get().data()); - scriptEngine->registerGlobalObject("HifiAbout", AboutUtil::getInstance()); + scriptEngine->registerGlobalObject("About", AboutUtil::getInstance()); + scriptEngine->registerGlobalObject("HifiAbout", AboutUtil::getInstance()); // Deprecated. scriptEngine->registerGlobalObject("ResourceRequestObserver", DependencyManager::get().data()); registerInteractiveWindowMetaType(scriptEngine.data()); diff --git a/scripts/system/interstitialPage.js b/scripts/system/interstitialPage.js index 23cff7699a..0c238756a9 100644 --- a/scripts/system/interstitialPage.js +++ b/scripts/system/interstitialPage.js @@ -369,7 +369,7 @@ } } - var THE_PLACE = (HifiAbout.buildVersion === "dev") ? "hifi://TheSpot-dev" : "hifi://TheSpot"; + var THE_PLACE = (About.buildVersion === "dev") ? "hifi://TheSpot-dev" : "hifi://TheSpot"; function clickedOnOverlay(overlayID, event) { if (loadingToTheSpotHoverID === overlayID) { location.handleLookupString(THE_PLACE);