Running scripts in QML
Showing the changes to interface/src/Application.cpp (1 of 16 files). Show all
Unified · Split
| @@ -982,12 +982,6 @@ Application::Application(int& argc, char** argv, QElapsedTimer& startupTimer) : · 981 unmodified lines | ||
| 982 | 982 | }); |
| 983 | 983 | |
| 984 | 984 | connect(this, &Application::applicationStateChanged, this, &Application::activeChanged); |
| 985 | − | |
| 986 | − // FIXME -- NOTE: This will call ProcessEvents() which can cause authentication signals to fire, which | |
| 987 | − // if not logged in can cause the login dialog to appear. As currently implemented, the login requires | |
| 988 | − // the offscreen UI to render, so this needs to be well after OffscreenUi is available | |
| 989 | − _runningScriptsWidget = new RunningScriptsWidget(_window); | |
| 990 | − | |
| 991 | 985 | qCDebug(interfaceapp, "Startup time: %4.2f seconds.", (double)startupTimer.elapsed() / 1000.0); |
| 992 | 986 | } |
| 993 | 987 | |
| @@ -1199,7 +1193,10 @@ void Application::initializeUi() { · 205 unmodified lines | ||
| 1199 | 1193 | offscreenUi->create(_offscreenContext->getContext()); |
| 1200 | 1194 | offscreenUi->setProxyWindow(_window->windowHandle()); |
| 1201 | 1195 | offscreenUi->setBaseUrl(QUrl::fromLocalFile(PathUtils::resourcesPath() + "/qml/")); |
| 1202 | − offscreenUi->load("Root.qml"); | |
| 1196 | + // OffscreenUi is a subclass of OffscreenQmlSurface specifically designed to | |
| 1197 | + // support the window management and scripting proxies for VR use | |
| 1198 | + offscreenUi->createDesktop(); | |
| 1199 | + | |
| 1203 | 1200 | // FIXME either expose so that dialogs can set this themselves or |
| 1204 | 1201 | // do better detection in the offscreen UI of what has focus |
| 1205 | 1202 | offscreenUi->setNavigationFocused(false); |
| @@ -1210,6 +1207,9 @@ void Application::initializeUi() { · 4 unmodified lines | ||
| 1210 | 1207 | qApp->quit(); |
| 1211 | 1208 | }); |
| 1212 | 1209 | |
| 1210 | + // For some reason there is already an "Application" object in the QML context, | |
| 1211 | + // though I can't find it. Hence, "ApplicationInterface" | |
| 1212 | + rootContext->setContextProperty("ApplicationInterface", this); | |
| 1213 | 1213 | rootContext->setContextProperty("AnimationCache", DependencyManager::get<AnimationCache>().data()); |
| 1214 | 1214 | rootContext->setContextProperty("Audio", &AudioScriptingInterface::getInstance()); |
| 1215 | 1215 | rootContext->setContextProperty("Controller", DependencyManager::get<controller::ScriptingInterface>().data()); |
| @@ -1232,8 +1232,6 @@ void Application::initializeUi() { · 16 unmodified lines | ||
| 1232 | 1232 | #endif |
| 1233 | 1233 | |
| 1234 | 1234 | rootContext->setContextProperty("Overlays", &_overlays); |
| 1235 | − rootContext->setContextProperty("Desktop", DependencyManager::get<DesktopScriptingInterface>().data()); | |
| 1236 | − | |
| 1237 | 1235 | rootContext->setContextProperty("Window", DependencyManager::get<WindowScriptingInterface>().data()); |
| 1238 | 1236 | rootContext->setContextProperty("Menu", MenuScriptingInterface::getInstance()); |
| 1239 | 1237 | rootContext->setContextProperty("Stats", Stats::getInstance()); |
| @@ -4535,18 +4533,20 @@ bool Application::displayAvatarAttachmentConfirmationDialog(const QString& name) · 3295 unmodified lines | ||
| 4535 | 4533 | } |
| 4536 | 4534 | |
| 4537 | 4535 | void Application::toggleRunningScriptsWidget() { |
| 4538 | − if (_runningScriptsWidget->isVisible()) { | |
| 4539 | − if (_runningScriptsWidget->hasFocus()) { | |
| 4540 | − _runningScriptsWidget->hide(); | |
| 4541 | − } else { | |
| 4542 | − _runningScriptsWidget->raise(); | |
| 4543 | − setActiveWindow(_runningScriptsWidget); | |
| 4544 | − _runningScriptsWidget->setFocus(); | |
| 4545 | − } | |
| 4546 | − } else { | |
| 4547 | − _runningScriptsWidget->show(); | |
| 4548 | − _runningScriptsWidget->setFocus(); | |
| 4549 | − } | |
| 4536 | + static const QUrl url("dialogs/RunningScripts.qml"); | |
| 4537 | + DependencyManager::get<OffscreenUi>()->toggle(url, "RunningScripts"); | |
| 4538 | + //if (_runningScriptsWidget->isVisible()) { | |
| 4539 | + // if (_runningScriptsWidget->hasFocus()) { | |
| 4540 | + // _runningScriptsWidget->hide(); | |
| 4541 | + // } else { | |
| 4542 | + // _runningScriptsWidget->raise(); | |
| 4543 | + // setActiveWindow(_runningScriptsWidget); | |
| 4544 | + // _runningScriptsWidget->setFocus(); | |
| 4545 | + // } | |
| 4546 | + //} else { | |
| 4547 | + // _runningScriptsWidget->show(); | |
| 4548 | + // _runningScriptsWidget->setFocus(); | |
| 4549 | + //} | |
| 4550 | 4550 | } |
| 4551 | 4551 | |
| 4552 | 4552 | void Application::packageModel() { |