mirror of
https://github.com/overte-org/overte.git
synced 2025-06-21 22:00:10 +02:00
finished allowing to go back to previous app
This commit is contained in:
parent
92bb7f2329
commit
4e94aaa9e8
6 changed files with 43 additions and 17 deletions
|
@ -23,7 +23,7 @@ TabletModalWindow {
|
||||||
property var eventBridge;
|
property var eventBridge;
|
||||||
signal sendToScript(var message);
|
signal sendToScript(var message);
|
||||||
property bool isHMD: false
|
property bool isHMD: false
|
||||||
|
property bool gotoPreviousApp: false;
|
||||||
color: hifi.colors.baseGray
|
color: hifi.colors.baseGray
|
||||||
|
|
||||||
property int colorScheme: hifi.colorSchemes.dark
|
property int colorScheme: hifi.colorSchemes.dark
|
||||||
|
@ -68,10 +68,11 @@ TabletModalWindow {
|
||||||
onCanceled: {
|
onCanceled: {
|
||||||
if (loginDialogRoot.Stack.view) {
|
if (loginDialogRoot.Stack.view) {
|
||||||
loginDialogRoot.Stack.view.pop();
|
loginDialogRoot.Stack.view.pop();
|
||||||
} else {
|
} else if (gotoPreviousApp) {
|
||||||
var tablet = Tablet.getTablet("com.highfidelity.interface.tablet.system");
|
var tablet = Tablet.getTablet("com.highfidelity.interface.tablet.system");
|
||||||
tablet.returnToPreviousApp();
|
tablet.returnToPreviousApp();
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
LoginDialog {
|
LoginDialog {
|
||||||
|
|
|
@ -18,7 +18,7 @@ StackView {
|
||||||
initialItem: root
|
initialItem: root
|
||||||
objectName: "stack"
|
objectName: "stack"
|
||||||
property string title: "General Settings"
|
property string title: "General Settings"
|
||||||
|
property alias gotoPreviousApp: root.gotoPreviousApp;
|
||||||
property var eventBridge;
|
property var eventBridge;
|
||||||
signal sendToScript(var message);
|
signal sendToScript(var message);
|
||||||
|
|
||||||
|
|
|
@ -61,38 +61,42 @@ Item {
|
||||||
tabletApps.clear();
|
tabletApps.clear();
|
||||||
loader.source = ""; // make sure we load the qml fresh each time.
|
loader.source = ""; // make sure we load the qml fresh each time.
|
||||||
loader.source = url;
|
loader.source = url;
|
||||||
|
tabletApps.append({"appUrl": url, "isWebUrl": false, "scriptUrl": "", "appWebUrl": ""});
|
||||||
}
|
}
|
||||||
|
|
||||||
function loadQMLOnTop(url) {
|
function loadQMLOnTop(url) {
|
||||||
console.log("[DR] -> loading the url: " + url);
|
tabletApps.append({"appUrl": url, "isWebUrl": false, "scriptUrl": "", "appWebUrl": ""});
|
||||||
tabletApps.append({"appUrl": url, "isWebUrl": false, "scriptUrl": ""});
|
|
||||||
loader.source = "";
|
loader.source = "";
|
||||||
loader.source = tabletApps.get(currentApp).appUrl;
|
loader.source = tabletApps.get(currentApp).appUrl;
|
||||||
|
if (loader.item.hasOwnProperty("gotoPreviousApp")) {
|
||||||
|
loader.item.gotoPreviousApp = true;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function loadWebOnTop(url, injectJavaScriptUrl) {
|
function loadWebOnTop(url, injectJavaScriptUrl) {
|
||||||
console.log("[DR] -> loading the url: " + url);
|
|
||||||
tabletApps.append({"appUrl": loader.source, "isWebUrl": true, "scriptUrl": injectJavaScriptUrl, "appWebUrl": url});
|
tabletApps.append({"appUrl": loader.source, "isWebUrl": true, "scriptUrl": injectJavaScriptUrl, "appWebUrl": url});
|
||||||
loader.item.url = tabletApps.get(currentApp).appWebUrl;
|
loader.item.url = tabletApps.get(currentApp).appWebUrl;
|
||||||
loader.item.scriptUrl = tabletApps.get(currentApp).scriptUrl;
|
loader.item.scriptUrl = tabletApps.get(currentApp).scriptUrl;
|
||||||
|
if (loader.item.hasOwnProperty("gotoPreviousApp")) {
|
||||||
|
loader.item.gotoPreviousApp = true;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function returnToPreviousApp() {
|
function returnToPreviousApp() {
|
||||||
tabletApps.remove(currentApp);
|
tabletApps.remove(currentApp);
|
||||||
var isWebPage = tabletApps.get(currentApp).isWebUrl;
|
var isWebPage = tabletApps.get(currentApp).isWebUrl;
|
||||||
console.log(isWebPage);
|
|
||||||
if (isWebPage) {
|
if (isWebPage) {
|
||||||
var webUrl = tabletApps.get(currentApp).appWebUrl;
|
var webUrl = tabletApps.get(currentApp).appWebUrl;
|
||||||
var scriptUrl = tabletApps.get(currentApp).scriptUrl;
|
var scriptUrl = tabletApps.get(currentApp).scriptUrl;
|
||||||
loadSource("TabletWebView.qml");
|
loadSource("TabletWebView.qml");
|
||||||
loadWebUrl(webUrl, scriptUrl);
|
loadWebUrl(webUrl, scriptUrl);
|
||||||
} else {
|
} else {
|
||||||
console.log(tabletApps.get(currentApp).appUrl);
|
|
||||||
loader.source = tabletApps.get(currentApp).appUrl;
|
loader.source = tabletApps.get(currentApp).appUrl;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function loadWebUrl(url, injectedJavaScriptUrl) {
|
function loadWebUrl(url, injectedJavaScriptUrl) {
|
||||||
|
tabletApps.clear();
|
||||||
loader.item.url = url;
|
loader.item.url = url;
|
||||||
loader.item.scriptURL = injectedJavaScriptUrl;
|
loader.item.scriptURL = injectedJavaScriptUrl;
|
||||||
tabletApps.append({"appUrl": "TabletWebView.qml", "isWebUrl": true, "scriptUrl": injectedJavaScriptUrl, "appWebUrl": url});
|
tabletApps.append({"appUrl": "TabletWebView.qml", "isWebUrl": true, "scriptUrl": injectedJavaScriptUrl, "appWebUrl": url});
|
||||||
|
|
|
@ -31,6 +31,7 @@ Item {
|
||||||
property bool keyboardEnabled: false
|
property bool keyboardEnabled: false
|
||||||
property bool keyboardRaised: false
|
property bool keyboardRaised: false
|
||||||
property bool punctuationMode: false
|
property bool punctuationMode: false
|
||||||
|
property bool gotoPreviousApp: false
|
||||||
|
|
||||||
property var tablet;
|
property var tablet;
|
||||||
|
|
||||||
|
@ -55,7 +56,13 @@ Item {
|
||||||
}
|
}
|
||||||
|
|
||||||
function closeDialog() {
|
function closeDialog() {
|
||||||
Tablet.getTablet("com.highfidelity.interface.tablet.system").returnToPreviousApp();
|
var tablet = Tablet.getTablet("com.highfidelity.interface.tablet.system");
|
||||||
|
|
||||||
|
if (gotoPreviousApp) {
|
||||||
|
tablet.returnToPreviousApp();
|
||||||
|
} else {
|
||||||
|
tablet.gotoHomeScreen();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
Rectangle {
|
Rectangle {
|
||||||
|
|
|
@ -99,7 +99,7 @@ public:
|
||||||
bool getToolbarMode() const { return _toolbarMode; }
|
bool getToolbarMode() const { return _toolbarMode; }
|
||||||
void setToolbarMode(bool toolbarMode);
|
void setToolbarMode(bool toolbarMode);
|
||||||
|
|
||||||
void initialScreen(const QVariant& url);
|
Q_INVOKABLE void initialScreen(const QVariant& url);
|
||||||
|
|
||||||
/**jsdoc
|
/**jsdoc
|
||||||
* transition to the home screen
|
* transition to the home screen
|
||||||
|
|
|
@ -37,13 +37,15 @@ function showFeedWindow() {
|
||||||
|| (!HMD.active && Settings.getValue("desktopTabletBecomesToolbar"))) {
|
|| (!HMD.active && Settings.getValue("desktopTabletBecomesToolbar"))) {
|
||||||
DialogsManager.showFeed();
|
DialogsManager.showFeed();
|
||||||
} else {
|
} else {
|
||||||
tablet.loadQMLSource("TabletAddressDialog.qml");
|
tablet.initialScreen("TabletAddressDialog.qml");
|
||||||
HMD.openTablet();
|
HMD.openTablet();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
var outstanding;
|
var outstanding;
|
||||||
var readyData;
|
var readyData;
|
||||||
|
var shareAfterLogin = false;
|
||||||
|
var snapshotToShareAfterLogin;
|
||||||
function onMessage(message) {
|
function onMessage(message) {
|
||||||
// Receives message from the html dialog via the qwebchannel EventBridge. This is complicated by the following:
|
// Receives message from the html dialog via the qwebchannel EventBridge. This is complicated by the following:
|
||||||
// 1. Although we can send POJOs, we cannot receive a toplevel object. (Arrays of POJOs are fine, though.)
|
// 1. Although we can send POJOs, we cannot receive a toplevel object. (Arrays of POJOs are fine, though.)
|
||||||
|
@ -82,24 +84,27 @@ function onMessage(message) {
|
||||||
default:
|
default:
|
||||||
//tablet.webEventReceived.disconnect(onMessage); // <<< It's probably this that's missing?!
|
//tablet.webEventReceived.disconnect(onMessage); // <<< It's probably this that's missing?!
|
||||||
HMD.closeTablet();
|
HMD.closeTablet();
|
||||||
tablet.gotoHomeScreen();
|
|
||||||
isLoggedIn = Account.isLoggedIn();
|
isLoggedIn = Account.isLoggedIn();
|
||||||
message.action.forEach(function (submessage) {
|
message.action.forEach(function (submessage) {
|
||||||
if (submessage.share && !isLoggedIn) {
|
if (submessage.share && !isLoggedIn) {
|
||||||
needsLogin = true;
|
needsLogin = true;
|
||||||
submessage.share = false;
|
submessage.share = false;
|
||||||
|
shareAfterLogin = true;
|
||||||
|
snapshotToShareAfterLogin = {path: submessage.localPath, href: submessage.href};
|
||||||
}
|
}
|
||||||
if (submessage.share) {
|
if (submessage.share) {
|
||||||
print('sharing', submessage.localPath);
|
print('sharing', submessage.localPath);
|
||||||
outstanding++;
|
outstanding = true;
|
||||||
Window.shareSnapshot(submessage.localPath, submessage.href);
|
//Window.shareSnapshot(submessage.localPath, submessage.href);
|
||||||
} else {
|
} else {
|
||||||
print('not sharing', submessage.localPath);
|
print('not sharing', submessage.localPath);
|
||||||
}
|
}
|
||||||
|
|
||||||
});
|
});
|
||||||
if (!outstanding && shouldOpenFeedAfterShare()) {
|
print(shouldOpenFeedAfterShare());
|
||||||
//showFeedWindow();
|
if (outstanding && shouldOpenFeedAfterShare()) {
|
||||||
|
showFeedWindow();
|
||||||
|
outstanding = false;
|
||||||
}
|
}
|
||||||
if (needsLogin) { // after the possible feed, so that the login is on top
|
if (needsLogin) { // after the possible feed, so that the login is on top
|
||||||
var isLoggedIn = Account.isLoggedIn();
|
var isLoggedIn = Account.isLoggedIn();
|
||||||
|
@ -241,13 +246,22 @@ function onTabletScreenChanged(type, url) {
|
||||||
isInSnapshotReview = false;
|
isInSnapshotReview = false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
function onConnected() {
|
||||||
|
if (shareAfterLogin && Account.isLoggedIn()) {
|
||||||
|
print('sharing', snapshotToShareAfterLogin.path);
|
||||||
|
Window.shareSnapshot(snapshotToShareAfterLogin.path, snapshotToShareAfterLogin.href);
|
||||||
|
shareAfterLogin = false;
|
||||||
|
showFeedWindow();
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
button.clicked.connect(onClicked);
|
button.clicked.connect(onClicked);
|
||||||
buttonConnected = true;
|
buttonConnected = true;
|
||||||
Window.snapshotShared.connect(snapshotShared);
|
Window.snapshotShared.connect(snapshotShared);
|
||||||
Window.processingGif.connect(processingGif);
|
Window.processingGif.connect(processingGif);
|
||||||
tablet.screenChanged.connect(onTabletScreenChanged);
|
tablet.screenChanged.connect(onTabletScreenChanged);
|
||||||
|
Account.usernameChanged.connect(onConnected);
|
||||||
Script.scriptEnding.connect(function () {
|
Script.scriptEnding.connect(function () {
|
||||||
if (buttonConnected) {
|
if (buttonConnected) {
|
||||||
button.clicked.disconnect(onClicked);
|
button.clicked.disconnect(onClicked);
|
||||||
|
|
Loading…
Reference in a new issue