Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Q
qgroundcontrol
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Valentin Platzgummer
qgroundcontrol
Commits
8dd3148d
Commit
8dd3148d
authored
Dec 27, 2015
by
Don Gagne
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #2481 from DonLakeFlyer/AutoTranslation
Automatic raw->cooked translation based on units meta data
parents
de276119
1e613594
Changes
12
Hide whitespace changes
Inline
Side-by-side
Showing
12 changed files
with
314 additions
and
161 deletions
+314
-161
Fact.cc
src/FactSystem/Fact.cc
+70
-23
Fact.h
src/FactSystem/Fact.h
+23
-18
FactMetaData.cc
src/FactSystem/FactMetaData.cc
+150
-41
FactMetaData.h
src/FactSystem/FactMetaData.h
+43
-18
ParameterLoader.cc
src/FactSystem/ParameterLoader.cc
+1
-1
APMParameterMetaData.cc
src/FirmwarePlugin/APM/APMParameterMetaData.cc
+6
-6
PX4ParameterMetaData.cc
src/FirmwarePlugin/PX4/PX4ParameterMetaData.cc
+9
-9
MavCmdInfo.json
src/MissionManager/MavCmdInfo.json
+3
-3
MissionCommands.cc
src/MissionManager/MissionCommands.cc
+0
-3
MissionCommands.h
src/MissionManager/MissionCommands.h
+0
-3
MissionItem.cc
src/MissionManager/MissionItem.cc
+9
-33
MissionItem.h
src/MissionManager/MissionItem.h
+0
-3
No files found.
src/FactSystem/Fact.cc
View file @
8dd3148d
...
@@ -80,7 +80,7 @@ void Fact::forceSetRawValue(const QVariant& value)
...
@@ -80,7 +80,7 @@ void Fact::forceSetRawValue(const QVariant& value)
QVariant
typedValue
;
QVariant
typedValue
;
QString
errorString
;
QString
errorString
;
if
(
_metaData
->
convertAndValidate
(
value
,
true
/* convertOnly */
,
typedValue
,
errorString
))
{
if
(
_metaData
->
convertAndValidate
Raw
(
value
,
true
/* convertOnly */
,
typedValue
,
errorString
))
{
_rawValue
.
setValue
(
typedValue
);
_rawValue
.
setValue
(
typedValue
);
emit
valueChanged
(
cookedValue
());
emit
valueChanged
(
cookedValue
());
emit
_containerRawValueChanged
(
rawValue
());
emit
_containerRawValueChanged
(
rawValue
());
...
@@ -96,7 +96,7 @@ void Fact::setRawValue(const QVariant& value)
...
@@ -96,7 +96,7 @@ void Fact::setRawValue(const QVariant& value)
QVariant
typedValue
;
QVariant
typedValue
;
QString
errorString
;
QString
errorString
;
if
(
_metaData
->
convertAndValidate
(
value
,
true
/* convertOnly */
,
typedValue
,
errorString
))
{
if
(
_metaData
->
convertAndValidate
Raw
(
value
,
true
/* convertOnly */
,
typedValue
,
errorString
))
{
if
(
typedValue
!=
_rawValue
)
{
if
(
typedValue
!=
_rawValue
)
{
_rawValue
.
setValue
(
typedValue
);
_rawValue
.
setValue
(
typedValue
);
emit
valueChanged
(
cookedValue
());
emit
valueChanged
(
cookedValue
());
...
@@ -242,27 +242,45 @@ QString Fact::_variantToString(const QVariant& variant) const
...
@@ -242,27 +242,45 @@ QString Fact::_variantToString(const QVariant& variant) const
return
valueString
;
return
valueString
;
}
}
QString
Fact
::
valueString
(
void
)
const
QString
Fact
::
rawValueString
(
void
)
const
{
return
_variantToString
(
rawValue
());
}
QString
Fact
::
cookedValueString
(
void
)
const
{
{
return
_variantToString
(
cookedValue
());
return
_variantToString
(
cookedValue
());
}
}
QVariant
Fact
::
defaultValue
(
void
)
const
QVariant
Fact
::
rawDefaultValue
(
void
)
const
{
if
(
_metaData
)
{
if
(
!
_metaData
->
defaultValueAvailable
())
{
qDebug
()
<<
"Access to unavailable default value"
;
}
return
_metaData
->
rawDefaultValue
();
}
else
{
qWarning
()
<<
"Meta data pointer missing"
;
return
QVariant
(
0
);
}
}
QVariant
Fact
::
cookedDefaultValue
(
void
)
const
{
{
if
(
_metaData
)
{
if
(
_metaData
)
{
if
(
!
_metaData
->
defaultValueAvailable
())
{
if
(
!
_metaData
->
defaultValueAvailable
())
{
qDebug
()
<<
"Access to unavailable default value"
;
qDebug
()
<<
"Access to unavailable default value"
;
}
}
return
_metaData
->
d
efaultValue
();
return
_metaData
->
cookedD
efaultValue
();
}
else
{
}
else
{
qWarning
()
<<
"Meta data pointer missing"
;
qWarning
()
<<
"Meta data pointer missing"
;
return
QVariant
(
0
);
return
QVariant
(
0
);
}
}
}
}
QString
Fact
::
d
efaultValueString
(
void
)
const
QString
Fact
::
cookedD
efaultValueString
(
void
)
const
{
{
return
_variantToString
(
d
efaultValue
());
return
_variantToString
(
cookedD
efaultValue
());
}
}
FactMetaData
::
ValueType_t
Fact
::
type
(
void
)
const
FactMetaData
::
ValueType_t
Fact
::
type
(
void
)
const
...
@@ -290,44 +308,74 @@ QString Fact::longDescription(void) const
...
@@ -290,44 +308,74 @@ QString Fact::longDescription(void) const
}
}
}
}
QString
Fact
::
units
(
void
)
const
QString
Fact
::
rawUnits
(
void
)
const
{
if
(
_metaData
)
{
return
_metaData
->
rawUnits
();
}
else
{
qWarning
()
<<
"Meta data pointer missing"
;
return
QString
();
}
}
QString
Fact
::
cookedUnits
(
void
)
const
{
{
if
(
_metaData
)
{
if
(
_metaData
)
{
return
_metaData
->
u
nits
();
return
_metaData
->
cookedU
nits
();
}
else
{
}
else
{
qWarning
()
<<
"Meta data pointer missing"
;
qWarning
()
<<
"Meta data pointer missing"
;
return
QString
();
return
QString
();
}
}
}
}
QVariant
Fact
::
m
in
(
void
)
const
QVariant
Fact
::
rawM
in
(
void
)
const
{
{
if
(
_metaData
)
{
if
(
_metaData
)
{
return
_metaData
->
m
in
();
return
_metaData
->
rawM
in
();
}
else
{
}
else
{
qWarning
()
<<
"Meta data pointer missing"
;
qWarning
()
<<
"Meta data pointer missing"
;
return
QVariant
(
0
);
return
QVariant
(
0
);
}
}
}
}
Q
String
Fact
::
minString
(
void
)
const
Q
Variant
Fact
::
cookedMin
(
void
)
const
{
{
return
_variantToString
(
min
());
if
(
_metaData
)
{
return
_metaData
->
cookedMin
();
}
else
{
qWarning
()
<<
"Meta data pointer missing"
;
return
QVariant
(
0
);
}
}
}
QVariant
Fact
::
max
(
void
)
const
QString
Fact
::
cookedMinString
(
void
)
const
{
return
_variantToString
(
cookedMin
());
}
QVariant
Fact
::
rawMax
(
void
)
const
{
{
if
(
_metaData
)
{
if
(
_metaData
)
{
return
_metaData
->
m
ax
();
return
_metaData
->
rawM
ax
();
}
else
{
}
else
{
qWarning
()
<<
"Meta data pointer missing"
;
qWarning
()
<<
"Meta data pointer missing"
;
return
QVariant
(
0
);
return
QVariant
(
0
);
}
}
}
}
Q
String
Fact
::
maxString
(
void
)
const
Q
Variant
Fact
::
cookedMax
(
void
)
const
{
{
return
_variantToString
(
max
());
if
(
_metaData
)
{
return
_metaData
->
cookedMax
();
}
else
{
qWarning
()
<<
"Meta data pointer missing"
;
return
QVariant
(
0
);
}
}
QString
Fact
::
cookedMaxString
(
void
)
const
{
return
_variantToString
(
cookedMax
());
}
}
bool
Fact
::
minIsDefaultForType
(
void
)
const
bool
Fact
::
minIsDefaultForType
(
void
)
const
...
@@ -372,6 +420,8 @@ QString Fact::group(void) const
...
@@ -372,6 +420,8 @@ QString Fact::group(void) const
void
Fact
::
setMetaData
(
FactMetaData
*
metaData
)
void
Fact
::
setMetaData
(
FactMetaData
*
metaData
)
{
{
// FIXME: Hack to stuff enums into APM parameters, wating on real APM metadata
static
QStringList
apmFlightModeParamList
;
static
QStringList
apmFlightModeParamList
;
static
QStringList
apmFlightModeEnumStrings
;
static
QStringList
apmFlightModeEnumStrings
;
static
QVariantList
apmFlightModeEnumValues
;
static
QVariantList
apmFlightModeEnumValues
;
...
@@ -380,8 +430,6 @@ void Fact::setMetaData(FactMetaData* metaData)
...
@@ -380,8 +430,6 @@ void Fact::setMetaData(FactMetaData* metaData)
static
QStringList
apmChannelOptEnumStrings
;
static
QStringList
apmChannelOptEnumStrings
;
static
QVariantList
apmChannelOptEnumValues
;
static
QVariantList
apmChannelOptEnumValues
;
// FIXME: Hack to stuff enums into APM parameters, wating on real APM metadata
if
(
apmFlightModeEnumStrings
.
count
()
==
0
)
{
if
(
apmFlightModeEnumStrings
.
count
()
==
0
)
{
apmFlightModeParamList
<<
"FLTMODE1"
<<
"FLTMODE2"
<<
"FLTMODE3"
<<
"FLTMODE4"
<<
"FLTMODE5"
<<
"FLTMODE6"
;
apmFlightModeParamList
<<
"FLTMODE1"
<<
"FLTMODE2"
<<
"FLTMODE3"
<<
"FLTMODE4"
<<
"FLTMODE5"
<<
"FLTMODE6"
;
apmFlightModeEnumStrings
<<
"Stabilize"
<<
"Acro"
<<
"AltHold"
<<
"Auto"
<<
"Guided"
<<
"Loiter"
<<
"RTL"
<<
"Circle"
apmFlightModeEnumStrings
<<
"Stabilize"
<<
"Acro"
<<
"AltHold"
<<
"Auto"
<<
"Guided"
<<
"Loiter"
<<
"RTL"
<<
"Circle"
...
@@ -415,7 +463,7 @@ bool Fact::valueEqualsDefault(void) const
...
@@ -415,7 +463,7 @@ bool Fact::valueEqualsDefault(void) const
{
{
if
(
_metaData
)
{
if
(
_metaData
)
{
if
(
_metaData
->
defaultValueAvailable
())
{
if
(
_metaData
->
defaultValueAvailable
())
{
return
_metaData
->
d
efaultValue
()
==
rawValue
();
return
_metaData
->
rawD
efaultValue
()
==
rawValue
();
}
else
{
}
else
{
return
false
;
return
false
;
}
}
...
@@ -435,14 +483,13 @@ bool Fact::defaultValueAvailable(void) const
...
@@ -435,14 +483,13 @@ bool Fact::defaultValueAvailable(void) const
}
}
}
}
QString
Fact
::
validate
(
const
QString
&
v
alue
,
bool
convertOnly
)
QString
Fact
::
validate
(
const
QString
&
cookedV
alue
,
bool
convertOnly
)
{
{
if
(
_metaData
)
{
if
(
_metaData
)
{
QVariant
typedValue
;
QVariant
typedValue
;
QString
errorString
;
QString
errorString
;
_metaData
->
convertAndValidate
(
v
alue
,
convertOnly
,
typedValue
,
errorString
);
_metaData
->
convertAndValidate
Cooked
(
cookedV
alue
,
convertOnly
,
typedValue
,
errorString
);
return
errorString
;
return
errorString
;
}
else
{
}
else
{
...
...
src/FactSystem/Fact.h
View file @
8dd3148d
...
@@ -48,8 +48,8 @@ public:
...
@@ -48,8 +48,8 @@ public:
Q_PROPERTY
(
int
componentId
READ
componentId
CONSTANT
)
Q_PROPERTY
(
int
componentId
READ
componentId
CONSTANT
)
Q_PROPERTY
(
int
decimalPlaces
READ
decimalPlaces
CONSTANT
)
Q_PROPERTY
(
int
decimalPlaces
READ
decimalPlaces
CONSTANT
)
Q_PROPERTY
(
QVariant
defaultValue
READ
defaultValue
CONSTANT
)
Q_PROPERTY
(
QVariant
defaultValue
READ
cookedDefaultValue
CONSTANT
)
Q_PROPERTY
(
QString
defaultValueString
READ
defaultValueString
CONSTANT
)
Q_PROPERTY
(
QString
defaultValueString
READ
cookedDefaultValueString
CONSTANT
)
Q_PROPERTY
(
bool
defaultValueAvailable
READ
defaultValueAvailable
CONSTANT
)
Q_PROPERTY
(
bool
defaultValueAvailable
READ
defaultValueAvailable
CONSTANT
)
Q_PROPERTY
(
int
enumIndex
READ
enumIndex
WRITE
setEnumIndex
NOTIFY
valueChanged
)
Q_PROPERTY
(
int
enumIndex
READ
enumIndex
WRITE
setEnumIndex
NOTIFY
valueChanged
)
Q_PROPERTY
(
QStringList
enumStrings
READ
enumStrings
NOTIFY
enumStringsChanged
)
Q_PROPERTY
(
QStringList
enumStrings
READ
enumStrings
NOTIFY
enumStringsChanged
)
...
@@ -57,48 +57,53 @@ public:
...
@@ -57,48 +57,53 @@ public:
Q_PROPERTY
(
QVariantList
enumValues
READ
enumValues
NOTIFY
enumValuesChanged
)
Q_PROPERTY
(
QVariantList
enumValues
READ
enumValues
NOTIFY
enumValuesChanged
)
Q_PROPERTY
(
QString
group
READ
group
CONSTANT
)
Q_PROPERTY
(
QString
group
READ
group
CONSTANT
)
Q_PROPERTY
(
QString
longDescription
READ
longDescription
CONSTANT
)
Q_PROPERTY
(
QString
longDescription
READ
longDescription
CONSTANT
)
Q_PROPERTY
(
QVariant
max
READ
max
CONSTANT
)
Q_PROPERTY
(
QVariant
max
READ
cookedMax
CONSTANT
)
Q_PROPERTY
(
QString
maxString
READ
maxString
CONSTANT
)
Q_PROPERTY
(
QString
maxString
READ
cookedMaxString
CONSTANT
)
Q_PROPERTY
(
bool
maxIsDefaultForType
READ
maxIsDefaultForType
CONSTANT
)
Q_PROPERTY
(
bool
maxIsDefaultForType
READ
maxIsDefaultForType
CONSTANT
)
Q_PROPERTY
(
QVariant
min
READ
min
CONSTANT
)
Q_PROPERTY
(
QVariant
min
READ
cookedMin
CONSTANT
)
Q_PROPERTY
(
QString
minString
READ
minString
CONSTANT
)
Q_PROPERTY
(
QString
minString
READ
cookedMinString
CONSTANT
)
Q_PROPERTY
(
bool
minIsDefaultForType
READ
minIsDefaultForType
CONSTANT
)
Q_PROPERTY
(
bool
minIsDefaultForType
READ
minIsDefaultForType
CONSTANT
)
Q_PROPERTY
(
QString
name
READ
name
CONSTANT
)
Q_PROPERTY
(
QString
name
READ
name
CONSTANT
)
Q_PROPERTY
(
QString
shortDescription
READ
shortDescription
CONSTANT
)
Q_PROPERTY
(
QString
shortDescription
READ
shortDescription
CONSTANT
)
Q_PROPERTY
(
FactMetaData
::
ValueType_t
type
READ
type
CONSTANT
)
Q_PROPERTY
(
FactMetaData
::
ValueType_t
type
READ
type
CONSTANT
)
Q_PROPERTY
(
QString
units
READ
units
CONSTANT
)
Q_PROPERTY
(
QString
units
READ
cookedUnits
CONSTANT
)
Q_PROPERTY
(
QVariant
value
READ
cookedValue
WRITE
setCookedValue
NOTIFY
valueChanged
)
Q_PROPERTY
(
QVariant
value
READ
cookedValue
WRITE
setCookedValue
NOTIFY
valueChanged
)
Q_PROPERTY
(
bool
valueEqualsDefault
READ
valueEqualsDefault
NOTIFY
valueChanged
)
Q_PROPERTY
(
bool
valueEqualsDefault
READ
valueEqualsDefault
NOTIFY
valueChanged
)
Q_PROPERTY
(
QVariant
valueString
READ
valueString
NOTIFY
valueChanged
)
Q_PROPERTY
(
QVariant
valueString
READ
cookedValueString
NOTIFY
valueChanged
)
/// Convert and validate value
/// Convert and validate value
/// @param convertOnly true: validate type conversion only, false: validate against meta data as well
/// @param convertOnly true: validate type conversion only, false: validate against meta data as well
Q_INVOKABLE
QString
validate
(
const
QString
&
v
alue
,
bool
convertOnly
);
Q_INVOKABLE
QString
validate
(
const
QString
&
cookedV
alue
,
bool
convertOnly
);
QVariant
cookedValue
(
void
)
const
;
/// Value after translation
QVariant
cookedValue
(
void
)
const
;
/// Value after translation
QVariant
rawValue
(
void
)
const
{
return
_rawValue
;
}
/// value prior to translation, careful
int
componentId
(
void
)
const
;
int
componentId
(
void
)
const
;
int
decimalPlaces
(
void
)
const
;
int
decimalPlaces
(
void
)
const
;
QVariant
defaultValue
(
void
)
const
;
QVariant
rawDefaultValue
(
void
)
const
;
QVariant
cookedDefaultValue
(
void
)
const
;
bool
defaultValueAvailable
(
void
)
const
;
bool
defaultValueAvailable
(
void
)
const
;
QString
defaultValueString
(
void
)
const
;
QString
cookedDefaultValueString
(
void
)
const
;
int
enumIndex
(
void
);
// This is not const, since an unknown value can modify the enum lists
int
enumIndex
(
void
);
// This is not const, since an unknown value can modify the enum lists
QStringList
enumStrings
(
void
)
const
;
QStringList
enumStrings
(
void
)
const
;
QString
enumStringValue
(
void
);
// This is not const, since an unknown value can modify the enum lists
QString
enumStringValue
(
void
);
// This is not const, since an unknown value can modify the enum lists
QVariantList
enumValues
(
void
)
const
;
QVariantList
enumValues
(
void
)
const
;
QString
group
(
void
)
const
;
QString
group
(
void
)
const
;
QString
longDescription
(
void
)
const
;
QString
longDescription
(
void
)
const
;
QVariant
max
(
void
)
const
;
QVariant
rawMax
(
void
)
const
;
QString
maxString
(
void
)
const
;
QVariant
cookedMax
(
void
)
const
;
QString
cookedMaxString
(
void
)
const
;
bool
maxIsDefaultForType
(
void
)
const
;
bool
maxIsDefaultForType
(
void
)
const
;
QVariant
min
(
void
)
const
;
QVariant
rawMin
(
void
)
const
;
QString
minString
(
void
)
const
;
QVariant
cookedMin
(
void
)
const
;
QString
cookedMinString
(
void
)
const
;
bool
minIsDefaultForType
(
void
)
const
;
bool
minIsDefaultForType
(
void
)
const
;
QString
name
(
void
)
const
;
QString
name
(
void
)
const
;
QVariant
rawValue
(
void
)
const
{
return
_rawValue
;
}
/// value prior to translation, careful
QString
shortDescription
(
void
)
const
;
QString
shortDescription
(
void
)
const
;
FactMetaData
::
ValueType_t
type
(
void
)
const
;
FactMetaData
::
ValueType_t
type
(
void
)
const
;
QString
units
(
void
)
const
;
QString
cookedUnits
(
void
)
const
;
QString
valueString
(
void
)
const
;
QString
rawUnits
(
void
)
const
;
QString
rawValueString
(
void
)
const
;
QString
cookedValueString
(
void
)
const
;
bool
valueEqualsDefault
(
void
)
const
;
bool
valueEqualsDefault
(
void
)
const
;
void
setRawValue
(
const
QVariant
&
value
);
void
setRawValue
(
const
QVariant
&
value
);
...
...
src/FactSystem/FactMetaData.cc
View file @
8dd3148d
...
@@ -31,20 +31,26 @@
...
@@ -31,20 +31,26 @@
#include <QDebug>
#include <QDebug>
#include <limits>
#include <limits>
#include <cmath>
const
FactMetaData
::
BuiltInTranslation_s
FactMetaData
::
_rgBuildInTranslations
[]
=
{
{
"centi-degrees"
,
"degrees"
,
FactMetaData
::
_centiDegreesToDegrees
,
FactMetaData
::
_degreesToCentiDegrees
},
{
"radians"
,
"degrees"
,
FactMetaData
::
_radiansToDegrees
,
FactMetaData
::
_degreesToRadians
},
};
FactMetaData
::
FactMetaData
(
QObject
*
parent
)
FactMetaData
::
FactMetaData
(
QObject
*
parent
)
:
QObject
(
parent
)
:
QObject
(
parent
)
,
_type
(
valueTypeInt32
)
,
_type
(
valueTypeInt32
)
,
_decimalPlaces
(
defaultDecimalPlaces
)
,
_decimalPlaces
(
defaultDecimalPlaces
)
,
_
d
efaultValue
(
0
)
,
_
rawD
efaultValue
(
0
)
,
_defaultValueAvailable
(
false
)
,
_defaultValueAvailable
(
false
)
,
_group
(
"*Default Group"
)
,
_group
(
"*Default Group"
)
,
_
m
ax
(
_maxForType
())
,
_
rawM
ax
(
_maxForType
())
,
_maxIsDefaultForType
(
true
)
,
_maxIsDefaultForType
(
true
)
,
_
m
in
(
_minForType
())
,
_
rawM
in
(
_minForType
())
,
_minIsDefaultForType
(
true
)
,
_minIsDefaultForType
(
true
)
,
_rawTranslator
(
defaultTranslator
)
,
_rawTranslator
(
_
defaultTranslator
)
,
_cookedTranslator
(
defaultTranslator
)
,
_cookedTranslator
(
_
defaultTranslator
)
{
{
}
}
...
@@ -53,15 +59,15 @@ FactMetaData::FactMetaData(ValueType_t type, QObject* parent)
...
@@ -53,15 +59,15 @@ FactMetaData::FactMetaData(ValueType_t type, QObject* parent)
:
QObject
(
parent
)
:
QObject
(
parent
)
,
_type
(
type
)
,
_type
(
type
)
,
_decimalPlaces
(
defaultDecimalPlaces
)
,
_decimalPlaces
(
defaultDecimalPlaces
)
,
_
d
efaultValue
(
0
)
,
_
rawD
efaultValue
(
0
)
,
_defaultValueAvailable
(
false
)
,
_defaultValueAvailable
(
false
)
,
_group
(
"*Default Group"
)
,
_group
(
"*Default Group"
)
,
_
m
ax
(
_maxForType
())
,
_
rawM
ax
(
_maxForType
())
,
_maxIsDefaultForType
(
true
)
,
_maxIsDefaultForType
(
true
)
,
_
m
in
(
_minForType
())
,
_
rawM
in
(
_minForType
())
,
_minIsDefaultForType
(
true
)
,
_minIsDefaultForType
(
true
)
,
_rawTranslator
(
defaultTranslator
)
,
_rawTranslator
(
_
defaultTranslator
)
,
_cookedTranslator
(
defaultTranslator
)
,
_cookedTranslator
(
_
defaultTranslator
)
{
{
}
}
...
@@ -75,66 +81,67 @@ FactMetaData::FactMetaData(const FactMetaData& other, QObject* parent)
...
@@ -75,66 +81,67 @@ FactMetaData::FactMetaData(const FactMetaData& other, QObject* parent)
const
FactMetaData
&
FactMetaData
::
operator
=
(
const
FactMetaData
&
other
)
const
FactMetaData
&
FactMetaData
::
operator
=
(
const
FactMetaData
&
other
)
{
{
_decimalPlaces
=
other
.
_decimalPlaces
;
_decimalPlaces
=
other
.
_decimalPlaces
;
_
defaultValue
=
other
.
_d
efaultValue
;
_
rawDefaultValue
=
other
.
_rawD
efaultValue
;
_defaultValueAvailable
=
other
.
_defaultValueAvailable
;
_defaultValueAvailable
=
other
.
_defaultValueAvailable
;
_enumStrings
=
other
.
_enumStrings
;
_enumStrings
=
other
.
_enumStrings
;
_enumValues
=
other
.
_enumValues
;
_enumValues
=
other
.
_enumValues
;
_group
=
other
.
_group
;
_group
=
other
.
_group
;
_longDescription
=
other
.
_longDescription
;
_longDescription
=
other
.
_longDescription
;
_
max
=
other
.
_m
ax
;
_
rawMax
=
other
.
_rawM
ax
;
_maxIsDefaultForType
=
other
.
_maxIsDefaultForType
;
_maxIsDefaultForType
=
other
.
_maxIsDefaultForType
;
_
min
=
other
.
_m
in
;
_
rawMin
=
other
.
_rawM
in
;
_minIsDefaultForType
=
other
.
_minIsDefaultForType
;
_minIsDefaultForType
=
other
.
_minIsDefaultForType
;
_name
=
other
.
_name
;
_name
=
other
.
_name
;
_shortDescription
=
other
.
_shortDescription
;
_shortDescription
=
other
.
_shortDescription
;
_type
=
other
.
_type
;
_type
=
other
.
_type
;
_units
=
other
.
_units
;
_rawUnits
=
other
.
_rawUnits
;
_cookedUnits
=
other
.
_cookedUnits
;
_rawTranslator
=
other
.
_rawTranslator
;
_rawTranslator
=
other
.
_rawTranslator
;
_cookedTranslator
=
other
.
_cookedTranslator
;
_cookedTranslator
=
other
.
_cookedTranslator
;
return
*
this
;
return
*
this
;
}
}
QVariant
FactMetaData
::
d
efaultValue
(
void
)
const
QVariant
FactMetaData
::
rawD
efaultValue
(
void
)
const
{
{
if
(
_defaultValueAvailable
)
{
if
(
_defaultValueAvailable
)
{
return
_
d
efaultValue
;
return
_
rawD
efaultValue
;
}
else
{
}
else
{
qWarning
()
<<
"Attempt to access unavailable default value"
;
qWarning
()
<<
"Attempt to access unavailable default value"
;
return
QVariant
(
0
);
return
QVariant
(
0
);
}
}
}
}
void
FactMetaData
::
set
DefaultValue
(
const
QVariant
&
d
efaultValue
)
void
FactMetaData
::
set
RawDefaultValue
(
const
QVariant
&
rawD
efaultValue
)
{
{
if
(
_
min
<=
defaultValue
&&
defaultValue
<=
_m
ax
)
{
if
(
_
rawMin
<=
rawDefaultValue
&&
rawDefaultValue
<=
_rawM
ax
)
{
_
defaultValue
=
d
efaultValue
;
_
rawDefaultValue
=
rawD
efaultValue
;
_defaultValueAvailable
=
true
;
_defaultValueAvailable
=
true
;
}
else
{
}
else
{
qWarning
()
<<
"Attempt to set default value which is outside min/max range"
;
qWarning
()
<<
"Attempt to set default value which is outside min/max range"
;
}
}
}
}
void
FactMetaData
::
set
Min
(
const
QVariant
&
m
in
)
void
FactMetaData
::
set
RawMin
(
const
QVariant
&
rawM
in
)
{
{
if
(
m
in
>
_minForType
())
{
if
(
rawM
in
>
_minForType
())
{
_
min
=
m
in
;
_
rawMin
=
rawM
in
;
_minIsDefaultForType
=
false
;
_minIsDefaultForType
=
false
;
}
else
{
}
else
{
qWarning
()
<<
"Attempt to set min below allowable value for fact: "
<<
name
()
qWarning
()
<<
"Attempt to set min below allowable value for fact: "
<<
name
()
<<
", value attempted: "
<<
m
in
<<
", value attempted: "
<<
rawM
in
<<
", type: "
<<
type
()
<<
", min for type: "
<<
_minForType
();
<<
", type: "
<<
type
()
<<
", min for type: "
<<
_minForType
();
_
m
in
=
_minForType
();
_
rawM
in
=
_minForType
();
}
}
}
}
void
FactMetaData
::
set
Max
(
const
QVariant
&
m
ax
)
void
FactMetaData
::
set
RawMax
(
const
QVariant
&
rawM
ax
)
{
{
if
(
m
ax
>
_maxForType
())
{
if
(
rawM
ax
>
_maxForType
())
{
qWarning
()
<<
"Attempt to set max above allowable value"
;
qWarning
()
<<
"Attempt to set max above allowable value"
;
_
m
ax
=
_maxForType
();
_
rawM
ax
=
_maxForType
();
}
else
{
}
else
{
_
max
=
m
ax
;
_
rawMax
=
rawM
ax
;
_maxIsDefaultForType
=
false
;
_maxIsDefaultForType
=
false
;
}
}
}
}
...
@@ -189,7 +196,7 @@ QVariant FactMetaData::_maxForType(void) const
...
@@ -189,7 +196,7 @@ QVariant FactMetaData::_maxForType(void) const
return
QVariant
();
return
QVariant
();
}
}
bool
FactMetaData
::
convertAndValidate
(
const
QVariant
&
v
alue
,
bool
convertOnly
,
QVariant
&
typedValue
,
QString
&
errorString
)
bool
FactMetaData
::
convertAndValidate
Raw
(
const
QVariant
&
rawV
alue
,
bool
convertOnly
,
QVariant
&
typedValue
,
QString
&
errorString
)
{
{
bool
convertOk
=
false
;
bool
convertOk
=
false
;
...
@@ -199,10 +206,10 @@ bool FactMetaData::convertAndValidate(const QVariant& value, bool convertOnly, Q
...
@@ -199,10 +206,10 @@ bool FactMetaData::convertAndValidate(const QVariant& value, bool convertOnly, Q
case
FactMetaData
:
:
valueTypeInt8
:
case
FactMetaData
:
:
valueTypeInt8
:
case
FactMetaData
:
:
valueTypeInt16
:
case
FactMetaData
:
:
valueTypeInt16
:
case
FactMetaData
:
:
valueTypeInt32
:
case
FactMetaData
:
:
valueTypeInt32
:
typedValue
=
QVariant
(
v
alue
.
toInt
(
&
convertOk
));
typedValue
=
QVariant
(
rawV
alue
.
toInt
(
&
convertOk
));
if
(
!
convertOnly
&&
convertOk
)
{
if
(
!
convertOnly
&&
convertOk
)
{
if
(
min
()
>
typedValue
||
typedValue
>
m
ax
())
{
if
(
rawMin
()
>
typedValue
||
typedValue
>
rawM
ax
())
{
errorString
=
QString
(
"Value must be within %1 and %2"
).
arg
(
min
().
toInt
()).
arg
(
m
ax
().
toInt
());
errorString
=
QString
(
"Value must be within %1 and %2"
).
arg
(
cookedMin
().
toInt
()).
arg
(
cookedM
ax
().
toInt
());
}
}
}
}
break
;
break
;
...
@@ -210,28 +217,28 @@ bool FactMetaData::convertAndValidate(const QVariant& value, bool convertOnly, Q
...
@@ -210,28 +217,28 @@ bool FactMetaData::convertAndValidate(const QVariant& value, bool convertOnly, Q
case
FactMetaData
:
:
valueTypeUint8
:
case
FactMetaData
:
:
valueTypeUint8
:
case
FactMetaData
:
:
valueTypeUint16
:
case
FactMetaData
:
:
valueTypeUint16
:
case
FactMetaData
:
:
valueTypeUint32
:
case
FactMetaData
:
:
valueTypeUint32
:
typedValue
=
QVariant
(
v
alue
.
toUInt
(
&
convertOk
));
typedValue
=
QVariant
(
rawV
alue
.
toUInt
(
&
convertOk
));
if
(
!
convertOnly
&&
convertOk
)
{
if
(
!
convertOnly
&&
convertOk
)
{
if
(
min
()
>
typedValue
||
typedValue
>
m
ax
())
{
if
(
rawMin
()
>
typedValue
||
typedValue
>
rawM
ax
())
{
errorString
=
QString
(
"Value must be within %1 and %2"
).
arg
(
min
().
toUInt
()).
arg
(
m
ax
().
toUInt
());
errorString
=
QString
(
"Value must be within %1 and %2"
).
arg
(
cookedMin
().
toUInt
()).
arg
(
cookedM
ax
().
toUInt
());
}
}
}
}
break
;
break
;
case
FactMetaData
:
:
valueTypeFloat
:
case
FactMetaData
:
:
valueTypeFloat
:
typedValue
=
QVariant
(
v
alue
.
toFloat
(
&
convertOk
));
typedValue
=
QVariant
(
rawV
alue
.
toFloat
(
&
convertOk
));
if
(
!
convertOnly
&&
convertOk
)
{
if
(
!
convertOnly
&&
convertOk
)
{
if
(
min
()
>
typedValue
||
typedValue
>
m
ax
())
{
if
(
rawMin
()
>
typedValue
||
typedValue
>
rawM
ax
())
{
errorString
=
QString
(
"Value must be within %1 and %2"
).
arg
(
min
().
toFloat
()).
arg
(
m
ax
().
toFloat
());
errorString
=
QString
(
"Value must be within %1 and %2"
).
arg
(
cookedMin
().
toFloat
()).
arg
(
cookedM
ax
().
toFloat
());
}
}
}
}
break
;
break
;
case
FactMetaData
:
:
valueTypeDouble
:
case
FactMetaData
:
:
valueTypeDouble
:
typedValue
=
QVariant
(
v
alue
.
toDouble
(
&
convertOk
));
typedValue
=
QVariant
(
rawV
alue
.
toDouble
(
&
convertOk
));
if
(
!
convertOnly
&&
convertOk
)
{
if
(
!
convertOnly
&&
convertOk
)
{
if
(
min
()
>
typedValue
||
typedValue
>
m
ax
())
{
if
(
rawMin
()
>
typedValue
||
typedValue
>
rawM
ax
())
{
errorString
=
QString
(
"Value must be within %1 and %2"
).
arg
(
min
().
toDouble
()).
arg
(
m
ax
().
toDouble
());
errorString
=
QString
(
"Value must be within %1 and %2"
).
arg
(
cookedMin
().
toDouble
()).
arg
(
cookedM
ax
().
toDouble
());
}
}
}
}
break
;
break
;
...
@@ -244,6 +251,61 @@ bool FactMetaData::convertAndValidate(const QVariant& value, bool convertOnly, Q
...
@@ -244,6 +251,61 @@ bool FactMetaData::convertAndValidate(const QVariant& value, bool convertOnly, Q
return
convertOk
&&
errorString
.
isEmpty
();
return
convertOk
&&
errorString
.
isEmpty
();
}
}
bool
FactMetaData
::
convertAndValidateCooked
(
const
QVariant
&
cookedValue
,
bool
convertOnly
,
QVariant
&
typedValue
,
QString
&
errorString
)
{
bool
convertOk
=
false
;
errorString
.
clear
();
switch
(
type
())
{
case
FactMetaData
:
:
valueTypeInt8
:
case
FactMetaData
:
:
valueTypeInt16
:
case
FactMetaData
:
:
valueTypeInt32
:
typedValue
=
QVariant
(
cookedValue
.
toInt
(
&
convertOk
));
if
(
!
convertOnly
&&
convertOk
)
{
if
(
cookedMin
()
>
typedValue
||
typedValue
>
cookedMax
())
{
errorString
=
QString
(
"Value must be within %1 and %2"
).
arg
(
cookedMin
().
toInt
()).
arg
(
cookedMax
().
toInt
());
}
}
break
;
case
FactMetaData
:
:
valueTypeUint8
:
case
FactMetaData
:
:
valueTypeUint16
:
case
FactMetaData
:
:
valueTypeUint32
:
typedValue
=
QVariant
(
cookedValue
.
toUInt
(
&
convertOk
));
if
(
!
convertOnly
&&
convertOk
)
{
if
(
cookedMin
()
>
typedValue
||
typedValue
>
cookedMax
())
{
errorString
=
QString
(
"Value must be within %1 and %2"
).
arg
(
cookedMin
().
toUInt
()).
arg
(
cookedMax
().
toUInt
());
}
}
break
;
case
FactMetaData
:
:
valueTypeFloat
:
typedValue
=
QVariant
(
cookedValue
.
toFloat
(
&
convertOk
));
if
(
!
convertOnly
&&
convertOk
)
{
if
(
cookedMin
()
>
typedValue
||
typedValue
>
cookedMax
())
{
errorString
=
QString
(
"Value must be within %1 and %2"
).
arg
(
cookedMin
().
toFloat
()).
arg
(
cookedMax
().
toFloat
());
}
}
break
;
case
FactMetaData
:
:
valueTypeDouble
:
typedValue
=
QVariant
(
cookedValue
.
toDouble
(
&
convertOk
));
if
(
!
convertOnly
&&
convertOk
)
{
if
(
cookedMin
()
>
typedValue
||
typedValue
>
cookedMax
())
{
errorString
=
QString
(
"Value must be within %1 and %2"
).
arg
(
cookedMin
().
toDouble
()).
arg
(
cookedMax
().
toDouble
());
}
}
break
;
}
if
(
!
convertOk
)
{
errorString
+=
"Invalid number"
;
}
return
convertOk
&&
errorString
.
isEmpty
();
}
void
FactMetaData
::
setEnumInfo
(
const
QStringList
&
strings
,
const
QVariantList
&
values
)
void
FactMetaData
::
setEnumInfo
(
const
QStringList
&
strings
,
const
QVariantList
&
values
)
{
{
if
(
strings
.
count
()
!=
values
.
count
())
{
if
(
strings
.
count
()
!=
values
.
count
())
{
...
@@ -253,6 +315,7 @@ void FactMetaData::setEnumInfo(const QStringList& strings, const QVariantList& v
...
@@ -253,6 +315,7 @@ void FactMetaData::setEnumInfo(const QStringList& strings, const QVariantList& v
_enumStrings
=
strings
;
_enumStrings
=
strings
;
_enumValues
=
values
;
_enumValues
=
values
;
_setBuiltInTranslator
();
}
}
void
FactMetaData
::
setTranslators
(
Translator
rawTranslator
,
Translator
cookedTranslator
)
void
FactMetaData
::
setTranslators
(
Translator
rawTranslator
,
Translator
cookedTranslator
)
...
@@ -261,8 +324,54 @@ void FactMetaData::setTranslators(Translator rawTranslator, Translator cookedTra
...
@@ -261,8 +324,54 @@ void FactMetaData::setTranslators(Translator rawTranslator, Translator cookedTra
_cookedTranslator
=
cookedTranslator
;
_cookedTranslator
=
cookedTranslator
;
}
}
void
FactMetaData
::
_setBuiltInTranslator
(
void
)
{
if
(
_enumStrings
.
count
())
{
// No translation if enum
setTranslators
(
_defaultTranslator
,
_defaultTranslator
);
_cookedUnits
=
_rawUnits
;
}
else
{
for
(
size_t
i
=
0
;
i
<
sizeof
(
_rgBuildInTranslations
)
/
sizeof
(
_rgBuildInTranslations
[
0
]);
i
++
)
{
const
BuiltInTranslation_s
*
pBuiltInTranslation
=
&
_rgBuildInTranslations
[
i
];
if
(
pBuiltInTranslation
->
rawUnits
==
_rawUnits
.
toLower
())
{
_cookedUnits
=
pBuiltInTranslation
->
cookedUnits
;
setTranslators
(
pBuiltInTranslation
->
rawTranslator
,
pBuiltInTranslation
->
cookedTranslator
);
}
}
}
}
void
FactMetaData
::
addEnumInfo
(
const
QString
&
name
,
const
QVariant
&
value
)
void
FactMetaData
::
addEnumInfo
(
const
QString
&
name
,
const
QVariant
&
value
)
{
{
_enumStrings
<<
name
;
_enumStrings
<<
name
;
_enumValues
<<
value
;
_enumValues
<<
value
;
}
}
QVariant
FactMetaData
::
_degreesToRadians
(
const
QVariant
&
degrees
)
{
return
QVariant
(
degrees
.
toDouble
()
*
(
M_PI
/
180.0
));
}
QVariant
FactMetaData
::
_radiansToDegrees
(
const
QVariant
&
radians
)
{
return
QVariant
(
radians
.
toDouble
()
*
(
180
/
M_PI
));
}
QVariant
FactMetaData
::
_centiDegreesToDegrees
(
const
QVariant
&
centiDegrees
)
{
return
QVariant
(
centiDegrees
.
toFloat
()
/
100.0
f
);
}
QVariant
FactMetaData
::
_degreesToCentiDegrees
(
const
QVariant
&
degrees
)
{
return
QVariant
((
unsigned
int
)(
degrees
.
toFloat
()
*
100.0
f
));
}
void
FactMetaData
::
setRawUnits
(
const
QString
&
rawUnits
)
{
_rawUnits
=
rawUnits
;
_cookedUnits
=
rawUnits
;
_setBuiltInTranslator
();
}
src/FactSystem/FactMetaData.h
View file @
8dd3148d
...
@@ -61,20 +61,24 @@ public:
...
@@ -61,20 +61,24 @@ public:
const
FactMetaData
&
operator
=
(
const
FactMetaData
&
other
);
const
FactMetaData
&
operator
=
(
const
FactMetaData
&
other
);
int
decimalPlaces
(
void
)
const
{
return
_decimalPlaces
;
}
int
decimalPlaces
(
void
)
const
{
return
_decimalPlaces
;
}
QVariant
defaultValue
(
void
)
const
;
QVariant
rawDefaultValue
(
void
)
const
;
QVariant
cookedDefaultValue
(
void
)
const
{
return
_rawTranslator
(
rawDefaultValue
());
}
bool
defaultValueAvailable
(
void
)
const
{
return
_defaultValueAvailable
;
}
bool
defaultValueAvailable
(
void
)
const
{
return
_defaultValueAvailable
;
}
QStringList
enumStrings
(
void
)
const
{
return
_enumStrings
;
}
QStringList
enumStrings
(
void
)
const
{
return
_enumStrings
;
}
QVariantList
enumValues
(
void
)
const
{
return
_enumValues
;
}
QVariantList
enumValues
(
void
)
const
{
return
_enumValues
;
}
QString
group
(
void
)
const
{
return
_group
;
}
QString
group
(
void
)
const
{
return
_group
;
}
QString
longDescription
(
void
)
const
{
return
_longDescription
;}
QString
longDescription
(
void
)
const
{
return
_longDescription
;}
QVariant
max
(
void
)
const
{
return
_max
;
}
QVariant
rawMax
(
void
)
const
{
return
_rawMax
;
}
QVariant
cookedMax
(
void
)
const
{
return
_rawTranslator
(
_rawMax
);
}
bool
maxIsDefaultForType
(
void
)
const
{
return
_maxIsDefaultForType
;
}
bool
maxIsDefaultForType
(
void
)
const
{
return
_maxIsDefaultForType
;
}
QVariant
min
(
void
)
const
{
return
_min
;
}
QVariant
rawMin
(
void
)
const
{
return
_rawMin
;
}
QVariant
cookedMin
(
void
)
const
{
return
_rawTranslator
(
_rawMin
);
}
bool
minIsDefaultForType
(
void
)
const
{
return
_minIsDefaultForType
;
}
bool
minIsDefaultForType
(
void
)
const
{
return
_minIsDefaultForType
;
}
QString
name
(
void
)
const
{
return
_name
;
}
QString
name
(
void
)
const
{
return
_name
;
}
QString
shortDescription
(
void
)
const
{
return
_shortDescription
;
}
QString
shortDescription
(
void
)
const
{
return
_shortDescription
;
}
ValueType_t
type
(
void
)
const
{
return
_type
;
}
ValueType_t
type
(
void
)
const
{
return
_type
;
}
QString
units
(
void
)
const
{
return
_units
;
}
QString
rawUnits
(
void
)
const
{
return
_rawUnits
;
}
QString
cookedUnits
(
void
)
const
{
return
_cookedUnits
;
}
Translator
rawTranslator
(
void
)
const
{
return
_rawTranslator
;
}
Translator
rawTranslator
(
void
)
const
{
return
_rawTranslator
;
}
Translator
cookedTranslator
(
void
)
const
{
return
_cookedTranslator
;
}
Translator
cookedTranslator
(
void
)
const
{
return
_cookedTranslator
;
}
...
@@ -83,50 +87,71 @@ public:
...
@@ -83,50 +87,71 @@ public:
void
addEnumInfo
(
const
QString
&
name
,
const
QVariant
&
value
);
void
addEnumInfo
(
const
QString
&
name
,
const
QVariant
&
value
);
void
setDecimalPlaces
(
int
decimalPlaces
)
{
_decimalPlaces
=
decimalPlaces
;
}
void
setDecimalPlaces
(
int
decimalPlaces
)
{
_decimalPlaces
=
decimalPlaces
;
}
void
set
DefaultValue
(
const
QVariant
&
d
efaultValue
);
void
set
RawDefaultValue
(
const
QVariant
&
rawD
efaultValue
);
void
setEnumInfo
(
const
QStringList
&
strings
,
const
QVariantList
&
values
);
void
setEnumInfo
(
const
QStringList
&
strings
,
const
QVariantList
&
values
);
void
setGroup
(
const
QString
&
group
)
{
_group
=
group
;
}
void
setGroup
(
const
QString
&
group
)
{
_group
=
group
;
}
void
setLongDescription
(
const
QString
&
longDescription
)
{
_longDescription
=
longDescription
;}
void
setLongDescription
(
const
QString
&
longDescription
)
{
_longDescription
=
longDescription
;}
void
set
Max
(
const
QVariant
&
m
ax
);
void
set
RawMax
(
const
QVariant
&
rawM
ax
);
void
set
Min
(
const
QVariant
&
max
);
void
set
RawMin
(
const
QVariant
&
rawMin
);
void
setName
(
const
QString
&
name
)
{
_name
=
name
;
}
void
setName
(
const
QString
&
name
)
{
_name
=
name
;
}
void
setShortDescription
(
const
QString
&
shortDescription
)
{
_shortDescription
=
shortDescription
;
}
void
setShortDescription
(
const
QString
&
shortDescription
)
{
_shortDescription
=
shortDescription
;
}
void
set
Units
(
const
QString
&
units
)
{
_units
=
units
;
}
void
set
RawUnits
(
const
QString
&
rawUnits
);
void
setTranslators
(
Translator
rawTranslator
,
Translator
cookedTranslator
);
void
setTranslators
(
Translator
rawTranslator
,
Translator
cookedTranslator
);
static
QVariant
defaultTranslator
(
const
QVariant
&
from
)
{
return
from
;
}
/// Converts the specified value, validating against meta data
/// Converts the specified
raw
value, validating against meta data
/// @param
v
alue Value to convert, can be string
/// @param
rawV
alue Value to convert, can be string
/// @param convertOnly true: convert to correct type only, do not validate against meta data
/// @param convertOnly true: convert to correct type only, do not validate against meta data
/// @param typeValue Converted value, correctly typed
/// @param typeValue Converted value, correctly typed
/// @param errorString Error string if convert fails
/// @param errorString Error string if convert fails
, values are cooked values since user visible
/// @returns false: Convert failed, errorString set
/// @returns false: Convert failed, errorString set
bool
convertAndValidate
(
const
QVariant
&
value
,
bool
convertOnly
,
QVariant
&
typedValue
,
QString
&
errorString
);
bool
convertAndValidateRaw
(
const
QVariant
&
rawValue
,
bool
convertOnly
,
QVariant
&
typedValue
,
QString
&
errorString
);
/// Same as convertAndValidateRaw except for cookedValue input
bool
convertAndValidateCooked
(
const
QVariant
&
cookedValue
,
bool
convertOnly
,
QVariant
&
typedValue
,
QString
&
errorString
);
static
const
int
defaultDecimalPlaces
=
3
;
static
const
int
defaultDecimalPlaces
=
3
;
private:
private:
QVariant
_minForType
(
void
)
const
;
QVariant
_minForType
(
void
)
const
;
QVariant
_maxForType
(
void
)
const
;
QVariant
_maxForType
(
void
)
const
;
void
_setBuiltInTranslator
(
void
);
// Built in translators
static
QVariant
_defaultTranslator
(
const
QVariant
&
from
)
{
return
from
;
}
static
QVariant
_degreesToRadians
(
const
QVariant
&
degrees
);
static
QVariant
_radiansToDegrees
(
const
QVariant
&
radians
);
static
QVariant
_centiDegreesToDegrees
(
const
QVariant
&
centiDegrees
);
static
QVariant
_degreesToCentiDegrees
(
const
QVariant
&
degrees
);
ValueType_t
_type
;
// must be first for correct constructor init
ValueType_t
_type
;
// must be first for correct constructor init
int
_decimalPlaces
;
int
_decimalPlaces
;
QVariant
_
d
efaultValue
;
QVariant
_
rawD
efaultValue
;
bool
_defaultValueAvailable
;
bool
_defaultValueAvailable
;
QStringList
_enumStrings
;
QStringList
_enumStrings
;
QVariantList
_enumValues
;
QVariantList
_enumValues
;
QString
_group
;
QString
_group
;
QString
_longDescription
;
QString
_longDescription
;
QVariant
_
m
ax
;
QVariant
_
rawM
ax
;
bool
_maxIsDefaultForType
;
bool
_maxIsDefaultForType
;
QVariant
_
m
in
;
QVariant
_
rawM
in
;
bool
_minIsDefaultForType
;
bool
_minIsDefaultForType
;
QString
_name
;
QString
_name
;
QString
_shortDescription
;
QString
_shortDescription
;
QString
_units
;
QString
_rawUnits
;
QString
_cookedUnits
;
Translator
_rawTranslator
;
Translator
_rawTranslator
;
Translator
_cookedTranslator
;
Translator
_cookedTranslator
;
struct
BuiltInTranslation_s
{
const
char
*
rawUnits
;
const
char
*
cookedUnits
;
Translator
rawTranslator
;
Translator
cookedTranslator
;
};
static
const
BuiltInTranslation_s
_rgBuildInTranslations
[];
};
};
#endif
#endif
src/FactSystem/ParameterLoader.cc
View file @
8dd3148d
...
@@ -721,7 +721,7 @@ void ParameterLoader::writeParametersToStream(QTextStream &stream)
...
@@ -721,7 +721,7 @@ void ParameterLoader::writeParametersToStream(QTextStream &stream)
Fact
*
fact
=
_mapParameterName2Variant
[
componentId
][
paramName
].
value
<
Fact
*>
();
Fact
*
fact
=
_mapParameterName2Variant
[
componentId
][
paramName
].
value
<
Fact
*>
();
Q_ASSERT
(
fact
);
Q_ASSERT
(
fact
);
stream
<<
_vehicle
->
id
()
<<
"
\t
"
<<
componentId
<<
"
\t
"
<<
paramName
<<
"
\t
"
<<
fact
->
v
alueString
()
<<
"
\t
"
<<
QString
(
"%1"
).
arg
(
_factTypeToMavType
(
fact
->
type
()))
<<
"
\n
"
;
stream
<<
_vehicle
->
id
()
<<
"
\t
"
<<
componentId
<<
"
\t
"
<<
paramName
<<
"
\t
"
<<
fact
->
rawV
alueString
()
<<
"
\t
"
<<
QString
(
"%1"
).
arg
(
_factTypeToMavType
(
fact
->
type
()))
<<
"
\n
"
;
}
}
}
}
...
...
src/FirmwarePlugin/APM/APMParameterMetaData.cc
View file @
8dd3148d
...
@@ -434,14 +434,14 @@ void APMParameterMetaData::addMetaDataToFact(Fact* fact, MAV_TYPE vehicleType)
...
@@ -434,14 +434,14 @@ void APMParameterMetaData::addMetaDataToFact(Fact* fact, MAV_TYPE vehicleType)
}
}
if
(
!
rawMetaData
->
units
.
isEmpty
())
{
if
(
!
rawMetaData
->
units
.
isEmpty
())
{
metaData
->
setUnits
(
rawMetaData
->
units
);
metaData
->
set
Raw
Units
(
rawMetaData
->
units
);
}
}
if
(
!
rawMetaData
->
min
.
isEmpty
())
{
if
(
!
rawMetaData
->
min
.
isEmpty
())
{
QVariant
varMin
;
QVariant
varMin
;
QString
errorString
;
QString
errorString
;
if
(
metaData
->
convertAndValidate
(
rawMetaData
->
min
,
false
/* validate as well */
,
varMin
,
errorString
))
{
if
(
metaData
->
convertAndValidate
Raw
(
rawMetaData
->
min
,
false
/* validate as well */
,
varMin
,
errorString
))
{
metaData
->
setMin
(
varMin
);
metaData
->
set
Raw
Min
(
varMin
);
}
else
{
}
else
{
qCDebug
(
APMParameterMetaDataLog
)
<<
"Invalid min value, name:"
<<
metaData
->
name
()
qCDebug
(
APMParameterMetaDataLog
)
<<
"Invalid min value, name:"
<<
metaData
->
name
()
<<
" type:"
<<
metaData
->
type
()
<<
" min:"
<<
rawMetaData
->
min
<<
" type:"
<<
metaData
->
type
()
<<
" min:"
<<
rawMetaData
->
min
...
@@ -452,8 +452,8 @@ void APMParameterMetaData::addMetaDataToFact(Fact* fact, MAV_TYPE vehicleType)
...
@@ -452,8 +452,8 @@ void APMParameterMetaData::addMetaDataToFact(Fact* fact, MAV_TYPE vehicleType)
if
(
!
rawMetaData
->
max
.
isEmpty
())
{
if
(
!
rawMetaData
->
max
.
isEmpty
())
{
QVariant
varMax
;
QVariant
varMax
;
QString
errorString
;
QString
errorString
;
if
(
metaData
->
convertAndValidate
(
rawMetaData
->
max
,
false
/* validate as well */
,
varMax
,
errorString
))
{
if
(
metaData
->
convertAndValidate
Raw
(
rawMetaData
->
max
,
false
/* validate as well */
,
varMax
,
errorString
))
{
metaData
->
setMax
(
varMax
);
metaData
->
set
Raw
Max
(
varMax
);
}
else
{
}
else
{
qCDebug
(
APMParameterMetaDataLog
)
<<
"Invalid max value, name:"
<<
metaData
->
name
()
<<
" type:"
qCDebug
(
APMParameterMetaDataLog
)
<<
"Invalid max value, name:"
<<
metaData
->
name
()
<<
" type:"
<<
metaData
->
type
()
<<
" max:"
<<
rawMetaData
->
max
<<
metaData
->
type
()
<<
" max:"
<<
rawMetaData
->
max
...
@@ -470,7 +470,7 @@ void APMParameterMetaData::addMetaDataToFact(Fact* fact, MAV_TYPE vehicleType)
...
@@ -470,7 +470,7 @@ void APMParameterMetaData::addMetaDataToFact(Fact* fact, MAV_TYPE vehicleType)
QString
errorString
;
QString
errorString
;
QPair
<
QString
,
QString
>
enumPair
=
rawMetaData
->
values
[
i
];
QPair
<
QString
,
QString
>
enumPair
=
rawMetaData
->
values
[
i
];
if
(
metaData
->
convertAndValidate
(
enumPair
.
first
,
false
/* validate */
,
enumValue
,
errorString
))
{
if
(
metaData
->
convertAndValidate
Raw
(
enumPair
.
first
,
false
/* validate */
,
enumValue
,
errorString
))
{
enumValues
<<
enumValue
;
enumValues
<<
enumValue
;
enumStrings
<<
enumPair
.
second
;
enumStrings
<<
enumPair
.
second
;
}
else
{
}
else
{
...
...
src/FirmwarePlugin/PX4/PX4ParameterMetaData.cc
View file @
8dd3148d
...
@@ -239,8 +239,8 @@ void PX4ParameterMetaData::_loadParameterFactMetaData(void)
...
@@ -239,8 +239,8 @@ void PX4ParameterMetaData::_loadParameterFactMetaData(void)
if
(
xml
.
attributes
().
hasAttribute
(
"default"
)
&&
!
strDefault
.
isEmpty
())
{
if
(
xml
.
attributes
().
hasAttribute
(
"default"
)
&&
!
strDefault
.
isEmpty
())
{
QVariant
varDefault
;
QVariant
varDefault
;
if
(
metaData
->
convertAndValidate
(
strDefault
,
false
,
varDefault
,
errorString
))
{
if
(
metaData
->
convertAndValidate
Raw
(
strDefault
,
false
,
varDefault
,
errorString
))
{
metaData
->
setDefaultValue
(
varDefault
);
metaData
->
set
Raw
DefaultValue
(
varDefault
);
}
else
{
}
else
{
qCWarning
(
PX4ParameterMetaDataLog
)
<<
"Invalid default value, name:"
<<
name
<<
" type:"
<<
type
<<
" default:"
<<
strDefault
<<
" error:"
<<
errorString
;
qCWarning
(
PX4ParameterMetaDataLog
)
<<
"Invalid default value, name:"
<<
name
<<
" type:"
<<
type
<<
" default:"
<<
strDefault
<<
" error:"
<<
errorString
;
}
}
...
@@ -275,8 +275,8 @@ void PX4ParameterMetaData::_loadParameterFactMetaData(void)
...
@@ -275,8 +275,8 @@ void PX4ParameterMetaData::_loadParameterFactMetaData(void)
qCDebug
(
PX4ParameterMetaDataLog
)
<<
"Min:"
<<
text
;
qCDebug
(
PX4ParameterMetaDataLog
)
<<
"Min:"
<<
text
;
QVariant
varMin
;
QVariant
varMin
;
if
(
metaData
->
convertAndValidate
(
text
,
true
/* convertOnly */
,
varMin
,
errorString
))
{
if
(
metaData
->
convertAndValidate
Raw
(
text
,
true
/* convertOnly */
,
varMin
,
errorString
))
{
metaData
->
setMin
(
varMin
);
metaData
->
set
Raw
Min
(
varMin
);
}
else
{
}
else
{
qCWarning
(
PX4ParameterMetaDataLog
)
<<
"Invalid min value, name:"
<<
metaData
->
name
()
<<
" type:"
<<
metaData
->
type
()
<<
" min:"
<<
text
<<
" error:"
<<
errorString
;
qCWarning
(
PX4ParameterMetaDataLog
)
<<
"Invalid min value, name:"
<<
metaData
->
name
()
<<
" type:"
<<
metaData
->
type
()
<<
" min:"
<<
text
<<
" error:"
<<
errorString
;
}
}
...
@@ -287,8 +287,8 @@ void PX4ParameterMetaData::_loadParameterFactMetaData(void)
...
@@ -287,8 +287,8 @@ void PX4ParameterMetaData::_loadParameterFactMetaData(void)
qCDebug
(
PX4ParameterMetaDataLog
)
<<
"Max:"
<<
text
;
qCDebug
(
PX4ParameterMetaDataLog
)
<<
"Max:"
<<
text
;
QVariant
varMax
;
QVariant
varMax
;
if
(
metaData
->
convertAndValidate
(
text
,
true
/* convertOnly */
,
varMax
,
errorString
))
{
if
(
metaData
->
convertAndValidate
Raw
(
text
,
true
/* convertOnly */
,
varMax
,
errorString
))
{
metaData
->
setMax
(
varMax
);
metaData
->
set
Raw
Max
(
varMax
);
}
else
{
}
else
{
qCWarning
(
PX4ParameterMetaDataLog
)
<<
"Invalid max value, name:"
<<
metaData
->
name
()
<<
" type:"
<<
metaData
->
type
()
<<
" max:"
<<
text
<<
" error:"
<<
errorString
;
qCWarning
(
PX4ParameterMetaDataLog
)
<<
"Invalid max value, name:"
<<
metaData
->
name
()
<<
" type:"
<<
metaData
->
type
()
<<
" max:"
<<
text
<<
" error:"
<<
errorString
;
}
}
...
@@ -297,7 +297,7 @@ void PX4ParameterMetaData::_loadParameterFactMetaData(void)
...
@@ -297,7 +297,7 @@ void PX4ParameterMetaData::_loadParameterFactMetaData(void)
Q_ASSERT
(
metaData
);
Q_ASSERT
(
metaData
);
QString
text
=
xml
.
readElementText
();
QString
text
=
xml
.
readElementText
();
qCDebug
(
PX4ParameterMetaDataLog
)
<<
"Unit:"
<<
text
;
qCDebug
(
PX4ParameterMetaDataLog
)
<<
"Unit:"
<<
text
;
metaData
->
setUnits
(
text
);
metaData
->
set
Raw
Units
(
text
);
}
else
if
(
elementName
==
"decimal"
)
{
}
else
if
(
elementName
==
"decimal"
)
{
Q_ASSERT
(
metaData
);
Q_ASSERT
(
metaData
);
...
@@ -325,8 +325,8 @@ void PX4ParameterMetaData::_loadParameterFactMetaData(void)
...
@@ -325,8 +325,8 @@ void PX4ParameterMetaData::_loadParameterFactMetaData(void)
if
(
metaData
->
defaultValueAvailable
())
{
if
(
metaData
->
defaultValueAvailable
())
{
QVariant
var
;
QVariant
var
;
if
(
!
metaData
->
convertAndValidate
(
metaData
->
d
efaultValue
(),
false
/* convertOnly */
,
var
,
errorString
))
{
if
(
!
metaData
->
convertAndValidate
Raw
(
metaData
->
rawD
efaultValue
(),
false
/* convertOnly */
,
var
,
errorString
))
{
qCWarning
(
PX4ParameterMetaDataLog
)
<<
"Invalid default value, name:"
<<
metaData
->
name
()
<<
" type:"
<<
metaData
->
type
()
<<
" default:"
<<
metaData
->
d
efaultValue
()
<<
" error:"
<<
errorString
;
qCWarning
(
PX4ParameterMetaDataLog
)
<<
"Invalid default value, name:"
<<
metaData
->
name
()
<<
" type:"
<<
metaData
->
type
()
<<
" default:"
<<
metaData
->
rawD
efaultValue
()
<<
" error:"
<<
errorString
;
}
}
}
}
...
...
src/MissionManager/MavCmdInfo.json
View file @
8dd3148d
...
@@ -113,7 +113,7 @@
...
@@ -113,7 +113,7 @@
},
},
"param4"
:
{
"param4"
:
{
"label"
:
"Heading:"
,
"label"
:
"Heading:"
,
"units"
:
"
degreesConvert
"
,
"units"
:
"
radians
"
,
"default"
:
0.0
,
"default"
:
0.0
,
"decimalPlaces"
:
2
"decimalPlaces"
:
2
}
}
...
@@ -128,13 +128,13 @@
...
@@ -128,13 +128,13 @@
"category"
:
"Basic"
,
"category"
:
"Basic"
,
"param1"
:
{
"param1"
:
{
"label"
:
"Pitch:"
,
"label"
:
"Pitch:"
,
"units"
:
"
degreesConvert
"
,
"units"
:
"
radians
"
,
"default"
:
0.26179939
,
"default"
:
0.26179939
,
"decimalPlaces"
:
2
"decimalPlaces"
:
2
},
},
"param4"
:
{
"param4"
:
{
"label"
:
"Heading:"
,
"label"
:
"Heading:"
,
"units"
:
"
degreesConvert
"
,
"units"
:
"
radians
"
,
"default"
:
0.0
,
"default"
:
0.0
,
"decimalPlaces"
:
2
"decimalPlaces"
:
2
}
}
...
...
src/MissionManager/MissionCommands.cc
View file @
8dd3148d
...
@@ -58,9 +58,6 @@ const QString MissionCommands::_specifiesCoordinateJsonKey (QStringLiteral("spe
...
@@ -58,9 +58,6 @@ const QString MissionCommands::_specifiesCoordinateJsonKey (QStringLiteral("spe
const
QString
MissionCommands
::
_unitsJsonKey
(
QStringLiteral
(
"units"
));
const
QString
MissionCommands
::
_unitsJsonKey
(
QStringLiteral
(
"units"
));
const
QString
MissionCommands
::
_versionJsonKey
(
QStringLiteral
(
"version"
));
const
QString
MissionCommands
::
_versionJsonKey
(
QStringLiteral
(
"version"
));
const
QString
MissionCommands
::
_degreesConvertUnits
(
QStringLiteral
(
"degreesConvert"
));
const
QString
MissionCommands
::
_degreesUnits
(
QStringLiteral
(
"degrees"
));
MissionCommands
::
MissionCommands
(
QGCApplication
*
app
)
MissionCommands
::
MissionCommands
(
QGCApplication
*
app
)
:
QGCTool
(
app
)
:
QGCTool
(
app
)
{
{
...
...
src/MissionManager/MissionCommands.h
View file @
8dd3148d
...
@@ -139,9 +139,6 @@ public:
...
@@ -139,9 +139,6 @@ public:
// Overrides from QGCTool
// Overrides from QGCTool
virtual
void
setToolbox
(
QGCToolbox
*
toolbox
);
virtual
void
setToolbox
(
QGCToolbox
*
toolbox
);
static
const
QString
_degreesUnits
;
static
const
QString
_degreesConvertUnits
;
signals:
signals:
private:
private:
...
...
src/MissionManager/MissionItem.cc
View file @
8dd3148d
...
@@ -309,7 +309,7 @@ void MissionItem::_setupMetaData(void)
...
@@ -309,7 +309,7 @@ void MissionItem::_setupMetaData(void)
if
(
!
_altitudeMetaData
)
{
if
(
!
_altitudeMetaData
)
{
_altitudeMetaData
=
new
FactMetaData
(
FactMetaData
::
valueTypeDouble
);
_altitudeMetaData
=
new
FactMetaData
(
FactMetaData
::
valueTypeDouble
);
_altitudeMetaData
->
setUnits
(
"meters"
);
_altitudeMetaData
->
set
Raw
Units
(
"meters"
);
_altitudeMetaData
->
setDecimalPlaces
(
3
);
_altitudeMetaData
->
setDecimalPlaces
(
3
);
enumStrings
.
clear
();
enumStrings
.
clear
();
...
@@ -336,11 +336,11 @@ void MissionItem::_setupMetaData(void)
...
@@ -336,11 +336,11 @@ void MissionItem::_setupMetaData(void)
_frameMetaData
->
setEnumInfo
(
enumStrings
,
enumValues
);
_frameMetaData
->
setEnumInfo
(
enumStrings
,
enumValues
);
_latitudeMetaData
=
new
FactMetaData
(
FactMetaData
::
valueTypeDouble
);
_latitudeMetaData
=
new
FactMetaData
(
FactMetaData
::
valueTypeDouble
);
_latitudeMetaData
->
setUnits
(
"deg"
);
_latitudeMetaData
->
set
Raw
Units
(
"deg"
);
_latitudeMetaData
->
setDecimalPlaces
(
7
);
_latitudeMetaData
->
setDecimalPlaces
(
7
);
_longitudeMetaData
=
new
FactMetaData
(
FactMetaData
::
valueTypeDouble
);
_longitudeMetaData
=
new
FactMetaData
(
FactMetaData
::
valueTypeDouble
);
_longitudeMetaData
->
setUnits
(
"deg"
);
_longitudeMetaData
->
set
Raw
Units
(
"deg"
);
_longitudeMetaData
->
setDecimalPlaces
(
7
);
_longitudeMetaData
->
setDecimalPlaces
(
7
);
}
}
...
@@ -516,18 +516,14 @@ QString MissionItem::commandDescription(void) const
...
@@ -516,18 +516,14 @@ QString MissionItem::commandDescription(void) const
void
MissionItem
::
_clearParamMetaData
(
void
)
void
MissionItem
::
_clearParamMetaData
(
void
)
{
{
_param1MetaData
.
setUnits
(
""
);
_param1MetaData
.
set
Raw
Units
(
""
);
_param1MetaData
.
setDecimalPlaces
(
FactMetaData
::
defaultDecimalPlaces
);
_param1MetaData
.
setDecimalPlaces
(
FactMetaData
::
defaultDecimalPlaces
);
_param1MetaData
.
setTranslators
(
FactMetaData
::
defaultTranslator
,
FactMetaData
::
defaultTranslator
);
_param2MetaData
.
setRawUnits
(
""
);
_param2MetaData
.
setUnits
(
""
);
_param2MetaData
.
setDecimalPlaces
(
FactMetaData
::
defaultDecimalPlaces
);
_param2MetaData
.
setDecimalPlaces
(
FactMetaData
::
defaultDecimalPlaces
);
_param2MetaData
.
setTranslators
(
FactMetaData
::
defaultTranslator
,
FactMetaData
::
defaultTranslator
);
_param3MetaData
.
setRawUnits
(
""
);
_param3MetaData
.
setUnits
(
""
);
_param3MetaData
.
setDecimalPlaces
(
FactMetaData
::
defaultDecimalPlaces
);
_param3MetaData
.
setDecimalPlaces
(
FactMetaData
::
defaultDecimalPlaces
);
_param3MetaData
.
setTranslators
(
FactMetaData
::
defaultTranslator
,
FactMetaData
::
defaultTranslator
);
_param4MetaData
.
setRawUnits
(
""
);
_param4MetaData
.
setUnits
(
""
);
_param4MetaData
.
setDecimalPlaces
(
FactMetaData
::
defaultDecimalPlaces
);
_param4MetaData
.
setDecimalPlaces
(
FactMetaData
::
defaultDecimalPlaces
);
_param4MetaData
.
setTranslators
(
FactMetaData
::
defaultTranslator
,
FactMetaData
::
defaultTranslator
);
}
}
QmlObjectListModel
*
MissionItem
::
textFieldFacts
(
void
)
QmlObjectListModel
*
MissionItem
::
textFieldFacts
(
void
)
...
@@ -575,12 +571,7 @@ QmlObjectListModel* MissionItem::textFieldFacts(void)
...
@@ -575,12 +571,7 @@ QmlObjectListModel* MissionItem::textFieldFacts(void)
paramFact
->
_setName
(
paramInfo
->
label
());
paramFact
->
_setName
(
paramInfo
->
label
());
paramMetaData
->
setDecimalPlaces
(
paramInfo
->
decimalPlaces
());
paramMetaData
->
setDecimalPlaces
(
paramInfo
->
decimalPlaces
());
paramMetaData
->
setEnumInfo
(
paramInfo
->
enumStrings
(),
paramInfo
->
enumValues
());
paramMetaData
->
setEnumInfo
(
paramInfo
->
enumStrings
(),
paramInfo
->
enumValues
());
if
(
paramInfo
->
units
()
==
MissionCommands
::
_degreesConvertUnits
)
{
paramMetaData
->
setRawUnits
(
paramInfo
->
units
());
paramMetaData
->
setTranslators
(
_radiansToDegrees
,
_degreesToRadians
);
paramMetaData
->
setUnits
(
MissionCommands
::
_degreesUnits
);
}
else
{
paramMetaData
->
setUnits
(
paramInfo
->
units
());
}
paramFact
->
setMetaData
(
paramMetaData
);
paramFact
->
setMetaData
(
paramMetaData
);
model
->
append
(
paramFact
);
model
->
append
(
paramFact
);
}
}
...
@@ -634,12 +625,7 @@ QmlObjectListModel* MissionItem::comboboxFacts(void)
...
@@ -634,12 +625,7 @@ QmlObjectListModel* MissionItem::comboboxFacts(void)
paramFact
->
_setName
(
paramInfo
->
label
());
paramFact
->
_setName
(
paramInfo
->
label
());
paramMetaData
->
setDecimalPlaces
(
paramInfo
->
decimalPlaces
());
paramMetaData
->
setDecimalPlaces
(
paramInfo
->
decimalPlaces
());
paramMetaData
->
setEnumInfo
(
paramInfo
->
enumStrings
(),
paramInfo
->
enumValues
());
paramMetaData
->
setEnumInfo
(
paramInfo
->
enumStrings
(),
paramInfo
->
enumValues
());
if
(
paramInfo
->
units
()
==
MissionCommands
::
_degreesConvertUnits
)
{
paramMetaData
->
setRawUnits
(
paramInfo
->
units
());
paramMetaData
->
setTranslators
(
_radiansToDegrees
,
_degreesToRadians
);
paramMetaData
->
setUnits
(
MissionCommands
::
_degreesUnits
);
}
else
{
paramMetaData
->
setUnits
(
paramInfo
->
units
());
}
paramFact
->
setMetaData
(
paramMetaData
);
paramFact
->
setMetaData
(
paramMetaData
);
model
->
append
(
paramFact
);
model
->
append
(
paramFact
);
}
}
...
@@ -804,16 +790,6 @@ QString MissionItem::commandName(void) const
...
@@ -804,16 +790,6 @@ QString MissionItem::commandName(void) const
}
}
}
}
QVariant
MissionItem
::
_degreesToRadians
(
const
QVariant
&
degrees
)
{
return
QVariant
(
degrees
.
toDouble
()
*
(
M_PI
/
180.0
));
}
QVariant
MissionItem
::
_radiansToDegrees
(
const
QVariant
&
radians
)
{
return
QVariant
(
radians
.
toDouble
()
*
(
180
/
M_PI
));
}
void
MissionItem
::
_sendFriendlyEditAllowedChanged
(
void
)
void
MissionItem
::
_sendFriendlyEditAllowedChanged
(
void
)
{
{
emit
friendlyEditAllowedChanged
(
friendlyEditAllowed
());
emit
friendlyEditAllowedChanged
(
friendlyEditAllowed
());
...
...
src/MissionManager/MissionItem.h
View file @
8dd3148d
...
@@ -211,9 +211,6 @@ private:
...
@@ -211,9 +211,6 @@ private:
void
_connectSignals
(
void
);
void
_connectSignals
(
void
);
void
_setupMetaData
(
void
);
void
_setupMetaData
(
void
);
static
QVariant
_degreesToRadians
(
const
QVariant
&
degrees
);
static
QVariant
_radiansToDegrees
(
const
QVariant
&
radians
);
private:
private:
bool
_rawEdit
;
bool
_rawEdit
;
bool
_dirty
;
bool
_dirty
;
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment