Debian Codegraph @

qml/generic/VersionLookup.qml

raw
1 import QtQuick 2.2
2 import QtQuick.Controls 1.1
3 import QtQuick.Layouts 1.1
4 import QtQuick.Window 2.1
5
6 Window {
7 title: "Sachesi " + version + " – " + qsTr("Version Lookup") + translator.lang
8 visible: false
9 onVisibleChanged: if (visible) {
10 x = window.x + (window.width - width) / 2
11 y = window.y + (window.height - height) / 2
12 }
13 height: 290
14 width: 490
15 ColumnLayout {
16 height: parent.height
17 width: parent.width
18 anchors { left: parent.left; leftMargin: 10 }
19 RowLayout {
20 GroupBox {
21 title: qsTr("Stop on:") + translator.lang
22 Column {
23 ExclusiveGroup {
24 id: group
25 onCurrentChanged: scanner.findExisting = current.item
26 }
27 RadioButton {
28 property int item: 0
29 text: qsTr("Next Found") + translator.lang
30 exclusiveGroup: group
31 checked: true
32 }
33 RadioButton {
34 property int item: 1
35 text: qsTr("Next Available Links") + translator.lang
36 exclusiveGroup: group
37 }
38 RadioButton {
39 property int item: 2
40 text: qsTr("Never") + translator.lang
41 exclusiveGroup: group
42 }
43 Button {
44 text: scanner.isAuto ? qsTr("Stop Scan") : qsTr("Autoscan") + translator.lang
45 onClicked: {
46 scanner.isAuto = !scanner.isAuto;
47 if (scanner.isAuto) { build.value += 3; relookup.clicked(); }
48 }
49 property bool finished: scanner.finishedScan
50 onFinishedChanged: {
51 if (finished && !scanner.isActive && scanner.isAuto) {
52 if (build.value >= 9998) {
53 minor.value++;
54 build.value = (build.value+3) % 10000;
55 } else
56 build.value += 3;
57 relookup.clicked();
58 }
59 }
60 }
61 }
62 }
63 ColumnLayout {
64 Layout.alignment: Qt.AlignVCenter
65 visible: scanner.curRelease !== null && scanner.curRelease.srVersion !== ""
66 Text {
67 Layout.alignment: Qt.AlignHCenter
68 text: qsTr("SR: %1").arg(scanner.curRelease !== null ? scanner.curRelease.srVersion : "") + " | " + qsTr("OS: %1").arg(scanner.curRelease !== null ? scanner.curRelease.osVersion : "") + translator.lang
69 font.pointSize: 12
70 }
71 Label {
72 Layout.alignment: Qt.AlignHCenter
73 text: {
74 var ret = ""
75 if (scanner.curRelease !== null) {
76 if (scanner.curRelease.activeServers & 1)
77 ret += qsTr("Production") + " "
78 if (scanner.curRelease.activeServers & 2)
79 ret += qsTr("Beta") + " "
80 if (scanner.curRelease.activeServers & 4)
81 ret += qsTr("Alpha") + " "
82 if (ret.length > 0)
83 ret = qsTr("Servers:") + " " + ret
84 }
85 return ret + translator.lang;
86 }
87 }
88 RowLayout {
89 Layout.alignment: Qt.AlignHCenter
90 property string osVersion: ""
91 visible: scanner.curRelease !== null && scanner.curRelease.srVersion != ""
92 Button {
93 id: grabPotential
94 enabled: scanner.curRelease !== null && scanner.curRelease.baseUrl !== ""
95 text: enabled ? qsTr("Grab Public Links") : qsTr("No Links Available") + translator.lang
96 onClicked: scanner.generatePotentialLinks()
97 }
98 }
99 }
100 }
101 RowLayout {
102 Layout.alignment: Qt.AlignTop | Qt.AlignHCenter
103 Row {
104 spacing: 1
105 property string latestOS: whitelistSettings.latestOS
106 onLatestOSChanged: {
107 var array = latestOS.split('.')
108 if (array.length > 3) {
109 major.prefix = array[0] + "."
110 major.value = parseInt(array[1])
111 minor.value = parseInt(array[2])
112 build.value = parseInt(array[3])
113 }
114 }
115
116 SpinBox {
117 id: major
118 width: qt_new ? implicitWidth : implicitWidth + 25
119 maximumValue: 255
120 }
121 SpinBox {
122 id: minor
123 width: qt_new ? implicitWidth : implicitWidth + 25
124 maximumValue: 255
125 }
126 SpinBox {
127 id: build
128 width: qt_new ? implicitWidth : implicitWidth + 25
129 maximumValue: 9999
130 stepSize: 3
131 }
132 }
133 Button {
134 id: relookup
135 text: qsTr("Lookup") + translator.lang
136 enabled: !scanner.isActive && !scanner.isAuto
137 onClicked: scanner.reverseLookup("10." + major.value + "." + minor.value + "." + build.value);
138 }
139 }
140 RowLayout {
141 Layout.alignment: Qt.AlignBottom | Qt.AlignHCenter
142 Button {
143 visible: scanner.history.length > 0
144 text: qsTr("History") + translator.lang
145 onClicked: scanner.exportHistory()
146 }
147
148 Button {
149 text: qsTr("Hide") + translator.lang
150 onClicked: close();
151 }
152 }
153 }
154 }