Merge branch 'tablet-ui' of github.com:highfidelity/hifi into tablet-ui-fix-edit-props-race

This commit is contained in:
Seth Alves 2017-03-10 10:22:10 -08:00
commit 411ec9a791
13 changed files with 43 additions and 1288 deletions

View file

@ -81,6 +81,10 @@ void HMDScriptingInterface::closeTablet() {
_showTablet = false; _showTablet = false;
} }
void HMDScriptingInterface::openTablet() {
_showTablet = true;
}
QScriptValue HMDScriptingInterface::getHUDLookAtPosition2D(QScriptContext* context, QScriptEngine* engine) { QScriptValue HMDScriptingInterface::getHUDLookAtPosition2D(QScriptContext* context, QScriptEngine* engine) {
glm::vec3 hudIntersection; glm::vec3 hudIntersection;
auto instance = DependencyManager::get<HMDScriptingInterface>(); auto instance = DependencyManager::get<HMDScriptingInterface>();

View file

@ -76,6 +76,8 @@ public:
Q_INVOKABLE void closeTablet(); Q_INVOKABLE void closeTablet();
Q_INVOKABLE void openTablet();
signals: signals:
bool shouldShowHandControllersChanged(); bool shouldShowHandControllersChanged();

View file

@ -287,7 +287,8 @@ void TabletProxy::setQmlTabletRoot(QQuickItem* qmlTabletRoot, QObject* qmlOffscr
QMetaObject::invokeMethod(_qmlTabletRoot, "loadSource", Q_ARG(const QVariant&, QVariant(TABLET_SOURCE_URL))); QMetaObject::invokeMethod(_qmlTabletRoot, "loadSource", Q_ARG(const QVariant&, QVariant(TABLET_SOURCE_URL)));
} }
gotoHomeScreen(); // force to the tablet to go to the homescreen
loadHomeScreen(true);
QMetaObject::invokeMethod(_qmlTabletRoot, "setUsername", Q_ARG(const QVariant&, QVariant(getUsername()))); QMetaObject::invokeMethod(_qmlTabletRoot, "setUsername", Q_ARG(const QVariant&, QVariant(getUsername())));
@ -305,6 +306,9 @@ void TabletProxy::setQmlTabletRoot(QQuickItem* qmlTabletRoot, QObject* qmlOffscr
} }
} }
void TabletProxy::gotoHomeScreen() {
loadHomeScreen(false);
}
void TabletProxy::gotoMenuScreen(const QString& submenu) { void TabletProxy::gotoMenuScreen(const QString& submenu) {
QObject* root = nullptr; QObject* root = nullptr;
@ -388,8 +392,8 @@ void TabletProxy::popFromStack() {
} }
} }
void TabletProxy::gotoHomeScreen() { void TabletProxy::loadHomeScreen(bool forceOntoHomeScreen) {
if (_state != State::Home) { if (_state != State::Home && ( _state != State::Uninitialized || forceOntoHomeScreen)) {
if (!_toolbarMode && _qmlTabletRoot) { if (!_toolbarMode && _qmlTabletRoot) {
auto loader = _qmlTabletRoot->findChild<QQuickItem*>("loader"); auto loader = _qmlTabletRoot->findChild<QQuickItem*>("loader");
QObject::connect(loader, SIGNAL(loaded()), this, SLOT(addButtonsToHomeScreen()), Qt::DirectConnection); QObject::connect(loader, SIGNAL(loaded()), this, SLOT(addButtonsToHomeScreen()), Qt::DirectConnection);

View file

@ -202,6 +202,7 @@ protected slots:
void desktopWindowClosed(); void desktopWindowClosed();
protected: protected:
void removeButtonsFromHomeScreen(); void removeButtonsFromHomeScreen();
void loadHomeScreen(bool forceOntoHomeScreen);
void addButtonsToToolbar(); void addButtonsToToolbar();
void removeButtonsFromToolbar(); void removeButtonsFromToolbar();

View file

@ -72,6 +72,9 @@ tablet.screenChanged.connect(onScreenChanged);
AudioDevice.muteToggled.connect(onMuteToggled); AudioDevice.muteToggled.connect(onMuteToggled);
Script.scriptEnding.connect(function () { Script.scriptEnding.connect(function () {
if (onAudioScreen) {
tablet.gotoHomeScreen();
}
button.clicked.disconnect(onClicked); button.clicked.disconnect(onClicked);
tablet.screenChanged.disconnect(onScreenChanged); tablet.screenChanged.disconnect(onScreenChanged);
AudioDevice.muteToggled.disconnect(onMuteToggled); AudioDevice.muteToggled.disconnect(onMuteToggled);

View file

@ -18,13 +18,14 @@ var button;
var buttonName = "GOTO"; var buttonName = "GOTO";
var toolBar = null; var toolBar = null;
var tablet = null; var tablet = null;
var onGotoScreen = false;
function onAddressBarShown(visible) { function onAddressBarShown(visible) {
button.editProperties({isActive: visible}); button.editProperties({isActive: visible});
} }
function onClicked(){ function onClicked(){
DialogsManager.toggleAddressBar(); DialogsManager.toggleAddressBar();
onGotoScreen = !onGotoScreen;
} }
if (Settings.getValue("HUDUIEnabled")) { if (Settings.getValue("HUDUIEnabled")) {
@ -49,6 +50,9 @@ button.clicked.connect(onClicked);
DialogsManager.addressBarShown.connect(onAddressBarShown); DialogsManager.addressBarShown.connect(onAddressBarShown);
Script.scriptEnding.connect(function () { Script.scriptEnding.connect(function () {
if (onGotoScreen) {
DialogsManager.toggleAddressBar();
}
button.clicked.disconnect(onClicked); button.clicked.disconnect(onClicked);
if (tablet) { if (tablet) {
tablet.removeButton(button); tablet.removeButton(button);

View file

@ -48,6 +48,9 @@
}, POLL_RATE); }, POLL_RATE);
Script.scriptEnding.connect(function () { Script.scriptEnding.connect(function () {
if (enabled) {
Menu.closeInfoView('InfoView_html/help.html');
}
button.clicked.disconnect(onClicked); button.clicked.disconnect(onClicked);
Script.clearInterval(interval); Script.clearInterval(interval);
if (tablet) { if (tablet) {

View file

@ -121,6 +121,7 @@ function onClick() {
if (onMarketplaceScreen) { if (onMarketplaceScreen) {
// for toolbar-mode: go back to home screen, this will close the window. // for toolbar-mode: go back to home screen, this will close the window.
tablet.gotoHomeScreen(); tablet.gotoHomeScreen();
onMarketplaceScreen = false;
} else { } else {
var entity = HMD.tabletID; var entity = HMD.tabletID;
Entities.editEntity(entity, {textures: JSON.stringify({"tex.close": HOME_BUTTON_TEXTURE})}); Entities.editEntity(entity, {textures: JSON.stringify({"tex.close": HOME_BUTTON_TEXTURE})});
@ -140,6 +141,9 @@ tablet.screenChanged.connect(onScreenChanged);
Entities.canWriteAssetsChanged.connect(onCanWriteAssetsChanged); Entities.canWriteAssetsChanged.connect(onCanWriteAssetsChanged);
Script.scriptEnding.connect(function () { Script.scriptEnding.connect(function () {
if (onMarketplaceScreen) {
tablet.gotoHomeScreen();
}
tablet.removeButton(marketplaceButton); tablet.removeButton(marketplaceButton);
tablet.screenChanged.disconnect(onScreenChanged); tablet.screenChanged.disconnect(onScreenChanged);
Entities.canWriteAssetsChanged.disconnect(onCanWriteAssetsChanged); Entities.canWriteAssetsChanged.disconnect(onCanWriteAssetsChanged);

View file

@ -48,6 +48,9 @@ var HOME_BUTTON_TEXTURE = "http://hifi-content.s3.amazonaws.com/alan/dev/tablet-
tablet.screenChanged.connect(onScreenChanged); tablet.screenChanged.connect(onScreenChanged);
Script.scriptEnding.connect(function () { Script.scriptEnding.connect(function () {
if (onMenuScreen) {
tablet.gotoHomeScreen();
}
button.clicked.disconnect(onClicked); button.clicked.disconnect(onClicked);
tablet.removeButton(button); tablet.removeButton(button);
tablet.screenChanged.disconnect(onScreenChanged); tablet.screenChanged.disconnect(onScreenChanged);

View file

@ -696,6 +696,9 @@ function clearLocalQMLDataAndClosePAL() {
} }
function shutdown() { function shutdown() {
if (onPalScreen) {
tablet.gotoHomeScreen();
}
button.clicked.disconnect(onTabletButtonClicked); button.clicked.disconnect(onTabletButtonClicked);
tablet.removeButton(button); tablet.removeButton(button);
tablet.screenChanged.disconnect(onTabletScreenChanged); tablet.screenChanged.disconnect(onTabletScreenChanged);

View file

@ -191,12 +191,12 @@ function resetButtons(pathStillSnapshot, pathAnimatedSnapshot, notify) {
if (clearOverlayWhenMoving) { if (clearOverlayWhenMoving) {
MyAvatar.setClearOverlayWhenMoving(true); // not until after the share dialog MyAvatar.setClearOverlayWhenMoving(true); // not until after the share dialog
} }
HMD.openTablet();
} }
function processingGif() { function processingGif() {
// show hud // show hud
Reticle.visible = reticleVisible; Reticle.visible = reticleVisible;
button.clicked.disconnect(onClicked); button.clicked.disconnect(onClicked);
buttonConnected = false; buttonConnected = false;
// show overlays if they were on // show overlays if they were on
@ -211,8 +211,10 @@ Window.snapshotShared.connect(snapshotShared);
Window.processingGif.connect(processingGif); Window.processingGif.connect(processingGif);
Script.scriptEnding.connect(function () { Script.scriptEnding.connect(function () {
button.clicked.disconnect(onClicked); if (buttonConnected) {
buttonConnected = false; button.clicked.disconnect(onClicked);
buttonConnected = false;
}
if (tablet) { if (tablet) {
tablet.removeButton(button); tablet.removeButton(button);
} }

View file

@ -114,6 +114,9 @@
tablet.screenChanged.connect(onScreenChanged); tablet.screenChanged.connect(onScreenChanged);
function cleanup() { function cleanup() {
if (onUsersScreen) {
tablet.gotoHomeScreen();
}
button.clicked.disconnect(onClicked); button.clicked.disconnect(onClicked);
tablet.removeButton(button); tablet.removeButton(button);
} }

File diff suppressed because it is too large Load diff