Warning, /utilities/skanpage/src/qml/DeviceSelection.qml is written in an unsupported language. File is not indexed.
0001 /**
0002 * SPDX-FileCopyrightText: 2020 by Alexander Stippich <a.stippich@gmx.net>
0003 *
0004 * SPDX-License-Identifier: GPL-2.0-only OR GPL-3.0-only OR LicenseRef-KDE-Accepted-GPL
0005 */
0006
0007 import QtQuick 2.7
0008 import QtQuick.Controls 2.14
0009 import QtQuick.Layouts 1.1
0010
0011 import org.kde.kirigami 2.12 as Kirigami
0012 import org.kde.skanpage 1.0
0013
0014 ColumnLayout {
0015
0016 Item {
0017 Layout.fillWidth: true
0018 Layout.fillHeight: true
0019 }
0020
0021 RowLayout {
0022 Layout.fillWidth: true
0023
0024 Item {
0025 Layout.fillWidth: true
0026 }
0027
0028 ScrollView {
0029 Layout.fillHeight: true
0030 Layout.maximumHeight: deviceList.contentHeight
0031
0032 ListView {
0033 id: deviceList
0034
0035 anchors.fill: parent
0036 contentWidth: contentItem.childrenRect.width + 2 * Kirigami.Units.smallSpacing
0037 contentHeight: contentItem.childrenRect.height + 2 * Kirigami.Units.smallSpacing
0038
0039 model: skanpage.devicesModel
0040
0041 visible: skanpage.devicesModel.rowCount !== 0
0042
0043 spacing: Kirigami.Units.smallSpacing
0044
0045 ButtonGroup {
0046 id: radioGroup
0047 }
0048
0049 delegate: RadioButton {
0050 id: selectButton
0051
0052 checked: index === 0
0053 ButtonGroup.group: radioGroup
0054 text: i18nc("Device vendor with device model, followed by the device name identifier", "%1 %2\n(%3)", vendor, model, name)
0055
0056 onClicked: {
0057 selectButton.checked = true
0058 skanpage.devicesModel.selectDevice(index)
0059 }
0060 }
0061 }
0062 }
0063
0064 Kirigami.PlaceholderMessage {
0065 visible: skanpage.devicesModel.rowCount === 0
0066 Layout.fillWidth: true
0067
0068 icon.name: "error"
0069 text: xi18nc("@info", "No devices found.")
0070 }
0071
0072 Item {
0073 Layout.fillWidth: true
0074 }
0075 }
0076
0077 Row {
0078 Layout.alignment: Qt.AlignHCenter
0079
0080 Button {
0081 id: selectDeviceButton
0082
0083 visible: skanpage.devicesModel.rowCount !== 0
0084
0085 icon.name: "select"
0086 text: i18n("Open selected device")
0087
0088 onClicked: skanpage.openDevice(skanpage.devicesModel.getSelectedDeviceName())
0089 }
0090
0091 Button {
0092 id: reloadDevicesListButton
0093
0094 icon.name: "view-refresh"
0095 text: i18n("Reload devices list")
0096
0097 onClicked: skanpage.reloadDevicesList()
0098 }
0099 }
0100
0101 Item {
0102 Layout.fillWidth: true
0103 Layout.fillHeight: true
0104 }
0105 }