adding back reload scripts

This commit is contained in:
Dante Ruiz 2018-05-29 17:38:02 -07:00
parent 5dadfde637
commit 3942f397d0
3 changed files with 23 additions and 20 deletions

View file

@ -20,9 +20,9 @@
#include <OffscreenQmlDialog.h> #include <OffscreenQmlDialog.h>
AboutUtil::AboutUtil(QObject *parent) : QObject(parent) { AboutUtil::AboutUtil(QObject *parent) : QObject(parent) {
QLocale locale_; QLocale locale;
m_DateConverted = QDate::fromString(BuildInfo::BUILD_TIME, "dd/MM/yyyy"). _dateConverted = QDate::fromString(BuildInfo::BUILD_TIME, "dd/MM/yyyy").
toString(locale_.dateFormat(QLocale::ShortFormat)); toString(locale.dateFormat(QLocale::ShortFormat));
} }
AboutUtil *AboutUtil::getInstance() AboutUtil *AboutUtil::getInstance()
@ -31,17 +31,17 @@ AboutUtil *AboutUtil::getInstance()
return &instance; return &instance;
} }
QString AboutUtil::buildDate() const QString AboutUtil::getBuildDate() const
{ {
return m_DateConverted; return _dateConverted;
} }
QString AboutUtil::buildVersion() const QString AboutUtil::getBuildVersion() const
{ {
return BuildInfo::VERSION; return BuildInfo::VERSION;
} }
QString AboutUtil::qtVersion() const QString AboutUtil::getQtVersion() const
{ {
return qVersion(); return qVersion();
} }
@ -49,7 +49,7 @@ QString AboutUtil::qtVersion() const
void AboutUtil::openUrl(const QString& url) const { void AboutUtil::openUrl(const QString& url) const {
auto tabletScriptingInterface = DependencyManager::get<TabletScriptingInterface>(); 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 hmd = DependencyManager::get<HMDScriptingInterface>();
auto offscreenUi = DependencyManager::get<OffscreenUi>(); auto offscreenUi = DependencyManager::get<OffscreenUi>();

View file

@ -16,27 +16,24 @@
#include <QObject> #include <QObject>
class AboutUtil : public QObject { class AboutUtil : public QObject {
Q_OBJECT Q_OBJECT
Q_PROPERTY(QString buildDate READ buildDate CONSTANT) Q_PROPERTY(QString buildDate READ getBuildDate CONSTANT)
Q_PROPERTY(QString buildVersion READ buildVersion CONSTANT) Q_PROPERTY(QString buildVersion READ getBuildVersion CONSTANT)
Q_PROPERTY(QString qtVersion READ qtVersion CONSTANT) Q_PROPERTY(QString qtVersion READ getQtVersion CONSTANT)
AboutUtil(QObject* parent = nullptr);
public: public:
static AboutUtil* getInstance(); static AboutUtil* getInstance();
~AboutUtil() {} ~AboutUtil() {}
QString buildDate() const; QString getBuildDate() const;
QString buildVersion() const; QString getBuildVersion() const;
QString qtVersion() const; QString getQtVersion() const;
public slots: public slots:
void openUrl(const QString &url) const; void openUrl(const QString &url) const;
private: private:
AboutUtil(QObject* parent = nullptr);
QString m_DateConverted; QString _dateConverted;
}; };
#endif // hifi_AboutUtil_h #endif // hifi_AboutUtil_h

View file

@ -3642,7 +3642,6 @@ void Application::keyPressEvent(QKeyEvent* event) {
_keysPressed.insert(event->key()); _keysPressed.insert(event->key());
_controllerScriptingInterface->emitKeyPressEvent(event); // send events to any registered scripts _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 one of our scripts have asked to capture this event, then stop processing it
if (_controllerScriptingInterface->isKeyCaptured(event)) { if (_controllerScriptingInterface->isKeyCaptured(event)) {
return; return;
@ -3727,6 +3726,13 @@ void Application::keyPressEvent(QKeyEvent* event) {
} }
break; break;
case Qt::Key_R:
if (isMeta && !event->isAutoRepeat()) {
DependencyManager::get<ScriptEngines>()->reloadAllScripts();
DependencyManager::get<OffscreenUi>()->clearCache();
}
break;
case Qt::Key_Asterisk: case Qt::Key_Asterisk:
Menu::getInstance()->triggerOption(MenuOption::DefaultSkybox); Menu::getInstance()->triggerOption(MenuOption::DefaultSkybox);
break; break;