From ee62a211ac230c93b12047b4e29b5ab75836a8c8 Mon Sep 17 00:00:00 2001 From: Atlante45 Date: Thu, 2 Jun 2016 15:36:11 -0700 Subject: [PATCH] Remove "Input Devices" menu --- interface/src/Application.cpp | 76 ----------------------------------- interface/src/Application.h | 1 - interface/src/Menu.cpp | 6 --- interface/src/Menu.h | 1 - 4 files changed, 84 deletions(-) diff --git a/interface/src/Application.cpp b/interface/src/Application.cpp index 52d9fdf64a..d41c971896 100644 --- a/interface/src/Application.cpp +++ b/interface/src/Application.cpp @@ -1477,7 +1477,6 @@ void Application::initializeUi() { } } _window->setMenuBar(new Menu()); - updateInputModes(); auto compositorHelper = DependencyManager::get(); connect(compositorHelper.data(), &CompositorHelper::allowMouseCaptureChanged, [=] { @@ -5247,81 +5246,6 @@ void Application::updateDisplayMode() { Q_ASSERT_X(_displayPlugin, "Application::updateDisplayMode", "could not find an activated display plugin"); } -static void addInputPluginToMenu(InputPluginPointer inputPlugin) { - auto menu = Menu::getInstance(); - QString name = INPUT_DEVICE_MENU_PREFIX + inputPlugin->getName(); - Q_ASSERT(!menu->menuItemExists(MenuOption::InputMenu, name)); - - static QActionGroup* inputPluginGroup = nullptr; - if (!inputPluginGroup) { - inputPluginGroup = new QActionGroup(menu); - inputPluginGroup->setExclusive(false); - } - - auto parent = menu->getMenu(MenuOption::InputMenu); - auto action = menu->addCheckableActionToQMenuAndActionHash(parent, - name, 0, true, qApp, - SLOT(updateInputModes())); - - inputPluginGroup->addAction(action); - Q_ASSERT(menu->menuItemExists(MenuOption::InputMenu, name)); -} - - -void Application::updateInputModes() { - auto menu = Menu::getInstance(); - auto inputPlugins = PluginManager::getInstance()->getInputPlugins(); - static std::once_flag once; - std::call_once(once, [&] { - foreach(auto inputPlugin, inputPlugins) { - addInputPluginToMenu(inputPlugin); - } - }); - auto offscreenUi = DependencyManager::get(); - - InputPluginList newInputPlugins; - InputPluginList removedInputPlugins; - foreach(auto inputPlugin, inputPlugins) { - QString name = INPUT_DEVICE_MENU_PREFIX + inputPlugin->getName(); - QAction* action = menu->getActionForOption(name); - - auto it = std::find(std::begin(_activeInputPlugins), std::end(_activeInputPlugins), inputPlugin); - if (action->isChecked() && it == std::end(_activeInputPlugins)) { - _activeInputPlugins.push_back(inputPlugin); - newInputPlugins.push_back(inputPlugin); - } else if (!action->isChecked() && it != std::end(_activeInputPlugins)) { - _activeInputPlugins.erase(it); - removedInputPlugins.push_back(inputPlugin); - } - } - - // A plugin was checked - if (newInputPlugins.size() > 0) { - foreach(auto newInputPlugin, newInputPlugins) { - newInputPlugin->activate(); - //newInputPlugin->installEventFilter(qApp); - //newInputPlugin->installEventFilter(offscreenUi.data()); - } - } - if (removedInputPlugins.size() > 0) { // A plugin was unchecked - foreach(auto removedInputPlugin, removedInputPlugins) { - removedInputPlugin->deactivate(); - //removedInputPlugin->removeEventFilter(qApp); - //removedInputPlugin->removeEventFilter(offscreenUi.data()); - } - } - - //if (newInputPlugins.size() > 0 || removedInputPlugins.size() > 0) { - // if (!_currentInputPluginActions.isEmpty()) { - // auto menu = Menu::getInstance(); - // foreach(auto itemInfo, _currentInputPluginActions) { - // menu->removeMenuItem(itemInfo.first, itemInfo.second); - // } - // _currentInputPluginActions.clear(); - // } - //} -} - mat4 Application::getEyeProjection(int eye) const { QMutexLocker viewLocker(&_viewMutex); if (isHMDMode()) { diff --git a/interface/src/Application.h b/interface/src/Application.h index ed7b582bfc..f93434f581 100644 --- a/interface/src/Application.h +++ b/interface/src/Application.h @@ -327,7 +327,6 @@ private slots: void nodeKilled(SharedNodePointer node); static void packetSent(quint64 length); void updateDisplayMode(); - void updateInputModes(); void domainConnectionRefused(const QString& reasonMessage, int reason); private: diff --git a/interface/src/Menu.cpp b/interface/src/Menu.cpp index a21aa71753..031564fa7a 100644 --- a/interface/src/Menu.cpp +++ b/interface/src/Menu.cpp @@ -403,12 +403,6 @@ Menu::Menu() { // Developer > Avatar >>> MenuWrapper* avatarDebugMenu = developerMenu->addMenu("Avatar"); - // Settings > Input Devices - MenuWrapper* inputModeMenu = addMenu(MenuOption::InputMenu, "Advanced"); - QActionGroup* inputModeGroup = new QActionGroup(inputModeMenu); - inputModeGroup->setExclusive(false); - - // Developer > Avatar > Face Tracking MenuWrapper* faceTrackingMenu = avatarDebugMenu->addMenu("Face Tracking"); { diff --git a/interface/src/Menu.h b/interface/src/Menu.h index fcaf8e6caa..8081e27eb8 100644 --- a/interface/src/Menu.h +++ b/interface/src/Menu.h @@ -113,7 +113,6 @@ namespace MenuOption { const QString Help = "Help..."; const QString IncreaseAvatarSize = "Increase Avatar Size"; const QString IndependentMode = "Independent Mode"; - const QString InputMenu = "Developer>Avatar>Input Devices"; const QString ActionMotorControl = "Enable Default Motor Control"; const QString LeapMotionOnHMD = "Leap Motion on HMD"; const QString LoadScript = "Open and Run Script File...";