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
1aba5c4b
Commit
1aba5c4b
authored
Apr 12, 2020
by
DoinLakeFlyer
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
parent
b458b751
Changes
7
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
966 additions
and
337 deletions
+966
-337
qgroundcontrol.pro
qgroundcontrol.pro
+2
-0
InstrumentValue.cc
src/FlightMap/Widgets/InstrumentValue.cc
+414
-0
InstrumentValue.h
src/FlightMap/Widgets/InstrumentValue.h
+173
-0
ValuePageWidget.qml
src/FlightMap/Widgets/ValuePageWidget.qml
+361
-8
ValuesWidgetController.cc
src/FlightMap/Widgets/ValuesWidgetController.cc
+12
-226
ValuesWidgetController.h
src/FlightMap/Widgets/ValuesWidgetController.h
+1
-100
QGCPopupDialogContainer.qml
src/QmlControls/QGCPopupDialogContainer.qml
+3
-3
No files found.
qgroundcontrol.pro
View file @
1aba5c4b
...
@@ -571,6 +571,7 @@ HEADERS += \
...
@@ -571,6 +571,7 @@ HEADERS += \
src
/
Camera
/
QGCCameraManager
.
h
\
src
/
Camera
/
QGCCameraManager
.
h
\
src
/
CmdLineOptParser
.
h
\
src
/
CmdLineOptParser
.
h
\
src
/
FirmwarePlugin
/
PX4
/
px4_custom_mode
.
h
\
src
/
FirmwarePlugin
/
PX4
/
px4_custom_mode
.
h
\
src
/
FlightMap
/
Widgets
/
InstrumentValue
.
h
\
src
/
FlightMap
/
Widgets
/
ValuesWidgetController
.
h
\
src
/
FlightMap
/
Widgets
/
ValuesWidgetController
.
h
\
src
/
FollowMe
/
FollowMe
.
h
\
src
/
FollowMe
/
FollowMe
.
h
\
src
/
Joystick
/
Joystick
.
h
\
src
/
Joystick
/
Joystick
.
h
\
...
@@ -778,6 +779,7 @@ SOURCES += \
...
@@ -778,6 +779,7 @@ SOURCES += \
src
/
Camera
/
QGCCameraIO
.
cc
\
src
/
Camera
/
QGCCameraIO
.
cc
\
src
/
Camera
/
QGCCameraManager
.
cc
\
src
/
Camera
/
QGCCameraManager
.
cc
\
src
/
CmdLineOptParser
.
cc
\
src
/
CmdLineOptParser
.
cc
\
src
/
FlightMap
/
Widgets
/
InstrumentValue
.
cc
\
src
/
FlightMap
/
Widgets
/
ValuesWidgetController
.
cc
\
src
/
FlightMap
/
Widgets
/
ValuesWidgetController
.
cc
\
src
/
FollowMe
/
FollowMe
.
cc
\
src
/
FollowMe
/
FollowMe
.
cc
\
src
/
Joystick
/
Joystick
.
cc
\
src
/
Joystick
/
Joystick
.
cc
\
...
...
src/FlightMap/Widgets/InstrumentValue.cc
0 → 100644
View file @
1aba5c4b
This diff is collapsed.
Click to expand it.
src/FlightMap/Widgets/InstrumentValue.h
0 → 100644
View file @
1aba5c4b
/****************************************************************************
*
* (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 <QObject>
class
InstrumentValue
:
public
QObject
{
Q_OBJECT
public:
enum
FontSize
{
DefaultFontSize
=
0
,
SmallFontSize
,
MediumFontSize
,
LargeFontSize
,
};
Q_ENUMS
(
FontSize
)
enum
IconPosition
{
IconAbove
=
0
,
IconLeft
,
};
Q_ENUMS
(
IconPosition
)
enum
RangeType
{
NoRangeInfo
=
0
,
ColorRange
,
OpacityRange
,
IconSelectRange
,
};
Q_ENUMS
(
RangeType
)
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
factName
MEMBER
_factName
NOTIFY
factNameChanged
)
Q_PROPERTY
(
Fact
*
fact
READ
fact
NOTIFY
factChanged
)
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
(
IconPosition
iconPosition
READ
iconPosition
WRITE
setIconPosition
NOTIFY
iconPositionChanged
)
Q_PROPERTY
(
QStringList
iconPositionNames
MEMBER
_iconPositionNames
CONSTANT
)
Q_PROPERTY
(
QStringList
iconNames
MEMBER
_iconNames
CONSTANT
)
Q_PROPERTY
(
FontSize
fontSize
READ
fontSize
WRITE
setFontSize
NOTIFY
fontSizeChanged
)
Q_PROPERTY
(
QStringList
fontSizeNames
MEMBER
_fontSizeNames
CONSTANT
)
Q_PROPERTY
(
bool
showUnits
READ
showUnits
WRITE
setShowUnits
NOTIFY
showUnitsChanged
)
Q_PROPERTY
(
QStringList
rangeTypeNames
MEMBER
_rangeTypeNames
CONSTANT
)
Q_PROPERTY
(
RangeType
rangeType
READ
rangeType
WRITE
setRangeType
NOTIFY
rangeTypeChanged
)
Q_PROPERTY
(
QVariantList
rangeValues
READ
rangeValues
WRITE
setRangeValues
NOTIFY
rangeValuesChanged
)
Q_PROPERTY
(
QVariantList
rangeColors
READ
rangeColors
WRITE
setRangeColors
NOTIFY
rangeColorsChanged
)
Q_PROPERTY
(
QVariantList
rangeIcons
READ
rangeIcons
WRITE
setRangeIcons
NOTIFY
rangeIconsChanged
)
Q_PROPERTY
(
QVariantList
rangeOpacities
READ
rangeOpacities
WRITE
setRangeOpacities
NOTIFY
rangeOpacitiesChanged
)
Q_INVOKABLE
void
setFact
(
const
QString
&
factGroupName
,
const
QString
&
factName
);
Q_INVOKABLE
void
clearFact
(
void
);
Q_INVOKABLE
bool
isValidColor
(
const
QColor
&
color
)
{
return
color
.
isValid
();
}
Q_INVOKABLE
QColor
invalidColor
(
void
)
{
return
QColor
();
}
Q_INVOKABLE
void
addRangeValue
(
void
);
Q_INVOKABLE
void
removeRangeValue
(
int
index
);
Fact
*
fact
(
void
)
{
return
_fact
;
}
FontSize
fontSize
(
void
)
const
{
return
_fontSize
;
}
QString
label
(
void
)
const
{
return
_label
;
}
bool
showUnits
(
void
)
const
{
return
_showUnits
;
}
QString
icon
(
void
)
const
{
return
_icon
;
}
IconPosition
iconPosition
(
void
)
const
{
return
_iconPosition
;
}
RangeType
rangeType
(
void
)
const
{
return
_rangeType
;
}
QVariantList
rangeValues
(
void
)
const
{
return
_rangeValues
;
}
QVariantList
rangeColors
(
void
)
const
{
return
_rangeColors
;
}
QVariantList
rangeIcons
(
void
)
const
{
return
_rangeIcons
;
}
QVariantList
rangeOpacities
(
void
)
const
{
return
_rangeOpacities
;
}
void
setFontSize
(
FontSize
fontSize
);
void
setLabel
(
const
QString
&
label
);
void
setShowUnits
(
bool
showUnits
);
void
setIcon
(
const
QString
&
icon
);
void
setIconPosition
(
IconPosition
iconPosition
);
void
setRangeType
(
RangeType
rangeType
);
void
setRangeValues
(
const
QVariantList
&
rangeValues
);
void
setRangeColors
(
const
QVariantList
&
rangeColors
);
void
setRangeIcons
(
const
QVariantList
&
rangeIcons
);
void
setRangeOpacities
(
const
QVariantList
&
rangeOpacities
);
void
activeVehicleChanged
(
Vehicle
*
activeVehicle
);
void
saveToSettings
(
QSettings
&
settings
)
const
;
void
readFromSettings
(
const
QSettings
&
settings
);
signals:
void
factChanged
(
Fact
*
fact
);
void
factNameChanged
(
const
QString
&
factName
);
void
factGroupNameChanged
(
const
QString
&
factGroup
);
void
labelChanged
(
QString
label
);
void
fontSizeChanged
(
FontSize
fontSize
);
void
showUnitsChanged
(
bool
showUnits
);
void
iconChanged
(
const
QString
&
icon
);
void
iconPositionChanged
(
IconPosition
iconPosition
);
void
factGroupNamesChanged
(
const
QStringList
&
factGroupNames
);
void
factValueNamesChanged
(
const
QStringList
&
factValueNames
);
void
rangeTypeChanged
(
RangeType
rangeType
);
void
rangeValuesChanged
(
const
QVariantList
&
rangeValues
);
void
rangeColorsChanged
(
const
QVariantList
&
rangeColors
);
void
rangeIconsChanged
(
const
QVariantList
&
rangeIcons
);
void
rangeOpacitiesChanged
(
const
QVariantList
&
rangeOpacities
);
private
slots
:
void
_resetRangeInfo
(
void
);
private:
void
_setFontSize
(
FontSize
fontSize
);
Vehicle
*
_activeVehicle
=
nullptr
;
QmlObjectListModel
*
_rowModel
=
nullptr
;
Fact
*
_fact
=
nullptr
;
QString
_factName
;
QString
_factGroupName
;
QString
_label
;
bool
_showUnits
=
true
;
FontSize
_fontSize
=
DefaultFontSize
;
QString
_icon
;
IconPosition
_iconPosition
=
IconLeft
;
QStringList
_factGroupNames
;
QStringList
_factValueNames
;
// Ranges allow you to specifiy semantics to apply when a value is within a certain range.
// The limits for each section of the range are specified in _rangeValues. With the first
// element indicating a range from that value to -infinity and the last element indicating
// a range from the value to +infinity.
//
// The semantics to apply are defined by the _rangeType value. With the semantic lists having
// a specific value for each section of the range. There should be _rangeValues.count() + 2
// semantic values in the apppropriate list.
RangeType
_rangeType
=
NoRangeInfo
;
QVariantList
_rangeValues
;
///< double values which indicate range setpoints
QVariantList
_rangeColors
;
///< QColor
QVariantList
_rangeIcons
;
///< QString resource name
QVariantList
_rangeOpacities
;
/// double opacity value
// These are user facing string for the various enums.
static
const
QStringList
_rangeTypeNames
;
static
const
QStringList
_iconPositionNames
;
static
QStringList
_iconNames
;
static
const
QStringList
_fontSizeNames
;
static
const
char
*
_versionKey
;
static
const
char
*
_factGroupNameKey
;
static
const
char
*
_factNameKey
;
static
const
char
*
_labelKey
;
static
const
char
*
_fontSizeKey
;
static
const
char
*
_showUnitsKey
;
static
const
char
*
_iconKey
;
static
const
char
*
_iconPositionKey
;
static
const
char
*
_rangeTypeKey
;
static
const
char
*
_rangeValuesKey
;
static
const
char
*
_rangeColorsKey
;
static
const
char
*
_rangeIconsKey
;
static
const
char
*
_rangeOpacitiesKey
;
static
const
char
*
_vehicleFactGroupName
;
};
Q_DECLARE_METATYPE
(
InstrumentValue
::
FontSize
)
Q_DECLARE_METATYPE
(
InstrumentValue
::
IconPosition
)
Q_DECLARE_METATYPE
(
InstrumentValue
::
RangeType
)
src/FlightMap/Widgets/ValuePageWidget.qml
View file @
1aba5c4b
This diff is collapsed.
Click to expand it.
src/FlightMap/Widgets/ValuesWidgetController.cc
View file @
1aba5c4b
This diff is collapsed.
Click to expand it.
src/FlightMap/Widgets/ValuesWidgetController.h
View file @
1aba5c4b
...
@@ -12,109 +12,10 @@
...
@@ -12,109 +12,10 @@
#include "FactSystem.h"
#include "FactSystem.h"
#include "QmlObjectListModel.h"
#include "QmlObjectListModel.h"
#include "QGCApplication.h"
#include "QGCApplication.h"
#include "InstrumentValue.h"
#include <QObject>
#include <QObject>
class
ValuesWidgetController
;
class
InstrumentValue
:
public
QObject
{
Q_OBJECT
public:
enum
FontSize
{
DefaultFontSize
=
0
,
SmallFontSize
,
MediumFontSize
,
LargeFontSize
};
Q_ENUMS
(
FontSize
)
enum
IconPosition
{
IconAbove
=
0
,
IconLeft
};
Q_ENUMS
(
IconPosition
)
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
factName
MEMBER
_factName
NOTIFY
factNameChanged
)
Q_PROPERTY
(
Fact
*
fact
READ
fact
NOTIFY
factChanged
)
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
(
IconPosition
iconPosition
READ
iconPosition
WRITE
setIconPosition
NOTIFY
iconPositionChanged
)
Q_PROPERTY
(
QStringList
iconPositionNames
MEMBER
_iconPositionNames
CONSTANT
)
Q_PROPERTY
(
QStringList
iconNames
MEMBER
_iconNames
CONSTANT
)
Q_PROPERTY
(
FontSize
fontSize
READ
fontSize
WRITE
setFontSize
NOTIFY
fontSizeChanged
)
Q_PROPERTY
(
QStringList
fontSizeNames
MEMBER
_fontSizeNames
CONSTANT
)
Q_PROPERTY
(
bool
showUnits
READ
showUnits
WRITE
setShowUnits
NOTIFY
showUnitsChanged
)
Q_INVOKABLE
void
setFact
(
const
QString
&
factGroupName
,
const
QString
&
factName
);
Q_INVOKABLE
void
clearFact
(
void
);
Fact
*
fact
(
void
)
{
return
_fact
;
}
FontSize
fontSize
(
void
)
const
{
return
_fontSize
;
}
QString
label
(
void
)
const
{
return
_label
;
}
bool
showUnits
(
void
)
const
{
return
_showUnits
;
}
QString
icon
(
void
)
const
{
return
_icon
;
}
IconPosition
iconPosition
(
void
)
const
{
return
_iconPosition
;
}
void
setFontSize
(
FontSize
fontSize
);
void
setLabel
(
const
QString
&
label
);
void
setShowUnits
(
bool
showUnits
);
void
setIcon
(
const
QString
&
icon
);
void
setIconPosition
(
IconPosition
iconPosition
);
void
activeVehicleChanged
(
Vehicle
*
activeVehicle
);
void
saveToSettings
(
QSettings
&
settings
)
const
;
void
readFromSettings
(
const
QSettings
&
settings
);
signals:
void
factChanged
(
Fact
*
fact
);
void
factNameChanged
(
const
QString
&
factName
);
void
factGroupNameChanged
(
const
QString
&
factGroup
);
void
labelChanged
(
QString
label
);
void
fontSizeChanged
(
FontSize
fontSize
);
void
showUnitsChanged
(
bool
showUnits
);
void
iconChanged
(
const
QString
&
icon
);
void
iconPositionChanged
(
IconPosition
iconPosition
);
void
factGroupNamesChanged
(
const
QStringList
&
factGroupNames
);
void
factValueNamesChanged
(
const
QStringList
&
factValueNames
);
private:
void
_setFontSize
(
FontSize
fontSize
);
Vehicle
*
_activeVehicle
=
nullptr
;
QmlObjectListModel
*
_rowModel
=
nullptr
;
Fact
*
_fact
=
nullptr
;
QString
_factName
;
QString
_factGroupName
;
QString
_label
;
bool
_showUnits
=
true
;
FontSize
_fontSize
=
DefaultFontSize
;
QString
_icon
;
IconPosition
_iconPosition
=
IconLeft
;
QStringList
_factGroupNames
;
QStringList
_factValueNames
;
static
const
QStringList
_iconPositionNames
;
static
QStringList
_iconNames
;
static
const
QStringList
_fontSizeNames
;
static
const
char
*
_factGroupNameKey
;
static
const
char
*
_factNameKey
;
static
const
char
*
_labelKey
;
static
const
char
*
_fontSizeKey
;
static
const
char
*
_showUnitsKey
;
static
const
char
*
_iconKey
;
static
const
char
*
_iconPositionKey
;
static
const
char
*
_vehicleFactGroupName
;
};
Q_DECLARE_METATYPE
(
InstrumentValue
::
FontSize
)
Q_DECLARE_METATYPE
(
InstrumentValue
::
IconPosition
)
class
ValuesWidgetController
:
public
QObject
class
ValuesWidgetController
:
public
QObject
{
{
Q_OBJECT
Q_OBJECT
...
...
src/QmlControls/QGCPopupDialogContainer.qml
View file @
1aba5c4b
...
@@ -156,9 +156,9 @@ Popup {
...
@@ -156,9 +156,9 @@ Popup {
}
}
Item
{
Item
{
id
:
item
id
:
item
w
idth
:
dialogComponentLoader
.
width
+
(
_contentMargin
*
2
)
Layout.preferredW
idth
:
dialogComponentLoader
.
width
+
(
_contentMargin
*
2
)
h
eight
:
dialogComponentLoader
.
height
+
_contentMargin
Layout.preferredH
eight
:
dialogComponentLoader
.
height
+
_contentMargin
Loader
{
Loader
{
id
:
dialogComponentLoader
id
:
dialogComponentLoader
...
...
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