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