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 {
|
||||
id: viewFinder
|
||||
anchors.centerIn: parent
|
||||
visible: devices.videoInputs.length > 0
|
||||
}
|
||||
|
||||
Prison.VideoScanner {
|
||||
@@ -47,6 +64,8 @@ Kirigami.Page {
|
||||
}
|
||||
|
||||
CaptureSession {
|
||||
id: session
|
||||
|
||||
camera: Camera {
|
||||
id: camera
|
||||
}
|
||||
|
||||
@@ -6,6 +6,7 @@ pragma ComponentBehavior: Bound
|
||||
import QtQuick
|
||||
import QtQuick.Controls as QQC2
|
||||
import QtQuick.Layouts
|
||||
import QtMultimedia
|
||||
|
||||
import org.kde.kirigami as Kirigami
|
||||
|
||||
@@ -25,6 +26,10 @@ RowLayout {
|
||||
*/
|
||||
signal textChanged(string newText)
|
||||
|
||||
MediaDevices {
|
||||
id: devices
|
||||
}
|
||||
|
||||
Kirigami.Heading {
|
||||
Layout.fillWidth: true
|
||||
visible: !root.collapsed
|
||||
@@ -101,6 +106,7 @@ RowLayout {
|
||||
QQC2.MenuItem {
|
||||
text: i18n("Scan a QR Code")
|
||||
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"), {
|
||||
connection: root.connection
|
||||
}, {
|
||||
|
||||
Reference in New Issue
Block a user