mirror of
https://github.com/overte-org/overte.git
synced 2025-04-14 07:47:30 +02:00
Merge pull request #13254 from danteruiz/add-back-reload-scripts
adding back reload scripts shortcut and clean up AboutUtil
This commit is contained in:
commit
194c33bf19
3 changed files with 29 additions and 28 deletions
|
@ -8,48 +8,46 @@
|
|||
// Distributed under the Apache License, Version 2.0.
|
||||
// See the accompanying file LICENSE or http://www.apache.org/licenses/LICENSE-2.0.html
|
||||
//
|
||||
|
||||
#include "AboutUtil.h"
|
||||
#include <QDate>
|
||||
#include <QLocale>
|
||||
|
||||
#include "AboutUtil.h"
|
||||
#include "BuildInfo.h"
|
||||
#include <ui/TabletScriptingInterface.h>
|
||||
#include <OffscreenQmlDialog.h>
|
||||
|
||||
#include "BuildInfo.h"
|
||||
#include "DependencyManager.h"
|
||||
#include "scripting/HMDScriptingInterface.h"
|
||||
#include "Application.h"
|
||||
#include <OffscreenQmlDialog.h>
|
||||
|
||||
AboutUtil::AboutUtil(QObject *parent) : QObject(parent) {
|
||||
QLocale locale_;
|
||||
m_DateConverted = QDate::fromString(BuildInfo::BUILD_TIME, "dd/MM/yyyy").
|
||||
toString(locale_.dateFormat(QLocale::ShortFormat));
|
||||
QLocale locale;
|
||||
_dateConverted = QDate::fromString(BuildInfo::BUILD_TIME, "dd/MM/yyyy").
|
||||
toString(locale.dateFormat(QLocale::ShortFormat));
|
||||
}
|
||||
|
||||
AboutUtil *AboutUtil::getInstance()
|
||||
{
|
||||
AboutUtil *AboutUtil::getInstance() {
|
||||
static AboutUtil instance;
|
||||
return &instance;
|
||||
}
|
||||
|
||||
QString AboutUtil::buildDate() const
|
||||
{
|
||||
return m_DateConverted;
|
||||
QString AboutUtil::getBuildDate() const {
|
||||
return _dateConverted;
|
||||
}
|
||||
|
||||
QString AboutUtil::buildVersion() const
|
||||
{
|
||||
QString AboutUtil::getBuildVersion() const {
|
||||
return BuildInfo::VERSION;
|
||||
}
|
||||
|
||||
QString AboutUtil::qtVersion() const
|
||||
{
|
||||
QString AboutUtil::getQtVersion() const {
|
||||
return qVersion();
|
||||
}
|
||||
|
||||
void AboutUtil::openUrl(const QString& url) const {
|
||||
|
||||
auto tabletScriptingInterface = DependencyManager::get<TabletScriptingInterface>();
|
||||
auto tablet = dynamic_cast<TabletProxy*>(tabletScriptingInterface->getTablet("com.highfidelity.interface.tablet.system"));
|
||||
auto tablet = tabletScriptingInterface->getTablet("com.highfidelity.interface.tablet.system");
|
||||
auto hmd = DependencyManager::get<HMDScriptingInterface>();
|
||||
auto offscreenUi = DependencyManager::get<OffscreenUi>();
|
||||
|
||||
|
|
|
@ -16,27 +16,24 @@
|
|||
#include <QObject>
|
||||
|
||||
class AboutUtil : public QObject {
|
||||
|
||||
Q_OBJECT
|
||||
|
||||
Q_PROPERTY(QString buildDate READ buildDate CONSTANT)
|
||||
Q_PROPERTY(QString buildVersion READ buildVersion CONSTANT)
|
||||
Q_PROPERTY(QString qtVersion READ qtVersion CONSTANT)
|
||||
|
||||
AboutUtil(QObject* parent = nullptr);
|
||||
Q_PROPERTY(QString buildDate READ getBuildDate CONSTANT)
|
||||
Q_PROPERTY(QString buildVersion READ getBuildVersion CONSTANT)
|
||||
Q_PROPERTY(QString qtVersion READ getQtVersion CONSTANT)
|
||||
public:
|
||||
static AboutUtil* getInstance();
|
||||
~AboutUtil() {}
|
||||
|
||||
QString buildDate() const;
|
||||
QString buildVersion() const;
|
||||
QString qtVersion() const;
|
||||
QString getBuildDate() const;
|
||||
QString getBuildVersion() const;
|
||||
QString getQtVersion() const;
|
||||
|
||||
public slots:
|
||||
void openUrl(const QString &url) const;
|
||||
private:
|
||||
|
||||
QString m_DateConverted;
|
||||
AboutUtil(QObject* parent = nullptr);
|
||||
QString _dateConverted;
|
||||
};
|
||||
|
||||
#endif // hifi_AboutUtil_h
|
||||
|
|
|
@ -3645,7 +3645,6 @@ void Application::keyPressEvent(QKeyEvent* event) {
|
|||
_keysPressed.insert(event->key());
|
||||
|
||||
_controllerScriptingInterface->emitKeyPressEvent(event); // send events to any registered scripts
|
||||
|
||||
// if one of our scripts have asked to capture this event, then stop processing it
|
||||
if (_controllerScriptingInterface->isKeyCaptured(event)) {
|
||||
return;
|
||||
|
@ -3730,6 +3729,13 @@ void Application::keyPressEvent(QKeyEvent* event) {
|
|||
}
|
||||
break;
|
||||
|
||||
case Qt::Key_R:
|
||||
if (isMeta && !event->isAutoRepeat()) {
|
||||
DependencyManager::get<ScriptEngines>()->reloadAllScripts();
|
||||
DependencyManager::get<OffscreenUi>()->clearCache();
|
||||
}
|
||||
break;
|
||||
|
||||
case Qt::Key_Asterisk:
|
||||
Menu::getInstance()->triggerOption(MenuOption::DefaultSkybox);
|
||||
break;
|
||||
|
|
Loading…
Reference in a new issue