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
b458b751
Unverified
Commit
b458b751
authored
Apr 11, 2020
by
Don Gagne
Committed by
GitHub
Apr 11, 2020
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #8653 from DonLakeFlyer/ValueEditDialog
Value edit dialog
parents
fb5fc249
c7262637
Changes
11
Show whitespace changes
Inline
Side-by-side
Showing
11 changed files
with
455 additions
and
256 deletions
+455
-256
qgroundcontrol.qrc
qgroundcontrol.qrc
+2
-0
FactGroup.cc
src/FactSystem/FactGroup.cc
+17
-9
FactGroup.h
src/FactSystem/FactGroup.h
+12
-11
ValuePageWidget.qml
src/FlightMap/Widgets/ValuePageWidget.qml
+134
-211
ValuesWidgetController.cc
src/FlightMap/Widgets/ValuesWidgetController.cc
+49
-19
ValuesWidgetController.h
src/FlightMap/Widgets/ValuesWidgetController.h
+11
-3
QGCPopupDialog.qml
src/QmlControls/QGCPopupDialog.qml
+41
-0
QGCPopupDialogContainer.qml
src/QmlControls/QGCPopupDialogContainer.qml
+174
-0
qmldir
src/QmlControls/QGroundControl/Controls/qmldir
+2
-0
QGCCorePlugin.cc
src/api/QGCCorePlugin.cc
+3
-3
MainRootWindow.qml
src/ui/MainRootWindow.qml
+10
-0
No files found.
qgroundcontrol.qrc
View file @
b458b751
...
@@ -142,6 +142,8 @@
...
@@ -142,6 +142,8 @@
<file alias="QGroundControl/Controls/QGCMenuSeparator.qml">src/QmlControls/QGCMenuSeparator.qml</file>
<file alias="QGroundControl/Controls/QGCMenuSeparator.qml">src/QmlControls/QGCMenuSeparator.qml</file>
<file alias="QGroundControl/Controls/QGCMouseArea.qml">src/QmlControls/QGCMouseArea.qml</file>
<file alias="QGroundControl/Controls/QGCMouseArea.qml">src/QmlControls/QGCMouseArea.qml</file>
<file alias="QGroundControl/Controls/QGCMovableItem.qml">src/QmlControls/QGCMovableItem.qml</file>
<file alias="QGroundControl/Controls/QGCMovableItem.qml">src/QmlControls/QGCMovableItem.qml</file>
<file alias="QGroundControl/Controls/QGCPopupDialog.qml">src/QmlControls/QGCPopupDialog.qml</file>
<file alias="QGroundControl/Controls/QGCPopupDialogContainer.qml">src/QmlControls/QGCPopupDialogContainer.qml</file>
<file alias="QGroundControl/Controls/QGCPipable.qml">src/QmlControls/QGCPipable.qml</file>
<file alias="QGroundControl/Controls/QGCPipable.qml">src/QmlControls/QGCPipable.qml</file>
<file alias="QGroundControl/Controls/QGCRadioButton.qml">src/QmlControls/QGCRadioButton.qml</file>
<file alias="QGroundControl/Controls/QGCRadioButton.qml">src/QmlControls/QGCRadioButton.qml</file>
<file alias="QGroundControl/Controls/QGCSlider.qml">src/QmlControls/QGCSlider.qml</file>
<file alias="QGroundControl/Controls/QGCSlider.qml">src/QmlControls/QGCSlider.qml</file>
...
...
src/FactSystem/FactGroup.cc
View file @
b458b751
...
@@ -53,8 +53,6 @@ void FactGroup::_setupTimer()
...
@@ -53,8 +53,6 @@ void FactGroup::_setupTimer()
Fact
*
FactGroup
::
getFact
(
const
QString
&
name
)
Fact
*
FactGroup
::
getFact
(
const
QString
&
name
)
{
{
Fact
*
fact
=
nullptr
;
if
(
name
.
contains
(
"."
))
{
if
(
name
.
contains
(
"."
))
{
QStringList
parts
=
name
.
split
(
"."
);
QStringList
parts
=
name
.
split
(
"."
);
if
(
parts
.
count
()
!=
2
)
{
if
(
parts
.
count
()
!=
2
)
{
...
@@ -71,11 +69,14 @@ Fact* FactGroup::getFact(const QString& name)
...
@@ -71,11 +69,14 @@ Fact* FactGroup::getFact(const QString& name)
return
factGroup
->
getFact
(
parts
[
1
]);
return
factGroup
->
getFact
(
parts
[
1
]);
}
}
if
(
_nameToFactMap
.
contains
(
name
))
{
Fact
*
fact
=
nullptr
;
fact
=
_nameToFactMap
[
name
];
QString
camelCaseName
=
_camelCase
(
name
);
if
(
_nameToFactMap
.
contains
(
camelCaseName
))
{
fact
=
_nameToFactMap
[
camelCaseName
];
QQmlEngine
::
setObjectOwnership
(
fact
,
QQmlEngine
::
CppOwnership
);
QQmlEngine
::
setObjectOwnership
(
fact
,
QQmlEngine
::
CppOwnership
);
}
else
{
}
else
{
qWarning
()
<<
"Unknown Fact"
<<
n
ame
;
qWarning
()
<<
"Unknown Fact"
<<
camelCaseN
ame
;
}
}
return
fact
;
return
fact
;
...
@@ -84,12 +85,13 @@ Fact* FactGroup::getFact(const QString& name)
...
@@ -84,12 +85,13 @@ Fact* FactGroup::getFact(const QString& name)
FactGroup
*
FactGroup
::
getFactGroup
(
const
QString
&
name
)
FactGroup
*
FactGroup
::
getFactGroup
(
const
QString
&
name
)
{
{
FactGroup
*
factGroup
=
nullptr
;
FactGroup
*
factGroup
=
nullptr
;
QString
camelCaseName
=
_camelCase
(
name
);
if
(
_nameToFactGroupMap
.
contains
(
n
ame
))
{
if
(
_nameToFactGroupMap
.
contains
(
camelCaseN
ame
))
{
factGroup
=
_nameToFactGroupMap
[
n
ame
];
factGroup
=
_nameToFactGroupMap
[
camelCaseN
ame
];
QQmlEngine
::
setObjectOwnership
(
factGroup
,
QQmlEngine
::
CppOwnership
);
QQmlEngine
::
setObjectOwnership
(
factGroup
,
QQmlEngine
::
CppOwnership
);
}
else
{
}
else
{
qWarning
()
<<
"Unknown FactGroup"
<<
n
ame
;
qWarning
()
<<
"Unknown FactGroup"
<<
camelCaseN
ame
;
}
}
return
factGroup
;
return
factGroup
;
...
@@ -142,3 +144,9 @@ void FactGroup::setLiveUpdates(bool liveUpdates)
...
@@ -142,3 +144,9 @@ void FactGroup::setLiveUpdates(bool liveUpdates)
fact
->
setSendValueChangedSignals
(
liveUpdates
);
fact
->
setSendValueChangedSignals
(
liveUpdates
);
}
}
}
}
QString
FactGroup
::
_camelCase
(
const
QString
&
text
)
{
return
text
[
0
].
toLower
()
+
text
.
right
(
text
.
length
()
-
1
);
}
src/FactSystem/FactGroup.h
View file @
b458b751
...
@@ -44,25 +44,26 @@ public:
...
@@ -44,25 +44,26 @@ public:
QStringList
factNames
(
void
)
const
{
return
_factNames
;
}
QStringList
factNames
(
void
)
const
{
return
_factNames
;
}
QStringList
factGroupNames
(
void
)
const
{
return
_nameToFactGroupMap
.
keys
();
}
QStringList
factGroupNames
(
void
)
const
{
return
_nameToFactGroupMap
.
keys
();
}
protected:
void
_addFact
(
Fact
*
fact
,
const
QString
&
name
);
void
_addFactGroup
(
FactGroup
*
factGroup
,
const
QString
&
name
);
void
_loadFromJsonArray
(
const
QJsonArray
jsonArray
);
int
_updateRateMSecs
;
///< Update rate for Fact::valueChanged signals, 0: immediate update
protected
slots
:
protected
slots
:
virtual
void
_updateAllValues
(
void
);
virtual
void
_updateAllValues
(
void
);
private:
void
_setupTimer
();
QTimer
_updateTimer
;
protected:
protected:
void
_addFact
(
Fact
*
fact
,
const
QString
&
name
);
void
_addFactGroup
(
FactGroup
*
factGroup
,
const
QString
&
name
);
void
_loadFromJsonArray
(
const
QJsonArray
jsonArray
);
int
_updateRateMSecs
;
///< Update rate for Fact::valueChanged signals, 0: immediate update
QMap
<
QString
,
Fact
*>
_nameToFactMap
;
QMap
<
QString
,
Fact
*>
_nameToFactMap
;
QMap
<
QString
,
FactGroup
*>
_nameToFactGroupMap
;
QMap
<
QString
,
FactGroup
*>
_nameToFactGroupMap
;
QMap
<
QString
,
FactMetaData
*>
_nameToFactMetaDataMap
;
QMap
<
QString
,
FactMetaData
*>
_nameToFactMetaDataMap
;
QStringList
_factNames
;
QStringList
_factNames
;
private:
void
_setupTimer
(
void
);
QString
_camelCase
(
const
QString
&
text
);
QTimer
_updateTimer
;
};
};
#endif
#endif
src/FlightMap/Widgets/ValuePageWidget.qml
View file @
b458b751
...
@@ -34,8 +34,7 @@ Column {
...
@@ -34,8 +34,7 @@ Column {
property
real
_margins
:
ScreenTools
.
defaultFontPixelWidth
/
2
property
real
_margins
:
ScreenTools
.
defaultFontPixelWidth
/
2
property
int
_colMax
:
4
property
int
_colMax
:
4
property
bool
_settingsUnlocked
:
false
property
bool
_settingsUnlocked
:
false
property
var
_valuePickerInstrumentValue
:
null
property
var
_valueDialogInstrumentValue
:
null
property
int
_valuePickerRowIndex
:
0
property
var
_rgFontSizes
:
[
ScreenTools
.
defaultFontPointSize
,
ScreenTools
.
smallFontPointSize
,
ScreenTools
.
mediumFontPointSize
,
ScreenTools
.
largeFontPointSize
]
property
var
_rgFontSizes
:
[
ScreenTools
.
defaultFontPointSize
,
ScreenTools
.
smallFontPointSize
,
ScreenTools
.
mediumFontPointSize
,
ScreenTools
.
largeFontPointSize
]
property
var
_rgFontSizeRatios
:
[
1
,
ScreenTools
.
smallFontPointRatio
,
ScreenTools
.
mediumFontPointRatio
,
ScreenTools
.
largeFontPointRatio
]
property
var
_rgFontSizeRatios
:
[
1
,
ScreenTools
.
smallFontPointRatio
,
ScreenTools
.
mediumFontPointRatio
,
ScreenTools
.
largeFontPointRatio
]
property
real
_doubleDescent
:
ScreenTools
.
defaultFontDescent
*
2
property
real
_doubleDescent
:
ScreenTools
.
defaultFontDescent
*
2
...
@@ -48,6 +47,7 @@ Column {
...
@@ -48,6 +47,7 @@ Column {
property
real
_columnButtonsTotalHeight
:
(
_columnButtonHeight
*
2
)
+
_columnButtonSpacing
property
real
_columnButtonsTotalHeight
:
(
_columnButtonHeight
*
2
)
+
_columnButtonSpacing
QGCPalette
{
id
:
qgcPal
;
colorGroupEnabled
:
true
}
QGCPalette
{
id
:
qgcPal
;
colorGroupEnabled
:
true
}
QGCPalette
{
id
:
qgcPalDisabled
;
colorGroupEnabled
:
false
}
ValuesWidgetController
{
id
:
controller
}
ValuesWidgetController
{
id
:
controller
}
...
@@ -79,9 +79,8 @@ Column {
...
@@ -79,9 +79,8 @@ Column {
property
int
rowIndex
property
int
rowIndex
onClicked
:
{
onClicked
:
{
_valuePickerInstrumentValue
=
instrumentValue
_valueDialogInstrumentValue
=
instrumentValue
_valuePickerRowIndex
=
rowIndex
mainWindow
.
showPopupDialog
(
valueDialog
,
qsTr
(
"
Value Display
"
),
StandardButton
.
Close
)
mainWindow
.
showComponentDialog
(
valuePickerDialog
,
qsTr
(
"
Select Value
"
),
mainWindow
.
showDialogDefaultWidth
,
StandardButton
.
Ok
)
}
}
}
}
}
}
...
@@ -142,7 +141,7 @@ Column {
...
@@ -142,7 +141,7 @@ Column {
label
.
x
=
label
.
y
=
0
label
.
x
=
label
.
y
=
0
}
else
{
}
else
{
// label above value
// label above value
if
(
label
)
{
if
(
object
.
label
)
{
label
.
x
=
(
width
-
label
.
width
)
/
2
label
.
x
=
(
width
-
label
.
width
)
/
2
label
.
y
=
0
label
.
y
=
0
value
.
y
=
label
.
height
+
smallSpacing
value
.
y
=
label
.
height
+
smallSpacing
...
@@ -272,187 +271,148 @@ Column {
...
@@ -272,187 +271,148 @@ Column {
}
}
Component
{
Component
{
id
:
value
Picker
Dialog
id
:
valueDialog
QGCViewDialog
{
QGCPopupDialog
{
function
accept
()
{
GridLayout
{
if
(
factRadioGroup
.
checkedButton
)
{
rowSpacing
:
_margins
_valuePickerInstrumentValue
.
setFact
(
factRadioGroup
.
checkedButton
.
radioFactGroupName
,
factRadioGroup
.
checkedButton
.
radioFact
.
name
,
labelTextField
.
text
,
fontSizeCombo
.
currentIndex
)
columnSpacing
:
_margins
columns
:
3
QGCCheckBox
{
id
:
valueCheckBox
text
:
qsTr
(
"
Value
"
)
checked
:
_valueDialogInstrumentValue
.
fact
onClicked
:
{
if
(
checked
)
{
_valueDialogInstrumentValue
.
setFact
(
_valueDialogInstrumentValue
.
factGroupNames
[
0
],
_valueDialogInstrumentValue
.
factValueNames
[
0
])
}
else
{
}
else
{
_valuePicker
InstrumentValue
.
clearFact
()
_valueDialog
InstrumentValue
.
clearFact
()
}
}
hideDialog
()
}
}
Connections
{
target
:
factRadioGroup
onCheckedButtonChanged
:
labelTextField
.
text
=
factRadioGroup
.
checkedButton
.
radioFact
.
shortDescription
}
ButtonGroup
{
id
:
fontRadioGroup
}
QGCFlickable
{
anchors.fill
:
parent
contentHeight
:
column
.
height
flickableDirection
:
Flickable
.
VerticalFlick
clip
:
true
ColumnLayout
{
id
:
column
anchors.left
:
parent
.
left
anchors.right
:
parent
.
right
spacing
:
_margins
QGCButton
{
Layout.fillWidth
:
true
text
:
qsTr
(
"
Blank Entry
"
)
onClicked
:
{
_valuePickerInstrumentValue
.
clearFact
();
hideDialog
()
}
}
}
RowLayout
{
QGCComboBox
{
Layout.fillWidth
:
true
model
:
_valueDialogInstrumentValue
.
factGroupNames
spacing
:
ScreenTools
.
defaultFontPixelWidth
sizeToContents
:
true
enabled
:
valueCheckBox
.
enabled
QGCLabel
{
text
:
qsTr
(
"
Label
"
)
}
onModelChanged
:
currentIndex
=
find
(
_valueDialogInstrumentValue
.
factGroupName
)
QGCTextField
{
Component.onCompleted
:
currentIndex
=
find
(
_valueDialogInstrumentValue
.
factGroupName
)
id
:
labelTextField
onActivated
:
{
Layout.fillWidth
:
true
_valueDialogInstrumentValue
.
setFact
(
currentText
,
""
)
text
:
_valuePickerInstrumentValue
.
label
_valueDialogInstrumentValue
.
icon
=
""
_valueDialogInstrumentValue
.
label
=
_valueDialogInstrumentValue
.
fact
.
shortDescription
}
}
}
}
RowLayout
{
spacing
:
ScreenTools
.
defaultFontPixelWidth
QGCLabel
{
text
:
qsTr
(
"
Font Size
"
)
}
QGCComboBox
{
QGCComboBox
{
id
:
fontSizeCombo
model
:
_valueDialogInstrumentValue
.
factValueNames
model
:
_valuePickerInstrumentValue
.
fontSizeNames
currentIndex
:
_valuePickerInstrumentValue
.
fontSize
sizeToContents
:
true
sizeToContents
:
true
onActivated
:
_valuePickerInstrumentValue
.
fontSize
=
index
enabled
:
valueCheckBox
.
enabled
}
onModelChanged
:
currentIndex
=
_valueDialogInstrumentValue
.
fact
?
find
(
_valueDialogInstrumentValue
.
factName
)
:
-
1
QGCCheckBox
{
Component.onCompleted
:
currentIndex
=
_valueDialogInstrumentValue
.
fact
?
find
(
_valueDialogInstrumentValue
.
factName
)
:
-
1
text
:
qsTr
(
"
Show Units
"
)
onActivated
:
{
checked
:
_valuePickerInstrumentValue
.
showUnits
_valueDialogInstrumentValue
.
setFact
(
_valueDialogInstrumentValue
.
factGroupName
,
currentText
)
onClicked
:
_valuePickerInstrumentValue
.
showUnits
=
checked
_valueDialogInstrumentValue
.
icon
=
""
_valueDialogInstrumentValue
.
label
=
_valueDialogInstrumentValue
.
fact
.
shortDescription
}
}
}
}
RowLayout
{
QGCRadioButton
{
spacing
:
ScreenTools
.
defaultFontPixelWidth
id
:
iconCheckBox
text
:
qsTr
(
"
Icon
"
)
QGCLabel
{
text
:
qsTr
(
"
Icon
"
)
}
Component.onCompleted
:
checked
=
_valueDialogInstrumentValue
.
icon
!=
""
onClicked
:
{
Rectangle
{
_valueDialogInstrumentValue
.
label
=
""
height
:
iconPositionCombo
.
height
_valueDialogInstrumentValue
.
icon
=
_valueDialogInstrumentValue
.
iconNames
[
0
]
width
:
noIconLabel
.
width
+
ScreenTools
.
defaultFontPixelWidth
*
2
mainWindow
.
showPopupDialog
(
iconDialog
,
qsTr
(
"
Select Icon
"
),
StandardButton
.
Close
)
color
:
qgcPal
.
window
border.color
:
qgcPal
.
text
visible
:
!
_valuePickerInstrumentValue
.
icon
QGCLabel
{
id
:
noIconLabel
anchors.centerIn
:
parent
text
:
qsTr
(
"
No Icon
"
)
}
}
}
}
QGCColoredImage
{
QGCColoredImage
{
Layout.alignment
:
Qt
.
AlignHCenter
height
:
iconPositionCombo
.
height
height
:
iconPositionCombo
.
height
width
:
height
width
:
height
source
:
_valuePickerInstrumentValue
.
icon
?
"
/InstrumentValueIcons/
"
+
_valuePickerInstrumentValue
.
icon
:
""
source
:
"
/InstrumentValueIcons/
"
+
(
_valueDialogInstrumentValue
.
icon
?
_valueDialogInstrumentValue
.
icon
:
_valueDialogInstrumentValue
.
iconNames
[
0
])
sourceSize.height
:
height
sourceSize.height
:
height
fillMode
:
Image
.
PreserveAspectFit
fillMode
:
Image
.
PreserveAspectFit
mipmap
:
true
mipmap
:
true
smooth
:
true
smooth
:
true
color
:
qgcPal
.
text
color
:
enabled
?
qgcPal
.
text
:
qgcPalDisabled
.
text
visible
:
_valuePickerInstrumentValue
.
icon
enabled
:
iconCheckBox
.
checked
MouseArea
{
anchors.fill
:
parent
onClicked
:
mainWindow
.
showPopupDialog
(
iconDialog
,
qsTr
(
"
Select Icon
"
),
StandardButton
.
Close
)
}
}
}
QGCComboBox
{
QGCComboBox
{
id
:
iconPositionCombo
id
:
iconPositionCombo
model
:
_valuePicker
InstrumentValue
.
iconPositionNames
model
:
_valueDialog
InstrumentValue
.
iconPositionNames
currentIndex
:
_valuePicker
InstrumentValue
.
iconPosition
currentIndex
:
_valueDialog
InstrumentValue
.
iconPosition
sizeToContents
:
true
sizeToContents
:
true
onActivated
:
_valuePicker
InstrumentValue
.
iconPosition
=
index
onActivated
:
_valueDialog
InstrumentValue
.
iconPosition
=
index
}
enabled
:
iconCheckBox
.
checked
}
}
SectionHeader
{
QGCRadioButton
{
id
:
iconListHeader
id
:
labelCheckBox
Layout.fillWidth
:
true
text
:
qsTr
(
"
Label
"
)
text
:
qsTr
(
"
Icons
"
)
Component.onCompleted
:
checked
=
_valueDialogInstrumentValue
.
label
!=
""
checked
:
false
onClicked
:
{
_valueDialogInstrumentValue
.
icon
=
""
_valueDialogInstrumentValue
.
label
=
_valueDialogInstrumentValue
.
fact
?
_valueDialogInstrumentValue
.
fact
.
shortDescription
:
qsTr
(
"
Label
"
)
}
}
Item
{
width
:
1
;
height
:
1
}
Loader
{
Layout.fillWidth
:
true
sourceComponent
:
iconListHeader
.
checked
?
iconList
:
undefined
visible
:
iconListHeader
.
checked
}
}
Loader
{
QGCTextField
{
id
:
labelTextField
Layout.fillWidth
:
true
Layout.fillWidth
:
true
sourceComponent
:
factGroupList
Layout.columnSpan
:
2
text
:
_valueDialogInstrumentValue
.
label
property
var
factGroup
:
_activeVehicle
enabled
:
labelCheckBox
.
checked
property
string
factGroupName
:
"
Vehicle
"
}
}
Repeater
{
QGCLabel
{
text
:
qsTr
(
"
Size
"
)
}
model
:
_activeVehicle
.
factGroupNames
Loader
{
QGCComboBox
{
Layout.fillWidth
:
true
id
:
fontSizeCombo
sourceComponent
:
factGroupList
Layout.columnSpan
:
2
model
:
_valueDialogInstrumentValue
.
fontSizeNames
property
var
factGroup
:
_activeVehicle
.
getFactGroup
(
modelData
)
currentIndex
:
_valueDialogInstrumentValue
.
fontSize
property
string
factGroupName
:
modelData
sizeToContents
:
true
}
onActivated
:
_valueDialogInstrumentValue
.
fontSize
=
index
}
}
QGCCheckBox
{
Layout.columnSpan
:
3
text
:
qsTr
(
"
Show Units
"
)
checked
:
_valueDialogInstrumentValue
.
showUnits
onClicked
:
_valueDialogInstrumentValue
.
showUnits
=
checked
}
}
}
}
}
}
}
}
Component
{
Component
{
id
:
iconList
id
:
iconDialog
Flow
{
Rectangle
{
height
:
ScreenTools
.
minTouchPixels
width
:
noIconLabel
.
width
+
ScreenTools
.
defaultFontPixelWidth
*
2
color
:
isNoIcon
?
qgcPal
.
text
:
qgcPal
.
window
border.color
:
isNoIcon
?
qgcPal
.
window
:
qgcPal
.
text
property
bool
isNoIcon
:
_valuePickerInstrumentValue
.
icon
===
""
QGCLabel
{
QGCPopupDialog
{
id
:
noIconLabel
GridLayout
{
anchors.centerIn
:
parent
columns
:
10
color
:
parent
.
isNoIcon
?
qgcPal
.
window
:
qgcPal
.
text
columnSpacing
:
0
text
:
qsTr
(
"
No Icon
"
)
rowSpacing
:
0
}
MouseArea
{
anchors.fill
:
parent
onClicked
:
_valuePickerInstrumentValue
.
icon
=
""
}
}
Repeater
{
Repeater
{
model
:
_valuePicker
InstrumentValue
.
iconNames
model
:
_valueDialog
InstrumentValue
.
iconNames
Rectangle
{
Rectangle
{
height
:
ScreenTools
.
minTouchPixels
height
:
ScreenTools
.
minTouchPixels
width
:
height
width
:
height
color
:
currentSelection
?
qgcPal
.
text
:
qgcPal
.
window
color
:
currentSelection
?
qgcPal
.
text
:
qgcPal
.
window
property
bool
currentSelection
:
_valuePicker
InstrumentValue
.
icon
==
modelData
property
bool
currentSelection
:
_valueDialog
InstrumentValue
.
icon
==
modelData
QGCColoredImage
{
QGCColoredImage
{
anchors.centerIn
:
parent
anchors.centerIn
:
parent
...
@@ -467,47 +427,10 @@ Column {
...
@@ -467,47 +427,10 @@ Column {
MouseArea
{
MouseArea
{
anchors.fill
:
parent
anchors.fill
:
parent
onClicked
:
_valuePickerInstrumentValue
.
icon
=
modelData
onClicked
:
{
}
_valueDialogInstrumentValue
.
icon
=
modelData
}
hideDialog
()
}
}
}
}
Component
{
id
:
factGroupList
// You must push in the following properties from the Loader
// property var factGroup
// property string factGroupName
Column
{
SectionHeader
{
id
:
header
anchors.left
:
parent
.
left
anchors.right
:
parent
.
right
text
:
factGroupName
.
charAt
(
0
).
toUpperCase
()
+
factGroupName
.
slice
(
1
)
checked
:
false
}
}
Column
{
visible
:
header
.
checked
Repeater
{
model
:
factGroup
?
factGroup
.
factNames
:
0
QGCRadioButton
{
text
:
radioFact
.
shortDescription
ButtonGroup.group
:
factRadioGroup
checked
:
radioFactGroupName
==
_valuePickerInstrumentValue
.
factGroupName
&&
radioFact
==
_valuePickerInstrumentValue
.
fact
property
string
radioFactGroupName
:
factGroupName
property
var
radioFact
:
factGroup
.
getFact
(
modelData
)
Component.onCompleted
:
{
if
(
checked
)
{
header
.
checked
=
true
}
}
}
}
}
}
...
...
src/FlightMap/Widgets/ValuesWidgetController.cc
View file @
b458b751
...
@@ -29,6 +29,7 @@ const char* InstrumentValue::_fontSizeKey = "fontSize";
...
@@ -29,6 +29,7 @@ const char* InstrumentValue::_fontSizeKey = "fontSize";
const
char
*
InstrumentValue
::
_showUnitsKey
=
"showUnits"
;
const
char
*
InstrumentValue
::
_showUnitsKey
=
"showUnits"
;
const
char
*
InstrumentValue
::
_iconKey
=
"icon"
;
const
char
*
InstrumentValue
::
_iconKey
=
"icon"
;
const
char
*
InstrumentValue
::
_iconPositionKey
=
"iconPosition"
;
const
char
*
InstrumentValue
::
_iconPositionKey
=
"iconPosition"
;
const
char
*
InstrumentValue
::
_vehicleFactGroupName
=
"Vehicle"
;
QStringList
InstrumentValue
::
_iconNames
;
QStringList
InstrumentValue
::
_iconNames
;
...
@@ -234,28 +235,32 @@ void ValuesWidgetController::_loadSettings(void)
...
@@ -234,28 +235,32 @@ void ValuesWidgetController::_loadSettings(void)
QStringList
largeValues
=
settings
.
value
(
_deprecatedLargeValuesKey
).
toStringList
();
QStringList
largeValues
=
settings
.
value
(
_deprecatedLargeValuesKey
).
toStringList
();
QStringList
smallValues
=
settings
.
value
(
_deprecatedSmallValuesKey
).
toStringList
();
QStringList
smallValues
=
settings
.
value
(
_deprecatedSmallValuesKey
).
toStringList
();
QStringList
altitudeProperties
=
{
"
altitudeRelative"
,
"a
ltitudeAMSL"
};
QStringList
altitudeProperties
=
{
"
AltitudeRelative"
,
"A
ltitudeAMSL"
};
int
rowIndex
=
-
1
;
int
rowIndex
=
-
1
;
int
valueCount
=
0
;
int
valueCount
=
0
;
QmlObjectListModel
*
rowModel
=
nullptr
;
QmlObjectListModel
*
rowModel
=
nullptr
;
for
(
const
QString
&
largeValue
:
largeValues
)
{
for
(
const
QString
&
largeValue
:
largeValues
)
{
QStringList
parts
=
largeValue
.
split
(
"."
);
QStringList
parts
=
largeValue
.
split
(
"."
);
QString
factGroupName
=
_pascalCase
(
parts
[
0
]);
QString
factName
=
_pascalCase
(
parts
[
1
]);
rowModel
=
appendRow
(
false
/* addBlankColumn */
);
rowModel
=
appendRow
(
false
/* addBlankColumn */
);
rowIndex
++
;
rowIndex
++
;
InstrumentValue
*
colValue
=
appendColumn
(
rowIndex
);
InstrumentValue
*
colValue
=
appendColumn
(
rowIndex
);
colValue
->
setFact
(
parts
[
0
],
parts
[
1
],
QString
()
);
colValue
->
setFact
(
factGroupName
,
factName
);
colValue
->
setLabel
(
colValue
->
fact
()
->
shortDescription
());
colValue
->
setLabel
(
colValue
->
fact
()
->
shortDescription
());
colValue
->
setShowUnits
(
true
);
colValue
->
setShowUnits
(
true
);
colValue
->
setFontSize
(
altitudeProperties
.
contains
(
parts
[
1
]
)
?
InstrumentValue
::
LargeFontSize
:
InstrumentValue
::
DefaultFontSize
);
colValue
->
setFontSize
(
altitudeProperties
.
contains
(
factName
)
?
InstrumentValue
::
LargeFontSize
:
InstrumentValue
::
DefaultFontSize
);
}
}
valueCount
=
0
;
valueCount
=
0
;
rowModel
=
nullptr
;
rowModel
=
nullptr
;
for
(
const
QString
&
smallValue
:
smallValues
)
{
for
(
const
QString
&
smallValue
:
smallValues
)
{
QStringList
parts
=
smallValue
.
split
(
"."
);
QStringList
parts
=
smallValue
.
split
(
"."
);
QString
factGroupName
=
_pascalCase
(
parts
[
0
]);
QString
factName
=
_pascalCase
(
parts
[
1
]);
if
(
!
(
valueCount
++
&
1
))
{
if
(
!
(
valueCount
++
&
1
))
{
rowModel
=
appendRow
(
false
/* addBlankColumn */
);
rowModel
=
appendRow
(
false
/* addBlankColumn */
);
...
@@ -263,7 +268,7 @@ void ValuesWidgetController::_loadSettings(void)
...
@@ -263,7 +268,7 @@ void ValuesWidgetController::_loadSettings(void)
}
}
InstrumentValue
*
colValue
=
appendColumn
(
rowIndex
);
InstrumentValue
*
colValue
=
appendColumn
(
rowIndex
);
colValue
->
setFact
(
parts
[
0
],
parts
[
1
],
QString
()
);
colValue
->
setFact
(
factGroupName
,
factName
);
colValue
->
setLabel
(
colValue
->
fact
()
->
shortDescription
());
colValue
->
setLabel
(
colValue
->
fact
()
->
shortDescription
());
colValue
->
setShowUnits
(
true
);
colValue
->
setShowUnits
(
true
);
colValue
->
setFontSize
(
InstrumentValue
::
SmallFontSize
);
colValue
->
setFontSize
(
InstrumentValue
::
SmallFontSize
);
...
@@ -332,6 +337,11 @@ void ValuesWidgetController::setValuesModelParentController(ValuesWidgetControll
...
@@ -332,6 +337,11 @@ void ValuesWidgetController::setValuesModelParentController(ValuesWidgetControll
}
}
}
}
QString
ValuesWidgetController
::
_pascalCase
(
const
QString
&
text
)
{
return
text
[
0
].
toUpper
()
+
text
.
right
(
text
.
length
()
-
1
);
}
InstrumentValue
::
InstrumentValue
(
Vehicle
*
activeVehicle
,
FontSize
fontSize
,
QmlObjectListModel
*
rowModel
)
InstrumentValue
::
InstrumentValue
(
Vehicle
*
activeVehicle
,
FontSize
fontSize
,
QmlObjectListModel
*
rowModel
)
:
QObject
(
rowModel
)
:
QObject
(
rowModel
)
,
_activeVehicle
(
activeVehicle
)
,
_activeVehicle
(
activeVehicle
)
...
@@ -342,17 +352,27 @@ InstrumentValue::InstrumentValue(Vehicle* activeVehicle, FontSize fontSize, QmlO
...
@@ -342,17 +352,27 @@ InstrumentValue::InstrumentValue(Vehicle* activeVehicle, FontSize fontSize, QmlO
QDir
iconDir
(
":/InstrumentValueIcons/"
);
QDir
iconDir
(
":/InstrumentValueIcons/"
);
_iconNames
=
iconDir
.
entryList
();
_iconNames
=
iconDir
.
entryList
();
}
}
activeVehicleChanged
(
_activeVehicle
);
}
}
void
InstrumentValue
::
activeVehicleChanged
(
Vehicle
*
activeVehicle
)
void
InstrumentValue
::
activeVehicleChanged
(
Vehicle
*
activeVehicle
)
{
{
_activeVehicle
=
activeVehicle
;
_activeVehicle
=
activeVehicle
;
_factGroupNames
.
clear
();
_factGroupNames
=
_activeVehicle
->
factGroupNames
();
for
(
QString
&
name
:
_factGroupNames
)
{
name
[
0
]
=
name
[
0
].
toUpper
();
}
_factGroupNames
.
prepend
(
_vehicleFactGroupName
);
emit
factGroupNamesChanged
(
_factGroupNames
);
if
(
_fact
)
{
if
(
_fact
)
{
_fact
=
nullptr
;
_fact
=
nullptr
;
FactGroup
*
factGroup
=
nullptr
;
FactGroup
*
factGroup
=
nullptr
;
if
(
_factGroupName
==
QStringLiteral
(
"Vehicle"
)
)
{
if
(
_factGroupName
==
_vehicleFactGroupName
)
{
factGroup
=
_activeVehicle
;
factGroup
=
_activeVehicle
;
}
else
{
}
else
{
factGroup
=
_activeVehicle
->
getFactGroup
(
_factGroupName
);
factGroup
=
_activeVehicle
->
getFactGroup
(
_factGroupName
);
...
@@ -365,37 +385,47 @@ void InstrumentValue::activeVehicleChanged(Vehicle* activeVehicle)
...
@@ -365,37 +385,47 @@ void InstrumentValue::activeVehicleChanged(Vehicle* activeVehicle)
}
}
}
}
void
InstrumentValue
::
setFact
(
QString
factGroupName
,
QString
factName
,
QString
label
)
void
InstrumentValue
::
setFact
(
const
QString
&
factGroupName
,
const
QString
&
factName
)
{
{
if
(
_fact
)
{
if
(
_fact
)
{
_fact
=
nullptr
;
_fact
=
nullptr
;
}
}
FactGroup
*
factGroup
=
nullptr
;
FactGroup
*
factGroup
=
nullptr
;
if
(
factGroupName
==
QStringLiteral
(
"Vehicle"
)
)
{
if
(
factGroupName
==
_vehicleFactGroupName
)
{
factGroup
=
_activeVehicle
;
factGroup
=
_activeVehicle
;
}
else
{
}
else
{
factGroup
=
_activeVehicle
->
getFactGroup
(
factGroupName
);
factGroup
=
_activeVehicle
->
getFactGroup
(
factGroupName
);
}
}
_factValueNames
.
clear
();
_factValueNames
=
factGroup
->
factNames
();
for
(
QString
&
name
:
_factValueNames
)
{
name
[
0
]
=
name
[
0
].
toUpper
();
}
QString
nonEmptyFactName
;
if
(
factGroup
)
{
if
(
factGroup
)
{
_fact
=
factGroup
->
getFact
(
factName
);
if
(
factName
.
isEmpty
())
{
nonEmptyFactName
=
_factValueNames
[
0
];
}
else
{
nonEmptyFactName
=
factName
;
}
_fact
=
factGroup
->
getFact
(
nonEmptyFactName
);
}
}
if
(
_fact
)
{
if
(
_fact
)
{
_factName
=
factName
;
_factGroupName
=
factGroupName
;
_factGroupName
=
factGroupName
;
_
label
=
label
;
_
factName
=
nonEmptyFactName
;
}
else
{
}
else
{
_factName
.
clear
();
_factName
.
clear
();
_factGroupName
.
clear
();
_factGroupName
.
clear
();
_label
.
clear
();
}
}
emit
labelChanged
(
_label
);
emit
factChanged
(
_fact
);
emit
fact
Changed
(
_fact
);
emit
fact
NameChanged
(
_factName
);
emit
fact
NameChanged
(
_fact
Name
);
emit
fact
GroupNameChanged
(
_factGroup
Name
);
emit
fact
GroupNameChanged
(
_factGroupName
);
emit
fact
ValueNamesChanged
(
_factValueNames
);
}
}
void
InstrumentValue
::
_setFontSize
(
FontSize
fontSize
)
void
InstrumentValue
::
_setFontSize
(
FontSize
fontSize
)
...
@@ -423,7 +453,7 @@ void InstrumentValue::saveToSettings(QSettings& settings) const
...
@@ -423,7 +453,7 @@ void InstrumentValue::saveToSettings(QSettings& settings) const
{
{
if
(
_fact
)
{
if
(
_fact
)
{
settings
.
setValue
(
_factGroupNameKey
,
_factGroupName
);
settings
.
setValue
(
_factGroupNameKey
,
_factGroupName
);
settings
.
setValue
(
_factNameKey
,
_fact
->
name
()
);
settings
.
setValue
(
_factNameKey
,
_fact
Name
);
}
else
{
}
else
{
settings
.
setValue
(
_factGroupNameKey
,
""
);
settings
.
setValue
(
_factGroupNameKey
,
""
);
settings
.
setValue
(
_factNameKey
,
""
);
settings
.
setValue
(
_factNameKey
,
""
);
...
@@ -446,7 +476,7 @@ void InstrumentValue::readFromSettings(const QSettings& settings)
...
@@ -446,7 +476,7 @@ void InstrumentValue::readFromSettings(const QSettings& settings)
QString
factName
=
settings
.
value
(
_factNameKey
).
toString
();
QString
factName
=
settings
.
value
(
_factNameKey
).
toString
();
if
(
!
factName
.
isEmpty
())
{
if
(
!
factName
.
isEmpty
())
{
setFact
(
_factGroupName
,
factName
,
_label
);
setFact
(
_factGroupName
,
factName
);
}
}
emit
factChanged
(
_fact
);
emit
factChanged
(
_fact
);
...
...
src/FlightMap/Widgets/ValuesWidgetController.h
View file @
b458b751
...
@@ -38,7 +38,10 @@ public:
...
@@ -38,7 +38,10 @@ public:
InstrumentValue
(
Vehicle
*
activeVehicle
,
FontSize
fontSize
,
QmlObjectListModel
*
rowModel
);
InstrumentValue
(
Vehicle
*
activeVehicle
,
FontSize
fontSize
,
QmlObjectListModel
*
rowModel
);
Q_PROPERTY
(
QStringList
factGroupNames
MEMBER
_factGroupNames
NOTIFY
factGroupNamesChanged
)
Q_PROPERTY
(
QStringList
factValueNames
MEMBER
_factValueNames
NOTIFY
factValueNamesChanged
)
Q_PROPERTY
(
QString
factGroupName
MEMBER
_factGroupName
NOTIFY
factGroupNameChanged
)
Q_PROPERTY
(
QString
factGroupName
MEMBER
_factGroupName
NOTIFY
factGroupNameChanged
)
Q_PROPERTY
(
QString
factName
MEMBER
_factName
NOTIFY
factNameChanged
)
Q_PROPERTY
(
Fact
*
fact
READ
fact
NOTIFY
factChanged
)
Q_PROPERTY
(
Fact
*
fact
READ
fact
NOTIFY
factChanged
)
Q_PROPERTY
(
QString
label
READ
label
WRITE
setLabel
NOTIFY
labelChanged
)
Q_PROPERTY
(
QString
label
READ
label
WRITE
setLabel
NOTIFY
labelChanged
)
Q_PROPERTY
(
QString
icon
READ
icon
WRITE
setIcon
NOTIFY
iconChanged
)
///< If !isEmpty icon will be show instead of label
Q_PROPERTY
(
QString
icon
READ
icon
WRITE
setIcon
NOTIFY
iconChanged
)
///< If !isEmpty icon will be show instead of label
...
@@ -49,7 +52,7 @@ public:
...
@@ -49,7 +52,7 @@ public:
Q_PROPERTY
(
QStringList
fontSizeNames
MEMBER
_fontSizeNames
CONSTANT
)
Q_PROPERTY
(
QStringList
fontSizeNames
MEMBER
_fontSizeNames
CONSTANT
)
Q_PROPERTY
(
bool
showUnits
READ
showUnits
WRITE
setShowUnits
NOTIFY
showUnitsChanged
)
Q_PROPERTY
(
bool
showUnits
READ
showUnits
WRITE
setShowUnits
NOTIFY
showUnitsChanged
)
Q_INVOKABLE
void
setFact
(
QString
factGroupName
,
QString
factName
,
QString
label
);
Q_INVOKABLE
void
setFact
(
const
QString
&
factGroupName
,
const
QString
&
factName
);
Q_INVOKABLE
void
clearFact
(
void
);
Q_INVOKABLE
void
clearFact
(
void
);
Fact
*
fact
(
void
)
{
return
_fact
;
}
Fact
*
fact
(
void
)
{
return
_fact
;
}
...
@@ -76,6 +79,8 @@ signals:
...
@@ -76,6 +79,8 @@ signals:
void
showUnitsChanged
(
bool
showUnits
);
void
showUnitsChanged
(
bool
showUnits
);
void
iconChanged
(
const
QString
&
icon
);
void
iconChanged
(
const
QString
&
icon
);
void
iconPositionChanged
(
IconPosition
iconPosition
);
void
iconPositionChanged
(
IconPosition
iconPosition
);
void
factGroupNamesChanged
(
const
QStringList
&
factGroupNames
);
void
factValueNamesChanged
(
const
QStringList
&
factValueNames
);
private:
private:
void
_setFontSize
(
FontSize
fontSize
);
void
_setFontSize
(
FontSize
fontSize
);
...
@@ -90,6 +95,8 @@ private:
...
@@ -90,6 +95,8 @@ private:
FontSize
_fontSize
=
DefaultFontSize
;
FontSize
_fontSize
=
DefaultFontSize
;
QString
_icon
;
QString
_icon
;
IconPosition
_iconPosition
=
IconLeft
;
IconPosition
_iconPosition
=
IconLeft
;
QStringList
_factGroupNames
;
QStringList
_factValueNames
;
static
const
QStringList
_iconPositionNames
;
static
const
QStringList
_iconPositionNames
;
static
QStringList
_iconNames
;
static
QStringList
_iconNames
;
...
@@ -102,6 +109,7 @@ private:
...
@@ -102,6 +109,7 @@ private:
static
const
char
*
_showUnitsKey
;
static
const
char
*
_showUnitsKey
;
static
const
char
*
_iconKey
;
static
const
char
*
_iconKey
;
static
const
char
*
_iconPositionKey
;
static
const
char
*
_iconPositionKey
;
static
const
char
*
_vehicleFactGroupName
;
};
};
Q_DECLARE_METATYPE
(
InstrumentValue
::
FontSize
)
Q_DECLARE_METATYPE
(
InstrumentValue
::
FontSize
)
...
@@ -146,7 +154,7 @@ private:
...
@@ -146,7 +154,7 @@ private:
InstrumentValue
*
_createNewInstrumentValueWorker
(
Vehicle
*
activeVehicle
,
InstrumentValue
::
FontSize
fontSize
,
QmlObjectListModel
*
rowModel
);
InstrumentValue
*
_createNewInstrumentValueWorker
(
Vehicle
*
activeVehicle
,
InstrumentValue
::
FontSize
fontSize
,
QmlObjectListModel
*
rowModel
);
void
_loadSettings
(
void
);
void
_loadSettings
(
void
);
void
_connectSignalsToController
(
InstrumentValue
*
value
,
ValuesWidgetController
*
controller
);
void
_connectSignalsToController
(
InstrumentValue
*
value
,
ValuesWidgetController
*
controller
);
QString
_pascalCase
(
const
QString
&
text
);
MultiVehicleManager
*
_multiVehicleMgr
=
nullptr
;
MultiVehicleManager
*
_multiVehicleMgr
=
nullptr
;
QmlObjectListModel
*
_valuesModel
=
nullptr
;
QmlObjectListModel
*
_valuesModel
=
nullptr
;
...
...
src/QmlControls/QGCPopupDialog.qml
0 → 100644
View file @
b458b751
/****************************************************************************
*
* (c) 2009-2020 QGROUNDCONTROL PROJECT <http://www.qgroundcontrol.org>
*
* QGroundControl is licensed according to the terms in the file
* COPYING.md in the root of the source code directory.
*
****************************************************************************/
import
QtQuick
2.12
Item
{
width
:
childrenRect
.
width
height
:
childrenRect
.
height
signal
hideDialog
Keys.onReleased
:
{
if
(
event
.
key
===
Qt
.
Key_Escape
)
{
reject
()
event
.
accepted
=
true
}
else
if
(
event
.
key
===
Qt
.
Key_Return
||
event
.
key
===
Qt
.
Key_Enter
)
{
accept
()
event
.
accepted
=
true
}
}
function
accept
()
{
if
(
acceptAllowed
)
{
Qt
.
inputMethod
.
hide
()
hideDialog
()
}
}
function
reject
()
{
if
(
rejectAllowed
)
{
Qt
.
inputMethod
.
hide
()
hideDialog
()
}
}
}
src/QmlControls/QGCPopupDialogContainer.qml
0 → 100644
View file @
b458b751
/****************************************************************************
*
* (c) 2009-2020 QGROUNDCONTROL PROJECT <http://www.qgroundcontrol.org>
*
* QGroundControl is licensed according to the terms in the file
* COPYING.md in the root of the source code directory.
*
****************************************************************************/
import
QtQuick
2.12
import
QtQuick
.
Controls
2.4
import
QtQuick
.
Layouts
1.12
import
QtQuick
.
Dialogs
1.3
import
QGroundControl
1.0
import
QGroundControl
.
Controls
1.0
import
QGroundControl
.
Palette
1.0
import
QGroundControl
.
ScreenTools
1.0
Popup
{
anchors.centerIn
:
parent
width
:
mainFlickable
.
width
height
:
mainFlickable
.
height
padding
:
0
modal
:
true
focus
:
true
background
:
Rectangle
{
color
:
QGroundControl
.
globalPalette
.
window
}
property
string
title
property
var
buttons
property
var
dialogComponent
property
real
_contentMargin
:
ScreenTools
.
defaultFontPixelHeight
/
2
property
real
_popupDoubleInset
:
ScreenTools
.
defaultFontPixelHeight
*
2
property
real
_maxAvailableWidth
:
parent
.
width
-
_popupDoubleInset
property
real
_maxAvailableHeight
:
parent
.
height
-
_popupDoubleInset
Component.onCompleted
:
setupDialogButtons
()
QGCPalette
{
id
:
qgcPal
;
colorGroupEnabled
:
parent
.
enabled
}
function
setupDialogButtons
()
{
acceptButton
.
visible
=
false
rejectButton
.
visible
=
false
// Accept role buttons
if
(
buttons
&
StandardButton
.
Ok
)
{
acceptButton
.
text
=
qsTr
(
"
Ok
"
)
acceptButton
.
visible
=
true
}
else
if
(
buttons
&
StandardButton
.
Open
)
{
acceptButton
.
text
=
qsTr
(
"
Open
"
)
acceptButton
.
visible
=
true
}
else
if
(
buttons
&
StandardButton
.
Save
)
{
acceptButton
.
text
=
qsTr
(
"
Save
"
)
acceptButton
.
visible
=
true
}
else
if
(
buttons
&
StandardButton
.
Apply
)
{
acceptButton
.
text
=
qsTr
(
"
Apply
"
)
acceptButton
.
visible
=
true
}
else
if
(
buttons
&
StandardButton
.
Open
)
{
acceptButton
.
text
=
qsTr
(
"
Open
"
)
acceptButton
.
visible
=
true
}
else
if
(
buttons
&
StandardButton
.
SaveAll
)
{
acceptButton
.
text
=
qsTr
(
"
Save All
"
)
acceptButton
.
visible
=
true
}
else
if
(
buttons
&
StandardButton
.
Yes
)
{
acceptButton
.
text
=
qsTr
(
"
Yes
"
)
acceptButton
.
visible
=
true
}
else
if
(
buttons
&
StandardButton
.
YesToAll
)
{
acceptButton
.
text
=
qsTr
(
"
Yes to All
"
)
acceptButton
.
visible
=
true
}
else
if
(
buttons
&
StandardButton
.
Retry
)
{
acceptButton
.
text
=
qsTr
(
"
Retry
"
)
acceptButton
.
visible
=
true
}
else
if
(
buttons
&
StandardButton
.
Reset
)
{
acceptButton
.
text
=
qsTr
(
"
Reset
"
)
acceptButton
.
visible
=
true
}
else
if
(
buttons
&
StandardButton
.
RestoreToDefaults
)
{
acceptButton
.
text
=
qsTr
(
"
Restore to Defaults
"
)
acceptButton
.
visible
=
true
}
else
if
(
buttons
&
StandardButton
.
Ignore
)
{
acceptButton
.
text
=
qsTr
(
"
Ignore
"
)
acceptButton
.
visible
=
true
}
// Reject role buttons
if
(
buttons
&
StandardButton
.
Cancel
)
{
rejectButton
.
text
=
qsTr
(
"
Cancel
"
)
rejectButton
.
visible
=
true
}
else
if
(
buttons
&
StandardButton
.
Close
)
{
rejectButton
.
text
=
qsTr
(
"
Close
"
)
rejectButton
.
visible
=
true
}
else
if
(
buttons
&
StandardButton
.
No
)
{
rejectButton
.
text
=
qsTr
(
"
No
"
)
rejectButton
.
visible
=
true
}
else
if
(
buttons
&
StandardButton
.
NoToAll
)
{
rejectButton
.
text
=
qsTr
(
"
No to All
"
)
rejectButton
.
visible
=
true
}
else
if
(
buttons
&
StandardButton
.
Abort
)
{
rejectButton
.
text
=
qsTr
(
"
Abort
"
)
rejectButton
.
visible
=
true
}
if
(
rejectButton
.
visible
)
{
closePolicy
=
Popup
.
NoAutoClose
|
Popup
.
CloseOnEscape
}
else
{
closePolicy
=
Popup
.
NoAutoClose
}
}
Connections
{
target
:
dialogComponentLoader
.
item
onHideDialog
:
close
()
}
QGCFlickable
{
id
:
mainFlickable
width
:
Math
.
min
(
mainColumnLayout
.
width
,
_maxAvailableWidth
)
height
:
Math
.
min
(
mainColumnLayout
.
height
,
_maxAvailableHeight
)
contentWidth
:
mainColumnLayout
.
width
contentHeight
:
mainColumnLayout
.
height
Rectangle
{
width
:
titleRowLayout
.
width
height
:
titleRowLayout
.
height
color
:
qgcPal
.
windowShade
}
ColumnLayout
{
id
:
mainColumnLayout
spacing
:
_contentMargin
RowLayout
{
id
:
titleRowLayout
Layout.fillWidth
:
true
QGCLabel
{
Layout.leftMargin
:
ScreenTools
.
defaultFontPixelWidth
Layout.fillWidth
:
true
text
:
title
height
:
parent
.
height
verticalAlignment
:
Text
.
AlignVCenter
}
QGCButton
{
id
:
rejectButton
onClicked
:
dialogComponentLoader
.
item
.
reject
()
}
QGCButton
{
id
:
acceptButton
primary
:
true
onClicked
:
dialogComponentLoader
.
item
.
accept
()
}
}
Item
{
id
:
item
width
:
dialogComponentLoader
.
width
+
(
_contentMargin
*
2
)
height
:
dialogComponentLoader
.
height
+
_contentMargin
Loader
{
id
:
dialogComponentLoader
x
:
_contentMargin
sourceComponent
:
dialogComponent
focus
:
true
property
bool
acceptAllowed
:
acceptButton
.
visible
property
bool
rejectAllowed
:
rejectButton
.
visible
}
}
}
}
}
src/QmlControls/QGroundControl/Controls/qmldir
View file @
b458b751
...
@@ -64,6 +64,8 @@ QGCMouseArea 1.0 QGCMouseArea.qml
...
@@ -64,6 +64,8 @@ QGCMouseArea 1.0 QGCMouseArea.qml
QGCMovableItem 1.0 QGCMovableItem.qml
QGCMovableItem 1.0 QGCMovableItem.qml
QGCOptionsComboBox 1.0 QGCOptionsComboBox.qml
QGCOptionsComboBox 1.0 QGCOptionsComboBox.qml
QGCPipable 1.0 QGCPipable.qml
QGCPipable 1.0 QGCPipable.qml
QGCPopupDialog 1.0 QGCPopupDialog.qml
QGCPopupDialogContainer 1.0 QGCPopupDialogContainer.qml
QGCRadioButton 1.0 QGCRadioButton.qml
QGCRadioButton 1.0 QGCRadioButton.qml
QGCSlider 1.0 QGCSlider.qml
QGCSlider 1.0 QGCSlider.qml
QGCSwitch 1.0 QGCSwitch.qml
QGCSwitch 1.0 QGCSwitch.qml
...
...
src/api/QGCCorePlugin.cc
View file @
b458b751
...
@@ -417,21 +417,21 @@ QmlObjectListModel* QGCCorePlugin::valuesWidgetDefaultSettings(ValuesWidgetContr
...
@@ -417,21 +417,21 @@ QmlObjectListModel* QGCCorePlugin::valuesWidgetDefaultSettings(ValuesWidgetContr
QmlObjectListModel
*
columnModel
=
controller
.
appendRow
();
QmlObjectListModel
*
columnModel
=
controller
.
appendRow
();
InstrumentValue
*
colValue
=
columnModel
->
value
<
InstrumentValue
*>
(
0
);
InstrumentValue
*
colValue
=
columnModel
->
value
<
InstrumentValue
*>
(
0
);
colValue
->
setFact
(
"Vehicle"
,
"
altitudeRelative"
,
QString
()
);
colValue
->
setFact
(
"Vehicle"
,
"
AltitudeRelative"
);
colValue
->
setLabel
(
colValue
->
fact
()
->
shortDescription
());
colValue
->
setLabel
(
colValue
->
fact
()
->
shortDescription
());
colValue
->
setShowUnits
(
true
);
colValue
->
setShowUnits
(
true
);
colValue
->
setFontSize
(
InstrumentValue
::
LargeFontSize
);
colValue
->
setFontSize
(
InstrumentValue
::
LargeFontSize
);
columnModel
=
controller
.
appendRow
();
columnModel
=
controller
.
appendRow
();
colValue
=
columnModel
->
value
<
InstrumentValue
*>
(
0
);
colValue
=
columnModel
->
value
<
InstrumentValue
*>
(
0
);
colValue
->
setFact
(
"Vehicle"
,
"
groundSpeed"
,
QString
()
);
colValue
->
setFact
(
"Vehicle"
,
"
GroundSpeed"
);
colValue
->
setLabel
(
colValue
->
fact
()
->
shortDescription
());
colValue
->
setLabel
(
colValue
->
fact
()
->
shortDescription
());
colValue
->
setShowUnits
(
true
);
colValue
->
setShowUnits
(
true
);
colValue
->
setFontSize
(
InstrumentValue
::
DefaultFontSize
);
colValue
->
setFontSize
(
InstrumentValue
::
DefaultFontSize
);
columnModel
=
controller
.
appendRow
();
columnModel
=
controller
.
appendRow
();
colValue
=
columnModel
->
value
<
InstrumentValue
*>
(
0
);
colValue
=
columnModel
->
value
<
InstrumentValue
*>
(
0
);
colValue
->
setFact
(
"Vehicle"
,
"
flightTime"
,
QString
()
);
colValue
->
setFact
(
"Vehicle"
,
"
FlightTime"
);
colValue
->
setLabel
(
colValue
->
fact
()
->
shortDescription
());
colValue
->
setLabel
(
colValue
->
fact
()
->
shortDescription
());
colValue
->
setShowUnits
(
false
);
colValue
->
setShowUnits
(
false
);
colValue
->
setFontSize
(
InstrumentValue
::
DefaultFontSize
);
colValue
->
setFontSize
(
InstrumentValue
::
DefaultFontSize
);
...
...
src/ui/MainRootWindow.qml
View file @
b458b751
...
@@ -223,6 +223,16 @@ ApplicationWindow {
...
@@ -223,6 +223,16 @@ ApplicationWindow {
}
}
}
}
function
showPopupDialog
(
component
,
title
,
buttons
)
{
var
popup
=
popupDialogContainterComponent
.
createObject
(
mainWindow
,
{
"
title
"
:
title
,
"
buttons
"
:
buttons
,
"
dialogComponent
"
:
component
})
popup
.
open
()
}
Component
{
id
:
popupDialogContainterComponent
QGCPopupDialogContainer
{
}
}
property
bool
_forceClose
:
false
property
bool
_forceClose
:
false
function
finishCloseProcess
()
{
function
finishCloseProcess
()
{
...
...
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