mirror of
https://github.com/AleziaKurdis/overte.git
synced 2025-04-08 23:12:16 +02:00
Merge pull request #6330 from Atlante45/master
// FIXME incredibly evil....
This commit is contained in:
commit
1dc392bb36
7 changed files with 24 additions and 25 deletions
|
@ -1027,10 +1027,7 @@ void Application::initializeUi() {
|
|||
foreach(auto inputPlugin, PluginManager::getInstance()->getInputPlugins()) {
|
||||
QString name = inputPlugin->getName();
|
||||
if (name == KeyboardMouseDevice::NAME) {
|
||||
auto kbm = static_cast<KeyboardMouseDevice*>(inputPlugin.data());
|
||||
// FIXME incredibly evil.... _keyboardMouseDevice is now owned by
|
||||
// both a QSharedPointer and a std::shared_ptr
|
||||
_keyboardMouseDevice = std::shared_ptr<KeyboardMouseDevice>(kbm);
|
||||
_keyboardMouseDevice = std::dynamic_pointer_cast<KeyboardMouseDevice>(inputPlugin);
|
||||
}
|
||||
}
|
||||
updateInputModes();
|
||||
|
@ -4645,7 +4642,7 @@ DisplayPlugin* Application::getActiveDisplayPlugin() {
|
|||
updateDisplayMode();
|
||||
Q_ASSERT(_displayPlugin);
|
||||
}
|
||||
return _displayPlugin.data();
|
||||
return _displayPlugin.get();
|
||||
}
|
||||
|
||||
const DisplayPlugin* Application::getActiveDisplayPlugin() const {
|
||||
|
@ -4685,10 +4682,10 @@ void Application::updateDisplayMode() {
|
|||
bool first = true;
|
||||
foreach(auto displayPlugin, displayPlugins) {
|
||||
addDisplayPluginToMenu(displayPlugin, first);
|
||||
QObject::connect(displayPlugin.data(), &DisplayPlugin::requestRender, [this] {
|
||||
QObject::connect(displayPlugin.get(), &DisplayPlugin::requestRender, [this] {
|
||||
paintGL();
|
||||
});
|
||||
QObject::connect(displayPlugin.data(), &DisplayPlugin::recommendedFramebufferSizeChanged, [this](const QSize & size) {
|
||||
QObject::connect(displayPlugin.get(), &DisplayPlugin::recommendedFramebufferSizeChanged, [this](const QSize & size) {
|
||||
resizeGL();
|
||||
});
|
||||
|
||||
|
@ -4814,12 +4811,14 @@ void Application::updateInputModes() {
|
|||
foreach(auto inputPlugin, inputPlugins) {
|
||||
QString name = inputPlugin->getName();
|
||||
QAction* action = menu->getActionForOption(name);
|
||||
if (action->isChecked() && !_activeInputPlugins.contains(inputPlugin)) {
|
||||
_activeInputPlugins.append(inputPlugin);
|
||||
newInputPlugins.append(inputPlugin);
|
||||
} else if (!action->isChecked() && _activeInputPlugins.contains(inputPlugin)) {
|
||||
_activeInputPlugins.removeOne(inputPlugin);
|
||||
removedInputPlugins.append(inputPlugin);
|
||||
|
||||
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);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -206,7 +206,7 @@ namespace controller {
|
|||
void ScriptingInterface::updateMaps() {
|
||||
QVariantMap newHardware;
|
||||
auto userInputMapper = DependencyManager::get<controller::UserInputMapper>();
|
||||
auto devices = userInputMapper->getDevices();
|
||||
const auto& devices = userInputMapper->getDevices();
|
||||
for (const auto& deviceMapping : devices) {
|
||||
auto deviceID = deviceMapping.first;
|
||||
if (deviceID != userInputMapper->getStandardDeviceID()) {
|
||||
|
|
|
@ -100,7 +100,7 @@ namespace controller {
|
|||
void setSensorToWorldMat(glm::mat4 sensorToWorldMat) { _sensorToWorldMat = sensorToWorldMat; }
|
||||
glm::mat4 getSensorToWorldMat() { return _sensorToWorldMat; }
|
||||
|
||||
DevicesMap getDevices() { return _registeredDevices; }
|
||||
const DevicesMap& getDevices() { return _registeredDevices; }
|
||||
uint16 getStandardDeviceID() const { return STANDARD_DEVICE; }
|
||||
InputDevice::Pointer getStandardDevice() { return _registeredDevices[getStandardDeviceID()]; }
|
||||
|
||||
|
|
|
@ -29,7 +29,7 @@ InputPluginList getInputPlugins() {
|
|||
|
||||
InputPluginList result;
|
||||
for (int i = 0; PLUGIN_POOL[i]; ++i) {
|
||||
InputPlugin * plugin = PLUGIN_POOL[i];
|
||||
InputPlugin* plugin = PLUGIN_POOL[i];
|
||||
if (plugin->isSupported()) {
|
||||
plugin->init();
|
||||
result.push_back(InputPluginPointer(plugin));
|
||||
|
|
|
@ -7,9 +7,8 @@
|
|||
//
|
||||
#pragma once
|
||||
|
||||
#include <QList>
|
||||
#include <QVector>
|
||||
#include <QSharedPointer>
|
||||
#include <vector>
|
||||
#include <memory>
|
||||
|
||||
class DisplayPlugin;
|
||||
class InputPlugin;
|
||||
|
@ -17,8 +16,8 @@ class Plugin;
|
|||
class PluginContainer;
|
||||
class PluginManager;
|
||||
|
||||
using DisplayPluginPointer = QSharedPointer<DisplayPlugin>;
|
||||
using DisplayPluginList = QVector<DisplayPluginPointer>;
|
||||
using InputPluginPointer = QSharedPointer<InputPlugin>;
|
||||
using InputPluginList = QVector<InputPluginPointer>;
|
||||
using DisplayPluginPointer = std::shared_ptr<DisplayPlugin>;
|
||||
using DisplayPluginList = std::vector<DisplayPluginPointer>;
|
||||
using InputPluginPointer = std::shared_ptr<InputPlugin>;
|
||||
using InputPluginList = std::vector<InputPluginPointer>;
|
||||
|
||||
|
|
|
@ -7,6 +7,8 @@
|
|||
//
|
||||
#pragma once
|
||||
|
||||
#include <QObject>
|
||||
|
||||
#include "Forward.h"
|
||||
|
||||
class PluginManager : public QObject {
|
||||
|
|
|
@ -132,8 +132,7 @@ int main(int argc, char** argv) {
|
|||
inputPlugin->activate();
|
||||
auto userInputMapper = DependencyManager::get<controller::UserInputMapper>();
|
||||
if (name == KeyboardMouseDevice::NAME) {
|
||||
auto keyboardMouseDevice = static_cast<KeyboardMouseDevice*>(inputPlugin.data()); // TODO: this seems super hacky
|
||||
userInputMapper->registerDevice(std::shared_ptr<InputDevice>(keyboardMouseDevice));
|
||||
userInputMapper->registerDevice(std::dynamic_pointer_cast<KeyboardMouseDevice>(inputPlugin));
|
||||
}
|
||||
inputPlugin->pluginUpdate(0, false);
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue