Showing the changes to interface/src/Application.cpp (1 of 30 files). Show all
Unified · Split
| @@ -1030,10 +1030,7 @@ void Application::initializeUi() { · 1029 unmodified lines | ||
| 1030 | 1030 | foreach(auto inputPlugin, PluginManager::getInstance()->getInputPlugins()) { |
| 1031 | 1031 | QString name = inputPlugin->getName(); |
| 1032 | 1032 | if (name == KeyboardMouseDevice::NAME) { |
| 1033 | − auto kbm = static_cast<KeyboardMouseDevice*>(inputPlugin.data()); | |
| 1034 | − // FIXME incredibly evil.... _keyboardMouseDevice is now owned by | |
| 1035 | − // both a QSharedPointer and a std::shared_ptr | |
| 1036 | − _keyboardMouseDevice = std::shared_ptr<KeyboardMouseDevice>(kbm); | |
| 1033 | + _keyboardMouseDevice = std::dynamic_pointer_cast<KeyboardMouseDevice>(inputPlugin); | |
| 1037 | 1034 | } |
| 1038 | 1035 | } |
| 1039 | 1036 | updateInputModes(); |
| @@ -4648,7 +4645,7 @@ DisplayPlugin* Application::getActiveDisplayPlugin() { · 3608 unmodified lines | ||
| 4648 | 4645 | updateDisplayMode(); |
| 4649 | 4646 | Q_ASSERT(_displayPlugin); |
| 4650 | 4647 | } |
| 4651 | − return _displayPlugin.data(); | |
| 4648 | + return _displayPlugin.get(); | |
| 4652 | 4649 | } |
| 4653 | 4650 | |
| 4654 | 4651 | const DisplayPlugin* Application::getActiveDisplayPlugin() const { |
| @@ -4688,10 +4685,10 @@ void Application::updateDisplayMode() { · 33 unmodified lines | ||
| 4688 | 4685 | bool first = true; |
| 4689 | 4686 | foreach(auto displayPlugin, displayPlugins) { |
| 4690 | 4687 | addDisplayPluginToMenu(displayPlugin, first); |
| 4691 | − QObject::connect(displayPlugin.data(), &DisplayPlugin::requestRender, [this] { | |
| 4688 | + QObject::connect(displayPlugin.get(), &DisplayPlugin::requestRender, [this] { | |
| 4692 | 4689 | paintGL(); |
| 4693 | 4690 | }); |
| 4694 | − QObject::connect(displayPlugin.data(), &DisplayPlugin::recommendedFramebufferSizeChanged, [this](const QSize & size) { | |
| 4691 | + QObject::connect(displayPlugin.get(), &DisplayPlugin::recommendedFramebufferSizeChanged, [this](const QSize & size) { | |
| 4695 | 4692 | resizeGL(); |
| 4696 | 4693 | }); |
| 4697 | 4694 | |
| @@ -4817,12 +4814,14 @@ void Application::updateInputModes() { · 119 unmodified lines | ||
| 4817 | 4814 | foreach(auto inputPlugin, inputPlugins) { |
| 4818 | 4815 | QString name = inputPlugin->getName(); |
| 4819 | 4816 | QAction* action = menu->getActionForOption(name); |
| 4820 | − if (action->isChecked() && !_activeInputPlugins.contains(inputPlugin)) { | |
| 4821 | − _activeInputPlugins.append(inputPlugin); | |
| 4822 | − newInputPlugins.append(inputPlugin); | |
| 4823 | − } else if (!action->isChecked() && _activeInputPlugins.contains(inputPlugin)) { | |
| 4824 | − _activeInputPlugins.removeOne(inputPlugin); | |
| 4825 | − removedInputPlugins.append(inputPlugin); | |
| 4817 | + | |
| 4818 | + auto it = std::find(std::begin(_activeInputPlugins), std::end(_activeInputPlugins), inputPlugin); | |
| 4819 | + if (action->isChecked() && it == std::end(_activeInputPlugins)) { | |
| 4820 | + _activeInputPlugins.push_back(inputPlugin); | |
| 4821 | + newInputPlugins.push_back(inputPlugin); | |
| 4822 | + } else if (!action->isChecked() && it != std::end(_activeInputPlugins)) { | |
| 4823 | + _activeInputPlugins.erase(it); | |
| 4824 | + removedInputPlugins.push_back(inputPlugin); | |
| 4826 | 4825 | } |
| 4827 | 4826 | } |
| 4828 | 4827 | |