AngleSpinBox.cpp   AngleSpinBox.cpp 
skipping to change at line 166 skipping to change at line 166
return; return;
} }
} }
formatText(); formatText();
lineEdit()->setCursorPosition(cusorPos); lineEdit()->setCursorPosition(cusorPos);
emit(valueChanged()); emit(valueChanged());
} }
QValidator::State AngleSpinBox::validate(QString& input, int& pos) const QValidator::State AngleSpinBox::validate(QString& input, int& pos) const
{ {
Q_UNUSED(pos);
QValidator::State state; QValidator::State state;
stringToDouble(input, &state); stringToDouble(input, &state);
pos = pos; // shut up the compiler
return state; return state;
} }
void AngleSpinBox::clear() void AngleSpinBox::clear()
{ {
radAngle = 0.0; radAngle = 0.0;
formatText(); formatText();
emit(valueChanged()); emit(valueChanged());
} }
skipping to change at line 212 skipping to change at line 212
{ {
sign = -1; sign = -1;
input = input.mid(negativePrefix(prefix).length()); input = input.mid(negativePrefix(prefix).length());
} }
else else
{ {
sign = 1; sign = 1;
input = input.mid(positivePrefix(prefix).length()); input = input.mid(positivePrefix(prefix).length());
} }
QRegExp dmsRx("^\\s*(\\d+)\\s*[d\\x00b0](\\s*(\\d+(\\.\\d*)?)\\s*[m' QRegExp dmsRx("^\\s*(\\d+)\\s*[d\\x00b0](\\s*(\\d+(\\.\\d*)?)\\s*[m'
](\\s*(\\d+(\\.\\d*)?)\\s*[s\"]\\s*)?)?$", Qt::CaseInsensitive); ](\\s*(\\d+(\\.\\d*)?)\\s*[s\"]\\s*)?)?$",
QRegExp hmsRx("^\\s*(\\d+)\\s*h(\\s*(\\d+(\\.\\d*)?)\\s*[m'](\\s*(\\ Qt::CaseInsensitive);
d+(\\.\\d*)?)\\s*[s\"]\\s*)?)?$", Qt::CaseInsensitive); QRegExp hmsRx("^\\s*(\\d+)\\s*h(\\s*(\\d+(\\.\\d*)?)\\s*[m'](\\s*(\\
d+(\\.\\d*)?)\\s*[s\"]\\s*)?)?$",
Qt::CaseInsensitive);
QRegExp decRx("^(\\d+(\\.\\d*)?)(\\s*[\\x00b0]\\s*)?$"); QRegExp decRx("^(\\d+(\\.\\d*)?)(\\s*[\\x00b0]\\s*)?$");
QRegExp badRx("[^hdms0-9 \\x00b0'\"\\.]", Qt::CaseInsensitive); QRegExp badRx("[^hdms0-9 \\x00b0'\"\\.]", Qt::CaseInsensitive);
QValidator::State dummy; QValidator::State dummy;
if (state == NULL) if (state == NULL)
{ {
state = &dummy; state = &dummy;
} }
if (dmsRx.exactMatch(input)) if (dmsRx.exactMatch(input))
skipping to change at line 372 skipping to change at line 374
if (s < ::pow(10, -1 * (decimalPlaces+1))) if (s < ::pow(10, -1 * (decimalPlaces+1)))
s= 0.0; s= 0.0;
else if (s < 0.0 && 0.0 - ::pow(10, -1 * (decimalPla ces+1))) else if (s < 0.0 && 0.0 - ::pow(10, -1 * (decimalPla ces+1)))
s= 0.0; s= 0.0;
QString signInd = positivePrefix(currentPrefixType); QString signInd = positivePrefix(currentPrefixType);
if (!sign) if (!sign)
signInd = negativePrefix(currentPrefixType); signInd = negativePrefix(currentPrefixType);
if (angleSpinBoxFormat == DMSLetters) if (angleSpinBoxFormat == DMSLetters)
lineEdit()->setText(QString("%1%2d %3m %4s") lineEdit()->setText(QString("%1%2d %3m %4s")
.arg(signInd).arg(d).arg(m).arg(s, 0, 'f', decimalPlaces, ' ')); .arg(signInd).arg(d).arg(m).arg(s, 0, '
f', decimalPlaces, ' '));
else else
lineEdit()->setText(QString("%1%2%3 %4' %5\" lineEdit()->setText(QString("%1%2%3 %4' %5\"
").arg(signInd).arg(d).arg(QChar(176)).arg(m).arg(s, 0, 'f', decimalPlaces, ")
' ')); .arg(signInd).arg(d).arg(QChar(176)).ar
g(m)
.arg(s, 0, 'f', decimalPlaces, ' '));
break; break;
} }
case HMSLetters: case HMSLetters:
case HMSSymbols: case HMSSymbols:
{ {
unsigned int h, m; unsigned int h, m;
double s; double s;
double angle = radAngle; double angle = radAngle;
angle = fmod(angle,2.0*M_PI); angle = fmod(angle,2.0*M_PI);
if (angle < 0.0) angle += 2.0*M_PI; // range: [0..2. 0*M_PI) if (angle < 0.0) angle += 2.0*M_PI; // range: [0..2. 0*M_PI)
skipping to change at line 411 skipping to change at line 416
m-=60; m-=60;
} }
// fix when we have tiny tiny tiny values. // fix when we have tiny tiny tiny values.
if (s < ::pow(10, -1 * (decimalPlaces+1))) if (s < ::pow(10, -1 * (decimalPlaces+1)))
s= 0.0; s= 0.0;
else if (s < 0.0 && 0.0 - ::pow(10, -1 * (decimalPla ces+1))) else if (s < 0.0 && 0.0 - ::pow(10, -1 * (decimalPla ces+1)))
s= 0.0; s= 0.0;
if (angleSpinBoxFormat == HMSLetters) if (angleSpinBoxFormat == HMSLetters)
lineEdit()->setText(QString("%1h %2m %3s").a lineEdit()->setText(QString("%1h %2m %3s")
rg(h).arg(m).arg(s, 0, 'f', decimalPlaces, ' ')); .arg(h).arg(m).arg(s, 0, 'f', decimalPl
aces, ' '));
else else
lineEdit()->setText(QString("%1h %2' %3\""). lineEdit()->setText(QString("%1h %2' %3\"")
arg(h).arg(m).arg(s, 0, 'f', decimalPlaces, ' ')); .arg(h).arg(m).arg(s, 0, 'f', decimalPl
aces, ' '));
break; break;
} }
case DecimalDeg: case DecimalDeg:
{ {
bool sign=true; bool sign=true;
double angle = radAngle; double angle = radAngle;
QString signInd = positivePrefix(currentPrefixType); QString signInd = positivePrefix(currentPrefixType);
if (radAngle<0) if (radAngle<0)
{ {
angle *= -1; angle *= -1;
sign = false; sign = false;
signInd = negativePrefix(currentPrefixType); signInd = negativePrefix(currentPrefixType);
} }
// lineEdit()->setText(QString("%1%2").arg(radAngle lineEdit()->setText(QString("%1%2%3")
* 180.0 / M_PI, 0, 'g', decimalPlaces, ' ').arg(QChar(176))); .arg(signInd)
lineEdit()->setText(QString("%1%2%3").arg(signInd).a .arg(fmod(angle * 180.0 / M_PI, 360.0), 0,
rg(fmod(angle * 180.0 / M_PI, 360.0), 0, 'f', decimalPlaces, ' ').arg(QChar 'f', decimalPlaces, ' ')
(176))); .arg(QChar(176)));
break; break;
} }
default: default:
{ {
qWarning() << "AngleSpinBox::formatText - WARNING - qWarning() << "AngleSpinBox::formatText - WARNING -
unknown format" << (int)(angleSpinBoxFormat); unknown format"
<< (int)(angleSpinBoxFormat);
break; break;
} }
} }
} }
 End of changes. 9 change blocks. 
21 lines changed or deleted 29 lines changed or added

This html diff was produced by rfcdiff 1.41. The latest version is available from http://tools.ietf.org/tools/rfcdiff/