diff --git a/interface/resources/qml/dialogs/RunningScripts.qml b/interface/resources/qml/dialogs/RunningScripts.qml index 7a76380487..6d7ef648fe 100644 --- a/interface/resources/qml/dialogs/RunningScripts.qml +++ b/interface/resources/qml/dialogs/RunningScripts.qml @@ -47,8 +47,6 @@ Window { } } - - Settings { category: "Overlay.RunningScripts" property alias x: root.x @@ -187,10 +185,13 @@ Window { anchors.bottom: filterEdit.top anchors.bottomMargin: 8 anchors.right: parent.right - Button { text: "from URL" } + Button { + text: "from URL"; + onClicked: ApplicationInterface.loadScriptURLDialog(); + } Button { text: "from Disk" - onClicked: fileDialogCreator.createObject(root); + onClicked: ApplicationInterface.loadDialog(); } } @@ -207,7 +208,8 @@ Window { TreeView { id: treeView height: 128 - anchors.bottom: parent.bottom + anchors.bottom: loadButton.top + anchors.bottomMargin: 8 anchors.left: parent.left anchors.right: parent.right headerVisible: false @@ -232,6 +234,37 @@ Window { model: scriptsModel TableViewColumn { title: "Name"; role: "display"; } } + + TextField { + id: selectedScript + enabled: true + readOnly: true + anchors.left: parent.left + anchors.right: loadButton.left + anchors.rightMargin: 8 + anchors.bottom: loadButton.bottom + anchors.top: loadButton.top + Connections { + target: treeView + onCurrentIndexChanged: { + var path = scriptsModel.data(treeView.currentIndex, 0x100) + if (path) { + selectedScript.text = path + } else { + selectedScript.text = "" + } + + } + } + } + + Button { + id: loadButton + anchors.bottom: parent.bottom + anchors.right: parent.right + text: "Load" + enabled: selectedScript.text != "" + } } } } diff --git a/interface/src/Application.cpp b/interface/src/Application.cpp index adcf5d305b..84c6e5e55c 100644 --- a/interface/src/Application.cpp +++ b/interface/src/Application.cpp @@ -977,12 +977,6 @@ Application::Application(int& argc, char** argv, QElapsedTimer& startupTimer) : }); connect(this, &Application::applicationStateChanged, this, &Application::activeChanged); - - // FIXME -- NOTE: This will call ProcessEvents() which can cause authentication signals to fire, which - // if not logged in can cause the login dialog to appear. As currently implemented, the login requires - // the offscreen UI to render, so this needs to be well after OffscreenUi is available - _runningScriptsWidget = new RunningScriptsWidget(_window); - qCDebug(interfaceapp, "Startup time: %4.2f seconds.", (double)startupTimer.elapsed() / 1000.0); } @@ -1208,6 +1202,9 @@ void Application::initializeUi() { qApp->quit(); }); + // For some reason there is already an "Application" object in the QML context, + // though I can't find it. Hence, "ApplicationInterface" + rootContext->setContextProperty("ApplicationInterface", this); rootContext->setContextProperty("AnimationCache", DependencyManager::get().data()); rootContext->setContextProperty("Audio", &AudioScriptingInterface::getInstance()); rootContext->setContextProperty("Controller", DependencyManager::get().data()); diff --git a/interface/src/Application.h b/interface/src/Application.h index 38b4a8845c..d50fef327b 100644 --- a/interface/src/Application.h +++ b/interface/src/Application.h @@ -245,8 +245,8 @@ public slots: bool importEntities(const QString& url); void setLowVelocityFilter(bool lowVelocityFilter); - void loadDialog(); - void loadScriptURLDialog(); + Q_INVOKABLE void loadDialog(); + Q_INVOKABLE void loadScriptURLDialog(); void toggleLogDialog(); void toggleRunningScriptsWidget();