Commit c4052eac authored by Gus Grubba's avatar Gus Grubba

Add option to ignore camel case in FactGroup.

parent ef99212f
......@@ -154,7 +154,7 @@ read_value(QDomNode& element, const char* tagName, QString& target)
//-----------------------------------------------------------------------------
QGCCameraControl::QGCCameraControl(const mavlink_camera_information_t *info, Vehicle* vehicle, int compID, QObject* parent)
: FactGroup(0, parent)
: FactGroup(0, parent, true /* ignore camel case */)
, _vehicle(vehicle)
, _compID(compID)
{
......
......@@ -20,17 +20,19 @@
QGC_LOGGING_CATEGORY(FactGroupLog, "FactGroupLog")
FactGroup::FactGroup(int updateRateMsecs, const QString& metaDataFile, QObject* parent)
FactGroup::FactGroup(int updateRateMsecs, const QString& metaDataFile, QObject* parent, bool ignoreCamelCase)
: QObject(parent)
, _updateRateMSecs(updateRateMsecs)
, _ignoreCamelCase(ignoreCamelCase)
{
_setupTimer();
_nameToFactMetaDataMap = FactMetaData::createMapFromJsonFile(metaDataFile, this);
}
FactGroup::FactGroup(int updateRateMsecs, QObject* parent)
FactGroup::FactGroup(int updateRateMsecs, QObject* parent, bool ignoreCamelCase)
: QObject(parent)
, _updateRateMSecs(updateRateMsecs)
, _ignoreCamelCase(ignoreCamelCase)
{
_setupTimer();
}
......@@ -70,7 +72,7 @@ Fact* FactGroup::getFact(const QString& name)
}
Fact* fact = nullptr;
QString camelCaseName = _camelCase(name);
QString camelCaseName = _ignoreCamelCase ? name : _camelCase(name);
if (_nameToFactMap.contains(camelCaseName)) {
fact = _nameToFactMap[camelCaseName];
......@@ -85,7 +87,7 @@ Fact* FactGroup::getFact(const QString& name)
FactGroup* FactGroup::getFactGroup(const QString& name)
{
FactGroup* factGroup = nullptr;
QString camelCaseName = _camelCase(name);
QString camelCaseName = _ignoreCamelCase ? name : _camelCase(name);
if (_nameToFactGroupMap.contains(camelCaseName)) {
factGroup = _nameToFactGroupMap[camelCaseName];
......
......@@ -26,8 +26,8 @@ class FactGroup : public QObject
Q_OBJECT
public:
FactGroup(int updateRateMsecs, const QString& metaDataFile, QObject* parent = nullptr);
FactGroup(int updateRateMsecs, QObject* parent = nullptr);
FactGroup(int updateRateMsecs, const QString& metaDataFile, QObject* parent = nullptr, bool ignoreCamelCase = false);
FactGroup(int updateRateMsecs, QObject* parent = nullptr, bool ignoreCamelCase = false);
Q_PROPERTY(QStringList factNames READ factNames CONSTANT)
Q_PROPERTY(QStringList factGroupNames READ factGroupNames CONSTANT)
......@@ -63,6 +63,7 @@ private:
void _setupTimer (void);
QString _camelCase (const QString& text);
bool _ignoreCamelCase = false;
QTimer _updateTimer;
};
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment