Commit 87865088 authored by Don Gagne's avatar Don Gagne

Parameter search support

parent 3a66b7ce
......@@ -157,9 +157,9 @@ Fact* AutoPilotPlugin::getFact(FactSystem::Provider_t provider, int componentId,
return NULL;
}
QStringList AutoPilotPlugin::parameterNames(void)
QStringList AutoPilotPlugin::parameterNames(int componentId)
{
return _getParameterLoader()->parameterNames();
return _getParameterLoader()->parameterNames(componentId);
}
const QMap<int, QMap<QString, QStringList> >& AutoPilotPlugin::getGroupMap(void)
......
......@@ -81,8 +81,7 @@ public:
Q_INVOKABLE bool parameterExists(int componentId, const QString& name);
/// Returns all parameter names
/// FIXME: component id missing, generic to fact
QStringList parameterNames(void);
QStringList parameterNames(int componentId);
/// Returns the specified parameter Fact from the default component
/// WARNING: Returns a default Fact if parameter does not exists. If that possibility exists, check for existince first with
......
......@@ -387,11 +387,11 @@ Fact* ParameterLoader::getFact(int componentId, const QString& name)
return _mapParameterName2Variant[componentId][name].value<Fact*>();
}
QStringList ParameterLoader::parameterNames(void)
QStringList ParameterLoader::parameterNames(int componentId)
{
QStringList names;
foreach(QString paramName, _mapParameterName2Variant[_defaultComponentId].keys()) {
foreach(QString paramName, _mapParameterName2Variant[_actualComponentId(componentId)].keys()) {
names << paramName;
}
......
......@@ -69,8 +69,7 @@ public:
const QString& name); ///< fact name
/// Returns all parameter names
/// FIXME: component id missing
QStringList parameterNames(void);
QStringList parameterNames(int componentId);
/// Returns the specified Fact.
/// WARNING: Will assert if parameter does not exists. If that possibily exists, check for existince first with
......
This diff is collapsed.
......@@ -53,13 +53,35 @@ QStringList ParameterEditorController::getGroupsForComponent(int componentId)
return groupMap[componentId].keys();
}
QStringList ParameterEditorController::getFactsForGroup(int componentId, QString group)
QStringList ParameterEditorController::getParametersForGroup(int componentId, QString group)
{
const QMap<int, QMap<QString, QStringList> >& groupMap = _autopilot->getGroupMap();
return groupMap[componentId][group];
}
QStringList ParameterEditorController::searchParametersForComponent(int componentId, const QString& searchText, bool searchInName, bool searchInDescriptions)
{
QStringList list;
foreach(QString paramName, _autopilot->parameterNames(componentId)) {
if (searchText.isEmpty()) {
list += paramName;
} else {
Fact* fact = _autopilot->getParameterFact(componentId, paramName);
if (searchInName && fact->name().contains(searchText, Qt::CaseInsensitive)) {
list += paramName;
} else if (searchInDescriptions && (fact->shortDescription().contains(searchText, Qt::CaseInsensitive) || fact->longDescription().contains(searchText, Qt::CaseInsensitive))) {
list += paramName;
}
}
}
list.sort();
return list;
}
void ParameterEditorController::clearRCToParam(void)
{
Q_ASSERT(_uas);
......
......@@ -45,7 +45,8 @@ public:
Q_PROPERTY(QStringList componentIds MEMBER _componentIds CONSTANT)
Q_INVOKABLE QStringList getGroupsForComponent(int componentId);
Q_INVOKABLE QStringList getFactsForGroup(int componentId, QString group);
Q_INVOKABLE QStringList getParametersForGroup(int componentId, QString group);
Q_INVOKABLE QStringList searchParametersForComponent(int componentId, const QString& searchText, bool searchInName, bool searchInDescriptions);
Q_INVOKABLE void clearRCToParam(void);
Q_INVOKABLE void saveToFile(void);
......
......@@ -106,6 +106,9 @@ FactPanel {
} else if (buttons & StandardButton.Abort) {
__rejectButton.text = "Abort"
__rejectButton.visible = true
} else if (buttons & StandardButton.Reset) {
__rejectButton.text = "Reset"
__rejectButton.visible = true
}
}
......
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