Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions qml/Application.qml
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,7 @@ ApplicationWindow {
height: parent.height
width: parent.width
collageMenu.printer : printer
libcamera: libcamera

settingsMenu.switchPrinter.onCheckedChanged:
{
Expand Down
3 changes: 3 additions & 0 deletions qml/ApplicationFlowForm.ui.qml
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ Item {
property alias collageMenu: collageMenu
property alias galleryMenu: galleryMenu
property alias settingsMenu: settingsMenu
property var libcamera

property real slideValueCollageSelection: 0.0
property real slideValueSnapshotMenu: 1.0
Expand All @@ -36,6 +37,7 @@ Item {
width: root.width
height: root.height
state: "deactivated"
libcamera: root.libcamera
}

ImagePreview {
Expand Down Expand Up @@ -73,6 +75,7 @@ Item {
z: 0
width: root.width
height: root.height
libcamera: root.libcamera
}

states: [
Expand Down
12 changes: 7 additions & 5 deletions qml/SettingsMenu.qml
Original file line number Diff line number Diff line change
Expand Up @@ -33,11 +33,13 @@ SettingsMenuForm {
{
listModel.push(gphotoCameras[i])
}
var libcameras = libcamera.availableCameras();
console.log("Libcamera Camera Count: " + Number(libcameras.length).toString())
for(i = 0; i < libcameras.length; i++)
{
listModel.push(libcameras[i])
if (form.libcamera) {
var libcameras = form.libcamera.availableCameras();
console.log("Libcamera Camera Count: " + Number(libcameras.length).toString())
for(i = 0; i < libcameras.length; i++)
{
listModel.push(libcameras[i])
}
}
return listModel;
}
Expand Down
1 change: 1 addition & 0 deletions qml/SettingsMenuForm.ui.qml
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ Item {
property alias comboBoxCameraOrientation: comboBoxCameraOrientation
property alias comboBoxNeuralNetworkRuntime: comboBoxNeuralNetworkRuntime
property alias buttonSelectPhotoDirectory: buttonSelectPhotoDirectory
property var libcamera

ColumnLayout {
anchors.fill: parent
Expand Down
2 changes: 2 additions & 0 deletions qml/SnapshotMenuForm.ui.qml
Original file line number Diff line number Diff line change
Expand Up @@ -14,10 +14,12 @@ Item {
property alias shutterButton: shutterButton
property alias countdown: shutterButton.countDownTime
property bool hideSnapshotSettingsPane: false
property var libcamera

CameraRenderer {
id: cameraRenderer
anchors.fill: parent
libcamera: element.libcamera

Text {
id: failureText
Expand Down
2 changes: 2 additions & 0 deletions qml/content/CameraRenderer.qml
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ Item {
property alias backgroundFilter: backgroundFilter
property bool backgroundFilterEnabled: false
property url backgroundImage: ""
property var libcamera

onCameraNameChanged:
{
Expand Down Expand Up @@ -54,6 +55,7 @@ Item {
anchors.fill: parent

cameraName: renderer.cameraName
libcamera: renderer.libcamera

onImageCaptured: function(image) {
whiteOverlay.state = "released"
Expand Down
33 changes: 21 additions & 12 deletions qml/content/CameraSource.qml
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ Item
property alias output: output
property string cameraName: ""
property bool readyForCapture: ((cameraSession.imageCapture.readyForCapture) || (cameraSource.state === "GPhotoCamera") || (cameraSource.state === "Libcamera"))
property var libcamera

signal imageCaptured(var image)
signal errorOccurred(var errorString)
Expand All @@ -37,12 +38,14 @@ Item
return
}
}
var libcameras = libcamera.availableCameras()
for (var j = 0; j < libcameras.length; j++) {
if (libcameras[j] === cameraName) {
cameraSource.state = "Libcamera"
console.log("CameraSource using Libcamera camera device: " + cameraName)
return
if (cameraSource.libcamera) {
var libcameras = cameraSource.libcamera.availableCameras()
for (var j = 0; j < libcameras.length; j++) {
if (libcameras[j] === cameraName) {
cameraSource.state = "Libcamera"
console.log("CameraSource using Libcamera camera device: " + cameraName)
return
}
}
}

Expand All @@ -62,7 +65,9 @@ Item
}
else if(state === "Libcamera")
{
libcamera.startCamera(cameraName)
if (cameraSource.libcamera) {
cameraSource.libcamera.startCamera(cameraName)
}
}
else
{
Expand All @@ -82,7 +87,9 @@ Item
}
else if(state === "Libcamera")
{
libcamera.stopCamera()
if (cameraSource.libcamera) {
cameraSource.libcamera.stopCamera()
}
}
else
{
Expand All @@ -100,7 +107,9 @@ Item
else if(state === "Libcamera")
{
console.log("Libcamera capture")
libcamera.captureImage()
if (cameraSource.libcamera) {
cameraSource.libcamera.captureImage()
}
}
else if(state === "GPhotoCamera")
{
Expand All @@ -118,7 +127,7 @@ Item
}

Connections {
target: libcamera
target: cameraSource.libcamera
function onErrorOccurred(errorString) {
if(state === "Libcamera")
{
Expand All @@ -129,7 +138,7 @@ Item

Connections
{
target: libcamera
target: cameraSource.libcamera
function onImageCaptured(image) {
cameraSource.imageCaptured(image)
}
Expand Down Expand Up @@ -262,7 +271,7 @@ Item
name: "Libcamera"
PropertyChanges {
target: cameraSession
videoFrameInput: libcamera
videoFrameInput: cameraSource.libcamera
}
},
State {
Expand Down