Unverified Commit 911310ff authored by Jonah Brüchert's avatar Jonah Brüchert 🌳

Implement video recording

parent 2fd47427
......@@ -6,7 +6,7 @@ import QtQuick.Layouts 1.2
Kirigami.Page {
id: cameraPage
leftPadding: 0
rightPadding: 0
bottomPadding: 0
......@@ -14,14 +14,38 @@ Kirigami.Page {
mainAction: Kirigami.Action {
id: captureAction
text: qsTr("Capture")
text: {
if (camera.captureMode == Camera.CaptureStillImage)
return "Capture photo"
else if (camera.videoRecorder.recorderStatus == CameraRecorder.RecordingStatus)
return "Stop recording video"
else if (camera.captureMode == Camera.CaptureVideo)
return "Start recording video"
}
iconName: {
if (camera.captureMode == Camera.CaptureStillImage)
return "camera-photo"
else if (camera.videoRecorder.recorderStatus == CameraRecorder.RecordingStatus)
return "window-close"
else if (camera.captureMode == Camera.CaptureVideo)
return "video-mp4"
}
onTriggered: camera.imageCapture.capture()
onTriggered: {
if (camera.captureMode == Camera.CaptureStillImage) {
camera.imageCapture.capture()
showPassiveNotification("Took a photo")
}
else if (camera.videoRecorder.recorderStatus == CameraRecorder.RecordingStatus) {
camera.videoRecorder.stop()
recordingFeedback.visible = false
showPassiveNotification("Stopped recording")
}
else if (camera.captureMode == Camera.CaptureVideo) {
camera.videoRecorder.record()
recordingFeedback.visible = true
showPassiveNotification("Started recording")
}
}
}
leftAction: Kirigami.Action {
......@@ -37,7 +61,7 @@ Kirigami.Page {
console.log("Capture Mode switched")
}
}
Rectangle {
id: cameraUI
state: "PhotoCapture"
......@@ -83,7 +107,7 @@ Kirigami.Page {
videoRecorder {
id: videoRecorder
resolution: settings.videoResolution
frameRate: 15
frameRate: 30
}
}
......@@ -138,4 +162,19 @@ Kirigami.Page {
onValueChanged: camera.setDigitalZoom(value)
}
Rectangle {
id: recordingFeedback
visible: false
color: "red"
radius: Kirigami.Units.gridUnit
height: Kirigami.Units.gridUnit * 2
width: height
anchors {
left: parent.left
top: parent.top
margins: Kirigami.Units.gridUnit * 2
}
}
}
import org.kde.kirigami 2.0 as Kirigami
import QtQuick 2.7
import QtQml.Models 2.2
Kirigami.GlobalDrawer {
actions: [
Kirigami.Action {
text: qsTr("Video resolution")
Kirigami.Action {
text: "640x480"
onTriggered: settings.videoResolution = text;
}
Kirigami.Action {
text: "1280x720"
onTriggered: settings.videoResolution = text;
}
Kirigami.Action {
text: "1920x1080"
onTriggered: settings.resolution = text
DelegateModel {
model: root.cameraPage.videoRecorder.supportedResolutions
delegate: Kirigami.Action {
text: model
onTriggered: settings.videoResolution = text;
}
}
}
]
Component.onCompleted: console.log(imageCapture.supportedResolutions)
// Component.onCompleted: console.log(root.cameraPage.cameraUI.camera.videoRecorder.supportedResolutions)
}
import org.kde.kirigami 2.2 as Kirigami
import QtQuick.Controls 2.0 as Controls
import QtQuick 2.7
Kirigami.ScrollablePage {
title: "Settings"
}
......@@ -50,12 +50,12 @@ Kirigami.ApplicationWindow {
property string videoResolution: "640x480"
}
Component {id: cameraPage; CameraPage {}}
id: root
title: "Camera"
globalDrawer: GlobalDrawer {}
Component {id: cameraPage; CameraPage {}}
Component.onCompleted: pageStack.push(cameraPage)
}
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment