History

abstract toggleMenu

Zach Pomerantz committed 9 years ago

Commit 637a4481 parent 380a16f3 files · +20 −32Browse files

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

Unified · Split

interface/src/Application.cpp+17−30
@@ -5764,38 +5764,25 @@ bool Application::displayAvatarAttachmentConfirmationDialog(const QString& name) · 5763 unmodified lines
5764 }5764 }
5765}5765}
5766 5766
5767void Application::toggleRunningScriptsWidget() const { 5767void Application::toggleMenu(const QString title, const QUrl widgetUrl, const QUrl tabletUrl) const {
5768 auto scriptEngines = DependencyManager::get<ScriptEngines>();5768 auto hmd = DependencyManager::get<HMDScriptingInterface>();
5769 bool scriptsRunning = !scriptEngines->getRunningScripts().isEmpty();5769 auto tablet = DependencyManager::get<TabletScriptingInterface>()->getTablet(SYSTEM_TABLET);
5770 auto tabletScriptingInterface = DependencyManager::get<TabletScriptingInterface>();5770 bool onTablet = false;
5771 auto tablet = dynamic_cast<TabletProxy*>(tabletScriptingInterface->getTablet(SYSTEM_TABLET));
5772 5771
5773 if (tablet->getToolbarMode() || false == scriptsRunning) {5772 if (!tablet->getToolbarMode() && (hmd->getShouldShowTablet() || isHMDMode())) {
5774 static const QUrl url("hifi/dialogs/RunningScripts.qml");5773 onTablet = tablet->pushOntoStack(tabletUrl);
5775 DependencyManager::get<OffscreenUi>()->show(url, "RunningScripts");5774 }
5776 } else {5775
5777 auto hmd = DependencyManager::get<HMDScriptingInterface>();5776 if (!onTablet) {
5778 if (!hmd->getShouldShowTablet() && !isHMDMode()) {5777 DependencyManager::get<OffscreenUi>()->show(widgetUrl, title);
5779 static const QUrl url("hifi/dialogs/RunningScripts.qml");
5780 DependencyManager::get<OffscreenUi>()->show(url, "RunningScripts");
5781 } else {
5782 static const QUrl url("../../hifi/dialogs/TabletRunningScripts.qml");
5783 tablet->pushOntoStack(url);
5784 }
5785 }5778 }
5786 //DependencyManager::get<OffscreenUi>()->show(url, "RunningScripts");5779}
5787 //if (_runningScriptsWidget->isVisible()) {5780
5788 // if (_runningScriptsWidget->hasFocus()) {5781void Application::toggleMenuRunningScripts() const {
5789 // _runningScriptsWidget->hide();5782 static const QString title("RunningScripts");
5790 // } else {5783 static const QUrl widgetUrl("hifi/dialogs/RunningScripts.qml");
5791 // _runningScriptsWidget->raise();5784 static const QUrl tabletUrl("../../hifi/dialogs/TabletRunningScripts.qml");
5792 // setActiveWindow(_runningScriptsWidget);5785 toggleMenu(title, widgetUrl, tabletUrl);
5793 // _runningScriptsWidget->setFocus();
5794 // }
5795 //} else {
5796 // _runningScriptsWidget->show();
5797 // _runningScriptsWidget->setFocus();
5798 //}
5799}5786}
5800 5787
5801void Application::showScriptLogs() {5788void Application::showScriptLogs() {