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
64a93570
Commit
64a93570
authored
Jul 28, 2019
by
Stefan Dunca
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add individual zoom controls
parent
aaa441e5
Changes
7
Hide whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
257 additions
and
2 deletions
+257
-2
custom.qrc
custom-example/custom.qrc
+4
-0
qgroundcontrol-start.sh
custom-example/deploy/qgroundcontrol-start.sh
+10
-0
ZoomControl.qml
custom-example/res/Custom/Camera/ZoomControl.qml
+213
-0
qmldir
custom-example/res/Custom/Camera/qmldir
+3
-0
CustomCameraControl.qml
custom-example/res/CustomCameraControl.qml
+24
-0
CustomPlugin.cc
custom-example/src/CustomPlugin.cc
+1
-0
QGCCameraControl.cc
src/Camera/QGCCameraControl.cc
+2
-2
No files found.
custom-example/custom.qrc
View file @
64a93570
...
@@ -45,4 +45,8 @@
...
@@ -45,4 +45,8 @@
<file alias="Custom/Widgets/CustomVehicleButton.qml">res/Custom/Widgets/CustomVehicleButton.qml</file>
<file alias="Custom/Widgets/CustomVehicleButton.qml">res/Custom/Widgets/CustomVehicleButton.qml</file>
<file alias="Custom/Widgets/qmldir">res/Custom/Widgets/qmldir</file>
<file alias="Custom/Widgets/qmldir">res/Custom/Widgets/qmldir</file>
</qresource>
</qresource>
<qresource prefix="Custom/Camera">
<file alias="Custom/Camera/qmldir">res/Custom/Camera/qmldir</file>
<file alias="Custom/Camera/ZoomControl.qml">res/Custom/Camera/ZoomControl.qml</file>
</qresource>
</RCC>
</RCC>
custom-example/deploy/qgroundcontrol-start.sh
0 → 100755
View file @
64a93570
#!/bin/sh
HERE
=
"
$(
dirname
"
$(
readlink
-f
"
${
0
}
"
)
"
)
"
export
LD_LIBRARY_PATH
=
"
${
HERE
}
/usr/lib/x86_64-linux-gnu"
:
"
${
HERE
}
/Qt/libs"
:
$LD_LIBRARY_PATH
export
QML2_IMPORT_PATH
=
"
${
HERE
}
/Qt/qml"
export
QT_PLUGIN_PATH
=
"
${
HERE
}
/Qt/plugins"
# hack until icon issue with AppImage is resolved
mkdir
-p
~/.icons
&&
\c
p
-f
${
HERE
}
/qgroundcontrol.png ~/.icons
"
${
HERE
}
/CustomQGC"
"
$@
"
custom-example/res/Custom/Camera/ZoomControl.qml
0 → 100644
View file @
64a93570
import
QtQuick
2.0
import
QtQuick
.
Controls
2.4
import
QtGraphicalEffects
1.0
Item
{
id
:
_root
property
color
mainColor
:
"
#000000
"
property
color
contentColor
:
"
#FFFFFF
"
property
alias
fontPointSize
:
zoomStatusTextItem
.
font
.
pointSize
property
real
zoomLevel
:
NaN
property
alias
zoomLevelVisible
:
zoomStatusItem
.
visible
property
bool
showZoomPrecision
:
true
signal
zoomIn
()
signal
zoomOut
()
signal
continuousZoomStart
(
var
zoomIn
)
signal
continuousZoomStop
()
height
:
zoomStatusTextItem
.
height
*
2
width
:
(
zoomLevelVisible
?
(
zoomStatusItem
.
width
-
zoomInButton
.
width
/
2
)
:
0
)
+
zoomInButton
.
width
+
zoomOutButton
.
width
Rectangle
{
id
:
zoomStatusItem
color
:
mainColor
opacity
:
0.5
radius
:
height
/
2
anchors.left
:
_root
.
left
anchors.verticalCenter
:
_root
.
verticalCenter
width
:
height
*
2
height
:
_root
.
height
*
0.8
}
Item
{
visible
:
zoomStatusItem
.
visible
anchors.left
:
zoomStatusItem
.
left
anchors.top
:
zoomStatusItem
.
top
anchors.right
:
zoomStatusItem
.
horizontalCenter
anchors.bottom
:
zoomStatusItem
.
bottom
z
:
zoomStatusItem
.
z
+
1
Text
{
id
:
zoomStatusTextItem
anchors.centerIn
:
parent
opacity
:
2
color
:
_root
.
contentColor
text
:
isNaN
(
zoomLevel
)
?
"
-
"
:
"
x
"
+
_root
.
zoomLevel
.
toFixed
(
_root
.
showZoomPrecision
?
1
:
0
)
}
}
Button
{
id
:
zoomInButton
flat
:
true
anchors.left
:
zoomLevelVisible
?
zoomStatusItem
.
horizontalCenter
:
_root
.
left
anchors.top
:
_root
.
top
width
:
height
height
:
_root
.
height
property
bool
holding
:
false
onPressed
:
{
_root
.
zoomIn
()
}
onPressAndHold
:
{
holding
=
true
}
onReleased
:
{
holding
=
false
}
background
:
Rectangle
{
anchors.fill
:
zoomInButton
radius
:
zoomInButton
.
width
/
2
color
:
_root
.
mainColor
}
contentItem
:
Item
{
anchors.fill
:
zoomInButton
Rectangle
{
id
:
zoomInMinusRectangle
anchors.centerIn
:
parent
width
:
zoomInButton
.
width
*
0.4
height
:
zoomInButton
.
height
*
0.05
color
:
_root
.
contentColor
}
Rectangle
{
anchors.centerIn
:
parent
width
:
zoomInMinusRectangle
.
height
height
:
zoomInMinusRectangle
.
width
color
:
_root
.
contentColor
}
}
}
Item
{
id
:
buttonSeparator
anchors.left
:
zoomInButton
.
right
anchors.verticalCenter
:
zoomInButton
.
verticalCenter
width
:
zoomInButton
.
width
*
0.05
height
:
zoomInButton
.
height
*
0.8
Rectangle
{
radius
:
width
*
0.2
anchors.centerIn
:
parent
width
:
zoomInButton
.
width
*
0.01
height
:
parent
.
height
*
0.8
color
:
_root
.
contentColor
}
}
Button
{
id
:
zoomOutButton
flat
:
true
anchors.left
:
buttonSeparator
.
right
anchors.top
:
zoomInButton
.
top
width
:
height
height
:
zoomInButton
.
height
property
bool
holding
:
false
onPressed
:
{
_root
.
zoomOut
()
}
onPressAndHold
:
{
holding
=
true
}
onReleased
:
{
holding
=
false
}
background
:
Rectangle
{
anchors.fill
:
zoomOutButton
radius
:
zoomOutButton
.
width
/
2
color
:
_root
.
mainColor
}
contentItem
:
Item
{
anchors.fill
:
zoomOutButton
Rectangle
{
id
:
zoomOutMinusRectangle
anchors.centerIn
:
parent
width
:
zoomInMinusRectangle
.
width
height
:
zoomInMinusRectangle
.
height
color
:
_root
.
contentColor
}
}
}
// Zoom buttons background
Rectangle
{
color
:
_root
.
mainColor
z
:
-
1
anchors.left
:
zoomInButton
.
horizontalCenter
anchors.right
:
zoomOutButton
.
horizontalCenter
anchors.top
:
zoomInButton
.
top
anchors.bottom
:
zoomOutButton
.
bottom
}
onStateChanged
:
{
if
(
state
==
"
ZoomingIn
"
)
{
_root
.
continuousZoomStart
(
true
)
}
else
if
(
state
==
"
ZoomingOut
"
)
{
_root
.
continuousZoomStart
(
false
)
}
else
{
_root
.
continuousZoomStop
()
}
}
state
:
"
None
"
states
:
[
State
{
name
:
"
None
"
when
:
zoomInButton
.
holding
===
false
&&
zoomOutButton
.
holding
===
false
},
State
{
name
:
"
ZoomingIn
"
when
:
zoomInButton
.
holding
===
true
},
State
{
name
:
"
ZoomingOut
"
when
:
zoomOutButton
.
holding
===
true
}
]
}
custom-example/res/Custom/Camera/qmldir
0 → 100644
View file @
64a93570
module Custom.Camera
ZoomControl 1.0 ZoomControl.qml
custom-example/res/CustomCameraControl.qml
View file @
64a93570
...
@@ -28,6 +28,7 @@ import QGroundControl.Vehicle 1.0
...
@@ -28,6 +28,7 @@ import QGroundControl.Vehicle 1.0
import
CustomQuickInterface
1.0
import
CustomQuickInterface
1.0
import
Custom
.
Widgets
1.0
import
Custom
.
Widgets
1.0
import
Custom
.
Camera
1.0
Item
{
Item
{
height
:
mainColumn
.
height
height
:
mainColumn
.
height
...
@@ -416,6 +417,29 @@ Item {
...
@@ -416,6 +417,29 @@ Item {
}
}
}
}
}
}
//-- Zoom Buttons
ZoomControl
{
id
:
zoomControl
visible
:
_hasZoom
mainColor
:
qgcPal
.
window
contentColor
:
qgcPal
.
text
fontPointSize
:
ScreenTools
.
defaultFontPointSize
*
1.25
zoomLevelVisible
:
false
zoomLevel
:
_hasZoom
?
_camera
.
zoomLevel
:
NaN
anchors.horizontalCenter
:
parent
.
horizontalCenter
onZoomIn
:
{
_camera
.
stepZoom
(
1
)
}
onZoomOut
:
{
_camera
.
stepZoom
(
-
1
)
}
onContinuousZoomStart
:
{
_camera
.
startZoom
(
zoomIn
?
1
:
-
1
)
}
onContinuousZoomStop
:
{
_camera
.
stopZoom
()
}
}
}
}
//-------------------------------------------------------------------------
//-------------------------------------------------------------------------
//-- Camera Settings
//-- Camera Settings
...
...
custom-example/src/CustomPlugin.cc
View file @
64a93570
...
@@ -205,6 +205,7 @@ CustomPlugin::createRootWindow(QObject *parent)
...
@@ -205,6 +205,7 @@ CustomPlugin::createRootWindow(QObject *parent)
QQmlApplicationEngine
*
pEngine
=
new
QQmlApplicationEngine
(
parent
);
QQmlApplicationEngine
*
pEngine
=
new
QQmlApplicationEngine
(
parent
);
pEngine
->
addImportPath
(
"qrc:/qml"
);
pEngine
->
addImportPath
(
"qrc:/qml"
);
pEngine
->
addImportPath
(
"qrc:/Custom/Widgets"
);
pEngine
->
addImportPath
(
"qrc:/Custom/Widgets"
);
pEngine
->
addImportPath
(
"qrc:/Custom/Camera"
);
pEngine
->
rootContext
()
->
setContextProperty
(
"joystickManager"
,
qgcApp
()
->
toolbox
()
->
joystickManager
());
pEngine
->
rootContext
()
->
setContextProperty
(
"joystickManager"
,
qgcApp
()
->
toolbox
()
->
joystickManager
());
pEngine
->
rootContext
()
->
setContextProperty
(
"debugMessageModel"
,
AppMessages
::
getModel
());
pEngine
->
rootContext
()
->
setContextProperty
(
"debugMessageModel"
,
AppMessages
::
getModel
());
pEngine
->
load
(
QUrl
(
QStringLiteral
(
"qrc:/qml/MainRootWindow.qml"
)));
pEngine
->
load
(
QUrl
(
QStringLiteral
(
"qrc:/qml/MainRootWindow.qml"
)));
...
...
src/Camera/QGCCameraControl.cc
View file @
64a93570
...
@@ -626,7 +626,7 @@ QGCCameraControl::startZoom(int direction)
...
@@ -626,7 +626,7 @@ QGCCameraControl::startZoom(int direction)
_vehicle
->
sendMavCommand
(
_vehicle
->
sendMavCommand
(
_compID
,
// Target component
_compID
,
// Target component
MAV_CMD_SET_CAMERA_ZOOM
,
// Command id
MAV_CMD_SET_CAMERA_ZOOM
,
// Command id
true
,
// ShowError
false
,
// ShowError
ZOOM_TYPE_CONTINUOUS
,
// Zoom type
ZOOM_TYPE_CONTINUOUS
,
// Zoom type
direction
);
// Direction (-1 wide, 1 tele)
direction
);
// Direction (-1 wide, 1 tele)
}
}
...
@@ -641,7 +641,7 @@ QGCCameraControl::stopZoom()
...
@@ -641,7 +641,7 @@ QGCCameraControl::stopZoom()
_vehicle
->
sendMavCommand
(
_vehicle
->
sendMavCommand
(
_compID
,
// Target component
_compID
,
// Target component
MAV_CMD_SET_CAMERA_ZOOM
,
// Command id
MAV_CMD_SET_CAMERA_ZOOM
,
// Command id
true
,
// ShowError
false
,
// ShowError
ZOOM_TYPE_CONTINUOUS
,
// Zoom type
ZOOM_TYPE_CONTINUOUS
,
// Zoom type
0
);
// Direction (-1 wide, 1 tele)
0
);
// Direction (-1 wide, 1 tele)
}
}
...
...
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