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
87865088
Commit
87865088
authored
Sep 25, 2015
by
Don Gagne
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Parameter search support
parent
3a66b7ce
Changes
8
Hide whitespace changes
Inline
Side-by-side
Showing
8 changed files
with
210 additions
and
95 deletions
+210
-95
AutoPilotPlugin.cc
src/AutoPilotPlugins/AutoPilotPlugin.cc
+2
-2
AutoPilotPlugin.h
src/AutoPilotPlugins/AutoPilotPlugin.h
+1
-2
ParameterLoader.cc
src/FactSystem/ParameterLoader.cc
+2
-2
ParameterLoader.h
src/FactSystem/ParameterLoader.h
+1
-2
ParameterEditor.qml
src/QmlControls/ParameterEditor.qml
+176
-85
ParameterEditorController.cc
src/QmlControls/ParameterEditorController.cc
+23
-1
ParameterEditorController.h
src/QmlControls/ParameterEditorController.h
+2
-1
QGCView.qml
src/QmlControls/QGCView.qml
+3
-0
No files found.
src/AutoPilotPlugins/AutoPilotPlugin.cc
View file @
87865088
...
...
@@ -157,9 +157,9 @@ Fact* AutoPilotPlugin::getFact(FactSystem::Provider_t provider, int componentId,
return
NULL
;
}
QStringList
AutoPilotPlugin
::
parameterNames
(
voi
d
)
QStringList
AutoPilotPlugin
::
parameterNames
(
int
componentI
d
)
{
return
_getParameterLoader
()
->
parameterNames
();
return
_getParameterLoader
()
->
parameterNames
(
componentId
);
}
const
QMap
<
int
,
QMap
<
QString
,
QStringList
>
>&
AutoPilotPlugin
::
getGroupMap
(
void
)
...
...
src/AutoPilotPlugins/AutoPilotPlugin.h
View file @
87865088
...
...
@@ -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
...
...
src/FactSystem/ParameterLoader.cc
View file @
87865088
...
...
@@ -387,11 +387,11 @@ Fact* ParameterLoader::getFact(int componentId, const QString& name)
return
_mapParameterName2Variant
[
componentId
][
name
].
value
<
Fact
*>
();
}
QStringList
ParameterLoader
::
parameterNames
(
voi
d
)
QStringList
ParameterLoader
::
parameterNames
(
int
componentI
d
)
{
QStringList
names
;
foreach
(
QString
paramName
,
_mapParameterName2Variant
[
_
defaultComponentId
].
keys
())
{
foreach
(
QString
paramName
,
_mapParameterName2Variant
[
_
actualComponentId
(
componentId
)
].
keys
())
{
names
<<
paramName
;
}
...
...
src/FactSystem/ParameterLoader.h
View file @
87865088
...
...
@@ -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
...
...
src/QmlControls/ParameterEditor.qml
View file @
87865088
...
...
@@ -39,9 +39,6 @@ import QGroundControl.FactControls 1.0
QGCView
{
viewPanel
:
panel
/// true: show full information, false: for use in smaller widgets
property
bool
fullMode
:
true
QGCPalette
{
id
:
__qgcPal
;
colorGroupEnabled
:
true
}
property
Fact
__editorDialogFact
:
Fact
{
}
...
...
@@ -49,6 +46,9 @@ QGCView {
readonly
property
real
__rightMargin
:
20
readonly
property
int
__maxParamChars
:
16
property
bool
_searchFilter
:
false
///< true: showing results of search
property
var
_searchResults
///< List of parameter names from search results
ParameterEditorController
{
id
:
controller
;
factPanel
:
panel
...
...
@@ -64,6 +64,65 @@ QGCView {
ParameterEditorDialog
{
fact
:
__editorDialogFact
}
}
// Component - Editor Dialog
Component
{
id
:
searchDialogComponent
QGCViewDialog
{
function
accept
()
{
_searchResults
=
controller
.
searchParametersForComponent
(
-
1
,
searchFor
.
text
,
searchInName
.
checked
,
searchInDescriptions
.
checked
)
_searchFilter
=
true
hideDialog
()
}
function
reject
()
{
_searchFilter
=
false
hideDialog
()
}
QGCLabel
{
id
:
searchForLabel
text
:
"
Search for:
"
}
QGCTextField
{
id
:
searchFor
anchors.topMargin
:
defaultTextHeight
/
3
anchors.top
:
searchForLabel
.
bottom
width
:
defaultTextWidth
*
20
}
QGCLabel
{
id
:
searchInLabel
anchors.topMargin
:
defaultTextHeight
anchors.top
:
searchFor
.
bottom
text
:
"
Search in:
"
}
QGCCheckBox
{
id
:
searchInName
anchors.topMargin
:
defaultTextHeight
/
3
anchors.top
:
searchInLabel
.
bottom
text
:
"
Name
"
}
QGCCheckBox
{
id
:
searchInDescriptions
anchors.topMargin
:
defaultTextHeight
/
3
anchors.top
:
searchInName
.
bottom
text
:
"
Descriptions
"
}
QGCLabel
{
anchors.topMargin
:
defaultTextHeight
anchors.top
:
searchInDescriptions
.
bottom
width
:
parent
.
width
wrapMode
:
Text
.
WordWrap
text
:
"
Hint: Leave 'Search For' blank and click Apply to list all parameters sorted by name.
"
}
}
}
Component
{
id
:
factRowsComponent
...
...
@@ -84,7 +143,7 @@ QGCView {
}
Repeater
{
model
:
controller
.
getFactsForGroup
(
componentId
,
group
)
model
:
parameterNames
Column
{
property
Fact
modelFact
:
controller
.
getParameterFact
(
componentId
,
modelData
)
...
...
@@ -116,7 +175,6 @@ QGCView {
height
:
parent
.
height
anchors.left
:
valueLabel
.
right
verticalAlignment
:
Text
.
AlignVCenter
visible
:
fullMode
text
:
modelFact
.
shortDescription
}
...
...
@@ -126,7 +184,7 @@ QGCView {
onClicked
:
{
__editorDialogFact
=
modelFact
showDialog
(
editorDialogComponent
,
"
Parameter Editor
"
,
fullMode
?
50
:
-
1
,
StandardButton
.
Cancel
|
StandardButton
.
Save
)
showDialog
(
editorDialogComponent
,
"
Parameter Editor
"
,
50
,
StandardButton
.
Cancel
|
StandardButton
.
Save
)
}
}
}
...
...
@@ -142,6 +200,106 @@ QGCView {
}
// Column - Facts
}
// Component - factRowsComponent
Component
{
id
:
groupedViewComponent
Item
{
ScrollView
{
id
:
groupScroll
width
:
defaultTextWidth
*
25
height
:
parent
.
height
Column
{
Repeater
{
model
:
controller
.
componentIds
Column
{
id
:
componentColumn
readonly
property
int
componentId
:
parseInt
(
modelData
)
QGCLabel
{
height
:
contentHeight
+
(
ScreenTools
.
defaultFontPixelHeight
*
0.5
)
text
:
"
Component #:
"
+
componentId
.
toString
()
verticalAlignment
:
Text
.
AlignVCenter
font.pixelSize
:
ScreenTools
.
mediumFontPixelSize
}
Repeater
{
model
:
controller
.
getGroupsForComponent
(
componentColumn
.
componentId
)
Column
{
QGCButton
{
x
:
__leftMargin
width
:
groupScroll
.
width
-
__leftMargin
-
__rightMargin
text
:
modelData
onClicked
:
{
factRowsLoader
.
sourceComponent
=
null
factRowsLoader
.
componentId
=
componentId
factRowsLoader
.
group
=
modelData
factRowsLoader
.
sourceComponent
=
factRowsComponent
}
}
Item
{
width
:
1
height
:
ScreenTools
.
defaultFontPixelSize
*
0.25
}
}
// Column - Group
}
// Repeater - Groups
Item
{
height
:
10
width
:
10
}
}
// Column - Component
}
// Repeater - Components
}
// Column - Component
}
// ScrollView - Groups
ScrollView
{
id
:
factScrollView
anchors.left
:
groupScroll
.
right
anchors.right
:
parent
.
right
height
:
parent
.
height
Loader
{
id
:
factRowsLoader
width
:
factScrollView
.
width
sourceComponent
:
factRowsComponent
property
int
componentId
:
controller
.
componentIds
[
0
]
property
string
group
:
controller
.
getGroupsForComponent
(
controller
.
componentIds
[
0
])[
0
]
property
var
parameterNames
:
controller
.
getParametersForGroup
(
componentId
,
group
)
}
}
// ScrollView - Facts
}
// Item
}
// Component - groupedViewComponent
Component
{
id
:
searchResultsViewComponent
Item
{
ScrollView
{
id
:
factScrollView
anchors.left
:
parent
.
left
anchors.right
:
parent
.
right
height
:
parent
.
height
Loader
{
id
:
factRowsLoader
width
:
factScrollView
.
width
sourceComponent
:
factRowsComponent
property
int
componentId
:
-
1
property
string
group
:
"
Search results
"
property
var
parameterNames
:
_searchResults
}
}
// ScrollView - Facts
}
// Item
}
// Component - sortedViewComponent
QGCViewPanel
{
id
:
panel
anchors.fill
:
parent
...
...
@@ -155,8 +313,8 @@ QGCView {
height
:
toolsButton
.
height
QGCLabel
{
id
:
titleText
font.pixelSize
:
ScreenTools
.
largeFontPixelSize
visible
:
fullMode
text
:
"
PARAMETER EDITOR
"
}
...
...
@@ -174,15 +332,17 @@ QGCView {
text
:
"
Reset all to defaults
"
onTriggered
:
controller
.
resetAllToDefaults
()
}
MenuItem
{
text
:
"
Search...
"
onTriggered
:
showDialog
(
searchDialogComponent
,
"
Parameter Search
"
,
50
,
StandardButton
.
Reset
|
StandardButton
.
Apply
)
}
MenuSeparator
{
}
MenuItem
{
text
:
"
Load from file
"
visible
:
fullMode
text
:
"
Load from file...
"
onTriggered
:
controller
.
loadFromFile
()
}
MenuItem
{
text
:
"
Save to file
"
visible
:
fullMode
text
:
"
Save to file...
"
onTriggered
:
controller
.
saveToFile
()
}
MenuSeparator
{
}
...
...
@@ -200,80 +360,11 @@ QGCView {
width
:
5
}
Item
{
width
:
parent
.
width
height
:
parent
.
height
-
(
lastSpacer
.
y
+
lastSpacer
.
height
)
ScrollView
{
id
:
groupScroll
width
:
defaultTextWidth
*
25
height
:
parent
.
height
Column
{
Repeater
{
model
:
controller
.
componentIds
Column
{
id
:
componentColumn
readonly
property
int
componentId
:
parseInt
(
modelData
)
QGCLabel
{
height
:
contentHeight
+
(
ScreenTools
.
defaultFontPixelHeight
*
0.5
)
text
:
"
Component #:
"
+
componentId
.
toString
()
verticalAlignment
:
Text
.
AlignVCenter
font.pixelSize
:
ScreenTools
.
mediumFontPixelSize
}
Repeater
{
model
:
controller
.
getGroupsForComponent
(
componentColumn
.
componentId
)
Column
{
QGCButton
{
x
:
__leftMargin
width
:
groupScroll
.
width
-
__leftMargin
-
__rightMargin
text
:
modelData
onClicked
:
{
factRowsLoader
.
sourceComponent
=
null
factRowsLoader
.
componentId
=
componentId
factRowsLoader
.
group
=
modelData
factRowsLoader
.
sourceComponent
=
factRowsComponent
}
}
Item
{
width
:
1
height
:
ScreenTools
.
defaultFontPixelSize
*
0.25
}
}
// Column - Group
}
// Repeater - Groups
Item
{
height
:
10
width
:
10
}
}
// Column - Component
}
// Repeater - Components
}
// Column - Component
}
// ScrollView - Groups
ScrollView
{
id
:
factScrollView
anchors.left
:
groupScroll
.
right
anchors.right
:
parent
.
right
height
:
parent
.
height
Loader
{
id
:
factRowsLoader
width
:
factScrollView
.
width
property
int
componentId
:
controller
.
componentIds
[
0
]
property
string
group
:
controller
.
getGroupsForComponent
(
controller
.
componentIds
[
0
])[
0
]
sourceComponent
:
factRowsComponent
}
}
// ScrollView - Facts
}
// Item - Group ScrollView + Facts
Loader
{
width
:
parent
.
width
height
:
parent
.
height
-
(
lastSpacer
.
y
+
lastSpacer
.
height
)
sourceComponent
:
_searchFilter
?
searchResultsViewComponent
:
groupedViewComponent
}
}
// Column - Outer
}
// QGCViewPanel
}
// QGCView
src/QmlControls/ParameterEditorController.cc
View file @
87865088
...
...
@@ -53,13 +53,35 @@ QStringList ParameterEditorController::getGroupsForComponent(int componentId)
return
groupMap
[
componentId
].
keys
();
}
QStringList
ParameterEditorController
::
get
Fact
sForGroup
(
int
componentId
,
QString
group
)
QStringList
ParameterEditorController
::
get
Parameter
sForGroup
(
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
);
...
...
src/QmlControls/ParameterEditorController.h
View file @
87865088
...
...
@@ -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
);
...
...
src/QmlControls/QGCView.qml
View file @
87865088
...
...
@@ -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
}
}
...
...
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