Debian Codegraph @

resources/qml/device-verification/DeviceVerification.qml

raw
1 // SPDX-FileCopyrightText: Nheko Contributors
2 //
3 // SPDX-License-Identifier: GPL-3.0-or-later
4
5 import QtQuick 2.10
6 import QtQuick.Controls 2.3
7 import QtQuick.Window 2.13
8 import im.nheko 1.0
9
10 ApplicationWindow {
11 id: dialog
12
13 property var flow
14
15 onClosing: VerificationManager.removeVerificationFlow(flow)
16 title: stack.currentItem ? (stack.currentItem.title_ || "") : ""
17 modality: Qt.NonModal
18 color: palette.window
19 //height: stack.currentItem.implicitHeight
20 minimumHeight: stack.currentItem.implicitHeight + 2 * Nheko.paddingLarge
21 height: stack.currentItem.implicitHeight + 2 * Nheko.paddingMedium
22 minimumWidth: 400
23 width: 400
24 flags: Qt.Dialog | Qt.WindowCloseButtonHint | Qt.WindowTitleHint
25
26 background: Rectangle {
27 color: palette.window
28 }
29
30
31 StackView {
32 id: stack
33
34 anchors.centerIn: parent
35
36 initialItem: newVerificationRequest
37 implicitWidth: dialog.width - 2* Nheko.paddingMedium
38 implicitHeight: dialog.height - 2* Nheko.paddingMedium
39 }
40
41 Component {
42 id: newVerificationRequest
43
44 NewVerificationRequest {
45 }
46
47 }
48
49 Component {
50 id: waiting
51
52 Waiting {
53 }
54
55 }
56
57 Component {
58 id: success
59
60 Success {
61 }
62
63 }
64
65 Component {
66 id: failed
67
68 Failed {
69 }
70
71 }
72
73 Component {
74 id: digitVerification
75
76 DigitVerification {
77 }
78
79 }
80
81 Component {
82 id: emojiVerification
83
84 EmojiVerification {
85 }
86
87 }
88
89 Item {
90 state: flow.state
91 states: [
92 State {
93 name: "PromptStartVerification"
94
95 StateChangeScript {
96 script: stack.replace(null, newVerificationRequest)
97 }
98
99 },
100 State {
101 name: "CompareEmoji"
102
103 StateChangeScript {
104 script: stack.replace(null, emojiVerification)
105 }
106
107 },
108 State {
109 name: "CompareNumber"
110
111 StateChangeScript {
112 script: stack.replace(null, digitVerification)
113 }
114
115 },
116 State {
117 name: "WaitingForKeys"
118
119 StateChangeScript {
120 script: stack.replace(null, waiting)
121 }
122
123 },
124 State {
125 name: "WaitingForOtherToAccept"
126
127 StateChangeScript {
128 script: stack.replace(null, waiting)
129 }
130
131 },
132 State {
133 name: "WaitingForMac"
134
135 StateChangeScript {
136 script: stack.replace(null, waiting)
137 }
138
139 },
140 State {
141 name: "Success"
142
143 StateChangeScript {
144 script: stack.replace(null, success)
145 }
146
147 },
148 State {
149 name: "Failed"
150
151 StateChangeScript {
152 script: stack.replace(null, failed)
153 }
154
155 }
156 ]
157 }
158
159 }