blob: 6036264994742fc7b68a024f7e4091101abd6ae4 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
|
import QtQuick 2.15
import QtQuick.Controls 2.12
import QtGraphicalEffects 1.14
import QtQuick.Layouts 1.14
import QtQuick.Templates 2.12 as T
import QtQuick.Controls.impl 2.12
import QtQuick.Controls.Material 2.12
import QtQuick.Controls.Material.impl 2.12
import "../themes/themes.js" as Theme
Item {
id: statusbox
anchors.fill: parent
VPNState {
id: vpn
}
Rectangle {
color: Theme.bgColor
anchors.fill: parent
}
Rectangle {
id: statusBoxBackground
color: Theme.fgColor
height: 300
radius: 10
antialiasing: true
anchors {
fill: parent
margins: 20
bottomMargin: 30
}
border {
color: Theme.accentOff
width: 2
}
}
ToolButton {
id: settingsButton
objectName: "settingsButton"
font.pixelSize: Qt.application.font.pixelSize * 1.6
opacity: 1
anchors {
top: parent.top
left: parent.left
topMargin: Theme.windowMargin + 5
leftMargin: Theme.windowMargin + 5
}
HoverHandler {
cursorShape: Qt.PointingHandCursor
}
onClicked: {
if (stackView.depth > 1) {
stackView.pop()
} else {
settingsDrawer.open()
}
}
Icon {
id: settingsImage
width: 16
height: 16
anchors.centerIn: settingsButton
source: stackView.depth
> 1 ? "../resources/arrow-left.svg" : "../resources/gear-fill.svg"
}
}
Rectangle {
id: statusLabelWrapper
height: 45
anchors {
top: statusBoxBackground.top
topMargin: 25
horizontalCenter: parent.horizontalCenter
}
BoldLabel {
id: connectionState
anchors.top: parent.top
anchors.horizontalCenter: parent.horizontalCenter
horizontalAlignment: Text.AlignHCenter
text: ""
FadeBehavior on text { }
}
}
Column {
id: col
width: parent.width * 0.8
anchors.horizontalCenter: parent.horizontalCenter
VerticalSpacer {
id: spacerPreImg
visible: true
height: 120
}
// TODO this can be synced with opacity serial animation, see
// https://doc.qt.io/qt-5/qml-qtquick-animatedimage.html#example-usage
// If you want to customize your asset, here's how:
// convert -delay 50 -loop 0 ravens2_*.png ravens.gif
AnimatedImage {
id: connectionImage
height: 160
speed: 0.8
source: "../resources/icon-noshield.svg"
anchors.horizontalCenter: parent.horizontalCenter
fillMode: Image.PreserveAspectFit
OpacityAnimator on opacity{
id: fadeIn
from: 0.5;
to: 1;
duration: 1000
}
onStatusChanged: {
playing = (status == AnimatedImage.Ready)
fadeIn.start()
}
}
VerticalSpacer {
id: spacerPostImg
visible: true
height: 20
Layout.alignment: Qt.AlignBottom
}
MaterialButton {
id: toggleVPN
// FIXME - this is a workaround. It will BREAK with i18n
width: 100
spacing: 8
anchors.horizontalCenter: parent.horizontalCenter
Layout.alignment: Qt.AlignBottom
font {
pixelSize: Theme.buttonFontSize
capitalization: Font.Capitalize
family: lightFont.name
bold: false
}
HoverHandler {
cursorShape: Qt.PointingHandCursor
}
onClicked: {
if (vpn.state === "on" | vpn.state === "starting") {
backend.switchOff()
} else if (vpn.state === "off") {
vpn.startingUI = true
backend.switchOn()
} else {
console.debug("unknown state")
}
}
}
}
}
|