Renaming Tablet API to Tablets, supporting dev-mode QML loading from filesystem

This commit is contained in:
Brad Davis 2017-11-10 12:34:52 -08:00
parent 92a3c209aa
commit 7bf1b176d7
91 changed files with 388 additions and 436 deletions

View file

@ -12,8 +12,10 @@ function(JOIN VALUES GLUE OUTPUT)
endfunction()
set(INTERFACE_QML_QRC ${CMAKE_CURRENT_BINARY_DIR}/qml.qrc)
generate_qrc(OUTPUT ${INTERFACE_QML_QRC} PATH ${CMAKE_CURRENT_SOURCE_DIR}/resources GLOBS *.qml *.qss *.js *.html *.ttf *.gif *.svg *.png *.jpg)
if (NOT DEV_BUILD)
set(INTERFACE_QML_QRC ${CMAKE_CURRENT_BINARY_DIR}/qml.qrc)
generate_qrc(OUTPUT ${INTERFACE_QML_QRC} PATH ${CMAKE_CURRENT_SOURCE_DIR}/resources GLOBS *.qml *.qss *.js *.html *.ttf *.gif *.svg *.png *.jpg)
endif()
# set a default root dir for each of our optional externals if it was not passed
set(OPTIONAL_EXTERNALS "LeapMotion")
@ -80,7 +82,9 @@ qt5_wrap_ui(QT_UI_HEADERS "${QT_UI_FILES}")
# add them to the interface source files
set(INTERFACE_SRCS ${INTERFACE_SRCS} "${QT_UI_HEADERS}" "${QT_RESOURCES}")
if (NOT DEV_BUILD)
list(APPEND INTERFACE_SRCS ${INTERFACE_QML_QRC})
endif()
if (UNIX)
install(

View file

@ -248,7 +248,7 @@ Item {
//dont rise local keyboard
keyboardEnabled = !root.isTablet && HMD.active;
//but rise Tablet's one instead for Tablet interface
//but rise Tablet's one instead for Tablets interface
if (root.isTablet) {
root.keyboardEnabled = HMD.active;
root.keyboardRaised = Qt.binding( function() { return keyboardRaised; })

View file

@ -221,7 +221,7 @@ Item {
root.iconText = "<"
//dont rise local keyboard
keyboardEnabled = !root.isTablet && HMD.active;
//but rise Tablet's one instead for Tablet interface
//but rise Tablet's one instead for Tablets interface
if (root.isTablet) {
root.keyboardEnabled = HMD.active;
root.keyboardRaised = Qt.binding( function() { return keyboardRaised; })

View file

@ -131,7 +131,7 @@ Item {
root.iconText = "<"
//dont rise local keyboard
keyboardEnabled = !root.isTablet && HMD.active;
//but rise Tablet's one instead for Tablet interface
//but rise Tablet's one instead for Tablets interface
if (root.isTablet) {
root.keyboardEnabled = HMD.active;
root.keyboardRaised = Qt.binding( function() { return keyboardRaised; })

View file

@ -29,12 +29,12 @@ Original.Button {
onHoveredChanged: {
if (hovered) {
tabletInterface.playSound(TabletEnums.ButtonHover);
Tablets.playSound(TabletEnums.ButtonHover);
}
}
onClicked: {
tabletInterface.playSound(TabletEnums.ButtonClick);
Tablets.playSound(TabletEnums.ButtonClick);
}
style: ButtonStyle {

View file

@ -31,12 +31,12 @@ Original.CheckBox {
activeFocusOnPress: true
onClicked: {
tabletInterface.playSound(TabletEnums.ButtonClick);
Tablets.playSound(TabletEnums.ButtonClick);
}
// TODO: doesnt works for QQC1. check with QQC2
// onHovered: {
// tabletInterface.playSound(TabletEnums.ButtonHover);
// Tablets.playSound(TabletEnums.ButtonHover);
// }
style: CheckBoxStyle {

View file

@ -36,12 +36,12 @@ CheckBox {
hoverEnabled: true
onClicked: {
tabletInterface.playSound(TabletEnums.ButtonClick);
Tablets.playSound(TabletEnums.ButtonClick);
}
onHoveredChanged: {
if (hovered) {
tabletInterface.playSound(TabletEnums.ButtonHover);
Tablets.playSound(TabletEnums.ButtonHover);
}
}

View file

@ -27,12 +27,12 @@ Original.Button {
onHoveredChanged: {
if (hovered) {
tabletInterface.playSound(TabletEnums.ButtonHover);
Tablets.playSound(TabletEnums.ButtonHover);
}
}
onClicked: {
tabletInterface.playSound(TabletEnums.ButtonClick);
Tablets.playSound(TabletEnums.ButtonClick);
}
style: ButtonStyle {

View file

@ -35,13 +35,13 @@ Item {
onContainsMouseChanged: {
if (containsMouse) {
tabletInterface.playSound(TabletEnums.ButtonHover);
Tablets.playSound(TabletEnums.ButtonHover);
}
}
onClicked: {
mouse.accepted = true;
tabletInterface.playSound(TabletEnums.ButtonClick);
Tablets.playSound(TabletEnums.ButtonClick);
webEntity.synthesizeKeyPress(glyph);
webEntity.synthesizeKeyPress(glyph, mirrorText);

View file

@ -30,12 +30,12 @@ Original.RadioButton {
readonly property int checkRadius: 2
onClicked: {
tabletInterface.playSound(TabletEnums.ButtonClick);
Tablets.playSound(TabletEnums.ButtonClick);
}
// TODO: doesnt works for QQC1. check with QQC2
// onHovered: {
// tabletInterface.playSound(TabletEnums.ButtonHover);
// Tablets.playSound(TabletEnums.ButtonHover);
// }
style: RadioButtonStyle {

View file

@ -41,7 +41,7 @@ Item {
}
if (WebEngineView.LoadFailedStatus === loadRequest.status) {
console.log(" Tablet WebEngineView failed to load url: " + loadRequest.url.toString());
console.log("Tablet WebEngineView failed to load url: " + loadRequest.url.toString());
}
if (WebEngineView.LoadSucceededStatus === loadRequest.status) {

View file

@ -24,7 +24,7 @@ Item {
});
object.selected.connect(function(button) {
if (button === OriginalDialogs.StandardButton.Ok) {
var tablet = Tablet.getTablet("com.highfidelity.interface.tablet.system");
var tablet = Tablets.getTablet("com.highfidelity.interface.tablet.system");
tablet.gotoHomeScreen()
}
});

View file

@ -89,10 +89,10 @@ TabletModalWindow {
//bodyLoader.active = false
}
if (gotoPreviousApp) {
var tablet = Tablet.getTablet("com.highfidelity.interface.tablet.system");
var tablet = Tablets.getTablet("com.highfidelity.interface.tablet.system");
tablet.returnToPreviousApp();
} else {
Tablet.getTablet("com.highfidelity.interface.tablet.system").gotoHomeScreen();
Tablets.getTablet("com.highfidelity.interface.tablet.system").gotoHomeScreen();
}
}

View file

@ -25,13 +25,13 @@ Preference {
id: button
onHoveredChanged: {
if (hovered) {
tabletInterface.playSound(TabletEnums.ButtonHover);
Tablets.playSound(TabletEnums.ButtonHover);
}
}
onClicked: {
preference.trigger();
tabletInterface.playSound(TabletEnums.ButtonClick);
Tablets.playSound(TabletEnums.ButtonClick);
}
width: 180
anchors.bottom: parent.bottom

View file

@ -41,12 +41,12 @@ Preference {
id: checkBox
onHoveredChanged: {
if (hovered) {
tabletInterface.playSound(TabletEnums.ButtonHover);
Tablets.playSound(TabletEnums.ButtonHover);
}
}
onClicked: {
tabletInterface.playSound(TabletEnums.ButtonClick);
Tablets.playSound(TabletEnums.ButtonClick);
}
anchors {

View file

@ -246,12 +246,12 @@ Item {
anchors.fill: parent;
acceptedButtons: Qt.LeftButton;
onClicked: {
tabletInterface.playSound(TabletEnums.ButtonClick);
Tablets.playSound(TabletEnums.ButtonClick);
goFunction("hifi://" + hifiUrl);
}
hoverEnabled: true;
onEntered: {
tabletInterface.playSound(TabletEnums.ButtonHover);
Tablets.playSound(TabletEnums.ButtonHover);
hoverThunk();
}
onExited: unhoverThunk();
@ -269,7 +269,7 @@ Item {
}
}
function go() {
tabletInterface.playSound(TabletEnums.ButtonClick);
Tablets.playSound(TabletEnums.ButtonClick);
goFunction(drillDownToPlace ? ("/places/" + placeName) : ("/user_stories/" + storyId));
}
MouseArea {

View file

@ -61,12 +61,12 @@ Rectangle {
scrollGestureEnabled: false;
onClicked: {
Audio.muted = !Audio.muted;
tabletInterface.playSound(TabletEnums.ButtonClick);
Tablets.playSound(TabletEnums.ButtonClick);
}
drag.target: dragTarget;
onContainsMouseChanged: {
if (containsMouse) {
tabletInterface.playSound(TabletEnums.ButtonHover);
Tablets.playSound(TabletEnums.ButtonHover);
}
}
}

View file

@ -123,11 +123,11 @@ Item {
hoverEnabled: true
enabled: true
onClicked: {
tabletInterface.playSound(TabletEnums.ButtonClick);
Tablets.playSound(TabletEnums.ButtonClick);
newEntityButton.clicked();
}
onEntered: {
tabletInterface.playSound(TabletEnums.ButtonHover);
Tablets.playSound(TabletEnums.ButtonHover);
newEntityButton.state = "hover state";
}
onExited: {

View file

@ -1,280 +0,0 @@
import QtQuick 2.5
import QtGraphicalEffects 1.0
import QtQuick.Layouts 1.3
import "."
import "../../styles-uit"
import "../audio" as HifiAudio
Item {
id: tablet
objectName: "tablet"
property int rowIndex: 0
property int columnIndex: 0
property int count: (flowMain.children.length - 1)
Component {
id: buttonComponent
TabletButton { }
}
Component.onCompleted: {
tablet.populateButtons();
}
function createClickedHandler(proxy) {
return function() { proxy.clicked(); }
}
function populateButtons() {
var tabletProxy = Tablet.getTablet("com.highfidelity.interface.tablet.system");
var buttons = tabletProxy.getButtons();
for (var i = 0; i < buttons.length; i++) {
var proxy = buttons[i];
var button = tablet.addButtonProxy(proxy.getProperties());
button.clicked.connect(createClickedHandler(proxy));
proxy.setQmlButton(button);
}
sortButtons();
}
// used to look up a button by its uuid
function findButtonIndex(uuid) {
if (!uuid) {
return -1;
}
for (var i in flowMain.children) {
var child = flowMain.children[i];
if (child.uuid === uuid) {
return i;
}
}
return -1;
}
function sortButtons() {
var children = [];
for (var i = 0; i < flowMain.children.length; i++) {
children[i] = flowMain.children[i];
}
children.sort(function (a, b) {
if (a.sortOrder === b.sortOrder) {
// subsort by stableOrder, because JS sort is not stable in qml.
return a.stableOrder - b.stableOrder;
} else {
return a.sortOrder - b.sortOrder;
}
});
flowMain.children = children;
}
// called by C++ code when a button should be added to the tablet
function addButtonProxy(properties) {
var button = buttonComponent.createObject(flowMain);
// copy all properites to button
var keys = Object.keys(properties).forEach(function (key) {
button[key] = properties[key];
});
// pass a reference to the tabletRoot object to the button.
if (tabletRoot) {
button.tabletRoot = tabletRoot;
} else {
button.tabletRoot = parent.parent;
}
return button;
}
// called by C++ code when a button should be removed from the tablet
function removeButtonProxy(properties) {
var index = findButtonIndex(properties.uuid);
if (index < 0) {
console.log("Warning: Tablet.qml could not find button with uuid = " + properties.uuid);
} else {
flowMain.children[index].destroy();
}
}
Rectangle {
id: bgTopBar
height: 90
anchors {
top: parent.top
left: parent.left
right: parent.right
}
gradient: Gradient {
GradientStop {
position: 0
color: "#2b2b2b"
}
GradientStop {
position: 1
color: "#1e1e1e"
}
}
HifiAudio.MicBar {
anchors {
left: parent.left
leftMargin: 30
verticalCenter: parent.verticalCenter
}
}
Item {
width: 150
height: 50
anchors.right: parent.right
anchors.rightMargin: 30
anchors.verticalCenter: parent.verticalCenter
ColumnLayout {
anchors.fill: parent
RalewaySemiBold {
text: Account.loggedIn ? qsTr("Log out") : qsTr("Log in")
horizontalAlignment: Text.AlignRight
anchors.right: parent.right
font.pixelSize: 20
color: "#afafaf"
}
RalewaySemiBold {
visible: Account.loggedIn
height: Account.loggedIn ? parent.height/2 - parent.spacing/2 : 0
text: Account.loggedIn ? "[" + tabletRoot.usernameShort + "]" : ""
horizontalAlignment: Text.AlignRight
anchors.right: parent.right
font.pixelSize: 20
color: "#afafaf"
}
}
MouseArea {
anchors.fill: parent
onClicked: {
if (!Account.loggedIn) {
DialogsManager.showLoginDialog()
} else {
Account.logOut()
}
}
}
}
}
Rectangle {
id: bgMain
gradient: Gradient {
GradientStop {
position: 0
color: "#2b2b2b"
}
GradientStop {
position: 1
color: "#0f212e"
}
}
anchors.bottom: parent.bottom
anchors.bottomMargin: 0
anchors.right: parent.right
anchors.rightMargin: 0
anchors.left: parent.left
anchors.leftMargin: 0
anchors.top: bgTopBar.bottom
anchors.topMargin: 0
Flickable {
id: flickable
width: parent.width
height: parent.height
contentWidth: parent.width
contentHeight: flowMain.childrenRect.height + flowMain.anchors.topMargin + flowMain.anchors.bottomMargin + flowMain.spacing
clip: true
Flow {
id: flowMain
spacing: 16
anchors.right: parent.right
anchors.rightMargin: 30
anchors.left: parent.left
anchors.leftMargin: 30
anchors.bottom: parent.bottom
anchors.bottomMargin: 30
anchors.top: parent.top
anchors.topMargin: 30
}
}
}
function setCurrentItemState(state) {
var index = rowIndex + columnIndex;
if (index >= 0 && index <= count ) {
flowMain.children[index].state = state;
}
}
function nextItem() {
setCurrentItemState("base state");
var nextColumnIndex = (columnIndex + 3 + 1) % 3;
var nextIndex = rowIndex + nextColumnIndex;
if(nextIndex <= count) {
columnIndex = nextColumnIndex;
};
setCurrentItemState("hover state");
}
function previousItem() {
setCurrentItemState("base state");
var prevIndex = (columnIndex + 3 - 1) % 3;
if((rowIndex + prevIndex) <= count){
columnIndex = prevIndex;
}
setCurrentItemState("hover state");
}
function upItem() {
setCurrentItemState("base state");
rowIndex = rowIndex - 3;
if (rowIndex < 0 ) {
rowIndex = (count - (count % 3));
var index = rowIndex + columnIndex;
if(index > count) {
rowIndex = rowIndex - 3;
}
}
setCurrentItemState("hover state");
}
function downItem() {
setCurrentItemState("base state");
rowIndex = rowIndex + 3;
var index = rowIndex + columnIndex;
if (index > count ) {
rowIndex = 0;
}
setCurrentItemState("hover state");
}
function selectItem() {
flowMain.children[rowIndex + columnIndex].clicked();
if (tabletRoot) {
tabletRoot.playButtonClickSound();
}
}
Keys.onRightPressed: nextItem();
Keys.onLeftPressed: previousItem();
Keys.onDownPressed: downItem();
Keys.onUpPressed: upItem();
Keys.onReturnPressed: selectItem();
}

View file

@ -72,7 +72,7 @@ StackView {
addressLine.focus = !HMD.active;
root.parentChanged.connect(center);
center();
tablet = Tablet.getTablet("com.highfidelity.interface.tablet.system");
tablet = Tablets.getTablet("com.highfidelity.interface.tablet.system");
}
Component.onDestruction: {
root.parentChanged.disconnect(center);
@ -149,7 +149,7 @@ StackView {
onClicked: {
addressBarDialog.loadHome();
tabletRoot.shown = false;
tablet = Tablet.getTablet("com.highfidelity.interface.tablet.system");
tablet = Tablets.getTablet("com.highfidelity.interface.tablet.system");
tablet.gotoHomeScreen();
}
anchors {

View file

@ -37,7 +37,7 @@ Item {
}
function closeDialog() {
Tablet.getTablet("com.highfidelity.interface.tablet.system").gotoHomeScreen();
Tablets.getTablet("com.highfidelity.interface.tablet.system").gotoHomeScreen();
}
anchors.topMargin: hifi.dimensions.tabletMenuHeader // Space for header.

View file

@ -121,7 +121,6 @@ Item {
enabled: true
preventStealing: true
onClicked: {
console.log("Tablet Button Clicked!");
if (tabletButton.inDebugMode) {
if (tabletButton.isActive) {
tabletButton.isActive = false;
@ -131,12 +130,12 @@ Item {
}
tabletButton.clicked();
if (tabletRoot) {
tabletInterface.playSound(TabletEnums.ButtonClick);
Tablets.playSound(TabletEnums.ButtonClick);
}
}
onEntered: {
tabletButton.isEntered = true;
tabletInterface.playSound(TabletEnums.ButtonHover);
Tablets.playSound(TabletEnums.ButtonHover);
if (tabletButton.isActive) {
tabletButton.state = "hover active state";

View file

@ -0,0 +1,159 @@
import QtQuick 2.5
import QtGraphicalEffects 1.0
import QtQuick.Layouts 1.3
import "."
import "../../styles-uit"
import "../audio" as HifiAudio
Item {
id: tablet
objectName: "tablet"
property var tabletProxy: Tablets.getTablet("com.highfidelity.interface.tablet.system");
Rectangle {
id: bgTopBar
height: 90
anchors {
top: parent.top
left: parent.left
right: parent.right
}
gradient: Gradient {
GradientStop {
position: 0
color: "#2b2b2b"
}
GradientStop {
position: 1
color: "#1e1e1e"
}
}
HifiAudio.MicBar {
anchors {
left: parent.left
leftMargin: 30
verticalCenter: parent.verticalCenter
}
}
Item {
width: 150
height: 50
anchors.right: parent.right
anchors.rightMargin: 30
anchors.verticalCenter: parent.verticalCenter
ColumnLayout {
anchors.fill: parent
RalewaySemiBold {
text: Account.loggedIn ? qsTr("Log out") : qsTr("Log in")
horizontalAlignment: Text.AlignRight
anchors.right: parent.right
font.pixelSize: 20
color: "#afafaf"
}
RalewaySemiBold {
visible: Account.loggedIn
height: Account.loggedIn ? parent.height/2 - parent.spacing/2 : 0
text: Account.loggedIn ? "[" + tabletRoot.usernameShort + "]" : ""
horizontalAlignment: Text.AlignRight
anchors.right: parent.right
font.pixelSize: 20
color: "#afafaf"
}
}
MouseArea {
anchors.fill: parent
onClicked: {
if (!Account.loggedIn) {
DialogsManager.showLoginDialog()
} else {
Account.logOut()
}
}
}
}
}
Rectangle {
id: bgMain
clip: true
gradient: Gradient {
GradientStop {
position: 0
color: "#2b2b2b"
}
GradientStop {
position: 1
color: "#0f212e"
}
}
anchors.bottom: parent.bottom
anchors.right: parent.right
anchors.left: parent.left
anchors.top: bgTopBar.bottom
GridView {
id: flickable
anchors.top: parent.top
anchors.topMargin: 15
anchors.bottom: parent.bottom
anchors.horizontalCenter: parent.horizontalCenter
width: cellWidth * 3
cellHeight: 145
cellWidth: 145
model: tabletProxy.buttons
delegate: Item {
width: flickable.cellWidth
height: flickable.cellHeight
property var proxy: modelData
TabletButton {
id: tabletButton
anchors.centerIn: parent
onClicked: modelData.clicked()
state: wrapper.GridView.isCurrentItem ? "hover state" : "base state"
}
Connections {
target: modelData;
onPropertiesChanged: {
updateProperties();
}
}
Component.onCompleted: updateProperties()
function updateProperties() {
var keys = Object.keys(modelData.properties).forEach(function (key) {
if (tabletButton[key] !== modelData.properties[key]) {
tabletButton[key] = modelData.properties[key];
}
});
}
}
}
}
Keys.onRightPressed: flickable.moveCurrentIndexRight();
Keys.onLeftPressed: flickable.moveCurrentIndexLeft();
Keys.onDownPressed: flickable.moveCurrentIndexDown();
Keys.onUpPressed: flickable.moveCurrentIndexUp();
Keys.onReturnPressed: {
if (flickable.currentItem) {
flickable.currentItem.proxy.clicked();
if (tabletRoot) {
tabletRoot.playButtonClickSound();
}
}
}
}

View file

@ -77,12 +77,12 @@ FocusScope {
anchors.fill: parent
hoverEnabled: true
onEntered: {
tabletInterface.playSound(TabletEnums.ButtonHover);
Tablets.playSound(TabletEnums.ButtonHover);
listView.currentIndex = index
}
onClicked: {
tabletInterface.playSound(TabletEnums.ButtonClick);
Tablets.playSound(TabletEnums.ButtonClick);
root.selected(item);
}
}

View file

@ -56,7 +56,7 @@ Item {
}
function closeDialog() {
var tablet = Tablet.getTablet("com.highfidelity.interface.tablet.system");
var tablet = Tablets.getTablet("com.highfidelity.interface.tablet.system");
if (gotoPreviousApp) {
tablet.returnToPreviousApp();
@ -206,7 +206,7 @@ Item {
}
Component.onCompleted: {
tablet = Tablet.getTablet("com.highfidelity.interface.tablet.system");
tablet = Tablets.getTablet("com.highfidelity.interface.tablet.system");
keyboardEnabled = HMD.active;
}

View file

@ -2214,12 +2214,12 @@ extern void setupPreferences();
void Application::initializeUi() {
// Make sure all QML surfaces share the main thread GL context
OffscreenQmlSurface::setSharedContext(_offscreenContext->getContext());
OffscreenQmlSurface::addWhitelistContextHandler(QUrl{ "qrc:///qml/OverlayWindowTest.qml" },
OffscreenQmlSurface::addWhitelistContextHandler(QUrl{ "OverlayWindowTest.qml" },
[](QQmlContext* context) {
qDebug() << "Whitelist OverlayWindow worked";
context->setContextProperty("OverlayWindowTestString", "TestWorked");
});
OffscreenQmlSurface::addWhitelistContextHandler(QUrl{ "qrc:///qml/hifi/audio/Audio.qml" },
OffscreenQmlSurface::addWhitelistContextHandler(QUrl{ "hifi/audio/Audio.qml" },
[](QQmlContext* context) {
qDebug() << "QQQ" << __FUNCTION__ << "Whitelist Audio worked";
});
@ -2310,9 +2310,6 @@ void Application::initializeUi() {
surfaceContext->setContextProperty("InputConfiguration", DependencyManager::get<InputConfiguration>().data());
surfaceContext->setContextProperty("Account", AccountScriptingInterface::getInstance());
surfaceContext->setContextProperty("Tablet", DependencyManager::get<TabletScriptingInterface>().data());
// Tablet inteference with Tablet.qml. Need to avoid this in QML space
surfaceContext->setContextProperty("tabletInterface", DependencyManager::get<TabletScriptingInterface>().data());
surfaceContext->setContextProperty("DialogsManager", _dialogsManagerScriptingInterface);
surfaceContext->setContextProperty("GlobalServices", GlobalServicesScriptingInterface::getInstance());
surfaceContext->setContextProperty("FaceTracker", DependencyManager::get<DdeFaceTracker>().data());
@ -5807,7 +5804,8 @@ void Application::registerScriptEngineWithApplicationServices(ScriptEnginePointe
qScriptRegisterMetaType(scriptEngine.data(), wrapperToScriptValue<TabletProxy>, wrapperFromScriptValue<TabletProxy>);
qScriptRegisterMetaType(scriptEngine.data(),
wrapperToScriptValue<TabletButtonProxy>, wrapperFromScriptValue<TabletButtonProxy>);
// Tablet inteference with Tablet.qml. Need to avoid this in QML space
scriptEngine->registerGlobalObject("Tablets", DependencyManager::get<TabletScriptingInterface>().data());
// FIXME remove these deprecated names for the tablet scripting interface
scriptEngine->registerGlobalObject("tabletInterface", DependencyManager::get<TabletScriptingInterface>().data());
scriptEngine->registerGlobalObject("Tablet", DependencyManager::get<TabletScriptingInterface>().data());

View file

@ -209,7 +209,6 @@ void Web3DOverlay::setupQmlSurface() {
_webSurface->getSurfaceContext()->setContextProperty("fileDialogHelper", new FileDialogHelper());
_webSurface->getSurfaceContext()->setContextProperty("MyAvatar", DependencyManager::get<AvatarManager>()->getMyAvatar().get());
_webSurface->getSurfaceContext()->setContextProperty("ScriptDiscoveryService", DependencyManager::get<ScriptEngines>().data());
_webSurface->getSurfaceContext()->setContextProperty("Tablet", DependencyManager::get<TabletScriptingInterface>().data());
_webSurface->getSurfaceContext()->setContextProperty("Assets", DependencyManager::get<AssetMappingsScriptingInterface>().data());
_webSurface->getSurfaceContext()->setContextProperty("LODManager", DependencyManager::get<LODManager>().data());
_webSurface->getSurfaceContext()->setContextProperty("OctreeStats", DependencyManager::get<OctreeStatsProvider>().data());
@ -228,9 +227,6 @@ void Web3DOverlay::setupQmlSurface() {
_webSurface->getSurfaceContext()->setContextProperty("pathToFonts", "../../");
// Tablet inteference with Tablet.qml. Need to avoid this in QML space
_webSurface->getSurfaceContext()->setContextProperty("tabletInterface", DependencyManager::get<TabletScriptingInterface>().data());
tabletScriptingInterface->setQmlTabletRoot("com.highfidelity.interface.tablet.system", _webSurface.data());
// mark the TabletProxy object as cpp ownership.
QObject* tablet = tabletScriptingInterface->getTablet("com.highfidelity.interface.tablet.system");

View file

@ -217,8 +217,6 @@ gpu::TexturePointer TextureCache::cacheTextureByHash(const std::string& hash, co
if (!result) {
_texturesByHashes[hash] = texture;
result = texture;
} else {
qCWarning(modelnetworking) << "QQQ Swapping out texture with previous live texture in hash " << hash.c_str();
}
}
return result;

View file

@ -9,10 +9,6 @@
// See the accompanying file LICENSE or http://www.apache.org/licenses/LICENSE-2.0.html
//
#ifdef _WIN32
#define _USE_MATH_DEFINES
#endif
#include <cstring>
#include <cstdio>
#include <cmath>

View file

@ -24,9 +24,30 @@
const QString& PathUtils::resourcesPath() {
#ifdef Q_OS_MAC
static QString staticResourcePath = QCoreApplication::applicationDirPath() + "/../Resources/";
static const QString staticResourcePath = QCoreApplication::applicationDirPath() + "/../Resources/";
#else
static QString staticResourcePath = QCoreApplication::applicationDirPath() + "/resources/";
static const QString staticResourcePath = QCoreApplication::applicationDirPath() + "/resources/";
#endif
return staticResourcePath;
}
#ifdef DEV_BUILD
const QString& PathUtils::projectRootPath() {
static QString sourceFolder;
static std::once_flag once;
std::call_once(once, [&] {
QDir thisDir = QFileInfo(__FILE__).absoluteDir();
sourceFolder = QDir::cleanPath(thisDir.absoluteFilePath("../../../"));
});
return sourceFolder;
}
#endif
const QString& PathUtils::qmlBasePath() {
#ifdef DEV_BUILD
static const QString staticResourcePath = QUrl::fromLocalFile(projectRootPath() + "/interface/resources/qml/").toString();
#else
static const QString staticResourcePath = "qrc:///qml/";
#endif
return staticResourcePath;

View file

@ -30,6 +30,10 @@ class PathUtils : public QObject, public Dependency {
Q_PROPERTY(QUrl defaultScripts READ defaultScriptsLocation CONSTANT)
public:
static const QString& resourcesPath();
static const QString& qmlBasePath();
#ifdef DEV_BUILD
static const QString& projectRootPath();
#endif
static QString getAppDataPath();
static QString getAppLocalDataPath();

View file

@ -48,6 +48,7 @@
#include "types/SoundEffect.h"
#include "TabletScriptingInterface.h"
#include "ToolbarScriptingInterface.h"
#include "Logging.h"
Q_LOGGING_CATEGORY(trace_render_qml, "trace.render.qml")
@ -62,7 +63,10 @@ public:
void addWhitelistContextHandler(const std::initializer_list<QUrl>& urls, const QmlContextCallback& callback) {
withWriteLock([&] {
for (const auto& url : urls) {
for (auto url : urls) {
if (url.isRelative()) {
url = QUrl(PathUtils::qmlBasePath() + url.toString());
}
_callbacks[url].push_back(callback);
}
});
@ -382,6 +386,13 @@ void initializeQmlEngine(QQmlEngine* engine, QQuickWindow* window) {
rootContext->setContextProperty("FileTypeProfile", new FileTypeProfile(rootContext));
rootContext->setContextProperty("HFWebEngineProfile", new HFWebEngineProfile(rootContext));
rootContext->setContextProperty("Paths", DependencyManager::get<PathUtils>().data());
static std::once_flag once;
std::call_once(once, [&] {
qRegisterMetaType<TabletProxy*>();
qRegisterMetaType<TabletButtonProxy*>();
});
rootContext->setContextProperty("Tablets", DependencyManager::get<TabletScriptingInterface>().data());
rootContext->setContextProperty("Toolbars", DependencyManager::get<ToolbarScriptingInterface>().data());
}
QQmlEngine* acquireEngine(QQuickWindow* window) {
@ -587,7 +598,7 @@ void OffscreenQmlSurface::create() {
auto qmlEngine = acquireEngine(_quickWindow);
_qmlContext = new QQmlContext(qmlEngine->rootContext());
_qmlContext->setBaseUrl(QUrl{ "qrc:///qml/" });
_qmlContext->setBaseUrl(QUrl{ PathUtils::qmlBasePath() });
_qmlContext->setContextProperty("offscreenWindow", QVariant::fromValue(getWindow()));
_qmlContext->setContextProperty("eventBridge", this);
_qmlContext->setContextProperty("webEntity", this);
@ -715,7 +726,6 @@ void OffscreenQmlSurface::load(const QUrl& qmlSource, bool createNewContext, con
}
void OffscreenQmlSurface::loadInternal(const QUrl& qmlSource, bool createNewContext, QQuickItem* parent, const QmlContextObjectCallback& onQmlLoadedCallback) {
qCDebug(uiLogging) << "QQQ" << __FUNCTION__ << qmlSource;
if (QThread::currentThread() != thread()) {
qCWarning(uiLogging) << "Called load on a non-surface thread";
}
@ -725,7 +735,6 @@ void OffscreenQmlSurface::loadInternal(const QUrl& qmlSource, bool createNewCont
QUrl finalQmlSource = qmlSource;
if ((qmlSource.isRelative() && !qmlSource.isEmpty()) || qmlSource.scheme() == QLatin1String("file")) {
finalQmlSource = _qmlContext->resolvedUrl(qmlSource);
qCDebug(uiLogging) << "QQQ" << __FUNCTION__ << "resolved to " << finalQmlSource;
}
auto targetContext = contextForUrl(finalQmlSource, createNewContext);

View file

@ -210,7 +210,7 @@ QObject* TabletScriptingInterface::getFlags() {
// TabletProxy
//
static const char* TABLET_SOURCE_URL = "hifi/tablet/Tablet.qml";
static const char* TABLET_HOME_SOURCE_URL = "hifi/tablet/TabletHome.qml";
static const char* WEB_VIEW_SOURCE_URL = "hifi/tablet/TabletWebView.qml";
static const char* VRMENU_SOURCE_URL = "hifi/tablet/TabletMenu.qml";
@ -274,7 +274,7 @@ void TabletProxy::setToolbarMode(bool toolbarMode) {
} else {
removeButtonsFromToolbar();
if (_currentPathLoaded == TABLET_SOURCE_URL) {
if (_currentPathLoaded == TABLET_HOME_SOURCE_URL) {
// Tablet QML now pulls buttons from Tablet proxy
} else {
loadHomeScreen(true);
@ -408,7 +408,7 @@ void TabletProxy::setQmlTabletRoot(OffscreenQmlSurface* qmlOffscreenSurface) {
});
if (_toolbarMode) {
QMetaObject::invokeMethod(_qmlTabletRoot, "loadSource", Q_ARG(const QVariant&, QVariant(TABLET_SOURCE_URL)));
QMetaObject::invokeMethod(_qmlTabletRoot, "loadSource", Q_ARG(const QVariant&, QVariant(TABLET_HOME_SOURCE_URL)));
}
// force to the tablet to go to the homescreen
@ -618,7 +618,7 @@ void TabletProxy::loadHomeScreen(bool forceOntoHomeScreen) {
if ((_state != State::Home && _state != State::Uninitialized) || forceOntoHomeScreen) {
if (!_toolbarMode && _qmlTabletRoot) {
QMetaObject::invokeMethod(_qmlTabletRoot, "loadSource", Q_ARG(const QVariant&, QVariant(TABLET_SOURCE_URL)));
QMetaObject::invokeMethod(_qmlTabletRoot, "loadSource", Q_ARG(const QVariant&, QVariant(TABLET_HOME_SOURCE_URL)));
QMetaObject::invokeMethod(_qmlTabletRoot, "playButtonClickSound");
} else if (_toolbarMode && _desktopWindow) {
// close desktop window
@ -627,8 +627,8 @@ void TabletProxy::loadHomeScreen(bool forceOntoHomeScreen) {
}
}
_state = State::Home;
emit screenChanged(QVariant("Home"), QVariant(TABLET_SOURCE_URL));
_currentPathLoaded = TABLET_SOURCE_URL;
emit screenChanged(QVariant("Home"), QVariant(TABLET_HOME_SOURCE_URL));
_currentPathLoaded = TABLET_HOME_SOURCE_URL;
}
}

View file

@ -227,14 +227,14 @@
}
function setUp() {
tablet = Tablet.getTablet("com.highfidelity.interface.tablet.system");
tablet = Tablets.getTablet("com.highfidelity.interface.tablet.system");
if (!tablet) {
return;
}
Recorder.setUp();
// Tablet/toolbar button.
// tablet/toolbar button.
button = tablet.addButton({
icon: APP_ICON_INACTIVE,
activeIcon: APP_ICON_ACTIVE,

View file

@ -10,7 +10,7 @@
var recording = false;
var onRecordingScreen = false;
var passedSaveDirectory = false;
var tablet = Tablet.getTablet("com.highfidelity.interface.tablet.system");
var tablet = Tablets.getTablet("com.highfidelity.interface.tablet.system");
var button = tablet.addButton({
text: "IRecord"
});

View file

@ -11,14 +11,14 @@
"use strict";
/* global Entities, Script, Tablet, MyAvatar, Vec3 */
/* global Entities, Script, Tablets, MyAvatar, Vec3 */
(function() { // BEGIN LOCAL_SCOPE
var DYNAMICS_TESTS_URL = Script.resolvePath("dynamics-tests.html");
var DEFAULT_LIFETIME = 120; // seconds
var tablet = Tablet.getTablet("com.highfidelity.interface.tablet.system");
var tablet = Tablets.getTablet("com.highfidelity.interface.tablet.system");
var button = tablet.addButton({
icon: Script.resolvePath("dynamicsTests.svg"),

View file

@ -19,7 +19,7 @@ Script.include("/~/system/libraries/Xform.js");
var TABLET_BUTTON_NAME = "PUCKTACH";
var TABLET_APP_URL = "https://hifi-content.s3.amazonaws.com/seefo/production/puck-attach/puck-attach.html";
var tablet = Tablet.getTablet("com.highfidelity.interface.tablet.system");
var tablet = Tablets.getTablet("com.highfidelity.interface.tablet.system");
var tabletButton = tablet.addButton({
text: TABLET_BUTTON_NAME,
icon: "https://s3.amazonaws.com/hifi-public/tony/icons/puck-i.svg",

View file

@ -1,6 +1,6 @@
(function () {
var HTML_URL = Script.resolvePath("sliderTest.html");
var tablet = Tablet.getTablet("com.highfidelity.interface.tablet.system");
var tablet = Tablets.getTablet("com.highfidelity.interface.tablet.system");
var button = tablet.addButton({
text: "SLIDER"
});

View file

@ -11,10 +11,10 @@
// Adds a button to the tablet that will switch to a web page.
// This web page contains buttons that will use the event bridge to trigger sounds.
/* globals Tablet */
/* globals Tablets */
var tablet = Tablet.getTablet("com.highfidelity.interface.tablet.system");
var tablet = Tablets.getTablet("com.highfidelity.interface.tablet.system");
var tabletButton = tablet.addButton({
text: "SOUNDS",
icon: "http://s3.amazonaws.com/hifi-public/tony/icons/trombone-i.png",

View file

@ -10,7 +10,7 @@
// Adds a BAM! button to the tablet ui.
var tablet = Tablet.getTablet("com.highfidelity.interface.tablet.system");
var tablet = Tablets.getTablet("com.highfidelity.interface.tablet.system");
var button = tablet.addButton({
text: "BAM!!!"
});

View file

@ -10,7 +10,7 @@
//
if (HMD.active && !Settings.getValue("HUDUIEnabled")) {
var tablet = Tablet.getTablet("com.highfidelity.interface.tablet.system");
var tablet = Tablets.getTablet("com.highfidelity.interface.tablet.system");
var qml = Script.resolvePath("TabletStats.qml");
tablet.loadQMLSource(qml);
Script.stop();

View file

@ -27,7 +27,7 @@
}
}
var tablet = Tablet.getTablet("com.highfidelity.interface.tablet.system");
var tablet = Tablets.getTablet("com.highfidelity.interface.tablet.system");
var button = tablet.addButton({
text: TABLET_BUTTON_NAME,
icon: ICON_URL,

View file

@ -8,7 +8,7 @@
// Distributed under the Apache License, Version 2.0.
// See the accompanying file LICENSE or http://www.apache.org/licenses/LICENSE-2.0.html
//
/* globals Tablet, Toolbars, Script, HMD, Controller, Menu */
/* globals Tablets, Toolbars, Script, HMD, Controller, Menu */
(function () {
var SNAPSHOT_DELAY = 500; // 500ms
var PHOTOBOOTH_WINDOW_HTML_URL = Script.resolvePath("./html/photobooth.html");
@ -16,7 +16,7 @@
var MODEL_BOUNDING_BOX_DIMENSIONS = {x: 1.0174,y: 1.1925,z: 1.0165};
var PhotoBooth = {};
var photoboothCreated = false;
var tablet = Tablet.getTablet("com.highfidelity.interface.tablet.system");
var tablet = Tablets.getTablet("com.highfidelity.interface.tablet.system");
var button = tablet.addButton({
icon: "icons/tablet-icons/snap-i.svg",
text: "PHOTOBOOTH"

View file

@ -54,7 +54,7 @@ function onScreenChanged(type, url) {
button.editProperties({isActive: onAudioScreen});
}
var tablet = Tablet.getTablet("com.highfidelity.interface.tablet.system");
var tablet = Tablets.getTablet("com.highfidelity.interface.tablet.system");
var button = tablet.addButton({
icon: Audio.muted ? MUTE_ICONS.icon : UNMUTE_ICONS.icon,
activeIcon: Audio.muted ? MUTE_ICONS.activeIcon : UNMUTE_ICONS.activeIcon,

View file

@ -1,6 +1,6 @@
"use strict";
/* jslint vars: true, plusplus: true, forin: true*/
/* globals Tablet, Script, AvatarList, Users, Entities, MyAvatar, Camera, Overlays, Vec3, Quat, Controller, print, getControllerWorldLocation */
/* globals Tablets, Script, AvatarList, Users, Entities, MyAvatar, Camera, Overlays, Vec3, Quat, Controller, print, getControllerWorldLocation */
/* eslint indent: ["error", 4, { "outerIIFEBody": 0 }] */
//
// audioMuteOverlay.js

View file

@ -9,7 +9,7 @@
// Distributed under the Apache License, Version 2.0.
// See the accompanying file LICENSE or http://www.apache.org/licenses/LICENSE-2.0.html
//
/* global Script, Tablet, AudioScope, Audio */
/* global Script, Tablets, AudioScope, Audio */
(function () { // BEGIN LOCAL_SCOPE
@ -17,7 +17,7 @@
var scopePaused = AudioScope.getPause();
var autoPause = false;
var tablet = Tablet.getTablet("com.highfidelity.interface.tablet.system");
var tablet = Tablets.getTablet("com.highfidelity.interface.tablet.system");
var showScopeButton = tablet.addButton({
icon: "icons/tablet-icons/scope.svg",
text: "Audio Scope",

View file

@ -183,7 +183,7 @@
// Setup the bubble button
var buttonName = "BUBBLE";
var tablet = Tablet.getTablet("com.highfidelity.interface.tablet.system");
var tablet = Tablets.getTablet("com.highfidelity.interface.tablet.system");
button = tablet.addButton({
icon: "icons/tablet-icons/bubble-i.svg",
activeIcon: "icons/tablet-icons/bubble-a.svg",

View file

@ -19,7 +19,7 @@
var tabletButtonIcon = "icons/tablet-icons/menu-i.svg"; // Icon for chat button.
var tabletButtonActiveIcon = "icons/tablet-icons/menu-a.svg"; // Active icon for chat button.
var tabletButton = null; // The button we create in the tablet.
var tablet = Tablet.getTablet("com.highfidelity.interface.tablet.system"); // The awesome tablet.
var tablet = Tablets.getTablet("com.highfidelity.interface.tablet.system"); // The awesome tablet.
var chatLog = []; // Array of chat messages in the form of [avatarID, displayName, message, data].
var avatarIdentifiers = {}; // Map of avatar ids to dict of identifierParams.
var speechBubbleShowing = false; // Is the speech bubble visible?

View file

@ -148,7 +148,7 @@
var walletEnabled = Settings.getValue("commerce", false);
function startup() {
if (walletEnabled) {
tablet = Tablet.getTablet("com.highfidelity.interface.tablet.system");
tablet = Tablets.getTablet("com.highfidelity.interface.tablet.system");
button = tablet.addButton({
text: buttonName,
icon: "icons/tablet-icons/wallet-i.svg",

View file

@ -9,7 +9,7 @@
// Distributed under the Apache License, Version 2.0.
// See the accompanying file LICENSE or http://www.apache.org/licenses/LICENSE-2.0.html
//
/* globals HMD, Script, Menu, Tablet, Camera */
/* globals HMD, Script, Menu, Tablets, Camera */
/* eslint indent: ["error", 4, { "outerIIFEBody": 0 }] */
(function() { // BEGIN LOCAL_SCOPE
@ -81,7 +81,7 @@ function endGodView() {
}
var button;
var tablet = Tablet.getTablet("com.highfidelity.interface.tablet.system");
var tablet = Tablets.getTablet("com.highfidelity.interface.tablet.system");
function onClicked() {
if (godView) {

View file

@ -11,7 +11,7 @@
//
/* global Script, SelectionDisplay, LightOverlayManager, CameraManager, Grid, GridTool, EntityListTool, Vec3, SelectionManager, Overlays, OverlayWebWindow, UserActivityLogger,
Settings, Entities, Tablet, Toolbars, Messages, Menu, Camera, progressDialog, tooltip, MyAvatar, Quat, Controller, Clipboard, HMD, UndoStack, ParticleExplorerTool */
Settings, Entities, Tablets, Toolbars, Messages, Menu, Camera, progressDialog, tooltip, MyAvatar, Quat, Controller, Clipboard, HMD, UndoStack, ParticleExplorerTool */
(function() { // BEGIN LOCAL_SCOPE
@ -390,7 +390,7 @@ var toolBar = (function () {
}
function fromQml(message) { // messages are {method, params}, like json-rpc. See also sendToQml.
var tablet = Tablet.getTablet("com.highfidelity.interface.tablet.system");
var tablet = Tablets.getTablet("com.highfidelity.interface.tablet.system");
tablet.popFromStack();
switch (message.method) {
case "newModelDialogAdd":
@ -417,7 +417,7 @@ var toolBar = (function () {
var hasRezPermissions = (Entities.canRez() || Entities.canRezTmp() || Entities.canRezCertified() || Entities.canRezTmpCertified());
var createButtonIconRsrc = (hasRezPermissions ? CREATE_ENABLED_ICON : CREATE_DISABLED_ICON);
tablet = Tablet.getTablet("com.highfidelity.interface.tablet.system");
tablet = Tablets.getTablet("com.highfidelity.interface.tablet.system");
activeButton = tablet.addButton({
captionColorOverride: hasRezPermissions ? "" : "#888888",
icon: createButtonIconRsrc,
@ -463,7 +463,7 @@ var toolBar = (function () {
var SHAPE_TYPE_DEFAULT = SHAPE_TYPE_STATIC_MESH;
// tablet version of new-model dialog
var tablet = Tablet.getTablet("com.highfidelity.interface.tablet.system");
var tablet = Tablets.getTablet("com.highfidelity.interface.tablet.system");
tablet.pushOntoStack("NewModelDialog.qml");
});
@ -644,7 +644,7 @@ var toolBar = (function () {
isActive = active;
activeButton.editProperties({isActive: isActive});
var tablet = Tablet.getTablet("com.highfidelity.interface.tablet.system");
var tablet = Tablets.getTablet("com.highfidelity.interface.tablet.system");
if (!isActive) {
entityListTool.setVisible(false);
@ -1850,7 +1850,7 @@ var PropertiesTool = function (opts) {
var that = {};
var webView = null;
webView = Tablet.getTablet("com.highfidelity.interface.tablet.system");
webView = Tablets.getTablet("com.highfidelity.interface.tablet.system");
webView.setVisible = function(value) {};
var visible = false;
@ -2293,7 +2293,7 @@ function selectParticleEntity(entityID) {
particleExplorerTool.webView.emitScriptEvent(JSON.stringify(particleData));
// Switch to particle explorer
var tablet = Tablet.getTablet("com.highfidelity.interface.tablet.system");
var tablet = Tablets.getTablet("com.highfidelity.interface.tablet.system");
tablet.sendToQml({method: 'selectTab', params: {id: 'particle'}});
}

View file

@ -414,12 +414,12 @@
}
function setUp() {
tablet = Tablet.getTablet("com.highfidelity.interface.tablet.system");
tablet = Tablets.getTablet("com.highfidelity.interface.tablet.system");
if (!tablet) {
return;
}
// Tablet button.
// Tablets button.
button = tablet.addButton({
icon: "icons/tablet-icons/finger-paint-i.svg",
activeIcon: "icons/tablet-icons/finger-paint-a.svg",

View file

@ -10,7 +10,7 @@
// Distributed under the Apache License, Version 2.0.
// See the accompanying file LICENSE or http://www.apache.org/licenses/LICENSE-2.0.html
//
/* globals Tablet, Toolbars, Script, HMD, DialogsManager */
/* globals Tablets, Toolbars, Script, HMD, DialogsManager */
(function() { // BEGIN LOCAL_SCOPE
@ -34,7 +34,7 @@
alpha: 0.9
});
} else {
tablet = Tablet.getTablet("com.highfidelity.interface.tablet.system");
tablet = Tablets.getTablet("com.highfidelity.interface.tablet.system");
button = tablet.addButton({
icon: "icons/tablet-icons/goto-i.svg",
text: buttonName,

View file

@ -10,7 +10,7 @@
// Distributed under the Apache License, Version 2.0.
// See the accompanying file LICENSE or http://www.apache.org/licenses/LICENSE-2.0.html
//
/* globals Tablet, Toolbars, Script, HMD, DialogsManager */
/* globals Tablets, Toolbars, Script, HMD, DialogsManager */
(function() { // BEGIN LOCAL_SCOPE
@ -37,7 +37,7 @@ if (Settings.getValue("HUDUIEnabled")) {
alpha: 0.9
});
} else {
tablet = Tablet.getTablet("com.highfidelity.interface.tablet.system");
tablet = Tablets.getTablet("com.highfidelity.interface.tablet.system");
button = tablet.addButton({
icon: "icons/tablet-icons/goto-i.svg",
activeIcon: "icons/tablet-icons/goto-a.svg",

View file

@ -10,14 +10,14 @@
// Distributed under the Apache License, Version 2.0.
// See the accompanying file LICENSE or http://www.apache.org/licenses/LICENSE-2.0.html
//
/* globals Tablet, Script, HMD, Controller, Menu */
/* globals Tablets, Script, HMD, Controller, Menu */
(function() { // BEGIN LOCAL_SCOPE
var HOME_BUTTON_TEXTURE = Script.resourcesPath() + "meshes/tablet-with-home-button.fbx/tablet-with-home-button.fbm/button-root.png";
var buttonName = "HELP";
var onHelpScreen = false;
var tablet = Tablet.getTablet("com.highfidelity.interface.tablet.system");
var tablet = Tablets.getTablet("com.highfidelity.interface.tablet.system");
var button = tablet.addButton({
icon: "icons/tablet-icons/help-i.svg",
activeIcon: "icons/tablet-icons/help-a.svg",

View file

@ -10,7 +10,7 @@
// Distributed under the Apache License, Version 2.0.
// See the accompanying file LICENSE or http://www.apache.org/licenses/LICENSE-2.0.html
//
/* globals HMD, Script, Menu, Tablet, Camera */
/* globals HMD, Script, Menu, Tablets, Camera */
/* eslint indent: ["error", 4, { "outerIIFEBody": 0 }] */
(function() { // BEGIN LOCAL_SCOPE
@ -38,7 +38,7 @@ function updateControllerDisplay() {
}
var button;
var tablet = Tablet.getTablet("com.highfidelity.interface.tablet.system");
var tablet = Tablets.getTablet("com.highfidelity.interface.tablet.system");
// Independent and Entity mode make people sick; disable them in hmd.
var desktopOnlyViews = ['Independent Mode', 'Entity Mode'];

View file

@ -7,7 +7,7 @@
// Distributed under the Apache License, Version 2.0.
// See the accompanying file LICENSE or http://www.apache.org/licenses/LICENSE-2.0.html
//
/* global getControllerWorldLocation, Tablet, WebTablet:true, HMD, Settings, Script,
/* global getControllerWorldLocation, Tablets, WebTablet:true, HMD, Settings, Script,
Vec3, Quat, MyAvatar, Entities, Overlays, Camera, Messages, Xform, clamp, Controller, Mat4, resizeTablet */
Script.include(Script.resolvePath("../libraries/utils.js"));
@ -168,7 +168,7 @@ WebTablet = function (url, width, dpi, hand, clientOnly, location, visible) {
this.receive = function (channel, senderID, senderUUID, localOnly) {
if (_this.homeButtonID == senderID) {
var tablet = Tablet.getTablet("com.highfidelity.interface.tablet.system");
var tablet = Tablets.getTablet("com.highfidelity.interface.tablet.system");
var onHomeScreen = tablet.onHomeScreen();
var isMessageOpen;
if (onHomeScreen) {
@ -513,7 +513,7 @@ WebTablet.prototype.mousePressEvent = function (event) {
entityPickResults.overlayID === this.tabletEntityID)) {
var overlayPickResults = Overlays.findRayIntersection(pickRay, true, [this.webOverlayID, this.homeButtonID], []);
if (overlayPickResults.intersects && overlayPickResults.overlayID === this.homeButtonID) {
var tablet = Tablet.getTablet("com.highfidelity.interface.tablet.system");
var tablet = Tablets.getTablet("com.highfidelity.interface.tablet.system");
var onHomeScreen = tablet.onHomeScreen();
var isMessageOpen = tablet.isMessageDialogOpen();
if (onHomeScreen) {

View file

@ -8,14 +8,14 @@
// See the accompanying file LICENSE or http://www.apache.org/licenses/LICENSE-2.0.html
//
/* global EntityListTool, Tablet, selectionManager, Entities, Camera, MyAvatar, Vec3, Menu, Messages,
/* global EntityListTool, Tablets, selectionManager, Entities, Camera, MyAvatar, Vec3, Menu, Messages,
cameraManager, MENU_EASE_ON_FOCUS, deleteSelectedEntities, toggleSelectedEntitiesLocked, toggleSelectedEntitiesVisible */
EntityListTool = function(opts) {
var that = {};
var webView = null;
webView = Tablet.getTablet("com.highfidelity.interface.tablet.system");
webView = Tablets.getTablet("com.highfidelity.interface.tablet.system");
webView.setVisible = function(value) {};
var filterInView = false;

View file

@ -237,7 +237,7 @@ GridTool = function(opts) {
var listeners = [];
var webView = null;
webView = Tablet.getTablet("com.highfidelity.interface.tablet.system");
webView = Tablets.getTablet("com.highfidelity.interface.tablet.system");
webView.setVisible = function(value) {};
horizontalGrid.addListener(function(data) {

View file

@ -354,7 +354,7 @@ flatten = function(array) {
getTabletWidthFromSettings = function () {
var DEFAULT_TABLET_WIDTH = 0.4375;
var tablet = Tablet.getTablet("com.highfidelity.interface.tablet.system");
var tablet = Tablets.getTablet("com.highfidelity.interface.tablet.system");
var toolbarMode = tablet.toolbarMode;
var DEFAULT_TABLET_SCALE = 100;
var tabletScalePercentage = DEFAULT_TABLET_SCALE;

View file

@ -82,7 +82,7 @@ function toggleMarketplace() {
}
}
var tablet = Tablet.getTablet("com.highfidelity.interface.tablet.system");
var tablet = Tablets.getTablet("com.highfidelity.interface.tablet.system");
var browseExamplesButton = tablet.addButton({
icon: "icons/tablet-icons/market-i.svg",

View file

@ -8,7 +8,7 @@
// See the accompanying file LICENSE or http://www.apache.org/licenses/LICENSE-2.0.html
//
/* global Tablet, Script, HMD, UserActivityLogger, Entities */
/* global Tablets, Script, HMD, UserActivityLogger, Entities */
/* eslint indent: ["error", 4, { "outerIIFEBody": 0 }] */
(function () { // BEGIN LOCAL_SCOPE
@ -81,7 +81,7 @@
}
}
var tablet = Tablet.getTablet("com.highfidelity.interface.tablet.system");
var tablet = Tablets.getTablet("com.highfidelity.interface.tablet.system");
var marketplaceButton = tablet.addButton({
icon: "icons/tablet-icons/market-i.svg",
activeIcon: "icons/tablet-icons/market-a.svg",

View file

@ -13,7 +13,7 @@ var HOME_BUTTON_TEXTURE = "http://hifi-content.s3.amazonaws.com/alan/dev/tablet-
// var HOME_BUTTON_TEXTURE = Script.resourcesPath() + "meshes/tablet-with-home-button.fbx/tablet-with-home-button.fbm/button-root.png";
(function() {
var tablet = Tablet.getTablet("com.highfidelity.interface.tablet.system");
var tablet = Tablets.getTablet("com.highfidelity.interface.tablet.system");
var button = tablet.addButton({
icon: "icons/tablet-icons/menu-i.svg",
activeIcon: "icons/tablet-icons/menu-a.svg",

View file

@ -18,7 +18,7 @@
Script.include("/~/system/libraries/controllers.js");
// grab the toolbar
var tablet = Tablet.getTablet("com.highfidelity.interface.tablet.system");
var tablet = Tablets.getTablet("com.highfidelity.interface.tablet.system");
var ASSETS_PATH = Script.resolvePath("assets");
var TOOLS_PATH = Script.resolvePath("assets/images/tools/");

View file

@ -1,6 +1,6 @@
"use strict";
/*jslint vars:true, plusplus:true, forin:true*/
/*global Script, Settings, Window, Controller, Overlays, SoundArray, LODManager, MyAvatar, Tablet, Camera, HMD, Menu, Quat, Vec3*/
/*global Script, Settings, Window, Controller, Overlays, SoundArray, LODManager, MyAvatar, Tablets, Camera, HMD, Menu, Quat, Vec3*/
//
// notifications.js
// Version 0.801
@ -696,7 +696,7 @@
Window.announcement.connect(onNotify);
Window.notifyEditError = onEditError;
Window.notify = onNotify;
Tablet.tabletNotification.connect(tabletNotification);
Tablets.tabletNotification.connect(tabletNotification);
Wallet.walletNotSetup.connect(walletNotSetup);
Messages.subscribe(NOTIFICATIONS_MESSAGE_CHANNEL);

View file

@ -1,6 +1,6 @@
"use strict";
/*jslint vars:true, plusplus:true, forin:true*/
/*global Tablet, Settings, Script, AvatarList, Users, Entities, MyAvatar, Camera, Overlays, Vec3, Quat, HMD, Controller, Account, UserActivityLogger, Messages, Window, XMLHttpRequest, print, location, getControllerWorldLocation*/
/*global Tablets, Settings, Script, AvatarList, Users, Entities, MyAvatar, Camera, Overlays, Vec3, Quat, HMD, Controller, Account, UserActivityLogger, Messages, Window, XMLHttpRequest, print, location, getControllerWorldLocation*/
/* eslint indent: ["error", 4, { "outerIIFEBody": 0 }] */
//
// pal.js
@ -677,7 +677,7 @@ var buttonName = "PEOPLE";
var tablet = null;
function startup() {
tablet = Tablet.getTablet("com.highfidelity.interface.tablet.system");
tablet = Tablets.getTablet("com.highfidelity.interface.tablet.system");
button = tablet.addButton({
text: buttonName,
icon: "icons/tablet-icons/people-i.svg",

View file

@ -17,7 +17,7 @@ var PARTICLE_EXPLORER_HTML_URL = Script.resolvePath('particleExplorer.html');
ParticleExplorerTool = function() {
var that = {};
that.createWebView = function() {
that.webView = Tablet.getTablet("com.highfidelity.interface.tablet.system");
that.webView = Tablets.getTablet("com.highfidelity.interface.tablet.system");
that.webView.setVisible = function(value) {};
that.webView.webEventReceived.connect(that.webEventReceived);
}

View file

@ -7,7 +7,7 @@
// Distributed under the Apache License, Version 2.0
// See the accompanying file LICENSE or http://www.apache.org/licenses/LICENSE-2.0.html
//
/* globals Tablet, Script, HMD, Settings, DialogsManager, Menu, Reticle, OverlayWebWindow, Desktop, Account, MyAvatar, Snapshot */
/* globals Tablets, Script, HMD, Settings, DialogsManager, Menu, Reticle, OverlayWebWindow, Desktop, Account, MyAvatar, Snapshot */
/* eslint indent: ["error", 4, { "outerIIFEBody": 0 }] */
(function () { // BEGIN LOCAL_SCOPE
@ -22,7 +22,7 @@ var clearOverlayWhenMoving;
var buttonName = "SNAP";
var buttonConnected = false;
var tablet = Tablet.getTablet("com.highfidelity.interface.tablet.system");
var tablet = Tablets.getTablet("com.highfidelity.interface.tablet.system");
var button = tablet.addButton({
icon: "icons/tablet-icons/snap-i.svg",
activeIcon: "icons/tablet-icons/snap-a.svg",

View file

@ -1,6 +1,6 @@
"use strict";
/*jslint vars:true, plusplus:true, forin:true*/
/*global Window, Script, Tablet, HMD, Controller, Account, XMLHttpRequest, location, print*/
/*global Window, Script, Tablets, HMD, Controller, Account, XMLHttpRequest, location, print*/
//
// goto.js
@ -30,7 +30,7 @@
var shouldActivateButton = false;
function ignore() { }
var tablet = Tablet.getTablet("com.highfidelity.interface.tablet.system");
var tablet = Tablets.getTablet("com.highfidelity.interface.tablet.system");
var NORMAL_ICON = "icons/tablet-icons/goto-i.svg";
var NORMAL_ACTIVE = "icons/tablet-icons/goto-a.svg";
var WAITING_ICON = "icons/tablet-icons/goto-msg.svg";

View file

@ -12,7 +12,7 @@
// See the accompanying file LICENSE or http://www.apache.org/licenses/LICENSE-2.0.html
//
/* global Script, HMD, WebTablet, UIWebTablet, UserActivityLogger, Settings, Entities, Messages, Tablet, Overlays,
/* global Script, HMD, WebTablet, UIWebTablet, UserActivityLogger, Settings, Entities, Messages, Tablets, Overlays,
MyAvatar, Menu, AvatarInputs, Vec3 */
(function() { // BEGIN LOCAL_SCOPE
@ -33,7 +33,7 @@
function checkTablet() {
if (gTablet === null) {
gTablet = Tablet.getTablet("com.highfidelity.interface.tablet.system");
gTablet = Tablets.getTablet("com.highfidelity.interface.tablet.system");
}
}
@ -315,7 +315,7 @@
Script.scriptEnding.connect(function () {
// if we reload scripts in tablet mode make sure we close the currently open window, by calling gotoHomeScreen
var tabletProxy = Tablet.getTablet("com.highfidelity.interface.tablet.system");
var tabletProxy = Tablets.getTablet("com.highfidelity.interface.tablet.system");
if (tabletProxy && tabletProxy.toolbarMode) {
tabletProxy.gotoHomeScreen();
}

View file

@ -33,7 +33,7 @@
GlobalServices.findableBy = myVisibility;
}
var tablet = Tablet.getTablet("com.highfidelity.interface.tablet.system");
var tablet = Tablets.getTablet("com.highfidelity.interface.tablet.system");
var button = tablet.addButton({
icon: "icons/tablet-icons/users-i.svg",
activeIcon: "icons/tablet-icons/users-a.svg",

View file

@ -1,6 +1,6 @@
"use strict";
/* jslint vars: true, plusplus: true, forin: true*/
/* globals Tablet, Script, AvatarList, Users, Entities, MyAvatar, Camera, Overlays, Vec3, Quat, Controller, print, getControllerWorldLocation */
/* globals Tablets, Script, AvatarList, Users, Entities, MyAvatar, Camera, Overlays, Vec3, Quat, Controller, print, getControllerWorldLocation */
/* eslint indent: ["error", 4, { "outerIIFEBody": 0 }] */
//
// createFloatinLanternBox.js

View file

@ -1,6 +1,6 @@
"use strict";
/* jslint vars: true, plusplus: true, forin: true*/
/* globals Tablet, Script, AvatarList, Users, Entities, MyAvatar, Camera, Overlays, Vec3, Quat, Controller, print, getControllerWorldLocation */
/* globals Tablets, Script, AvatarList, Users, Entities, MyAvatar, Camera, Overlays, Vec3, Quat, Controller, print, getControllerWorldLocation */
/* eslint indent: ["error", 4, { "outerIIFEBody": 0 }] */
//
// createTetherballStick.js

View file

@ -1,6 +1,6 @@
"use strict";
/* jslint vars: true, plusplus: true, forin: true*/
/* globals Tablet, Script, AvatarList, Users, Entities, MyAvatar, Camera, Overlays, Vec3, Quat, Controller, print, getControllerWorldLocation */
/* globals Tablets, Script, AvatarList, Users, Entities, MyAvatar, Camera, Overlays, Vec3, Quat, Controller, print, getControllerWorldLocation */
/* eslint indent: ["error", 4, { "outerIIFEBody": 0 }] */
//
// floatinLantern.js

View file

@ -1,6 +1,6 @@
"use strict";
/* jslint vars: true, plusplus: true, forin: true*/
/* globals Tablet, Script, AvatarList, Users, Entities, MyAvatar, Camera, Overlays, Vec3, Quat, Controller, print, getControllerWorldLocation */
/* globals Tablets, Script, AvatarList, Users, Entities, MyAvatar, Camera, Overlays, Vec3, Quat, Controller, print, getControllerWorldLocation */
/* eslint indent: ["error", 4, { "outerIIFEBody": 0 }] */
//
// floatingLanternBox.js

View file

@ -1,6 +1,6 @@
"use strict";
/* jslint vars: true, plusplus: true, forin: true*/
/* globals Tablet, Script, AvatarList, Users, Entities, MyAvatar, Camera, Overlays, Vec3, Quat, Controller, print, getControllerWorldLocation */
/* globals Tablets, Script, AvatarList, Users, Entities, MyAvatar, Camera, Overlays, Vec3, Quat, Controller, print, getControllerWorldLocation */
/* eslint indent: ["error", 4, { "outerIIFEBody": 0 }] */
//
// tetherballStick.js

View file

@ -0,0 +1,28 @@
//
// Created by Bradley Austin Davis on 2017/11/08
// Copyright 2013-2017 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 "PathUtilsTests.h"
#include <QtTest/QtTest>
#include <PathUtils.h>
QTEST_MAIN(PathUtilsTests)
void PathUtilsTests::testPathUtils() {
QString result = PathUtils::qmlBasePath();
#if DEV_BUILD
QVERIFY(result.startsWith("file:///"));
#else
QVERIFY(result.startsWith("qrc:///"));
#endif
QVERIFY(result.endsWith("/"));
}

View file

@ -0,0 +1,20 @@
//
// Created by Bradley Austin Davis on 2017/11/08
// Copyright 2013-2017 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_PathUtilsTests_h
#define hifi_PathUtilsTests_h
#include <QtCore/QObject>
class PathUtilsTests : public QObject {
Q_OBJECT
private slots:
void testPathUtils();
};
#endif // hifi_PathUtilsTests_h

View file

@ -26,7 +26,7 @@
APP_URL = APP_OUTDATED_URL;
}
var tablet = Tablet.getTablet("com.highfidelity.interface.tablet.system");
var tablet = Tablets.getTablet("com.highfidelity.interface.tablet.system");
var button = tablet.addButton({
icon: APP_ICON,
activeIcon: APP_ICON_ACTIVE,

View file

@ -162,7 +162,7 @@ var globalState = {
function main() {
log('initializing...', VERSION);
var tablet = Tablet.getTablet('com.highfidelity.interface.tablet.system'),
var tablet = Tablets.getTablet('com.highfidelity.interface.tablet.system'),
button = tablet.addButton(BUTTON_CONFIG);
Script.scriptEnding.connect(function() {
@ -601,7 +601,7 @@ function _patchCameraModeSetting() {
}
function getSystemMetadata() {
var tablet = Tablet.getTablet('com.highfidelity.interface.tablet.system');
var tablet = Tablets.getTablet('com.highfidelity.interface.tablet.system');
return {
mode: {
hmd: HMD.active,

View file

@ -16,7 +16,7 @@
// Load up engine
var APP_NAME = "CLAP";
var ClapEngine = Script.require(Script.resolvePath("scripts/ClapEngine.js?v9"));
var tablet = Tablet.getTablet("com.highfidelity.interface.tablet.system");
var tablet = Tablets.getTablet("com.highfidelity.interface.tablet.system");
// Define Menu
var blackIcon = Script.resolvePath("icons/tablet-icons/clap-a.svg?foxv2");

View file

@ -45,7 +45,7 @@ var buttonConfig = utils.assign({
activeIcon: require('./doppleganger-a.svg.json'),
});
var tablet = Tablet.getTablet('com.highfidelity.interface.tablet.system'),
var tablet = Tablets.getTablet('com.highfidelity.interface.tablet.system'),
button = tablet.addButton(buttonConfig);
Script.scriptEnding.connect(function() {

View file

@ -905,7 +905,7 @@ var buttonConfig = utils.assign({
activeIcon: __webpack_require__(7),
});
var tablet = Tablet.getTablet('com.highfidelity.interface.tablet.system'),
var tablet = Tablets.getTablet('com.highfidelity.interface.tablet.system'),
button = tablet.addButton(buttonConfig);
Script.scriptEnding.connect(function() {

View file

@ -12,7 +12,7 @@
var DopplegangerClass = Script.require('./doppleganger.js');
var tablet = Tablet.getTablet('com.highfidelity.interface.tablet.system'),
var tablet = Tablets.getTablet('com.highfidelity.interface.tablet.system'),
button = tablet.addButton({
icon: Script.resolvePath('./doppleganger-i.svg'),
activeIcon: Script.resolvePath('./doppleganger-a.svg'),

View file

@ -19,7 +19,7 @@ var lib = Script.require("https://hifi-content.s3.amazonaws.com/elisalj/emoji_sc
var APP_NAME = "EMOJIS";
var APP_URL = "https://hifi-content.s3.amazonaws.com/elisalj/emoji_scripts/emojiTabletUI.html?" + Date.now();
var APP_ICON = "https://hifi-content.s3.amazonaws.com/elisalj/emoji_scripts/icons/emoji-i.svg";
var tablet = Tablet.getTablet("com.highfidelity.interface.tablet.system");
var tablet = Tablets.getTablet("com.highfidelity.interface.tablet.system");
var button = tablet.addButton({
icon: APP_ICON,

View file

@ -17,7 +17,7 @@
var TRIGGER_PRESSURE = 0.95;
var tablet = Tablet.getTablet('com.highfidelity.interface.tablet.system');
var tablet = Tablets.getTablet('com.highfidelity.interface.tablet.system');
var button = tablet.addButton({
icon: APP_ICON,

View file

@ -631,7 +631,7 @@
}
function setUp() {
tablet = Tablet.getTablet("com.highfidelity.interface.tablet.system");
tablet = Tablets.getTablet("com.highfidelity.interface.tablet.system");
if (!tablet) {
return;
}
@ -694,7 +694,7 @@
}
// FIXME: If setUp() is run immediately at Interface start-up, Interface hangs and crashes because of the line of code:
// tablet = Tablet.getTablet("com.highfidelity.interface.tablet.system");
// tablet = Tablets.getTablet("com.highfidelity.interface.tablet.system");
//setUp();
//Script.scriptEnding.connect(tearDown);
Script.setTimeout(function () {

View file

@ -1930,7 +1930,7 @@
function setUp() {
var hasRezPermissions;
tablet = Tablet.getTablet("com.highfidelity.interface.tablet.system");
tablet = Tablets.getTablet("com.highfidelity.interface.tablet.system");
if (!tablet) {
App.log("ERROR: Tablet not found! App not started.");
return;

View file

@ -28,7 +28,7 @@
}
}
var tablet = Tablet.getTablet("com.highfidelity.interface.tablet.system");
var tablet = Tablets.getTablet("com.highfidelity.interface.tablet.system");
var button = tablet.addButton({
icon: ICONS.icon,
activeIcon: ICONS.activeIcon,

View file

@ -1,6 +1,6 @@
"use strict";
/*jslint vars:true, plusplus:true, forin:true*/
/*global Tablet, Script, */
/*global Tablets, Script, */
/* eslint indent: ["error", 4, { "outerIIFEBody": 0 }] */
//
// spectatorCamera.js
@ -188,7 +188,7 @@
// -tablet: The tablet instance to be modified.
var tablet = null;
function startup() {
tablet = Tablet.getTablet("com.highfidelity.interface.tablet.system");
tablet = Tablets.getTablet("com.highfidelity.interface.tablet.system");
addOrRemoveButton(false, HMD.active);
tablet.screenChanged.connect(onTabletScreenChanged);
Window.domainChanged.connect(onDomainChanged);

View file

@ -20,7 +20,7 @@
var isRaiseHandButtonActive = false;
var animHandlerId;
var tablet = Tablet.getTablet("com.highfidelity.interface.tablet.system");
var tablet = Tablets.getTablet("com.highfidelity.interface.tablet.system");
var button = tablet.addButton({
text: BUTTON_NAME,
icon: "icons/tablet-icons/raise-hand-i.svg",