-
Notifications
You must be signed in to change notification settings - Fork 1
/
PiholestatsSettings.qml
207 lines (192 loc) · 4.41 KB
/
PiholestatsSettings.qml
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
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
import QtQuick 2.1
import qb.components 1.0
import BasicUIControls 1.0
Screen {
id: root
screenTitle: qsTr("Pi-Hole Instellingen")
screenTitleIconUrl: "qrc:/tsc/pihole_logo_40x40.png"
property bool messageShown : false
// Save button
onShown: {
addCustomTopRightButton("Opslaan");
showAppIconToggle.isSwitchedOn = app.showAppIcon;
ipadresLabel.inputText = app.ipadres;
poortnummerLabel.inputText = app.poortnummer;
refreshrateLabel.inputText = app.refreshrate;
authtokenLabel.inputText = app.authtoken;
messageShown = false;
}
onCustomButtonClicked: {
app.saveSettings();
app.firstTimeShown = true;
app.piholeDataRead = false;
app.readPiHolePHPData();
hide();
}
// Save IP Address
function saveIpadres(text) {
if (text) {
ipadresLabel.inputText = text;
app.ipadres = text;
}
}
// Save Port Number
function savePoortnummer(text) {
if (text) {
poortnummerLabel.inputText = text;
app.poortnummer = text;
}
}
// Save Refresh rate
function saveRefreshRate(text) {
if (text) {
refreshrateLabel.inputText = text;
app.refreshrate = text;
}
}
// Save Authentication token
function saveAuthToken(text) {
if (text) {
authtokenLabel.inputText = text;
app.authtoken = text;
}
}
// systray icon toggle
Text {
id: systrayText
anchors {
left: parent.left
leftMargin: isNxt ? 62 : 50
top: parent.top
topMargin: isNxt ? 19 : 15
}
font {
pixelSize: isNxt ? 25 : 20
family: qfont.bold.name
}
wrapMode: Text.WordWrap
text: "Pi-Hole icoon zichtbaar in systray?"
}
OnOffToggle {
id: showAppIconToggle
height: 36
anchors {
right: parent.right
rightMargin: isNxt ? 125 : 100
top: systrayText.top
}
leftIsSwitchedOn: false
onSelectedChangedByUser: {
app.showAppIcon = isSwitchedOn
}
}
// IP address
EditTextLabel4421 {
id: ipadresLabel
height: editipAdresButton.height
width: isNxt ? 800 : 600
leftText: qsTr("IP-adres Pi-Hole")
leftTextAvailableWidth: isNxt ? 600 : 480
anchors {
left:parent.left
leftMargin: isNxt ? 62 : 50
top: systrayText.bottom
topMargin: isNxt ? 25 : 20
}
}
IconButton {
id: editipAdresButton
width: isNxt ? 50 : 40
anchors {
left:ipadresLabel.right
leftMargin: isNxt ? 12 : 10
top: ipadresLabel.top
}
iconSource: "qrc:/tsc/edit.png"
onClicked: {
qkeyboard.open("Voer hier het ip-adres van Pi-Hole in", ipadresLabel.inputText, saveIpadres)
}
}
// Port number
EditTextLabel4421 {
id: poortnummerLabel
height: editportNumberButton.height
width: isNxt ? 800 : 600
leftTextAvailableWidth: isNxt ? 600 : 480
leftText: qsTr("Port (standaard is 80)")
anchors {
left:parent.left
leftMargin: isNxt ? 62 : 50
top: ipadresLabel.bottom
topMargin: isNxt ? 25 : 20
}
}
IconButton {
id: editportNumberButton
width: isNxt ? 50 : 40
anchors {
left:poortnummerLabel.right
leftMargin: isNxt ? 12 : 10
top: poortnummerLabel.top
}
iconSource: "qrc:/tsc/edit.png"
onClicked: {
qkeyboard.open("Voer hier de poort in", poortnummerLabel.inputText, savePoortnummer);
}
}
// refresh rate
EditTextLabel4421 {
id: refreshrateLabel
height: editRefreshRateButton.height
width: isNxt ? 800 : 600
leftTextAvailableWidth: isNxt ? 600 : 480
leftText: qsTr("Vernieuwen elke x seconden (standaard is 60)")
anchors {
left:parent.left
leftMargin: isNxt ? 62 : 50
top: poortnummerLabel.bottom
topMargin: isNxt ? 25 : 20
}
}
IconButton {
id: editRefreshRateButton
width: isNxt ? 50 : 40
anchors {
left:refreshrateLabel.right
leftMargin: isNxt ? 12 : 10
top: refreshrateLabel.top
}
iconSource: "qrc:/tsc/edit.png"
onClicked: {
qkeyboard.open("Voer hier de refresh rate in", refreshrateLabel.inputText, saveRefreshRate);
}
}
// authentication token
EditTextLabel4421 {
id: authtokenLabel
height: editAuthTokenButton.height
width: isNxt ? 800 : 600
leftTextAvailableWidth: isNxt ? 600 : 480
leftText: qsTr("Authenticatie token")
anchors {
left:parent.left
leftMargin: isNxt ? 62 : 50
top: refreshrateLabel.bottom
topMargin: isNxt ? 25 : 20
}
}
IconButton {
id: editAuthTokenButton
width: isNxt ? 50 : 40
anchors {
left:authtokenLabel.right
leftMargin: isNxt ? 12 : 10
top: authtokenLabel.top
}
iconSource: "qrc:/tsc/edit.png"
onClicked: {
qkeyboard.open("Voer hier de authentication token in", authtokenLabel.inputText, saveAuthToken);
}
}
// end
}