xbmc
JoystickMapper.h
1 /*
2  * Copyright (C) 2017-2018 Team Kodi
3  * This file is part of Kodi - https://kodi.tv
4  *
5  * SPDX-License-Identifier: GPL-2.0-or-later
6  * See LICENSES/README.md for more information.
7  */
8 
9 #pragma once
10 
11 #include "IButtonMapper.h"
13 
14 #include <map>
15 #include <memory>
16 #include <set>
17 #include <string>
18 #include <vector>
19 
20 class IWindowKeymap;
21 
22 namespace tinyxml2
23 {
24 class XMLElement;
25 class XMLNode;
26 } // namespace tinyxml2
27 
29 {
30 public:
31  CJoystickMapper() = default;
32  ~CJoystickMapper() override = default;
33 
34  // implementation of IButtonMapper
35  void MapActions(int windowID, const tinyxml2::XMLNode* pDevice) override;
36  void Clear() override;
37 
38  std::vector<std::shared_ptr<const IWindowKeymap>> GetJoystickKeymaps() const;
39 
40 private:
41  void DeserializeJoystickNode(const tinyxml2::XMLNode* pDevice, std::string& controllerId);
42  bool DeserializeButton(const tinyxml2::XMLElement* pButton,
43  std::string& feature,
44  KODI::JOYSTICK::ANALOG_STICK_DIRECTION& dir,
45  unsigned int& holdtimeMs,
46  std::set<std::string>& hotkeys,
47  std::string& actionStr);
48 
49  using ControllerID = std::string;
50  std::map<ControllerID, std::shared_ptr<IWindowKeymap>> m_joystickKeymaps;
51 
52  std::vector<std::string> m_controllerIds;
53 };
Interface for classes that can map buttons to Kodi actions.
Definition: IButtonMapper.h:19
Definition: SkinTimerManager.h:18
Definition: JoystickMapper.h:28
Interface for mapping buttons to Kodi actions for specific windows.
Definition: IKeymap.h:54