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
1313a698
Commit
1313a698
authored
Aug 19, 2020
by
DonLakeFlyer
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
parent
76b58cbc
Changes
13
Hide whitespace changes
Inline
Side-by-side
Showing
13 changed files
with
138 additions
and
366 deletions
+138
-366
qgroundcontrol.pro
qgroundcontrol.pro
+0
-2
qgroundcontrol.qrc
qgroundcontrol.qrc
+0
-1
QGCApplication.cc
src/QGCApplication.cc
+0
-2
FactValueGrid.cc
src/QmlControls/FactValueGrid.cc
+44
-48
FactValueGrid.h
src/QmlControls/FactValueGrid.h
+12
-23
HorizontalFactValueGrid.cc
src/QmlControls/HorizontalFactValueGrid.cc
+4
-4
HorizontalFactValueGrid.qml
src/QmlControls/HorizontalFactValueGrid.qml
+42
-13
InstrumentValueValue.qml
src/QmlControls/InstrumentValueValue.qml
+2
-0
qmldir
src/QmlControls/QGroundControl/Controls/qmldir
+0
-1
VerticalFactValueGrid.cc
src/QmlControls/VerticalFactValueGrid.cc
+0
-30
VerticalFactValueGrid.h
src/QmlControls/VerticalFactValueGrid.h
+0
-38
VerticalFactValueGrid.qml
src/QmlControls/VerticalFactValueGrid.qml
+0
-174
QGCCorePlugin.cc
src/api/QGCCorePlugin.cc
+34
-30
No files found.
qgroundcontrol.pro
View file @
1313a698
...
...
@@ -670,7 +670,6 @@ HEADERS += \
src
/
QmlControls
/
TerrainProfile
.
h
\
src
/
QmlControls
/
ToolStripAction
.
h
\
src
/
QmlControls
/
ToolStripActionList
.
h
\
src
/
QmlControls
/
VerticalFactValueGrid
.
h
\
src
/
QtLocationPlugin
/
QMLControl
/
QGCMapEngineManager
.
h
\
src
/
Settings
/
ADSBVehicleManagerSettings
.
h
\
src
/
Settings
/
AppSettings
.
h
\
...
...
@@ -890,7 +889,6 @@ SOURCES += \
src
/
QmlControls
/
TerrainProfile
.
cc
\
src
/
QmlControls
/
ToolStripAction
.
cc
\
src
/
QmlControls
/
ToolStripActionList
.
cc
\
src
/
QmlControls
/
VerticalFactValueGrid
.
cc
\
src
/
QtLocationPlugin
/
QMLControl
/
QGCMapEngineManager
.
cc
\
src
/
Settings
/
ADSBVehicleManagerSettings
.
cc
\
src
/
Settings
/
AppSettings
.
cc
\
...
...
qgroundcontrol.qrc
View file @
1313a698
...
...
@@ -183,7 +183,6 @@
<file alias="QGroundControl/Controls/TransectStyleComplexItemTerrainFollow.qml">src/PlanView/TransectStyleComplexItemTerrainFollow.qml</file>
<file alias="QGroundControl/Controls/VehicleRotationCal.qml">src/QmlControls/VehicleRotationCal.qml</file>
<file alias="QGroundControl/Controls/VehicleSummaryRow.qml">src/QmlControls/VehicleSummaryRow.qml</file>
<file alias="QGroundControl/Controls/VerticalFactValueGrid.qml">src/QmlControls/VerticalFactValueGrid.qml</file>
<file alias="QGroundControl/Controls/VTOLLandingPatternMapVisual.qml">src/PlanView/VTOLLandingPatternMapVisual.qml</file>
<file alias="QGroundControl/FactControls/AltitudeFactTextField.qml">src/FactSystem/FactControls/AltitudeFactTextField.qml</file>
<file alias="QGroundControl/FactControls/FactBitmask.qml">src/FactSystem/FactControls/FactBitmask.qml</file>
...
...
src/QGCApplication.cc
View file @
1313a698
...
...
@@ -77,7 +77,6 @@
#include "MAVLinkInspectorController.h"
#endif
#include "HorizontalFactValueGrid.h"
#include "VerticalFactValueGrid.h"
#include "InstrumentValueData.h"
#include "AppMessages.h"
#include "SimulatedPosition.h"
...
...
@@ -553,7 +552,6 @@ void QGCApplication::_initCommon()
qmlRegisterUncreatableType
<
FactValueGrid
>
(
kQGCTemplates
,
1
,
0
,
"FactValueGrid"
,
kRefOnly
);
qmlRegisterType
<
HorizontalFactValueGrid
>
(
kQGCTemplates
,
1
,
0
,
"HorizontalFactValueGrid"
);
qmlRegisterType
<
VerticalFactValueGrid
>
(
kQGCTemplates
,
1
,
0
,
"VerticalFactValueGrid"
);
qmlRegisterType
<
QGCMapCircle
>
(
"QGroundControl.FlightMap"
,
1
,
0
,
"QGCMapCircle"
);
...
...
src/QmlControls/FactValueGrid.cc
View file @
1313a698
...
...
@@ -15,9 +15,7 @@
#include <QSettings>
const
char
*
FactValueGrid
::
_rowsKey
=
"rows"
;
const
char
*
FactValueGrid
::
_columnsKey
=
"columns"
;
const
char
*
FactValueGrid
::
_fontSizeKey
=
"fontSize"
;
const
char
*
FactValueGrid
::
_orientationKey
=
"orientation"
;
const
char
*
FactValueGrid
::
_versionKey
=
"version"
;
const
char
*
FactValueGrid
::
_factGroupNameKey
=
"groupName"
;
const
char
*
FactValueGrid
::
_factNameKey
=
"factName"
;
...
...
@@ -44,7 +42,7 @@ const QStringList FactValueGrid::_fontSizeNames = {
FactValueGrid
::
FactValueGrid
(
QQuickItem
*
parent
)
:
QQuickItem
(
parent
)
,
_
rows
(
new
QmlObjectListModel
(
this
))
,
_
columns
(
new
QmlObjectListModel
(
this
))
{
if
(
_iconNames
.
isEmpty
())
{
QDir
iconDir
(
":/InstrumentValueIcons/"
);
...
...
@@ -57,7 +55,7 @@ FactValueGrid::FactValueGrid(QQuickItem* parent)
FactValueGrid
::
FactValueGrid
(
const
QString
&
defaultSettingsGroup
)
:
QQuickItem
(
nullptr
)
,
_defaultSettingsGroup
(
defaultSettingsGroup
)
,
_
rows
(
new
QmlObjectListModel
(
this
))
,
_
columns
(
new
QmlObjectListModel
(
this
))
{
_init
();
}
...
...
@@ -189,46 +187,46 @@ void FactValueGrid::_connectSaveSignals(InstrumentValueData* value)
connect
(
value
,
&
InstrumentValueData
::
rangeIconsChanged
,
this
,
&
FactValueGrid
::
_saveSettings
);
}
void
FactValueGrid
::
append
Column
(
void
)
void
FactValueGrid
::
append
Row
(
void
)
{
for
(
int
rowIndex
=
0
;
rowIndex
<
_rows
->
count
();
row
Index
++
)
{
QmlObjectListModel
*
list
=
_
rows
->
value
<
QmlObjectListModel
*>
(
row
Index
);
for
(
int
colIndex
=
0
;
colIndex
<
_columns
->
count
();
col
Index
++
)
{
QmlObjectListModel
*
list
=
_
columns
->
value
<
QmlObjectListModel
*>
(
col
Index
);
list
->
append
(
_createNewInstrumentValueWorker
(
list
));
}
_
column
Count
++
;
emit
columnCountChanged
(
_column
Count
);
_
row
Count
++
;
emit
rowCountChanged
(
_row
Count
);
_saveSettings
();
}
void
FactValueGrid
::
deleteLast
Column
(
void
)
void
FactValueGrid
::
deleteLast
Row
(
void
)
{
if
(
_
column
Count
<=
1
)
{
if
(
_
row
Count
<=
1
)
{
return
;
}
for
(
int
rowIndex
=
0
;
rowIndex
<
_rows
->
count
();
row
Index
++
)
{
QmlObjectListModel
*
list
=
_
rows
->
value
<
QmlObjectListModel
*>
(
row
Index
);
for
(
int
colIndex
=
0
;
colIndex
<
_columns
->
count
();
col
Index
++
)
{
QmlObjectListModel
*
list
=
_
columns
->
value
<
QmlObjectListModel
*>
(
col
Index
);
list
->
removeAt
(
list
->
count
()
-
1
)
->
deleteLater
();
}
_
column
Count
--
;
emit
columnCountChanged
(
_column
Count
);
_
row
Count
--
;
emit
rowCountChanged
(
_row
Count
);
_saveSettings
();
}
QmlObjectListModel
*
FactValueGrid
::
append
Row
(
void
)
QmlObjectListModel
*
FactValueGrid
::
append
Column
(
void
)
{
QmlObjectListModel
*
newList
=
new
QmlObjectListModel
(
_
row
s
);
_
row
s
->
append
(
newList
);
QmlObjectListModel
*
newList
=
new
QmlObjectListModel
(
_
column
s
);
_
column
s
->
append
(
newList
);
// If this is the first row then we automatically add the first column as well
int
c
ColsToAdd
=
qMax
(
_column
Count
,
1
);
for
(
int
i
=
0
;
i
<
c
Col
sToAdd
;
i
++
)
{
int
c
RowsToAdd
=
qMax
(
_row
Count
,
1
);
for
(
int
i
=
0
;
i
<
c
Row
sToAdd
;
i
++
)
{
newList
->
append
(
_createNewInstrumentValueWorker
(
newList
));
}
if
(
c
ColsToAdd
!=
_column
Count
)
{
_
columnCount
=
cCol
sToAdd
;
emit
columnCountChanged
(
_column
Count
);
if
(
c
RowsToAdd
!=
_row
Count
)
{
_
rowCount
=
cRow
sToAdd
;
emit
rowCountChanged
(
_row
Count
);
}
_saveSettings
();
...
...
@@ -236,10 +234,10 @@ QmlObjectListModel* FactValueGrid::appendRow(void)
return
newList
;
}
void
FactValueGrid
::
deleteLast
Row
(
void
)
void
FactValueGrid
::
deleteLast
Column
(
void
)
{
if
(
_
row
s
->
count
()
>
1
)
{
_
rows
->
removeAt
(
_row
s
->
count
()
-
1
)
->
deleteLater
();
if
(
_
column
s
->
count
()
>
1
)
{
_
columns
->
removeAt
(
_column
s
->
count
()
-
1
)
->
deleteLater
();
}
}
...
...
@@ -272,17 +270,16 @@ void FactValueGrid::_saveSettings(void)
settings
.
remove
(
""
);
// Remove any previous settings
settings
.
setValue
(
_versionKey
,
1
);
settings
.
setValue
(
_fontSizeKey
,
_fontSize
);
settings
.
setValue
(
_orientationKey
,
_orientation
);
settings
.
setValue
(
_columnsKey
,
_columnCount
);
settings
.
setValue
(
_versionKey
,
1
);
settings
.
setValue
(
_fontSizeKey
,
_fontSize
);
settings
.
setValue
(
_rowsKey
,
_rowCount
);
settings
.
beginWriteArray
(
_rowsKey
);
for
(
int
rowIndex
=
0
;
rowIndex
<
_rows
->
count
();
row
Index
++
)
{
QmlObjectListModel
*
columns
=
_
rows
->
value
<
QmlObjectListModel
*>
(
row
Index
);
for
(
int
colIndex
=
0
;
colIndex
<
_columns
->
count
();
col
Index
++
)
{
QmlObjectListModel
*
columns
=
_
columns
->
value
<
QmlObjectListModel
*>
(
col
Index
);
settings
.
setArrayIndex
(
row
Index
);
settings
.
beginWriteArray
(
_
column
sKey
);
settings
.
setArrayIndex
(
col
Index
);
settings
.
beginWriteArray
(
_
row
sKey
);
for
(
int
colIndex
=
0
;
colIndex
<
columns
->
count
();
colIndex
++
)
{
InstrumentValueData
*
value
=
columns
->
value
<
InstrumentValueData
*>
(
colIndex
);
...
...
@@ -299,10 +296,10 @@ void FactValueGrid::_loadSettings(void)
{
_preventSaveSettings
=
true
;
_
row
s
->
deleteLater
();
_
column
s
->
deleteLater
();
_
rows
=
new
QmlObjectListModel
(
this
);
_
columnCount
=
0
;
_
columns
=
new
QmlObjectListModel
(
this
);
_
rowCount
=
0
;
QSettings
settings
;
QString
groupNameFormat
(
"%1-%2"
);
...
...
@@ -325,27 +322,26 @@ void FactValueGrid::_loadSettings(void)
qgcApp
()
->
toolbox
()
->
corePlugin
()
->
factValueGridCreateDefaultSettings
(
_defaultSettingsGroup
);
}
_fontSize
=
settings
.
value
(
_fontSizeKey
,
DefaultFontSize
).
value
<
FontSize
>
();
_orientation
=
settings
.
value
(
_orientationKey
,
VerticalOrientation
).
value
<
Orientation
>
();
// Initial setup of empty items
int
cColumns
=
settings
.
value
(
_
column
sKey
).
toInt
();
int
cColumns
=
settings
.
value
(
_
row
sKey
).
toInt
();
int
cModelLists
=
settings
.
beginReadArray
(
_rowsKey
);
if
(
cModelLists
&&
cColumns
)
{
append
Row
();
append
Column
();
for
(
int
itemIndex
=
1
;
itemIndex
<
cColumns
;
itemIndex
++
)
{
appendColumn
();
}
for
(
int
rowIndex
=
1
;
rowIndex
<
cModelLists
;
rowIndex
++
)
{
appendRow
();
}
for
(
int
colIndex
=
1
;
colIndex
<
cModelLists
;
colIndex
++
)
{
appendColumn
();
}
}
// Fill in the items from settings
for
(
int
rowIndex
=
0
;
rowIndex
<
cModelLists
;
row
Index
++
)
{
settings
.
setArrayIndex
(
row
Index
);
int
cItems
=
settings
.
beginReadArray
(
_
column
sKey
);
for
(
int
colIndex
=
0
;
colIndex
<
cModelLists
;
col
Index
++
)
{
settings
.
setArrayIndex
(
col
Index
);
int
cItems
=
settings
.
beginReadArray
(
_
row
sKey
);
for
(
int
itemIndex
=
0
;
itemIndex
<
cItems
;
itemIndex
++
)
{
QmlObjectListModel
*
list
=
_
rows
->
value
<
QmlObjectListModel
*>
(
row
Index
);
QmlObjectListModel
*
list
=
_
columns
->
value
<
QmlObjectListModel
*>
(
col
Index
);
InstrumentValueData
*
value
=
list
->
value
<
InstrumentValueData
*>
(
itemIndex
);
settings
.
setArrayIndex
(
itemIndex
);
_loadValueData
(
settings
,
value
);
...
...
@@ -354,7 +350,7 @@ void FactValueGrid::_loadSettings(void)
}
settings
.
endArray
();
emit
rowsChanged
(
_row
s
);
emit
columnsChanged
(
_column
s
);
_preventSaveSettings
=
false
;
}
src/QmlControls/FactValueGrid.h
View file @
1313a698
...
...
@@ -26,12 +26,6 @@ public:
FactValueGrid
(
QQuickItem
*
parent
=
nullptr
);
FactValueGrid
(
const
QString
&
defaultSettingsGroup
);
enum
Orientation
{
HorizontalOrientation
=
0
,
// Labels will be to the left of the value
VerticalOrientation
// Labels will be above the value
};
Q_ENUMS
(
Orientation
)
enum
FontSize
{
DefaultFontSize
=
0
,
SmallFontSize
,
...
...
@@ -50,22 +44,21 @@ public:
// The combination of the two valuePage*SettingsGroup values allows each FactValueGrid to have it's own persistence space.
Q_PROPERTY
(
QmlObjectListModel
*
rows
MEMBER
_rows
NOTIFY
row
sChanged
)
Q_PROPERTY
(
int
columnCount
MEMBER
_columnCount
NOTIFY
column
CountChanged
)
Q_PROPERTY
(
QmlObjectListModel
*
columns
MEMBER
_columns
NOTIFY
column
sChanged
)
Q_PROPERTY
(
int
rowCount
MEMBER
_rowCount
NOTIFY
row
CountChanged
)
Q_PROPERTY
(
QString
userSettingsGroup
MEMBER
_userSettingsGroup
NOTIFY
userSettingsGroupChanged
)
Q_PROPERTY
(
QString
defaultSettingsGroup
MEMBER
_defaultSettingsGroup
NOTIFY
defaultSettingsGroupChanged
)
Q_PROPERTY
(
Orientation
orientation
MEMBER
_orientation
CONSTANT
)
Q_PROPERTY
(
QStringList
iconNames
READ
iconNames
CONSTANT
)
Q_PROPERTY
(
FontSize
fontSize
READ
fontSize
WRITE
setFontSize
NOTIFY
fontSizeChanged
)
Q_PROPERTY
(
QStringList
fontSizeNames
MEMBER
_fontSizeNames
CONSTANT
)
Q_INVOKABLE
void
resetToDefaults
(
void
);
Q_INVOKABLE
QmlObjectListModel
*
append
Row
(
void
);
Q_INVOKABLE
void
deleteLast
Row
(
void
);
Q_INVOKABLE
void
append
Column
(
void
);
Q_INVOKABLE
void
deleteLast
Column
(
void
);
Q_INVOKABLE
void
resetToDefaults
(
void
);
Q_INVOKABLE
QmlObjectListModel
*
append
Column
(
void
);
Q_INVOKABLE
void
deleteLast
Column
(
void
);
Q_INVOKABLE
void
append
Row
(
void
);
Q_INVOKABLE
void
deleteLast
Row
(
void
);
QmlObjectListModel
*
rows
(
void
)
const
{
return
_row
s
;
}
QmlObjectListModel
*
columns
(
void
)
const
{
return
_column
s
;
}
FontSize
fontSize
(
void
)
const
{
return
_fontSize
;
}
QStringList
iconNames
(
void
)
const
{
return
_iconNames
;
}
QGCMAVLink
::
VehicleClass_t
vehicleClass
(
void
)
const
{
return
_vehicleClass
;
}
...
...
@@ -79,8 +72,8 @@ signals:
void
userSettingsGroupChanged
(
const
QString
&
userSettingsGroup
);
void
defaultSettingsGroupChanged
(
const
QString
&
defaultSettingsGroup
);
void
fontSizeChanged
(
FontSize
fontSize
);
void
rowsChanged
(
QmlObjectListModel
*
model
);
void
columnCountChanged
(
int
column
Count
);
void
columnsChanged
(
QmlObjectListModel
*
model
);
void
rowCountChanged
(
int
row
Count
);
protected:
Q_DISABLE_COPY
(
FactValueGrid
)
...
...
@@ -88,11 +81,10 @@ protected:
QGCMAVLink
::
VehicleClass_t
_vehicleClass
=
QGCMAVLink
::
VehicleClassGeneric
;
QString
_defaultSettingsGroup
;
// Settings group to read from if the user has not modified from the default settings
QString
_userSettingsGroup
;
// Settings group to read from for user modified settings
Orientation
_orientation
=
VerticalOrientation
;
FontSize
_fontSize
=
DefaultFontSize
;
bool
_preventSaveSettings
=
false
;
QmlObjectListModel
*
_
rows
=
nullptr
;
int
_
columnCount
=
0
;
QmlObjectListModel
*
_
columns
=
nullptr
;
int
_
rowCount
=
0
;
private
slots
:
void
_offlineVehicleTypeChanged
(
void
);
...
...
@@ -113,8 +105,6 @@ private:
static
const
char
*
_versionKey
;
static
const
char
*
_rowsKey
;
static
const
char
*
_columnsKey
;
static
const
char
*
_orientationKey
;
static
const
char
*
_fontSizeKey
;
static
const
char
*
_factGroupNameKey
;
static
const
char
*
_factNameKey
;
...
...
@@ -133,4 +123,3 @@ private:
QML_DECLARE_TYPE
(
FactValueGrid
)
Q_DECLARE_METATYPE
(
FactValueGrid
::
FontSize
)
Q_DECLARE_METATYPE
(
FactValueGrid
::
Orientation
)
src/QmlControls/HorizontalFactValueGrid.cc
View file @
1313a698
...
...
@@ -14,17 +14,17 @@
#include <QSettings>
const
QString
HorizontalFactValueGrid
::
_toolbarUserSettingsGroup
(
"TelemetryBarUserSettingsWIP0"
);
const
QString
HorizontalFactValueGrid
::
telemetryBarDefaultSettingsGroup
(
"TelemetryBarDefaultSettingsWIP0"
);
const
QString
HorizontalFactValueGrid
::
_toolbarUserSettingsGroup
(
"TelemetryBarUserSettingsWIP0
1
"
);
const
QString
HorizontalFactValueGrid
::
telemetryBarDefaultSettingsGroup
(
"TelemetryBarDefaultSettingsWIP0
1
"
);
HorizontalFactValueGrid
::
HorizontalFactValueGrid
(
QQuickItem
*
parent
)
:
FactValueGrid
(
parent
)
{
_orientation
=
HorizontalOrientation
;
}
HorizontalFactValueGrid
::
HorizontalFactValueGrid
(
const
QString
&
defaultSettingsGroup
)
:
FactValueGrid
(
defaultSettingsGroup
)
{
_orientation
=
HorizontalOrientation
;
}
src/QmlControls/HorizontalFactValueGrid.qml
View file @
1313a698
...
...
@@ -71,11 +71,11 @@ T.HorizontalFactValueGrid {
GridLayout
{
id
:
valueGrid
rows
:
_root
.
row
s
.
count
rows
:
_root
.
column
s
.
count
rowSpacing
:
0
Repeater
{
model
:
_root
.
row
s
model
:
_root
.
column
s
Repeater
{
id
:
labelRepeater
...
...
@@ -84,8 +84,8 @@ T.HorizontalFactValueGrid {
property
real
_index
:
index
InstrumentValueLabel
{
Layout.row
:
labelRepeater
.
_
index
Layout.column
:
index
*
3
Layout.row
:
index
Layout.column
:
labelRepeater
.
_
index
*
3
Layout.fillHeight
:
true
Layout.alignment
:
Qt
.
AlignRight
instrumentValueData
:
object
...
...
@@ -94,26 +94,55 @@ T.HorizontalFactValueGrid {
}
Repeater
{
model
:
_root
.
row
s
model
:
_root
.
column
s
Repeater
{
id
:
valueRepeater
model
:
object
property
real
_index
:
index
property
real
_index
:
index
property
real
maxWidth
:
0
property
var
lastCheck
:
new
Date
().
getTime
()
function
recalcWidth
()
{
var
newMaxWidth
=
0
for
(
var
i
=
0
;
i
<
valueRepeater
.
count
;
i
++
)
{
newMaxWidth
=
Math
.
max
(
newMaxWidth
,
valueRepeater
.
itemAt
(
0
).
contentWidth
)
}
console
.
log
(
"
recalcWidth
"
,
newMaxWidth
,
maxWidth
)
maxWidth
=
Math
.
min
(
maxWidth
,
newMaxWidth
)
}
InstrumentValueValue
{
Layout.row
:
valueRepeater
.
_
index
Layout.column
:
(
index
*
3
)
+
1
Layout.row
:
index
Layout.column
:
(
valueRepeater
.
_
index
*
3
)
+
1
Layout.fillHeight
:
true
Layout.alignment
:
Qt
.
AlignLeft
Layout.preferredWidth
:
maxWidth
instrumentValueData
:
object
property
real
lastContentWidth
Component.onCompleted
:
{
maxWidth
=
Math
.
max
(
maxWidth
,
contentWidth
)
lastContentWidth
=
contentWidth
}
onContentWidthChanged
:
{
maxWidth
=
Math
.
max
(
maxWidth
,
contentWidth
)
lastContentWidth
=
contentWidth
var
currentTime
=
new
Date
().
getTime
()
if
(
currentTime
-
lastCheck
>
30
*
1000
)
{
lastCheck
=
currentTime
valueRepeater
.
recalcWidth
()
}
}
}
}
}
Repeater
{
model
:
_root
.
row
s
model
:
_root
.
column
s
Repeater
{
id
:
spacerRepeater
...
...
@@ -122,8 +151,8 @@ T.HorizontalFactValueGrid {
property
real
_index
:
index
Item
{
Layout.row
:
spacerRepeater
.
_
index
Layout.column
:
(
index
*
3
)
+
2
Layout.row
:
index
Layout.column
:
(
spacerRepeater
.
_
index
*
3
)
+
2
Layout.preferredWidth
:
ScreenTools
.
defaultFontPixelWidth
Layout.preferredHeight
:
1
}
...
...
@@ -150,7 +179,7 @@ T.HorizontalFactValueGrid {
Layout.fillWidth
:
true
Layout.preferredHeight
:
parent
.
height
text
:
qsTr
(
"
-
"
)
enabled
:
_root
.
row
s
.
c
ount
>
1
enabled
:
_root
.
row
C
ount
>
1
onClicked
:
deleteLastRow
()
}
}
...
...
@@ -177,7 +206,7 @@ T.HorizontalFactValueGrid {
Layout.preferredHeight
:
ScreenTools
.
minTouchPixels
Layout.preferredWidth
:
parent
.
width
text
:
qsTr
(
"
-
"
)
enabled
:
_root
.
column
C
ount
>
1
enabled
:
_root
.
column
s
.
c
ount
>
1
onClicked
:
deleteLastColumn
()
}
}
...
...
src/QmlControls/InstrumentValueValue.qml
View file @
1313a698
...
...
@@ -21,6 +21,7 @@ import QGroundControl.Palette 1.0
ColumnLayout
{
property
var
instrumentValueData
:
null
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
]
...
...
@@ -36,6 +37,7 @@ ColumnLayout {
property
real
_height
:
0
QGCLabel
{
id
:
label
Layout.alignment
:
_verticalOrientation
?
Qt
.
AlignHCenter
:
Qt
.
AlignVCenter
font.pointSize
:
_fontSize
text
:
instrumentValueData
.
fact
.
enumOrValueString
+
(
instrumentValueData
.
showUnits
?
"
"
+
instrumentValueData
.
fact
.
units
:
""
)
...
...
src/QmlControls/QGroundControl/Controls/qmldir
View file @
1313a698
...
...
@@ -107,6 +107,5 @@ TransectStyleMapVisuals 1.0 TransectStyleMapVisuals.qml
ToolStrip 1.0 ToolStrip.qml
VehicleRotationCal 1.0 VehicleRotationCal.qml
VehicleSummaryRow 1.0 VehicleSummaryRow.qml
VerticalFactValueGrid 1.0 VerticalFactValueGrid.qml
QGCHoverButton 1.0 QGCHoverButton.qml
MAVLinkChart 1.0 MAVLinkChart.qml
src/QmlControls/VerticalFactValueGrid.cc
deleted
100644 → 0
View file @
76b58cbc
/****************************************************************************
*
* (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.
*
****************************************************************************/
#include "VerticalFactValueGrid.h"
#include "InstrumentValueData.h"
#include "QGCApplication.h"
#include "QGCCorePlugin.h"
#include <QSettings>
const
QString
VerticalFactValueGrid
::
_valuePageUserSettingsGroup
(
"ValuePageUserSettings2"
);
const
QString
VerticalFactValueGrid
::
valuePageDefaultSettingsGroup
(
"ValuePageDefaultSettings2"
);
VerticalFactValueGrid
::
VerticalFactValueGrid
(
QQuickItem
*
parent
)
:
FactValueGrid
(
parent
)
{
_orientation
=
VerticalOrientation
;
}
VerticalFactValueGrid
::
VerticalFactValueGrid
(
const
QString
&
defaultSettingsGroup
)
:
FactValueGrid
(
defaultSettingsGroup
)
{
_orientation
=
VerticalOrientation
;
}
src/QmlControls/VerticalFactValueGrid.h
deleted
100644 → 0
View file @
76b58cbc
/****************************************************************************
*
* (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.
*
****************************************************************************/
#pragma once
#include "FactSystem.h"
#include "QmlObjectListModel.h"
#include "QGCApplication.h"
#include "FactValueGrid.h"
class
InstrumentValueData
;
class
VerticalFactValueGrid
:
public
FactValueGrid
{
Q_OBJECT
public:
VerticalFactValueGrid
(
QQuickItem
*
parent
=
nullptr
);
VerticalFactValueGrid
(
const
QString
&
defaultSettingsGroup
);
Q_PROPERTY
(
QString
valuePageDefaultSettingsGroup
MEMBER
valuePageDefaultSettingsGroup
CONSTANT
)
Q_PROPERTY
(
QString
valuePageUserSettingsGroup
MEMBER
_valuePageUserSettingsGroup
CONSTANT
)
static
const
QString
valuePageDefaultSettingsGroup
;
private:
Q_DISABLE_COPY
(
VerticalFactValueGrid
)
static
const
QString
_valuePageUserSettingsGroup
;
};
QML_DECLARE_TYPE
(
VerticalFactValueGrid
)
src/QmlControls/VerticalFactValueGrid.qml
deleted
100644 → 0
View file @
76b58cbc
/****************************************************************************
*
* (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
.
Layouts
1.2
import
QtQuick
.
Controls
2.5
import
QtQml
2.12
import
QGroundControl
.
Templates
1.0
as
T
import
QGroundControl
.
Controls
1.0
import
QGroundControl
.
ScreenTools
1.0
import
QGroundControl
.
Controllers
1.0
import
QGroundControl
.
Palette
1.0
import
QGroundControl
.
FlightMap
1.0
import
QGroundControl
1.0
// Note: This control will spit out qWarnings like this: "QGridLayoutEngine::addItem: Cell (0, 1) already taken"
// This is due to Qt bug https://bugreports.qt.io/browse/QTBUG-65121
// If this becomes a problem I'll implement our own grid layout control
T.VerticalFactValueGrid
{
id
:
_root
height
:
childrenRect
.
height
property
bool
settingsUnlocked
:
false
QGCPalette
{
id
:
qgcPal
;
colorGroupEnabled
:
enabled
}
QGCFlickable
{
width
:
parent
.
width
height
:
topLevelRowLayout
.
height
flickableDirection
:
QGCFlickable
.
HorizontalFlick
contentWidth
:
topLevelRowLayout
.
width
RowLayout
{
id
:
topLevelRowLayout
spacing
:
0
ColumnLayout
{
spacing
:
0
GridLayout
{
id
:
valueGrid
Layout.minimumWidth
:
_root
.
width
-
(
columnButtons
.
visible
?
columnButtons
.
width
+
columnSpacing
:
0
)
rows
:
_root
.
rows
.
count
*
2
rowSpacing
:
0
columnSpacing
:
5
Repeater
{
model
:
_root
.
rows
Repeater
{
id
:
labelRepeater
model
:
object
property
real
_index
:
index
InstrumentValueLabel
{
Layout.row
:
labelRepeater
.
_index
*
2
Layout.column
:
index
Layout.fillWidth
:
true
Layout.alignment
:
Qt
.
AlignHCenter
instrumentValueData
:
object
}
}
}
Repeater
{
model
:
_root
.
rows
Repeater
{
id
:
valueRepeater
model
:
object
property
real
_index
:
index
InstrumentValueValue
{
Layout.row
:
valueRepeater
.
_index
*
2
+
1
Layout.column
:
index
Layout.fillWidth
:
true
Layout.alignment
:
Qt
.
AlignHCenter
instrumentValueData
:
object
}
}
}
}
RowLayout
{
id
:
rowButtons
height
:
ScreenTools
.
minTouchPixels
/
2
Layout.fillWidth
:
true
spacing
:
1
visible
:
settingsUnlocked
QGCButton
{
Layout.fillWidth
:
true
Layout.preferredHeight
:
parent
.
height
text
:
qsTr
(
"
+
"
)
onClicked
:
appendRow
()
}
QGCButton
{
Layout.fillWidth
:
true
Layout.preferredHeight
:
parent
.
height
text
:
qsTr
(
"
-
"
)
enabled
:
_root
.
rows
.
count
>
1
onClicked
:
deleteLastRow
()
}
}
}
ColumnLayout
{
id
:
columnButtons
Layout.fillHeight
:
true
Layout.bottomMargin
:
rowButtons
.
height
width
:
ScreenTools
.
minTouchPixels
/
2
spacing
:
1
visible
:
settingsUnlocked
QGCButton
{
Layout.fillHeight
:
true
Layout.preferredHeight
:
ScreenTools
.
minTouchPixels
Layout.preferredWidth
:
parent
.
width
text
:
qsTr
(
"
+
"
)
onClicked
:
appendColumn
()
}
QGCButton
{
Layout.fillHeight
:
true
Layout.preferredHeight
:
ScreenTools
.
minTouchPixels
Layout.preferredWidth
:
parent
.
width
text
:
qsTr
(
"
-
"
)
enabled
:
_root
.
columnCount
>
1
onClicked
:
deleteLastColumn
()
}
}
}
QGCMouseArea
{
x
:
valueGrid
.
x
y
:
valueGrid
.
y
width
:
valueGrid
.
width
height
:
valueGrid
.
height
visible
:
settingsUnlocked
onClicked
:
{
var
item
=
valueGrid
.
childAt
(
mouse
.
x
,
mouse
.
y
)
//console.log(item, item ? item.instrumentValueData : "null", item && item.parent ? item.parent.instrumentValueData : "null")
if
(
item
&&
item
.
instrumentValueData
!==
undefined
)
{
mainWindow
.
showPopupDialogFromComponent
(
valueEditDialog
,
{
instrumentValueData
:
item
.
instrumentValueData
})
}
}
/*Rectangle {
anchors.fill: parent
border.color: "green"
border.width: 1
color: "transparent"
}*/
}
}
Component
{
id
:
valueEditDialog
InstrumentValueEditDialog
{
}
}
}
src/api/QGCCorePlugin.cc
View file @
1313a698
...
...
@@ -23,7 +23,6 @@
#include "QGCLoggingCategory.h"
#include "QGCCameraManager.h"
#include "HorizontalFactValueGrid.h"
#include "VerticalFactValueGrid.h"
#include "InstrumentValueData.h"
#include <QtQml>
...
...
@@ -298,65 +297,70 @@ void QGCCorePlugin::factValueGridCreateDefaultSettings(const QString& defaultSet
factValueGrid
.
setFontSize
(
FactValueGrid
::
LargeFontSize
);
factValueGrid
.
appendRow
();
factValueGrid
.
appendRow
();
factValueGrid
.
appendColumn
();
factValueGrid
.
appendColumn
();
factValueGrid
.
appendColumn
();
if
(
includeFWValues
)
{
factValueGrid
.
appendColumn
();
}
factValueGrid
.
appendRow
();
int
col
Index
=
0
;
QmlObjectListModel
*
row
=
factValueGrid
.
row
s
()
->
value
<
QmlObjectListModel
*>
(
0
);
int
row
Index
=
0
;
QmlObjectListModel
*
column
=
factValueGrid
.
column
s
()
->
value
<
QmlObjectListModel
*>
(
0
);
InstrumentValueData
*
value
=
row
->
value
<
InstrumentValueData
*>
(
col
Index
++
);
InstrumentValueData
*
value
=
column
->
value
<
InstrumentValueData
*>
(
row
Index
++
);
value
->
setFact
(
"Vehicle"
,
"AltitudeRelative"
);
value
->
setIcon
(
"arrow-thick-up.svg"
);
value
->
setText
(
value
->
fact
()
->
shortDescription
());
value
->
setShowUnits
(
true
);
value
=
row
->
value
<
InstrumentValueData
*>
(
col
Index
++
);
value
->
setFact
(
"Vehicle"
,
"
ClimbRat
e"
);
value
->
setIcon
(
"
arrow-simple-up
.svg"
);
value
=
column
->
value
<
InstrumentValueData
*>
(
row
Index
++
);
value
->
setFact
(
"Vehicle"
,
"
DistanceToHom
e"
);
value
->
setIcon
(
"
bookmark copy 3
.svg"
);
value
->
setText
(
value
->
fact
()
->
shortDescription
());
value
->
setShowUnits
(
true
);
if
(
includeFWValues
)
{
value
=
row
->
value
<
InstrumentValueData
*>
(
colIndex
++
);
value
->
setFact
(
"Vehicle"
,
"AirSpeed"
);
value
->
setText
(
"AirSpd"
);
value
->
setShowUnits
(
true
);
}
value
=
row
->
value
<
InstrumentValueData
*>
(
colIndex
++
);
value
->
setFact
(
"Vehicle"
,
"FlightTime"
);
value
->
setIcon
(
"timer.svg"
);
value
->
setText
(
value
->
fact
()
->
shortDescription
());
value
->
setShowUnits
(
false
);
rowIndex
=
0
;
column
=
factValueGrid
.
columns
()
->
value
<
QmlObjectListModel
*>
(
1
);
colIndex
=
0
;
row
=
factValueGrid
.
rows
()
->
value
<
QmlObjectListModel
*>
(
1
);
value
=
row
->
value
<
InstrumentValueData
*>
(
colIndex
++
);
value
->
setFact
(
"Vehicle"
,
"DistanceToHome"
);
value
->
setIcon
(
"bookmark copy 3.svg"
);
value
=
column
->
value
<
InstrumentValueData
*>
(
rowIndex
++
);
value
->
setFact
(
"Vehicle"
,
"ClimbRate"
);
value
->
setIcon
(
"arrow-simple-up.svg"
);
value
->
setText
(
value
->
fact
()
->
shortDescription
());
value
->
setShowUnits
(
true
);
value
=
row
->
value
<
InstrumentValueData
*>
(
col
Index
++
);
value
=
column
->
value
<
InstrumentValueData
*>
(
row
Index
++
);
value
->
setFact
(
"Vehicle"
,
"GroundSpeed"
);
value
->
setIcon
(
"arrow-simple-right.svg"
);
value
->
setText
(
value
->
fact
()
->
shortDescription
());
value
->
setShowUnits
(
true
);
if
(
includeFWValues
)
{
value
=
row
->
value
<
InstrumentValueData
*>
(
colIndex
++
);
rowIndex
=
0
;
column
=
factValueGrid
.
columns
()
->
value
<
QmlObjectListModel
*>
(
2
);
value
=
column
->
value
<
InstrumentValueData
*>
(
rowIndex
++
);
value
->
setFact
(
"Vehicle"
,
"AirSpeed"
);
value
->
setText
(
"AirSpd"
);
value
->
setShowUnits
(
true
);
value
=
column
->
value
<
InstrumentValueData
*>
(
rowIndex
++
);
value
->
setFact
(
"Vehicle"
,
"ThrottlePct"
);
value
->
setText
(
"Thr"
);
value
->
setShowUnits
(
true
);
}
value
=
row
->
value
<
InstrumentValueData
*>
(
colIndex
++
);
rowIndex
=
0
;
column
=
factValueGrid
.
columns
()
->
value
<
QmlObjectListModel
*>
(
includeFWValues
?
3
:
2
);
value
=
column
->
value
<
InstrumentValueData
*>
(
rowIndex
++
);
value
->
setFact
(
"Vehicle"
,
"FlightTime"
);
value
->
setIcon
(
"timer.svg"
);
value
->
setText
(
value
->
fact
()
->
shortDescription
());
value
->
setShowUnits
(
false
);
value
=
column
->
value
<
InstrumentValueData
*>
(
rowIndex
++
);
value
->
setFact
(
"Vehicle"
,
"FlightDistance"
);
value
->
setIcon
(
"travel-walk.svg"
);
value
->
setText
(
value
->
fact
()
->
shortDescription
());
...
...
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