summaryrefslogtreecommitdiff
path: root/src/gamefeaturesproxy.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/gamefeaturesproxy.cpp')
-rw-r--r--src/gamefeaturesproxy.cpp48
1 files changed, 48 insertions, 0 deletions
diff --git a/src/gamefeaturesproxy.cpp b/src/gamefeaturesproxy.cpp
new file mode 100644
index 00000000..3adac353
--- /dev/null
+++ b/src/gamefeaturesproxy.cpp
@@ -0,0 +1,48 @@
+#include "gamefeaturesproxy.h"
+
+#include "game_features.h"
+#include "organizerproxy.h"
+
+GameFeaturesProxy::GameFeaturesProxy(OrganizerProxy* coreProxy,
+ GameFeatures& gameFeatures)
+ : m_CoreProxy(*coreProxy), m_Features(gameFeatures)
+{}
+
+bool GameFeaturesProxy::registerFeature(QStringList const& games,
+ std::shared_ptr<MOBase::GameFeature> feature,
+ int priority, bool replace)
+{
+ if (replace) {
+ m_Features.unregisterGameFeatures(m_CoreProxy.plugin(), feature->typeInfo());
+ }
+ return m_Features.registerGameFeature(m_CoreProxy.plugin(), games, feature, priority);
+}
+
+bool GameFeaturesProxy::registerFeature(MOBase::IPluginGame* game,
+ std::shared_ptr<MOBase::GameFeature> feature,
+ int priority, bool replace)
+{
+ return registerFeature({game->gameName()}, feature, priority, replace);
+}
+
+bool GameFeaturesProxy::registerFeature(std::shared_ptr<MOBase::GameFeature> feature,
+ int priority, bool replace)
+{
+ return registerFeature({}, feature, priority, replace);
+}
+
+bool GameFeaturesProxy::unregisterFeature(std::shared_ptr<MOBase::GameFeature> feature)
+{
+ return m_Features.unregisterGameFeature(feature);
+}
+
+std::shared_ptr<MOBase::GameFeature>
+GameFeaturesProxy::gameFeatureImpl(std::type_info const& info) const
+{
+ return m_Features.gameFeature(info);
+}
+
+int GameFeaturesProxy::unregisterFeaturesImpl(std::type_info const& info)
+{
+ return m_Features.unregisterGameFeatures(m_CoreProxy.plugin(), info);
+}