Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
Valentin Platzgummer
qgroundcontrol
Commits
880ee75d
Commit
880ee75d
authored
Sep 28, 2017
by
Gus Grubba
Browse files
Camera control tweaks
parent
7e320ebd
Changes
4
Hide whitespace changes
Inline
Side-by-side
src/Camera/QGCCameraControl.cc
View file @
880ee75d
...
@@ -1434,3 +1434,11 @@ QGCCameraControl::validateParameter(Fact* pFact, QVariant& newValue)
...
@@ -1434,3 +1434,11 @@ QGCCameraControl::validateParameter(Fact* pFact, QVariant& newValue)
Q_UNUSED
(
newValue
);
Q_UNUSED
(
newValue
);
return
true
;
return
true
;
}
}
//-----------------------------------------------------------------------------
QStringList
QGCCameraControl
::
activeSettings
()
{
qCDebug
(
CameraControlLog
)
<<
"Active:"
<<
_activeSettings
;
return
_activeSettings
;
}
src/Camera/QGCCameraControl.h
View file @
880ee75d
...
@@ -144,7 +144,7 @@ public:
...
@@ -144,7 +144,7 @@ public:
virtual
VideoStatus
videoStatus
();
virtual
VideoStatus
videoStatus
();
virtual
PhotoStatus
photoStatus
();
virtual
PhotoStatus
photoStatus
();
virtual
CameraMode
cameraMode
()
{
return
_cameraMode
;
}
virtual
CameraMode
cameraMode
()
{
return
_cameraMode
;
}
virtual
QStringList
activeSettings
()
{
return
_activeSettings
;
}
virtual
QStringList
activeSettings
()
;
virtual
quint32
storageFree
()
{
return
_storageFree
;
}
virtual
quint32
storageFree
()
{
return
_storageFree
;
}
virtual
QString
storageFreeStr
();
virtual
QString
storageFreeStr
();
virtual
quint32
storageTotal
()
{
return
_storageTotal
;
}
virtual
quint32
storageTotal
()
{
return
_storageTotal
;
}
...
...
src/Camera/QGCCameraManager.cc
View file @
880ee75d
...
@@ -112,7 +112,7 @@ QGCCameraManager::_handleCameraInfo(const mavlink_message_t& message)
...
@@ -112,7 +112,7 @@ QGCCameraManager::_handleCameraInfo(const mavlink_message_t& message)
{
{
mavlink_camera_information_t
info
;
mavlink_camera_information_t
info
;
mavlink_msg_camera_information_decode
(
&
message
,
&
info
);
mavlink_msg_camera_information_decode
(
&
message
,
&
info
);
qCDebug
(
CameraManagerLog
)
<<
"_handleCameraInfo:"
<<
(
const
char
*
)(
void
*
)
&
info
.
model_name
[
0
]
<<
(
const
char
*
)(
void
*
)
&
info
.
vendor_name
[
0
];
qCDebug
(
CameraManagerLog
)
<<
"_handleCameraInfo:"
<<
(
const
char
*
)(
void
*
)
&
info
.
model_name
[
0
]
<<
(
const
char
*
)(
void
*
)
&
info
.
vendor_name
[
0
]
<<
"Comp ID:"
<<
message
.
compid
;
QGCCameraControl
*
pCamera
=
_vehicle
->
firmwarePlugin
()
->
createCameraControl
(
&
info
,
_vehicle
,
message
.
compid
,
this
);
QGCCameraControl
*
pCamera
=
_vehicle
->
firmwarePlugin
()
->
createCameraControl
(
&
info
,
_vehicle
,
message
.
compid
,
this
);
if
(
pCamera
)
{
if
(
pCamera
)
{
QQmlEngine
::
setObjectOwnership
(
pCamera
,
QQmlEngine
::
CppOwnership
);
QQmlEngine
::
setObjectOwnership
(
pCamera
,
QQmlEngine
::
CppOwnership
);
...
...
src/FlightMap/Widgets/CameraPageWidget.qml
View file @
880ee75d
...
@@ -34,14 +34,15 @@ Column {
...
@@ -34,14 +34,15 @@ Column {
property
var
_dynamicCameras
:
_activeVehicle
?
_activeVehicle
.
dynamicCameras
:
null
property
var
_dynamicCameras
:
_activeVehicle
?
_activeVehicle
.
dynamicCameras
:
null
property
bool
_isCamera
:
_dynamicCameras
?
_dynamicCameras
.
cameras
.
count
>
0
:
false
property
bool
_isCamera
:
_dynamicCameras
?
_dynamicCameras
.
cameras
.
count
>
0
:
false
property
bool
_cameraModeUndefined
:
_isCamera
?
_dynamicCameras
.
cameras
.
get
(
0
).
cameraMode
===
QGCCameraControl
.
CAMERA_MODE_UNDEFINED
:
true
property
bool
_cameraModeUndefined
:
_isCamera
?
_dynamicCameras
.
cameras
.
get
(
0
).
cameraMode
===
QGCCameraControl
.
CAMERA_MODE_UNDEFINED
:
true
property
bool
_cameraVideoMode
:
_isCamera
?
_dynamicCameras
.
cameras
.
get
(
0
).
cameraMode
===
QGCCameraControl
.
CAMERA_MODE_VIDEO
:
false
property
bool
_cameraVideoMode
:
_isCamera
?
_dynamicCameras
.
cameras
.
get
(
0
).
cameraMode
===
1
:
false
property
bool
_cameraPhotoMode
:
_isCamera
?
_dynamicCameras
.
cameras
.
get
(
0
).
cameraMode
===
QGCCameraControl
.
CAMERA_MODE_PHOTO
:
false
property
bool
_cameraPhotoMode
:
_isCamera
?
_dynamicCameras
.
cameras
.
get
(
0
).
cameraMode
===
0
:
false
property
var
_camera
:
_isCamera
?
_dynamicCameras
.
cameras
.
get
(
0
)
:
null
// Single camera support for the time being
property
var
_camera
:
_isCamera
?
_dynamicCameras
.
cameras
.
get
(
0
)
:
null
// Single camera support for the time being
property
real
_spacers
:
ScreenTools
.
defaultFontPixelHeight
*
0.5
property
real
_spacers
:
ScreenTools
.
defaultFontPixelHeight
*
0.5
property
real
_labelFieldWidth
:
ScreenTools
.
defaultFontPixelWidth
*
30
property
real
_labelFieldWidth
:
ScreenTools
.
defaultFontPixelWidth
*
30
property
real
_editFieldWidth
:
ScreenTools
.
defaultFontPixelWidth
*
30
property
real
_editFieldWidth
:
ScreenTools
.
defaultFontPixelWidth
*
30
property
bool
_communicationLost
:
_activeVehicle
?
_activeVehicle
.
connectionLost
:
false
property
bool
_communicationLost
:
_activeVehicle
?
_activeVehicle
.
connectionLost
:
false
property
bool
_hasModes
:
_isCamera
&&
_camera
&&
_camera
.
hasModes
property
bool
_hasModes
:
_isCamera
&&
_camera
&&
_camera
.
hasModes
property
bool
_videoRecording
:
_camera
&&
_camera
.
videoStatus
===
QGCCameraControl
.
VIDEO_CAPTURE_STATUS_RUNNING
function
showSettings
()
{
function
showSettings
()
{
qgcView
.
showDialog
(
cameraSettings
,
_cameraVideoMode
?
qsTr
(
"
Video Settings
"
)
:
qsTr
(
"
Camera Settings
"
),
70
,
StandardButton
.
Ok
)
qgcView
.
showDialog
(
cameraSettings
,
_cameraVideoMode
?
qsTr
(
"
Video Settings
"
)
:
qsTr
(
"
Camera Settings
"
),
70
,
StandardButton
.
Ok
)
...
@@ -66,23 +67,26 @@ Column {
...
@@ -66,23 +67,26 @@ Column {
}
}
//-- Camera Mode (visible only if camera has modes)
//-- Camera Mode (visible only if camera has modes)
Rectangle
{
Rectangle
{
width
:
_hasModes
?
ScreenTools
.
defaultFontPixelWidth
*
12
:
0
width
:
_hasModes
?
ScreenTools
.
defaultFontPixelWidth
*
8
:
0
height
:
_hasModes
?
ScreenTools
.
defaultFontPixelWidth
*
4
:
0
height
:
_hasModes
?
ScreenTools
.
defaultFontPixelWidth
*
4
:
0
color
:
qgcPal
.
window
color
:
qgcPal
.
button
radius
:
height
*
0.5
radius
:
height
*
0.5
visible
:
_hasModes
visible
:
_hasModes
anchors.horizontalCenter
:
parent
.
horizontalCenter
anchors.horizontalCenter
:
parent
.
horizontalCenter
//-- Video Mode
//-- Video Mode
Rectangle
{
Rectangle
{
width
:
parent
.
height
*
0.9
width
:
parent
.
height
height
:
parent
.
height
*
0.9
height
:
parent
.
height
color
:
qgcPal
.
windowShadeDark
color
:
_cameraVideoMode
?
qgcPal
.
window
:
qgcPal
.
button
radius
:
height
*
0.5
radius
:
height
*
0.5
anchors.left
:
parent
.
left
anchors.left
:
parent
.
left
anchors.leftMargin
:
4
border.color
:
qgcPal
.
text
border.width
:
_cameraVideoMode
?
1
:
0
anchors.verticalCenter
:
parent
.
verticalCenter
anchors.verticalCenter
:
parent
.
verticalCenter
QGCColoredImage
{
QGCColoredImage
{
anchors.fill
:
parent
height
:
parent
.
height
*
0.5
width
:
height
anchors.centerIn
:
parent
source
:
"
/qmlimages/camera_video.svg
"
source
:
"
/qmlimages/camera_video.svg
"
fillMode
:
Image
.
PreserveAspectFit
fillMode
:
Image
.
PreserveAspectFit
sourceSize.height
:
height
sourceSize.height
:
height
...
@@ -98,15 +102,18 @@ Column {
...
@@ -98,15 +102,18 @@ Column {
}
}
//-- Photo Mode
//-- Photo Mode
Rectangle
{
Rectangle
{
width
:
parent
.
height
*
0.9
width
:
parent
.
height
height
:
parent
.
height
*
0.9
height
:
parent
.
height
color
:
qgcPal
.
windowShade
color
:
_cameraPhotoMode
?
qgcPal
.
window
:
qgcPal
.
button
radius
:
height
*
0.5
radius
:
height
*
0.5
anchors.right
:
parent
.
right
anchors.right
:
parent
.
right
anchors.rightMargin
:
4
border.color
:
qgcPal
.
text
border.width
:
_cameraPhotoMode
?
1
:
0
anchors.verticalCenter
:
parent
.
verticalCenter
anchors.verticalCenter
:
parent
.
verticalCenter
QGCColoredImage
{
QGCColoredImage
{
anchors.fill
:
parent
height
:
parent
.
height
*
0.5
width
:
height
anchors.centerIn
:
parent
source
:
"
/qmlimages/camera_photo.svg
"
source
:
"
/qmlimages/camera_photo.svg
"
fillMode
:
Image
.
PreserveAspectFit
fillMode
:
Image
.
PreserveAspectFit
sourceSize.height
:
height
sourceSize.height
:
height
...
@@ -132,9 +139,9 @@ Column {
...
@@ -132,9 +139,9 @@ Column {
border.width
:
3
border.width
:
3
anchors.horizontalCenter
:
parent
.
horizontalCenter
anchors.horizontalCenter
:
parent
.
horizontalCenter
Rectangle
{
Rectangle
{
width
:
parent
.
width
*
0.75
width
:
parent
.
width
*
(
_videoRecording
?
0.5
:
0.75
)
height
:
width
height
:
width
radius
:
width
*
0.5
radius
:
_videoRecording
?
0
:
width
*
0.5
color
:
_cameraModeUndefined
?
qgcPal
.
colorGrey
:
qgcPal
.
colorRed
color
:
_cameraModeUndefined
?
qgcPal
.
colorGrey
:
qgcPal
.
colorRed
anchors.centerIn
:
parent
anchors.centerIn
:
parent
}
}
...
@@ -143,7 +150,7 @@ Column {
...
@@ -143,7 +150,7 @@ Column {
enabled
:
!
_cameraModeUndefined
enabled
:
!
_cameraModeUndefined
onClicked
:
{
onClicked
:
{
if
(
_cameraVideoMode
)
{
if
(
_cameraVideoMode
)
{
//-- Start/Stop
Video
_camera
.
toggle
Video
()
}
else
{
}
else
{
_camera
.
takePhoto
()
_camera
.
takePhoto
()
}
}
...
@@ -246,7 +253,7 @@ Column {
...
@@ -246,7 +253,7 @@ Column {
standardButtons
:
StandardButton
.
Yes
|
StandardButton
.
No
standardButtons
:
StandardButton
.
Yes
|
StandardButton
.
No
onNo
:
resetPrompt
.
close
()
onNo
:
resetPrompt
.
close
()
onYes
:
{
onYes
:
{
// TODO
_camera
.
resetSettings
()
resetPrompt
.
close
()
resetPrompt
.
close
()
}
}
}
}
...
@@ -264,7 +271,6 @@ Column {
...
@@ -264,7 +271,6 @@ Column {
}
}
QGCButton
{
QGCButton
{
text
:
qsTr
(
"
Format
"
)
text
:
qsTr
(
"
Format
"
)
enabled
:
false
onClicked
:
formatPrompt
.
open
()
onClicked
:
formatPrompt
.
open
()
width
:
_editFieldWidth
width
:
_editFieldWidth
anchors.verticalCenter
:
parent
.
verticalCenter
anchors.verticalCenter
:
parent
.
verticalCenter
...
@@ -275,7 +281,7 @@ Column {
...
@@ -275,7 +281,7 @@ Column {
standardButtons
:
StandardButton
.
Yes
|
StandardButton
.
No
standardButtons
:
StandardButton
.
Yes
|
StandardButton
.
No
onNo
:
formatPrompt
.
close
()
onNo
:
formatPrompt
.
close
()
onYes
:
{
onYes
:
{
// TODO
_camera
.
formatCard
()
formatPrompt
.
close
()
formatPrompt
.
close
()
}
}
}
}
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new 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