mirror of
https://github.com/overte-org/overte.git
synced 2025-08-04 07:43:35 +02:00
Remove input plugin menu dependency
This commit is contained in:
parent
6f75fab298
commit
24bbb8db3f
3 changed files with 17 additions and 22 deletions
|
@ -198,7 +198,6 @@ static const float PHYSICS_READY_RANGE = 3.0f; // how far from avatar to check f
|
||||||
|
|
||||||
static const QString DESKTOP_LOCATION = QStandardPaths::writableLocation(QStandardPaths::DesktopLocation);
|
static const QString DESKTOP_LOCATION = QStandardPaths::writableLocation(QStandardPaths::DesktopLocation);
|
||||||
|
|
||||||
static const QString INPUT_DEVICE_MENU_PREFIX = "Device: ";
|
|
||||||
Setting::Handle<int> maxOctreePacketsPerSecond("maxOctreePPS", DEFAULT_MAX_OCTREE_PPS);
|
Setting::Handle<int> maxOctreePacketsPerSecond("maxOctreePPS", DEFAULT_MAX_OCTREE_PPS);
|
||||||
|
|
||||||
const QHash<QString, Application::AcceptURLMethod> Application::_acceptedExtensions {
|
const QHash<QString, Application::AcceptURLMethod> Application::_acceptedExtensions {
|
||||||
|
@ -1000,7 +999,7 @@ Application::Application(int& argc, char** argv, QElapsedTimer& startupTimer) :
|
||||||
RenderableWebEntityItem* webEntity = dynamic_cast<RenderableWebEntityItem*>(entity.get());
|
RenderableWebEntityItem* webEntity = dynamic_cast<RenderableWebEntityItem*>(entity.get());
|
||||||
if (webEntity) {
|
if (webEntity) {
|
||||||
webEntity->setProxyWindow(_window->windowHandle());
|
webEntity->setProxyWindow(_window->windowHandle());
|
||||||
if (Menu::getInstance()->isOptionChecked(INPUT_DEVICE_MENU_PREFIX + KeyboardMouseDevice::NAME)) {
|
if (_keyboardMouseDevice->isActive()) {
|
||||||
_keyboardMouseDevice->pluginFocusOutEvent();
|
_keyboardMouseDevice->pluginFocusOutEvent();
|
||||||
}
|
}
|
||||||
_keyboardFocusedItem = entityItemID;
|
_keyboardFocusedItem = entityItemID;
|
||||||
|
@ -1153,9 +1152,7 @@ void Application::aboutToQuit() {
|
||||||
emit beforeAboutToQuit();
|
emit beforeAboutToQuit();
|
||||||
|
|
||||||
foreach(auto inputPlugin, PluginManager::getInstance()->getInputPlugins()) {
|
foreach(auto inputPlugin, PluginManager::getInstance()->getInputPlugins()) {
|
||||||
QString name = INPUT_DEVICE_MENU_PREFIX + inputPlugin->getName();
|
if (inputPlugin->isActive()) {
|
||||||
QAction* action = Menu::getInstance()->getActionForOption(name);
|
|
||||||
if (action->isChecked()) {
|
|
||||||
inputPlugin->deactivate();
|
inputPlugin->deactivate();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -2024,7 +2021,7 @@ void Application::keyPressEvent(QKeyEvent* event) {
|
||||||
}
|
}
|
||||||
|
|
||||||
if (hasFocus()) {
|
if (hasFocus()) {
|
||||||
if (Menu::getInstance()->isOptionChecked(INPUT_DEVICE_MENU_PREFIX + KeyboardMouseDevice::NAME)) {
|
if (_keyboardMouseDevice->isActive()) {
|
||||||
_keyboardMouseDevice->keyPressEvent(event);
|
_keyboardMouseDevice->keyPressEvent(event);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -2358,7 +2355,7 @@ void Application::keyReleaseEvent(QKeyEvent* event) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (Menu::getInstance()->isOptionChecked(INPUT_DEVICE_MENU_PREFIX + KeyboardMouseDevice::NAME)) {
|
if (_keyboardMouseDevice->isActive()) {
|
||||||
_keyboardMouseDevice->keyReleaseEvent(event);
|
_keyboardMouseDevice->keyReleaseEvent(event);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -2390,9 +2387,7 @@ void Application::keyReleaseEvent(QKeyEvent* event) {
|
||||||
void Application::focusOutEvent(QFocusEvent* event) {
|
void Application::focusOutEvent(QFocusEvent* event) {
|
||||||
auto inputPlugins = PluginManager::getInstance()->getInputPlugins();
|
auto inputPlugins = PluginManager::getInstance()->getInputPlugins();
|
||||||
foreach(auto inputPlugin, inputPlugins) {
|
foreach(auto inputPlugin, inputPlugins) {
|
||||||
QString name = INPUT_DEVICE_MENU_PREFIX + inputPlugin->getName();
|
if (inputPlugin->isActive()) {
|
||||||
QAction* action = Menu::getInstance()->getActionForOption(name);
|
|
||||||
if (action && action->isChecked()) {
|
|
||||||
inputPlugin->pluginFocusOutEvent();
|
inputPlugin->pluginFocusOutEvent();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -2477,7 +2472,7 @@ void Application::mouseMoveEvent(QMouseEvent* event) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (Menu::getInstance()->isOptionChecked(INPUT_DEVICE_MENU_PREFIX + KeyboardMouseDevice::NAME)) {
|
if (_keyboardMouseDevice->isActive()) {
|
||||||
_keyboardMouseDevice->mouseMoveEvent(event);
|
_keyboardMouseDevice->mouseMoveEvent(event);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -2514,7 +2509,7 @@ void Application::mousePressEvent(QMouseEvent* event) {
|
||||||
|
|
||||||
|
|
||||||
if (hasFocus()) {
|
if (hasFocus()) {
|
||||||
if (Menu::getInstance()->isOptionChecked(INPUT_DEVICE_MENU_PREFIX + KeyboardMouseDevice::NAME)) {
|
if (_keyboardMouseDevice->isActive()) {
|
||||||
_keyboardMouseDevice->mousePressEvent(event);
|
_keyboardMouseDevice->mousePressEvent(event);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -2559,7 +2554,7 @@ void Application::mouseReleaseEvent(QMouseEvent* event) {
|
||||||
}
|
}
|
||||||
|
|
||||||
if (hasFocus()) {
|
if (hasFocus()) {
|
||||||
if (Menu::getInstance()->isOptionChecked(INPUT_DEVICE_MENU_PREFIX + KeyboardMouseDevice::NAME)) {
|
if (_keyboardMouseDevice->isActive()) {
|
||||||
_keyboardMouseDevice->mouseReleaseEvent(event);
|
_keyboardMouseDevice->mouseReleaseEvent(event);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -2586,7 +2581,7 @@ void Application::touchUpdateEvent(QTouchEvent* event) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (Menu::getInstance()->isOptionChecked(INPUT_DEVICE_MENU_PREFIX + KeyboardMouseDevice::NAME)) {
|
if (_keyboardMouseDevice->isActive()) {
|
||||||
_keyboardMouseDevice->touchUpdateEvent(event);
|
_keyboardMouseDevice->touchUpdateEvent(event);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -2604,7 +2599,7 @@ void Application::touchBeginEvent(QTouchEvent* event) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (Menu::getInstance()->isOptionChecked(INPUT_DEVICE_MENU_PREFIX + KeyboardMouseDevice::NAME)) {
|
if (_keyboardMouseDevice->isActive()) {
|
||||||
_keyboardMouseDevice->touchBeginEvent(event);
|
_keyboardMouseDevice->touchBeginEvent(event);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -2621,7 +2616,7 @@ void Application::touchEndEvent(QTouchEvent* event) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (Menu::getInstance()->isOptionChecked(INPUT_DEVICE_MENU_PREFIX + KeyboardMouseDevice::NAME)) {
|
if (_keyboardMouseDevice->isActive()) {
|
||||||
_keyboardMouseDevice->touchEndEvent(event);
|
_keyboardMouseDevice->touchEndEvent(event);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -2637,7 +2632,7 @@ void Application::wheelEvent(QWheelEvent* event) const {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (Menu::getInstance()->isOptionChecked(INPUT_DEVICE_MENU_PREFIX + KeyboardMouseDevice::NAME)) {
|
if (_keyboardMouseDevice->isActive()) {
|
||||||
_keyboardMouseDevice->wheelEvent(event);
|
_keyboardMouseDevice->wheelEvent(event);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -2770,9 +2765,7 @@ void Application::idle(float nsecsElapsed) {
|
||||||
getActiveDisplayPlugin()->idle();
|
getActiveDisplayPlugin()->idle();
|
||||||
auto inputPlugins = PluginManager::getInstance()->getInputPlugins();
|
auto inputPlugins = PluginManager::getInstance()->getInputPlugins();
|
||||||
foreach(auto inputPlugin, inputPlugins) {
|
foreach(auto inputPlugin, inputPlugins) {
|
||||||
QString name = INPUT_DEVICE_MENU_PREFIX + inputPlugin->getName();
|
if (inputPlugin->isActive()) {
|
||||||
QAction* action = Menu::getInstance()->getActionForOption(name);
|
|
||||||
if (action && action->isChecked()) {
|
|
||||||
inputPlugin->idle();
|
inputPlugin->idle();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -25,7 +25,6 @@ InputPluginList getInputPlugins() {
|
||||||
for (int i = 0; PLUGIN_POOL[i]; ++i) {
|
for (int i = 0; PLUGIN_POOL[i]; ++i) {
|
||||||
InputPlugin* plugin = PLUGIN_POOL[i];
|
InputPlugin* plugin = PLUGIN_POOL[i];
|
||||||
if (plugin->isSupported()) {
|
if (plugin->isSupported()) {
|
||||||
plugin->init();
|
|
||||||
result.push_back(InputPluginPointer(plugin));
|
result.push_back(InputPluginPointer(plugin));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -164,15 +164,18 @@ const InputPluginList& PluginManager::getInputPlugins() {
|
||||||
InputProvider* inputProvider = qobject_cast<InputProvider*>(loader->instance());
|
InputProvider* inputProvider = qobject_cast<InputProvider*>(loader->instance());
|
||||||
if (inputProvider) {
|
if (inputProvider) {
|
||||||
for (auto inputPlugin : inputProvider->getInputPlugins()) {
|
for (auto inputPlugin : inputProvider->getInputPlugins()) {
|
||||||
|
if (inputPlugin->isSupported()) {
|
||||||
inputPlugins.push_back(inputPlugin);
|
inputPlugins.push_back(inputPlugin);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
auto& container = PluginContainer::getInstance();
|
auto& container = PluginContainer::getInstance();
|
||||||
for (auto plugin : inputPlugins) {
|
for (auto plugin : inputPlugins) {
|
||||||
plugin->setContainer(&container);
|
plugin->setContainer(&container);
|
||||||
plugin->init();
|
plugin->init();
|
||||||
|
plugin->activate();
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
return inputPlugins;
|
return inputPlugins;
|
||||||
|
|
Loading…
Reference in a new issue