|
|
|
@ -153,9 +153,7 @@ FactMetaData::FactMetaData(QObject* parent)
@@ -153,9 +153,7 @@ FactMetaData::FactMetaData(QObject* parent)
|
|
|
|
|
, _rawDefaultValue (0) |
|
|
|
|
, _defaultValueAvailable(false) |
|
|
|
|
, _rawMax (_maxForType()) |
|
|
|
|
, _maxIsDefaultForType (true) |
|
|
|
|
, _rawMin (_minForType()) |
|
|
|
|
, _minIsDefaultForType (true) |
|
|
|
|
, _rawTranslator (_defaultTranslator) |
|
|
|
|
, _cookedTranslator (_defaultTranslator) |
|
|
|
|
, _vehicleRebootRequired(false) |
|
|
|
@ -177,9 +175,7 @@ FactMetaData::FactMetaData(ValueType_t type, QObject* parent)
@@ -177,9 +175,7 @@ FactMetaData::FactMetaData(ValueType_t type, QObject* parent)
|
|
|
|
|
, _rawDefaultValue (0) |
|
|
|
|
, _defaultValueAvailable(false) |
|
|
|
|
, _rawMax (_maxForType()) |
|
|
|
|
, _maxIsDefaultForType (true) |
|
|
|
|
, _rawMin (_minForType()) |
|
|
|
|
, _minIsDefaultForType (true) |
|
|
|
|
, _rawTranslator (_defaultTranslator) |
|
|
|
|
, _cookedTranslator (_defaultTranslator) |
|
|
|
|
, _vehicleRebootRequired(false) |
|
|
|
@ -207,9 +203,7 @@ FactMetaData::FactMetaData(ValueType_t type, const QString name, QObject* parent
@@ -207,9 +203,7 @@ FactMetaData::FactMetaData(ValueType_t type, const QString name, QObject* parent
|
|
|
|
|
, _rawDefaultValue (0) |
|
|
|
|
, _defaultValueAvailable(false) |
|
|
|
|
, _rawMax (_maxForType()) |
|
|
|
|
, _maxIsDefaultForType (true) |
|
|
|
|
, _rawMin (_minForType()) |
|
|
|
|
, _minIsDefaultForType (true) |
|
|
|
|
, _name (name) |
|
|
|
|
, _rawTranslator (_defaultTranslator) |
|
|
|
|
, _cookedTranslator (_defaultTranslator) |
|
|
|
@ -238,9 +232,7 @@ const FactMetaData& FactMetaData::operator=(const FactMetaData& other)
@@ -238,9 +232,7 @@ const FactMetaData& FactMetaData::operator=(const FactMetaData& other)
|
|
|
|
|
_group = other._group; |
|
|
|
|
_longDescription = other._longDescription; |
|
|
|
|
_rawMax = other._rawMax; |
|
|
|
|
_maxIsDefaultForType = other._maxIsDefaultForType; |
|
|
|
|
_rawMin = other._rawMin; |
|
|
|
|
_minIsDefaultForType = other._minIsDefaultForType; |
|
|
|
|
_name = other._name; |
|
|
|
|
_shortDescription = other._shortDescription; |
|
|
|
|
_type = other._type; |
|
|
|
@ -292,7 +284,6 @@ void FactMetaData::setRawMin(const QVariant& rawMin)
@@ -292,7 +284,6 @@ void FactMetaData::setRawMin(const QVariant& rawMin)
|
|
|
|
|
{ |
|
|
|
|
if (isInRawMinLimit(rawMin)) { |
|
|
|
|
_rawMin = rawMin; |
|
|
|
|
_minIsDefaultForType = false; |
|
|
|
|
} else { |
|
|
|
|
qWarning() << "Attempt to set min below allowable value for fact: " << name() |
|
|
|
|
<< ", value attempted: " << rawMin |
|
|
|
@ -305,9 +296,10 @@ void FactMetaData::setRawMax(const QVariant& rawMax)
@@ -305,9 +296,10 @@ void FactMetaData::setRawMax(const QVariant& rawMax)
|
|
|
|
|
{ |
|
|
|
|
if (isInRawMaxLimit(rawMax)) { |
|
|
|
|
_rawMax = rawMax; |
|
|
|
|
_maxIsDefaultForType = false; |
|
|
|
|
} else { |
|
|
|
|
qWarning() << "Attempt to set max above allowable value"; |
|
|
|
|
qWarning() << "Attempt to set max above allowable value for fact: " << name() |
|
|
|
|
<< ", value attempted: " << rawMax |
|
|
|
|
<< ", type: " << type() << ", max for type: " << _maxForType(); |
|
|
|
|
_rawMax = _maxForType(); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
@ -372,9 +364,9 @@ bool FactMetaData::isInRawMaxLimit(const QVariant& variantValue) const
@@ -372,9 +364,9 @@ bool FactMetaData::isInRawMaxLimit(const QVariant& variantValue) const
|
|
|
|
|
return true; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
QVariant FactMetaData::_minForType(void) const |
|
|
|
|
QVariant FactMetaData::minForType(ValueType_t type) |
|
|
|
|
{ |
|
|
|
|
switch (_type) { |
|
|
|
|
switch (type) { |
|
|
|
|
case valueTypeUint8: |
|
|
|
|
return QVariant(std::numeric_limits<unsigned char>::min()); |
|
|
|
|
case valueTypeInt8: |
|
|
|
@ -409,9 +401,9 @@ QVariant FactMetaData::_minForType(void) const
@@ -409,9 +401,9 @@ QVariant FactMetaData::_minForType(void) const
|
|
|
|
|
return QVariant(); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
QVariant FactMetaData::_maxForType(void) const |
|
|
|
|
QVariant FactMetaData::maxForType(ValueType_t type) |
|
|
|
|
{ |
|
|
|
|
switch (_type) { |
|
|
|
|
switch (type) { |
|
|
|
|
case valueTypeUint8: |
|
|
|
|
return QVariant(std::numeric_limits<unsigned char>::max()); |
|
|
|
|
case valueTypeInt8: |
|
|
|
|