// // AboutUtil.cpp // interface/src // // Created by Vlad Stelmahovsky on 15/5/2018. // Copyright 2018 High Fidelity, Inc. // // Distributed under the Apache License, Version 2.0. // See the accompanying file LICENSE or http://www.apache.org/licenses/LICENSE-2.0.html // #include #include #include "AboutUtil.h" #include "BuildInfo.h" #include #include "DependencyManager.h" #include "scripting/HMDScriptingInterface.h" #include "Application.h" #include AboutUtil::AboutUtil(QObject *parent) : QObject(parent) { QLocale locale_; m_DateConverted = QDate::fromString(BuildInfo::BUILD_TIME, "dd/MM/yyyy"). toString(locale_.dateFormat(QLocale::ShortFormat)); } AboutUtil *AboutUtil::getInstance() { static AboutUtil instance; return &instance; } QString AboutUtil::buildDate() const { return m_DateConverted; } QString AboutUtil::buildVersion() const { return BuildInfo::VERSION; } QString AboutUtil::qtVersion() const { return qVersion(); } void AboutUtil::openUrl(const QString& url) const { auto tabletScriptingInterface = DependencyManager::get(); auto tablet = dynamic_cast(tabletScriptingInterface->getTablet("com.highfidelity.interface.tablet.system")); auto hmd = DependencyManager::get(); auto offscreenUi = DependencyManager::get(); if (tablet->getToolbarMode()) { offscreenUi->load("Browser.qml", [=](QQmlContext* context, QObject* newObject) { newObject->setProperty("url", url); }); } else { if (!hmd->getShouldShowTablet() && !qApp->isHMDMode()) { offscreenUi->load("Browser.qml", [=](QQmlContext* context, QObject* newObject) { newObject->setProperty("url", url); }); } else { tablet->gotoWebScreen(url); } } }