Kstars

MotionControl.qml
1// SPDX-FileCopyrightText: 2016 Artem Fedoskin <afedoskin3@gmail.com>
2// SPDX-License-Identifier: GPL-2.0-or-later
3
4import QtQuick 2.6
5import QtQuick.Window 2.2
6import QtQuick.Layouts 1.2
7import QtQuick.Controls 2.0
8import TelescopeLiteEnums 1.0
9import "../../constants" 1.0
10import "../../modules"
11
12ColumnLayout {
14 anchors {
15 fill: parent
16 margins: Num.marginsKStab
17 }
18 spacing: 5 * Num.dp
19
20 enabled: buttonsEnabled
21
22 property string deviceName
23 property var telescope: ClientManagerLite.getTelescope()
24 property bool buttonsEnabled: ClientManagerLite.getTelescope().isConnected()
25
27 target: ClientManagerLite
29 buttonsEnabled = ClientManagerLite.getTelescope().isConnected()
30 }
32 telescope = newTelescope
33 }
34 }
35
36 //Row 1
37 RowLayout {
38 Layout.fillHeight: true
39 anchors {
40 left: parent.left
41 right: parent.right
42 }
43
44 Button {
45 Layout.fillHeight: true
46 Layout.fillWidth: true
47 activeFocusOnTab: false
48
49
50 onPressedChanged: {
51 if(telescope) {
52 if(pressed) {
53 telescope.moveNS(TelescopeNS.MOTION_NORTH, TelescopeCommand.MOTION_START)
54 telescope.moveWE(TelescopeNS.MOTION_WEST, TelescopeCommand.MOTION_START)
55 } else {
56 telescope.moveNS(TelescopeNS.MOTION_NORTH, TelescopeCommand.MOTION_STOP)
57 telescope.moveWE(TelescopeNS.MOTION_WEST, TelescopeCommand.MOTION_STOP)
58 }
59 }
60 }
61
62 text: xi18n("NW")
63 }
64
65 Button {
66 Layout.fillHeight: true
67 Layout.fillWidth: true
68 activeFocusOnTab: false
69
70
71 onPressedChanged: {
72
73 if(telescope) {
74 if(pressed) {
75 telescope.moveNS(TelescopeNS.MOTION_NORTH, TelescopeCommand.MOTION_START)
76 } else {
77 telescope.moveNS(TelescopeNS.MOTION_NORTH, TelescopeCommand.MOTION_STOP)
78 }
79 }
80 }
81
82 text: xi18n("N")
83 }
84
85 Button {
86 Layout.fillHeight: true
87 Layout.fillWidth: true
88 activeFocusOnTab: false
89
90
91 onPressedChanged: {
92
93 if(telescope) {
94 if(pressed) {
95 telescope.moveNS(TelescopeNS.MOTION_NORTH, TelescopeCommand.MOTION_START)
96 telescope.moveWE(TelescopeNS.MOTION_EAST, TelescopeCommand.MOTION_START)
97 } else {
98 telescope.moveNS(TelescopeNS.MOTION_NORTH, TelescopeCommand.MOTION_STOP)
99 telescope.moveWE(TelescopeNS.MOTION_EAST, TelescopeCommand.MOTION_STOP)
100 }
101 }
102 }
103
104 text: xi18n("NE")
105 }
106 }
107
108 //Row 2
109 RowLayout {
110 Layout.fillHeight: true
111 Layout.fillWidth: true
112
113 Button {
114 Layout.fillHeight: true
115 Layout.fillWidth: true
116 activeFocusOnTab: false
117
118
119 onPressedChanged: {
120
121 if(telescope) {
122 if(pressed) {
123 telescope.moveWE(TelescopeNS.MOTION_WEST, TelescopeCommand.MOTION_START)
124 } else {
125 telescope.moveWE(TelescopeNS.MOTION_WEST, TelescopeCommand.MOTION_STOP)
126 }
127 }
128 }
129
130 text: xi18n("W")
131 }
132
133 Button {
134 Layout.fillHeight: true
135 Layout.fillWidth: true
136 activeFocusOnTab: false
137
138
139 onPressedChanged: {
140
141 if(telescope) {
142 telescope.abort();
143 }
144 }
145
146 text: xi18n("Stop")
147 }
148
149 Button {
150 Layout.fillHeight: true
151 Layout.fillWidth: true
152 activeFocusOnTab: false
153
154
155 onPressedChanged: {
156
157 if(telescope) {
158 if(pressed) {
159 telescope.moveWE(TelescopeNS.MOTION_EAST, TelescopeCommand.MOTION_START)
160 } else {
161 telescope.moveWE(TelescopeNS.MOTION_EAST, TelescopeCommand.MOTION_STOP)
162 }
163 }
164 }
165
166 text: xi18n("E")
167 }
168 }
169
170 //Row 3
171 RowLayout {
172 Layout.fillHeight: true
173 Layout.fillWidth: true
174
175 Button {
176 Layout.fillHeight: true
177 Layout.fillWidth: true
178 activeFocusOnTab: false
179 onPressedChanged: {
180
181 if(telescope) {
182 if(pressed) {
183 telescope.moveNS(TelescopeNS.MOTION_SOUTH, TelescopeCommand.MOTION_START)
184 telescope.moveWE(TelescopeNS.MOTION_WEST, TelescopeCommand.MOTION_START)
185 } else {
186 telescope.moveNS(TelescopeNS.MOTION_SOUTH, TelescopeCommand.MOTION_STOP)
187 telescope.moveWE(TelescopeNS.MOTION_WEST, TelescopeCommand.MOTION_STOP)
188 }
189 }
190 }
191
192 text: xi18n("SW")
193 }
194
195 Button {
196 Layout.fillHeight: true
197 Layout.fillWidth: true
198 activeFocusOnTab: false
199
200
201 text: xi18n("S")
202
203 onPressedChanged: {
204
205 if(telescope) {
206 if(pressed) {
207 telescope.moveNS(TelescopeNS.MOTION_SOUTH, TelescopeCommand.MOTION_START)
208 } else {
209 telescope.moveNS(TelescopeNS.MOTION_SOUTH, TelescopeCommand.MOTION_STOP)
210 }
211 }
212 }
213 }
214
215 Button {
216 Layout.fillHeight: true
217 Layout.fillWidth: true
218 activeFocusOnTab: false
219
220
221 onPressedChanged: {
222
223 if(telescope) {
224 if(pressed) {
225 telescope.moveNS(TelescopeNS.MOTION_SOUTH, TelescopeCommand.MOTION_START)
226 telescope.moveWE(TelescopeNS.MOTION_EAST, TelescopeCommand.MOTION_START)
227 } else {
228 telescope.moveNS(TelescopeNS.MOTION_SOUTH, TelescopeCommand.MOTION_STOP)
229 telescope.moveWE(TelescopeNS.MOTION_EAST, TelescopeCommand.MOTION_STOP)
230 }
231 }
232 }
233
234 text: xi18n("SE")
235 }
236 }
237
238 //Slewing
239 RowLayout {
240 id: slewingRateRow
241 Layout.fillHeight: true
242 Layout.fillWidth: true
243
244 Button {
245 id: decreaseSlew
246 height: motionCColumn.height * 0.15
247 Layout.fillWidth: true
248 activeFocusOnTab: false
249 enabled: telescope.slewDecreasable
250
252 target: telescope
254 decreaseSlew.enabled = telescope.slewDecreasable
255 }
256 }
257
258 onClicked: {
259 if(telescope) {
260 telescope.decreaseSlewRate()
261 }
262 }
263
264 text: xi18n("-")
265 }
266 KSText {
267 height: parent.height * 0.15
268 Layout.fillWidth: true
269 horizontalAlignment: Text.AlignHCenter
270
271 text: xi18n("Slew rate: " + telescope.slewRateLabel)
272 }
273
274 Button {
275 id: increaseSlew
276 height: motionCColumn.height * 0.15
277 Layout.fillWidth: true
278 activeFocusOnTab: false
279 enabled: telescope.slewIncreasable
280
282 target: telescope
284 increaseSlew.enabled = telescope.slewIncreasable
285 }
286 }
287
288 onClicked: {
289 if(telescope) {
290 telescope.increaseSlewRate()
291 }
292 }
293
294 text: xi18n("+")
295 }
296 }
297}
QString xi18n(const char *text, const TYPE &arg...)
QTextStream & left(QTextStream &stream)
QTextStream & right(QTextStream &stream)
This file is part of the KDE documentation.
Documentation copyright © 1996-2024 The KDE developers.
Generated on Fri May 17 2024 11:48:26 by doxygen 1.10.0 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.