From 8ed5c071f577cc90a93c6077545cf25b1ad62ee3 Mon Sep 17 00:00:00 2001 From: Stanislaw Halik Date: Sat, 25 Mar 2017 09:22:51 +0100 Subject: logic/mappings: move from header --- logic/mappings.cpp | 37 +++++++++++++++++++++++++++++++++++++ 1 file changed, 37 insertions(+) create mode 100644 logic/mappings.cpp (limited to 'logic/mappings.cpp') diff --git a/logic/mappings.cpp b/logic/mappings.cpp new file mode 100644 index 00000000..115e9083 --- /dev/null +++ b/logic/mappings.cpp @@ -0,0 +1,37 @@ +#pragma once + +#include "mappings.hpp" + +Map::Map(QString primary, QString secondary, int max_x, int max_y, axis_opts& opts) : + opts(opts), + name1(primary), + name2(secondary), + spline_main(max_x, max_y, primary), + spline_alt(max_x, max_y, secondary) +{ + spline_main.set_max_input(opts.clamp); + spline_alt.set_max_input(opts.clamp); +} + +void Map::save(QSettings& s) +{ + spline_main.save(s); + spline_alt.save(s); +} + +void Map::load() +{ + spline_main.reload(); + spline_alt.reload(); +} + +Mappings::Mappings(std::vector opts) : + axes { + Map("spline-X", "alt-spline-X", 30, 75, *opts[TX]), + Map("spline-Y", "alt-spline-Y", 30, 75, *opts[TY]), + Map("spline-Z", "alt-spline-Z", 30, 75, *opts[TZ]), + Map("spline-yaw", "alt-spline-yaw", 180, 180, *opts[Yaw]), + Map("spline-pitch", "alt-spline-pitch", 180, 180, *opts[Pitch]), + Map("spline-roll", "alt-spline-roll", 180, 180, *opts[Roll]) + } +{} -- cgit v1.2.3