load/save of the mouse absolutecoordinate option

This commit is contained in:
Gergely Mincsovics
2020-12-27 03:19:20 +01:00
parent beb8d06191
commit 1c55328bf8
2 changed files with 23 additions and 4 deletions

View File

@ -13,7 +13,9 @@ Axis::Axis( int i, QObject *parent ) : QObject(parent) {
isOn = false;
isDown = false;
state = 0;
interpretation = ZeroOne;
gradient = false;
absolute = false;
toDefault();
tick = 0;
}
@ -117,8 +119,20 @@ bool Axis::read( QTextStream &stream ) {
else return false;
}
//the rest of the options are keywords without integers
else if (*it == "gradient") {
else if (*it == "zeroone") {
interpretation = ZeroOne;
gradient = false;
absolute = false;
}
else if (*it == "absolute") {
interpretation = Absolute2; // to avoid name collision with a #define Absolute
gradient = true;
absolute = true;
}
else if (*it == "gradient") {
interpretation = Gradient;
gradient = true;
absolute = false;
}
else if (*it == "throttle+") {
throttle = 1;
@ -157,7 +171,8 @@ void Axis::timerCalled() {
void Axis::write( QTextStream &stream ) {
stream << "\tAxis " << (index+1) << ": ";
if (gradient) stream << "gradient, ";
stream << ((interpretation == ZeroOne)?"ZeroOne":
(interpretation == Gradient)?"Gradient":"Absolute") << ", ";
if (throttle > 0) stream << "throttle+, ";
else if (throttle < 0) stream << "throttle-, ";
if (dZone != DZONE) stream << "dZone " << dZone << ", ";
@ -235,7 +250,9 @@ void Axis::jsevent( int value ) {
void Axis::toDefault() {
release();
interpretation = ZeroOne;
gradient = false;
absolute = false;
throttle = 0;
maxSpeed = 100;
transferCurve = Quadratic;
@ -254,7 +271,9 @@ void Axis::toDefault() {
}
bool Axis::isDefault() {
return (gradient == false) &&
return (interpretation == ZeroOne) &&
(gradient == false) &&
(absolute == false) &&
(throttle == 0) &&
(maxSpeed == 100) &&
(dZone == DZONE) &&

View File

@ -22,7 +22,7 @@ class Axis : public QObject {
Q_OBJECT
//each axis can create a key press or move the mouse in one of four directions.
enum Interpretation { ZeroOne, Gradient, Absolute };
enum Interpretation { ZeroOne, Gradient, Absolute, Absolute2 = Absolute };
enum Mode {Keyboard, MousePosVert, MouseNegVert, MousePosHor, MouseNegHor};
enum TransferCurve {Linear, Quadratic, Cubic, QuadraticExtreme,
PowerFunction};