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
fee0d4d1
Unverified
Commit
fee0d4d1
authored
Jan 12, 2018
by
Don Gagne
Committed by
GitHub
Jan 12, 2018
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #6001 from mavlink/factMetadataCrash
Fixed crash in FactMetadata constructor.
parents
2af0422b
db27a9ea
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
30 additions
and
23 deletions
+30
-23
FactMetaData.cc
src/FactSystem/FactMetaData.cc
+24
-17
FactMetaData.h
src/FactSystem/FactMetaData.h
+5
-5
APMParameterMetaData.cc
src/FirmwarePlugin/APM/APMParameterMetaData.cc
+1
-1
No files found.
src/FactSystem/FactMetaData.cc
View file @
fee0d4d1
...
...
@@ -32,8 +32,8 @@ const qreal FactMetaData::UnitConsts_s::milesToMeters = 1609.344;
const
qreal
FactMetaData
::
UnitConsts_s
::
feetToMeters
=
0.3048
;
const
qreal
FactMetaData
::
UnitConsts_s
::
inchesToCentimeters
=
2.54
;
const
QString
FactMetaData
::
defaultCategory
=
tr
(
"Other"
);
const
QString
FactMetaData
::
defaultGroup
=
tr
(
"Misc"
);
static
const
char
*
kDefaultCategory
=
QT_TRANSLATE_NOOP
(
"FactMetaData"
,
"Other"
);
static
const
char
*
kDefaultGroup
=
QT_TRANSLATE_NOOP
(
"FactMetaData"
,
"Misc"
);
// Built in translations for all Facts
const
FactMetaData
::
BuiltInTranslation_s
FactMetaData
::
_rgBuiltInTranslations
[]
=
{
...
...
@@ -84,8 +84,6 @@ FactMetaData::FactMetaData(QObject* parent)
,
_decimalPlaces
(
unknownDecimalPlaces
)
,
_rawDefaultValue
(
0
)
,
_defaultValueAvailable
(
false
)
,
_category
(
defaultCategory
)
,
_group
(
defaultGroup
)
,
_rawMax
(
_maxForType
())
,
_maxIsDefaultForType
(
true
)
,
_rawMin
(
_minForType
())
...
...
@@ -97,7 +95,8 @@ FactMetaData::FactMetaData(QObject* parent)
,
_hasControl
(
true
)
,
_readOnly
(
false
)
{
_category
=
kDefaultCategory
;
_group
=
kDefaultGroup
;
}
FactMetaData
::
FactMetaData
(
ValueType_t
type
,
QObject
*
parent
)
...
...
@@ -106,8 +105,6 @@ FactMetaData::FactMetaData(ValueType_t type, QObject* parent)
,
_decimalPlaces
(
unknownDecimalPlaces
)
,
_rawDefaultValue
(
0
)
,
_defaultValueAvailable
(
false
)
,
_category
(
defaultCategory
)
,
_group
(
defaultGroup
)
,
_rawMax
(
_maxForType
())
,
_maxIsDefaultForType
(
true
)
,
_rawMin
(
_minForType
())
...
...
@@ -119,7 +116,8 @@ FactMetaData::FactMetaData(ValueType_t type, QObject* parent)
,
_hasControl
(
true
)
,
_readOnly
(
false
)
{
_category
=
kDefaultCategory
;
_group
=
kDefaultGroup
;
}
FactMetaData
::
FactMetaData
(
const
FactMetaData
&
other
,
QObject
*
parent
)
...
...
@@ -134,8 +132,6 @@ FactMetaData::FactMetaData(ValueType_t type, const QString name, QObject* parent
,
_decimalPlaces
(
unknownDecimalPlaces
)
,
_rawDefaultValue
(
0
)
,
_defaultValueAvailable
(
false
)
,
_category
(
defaultCategory
)
,
_group
(
defaultGroup
)
,
_rawMax
(
_maxForType
())
,
_maxIsDefaultForType
(
true
)
,
_rawMin
(
_minForType
())
...
...
@@ -148,7 +144,8 @@ FactMetaData::FactMetaData(ValueType_t type, const QString name, QObject* parent
,
_hasControl
(
true
)
,
_readOnly
(
false
)
{
_category
=
kDefaultCategory
;
_group
=
kDefaultGroup
;
}
const
FactMetaData
&
FactMetaData
::
operator
=
(
const
FactMetaData
&
other
)
...
...
@@ -181,6 +178,16 @@ const FactMetaData& FactMetaData::operator=(const FactMetaData& other)
return
*
this
;
}
const
QString
FactMetaData
::
defaultCategory
()
{
return
QString
(
kDefaultCategory
);
}
const
QString
FactMetaData
::
defaultGroup
()
{
return
QString
(
kDefaultGroup
);
}
QVariant
FactMetaData
::
rawDefaultValue
(
void
)
const
{
if
(
_defaultValueAvailable
)
{
...
...
@@ -253,7 +260,7 @@ QVariant FactMetaData::_minForType(void) const
case
valueTypeCustom
:
return
QVariant
();
}
// Make windows compiler happy, even switch is full cased
return
QVariant
();
}
...
...
@@ -285,7 +292,7 @@ QVariant FactMetaData::_maxForType(void) const
case
valueTypeCustom
:
return
QVariant
();
}
// Make windows compiler happy, even switch is full cased
return
QVariant
();
}
...
...
@@ -293,9 +300,9 @@ QVariant FactMetaData::_maxForType(void) const
bool
FactMetaData
::
convertAndValidateRaw
(
const
QVariant
&
rawValue
,
bool
convertOnly
,
QVariant
&
typedValue
,
QString
&
errorString
)
{
bool
convertOk
=
false
;
errorString
.
clear
();
switch
(
type
())
{
case
FactMetaData
:
:
valueTypeInt8
:
case
FactMetaData
:
:
valueTypeInt16
:
...
...
@@ -347,11 +354,11 @@ bool FactMetaData::convertAndValidateRaw(const QVariant& rawValue, bool convertO
typedValue
=
QVariant
(
rawValue
.
toByteArray
());
break
;
}
if
(
!
convertOk
)
{
errorString
+=
tr
(
"Invalid number"
);
}
return
convertOk
&&
errorString
.
isEmpty
();
}
...
...
src/FactSystem/FactMetaData.h
View file @
fee0d4d1
...
...
@@ -27,7 +27,7 @@
class
FactMetaData
:
public
QObject
{
Q_OBJECT
public:
typedef
enum
{
valueTypeUint8
,
...
...
@@ -45,7 +45,7 @@ public:
}
ValueType_t
;
typedef
QVariant
(
*
Translator
)(
const
QVariant
&
from
);
FactMetaData
(
QObject
*
parent
=
NULL
);
FactMetaData
(
ValueType_t
type
,
QObject
*
parent
=
NULL
);
FactMetaData
(
ValueType_t
type
,
const
QString
name
,
QObject
*
parent
=
NULL
);
...
...
@@ -76,6 +76,9 @@ public:
/// Returns the string for distance units which has configued by user
static
QString
appSettingsAreaUnitsString
(
void
);
static
const
QString
defaultCategory
();
static
const
QString
defaultGroup
();
int
decimalPlaces
(
void
)
const
;
QVariant
rawDefaultValue
(
void
)
const
;
QVariant
cookedDefaultValue
(
void
)
const
{
return
_rawTranslator
(
rawDefaultValue
());
}
...
...
@@ -160,9 +163,6 @@ public:
static
ValueType_t
stringToType
(
const
QString
&
typeString
,
bool
&
unknownType
);
static
size_t
typeToSize
(
ValueType_t
type
);
static
const
QString
defaultCategory
;
static
const
QString
defaultGroup
;
private:
QVariant
_minForType
(
void
)
const
;
QVariant
_maxForType
(
void
)
const
;
...
...
src/FirmwarePlugin/APM/APMParameterMetaData.cc
View file @
fee0d4d1
...
...
@@ -306,7 +306,7 @@ void APMParameterMetaData::correctGroupMemberships(ParameterNametoFactMetaDataMa
foreach
(
const
QString
&
groupName
,
groupMembers
.
keys
())
{
if
(
groupMembers
[
groupName
].
count
()
==
1
)
{
foreach
(
const
QString
&
parameter
,
groupMembers
.
value
(
groupName
))
{
parameterToFactMetaDataMap
[
parameter
]
->
group
=
FactMetaData
::
defaultGroup
;
parameterToFactMetaDataMap
[
parameter
]
->
group
=
FactMetaData
::
defaultGroup
()
;
}
}
}
...
...
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