History

Merge pull request #6812 from jherico/running_scripts

Running scripts in QML

Brad Hefta-Gaub committed 10 years ago

Commit cd167e42 parents 90f4ca7 e7bfcba16 files · +587 −858Browse files

Showing the changes to interface/src/Application.cpp (1 of 16 files). Show all

Unified · Split

interface/src/Application.cpp+21−21
@@ -982,12 +982,6 @@ Application::Application(int& argc, char** argv, QElapsedTimer& startupTimer) : · 981 unmodified lines
982 });982 });
983 983
984 connect(this, &Application::applicationStateChanged, this, &Application::activeChanged);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 qCDebug(interfaceapp, "Startup time: %4.2f seconds.", (double)startupTimer.elapsed() / 1000.0);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 offscreenUi->create(_offscreenContext->getContext());1193 offscreenUi->create(_offscreenContext->getContext());
1200 offscreenUi->setProxyWindow(_window->windowHandle());1194 offscreenUi->setProxyWindow(_window->windowHandle());
1201 offscreenUi->setBaseUrl(QUrl::fromLocalFile(PathUtils::resourcesPath() + "/qml/"));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 // FIXME either expose so that dialogs can set this themselves or1200 // FIXME either expose so that dialogs can set this themselves or
1204 // do better detection in the offscreen UI of what has focus1201 // do better detection in the offscreen UI of what has focus
1205 offscreenUi->setNavigationFocused(false);1202 offscreenUi->setNavigationFocused(false);
@@ -1210,6 +1207,9 @@ void Application::initializeUi() { · 4 unmodified lines
1210 qApp->quit();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 rootContext->setContextProperty("AnimationCache", DependencyManager::get<AnimationCache>().data());1213 rootContext->setContextProperty("AnimationCache", DependencyManager::get<AnimationCache>().data());
1214 rootContext->setContextProperty("Audio", &AudioScriptingInterface::getInstance());1214 rootContext->setContextProperty("Audio", &AudioScriptingInterface::getInstance());
1215 rootContext->setContextProperty("Controller", DependencyManager::get<controller::ScriptingInterface>().data());1215 rootContext->setContextProperty("Controller", DependencyManager::get<controller::ScriptingInterface>().data());
@@ -1232,8 +1232,6 @@ void Application::initializeUi() { · 16 unmodified lines
1232#endif1232#endif
1233 1233
1234 rootContext->setContextProperty("Overlays", &_overlays);1234 rootContext->setContextProperty("Overlays", &_overlays);
1235 rootContext->setContextProperty("Desktop", DependencyManager::get<DesktopScriptingInterface>().data());
1236
1237 rootContext->setContextProperty("Window", DependencyManager::get<WindowScriptingInterface>().data());1235 rootContext->setContextProperty("Window", DependencyManager::get<WindowScriptingInterface>().data());
1238 rootContext->setContextProperty("Menu", MenuScriptingInterface::getInstance());1236 rootContext->setContextProperty("Menu", MenuScriptingInterface::getInstance());
1239 rootContext->setContextProperty("Stats", Stats::getInstance());1237 rootContext->setContextProperty("Stats", Stats::getInstance());
@@ -4535,18 +4533,20 @@ bool Application::displayAvatarAttachmentConfirmationDialog(const QString& name) · 3295 unmodified lines
4535}4533}
4536 4534
4537void Application::toggleRunningScriptsWidget() {4535void Application::toggleRunningScriptsWidget() {
4538 if (_runningScriptsWidget->isVisible()) {4536 static const QUrl url("dialogs/RunningScripts.qml");
4539 if (_runningScriptsWidget->hasFocus()) {4537 DependencyManager::get<OffscreenUi>()->toggle(url, "RunningScripts");
4540 _runningScriptsWidget->hide();4538 //if (_runningScriptsWidget->isVisible()) {
4541 } else {4539 // if (_runningScriptsWidget->hasFocus()) {
4542 _runningScriptsWidget->raise();4540 // _runningScriptsWidget->hide();
4543 setActiveWindow(_runningScriptsWidget);4541 // } else {
4544 _runningScriptsWidget->setFocus();4542 // _runningScriptsWidget->raise();
4545 }4543 // setActiveWindow(_runningScriptsWidget);
4546 } else {4544 // _runningScriptsWidget->setFocus();
4547 _runningScriptsWidget->show();4545 // }
4548 _runningScriptsWidget->setFocus();4546 //} else {
4549 }4547 // _runningScriptsWidget->show();
4548 // _runningScriptsWidget->setFocus();
4549 //}
4550}4550}
4551 4551
4552void Application::packageModel() {4552void Application::packageModel() {