Debian Codegraph @

qml/generic/USBConnect.qml

raw
1 import QtQuick 2.2
2 import QtQuick.Controls 1.1
3 import QtQuick.Layouts 1.1
4
5 Item {
6 id:main
7 visible: titleRow.currentIndex > 2 && (i.device === null || i.loginBlock || i.wrongPass || !i.completed)
8 anchors.fill: parent
9
10 ColumnLayout {
11 id: develText
12 anchors.centerIn: parent
13 height: parent.height / 2
14 Label {
15 Layout.alignment: Qt.AlignTop | Qt.AlignHCenter
16 text: qsTr("These tools require a USB connection") + translator.lang
17 }
18 RowLayout {
19 Layout.alignment: Qt.AlignHCenter
20 ColumnLayout {
21 Label {
22 text: qsTr("Password:") + translator.lang
23 }
24 Label {
25 id: subtextValue
26 visible: i.wrongPass
27 text: qsTr("Incorrect") + translator.lang
28 color: "red"
29 }
30 }
31 TextField {
32 id: passText
33 property bool showing: false
34 property string pass_init: i.password
35 text: pass_init;
36 Timer { id: try_again; interval: 100; onTriggered: i.wrongPass = false }
37 onTextChanged: {
38 if (i.password !== text) {
39 i.password = text
40 if (i.wrongPass)
41 try_again.restart()
42 }
43 }
44 echoMode: showing ? TextInput.Normal : TextInput.Password
45 }
46 Button {
47 tooltip: passText.showing ? qsTr("Hide Password") : qsTr("Show Password") + translator.lang
48 anchors { left: passText.right; leftMargin: 10; verticalCenter: passText.verticalCenter }
49 iconSource: "showpass.png"
50 onClicked: passText.showing = !passText.showing
51 }
52 }
53 ColumnLayout {
54 visible: i.loginBlock
55 Label {
56 text: qsTr("There was an issue connecting.") + translator.lang
57 }
58 Button {
59 text: qsTr("Try Again") + translator.lang
60 onClicked: i.loginBlock = false
61 }
62 }
63 RowLayout {
64 Layout.alignment: Qt.AlignBottom | Qt.AlignHCenter
65 ColumnLayout {
66 Label {
67 visible: !i.loginBlock && !detected.visible
68 text: qsTr("Searching for USB device") + translator.lang
69 }
70 Label {
71 id: detected
72 property int numDevices: typeof b != 'undefined' ? b.devices.length : 0
73 property int deviceType: numDevices ? b.devices[0] : 0
74 property string deviceName: switch(deviceType) {
75 case 1: return "Bootloader"
76 case 8012: return "Windows"
77 case 8013: return "Unix"
78 case 8017: return "Autodetect"
79 default: return ""
80 }
81
82 visible: numDevices
83 text: qsTr("Detected %1 Blackberry USB device(s) in %2 mode.").arg(numDevices).arg(deviceName) + translator.lang
84 }
85 Label {
86 visible: i.possibleDevices
87 Layout.alignment: Qt.AlignHCenter
88 text: qsTr("Talking to %1 possible device(s).").arg(i.possibleDevices) + translator.lang
89 }
90 Button {
91 visible: i.hasLog
92 Layout.alignment: Qt.AlignHCenter
93 text: qsTr("Connection Log")+ translator.lang
94 onClicked: i.openLog();
95 }
96 }
97 BusyIndicator {
98 visible: !i.loginBlock
99 height: parent.implicitHeight + 7
100 width: height
101 }
102 }
103 }
104 }