76 double __fdSec = fabs( _fdValue );
78 modf( __fdSec / 60.0, &__fdMin );
79 __fdSec -= __fdMin * 60.0;
81 modf( __fdMin / 60.0, &__fdHour );
82 __fdMin -= __fdHour * 60.0;
83 QString __qsSec = QString::number( __fdSec,
'f', _iPrecision ).prepend(
"0" ).right( 2+( _iPrecision>0 ? _iPrecision+1 : 0 ) );
84 if( __qsSec[0] ==
'6' ) { __fdMin += 1; __qsSec[0] =
'0'; }
85 QString __qsMin = QString::number( __fdMin,
'f', 0 ).prepend(
"0" ).right( 2 );
86 if( __qsMin[0] ==
'6' ) { __fdHour += 1; __qsMin[0] =
'0'; }
87 return QString::number( _fdValue < 0 ? -__fdHour : __fdHour,
'f', 0 )+
":"+__qsMin+
":"+__qsSec;
92 double __fdMin = fabs( _fdValue ) / 60.0;
94 modf( __fdMin / 60.0, &__fdHour );
95 __fdMin -= __fdHour * 60.0;
96 QString __qsMin = QString::number( __fdMin,
'f', _iPrecision ).prepend(
"0" ).right( 2+( _iPrecision>0 ? _iPrecision+1 : 0 ) );
97 if( __qsMin[0] ==
'6' ) { __fdHour += 1; __qsMin[0] =
'0'; }
98 return QString::number( _fdValue < 0 ? -__fdHour : __fdHour,
'f', 0 )+
":"+__qsMin;
102 return QString::number( _fdValue / 60.0,
'f', _iPrecision )+
"'";
105 return QString::number( _fdValue,
'f', _iPrecision )+
"\"";
119 static const QRegExp __qRegExpHMS(
"^\\s*(-?)(0?\\d|1\\d|2[0-3]):(0?\\d|[1-5]\\d):(0?\\d|[1-5]\\d(\\.\\d+)?)\\s*$" );
120 static const QRegExp __qRegExpHM(
"^\\s*(-?)(0?\\d|1\\d|2[0-3]):((0?\\d|[1-5]\\d)(\\.\\d+)?)\\s*$" );
121 static const QRegExp __qRegExpM(
"^\\s*(-?)(\\d+(\\.\\d+)?)\\s*'\\s*$" );
122 static const QRegExp __qRegExpS(
"^\\s*(-?)(\\d+(\\.\\d+)?)\\s*\"\\s*$" );
124 if( _pbOK ) *_pbOK =
false;
128 if( __qRegExpHMS.exactMatch( _rqString ) )
130 __qsSign = __qRegExpHMS.cap(1);
131 __fdValue = __qRegExpHMS.cap(2).toDouble( &__bOK ) * 3600.0;
132 if( !__bOK )
return 0.0;
133 __fdValue += __qRegExpHMS.cap(3).toDouble( &__bOK ) * 60.0;
134 if( !__bOK )
return 0.0;
135 __fdValue += __qRegExpHMS.cap(4).toDouble( &__bOK );
136 if( !__bOK )
return 0.0;
138 else if( __qRegExpHM.exactMatch( _rqString ) )
140 __qsSign = __qRegExpHM.cap(1);
141 __fdValue = __qRegExpHM.cap(2).toDouble( &__bOK ) * 3600.0;
142 if( !__bOK )
return 0.0;
143 __fdValue += __qRegExpHM.cap(3).toDouble( &__bOK ) * 60.0;
144 if( !__bOK )
return 0.0;
146 else if( __qRegExpM.exactMatch( _rqString ) )
148 __qsSign = __qRegExpM.cap(1);
149 __fdValue = __qRegExpM.cap(2).toDouble( &__bOK ) * 60.0;
150 if( !__bOK )
return 0.0;
152 else if( __qRegExpS.exactMatch( _rqString ) )
154 __qsSign = __qRegExpS.cap(1);
155 __fdValue = __qRegExpS.cap(2).toDouble( &__bOK );
156 if( !__bOK )
return 0.0;
159 if( !__qsSign.isEmpty() ) __fdValue = -__fdValue;
160 if( _pbOK ) *_pbOK =
true;
[UI] Container for the application's settings
int getPrecisionTimeDelta()
[Precision] Returns the time difference decimal precision
CUnitTimeDelta::EUnit getUnitTimeDelta()
[Unit] Returns the time difference format/unit
Container class for supported machine-friendly format/unit codes.
QMap< CUnitTimeDelta::EUnit, QString > qMapCodes
Container class for supported human-readable format/unit symbols.
QMap< CUnitTimeDelta::EUnit, QString > qMapSymbols
static const QMap< EUnit, QString > & symbols()
Returns the list of supported human-readable format/unit symbols.
static const CUnitTimeDeltaSymbols oUnitTimeDeltaSymbols
Container for supported human-readable format/unit symbols.
static const QMap< EUnit, QString > & codes()
Returns the list of supported machine-friendly format/unit codes.
static EUnit fromCode(const QString &_rqsCode)
Returns the format/unit ID corresponding to the given machine-friendly code.
@ UNDEFINED
undefined format/unit
static QString toSymbol(EUnit _eUnit)
Returns the human-readable symbol corresponding to the given format/unit ID.
static double fromString(const QString &_rqString, bool *_pbOK=0)
Returns the numeric value corresponding (parsed) from the string.
static QString toCode(EUnit _eUnit)
Returns the machine-friendly code corresponding to the given format/unit ID.
static QString toString(double _fdValue, EUnit _eUnit, int _iPrecision=0)
Returns the formatted represention of the given value, using the specified format/unit and decimal pr...
static EUnit fromSymbol(const QString &_rqsSymbol)
Returns the format/unit ID corresponding to the given human-readable symbol.
static const CUnitTimeDeltaCodes oUnitTimeDeltaCodes
Container for supported machine-friendly format/unit codes.
static CSettings * useSettings()