Merge branch 'master' of github.com:highfidelity/hifi into dice-on-table-1

This commit is contained in:
Seth Alves 2015-05-06 12:19:04 -07:00
commit a72ac3ead2
13 changed files with 386 additions and 226 deletions

View file

@ -1,8 +1,7 @@
<!-- Copyright 2015 High Fidelity, Inc. --> <!-- Copyright 2015 High Fidelity, Inc. -->
<html> <html>
<head> <head>
<meta charset="utf-8"> <meta charset="utf-8"/>
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<input type="hidden" id="version" value="1"/> <input type="hidden" id="version" value="1"/>
<title>Welcome to Interface</title> <title>Welcome to Interface</title>
@ -85,63 +84,63 @@
<div id="container" class="grid"> <div id="container" class="grid">
<div class="grid-unit"> <div class="grid-unit">
<h3>Move around</h3> <h3>Move around</h3>
<img class="grid-img" src="img/move.png" alt"Move around"></img> <img class="grid-img" src="img/move.png" alt="Move around"></img>
<p> <p>
Move around with WASD & fly<br> Move around with WASD &amp; fly<br/>
up or down with E & C.<br> up or down with E &amp; C.<br/>
Cmnd/Ctrl+G will send you<br> Cmnd/Ctrl+G will send you<br/>
home. Hitting Enter will let you<br> home. Hitting Enter will let you<br/>
teleport to a user or location. teleport to a user or location.
</p> </p>
</div> </div>
<div class="grid-unit"> <div class="grid-unit">
<h3>Listen & talk</h3> <h3>Listen &amp; talk</h3>
<img class="grid-img" src="img/talk.png" alt"Talk"></img> <img class="grid-img" src="img/talk.png" alt="Talk"></img>
<p> <p>
Use your best headphones<br> Use your best headphones<br/>
and microphone for high<br> and microphone for high<br/>
fidelity audio. Chat via text by<br> fidelity audio. Chat via text by<br/>
pressing the \ key. pressing the \ key.
</p> </p>
</div> </div>
<div class="grid-unit"> <div class="grid-unit">
<h3>Connect devices</h3> <h3>Connect devices</h3>
<img class="grid-img" src="img/devices.png" alt"Connect devices"></img> <img class="grid-img" src="img/devices.png" alt="Connect devices"></img>
<p> <p>
Have an Oculus Rift, a Razer<br> Have an Oculus Rift, a Razer<br/>
Hydra, or a PrimeSense 3D<br> Hydra, or a PrimeSense 3D<br/>
camera? We support them all. camera? We support them all.
</p> </p>
</div> </div>
<div class="grid-unit"> <div class="grid-unit">
<h3>Run a script</h3> <h3>Run a script</h3>
<img class="grid-img" src="img/run-script.png" alt"Run a script"></img> <img class="grid-img" src="img/run-script.png" alt="Run a script"></img>
<p> <p>
Cmnd/Cntrl+J will launch a<br> Cmnd/Cntrl+J will launch a<br/>
Running Scripts dialog to help<br> Running Scripts dialog to help<br/>
manage your scripts and search<br> manage your scripts and search<br/>
for new ones to run. for new ones to run.
</p> </p>
</div> </div>
<div class="grid-unit"> <div class="grid-unit">
<h3>Script something</h3> <h3>Script something</h3>
<img class="grid-img" src="img/write-script.png" alt"Write a script"></img> <img class="grid-img" src="img/write-script.png" alt="Write a script"></img>
<p> <p>
Write a script; we're always<br> Write a script; we're always<br/>
adding new features.<br> adding new features.<br/>
Cmnd/Cntrl+J will launch a<br> Cmnd/Cntrl+J will launch a<br/>
Running Scripts dialog to help<br> Running Scripts dialog to help<br/>
manage your scripts. manage your scripts.
</p> </p>
</div> </div>
<div class="grid-unit"> <div class="grid-unit">
<h3>Import models</h3> <h3>Import models</h3>
<img class="grid-img" src="img/models.png" alt"Import models"></img> <img class="grid-img" src="img/models.png" alt="Import models"></img>
<p> <p>
Use the <strong>edit.js</strong> script to<br> Use the <strong>edit.js</strong> script to<br/>
add FBX models in-world. You<br> add FBX models in-world. You<br/>
can use grids and fine tune<br> can use grids and fine tune<br/>
placement-related parameters<br> placement-related parameters<br/>
with ease. with ease.
</p> </p>
</div> </div>
@ -149,20 +148,19 @@
<div class="grid-unit"> <div class="grid-unit">
<h3>Read the docs</h3> <h3>Read the docs</h3>
<p> <p>
We are writing documentation on<br> We are writing documentation on<br/>
just about everything. Please,<br> just about everything. Please,<br/>
devour all we've written and make<br> devour all we've written and make<br/>
suggestions where necessary.<br> suggestions where necessary.<br/>
Documentation is always at<br> Documentation is always at<br/>
<a href="http://docs.highfidelity.com/"><b>docs.highfidelity.com</b></a> <a href="http://docs.highfidelity.com/"><b>docs.highfidelity.com</b></a>
</p> </p>
</div> </div>
<div class="grid-unit padding-block"></div> <div class="grid-unit padding-block"></div>
</div>
</div> </div>
</body> </body>
<script> <script>//<![CDATA[
<!-- Masonry PACKAGED v3.2.2 --> <!-- Masonry PACKAGED v3.2.2 -->
<!-- Cascading grid layout library --> <!-- Cascading grid layout library -->
<!-- http://masonry.desandro.com --> <!-- http://masonry.desandro.com -->
@ -185,6 +183,6 @@
<!-- Force reset layout after body resized--> <!-- Force reset layout after body resized-->
container.style.width = "0"; container.style.width = "0";
} }
</script> //]]></script>
</html> </html>

View file

@ -2,29 +2,149 @@ import QtQuick 2.3
import QtQuick.Controls 1.2 import QtQuick.Controls 1.2
import QtWebKit 3.0 import QtWebKit 3.0
import "controls" import "controls"
import "styles"
Dialog { Dialog {
title: "Browser Window" id: root
id: testDialog HifiConstants { id: hifi }
objectName: "Browser" title: "Browser"
width: 1280 resizable: true
height: 720 contentImplicitWidth: clientArea.implicitWidth
contentImplicitHeight: clientArea.implicitHeight
backgroundColor: "#7f000000"
Component.onCompleted: {
enabled = true
addressBar.text = webview.url
}
onParentChanged: {
if (visible && enabled) {
addressBar.forceActiveFocus();
addressBar.selectAll()
}
}
Item { Item {
id: clientArea id: clientArea
// The client area implicitHeight: 600
anchors.fill: parent implicitWidth: 800
anchors.margins: parent.margins x: root.clientX
anchors.topMargin: parent.topMargin y: root.clientY
width: root.clientWidth
height: root.clientHeight
Rectangle {
anchors.left: parent.left
anchors.right: parent.right
anchors.top: parent.top
anchors.bottom: scrollView.top
color: "white"
}
Row {
id: buttons
spacing: 4
anchors.top: parent.top
anchors.topMargin: 8
anchors.left: parent.left
anchors.leftMargin: 8
FontAwesome {
id: back; text: "\uf0a8"; size: 48; enabled: webview.canGoBack;
color: enabled ? hifi.colors.text : hifi.colors.disabledText
MouseArea { anchors.fill: parent; onClicked: webview.goBack() }
}
FontAwesome {
id: forward; text: "\uf0a9"; size: 48; enabled: webview.canGoForward;
color: enabled ? hifi.colors.text : hifi.colors.disabledText
MouseArea { anchors.fill: parent; onClicked: webview.goBack() }
}
FontAwesome {
id: reload; size: 48; text: webview.loading ? "\uf057" : "\uf021"
MouseArea { anchors.fill: parent; onClicked: webview.loading ? webview.stop() : webview.reload() }
}
}
Border {
height: 48
radius: 8
anchors.top: parent.top
anchors.topMargin: 8
anchors.right: parent.right
anchors.rightMargin: 8
anchors.left: buttons.right
anchors.leftMargin: 8
Item {
id: barIcon
width: parent.height
height: parent.height
Image {
source: webview.icon;
x: (parent.height - height) / 2
y: (parent.width - width) / 2
verticalAlignment: Image.AlignVCenter;
horizontalAlignment: Image.AlignHCenter
onSourceChanged: console.log("Icon url: " + source)
}
}
TextInput {
id: addressBar
anchors.right: parent.right
anchors.rightMargin: 8
anchors.left: barIcon.right
anchors.leftMargin: 0
anchors.verticalCenter: parent.verticalCenter
Keys.onPressed: {
switch(event.key) {
case Qt.Key_Enter:
case Qt.Key_Return:
event.accepted = true
if (text.indexOf("http") != 0) {
text = "http://" + text
}
webview.url = text
break;
}
}
}
}
ScrollView { ScrollView {
anchors.fill: parent id: scrollView
anchors.top: buttons.bottom
anchors.topMargin: 8
anchors.bottom: parent.bottom
anchors.left: parent.left
anchors.right: parent.right
WebView { WebView {
id: webview id: webview
url: "http://slashdot.org" url: "http://highfidelity.com"
anchors.fill: parent anchors.fill: parent
onLoadingChanged: {
if (loadRequest.status == WebView.LoadSucceededStarted) {
addressBar.text = loadRequest.url
}
}
onIconChanged: {
barIcon.source = icon
}
} }
} }
} // item
}
} Keys.onPressed: {
switch(event.key) {
case Qt.Key_L:
if (event.modifiers == Qt.ControlModifier) {
event.accepted = true
addressBar.selectAll()
addressBar.forceActiveFocus()
}
break;
}
}
} // dialog

View file

@ -0,0 +1,32 @@
import Hifi 1.0 as Hifi
import QtQuick 2.3
import QtQuick.Controls 1.2
import QtQuick.Controls.Styles 1.3
import QtWebKit 3.0
import "controls"
Dialog {
id: root
width: 800
height: 800
resizable: true
Hifi.InfoView {
id: infoView
// Fille the client area
anchors.fill: parent
anchors.margins: parent.margins
anchors.topMargin: parent.topMargin
ScrollView {
anchors.fill: parent
WebView {
objectName: "WebView"
id: webview
url: infoView.url
anchors.fill: parent
}
}
}
}

View file

@ -85,7 +85,7 @@
#include <UserActivityLogger.h> #include <UserActivityLogger.h>
#include <UUID.h> #include <UUID.h>
#include <MessageDialog.h> #include <MessageDialog.h>
#include <InfoView.h>
#include <SceneScriptingInterface.h> #include <SceneScriptingInterface.h>
#include "Application.h" #include "Application.h"
@ -134,7 +134,6 @@
#include "ui/DataWebDialog.h" #include "ui/DataWebDialog.h"
#include "ui/DialogsManager.h" #include "ui/DialogsManager.h"
#include "ui/InfoView.h"
#include "ui/LoginDialog.h" #include "ui/LoginDialog.h"
#include "ui/Snapshot.h" #include "ui/Snapshot.h"
#include "ui/StandAloneJSConsole.h" #include "ui/StandAloneJSConsole.h"
@ -777,8 +776,8 @@ void Application::initializeGL() {
// update before the first render // update before the first render
update(1.0f / _fps); update(1.0f / _fps);
InfoView::showFirstTime(INFO_HELP_PATH); InfoView::show(INFO_HELP_PATH, true);
} }
void Application::initializeUi() { void Application::initializeUi() {
@ -942,11 +941,11 @@ void Application::faceTrackerMuteToggled() {
} }
void Application::aboutApp() { void Application::aboutApp() {
InfoView::forcedShow(INFO_HELP_PATH); InfoView::show(INFO_HELP_PATH);
} }
void Application::showEditEntitiesHelp() { void Application::showEditEntitiesHelp() {
InfoView::forcedShow(INFO_EDIT_ENTITIES_PATH); InfoView::show(INFO_EDIT_ENTITIES_PATH);
} }
void Application::resetCamerasOnResizeGL(Camera& camera, int width, int height) { void Application::resetCamerasOnResizeGL(Camera& camera, int width, int height) {
@ -1133,6 +1132,13 @@ void Application::keyPressEvent(QKeyEvent* event) {
Menu::getInstance()->triggerOption(MenuOption::AddressBar); Menu::getInstance()->triggerOption(MenuOption::AddressBar);
break; break;
case Qt::Key_B:
if (isMeta) {
auto offscreenUi = DependencyManager::get<OffscreenUi>();
offscreenUi->load("Browser.qml");
}
break;
case Qt::Key_L: case Qt::Key_L:
if (isShifted && isMeta) { if (isShifted && isMeta) {
Menu::getInstance()->triggerOption(MenuOption::Log); Menu::getInstance()->triggerOption(MenuOption::Log);
@ -2313,18 +2319,6 @@ void Application::updateCamera(float deltaTime) {
PerformanceTimer perfTimer("updateCamera"); PerformanceTimer perfTimer("updateCamera");
bool showWarnings = Menu::getInstance()->isOptionChecked(MenuOption::PipelineWarnings); bool showWarnings = Menu::getInstance()->isOptionChecked(MenuOption::PipelineWarnings);
PerformanceWarning warn(showWarnings, "Application::updateCamera()"); PerformanceWarning warn(showWarnings, "Application::updateCamera()");
if (!OculusManager::isConnected() && !TV3DManager::isConnected() &&
Menu::getInstance()->isOptionChecked(MenuOption::OffAxisProjection)) {
FaceTracker* tracker = getActiveFaceTracker();
if (tracker && !tracker->isMuted()) {
const float EYE_OFFSET_SCALE = 0.025f;
glm::vec3 position = tracker->getHeadTranslation() * EYE_OFFSET_SCALE;
float xSign = (_myCamera.getMode() == CAMERA_MODE_MIRROR) ? 1.0f : -1.0f;
_myCamera.setEyeOffsetPosition(glm::vec3(position.x * xSign, position.y, -position.z));
updateProjectionMatrix();
}
}
} }
void Application::updateDialogs(float deltaTime) { void Application::updateDialogs(float deltaTime) {

View file

@ -282,7 +282,6 @@ Menu::Menu() {
Qt::CTRL | Qt::SHIFT | Qt::Key_1, false, Qt::CTRL | Qt::SHIFT | Qt::Key_1, false,
&nodeBounds, SLOT(setShowEntityNodes(bool))); &nodeBounds, SLOT(setShowEntityNodes(bool)));
addCheckableActionToQMenuAndActionHash(viewMenu, MenuOption::OffAxisProjection, 0, false);
addCheckableActionToQMenuAndActionHash(viewMenu, MenuOption::TurnWithHead, 0, false); addCheckableActionToQMenuAndActionHash(viewMenu, MenuOption::TurnWithHead, 0, false);
addCheckableActionToQMenuAndActionHash(viewMenu, MenuOption::Stats); addCheckableActionToQMenuAndActionHash(viewMenu, MenuOption::Stats);

View file

@ -214,7 +214,6 @@ namespace MenuOption {
const QString MuteFaceTracking = "Mute Face Tracking"; const QString MuteFaceTracking = "Mute Face Tracking";
const QString NoFaceTracking = "None"; const QString NoFaceTracking = "None";
const QString OctreeStats = "Entity Statistics"; const QString OctreeStats = "Entity Statistics";
const QString OffAxisProjection = "Off-Axis Projection";
const QString OnlyDisplayTopTen = "Only Display Top Ten"; const QString OnlyDisplayTopTen = "Only Display Top Ten";
const QString PackageModel = "Package Model..."; const QString PackageModel = "Package Model...";
const QString Pair = "Pair"; const QString Pair = "Pair";

View file

@ -1,94 +0,0 @@
//
// InfoView.cpp
// interface/src/ui
//
// Created by Stojce Slavkovski on 9/7/13.
// Copyright 2013 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 <QApplication>
#include <QDesktopWidget>
#include <QDesktopServices>
#include <QFileInfo>
#include <QtWebKitWidgets/QWebFrame>
#include <QtWebKit/QWebElement>
#include <PathUtils.h>
#include <SettingHandle.h>
#include "InfoView.h"
static const float MAX_DIALOG_HEIGHT_RATIO = 0.9f;
Setting::Handle<QString> infoVersion("info-version", QString());
InfoView::InfoView(bool forced, QString path) :
_forced(forced)
{
setWindowFlags(Qt::WindowStaysOnTopHint | Qt::CustomizeWindowHint | Qt::WindowCloseButtonHint);
QString absPath = QFileInfo(PathUtils::resourcesPath() + path).absoluteFilePath();
QUrl url = QUrl::fromLocalFile(absPath);
page()->setLinkDelegationPolicy(QWebPage::DelegateExternalLinks);
connect(this, SIGNAL(linkClicked(QUrl)), this, SLOT(linkClickedInfoView(QUrl)));
load(url);
connect(this, SIGNAL(loadFinished(bool)), this, SLOT(loaded(bool)));
}
void InfoView::showFirstTime(QString path) {
new InfoView(false, path);
}
void InfoView::forcedShow(QString path) {
new InfoView(true, path);
}
bool InfoView::shouldShow() {
bool shouldShow = false;
if (_forced) {
return true;
}
QString lastVersion = infoVersion.get();
QWebElement versionTag = page()->mainFrame()->findFirstElement("#version");
QString version = versionTag.attribute("value");
if (version != QString::null && (lastVersion == QString::null || lastVersion != version)) {
infoVersion.set(version);
shouldShow = true;
} else {
shouldShow = false;
}
return shouldShow;
}
void InfoView::loaded(bool ok) {
if (!ok || !shouldShow()) {
deleteLater();
return;
}
QDesktopWidget* desktop = qApp->desktop();
QWebFrame* mainFrame = page()->mainFrame();
int height = mainFrame->contentsSize().height() > desktop->height() ?
desktop->height() * MAX_DIALOG_HEIGHT_RATIO :
mainFrame->contentsSize().height();
resize(mainFrame->contentsSize().width(), height);
move(desktop->screen()->rect().center() - rect().center());
setWindowTitle(title());
setAttribute(Qt::WA_DeleteOnClose);
show();
}
void InfoView::linkClickedInfoView(QUrl url) {
close();
QDesktopServices::openUrl(url);
}

View file

@ -1,33 +0,0 @@
//
// InfoView.h
// interface/src/ui
//
// Created by Stojce Slavkovski on 9/7/13.
// Copyright 2013 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
//
#ifndef hifi_InfoView_h
#define hifi_InfoView_h
#include <QtWebKitWidgets/QWebView>
class InfoView : public QWebView {
Q_OBJECT
public:
static void showFirstTime(QString path);
static void forcedShow(QString path);
private:
InfoView(bool forced, QString path);
bool _forced;
bool shouldShow();
private slots:
void loaded(bool ok);
void linkClickedInfoView(QUrl url);
};
#endif // hifi_InfoView_h

View file

@ -1,7 +1,7 @@
set(TARGET_NAME ui) set(TARGET_NAME ui)
# use setup_hifi_library macro to setup our project and link appropriate Qt modules # use setup_hifi_library macro to setup our project and link appropriate Qt modules
setup_hifi_library(OpenGL Network Qml Quick Script) setup_hifi_library(OpenGL Network Qml Quick Script XmlPatterns)
link_hifi_libraries(render-utils shared) link_hifi_libraries(render-utils shared)

View file

@ -0,0 +1,87 @@
//
//
// InfoView.h
//
// Created by Bradley Austin Davis 2015/04/25
// Copyright 2015 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 "InfoView.h"
#include <SettingHandle.h>
#include <PathUtils.h>
#include <QXmlQuery>
#include <QDir>
const QUrl InfoView::QML{ "InfoView.qml" };
const QString InfoView::NAME{ "InfoView" };
Setting::Handle<QString> infoVersion("info-version", QString());
InfoView::InfoView(QQuickItem* parent) : QQuickItem(parent) {
}
void InfoView::registerType() {
qmlRegisterType<InfoView>("Hifi", 1, 0, NAME.toLocal8Bit().constData());
}
QString fetchVersion(const QUrl& url) {
QXmlQuery query;
query.bindVariable("file", QVariant(url));
query.setQuery("string((doc($file)//input[@id='version'])[1]/@value)");
QString r;
query.evaluateTo(&r);
return r.trimmed();
}
void InfoView::show(const QString& path, bool firstOrChangedOnly) {
static bool registered{ false };
if (!registered) {
registerType();
registered = true;
}
QUrl url;
if (QDir(path).isRelative()) {
url = QUrl::fromLocalFile(PathUtils::resourcesPath() + path);
} else {
url = QUrl::fromLocalFile(path);
}
if (firstOrChangedOnly) {
const QString lastVersion = infoVersion.get();
// If we have version information stored
if (lastVersion != QString::null) {
// Check to see the document version. If it's valid and matches
// the stored version, we're done, so exit
const QString version = fetchVersion(url);
if (version == QString::null || version == lastVersion) {
return;
}
}
}
auto offscreenUi = DependencyManager::get<OffscreenUi>();
QString infoViewName(NAME + "_" + path);
offscreenUi->show(QML, NAME + "_" + path, [=](QQmlContext* context, QObject* newObject){
QQuickItem* item = dynamic_cast<QQuickItem*>(newObject);
item->setWidth(720);
item->setHeight(720);
InfoView* newInfoView = newObject->findChild<InfoView*>();
Q_ASSERT(newInfoView);
newInfoView->parent()->setObjectName(infoViewName);
newInfoView->setUrl(url);
});
}
QUrl InfoView::url() {
return _url;
}
void InfoView::setUrl(const QUrl& url) {
if (url != _url) {
_url = url;
emit urlChanged();
}
}

View file

@ -0,0 +1,38 @@
//
// InfoView.h
//
// Created by Bradley Austin Davis 2015/04/25
// Copyright 2015 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
//
#ifndef hifi_InfoView_h
#define hifi_InfoView_h
#include <QQuickItem>
#include "OffscreenUi.h"
class InfoView : public QQuickItem {
Q_OBJECT
Q_PROPERTY(QUrl url READ url WRITE setUrl NOTIFY urlChanged)
static const QUrl QML;
static const QString NAME;
public:
static void registerType();
static void show(const QString& path, bool firstOrChangedOnly = false);
InfoView(QQuickItem* parent = nullptr);
QUrl url();
void setUrl(const QUrl& url);
signals:
void urlChanged();
private:
QUrl _url;
};
#endif // hifi_InfoView_h

View file

@ -254,8 +254,11 @@ void OffscreenUi::updateQuick() {
glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT); glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
_renderControl->render(); _renderControl->render();
// FIXME The web browsers seem to be leaving GL in an error state.
Q_ASSERT(!glGetError()); // Need a debug context with sync logging to figure out why.
// for now just clear the errors
glGetError();
// Q_ASSERT(!glGetError());
_quickWindow->resetOpenGLState(); _quickWindow->resetOpenGLState();

View file

@ -27,15 +27,15 @@
#include <QOpenGLFunctions> #include <QOpenGLFunctions>
#include <QQmlContext> #include <QQmlContext>
#include <QtQml/QQmlApplicationEngine> #include <QtQml/QQmlApplicationEngine>
#include <PathUtils.h>
#include <unordered_map> #include <unordered_map>
#include <memory> #include <memory>
#include <glm/glm.hpp> #include <glm/glm.hpp>
#include <PathUtils.h> #include <PathUtils.h>
#include <QDir> #include <QDir>
#include "MessageDialog.h" #include "MessageDialog.h"
#include "VrMenu.h" #include "VrMenu.h"
#include "InfoView.h"
#include <QDesktopWidget> #include <QDesktopWidget>
class RateCounter { class RateCounter {
@ -241,12 +241,21 @@ public:
} }
}; };
const QString& getQmlDir() { const QString& getResourcesDir() {
static QString dir; static QString dir;
if (dir.isEmpty()) { if (dir.isEmpty()) {
QDir path(__FILE__); QDir path(__FILE__);
path.cdUp(); path.cdUp();
dir = path.cleanPath(path.absoluteFilePath("../../../interface/resources/qml/")) + "/"; dir = path.cleanPath(path.absoluteFilePath("../../../interface/resources/")) + "/";
qDebug() << "Resources Path: " << dir;
}
return dir;
}
const QString& getQmlDir() {
static QString dir;
if (dir.isEmpty()) {
dir = getResourcesDir() + "qml/";
qDebug() << "Qml Path: " << dir; qDebug() << "Qml Path: " << dir;
} }
return dir; return dir;
@ -323,6 +332,7 @@ public:
MessageDialog::registerType(); MessageDialog::registerType();
VrMenu::registerType(); VrMenu::registerType();
InfoView::registerType();
qmlRegisterType<MenuConstants>("Hifi", 1, 0, "MenuConstants"); qmlRegisterType<MenuConstants>("Hifi", 1, 0, "MenuConstants");
@ -412,24 +422,31 @@ protected:
void keyPressEvent(QKeyEvent* event) { void keyPressEvent(QKeyEvent* event) {
_altPressed = Qt::Key_Alt == event->key(); _altPressed = Qt::Key_Alt == event->key();
switch (event->key()) { switch (event->key()) {
case Qt::Key_L: case Qt::Key_B:
if (event->modifiers() & Qt::CTRL) { if (event->modifiers() & Qt::CTRL) {
} auto offscreenUi = DependencyManager::get<OffscreenUi>();
break; offscreenUi->load("Browser.qml");
case Qt::Key_K: }
if (event->modifiers() & Qt::CTRL) { break;
OffscreenUi::question("Message title", "Message contents", [](QMessageBox::Button b){ case Qt::Key_L:
qDebug() << b; if (event->modifiers() & Qt::CTRL) {
}); InfoView::show(getResourcesDir() + "html/interface-welcome.html", true);
} }
break; break;
case Qt::Key_J: case Qt::Key_K:
if (event->modifiers() & Qt::CTRL) { if (event->modifiers() & Qt::CTRL) {
auto offscreenUi = DependencyManager::get<OffscreenUi>(); OffscreenUi::question("Message title", "Message contents", [](QMessageBox::Button b){
rootMenu = offscreenUi->getRootItem()->findChild<QObject*>("rootMenu"); qDebug() << b;
QMetaObject::invokeMethod(rootMenu, "popup"); });
} }
break; break;
case Qt::Key_J:
if (event->modifiers() & Qt::CTRL) {
auto offscreenUi = DependencyManager::get<OffscreenUi>();
rootMenu = offscreenUi->getRootItem()->findChild<QObject*>("rootMenu");
QMetaObject::invokeMethod(rootMenu, "popup");
}
break;
} }
QWindow::keyPressEvent(event); QWindow::keyPressEvent(event);
} }
@ -445,7 +462,7 @@ protected:
if (devicePixelRatio() != oldPixelRatio) { if (devicePixelRatio() != oldPixelRatio) {
oldPixelRatio = devicePixelRatio(); oldPixelRatio = devicePixelRatio();
resizeWindow(size()); resizeWindow(size());
} }
QWindow::moveEvent(event); QWindow::moveEvent(event);
} }
}; };