mirror of
https://github.com/Armored-Dragon/overte.git
synced 2025-03-11 16:13:16 +01:00
51 lines
1.3 KiB
C++
51 lines
1.3 KiB
C++
//
|
|
// LeapMotionProvider.cpp
|
|
//
|
|
// Created by David Rowe on 15 Jun 2017.
|
|
// Copyright 2017 High Fidelity, Inc.
|
|
//
|
|
// Distributed under the Apache License, Version 2.0.
|
|
// See the accompanying file LICENSE or http://www.apache.org/licenses/LICENSE-2.0.html
|
|
//
|
|
|
|
#include <mutex>
|
|
|
|
#include <QtCore/QObject>
|
|
#include <QtCore/QtPlugin>
|
|
#include <QtCore/QStringList>
|
|
|
|
#include <plugins/RuntimePlugin.h>
|
|
#include <plugins/InputPlugin.h>
|
|
|
|
#include "LeapMotionPlugin.h"
|
|
|
|
class LeapMotionProvider : public QObject, public InputProvider
|
|
{
|
|
Q_OBJECT
|
|
Q_PLUGIN_METADATA(IID InputProvider_iid FILE "plugin.json")
|
|
Q_INTERFACES(InputProvider)
|
|
|
|
public:
|
|
LeapMotionProvider(QObject* parent = nullptr) : QObject(parent) {}
|
|
virtual ~LeapMotionProvider() {}
|
|
|
|
virtual InputPluginList getInputPlugins() override {
|
|
static std::once_flag once;
|
|
std::call_once(once, [&] {
|
|
InputPluginPointer plugin(new LeapMotionPlugin());
|
|
if (plugin->isSupported()) {
|
|
_inputPlugins.push_back(plugin);
|
|
}
|
|
});
|
|
return _inputPlugins;
|
|
}
|
|
|
|
virtual void destroyInputPlugins() override {
|
|
_inputPlugins.clear();
|
|
}
|
|
|
|
private:
|
|
InputPluginList _inputPlugins;
|
|
};
|
|
|
|
#include "LeapMotionProvider.moc"
|