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
2de8a49b
Commit
2de8a49b
authored
Nov 18, 2015
by
dogmaphobic
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Work on Parameter Editor
parent
ee06661a
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
286 additions
and
280 deletions
+286
-280
FactPanelController.cc
src/FactSystem/FactControls/FactPanelController.cc
+16
-16
ParameterEditor.qml
src/QmlControls/ParameterEditor.qml
+270
-264
No files found.
src/FactSystem/FactControls/FactPanelController.cc
View file @
2de8a49b
/*=====================================================================
QGroundControl Open Source Ground Control Station
(c) 2009 - 2014 QGROUNDCONTROL PROJECT <http://www.qgroundcontrol.org>
This file is part of the QGROUNDCONTROL project
QGROUNDCONTROL is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
QGROUNDCONTROL is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with QGROUNDCONTROL. If not, see <http://www.gnu.org/licenses/>.
======================================================================*/
#include "FactPanelController.h"
...
...
@@ -38,15 +38,15 @@ FactPanelController::FactPanelController(void) :
{
_vehicle
=
qgcApp
()
->
toolbox
()
->
multiVehicleManager
()
->
activeVehicle
();
Q_ASSERT
(
_vehicle
);
_uas
=
_vehicle
->
uas
();
Q_ASSERT
(
_uas
);
_autopilot
=
_vehicle
->
autopilotPlugin
();
Q_ASSERT
(
_autopilot
);
Q_ASSERT
(
_autopilot
->
parametersReady
());
Q_ASSERT
(
!
_autopilot
->
missingParameters
());
// Do a delayed check for the _factPanel finally being set correctly from Qml
QTimer
::
singleShot
(
1000
,
this
,
&
FactPanelController
::
_checkForMissingFactPanel
);
}
...
...
@@ -60,7 +60,7 @@ void FactPanelController::setFactPanel(QQuickItem* panel)
{
// Once we finally have the _factPanel member set, send any
// missing fact notices that were waiting to go out
_factPanel
=
panel
;
foreach
(
QString
missingParam
,
_delayedMissingParams
)
{
_notifyPanelMissingParameter
(
missingParam
);
...
...
@@ -95,9 +95,9 @@ void FactPanelController::_notifyPanelErrorMsg(const QString& errorMsg)
void
FactPanelController
::
_reportMissingParameter
(
int
componentId
,
const
QString
&
name
)
{
qgcApp
()
->
reportMissingParameter
(
componentId
,
name
);
QString
missingParam
=
QString
(
"%1:%2"
).
arg
(
componentId
).
arg
(
name
);
// If missing parameters a reported from the constructor of a derived class we
// will not have access to _factPanel yet. Just record list of missing facts
// in that case instead of notify. Once _factPanel is available they will be
...
...
@@ -112,14 +112,14 @@ void FactPanelController::_reportMissingParameter(int componentId, const QString
bool
FactPanelController
::
_allParametersExists
(
int
componentId
,
QStringList
names
)
{
bool
noMissingFacts
=
true
;
foreach
(
QString
name
,
names
)
{
if
(
!
_autopilot
->
parameterExists
(
componentId
,
name
))
{
_reportMissingParameter
(
componentId
,
name
);
noMissingFacts
=
false
;
}
}
return
noMissingFacts
;
}
...
...
@@ -152,4 +152,4 @@ void FactPanelController::_showInternalError(const QString& errorMsg)
_notifyPanelErrorMsg
(
QString
(
"Internal Error: %1"
).
arg
(
errorMsg
));
qCWarning
(
FactPanelControllerLog
)
<<
"Internal Error"
<<
errorMsg
;
QGCMessageBox
::
critical
(
"Internal Error"
,
errorMsg
);
}
\ No newline at end of file
}
src/QmlControls/ParameterEditor.qml
View file @
2de8a49b
...
...
@@ -40,27 +40,287 @@ QGCView {
viewPanel
:
panel
QGCPalette
{
id
:
__qgcPal
;
colorGroupEnabled
:
true
}
property
Fact
__editorDialogFact
:
Fact
{
}
readonly
property
real
__leftMargin
:
10
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
property
Fact
__editorDialogFact
:
Fact
{
}
property
int
_rowHeight
:
ScreenTools
.
defaultFontPixelHeight
*
2
property
int
_rowWidth
:
10
// Dynamic adjusted at runtime
property
bool
_searchFilter
:
false
///< true: showing results of search
property
var
_searchResults
///< List of parameter names from search results
property
string
_currentGroup
:
""
ParameterEditorController
{
id
:
controller
;
factPanel
:
panel
onShowErrorMessage
:
{
showMessage
(
"
Parameter Load Errors
"
,
errorMsg
,
StandardButton
.
Ok
)
}
}
QGCViewPanel
{
id
:
panel
anchors.fill
:
parent
Column
{
anchors.fill
:
parent
spacing
:
ScreenTools
.
defaultFontPixelHeight
*
0.25
//---------------------------------------------
//-- Header
Item
{
id
:
header
width
:
parent
.
width
height
:
ScreenTools
.
defaultFontPixelHeight
*
1.75
QGCLabel
{
text
:
"
Search Results
"
visible
:
_searchFilter
font.weight
:
Font
.
DemiBold
anchors.verticalCenter
:
parent
.
verticalCenter
}
Item
{
id
:
groupTitle
visible
:
!
_searchFilter
width
:
ScreenTools
.
defaultFontPixelWidth
*
25
anchors.verticalCenter
:
parent
.
verticalCenter
QGCLabel
{
text
:
"
GROUPS
"
font.weight
:
Font
.
DemiBold
anchors.centerIn
:
parent
}
}
QGCLabel
{
text
:
_currentGroup
+
"
Parameters
"
visible
:
!
_searchFilter
font.weight
:
Font
.
DemiBold
anchors.left
:
groupTitle
.
right
anchors.leftMargin
:
ScreenTools
.
defaultFontPixelWidth
anchors.verticalCenter
:
parent
.
verticalCenter
}
QGCButton
{
text
:
"
Back
"
visible
:
_searchFilter
anchors.right
:
parent
.
right
height
:
ScreenTools
.
defaultFontPixelHeight
*
1.75
onClicked
:
{
_searchFilter
=
false
hideDialog
()
}
}
QGCButton
{
text
:
"
Tools
"
visible
:
!
_searchFilter
anchors.right
:
parent
.
right
height
:
ScreenTools
.
defaultFontPixelHeight
*
1.75
menu
:
Menu
{
MenuItem
{
text
:
"
Refresh
"
onTriggered
:
controller
.
refresh
()
}
MenuItem
{
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...
"
onTriggered
:
controller
.
loadFromFile
()
}
MenuItem
{
text
:
"
Save to file...
"
onTriggered
:
controller
.
saveToFile
()
}
MenuSeparator
{
}
MenuItem
{
text
:
"
Clear RC to Param
"
onTriggered
:
controller
.
clearRCToParam
()
}
}
}
}
Rectangle
{
color
:
__qgcPal
.
text
width
:
parent
.
width
height
:
1
opacity
:
0.1
anchors.topMargin
:
-
1
}
//---------------------------------------------
//-- Contents
Loader
{
width
:
parent
.
width
height
:
parent
.
height
-
header
.
height
sourceComponent
:
_searchFilter
?
searchResultsViewComponent
:
groupedViewComponent
}
}
}
//-- Parameter Groups
Component
{
id
:
editorDialogComponent
id
:
groupedViewComponent
Row
{
spacing
:
ScreenTools
.
defaultFontPixelWidth
*
0.5
//-- Parameter Groups
Flickable
{
id
:
groupScroll
width
:
ScreenTools
.
defaultFontPixelWidth
*
25
height
:
parent
.
height
clip
:
true
pixelAligned
:
true
contentHeight
:
groupedViewComponentColumn
.
height
contentWidth
:
groupedViewComponentColumn
.
width
boundsBehavior
:
Flickable
.
OvershootBounds
flickableDirection
:
Flickable
.
VerticalFlick
Column
{
id
:
groupedViewComponentColumn
spacing
:
Math
.
ceil
(
ScreenTools
.
defaultFontPixelHeight
*
0.25
)
Repeater
{
model
:
controller
.
componentIds
Column
{
id
:
componentColumn
readonly
property
int
componentId
:
parseInt
(
modelData
)
spacing
:
Math
.
ceil
(
ScreenTools
.
defaultFontPixelHeight
*
0.25
)
QGCLabel
{
text
:
"
Component #:
"
+
componentId
.
toString
()
font.weight
:
Font
.
DemiBold
anchors.horizontalCenter
:
parent
.
horizontalCenter
}
ExclusiveGroup
{
id
:
groupGroup
}
Repeater
{
model
:
controller
.
getGroupsForComponent
(
componentId
)
QGCButton
{
width
:
ScreenTools
.
defaultFontPixelWidth
*
25
text
:
modelData
height
:
_rowHeight
exclusiveGroup
:
setupButtonGroup
onClicked
:
{
checked
=
true
factRowsLoader
.
sourceComponent
=
null
_rowWidth
=
10
factRowsLoader
.
componentId
=
componentId
factRowsLoader
.
parameterNames
=
controller
.
getParametersForGroup
(
componentId
,
modelData
)
factRowsLoader
.
sourceComponent
=
factRowsComponent
_currentGroup
=
modelData
}
}
}
}
}
}
}
Rectangle
{
color
:
__qgcPal
.
text
width
:
1
height
:
parent
.
height
opacity
:
0.1
}
//-- Parameters
Flickable
{
id
:
factScrollView
width
:
parent
.
width
-
groupScroll
.
width
height
:
parent
.
height
contentHeight
:
factRowsLoader
.
height
contentWidth
:
_rowWidth
boundsBehavior
:
Flickable
.
OvershootBounds
pixelAligned
:
true
clip
:
true
Loader
{
id
:
factRowsLoader
sourceComponent
:
factRowsComponent
property
int
componentId
:
controller
.
componentIds
[
0
]
property
var
parameterNames
:
controller
.
getParametersForGroup
(
componentId
,
controller
.
getGroupsForComponent
(
componentId
)[
0
])
onLoaded
:
{
_currentGroup
=
controller
.
getGroupsForComponent
(
controller
.
componentIds
[
0
])[
0
]
}
}
}
}
}
//---------------------------------------------
// Search result view
Component
{
id
:
searchResultsViewComponent
Item
{
Flickable
{
id
:
factScrollView
width
:
parent
.
width
height
:
parent
.
height
contentHeight
:
factRowsLoader
.
height
contentWidth
:
_rowWidth
boundsBehavior
:
Flickable
.
OvershootBounds
pixelAligned
:
true
clip
:
true
Loader
{
id
:
factRowsLoader
sourceComponent
:
factRowsComponent
property
int
componentId
:
-
1
property
var
parameterNames
:
_searchResults
}
}
}
}
//---------------------------------------------
// Paremeters view
Component
{
id
:
factRowsComponent
Column
{
spacing
:
Math
.
ceil
(
ScreenTools
.
defaultFontPixelHeight
*
0.25
)
Repeater
{
model
:
parameterNames
Rectangle
{
height
:
_rowHeight
width
:
_rowWidth
color
:
Qt
.
rgba
(
0
,
0
,
0
,
0
)
Row
{
id
:
factRow
property
Fact
modelFact
:
controller
.
getParameterFact
(
componentId
,
modelData
)
spacing
:
Math
.
ceil
(
ScreenTools
.
defaultFontPixelWidth
*
0.5
)
anchors.verticalCenter
:
parent
.
verticalCenter
QGCLabel
{
id
:
nameLabel
width
:
ScreenTools
.
defaultFontPixelWidth
*
20
text
:
factRow
.
modelFact
.
name
}
QGCLabel
{
id
:
valueLabel
width
:
ScreenTools
.
defaultFontPixelWidth
*
20
color
:
factRow
.
modelFact
.
valueEqualsDefault
?
__qgcPal
.
text
:
__qgcPal
.
warningText
text
:
factRow
.
modelFact
.
valueString
+
"
"
+
factRow
.
modelFact
.
units
}
QGCLabel
{
text
:
factRow
.
modelFact
.
shortDescription
}
Component.onCompleted
:
{
if
(
_rowWidth
<
factRow
.
width
+
ScreenTools
.
defaultFontPixelWidth
)
{
_rowWidth
=
factRow
.
width
+
ScreenTools
.
defaultFontPixelWidth
}
}
}
Rectangle
{
width
:
_rowWidth
height
:
1
color
:
__qgcPal
.
text
opacity
:
0.15
anchors.bottom
:
parent
.
bottom
anchors.left
:
parent
.
left
}
MouseArea
{
anchors.fill
:
parent
acceptedButtons
:
Qt
.
LeftButton
onClicked
:
{
__editorDialogFact
=
factRow
.
modelFact
showDialog
(
editorDialogComponent
,
"
Parameter Editor
"
,
50
,
StandardButton
.
Cancel
|
StandardButton
.
Save
)
}
}
}
}
}
}
Component
{
id
:
editorDialogComponent
ParameterEditorDialog
{
fact
:
__editorDialogFact
}
}
...
...
@@ -89,7 +349,7 @@ QGCView {
id
:
searchFor
anchors.topMargin
:
defaultTextHeight
/
3
anchors.top
:
searchForLabel
.
bottom
width
:
defaultText
Width
*
20
width
:
ScreenTools
.
defaultFontPixel
Width
*
20
}
/*
...
...
@@ -126,258 +386,4 @@ QGCView {
}
}
Component
{
id
:
factRowsComponent
Column
{
id
:
factColumn
x
:
__leftMargin
QGCLabel
{
text
:
group
verticalAlignment
:
Text
.
AlignVCenter
font.pixelSize
:
ScreenTools
.
mediumFontPixelSize
}
Rectangle
{
width
:
parent
.
width
height
:
1
color
:
__qgcPal
.
text
}
Repeater
{
model
:
parameterNames
Column
{
property
Fact
modelFact
:
controller
.
getParameterFact
(
componentId
,
modelData
)
Item
{
x
:
__leftMargin
width
:
parent
.
width
height
:
ScreenTools
.
defaultFontPixelSize
*
1.75
QGCLabel
{
id
:
nameLabel
width
:
defaultTextWidth
*
(
__maxParamChars
+
1
)
height
:
parent
.
height
verticalAlignment
:
Text
.
AlignVCenter
text
:
modelFact
.
name
}
QGCLabel
{
id
:
valueLabel
width
:
defaultTextWidth
*
20
height
:
parent
.
height
anchors.left
:
nameLabel
.
right
verticalAlignment
:
Text
.
AlignVCenter
color
:
modelFact
.
valueEqualsDefault
?
__qgcPal
.
text
:
"
orange
"
text
:
modelFact
.
valueString
+
"
"
+
modelFact
.
units
}
QGCLabel
{
height
:
parent
.
height
anchors.left
:
valueLabel
.
right
verticalAlignment
:
Text
.
AlignVCenter
text
:
modelFact
.
shortDescription
}
MouseArea
{
anchors.fill
:
parent
acceptedButtons
:
Qt
.
LeftButton
onClicked
:
{
__editorDialogFact
=
modelFact
showDialog
(
editorDialogComponent
,
"
Parameter Editor
"
,
50
,
StandardButton
.
Cancel
|
StandardButton
.
Save
)
}
}
}
Rectangle
{
x
:
__leftMargin
width
:
factColumn
.
width
-
__leftMargin
-
__rightMargin
height
:
1
color
:
__qgcPal
.
windowShade
}
}
// Column - Fact
}
// Repeater - Facts
}
// Column - Facts
}
// Component - factRowsComponent
Component
{
id
:
groupedViewComponent
Item
{
Flickable
{
id
:
groupScroll
width
:
defaultTextWidth
*
25
height
:
parent
.
height
clip
:
true
contentHeight
:
groupedViewComponentColumn
.
height
contentWidth
:
groupedViewComponentColumn
.
width
boundsBehavior
:
Flickable
.
StopAtBounds
flickableDirection
:
Flickable
.
VerticalFlick
Column
{
id
:
groupedViewComponentColumn
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
}
// Flickable - Groups
Flickable
{
id
:
factScrollView
anchors.left
:
groupScroll
.
right
anchors.right
:
parent
.
right
height
:
parent
.
height
contentHeight
:
factRowsLoader
.
height
contentWidth
:
panel
.
width
*
2
//-- TODO: Find how to get actual resulting width. "factRowsLoader.sourceComponent.width" doesn't work.
boundsBehavior
:
Flickable
.
StopAtBounds
clip
:
true
Loader
{
id
:
factRowsLoader
sourceComponent
:
factRowsComponent
property
int
componentId
:
controller
.
componentIds
[
0
]
property
string
group
:
controller
.
getGroupsForComponent
(
controller
.
componentIds
[
0
])[
0
]
property
var
parameterNames
:
controller
.
getParametersForGroup
(
componentId
,
group
)
}
}
// Flickable - Facts
}
// Item
}
// Component - groupedViewComponent
Component
{
id
:
searchResultsViewComponent
Item
{
ScrollView
{
id
:
factScrollView
anchors.left
:
parent
.
left
anchors.right
:
parent
.
right
height
:
parent
.
height
horizontalScrollBarPolicy
:
Qt
.
ScrollBarAlwaysOff
verticalScrollBarPolicy
:
Qt
.
ScrollBarAlwaysOff
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
Column
{
anchors.fill
:
parent
Item
{
width
:
parent
.
width
height
:
toolsButton
.
height
QGCLabel
{
id
:
titleText
font.pixelSize
:
ScreenTools
.
mediumFontPixelSize
text
:
"
PARAMETERS
"
}
QGCButton
{
id
:
toolsButton
anchors.right
:
parent
.
right
text
:
"
Tools
"
menu
:
Menu
{
MenuItem
{
text
:
"
Refresh
"
onTriggered
:
controller
.
refresh
()
}
MenuItem
{
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...
"
onTriggered
:
controller
.
loadFromFile
()
}
MenuItem
{
text
:
"
Save to file...
"
onTriggered
:
controller
.
saveToFile
()
}
MenuSeparator
{
}
MenuItem
{
text
:
"
Clear RC to Param
"
onTriggered
:
controller
.
clearRCToParam
()
}
}
}
}
Item
{
id
:
lastSpacer
height
:
10
width
:
5
}
Loader
{
width
:
parent
.
width
height
:
parent
.
height
-
(
lastSpacer
.
y
+
lastSpacer
.
height
)
sourceComponent
:
_searchFilter
?
searchResultsViewComponent
:
groupedViewComponent
}
}
// Column - Outer
}
// QGCViewPanel
}
// QGCView
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