Hide "Scan a QR Code" with no camera connected
Also when you disconnect/turn off the camera while the QR scanner is open, show a better error message instead of freezing the last frame.
This commit is contained in:
@@ -27,9 +27,26 @@ Kirigami.Page {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
MediaDevices {
|
||||||
|
id: devices
|
||||||
|
}
|
||||||
|
|
||||||
|
Rectangle {
|
||||||
|
anchors.fill: parent
|
||||||
|
|
||||||
|
color: Kirigami.Theme.backgroundColor
|
||||||
|
visible: devices.videoInputs.length === 0
|
||||||
|
|
||||||
|
Kirigami.PlaceholderMessage {
|
||||||
|
text: i18nc("@info", "No Camera Connected")
|
||||||
|
anchors.centerIn: parent
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
VideoOutput {
|
VideoOutput {
|
||||||
id: viewFinder
|
id: viewFinder
|
||||||
anchors.centerIn: parent
|
anchors.centerIn: parent
|
||||||
|
visible: devices.videoInputs.length > 0
|
||||||
}
|
}
|
||||||
|
|
||||||
Prison.VideoScanner {
|
Prison.VideoScanner {
|
||||||
@@ -47,6 +64,8 @@ Kirigami.Page {
|
|||||||
}
|
}
|
||||||
|
|
||||||
CaptureSession {
|
CaptureSession {
|
||||||
|
id: session
|
||||||
|
|
||||||
camera: Camera {
|
camera: Camera {
|
||||||
id: camera
|
id: camera
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -6,6 +6,7 @@ pragma ComponentBehavior: Bound
|
|||||||
import QtQuick
|
import QtQuick
|
||||||
import QtQuick.Controls as QQC2
|
import QtQuick.Controls as QQC2
|
||||||
import QtQuick.Layouts
|
import QtQuick.Layouts
|
||||||
|
import QtMultimedia
|
||||||
|
|
||||||
import org.kde.kirigami as Kirigami
|
import org.kde.kirigami as Kirigami
|
||||||
|
|
||||||
@@ -25,6 +26,10 @@ RowLayout {
|
|||||||
*/
|
*/
|
||||||
signal textChanged(string newText)
|
signal textChanged(string newText)
|
||||||
|
|
||||||
|
MediaDevices {
|
||||||
|
id: devices
|
||||||
|
}
|
||||||
|
|
||||||
Kirigami.Heading {
|
Kirigami.Heading {
|
||||||
Layout.fillWidth: true
|
Layout.fillWidth: true
|
||||||
visible: !root.collapsed
|
visible: !root.collapsed
|
||||||
@@ -101,6 +106,7 @@ RowLayout {
|
|||||||
QQC2.MenuItem {
|
QQC2.MenuItem {
|
||||||
text: i18n("Scan a QR Code")
|
text: i18n("Scan a QR Code")
|
||||||
icon.name: "view-barcode-qr"
|
icon.name: "view-barcode-qr"
|
||||||
|
visible: devices.videoInputs.length > 0
|
||||||
onTriggered: (root.Kirigami.PageStack.pageStack as Kirigami.PageRow).pushDialogLayer(Qt.createComponent("org.kde.neochat", "QrScannerPage"), {
|
onTriggered: (root.Kirigami.PageStack.pageStack as Kirigami.PageRow).pushDialogLayer(Qt.createComponent("org.kde.neochat", "QrScannerPage"), {
|
||||||
connection: root.connection
|
connection: root.connection
|
||||||
}, {
|
}, {
|
||||||
|
|||||||
Reference in New Issue
Block a user