Add support of number of decimals to unit system
This commit is contained in:
@@ -85,6 +85,7 @@ UnitsSchema *UnitsApi::UserPrefSystem = new UnitsSchemaInternal();
|
||||
|
||||
double UnitsApi::UserPrefFactor [50];
|
||||
QString UnitsApi::UserPrefUnit [50];
|
||||
int UnitsApi::UserPrefDecimals = 2;
|
||||
|
||||
UnitsApi::UnitsApi(const char* filter)
|
||||
{
|
||||
@@ -196,6 +197,16 @@ const double UnitsApi::getPrefFactorOf(QuantityType t)
|
||||
return UserPrefFactor[t];
|
||||
}
|
||||
|
||||
void UnitsApi::setDecimals(int prec)
|
||||
{
|
||||
UserPrefDecimals = prec;
|
||||
}
|
||||
|
||||
int UnitsApi::getDecimals()
|
||||
{
|
||||
return UserPrefDecimals;
|
||||
}
|
||||
|
||||
void UnitsApi::setDefaults(void)
|
||||
{
|
||||
setPrefOf( Length ,"mm" );
|
||||
|
||||
@@ -101,6 +101,10 @@ public:
|
||||
static const QString getQuantityName(QuantityType t);
|
||||
/// get the translation factor for the default unit of a quantity
|
||||
static const double getPrefFactorOf(QuantityType t);
|
||||
// set the number of decimals
|
||||
static void setDecimals(int);
|
||||
// fet the number of decimals
|
||||
static int getDecimals();
|
||||
/// set the application defaults
|
||||
static void setDefaults(void);
|
||||
//@}
|
||||
@@ -119,6 +123,8 @@ protected:
|
||||
static double UserPrefFactor [50] ;
|
||||
/// name of the unit the user wants to use as quantities
|
||||
static QString UserPrefUnit [50] ;
|
||||
/// number of decimals for floats
|
||||
static int UserPrefDecimals;
|
||||
|
||||
// do the real work
|
||||
static double parse(const char*,bool &UsedUnit);
|
||||
|
||||
Reference in New Issue
Block a user