mirror of
https://github.com/overte-org/overte.git
synced 2025-04-20 11:45:36 +02:00
new snapshot review behavior
This commit is contained in:
parent
17d9db487d
commit
8823f48666
2 changed files with 67 additions and 28 deletions
|
@ -21,6 +21,15 @@
|
|||
max-width: 100%;
|
||||
height:auto;
|
||||
}
|
||||
.prompt {
|
||||
font-family: Raleway-SemiBold;
|
||||
text-transform: none;
|
||||
}
|
||||
|
||||
.sub-section-header > div > input {
|
||||
margin-top:20px;
|
||||
}
|
||||
span.inline-checkbox { display:inline; }
|
||||
|
||||
@media (max-width: 768px){
|
||||
.snapshot-column-left{
|
||||
|
@ -37,6 +46,8 @@
|
|||
.snapsection{
|
||||
width:95% !important;
|
||||
padding-right:0px;
|
||||
margin-left: auto;
|
||||
margin-right: auto;
|
||||
}
|
||||
div#sharing {
|
||||
margin-top:50px;
|
||||
|
@ -104,11 +115,14 @@
|
|||
|
||||
};
|
||||
// beware of bug: Cannot send objects at top level. (Nested in arrays is fine.)
|
||||
shareSelected = function() {
|
||||
EventBridge.emitWebEvent(paths);
|
||||
shareSelected = function () {
|
||||
EventBridge.emitWebEvent(paths.concat({openFeed: document.getElementById("openFeed").checked}));
|
||||
};
|
||||
doNotShare = function() {
|
||||
EventBridge.emitWebEvent([]);
|
||||
doNotShare = function () {
|
||||
EventBridge.emitWebEvent([{openFeed: document.getElementById("openFeed").checked}]);
|
||||
};
|
||||
snapshotSettings = function () {
|
||||
EventBridge.emitWebEvent("openSettings");
|
||||
};
|
||||
</script>
|
||||
|
||||
|
@ -120,16 +134,23 @@
|
|||
<div class="section-header snapsection">
|
||||
<label>Snapshots sucessfully saved!</label>
|
||||
</div>
|
||||
<div id="sharing">
|
||||
<div class="sub-section-header snapsection">
|
||||
<label>Would you like to share?</label>
|
||||
</div>
|
||||
<div class="sub-section-header snapsection">
|
||||
<input type="button" id="share" value="SHARE IN FEED" onclick="shareSelected()"/>
|
||||
</div>
|
||||
<div class="sub-section-header snapsection">
|
||||
<input type="button" class="red" id="close" value="DON'T SHARE" onclick="doNotShare()"/>
|
||||
<div class="sub-section-header snapsection">
|
||||
<div id="sharing">
|
||||
<div class="prompt">Would you like to share your pic in the Snapshots feed?</div>
|
||||
<div>
|
||||
<input type="button" class="blue" id="share" value="SHARE IN FEED" onclick="shareSelected()"/>
|
||||
</div>
|
||||
</div>
|
||||
<div>
|
||||
<input type="button" class="red" id="close" value="DON'T SHARE" onclick="doNotShare()"/>
|
||||
</div>
|
||||
</div>
|
||||
<div class="sub-section-header snapsection">
|
||||
<input type="button" value="Snapshot setttings" onclick="snapshotSettings()"/>
|
||||
<span class="inline-checkbox property checkbox">
|
||||
<input id="openFeed" type="checkbox" checked/>
|
||||
<label for="openFeed">Open feed after</label>
|
||||
</span>
|
||||
</div>
|
||||
</div>
|
||||
<div id="snapshot-images" class="snapshot-column-right"/>
|
||||
|
|
|
@ -20,24 +20,39 @@ var button = toolBar.addButton({
|
|||
alpha: 0.9,
|
||||
});
|
||||
|
||||
function showFeedWindow() {
|
||||
DialogsManager.showFeed();
|
||||
}
|
||||
|
||||
var openFeed, outstanding;
|
||||
function confirmShare(data) {
|
||||
var dialog = new OverlayWebWindow('Snapshot', Script.resolvePath("html/ShareSnapshot.html"), 800, 470);
|
||||
var dialog = new OverlayWebWindow('Snapshot Review', Script.resolvePath("html/ShareSnapshot.html"), 800, 470);
|
||||
function onMessage(message) {
|
||||
if (message == 'ready') { // The window can now receive data from us.
|
||||
switch (message) {
|
||||
case 'ready':
|
||||
dialog.emitScriptEvent(data); // Send it.
|
||||
return;
|
||||
} // Rest is confirmation processing
|
||||
dialog.webEventReceived.disconnect(onMessage); // I'm not certain that this is necessary. If it is, what do we do on normal close?
|
||||
dialog.close();
|
||||
dialog.deleteLater();
|
||||
message = message.filter(function (picture) { return picture.share; });
|
||||
if (message.length) {
|
||||
print('sharing', message.map(function (picture) { return picture.localPath; }).join(', '));
|
||||
message.forEach(function (data) {
|
||||
Window.shareSnapshot(data.localPath);
|
||||
openFeed = false;
|
||||
outstanding = 0;
|
||||
break;
|
||||
case 'openSettings':
|
||||
Desktop.show("hifi/dialogs/GeneralPreferencesDialog.qml", "GeneralPreferencesDialog");
|
||||
break;
|
||||
default:
|
||||
dialog.webEventReceived.disconnect(onMessage); // I'm not certain that this is necessary. If it is, what do we do on normal close?
|
||||
dialog.close();
|
||||
dialog.deleteLater();
|
||||
message.forEach(function (submessage) {
|
||||
if (submessage.share) {
|
||||
print('sharing', submessage.localPath);
|
||||
outstanding++;
|
||||
Window.shareSnapshot(submessage.localPath);
|
||||
} else if (submessage.openFeed) {
|
||||
openFeed = true;
|
||||
}
|
||||
});
|
||||
} else {
|
||||
print('declined to share', JSON.stringify(data));
|
||||
if (openFeed && !outstanding) {
|
||||
showFeedWindow();
|
||||
}
|
||||
}
|
||||
}
|
||||
dialog.webEventReceived.connect(onMessage);
|
||||
|
@ -51,7 +66,10 @@ function snapshotShared(success) {
|
|||
} else {
|
||||
// for now just print an error.
|
||||
print('snapshot upload/share failed');
|
||||
}
|
||||
}
|
||||
if ((--outstanding <= 0) && openFeed) {
|
||||
showFeedWindow();
|
||||
}
|
||||
}
|
||||
|
||||
function onClicked() {
|
||||
|
|
Loading…
Reference in a new issue