|
|
@ -26,6 +26,7 @@ ParameterEditorController::ParameterEditorController(void) |
|
|
|
, _parameters (new QmlObjectListModel(this)) |
|
|
|
, _parameters (new QmlObjectListModel(this)) |
|
|
|
, _parameterMgr (_vehicle->parameterManager()) |
|
|
|
, _parameterMgr (_vehicle->parameterManager()) |
|
|
|
, _componentCategoryPrefix (tr("Component ")) |
|
|
|
, _componentCategoryPrefix (tr("Component ")) |
|
|
|
|
|
|
|
, _showModifiedOnly (false) |
|
|
|
{ |
|
|
|
{ |
|
|
|
const QMap<QString, QMap<QString, QStringList> >& categoryMap = _parameterMgr->getDefaultComponentCategoryMap(); |
|
|
|
const QMap<QString, QMap<QString, QStringList> >& categoryMap = _parameterMgr->getDefaultComponentCategoryMap(); |
|
|
|
_categories = categoryMap.keys(); |
|
|
|
_categories = categoryMap.keys(); |
|
|
@ -50,6 +51,7 @@ ParameterEditorController::ParameterEditorController(void) |
|
|
|
connect(this, &ParameterEditorController::searchTextChanged, this, &ParameterEditorController::_updateParameters); |
|
|
|
connect(this, &ParameterEditorController::searchTextChanged, this, &ParameterEditorController::_updateParameters); |
|
|
|
connect(this, &ParameterEditorController::currentCategoryChanged, this, &ParameterEditorController::_updateParameters); |
|
|
|
connect(this, &ParameterEditorController::currentCategoryChanged, this, &ParameterEditorController::_updateParameters); |
|
|
|
connect(this, &ParameterEditorController::currentGroupChanged, this, &ParameterEditorController::_updateParameters); |
|
|
|
connect(this, &ParameterEditorController::currentGroupChanged, this, &ParameterEditorController::_updateParameters); |
|
|
|
|
|
|
|
connect(this, &ParameterEditorController::showModifiedOnlyChanged, this, &ParameterEditorController::_updateParameters); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
ParameterEditorController::~ParameterEditorController() |
|
|
|
ParameterEditorController::~ParameterEditorController() |
|
|
@ -163,12 +165,18 @@ void ParameterEditorController::setRCToParam(const QString& paramName) |
|
|
|
#endif |
|
|
|
#endif |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
bool ParameterEditorController::_shouldShow(Fact* fact) |
|
|
|
|
|
|
|
{ |
|
|
|
|
|
|
|
bool show = _showModifiedOnly ? (fact->defaultValueAvailable() ? (fact->valueEqualsDefault() ? false : true) : false) : true; |
|
|
|
|
|
|
|
return show; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
void ParameterEditorController::_updateParameters(void) |
|
|
|
void ParameterEditorController::_updateParameters(void) |
|
|
|
{ |
|
|
|
{ |
|
|
|
QObjectList newParameterList; |
|
|
|
QObjectList newParameterList; |
|
|
|
QStringList searchItems = _searchText.split(' ', QString::SkipEmptyParts); |
|
|
|
QStringList searchItems = _searchText.split(' ', QString::SkipEmptyParts); |
|
|
|
|
|
|
|
|
|
|
|
if (searchItems.isEmpty()) { |
|
|
|
if (searchItems.isEmpty() && !_showModifiedOnly) { |
|
|
|
if (_currentCategory.startsWith(_componentCategoryPrefix)) { |
|
|
|
if (_currentCategory.startsWith(_componentCategoryPrefix)) { |
|
|
|
int compId = _currentCategory.right(_currentCategory.length() - _componentCategoryPrefix.length()).toInt(); |
|
|
|
int compId = _currentCategory.right(_currentCategory.length() - _componentCategoryPrefix.length()).toInt(); |
|
|
|
for (const QString& paramName: _parameterMgr->parameterNames(compId)) { |
|
|
|
for (const QString& paramName: _parameterMgr->parameterNames(compId)) { |
|
|
@ -184,9 +192,9 @@ void ParameterEditorController::_updateParameters(void) |
|
|
|
} else { |
|
|
|
} else { |
|
|
|
for(const QString ¶meter: _parameterMgr->parameterNames(_vehicle->defaultComponentId())) { |
|
|
|
for(const QString ¶meter: _parameterMgr->parameterNames(_vehicle->defaultComponentId())) { |
|
|
|
Fact* fact = _parameterMgr->getParameter(_vehicle->defaultComponentId(), parameter); |
|
|
|
Fact* fact = _parameterMgr->getParameter(_vehicle->defaultComponentId(), parameter); |
|
|
|
bool matched = true; |
|
|
|
bool matched = _shouldShow(fact); |
|
|
|
|
|
|
|
// All of the search items must match in order for the parameter to be added to the list
|
|
|
|
// all of the search items must match in order for the parameter to be added to the list
|
|
|
|
if(matched) { |
|
|
|
for (const auto& searchItem : searchItems) { |
|
|
|
for (const auto& searchItem : searchItems) { |
|
|
|
if (!fact->name().contains(searchItem, Qt::CaseInsensitive) && |
|
|
|
if (!fact->name().contains(searchItem, Qt::CaseInsensitive) && |
|
|
|
!fact->shortDescription().contains(searchItem, Qt::CaseInsensitive) && |
|
|
|
!fact->shortDescription().contains(searchItem, Qt::CaseInsensitive) && |
|
|
@ -194,6 +202,7 @@ void ParameterEditorController::_updateParameters(void) |
|
|
|
matched = false; |
|
|
|
matched = false; |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
if (matched) { |
|
|
|
if (matched) { |
|
|
|
newParameterList.append(fact); |
|
|
|
newParameterList.append(fact); |
|
|
|
} |
|
|
|
} |
|
|
|