Showing the changes to interface/src/scripting/ControllerScriptingInterface.cpp (1 of 2 files). Show all
Unified · Split
| @@ -46,32 +46,36 @@ QScriptValue inputToScriptValue(QScriptEngine* engine, const UserInputMapper::In · 45 unmodified lines | |||
| 46 | QScriptValue obj = engine->newObject(); | 46 | QScriptValue obj = engine->newObject(); |
| 47 | obj.setProperty("device", input.getDevice()); | 47 | obj.setProperty("device", input.getDevice()); |
| 48 | obj.setProperty("channel", input.getChannel()); | 48 | obj.setProperty("channel", input.getChannel()); |
| 49 | obj.setProperty("type", input._type); | 49 | obj.setProperty("type", (unsigned short) input.getType()); |
| 50 | obj.setProperty("id", input.getID()); | 50 | obj.setProperty("id", input.getID()); |
| 51 | return obj; | 51 | return obj; |
| 52 | } | 52 | } |
| 53 | 53 | ||
| 54 | void inputFromScriptValue(const QScriptValue& object, UserInputMapper::Input& input) { | 54 | void inputFromScriptValue(const QScriptValue& object, UserInputMapper::Input& input) { |
| 55 | input._device = object.property("device").toUInt16(); | 55 | input.setDevice(object.property("device").toUInt16()); |
| 56 | input._channel = object.property("channel").toUInt16(); | 56 | input.setChannel(object.property("channel").toUInt16()); |
| 57 | input._type = object.property("type").toUInt16(); | 57 | input.setType(object.property("type").toUInt16()); |
| 58 | input._id = object.property("id").toInt32(); | 58 | input.setID(object.property("id").toInt32()); |
| 59 | } | 59 | } |
| 60 | 60 | ||
| 61 | QScriptValue inputChannelToScriptValue(QScriptEngine* engine, const UserInputMapper::InputChannel& inputChannel) { | 61 | QScriptValue inputChannelToScriptValue(QScriptEngine* engine, const UserInputMapper::InputChannel& inputChannel) { |
| 62 | QScriptValue obj = engine->newObject(); | 62 | QScriptValue obj = engine->newObject(); |
| 63 | obj.setProperty("input", inputToScriptValue(engine, inputChannel._input)); | 63 | obj.setProperty("input", inputToScriptValue(engine, inputChannel.getInput())); |
| 64 | obj.setProperty("modifier", inputToScriptValue(engine, inputChannel._modifier)); | 64 | obj.setProperty("modifier", inputToScriptValue(engine, inputChannel.getModifier())); |
| 65 | obj.setProperty("action", inputChannel._action); | 65 | obj.setProperty("action", inputChannel.getAction()); |
| 66 | obj.setProperty("scale", inputChannel._scale); | 66 | obj.setProperty("scale", inputChannel.getScale()); |
| 67 | return obj; | 67 | return obj; |
| 68 | } | 68 | } |
| 69 | 69 | ||
| 70 | void inputChannelFromScriptValue(const QScriptValue& object, UserInputMapper::InputChannel& inputChannel) { | 70 | void inputChannelFromScriptValue(const QScriptValue& object, UserInputMapper::InputChannel& inputChannel) { |
| 71 | inputFromScriptValue(object.property("input"), inputChannel._input); | 71 | UserInputMapper::Input input; |
| 72 | inputFromScriptValue(object.property("modifier"), inputChannel._modifier); | 72 | UserInputMapper::Input modifier; |
| 73 | inputChannel._action = UserInputMapper::Action(object.property("action").toVariant().toInt()); | 73 | inputFromScriptValue(object.property("input"), input); |
| 74 | inputChannel._scale = object.property("scale").toVariant().toFloat(); | 74 | inputChannel.setInput(input); |
| 75 | inputFromScriptValue(object.property("modifier"), modifier); | ||
| 76 | inputChannel.setModifier(modifier); | ||
| 77 | inputChannel.setAction(UserInputMapper::Action(object.property("action").toVariant().toInt())); | ||
| 78 | inputChannel.setScale(object.property("scale").toVariant().toFloat()); | ||
| 75 | } | 79 | } |
| 76 | 80 | ||
| 77 | QScriptValue actionToScriptValue(QScriptEngine* engine, const UserInputMapper::Action& action) { | 81 | QScriptValue actionToScriptValue(QScriptEngine* engine, const UserInputMapper::Action& action) { |