mirror of
https://github.com/overte-org/overte.git
synced 2025-08-08 12:37:51 +02:00
Merge pull request #7740 from ctrlaltdavid/20887
Don't display "Reveal Scripts Folder" control in HMD mode
This commit is contained in:
commit
de17834dd1
7 changed files with 27 additions and 9 deletions
|
@ -24,7 +24,8 @@ Window {
|
||||||
resizable: true
|
resizable: true
|
||||||
destroyOnInvisible: true
|
destroyOnInvisible: true
|
||||||
x: 40; y: 40
|
x: 40; y: 40
|
||||||
implicitWidth: 400; implicitHeight: 728
|
implicitWidth: 400
|
||||||
|
implicitHeight: isHMD ? 695 : 728
|
||||||
minSize: Qt.vector2d(200, 300)
|
minSize: Qt.vector2d(200, 300)
|
||||||
|
|
||||||
HifiConstants { id: hifi }
|
HifiConstants { id: hifi }
|
||||||
|
@ -32,6 +33,7 @@ Window {
|
||||||
property var scripts: ScriptDiscoveryService;
|
property var scripts: ScriptDiscoveryService;
|
||||||
property var scriptsModel: scripts.scriptsModelFilter
|
property var scriptsModel: scripts.scriptsModelFilter
|
||||||
property var runningScriptsModel: ListModel { }
|
property var runningScriptsModel: ListModel { }
|
||||||
|
property bool isHMD: false
|
||||||
|
|
||||||
Settings {
|
Settings {
|
||||||
category: "Overlay.RunningScripts"
|
category: "Overlay.RunningScripts"
|
||||||
|
@ -44,7 +46,10 @@ Window {
|
||||||
onScriptCountChanged: updateRunningScripts();
|
onScriptCountChanged: updateRunningScripts();
|
||||||
}
|
}
|
||||||
|
|
||||||
Component.onCompleted: updateRunningScripts()
|
Component.onCompleted: {
|
||||||
|
isHMD = HMD.active;
|
||||||
|
updateRunningScripts();
|
||||||
|
}
|
||||||
|
|
||||||
function setDefaultFocus() {
|
function setDefaultFocus() {
|
||||||
// Work around FocusScope of scrollable window.
|
// Work around FocusScope of scrollable window.
|
||||||
|
@ -237,7 +242,7 @@ Window {
|
||||||
}
|
}
|
||||||
|
|
||||||
HifiControls.VerticalSpacer {
|
HifiControls.VerticalSpacer {
|
||||||
height: hifi.dimensions.controlInterlineHeight - 3
|
height: hifi.dimensions.controlInterlineHeight - (!isHMD ? 3 : 0)
|
||||||
}
|
}
|
||||||
|
|
||||||
HifiControls.TextAction {
|
HifiControls.TextAction {
|
||||||
|
@ -245,13 +250,15 @@ Window {
|
||||||
icon: hifi.glyphs.script
|
icon: hifi.glyphs.script
|
||||||
iconSize: 24
|
iconSize: 24
|
||||||
text: "Reveal Scripts Folder"
|
text: "Reveal Scripts Folder"
|
||||||
onClicked: fileDialogHelper.openScriptsDirectory()
|
onClicked: fileDialogHelper.openDirectory(scripts.defaultScriptsPath)
|
||||||
colorScheme: hifi.colorSchemes.dark
|
colorScheme: hifi.colorSchemes.dark
|
||||||
anchors.left: parent.left
|
anchors.left: parent.left
|
||||||
|
visible: !isHMD
|
||||||
}
|
}
|
||||||
|
|
||||||
HifiControls.VerticalSpacer {
|
HifiControls.VerticalSpacer {
|
||||||
height: hifi.dimensions.controlInterlineHeight - 3
|
height: hifi.dimensions.controlInterlineHeight - 3
|
||||||
|
visible: !isHMD
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -511,3 +511,7 @@ void ScriptEngines::onScriptEngineError(const QString& scriptFilename) {
|
||||||
qCDebug(scriptengine) << "Application::loadScript(), script failed to load...";
|
qCDebug(scriptengine) << "Application::loadScript(), script failed to load...";
|
||||||
emit scriptLoadError(scriptFilename, "");
|
emit scriptLoadError(scriptFilename, "");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
QString ScriptEngines::getDefaultScriptsLocation() const {
|
||||||
|
return defaultScriptsLocation().toString();
|
||||||
|
}
|
||||||
|
|
|
@ -50,6 +50,8 @@ public:
|
||||||
ScriptsModel* scriptsModel() { return &_scriptsModel; };
|
ScriptsModel* scriptsModel() { return &_scriptsModel; };
|
||||||
ScriptsModelFilter* scriptsModelFilter() { return &_scriptsModelFilter; };
|
ScriptsModelFilter* scriptsModelFilter() { return &_scriptsModelFilter; };
|
||||||
|
|
||||||
|
QString getDefaultScriptsLocation() const;
|
||||||
|
|
||||||
Q_INVOKABLE void loadOneScript(const QString& scriptFilename);
|
Q_INVOKABLE void loadOneScript(const QString& scriptFilename);
|
||||||
Q_INVOKABLE ScriptEngine* loadScript(const QUrl& scriptFilename = QString(),
|
Q_INVOKABLE ScriptEngine* loadScript(const QUrl& scriptFilename = QString(),
|
||||||
bool isUserLoaded = true, bool loadScriptFromEditor = false, bool activateMainWindow = false, bool reload = false);
|
bool isUserLoaded = true, bool loadScriptFromEditor = false, bool activateMainWindow = false, bool reload = false);
|
||||||
|
@ -62,6 +64,8 @@ public:
|
||||||
Q_INVOKABLE QVariantList getPublic();
|
Q_INVOKABLE QVariantList getPublic();
|
||||||
Q_INVOKABLE QVariantList getLocal();
|
Q_INVOKABLE QVariantList getLocal();
|
||||||
|
|
||||||
|
Q_PROPERTY(QString defaultScriptsPath READ getDefaultScriptsLocation)
|
||||||
|
|
||||||
// Called at shutdown time
|
// Called at shutdown time
|
||||||
void shutdownScripting();
|
void shutdownScripting();
|
||||||
|
|
||||||
|
|
|
@ -16,8 +16,6 @@
|
||||||
#include <QtCore/QRegularExpression>
|
#include <QtCore/QRegularExpression>
|
||||||
#include <QDesktopServices>
|
#include <QDesktopServices>
|
||||||
|
|
||||||
#include "PathUtils.h"
|
|
||||||
|
|
||||||
|
|
||||||
QUrl FileDialogHelper::home() {
|
QUrl FileDialogHelper::home() {
|
||||||
return pathToUrl(QStandardPaths::standardLocations(QStandardPaths::HomeLocation)[0]);
|
return pathToUrl(QStandardPaths::standardLocations(QStandardPaths::HomeLocation)[0]);
|
||||||
|
@ -107,6 +105,6 @@ QStringList FileDialogHelper::drives() {
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
void FileDialogHelper::openScriptsDirectory() {
|
void FileDialogHelper::openDirectory(const QString& path) {
|
||||||
QDesktopServices::openUrl(defaultScriptsLocation());
|
QDesktopServices::openUrl(path);
|
||||||
}
|
}
|
||||||
|
|
|
@ -59,7 +59,7 @@ public:
|
||||||
Q_INVOKABLE QUrl pathToUrl(const QString& path);
|
Q_INVOKABLE QUrl pathToUrl(const QString& path);
|
||||||
Q_INVOKABLE QUrl saveHelper(const QString& saveText, const QUrl& currentFolder, const QStringList& selectionFilters);
|
Q_INVOKABLE QUrl saveHelper(const QString& saveText, const QUrl& currentFolder, const QStringList& selectionFilters);
|
||||||
|
|
||||||
Q_INVOKABLE void openScriptsDirectory();
|
Q_INVOKABLE void openDirectory(const QString& path);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -51,7 +51,11 @@ Item {
|
||||||
function getRunning() {
|
function getRunning() {
|
||||||
return _runningScripts;
|
return _runningScripts;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
Item {
|
||||||
|
objectName: "HMD"
|
||||||
|
property bool active: false
|
||||||
}
|
}
|
||||||
|
|
||||||
Item {
|
Item {
|
||||||
|
|
|
@ -88,6 +88,7 @@ int main(int argc, char *argv[]) {
|
||||||
setChild(engine, "ApplicationCompositor");
|
setChild(engine, "ApplicationCompositor");
|
||||||
setChild(engine, "Desktop");
|
setChild(engine, "Desktop");
|
||||||
setChild(engine, "ScriptDiscoveryService");
|
setChild(engine, "ScriptDiscoveryService");
|
||||||
|
setChild(engine, "HMD");
|
||||||
setChild(engine, "MenuHelper");
|
setChild(engine, "MenuHelper");
|
||||||
setChild(engine, "Preferences");
|
setChild(engine, "Preferences");
|
||||||
setChild(engine, "urlHandler");
|
setChild(engine, "urlHandler");
|
||||||
|
|
Loading…
Reference in a new issue