load/save of the mouse absolutecoordinate option
This commit is contained in:
25
src/axis.cpp
25
src/axis.cpp
@ -13,7 +13,9 @@ Axis::Axis( int i, QObject *parent ) : QObject(parent) {
|
|||||||
isOn = false;
|
isOn = false;
|
||||||
isDown = false;
|
isDown = false;
|
||||||
state = 0;
|
state = 0;
|
||||||
|
interpretation = ZeroOne;
|
||||||
gradient = false;
|
gradient = false;
|
||||||
|
absolute = false;
|
||||||
toDefault();
|
toDefault();
|
||||||
tick = 0;
|
tick = 0;
|
||||||
}
|
}
|
||||||
@ -117,8 +119,20 @@ bool Axis::read( QTextStream &stream ) {
|
|||||||
else return false;
|
else return false;
|
||||||
}
|
}
|
||||||
//the rest of the options are keywords without integers
|
//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;
|
gradient = true;
|
||||||
|
absolute = true;
|
||||||
|
}
|
||||||
|
else if (*it == "gradient") {
|
||||||
|
interpretation = Gradient;
|
||||||
|
gradient = true;
|
||||||
|
absolute = false;
|
||||||
}
|
}
|
||||||
else if (*it == "throttle+") {
|
else if (*it == "throttle+") {
|
||||||
throttle = 1;
|
throttle = 1;
|
||||||
@ -157,7 +171,8 @@ void Axis::timerCalled() {
|
|||||||
|
|
||||||
void Axis::write( QTextStream &stream ) {
|
void Axis::write( QTextStream &stream ) {
|
||||||
stream << "\tAxis " << (index+1) << ": ";
|
stream << "\tAxis " << (index+1) << ": ";
|
||||||
if (gradient) stream << "gradient, ";
|
stream << ((interpretation == ZeroOne)?"ZeroOne":
|
||||||
|
(interpretation == Gradient)?"Gradient":"Absolute") << ", ";
|
||||||
if (throttle > 0) stream << "throttle+, ";
|
if (throttle > 0) stream << "throttle+, ";
|
||||||
else if (throttle < 0) stream << "throttle-, ";
|
else if (throttle < 0) stream << "throttle-, ";
|
||||||
if (dZone != DZONE) stream << "dZone " << dZone << ", ";
|
if (dZone != DZONE) stream << "dZone " << dZone << ", ";
|
||||||
@ -235,7 +250,9 @@ void Axis::jsevent( int value ) {
|
|||||||
|
|
||||||
void Axis::toDefault() {
|
void Axis::toDefault() {
|
||||||
release();
|
release();
|
||||||
|
interpretation = ZeroOne;
|
||||||
gradient = false;
|
gradient = false;
|
||||||
|
absolute = false;
|
||||||
throttle = 0;
|
throttle = 0;
|
||||||
maxSpeed = 100;
|
maxSpeed = 100;
|
||||||
transferCurve = Quadratic;
|
transferCurve = Quadratic;
|
||||||
@ -254,7 +271,9 @@ void Axis::toDefault() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
bool Axis::isDefault() {
|
bool Axis::isDefault() {
|
||||||
return (gradient == false) &&
|
return (interpretation == ZeroOne) &&
|
||||||
|
(gradient == false) &&
|
||||||
|
(absolute == false) &&
|
||||||
(throttle == 0) &&
|
(throttle == 0) &&
|
||||||
(maxSpeed == 100) &&
|
(maxSpeed == 100) &&
|
||||||
(dZone == DZONE) &&
|
(dZone == DZONE) &&
|
||||||
|
@ -22,7 +22,7 @@ class Axis : public QObject {
|
|||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
|
|
||||||
//each axis can create a key press or move the mouse in one of four directions.
|
//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 Mode {Keyboard, MousePosVert, MouseNegVert, MousePosHor, MouseNegHor};
|
||||||
enum TransferCurve {Linear, Quadratic, Cubic, QuadraticExtreme,
|
enum TransferCurve {Linear, Quadratic, Cubic, QuadraticExtreme,
|
||||||
PowerFunction};
|
PowerFunction};
|
||||||
|
Reference in New Issue
Block a user