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
31930fd3
Commit
31930fd3
authored
Aug 23, 2020
by
DonLakeFlyer
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
parent
eb07fbba
Changes
7
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
224 additions
and
199 deletions
+224
-199
FactValueGrid.cc
src/QmlControls/FactValueGrid.cc
+21
-19
FactValueGrid.h
src/QmlControls/FactValueGrid.h
+2
-0
HorizontalFactValueGrid.cc
src/QmlControls/HorizontalFactValueGrid.cc
+2
-2
InstrumentValueData.cc
src/QmlControls/InstrumentValueData.cc
+34
-33
InstrumentValueData.h
src/QmlControls/InstrumentValueData.h
+2
-0
InstrumentValueEditDialog.qml
src/QmlControls/InstrumentValueEditDialog.qml
+154
-139
InstrumentValueValue.qml
src/QmlControls/InstrumentValueValue.qml
+9
-6
No files found.
src/QmlControls/FactValueGrid.cc
View file @
31930fd3
...
...
@@ -14,19 +14,21 @@
#include <QSettings>
const
char
*
FactValueGrid
::
_rowsKey
=
"rows"
;
const
char
*
FactValueGrid
::
_fontSizeKey
=
"fontSize"
;
const
char
*
FactValueGrid
::
_versionKey
=
"version"
;
const
char
*
FactValueGrid
::
_factGroupNameKey
=
"groupName"
;
const
char
*
FactValueGrid
::
_factNameKey
=
"factName"
;
const
char
*
FactValueGrid
::
_textKey
=
"text"
;
const
char
*
FactValueGrid
::
_showUnitsKey
=
"showUnits"
;
const
char
*
FactValueGrid
::
_iconKey
=
"icon"
;
const
char
*
FactValueGrid
::
_rangeTypeKey
=
"rangeType"
;
const
char
*
FactValueGrid
::
_rangeValuesKey
=
"rangeValues"
;
const
char
*
FactValueGrid
::
_rangeColorsKey
=
"rangeColors"
;
const
char
*
FactValueGrid
::
_rangeIconsKey
=
"rangeIcons"
;
const
char
*
FactValueGrid
::
_rangeOpacitiesKey
=
"rangeOpacities"
;
const
char
*
FactValueGrid
::
_columnsKey
=
"columns"
;
const
char
*
FactValueGrid
::
_rowsKey
=
"rows"
;
const
char
*
FactValueGrid
::
_rowCountKey
=
"rowCount"
;
const
char
*
FactValueGrid
::
_fontSizeKey
=
"fontSize"
;
const
char
*
FactValueGrid
::
_versionKey
=
"version"
;
const
char
*
FactValueGrid
::
_factGroupNameKey
=
"factGroupName"
;
const
char
*
FactValueGrid
::
_factNameKey
=
"factName"
;
const
char
*
FactValueGrid
::
_textKey
=
"text"
;
const
char
*
FactValueGrid
::
_showUnitsKey
=
"showUnits"
;
const
char
*
FactValueGrid
::
_iconKey
=
"icon"
;
const
char
*
FactValueGrid
::
_rangeTypeKey
=
"rangeType"
;
const
char
*
FactValueGrid
::
_rangeValuesKey
=
"rangeValues"
;
const
char
*
FactValueGrid
::
_rangeColorsKey
=
"rangeColors"
;
const
char
*
FactValueGrid
::
_rangeIconsKey
=
"rangeIcons"
;
const
char
*
FactValueGrid
::
_rangeOpacitiesKey
=
"rangeOpacities"
;
const
char
*
FactValueGrid
::
_deprecatedGroupKey
=
"ValuesWidget"
;
...
...
@@ -272,9 +274,9 @@ void FactValueGrid::_saveSettings(void)
settings
.
setValue
(
_versionKey
,
1
);
settings
.
setValue
(
_fontSizeKey
,
_fontSize
);
settings
.
setValue
(
_row
sKey
,
_rowCount
);
settings
.
setValue
(
_row
CountKey
,
_rowCount
);
settings
.
beginWriteArray
(
_
row
sKey
);
settings
.
beginWriteArray
(
_
column
sKey
);
for
(
int
colIndex
=
0
;
colIndex
<
_columns
->
count
();
colIndex
++
)
{
QmlObjectListModel
*
columns
=
_columns
->
value
<
QmlObjectListModel
*>
(
colIndex
);
...
...
@@ -324,11 +326,11 @@ void FactValueGrid::_loadSettings(void)
_fontSize
=
settings
.
value
(
_fontSizeKey
,
DefaultFontSize
).
value
<
FontSize
>
();
// Initial setup of empty items
int
c
Columns
=
settings
.
value
(
_rows
Key
).
toInt
();
int
cModelLists
=
settings
.
beginReadArray
(
_
row
sKey
);
if
(
cModelLists
&&
c
Column
s
)
{
int
c
Rows
=
settings
.
value
(
_rowCount
Key
).
toInt
();
int
cModelLists
=
settings
.
beginReadArray
(
_
column
sKey
);
if
(
cModelLists
&&
c
Row
s
)
{
appendColumn
();
for
(
int
itemIndex
=
1
;
itemIndex
<
cColumns
;
item
Index
++
)
{
for
(
int
rowIndex
=
1
;
rowIndex
<
cRows
;
row
Index
++
)
{
appendRow
();
}
for
(
int
colIndex
=
1
;
colIndex
<
cModelLists
;
colIndex
++
)
{
...
...
src/QmlControls/FactValueGrid.h
View file @
31930fd3
...
...
@@ -104,7 +104,9 @@ private:
static
const
QStringList
_fontSizeNames
;
static
const
char
*
_versionKey
;
static
const
char
*
_columnsKey
;
static
const
char
*
_rowsKey
;
static
const
char
*
_rowCountKey
;
static
const
char
*
_fontSizeKey
;
static
const
char
*
_factGroupNameKey
;
static
const
char
*
_factNameKey
;
...
...
src/QmlControls/HorizontalFactValueGrid.cc
View file @
31930fd3
...
...
@@ -14,8 +14,8 @@
#include <QSettings>
const
QString
HorizontalFactValueGrid
::
_toolbarUserSettingsGroup
(
"TelemetryBarUserSettingsWIP0
1
"
);
const
QString
HorizontalFactValueGrid
::
telemetryBarDefaultSettingsGroup
(
"TelemetryBarDefaultSettingsWIP0
1
"
);
const
QString
HorizontalFactValueGrid
::
_toolbarUserSettingsGroup
(
"TelemetryBarUserSettingsWIP0
2
"
);
const
QString
HorizontalFactValueGrid
::
telemetryBarDefaultSettingsGroup
(
"TelemetryBarDefaultSettingsWIP0
2
"
);
HorizontalFactValueGrid
::
HorizontalFactValueGrid
(
QQuickItem
*
parent
)
:
FactValueGrid
(
parent
)
...
...
src/QmlControls/InstrumentValueData.cc
View file @
31930fd3
...
...
@@ -42,37 +42,31 @@ InstrumentValueData::InstrumentValueData(FactValueGrid* factValueGrid, QObject*
void
InstrumentValueData
::
_activeVehicleChanged
(
Vehicle
*
activeVehicle
)
{
if
(
!
activeVehicle
)
{
activeVehicle
=
qgcApp
()
->
toolbox
()
->
multiVehicleManager
()
->
offlineEditingVehicle
(
);
if
(
_
activeVehicle
)
{
disconnect
(
_activeVehicle
,
&
Vehicle
::
factGroupNamesChanged
,
this
,
&
InstrumentValueData
::
_lookForMissingFact
);
}
if
(
_fact
)
{
disconnect
(
_fact
,
&
Fact
::
rawValueChanged
,
this
,
&
InstrumentValueData
::
_updateColor
);
if
(
!
activeVehicle
)
{
activeVehicle
=
qgcApp
()
->
toolbox
()
->
multiVehicleManager
()
->
offlineEditingVehicle
(
);
}
_activeVehicle
=
activeVehicle
;
connect
(
_activeVehicle
,
&
Vehicle
::
factGroupNamesChanged
,
this
,
&
InstrumentValueData
::
_lookForMissingFact
);
emit
factGroupNamesChanged
();
if
(
_fact
)
{
_fact
=
nullptr
;
FactGroup
*
factGroup
=
nullptr
;
if
(
_factGroupName
==
vehicleFactGroupName
)
{
factGroup
=
_activeVehicle
;
}
else
{
factGroup
=
_activeVehicle
->
getFactGroup
(
_factGroupName
);
}
if
(
factGroup
)
{
_fact
=
factGroup
->
getFact
(
_factName
);
}
emit
factChanged
(
_fact
);
connect
(
_fact
,
&
Fact
::
rawValueChanged
,
this
,
&
InstrumentValueData
::
_updateRanges
);
if
(
!
_factGroupName
.
isEmpty
()
&&
!
_factName
.
isEmpty
())
{
_setFactWorker
();
}
}
_updateRanges
();
void
InstrumentValueData
::
_lookForMissingFact
(
void
)
{
// This is called when new fact groups show up on the vehicle. We need to see if we can fill in any
// facts which may have been missing up to now.
if
(
!
_fact
)
{
_setFactWorker
();
}
}
void
InstrumentValueData
::
clearFact
(
void
)
...
...
@@ -92,7 +86,7 @@ void InstrumentValueData::clearFact(void)
emit
showUnitsChanged
(
_showUnits
);
}
void
InstrumentValueData
::
setFact
(
const
QString
&
factGroupName
,
const
QString
&
factName
)
void
InstrumentValueData
::
_setFactWorker
(
void
)
{
if
(
_fact
)
{
disconnect
(
_fact
,
&
Fact
::
rawValueChanged
,
this
,
&
InstrumentValueData
::
_updateRanges
);
...
...
@@ -100,19 +94,18 @@ void InstrumentValueData::setFact(const QString& factGroupName, const QString& f
}
FactGroup
*
factGroup
=
nullptr
;
if
(
factGroupName
==
vehicleFactGroupName
)
{
if
(
_
factGroupName
==
vehicleFactGroupName
)
{
factGroup
=
_activeVehicle
;
}
else
{
factGroup
=
_activeVehicle
->
getFactGroup
(
factGroupName
);
factGroup
=
_activeVehicle
->
getFactGroup
(
_
factGroupName
);
}
_factGroupName
=
factGroupName
;
QString
nonEmptyFactName
;
if
(
factGroup
)
{
if
(
factName
.
isEmpty
())
{
if
(
_
factName
.
isEmpty
())
{
nonEmptyFactName
=
factValueNames
()[
0
];
}
else
{
nonEmptyFactName
=
factName
;
nonEmptyFactName
=
_
factName
;
}
_fact
=
factGroup
->
getFact
(
nonEmptyFactName
);
}
...
...
@@ -120,9 +113,6 @@ void InstrumentValueData::setFact(const QString& factGroupName, const QString& f
if
(
_fact
)
{
_factName
=
nonEmptyFactName
;
connect
(
_fact
,
&
Fact
::
rawValueChanged
,
this
,
&
InstrumentValueData
::
_updateRanges
);
}
else
{
_factGroupName
.
clear
();
_factName
.
clear
();
}
emit
factValueNamesChanged
();
...
...
@@ -132,6 +122,13 @@ void InstrumentValueData::setFact(const QString& factGroupName, const QString& f
_updateRanges
();
}
void
InstrumentValueData
::
setFact
(
const
QString
&
factGroupName
,
const
QString
&
factName
)
{
_factGroupName
=
factGroupName
;
_factName
=
factName
;
_setFactWorker
();
}
void
InstrumentValueData
::
setText
(
const
QString
&
text
)
{
...
...
@@ -364,6 +361,8 @@ QStringList InstrumentValueData::factGroupNames(void) const
QStringList
InstrumentValueData
::
factValueNames
(
void
)
const
{
QStringList
valueNames
;
FactGroup
*
factGroup
=
nullptr
;
if
(
_factGroupName
==
vehicleFactGroupName
)
{
factGroup
=
_activeVehicle
;
...
...
@@ -371,9 +370,11 @@ QStringList InstrumentValueData::factValueNames(void) const
factGroup
=
_activeVehicle
->
getFactGroup
(
_factGroupName
);
}
QStringList
valueNames
=
factGroup
->
factNames
();
for
(
QString
&
name
:
valueNames
)
{
name
[
0
]
=
name
[
0
].
toUpper
();
if
(
factGroup
)
{
valueNames
=
factGroup
->
factNames
();
for
(
QString
&
name
:
valueNames
)
{
name
[
0
]
=
name
[
0
].
toUpper
();
}
}
return
valueNames
;
...
...
src/QmlControls/InstrumentValueData.h
View file @
31930fd3
...
...
@@ -105,12 +105,14 @@ private slots:
void
_resetRangeInfo
(
void
);
void
_updateRanges
(
void
);
void
_activeVehicleChanged
(
Vehicle
*
activeVehicle
);
void
_lookForMissingFact
(
void
);
private:
int
_currentRangeIndex
(
const
QVariant
&
value
);
void
_updateColor
(
void
);
void
_updateIcon
(
void
);
void
_updateOpacity
(
void
);
void
_setFactWorker
(
void
);
FactValueGrid
*
_factValueGrid
=
nullptr
;
Vehicle
*
_activeVehicle
=
nullptr
;
...
...
src/QmlControls/InstrumentValueEditDialog.qml
View file @
31930fd3
This diff is collapsed.
Click to expand it.
src/QmlControls/InstrumentValueValue.qml
View file @
31930fd3
...
...
@@ -23,7 +23,6 @@ ColumnLayout {
property
bool
settingsUnlocked
:
false
property
alias
contentWidth
:
label
.
contentWidth
property
bool
_verticalOrientation
:
instrumentValueData
.
factValueGrid
.
orientation
===
FactValueGrid
.
VerticalOrientation
property
var
_rgFontSizes
:
[
ScreenTools
.
defaultFontPointSize
,
ScreenTools
.
smallFontPointSize
,
ScreenTools
.
mediumFontPointSize
,
ScreenTools
.
largeFontPointSize
]
property
var
_rgFontSizeRatios
:
[
1
,
ScreenTools
.
smallFontPointRatio
,
ScreenTools
.
mediumFontPointRatio
,
ScreenTools
.
largeFontPointRatio
]
property
real
_doubleDescent
:
ScreenTools
.
defaultFontDescent
*
2
...
...
@@ -32,17 +31,21 @@ ColumnLayout {
property
real
_tightHeight
:
_rgFontSizeTightHeights
[
instrumentValueData
.
factValueGrid
.
fontSize
]
property
real
_fontSize
:
_rgFontSizes
[
instrumentValueData
.
factValueGrid
.
fontSize
]
property
real
_horizontalLabelSpacing
:
ScreenTools
.
defaultFontPixelWidth
property
bool
_valueVisible
:
instrumentValueData
.
fact
property
real
_width
:
0
property
real
_height
:
0
QGCLabel
{
id
:
label
Layout.alignment
:
_verticalOrientation
?
Qt
.
AlignHCenter
:
Qt
.
AlignVCenter
Layout.alignment
:
Qt
.
AlignVCenter
font.pointSize
:
_fontSize
text
:
instrumentValueData
.
fact
.
enumOrValueString
+
(
instrumentValueData
.
showUnits
?
"
"
+
instrumentValueData
.
fact
.
units
:
""
)
visible
:
_valueVisible
text
:
valueText
()
QGCPalette
{
id
:
qgcPal
;
colorGroupEnabled
:
enabled
}
function
valueText
()
{
if
(
instrumentValueData
.
fact
)
{
return
instrumentValueData
.
fact
.
enumOrValueString
+
(
instrumentValueData
.
showUnits
?
"
"
+
instrumentValueData
.
fact
.
units
:
""
)
}
else
{
return
qsTr
(
"
--.--
"
)
}
}
}
}
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