mirror of
https://github.com/overte-org/overte.git
synced 2025-04-22 21:13:31 +02:00
New Snap FTUE flow
This commit is contained in:
parent
92187e2424
commit
3221214283
5 changed files with 41 additions and 2 deletions
interface/src/scripting
scripts/system
|
@ -168,6 +168,28 @@ void WindowScriptingInterface::ensureReticleVisible() const {
|
|||
}
|
||||
}
|
||||
|
||||
/// Display a "browse to directory" dialog. If `directory` is an invalid file or directory the browser will start at the current
|
||||
/// working directory.
|
||||
/// \param const QString& title title of the window
|
||||
/// \param const QString& directory directory to start the file browser at
|
||||
/// \param const QString& nameFilter filter to filter filenames by - see `QFileDialog`
|
||||
/// \return QScriptValue file path as a string if one was selected, otherwise `QScriptValue::NullValue`
|
||||
QScriptValue WindowScriptingInterface::browseDir(const QString& title, const QString& directory) {
|
||||
ensureReticleVisible();
|
||||
QString path = directory;
|
||||
if (path.isEmpty()) {
|
||||
path = getPreviousBrowseLocation();
|
||||
}
|
||||
#ifndef Q_OS_WIN
|
||||
path = fixupPathForMac(directory);
|
||||
#endif
|
||||
QString result = OffscreenUi::getExistingDirectory(nullptr, title, path);
|
||||
if (!result.isEmpty()) {
|
||||
setPreviousBrowseLocation(QFileInfo(result).absolutePath());
|
||||
}
|
||||
return result.isEmpty() ? QScriptValue::NullValue : QScriptValue(result);
|
||||
}
|
||||
|
||||
/// Display an open file dialog. If `directory` is an invalid file or directory the browser will start at the current
|
||||
/// working directory.
|
||||
/// \param const QString& title title of the window
|
||||
|
|
|
@ -51,6 +51,7 @@ public slots:
|
|||
QScriptValue confirm(const QString& message = "");
|
||||
QScriptValue prompt(const QString& message = "", const QString& defaultText = "");
|
||||
CustomPromptResult customPrompt(const QVariant& config);
|
||||
QScriptValue browseDir(const QString& title = "", const QString& directory = "");
|
||||
QScriptValue browse(const QString& title = "", const QString& directory = "", const QString& nameFilter = "");
|
||||
QScriptValue save(const QString& title = "", const QString& directory = "", const QString& nameFilter = "");
|
||||
QScriptValue browseAssets(const QString& title = "", const QString& directory = "", const QString& nameFilter = "");
|
||||
|
|
|
@ -204,6 +204,7 @@ input[type=button].naked:active {
|
|||
margin: auto;
|
||||
box-sizing: content-box;
|
||||
display: inline;
|
||||
outline:none;
|
||||
}
|
||||
#snap-button:disabled {
|
||||
background: gray;
|
||||
|
|
|
@ -25,6 +25,14 @@ function showSetupInstructions() {
|
|||
'<input type="button" value="CHOOSE" onclick="chooseSnapshotLocation()" />';
|
||||
document.getElementById("snap-button").disabled = true;
|
||||
}
|
||||
function showSetupComplete() {
|
||||
var snapshotImagesDiv = document.getElementById("snapshot-images");
|
||||
snapshotImagesDiv.className = "snapshotInstructions";
|
||||
snapshotImagesDiv.innerHTML = '<img class="centeredImage" src="./img/snapshotIcon.png" alt="Snapshot Instructions" width="64" height="64"/>' +
|
||||
'<br/>' +
|
||||
"<h4>You're all set!</h4>" +
|
||||
'<p>Try taking a snapshot by pressing the button below.</p>';
|
||||
}
|
||||
function chooseSnapshotLocation() {
|
||||
EventBridge.emitWebEvent(JSON.stringify({
|
||||
type: "snapshot",
|
||||
|
@ -244,6 +252,7 @@ window.onload = function () {
|
|||
break;
|
||||
case 'snapshotLocationChosen':
|
||||
clearImages();
|
||||
showSetupComplete();
|
||||
break;
|
||||
case 'clearPreviousImages':
|
||||
clearImages();
|
||||
|
|
|
@ -117,12 +117,18 @@ function onMessage(message) {
|
|||
type: "snapshot",
|
||||
action: "showSetupInstructions"
|
||||
}));
|
||||
Settings.setValue("previousStillSnapPath", "");
|
||||
Settings.setValue("previousStillSnapStoryID", "");
|
||||
Settings.setValue("previousStillSnapSharingDisabled", false);
|
||||
Settings.setValue("previousAnimatedSnapPath", "");
|
||||
Settings.setValue("previousAnimatedSnapStoryID", "");
|
||||
Settings.setValue("previousAnimatedSnapSharingDisabled", false);
|
||||
}
|
||||
break;
|
||||
case 'chooseSnapshotLocation':
|
||||
var snapshotPath = Window.browse("Choose Snapshots Directory","","");
|
||||
var snapshotPath = Window.browseDir("Choose Snapshots Directory", "", "");
|
||||
|
||||
if (!snapshotPath.isEmpty()) { // not cancelled
|
||||
if (snapshotPath) { // not cancelled
|
||||
Settings.setValue("snapshotsLocation", snapshotPath);
|
||||
tablet.emitScriptEvent(JSON.stringify({
|
||||
type: "snapshot",
|
||||
|
|
Loading…
Reference in a new issue