2import QtQuick.Controls 2.15
3import QtQuick.Layouts 2.15
7 objectName: "mountControlObject"
11 property color buttonColor:
"silver"
12 property color coordsColor:
"gold"
23 width: (
Qt.platform.os ===
"osx") ? fontMetrics.height * 13.5 /.75 : fontMetrics.height * 13.5
24 height: (
Qt.platform.os ===
"osx") ? fontMetrics.height * 29.5 /.75 : fontMetrics.height * 29.5
28 onClicked: mountMotionLayout.focus = true
31 id: mainVerticalLayout
33 anchors.margins: fontMetrics.height * 0.25
37 rowSpacing: fontMetrics.height * 0.05
38 columnSpacing: fontMetrics.height * 0.05
39 Layout.minimumHeight: fontMetrics.height * 8
40 Layout.maximumHeight: fontMetrics.height * 8
41 Layout.minimumWidth: fontMetrics.height * 10
42 Layout.maximumWidth: fontMetrics.height * 10
48 event.accepted =
true;
49 if (!
event.isAutoRepeat)
50 onPressedChanged(event,
true);
54 event.accepted =
true;
55 if (!
event.isAutoRepeat)
56 onPressedChanged(event,
false);
59 function setTimeout(delay_ms, cb) {
60 var component =
Qt.createComponent(
"timer.qml");
61 var timer = component.createObject(rectangle, {x: 0, y: 0});
64 console.error(
"Error creating timer object");
67 timer.callback = function() {
71 timer.interval = delay_ms;
75 property var keyState: ({})
77 property var motionState: ({ns: -1, we: -1})
82 property var filteredKeyState: {0x13:
false, 0x15:
false, 0x12:
false, 0x14:
false}
83 function moveMount() {
84 var
up = filteredKeyState[
Qt.Key_Up];
85 var down = filteredKeyState[
Qt.Key_Down];
86 var
left = filteredKeyState[
Qt.Key_Left];
87 var
right = filteredKeyState[
Qt.Key_Right];
97 mount.motionCommand(0, ns, -1);
99 }
else if (motionState.ns !== -1) {
100 mount.motionCommand(1, motionState.ns, -1);
103 if (left !== right) {
109 mount.motionCommand(0, -1, we);
111 }
else if (motionState.we !== -1) {
112 mount.motionCommand(1, -1, motionState.we);
117 northRect.opacity = 1;
118 }
else if (ns === 1) {
119 southRect.opacity = 1;
121 northRect.opacity = 0;
122 southRect.opacity = 0;
125 westRect.opacity = 1;
126 }
else if (we === 1) {
127 eastRect.opacity = 1;
129 westRect.opacity = 0;
130 eastRect.opacity = 0;
134 function deflicker(key, pressed) {
135 keyState[key] = pressed;
136 setTimeout(5, function() {
137 if (pressed === keyState[key] && pressed !== filteredKeyState[key]) {
138 filteredKeyState[key] = pressed;
144 function onPressedChanged(event, pressed) {
145 deflicker(
event.key, pressed);
151 Layout.fillHeight:
true
152 Layout.fillWidth:
true
157 color: northWest.pressed ?
"red" : rectangle.buttonColor
162 northWest.pressed ?
mount.motionCommand(0, 0, 0) :
mount.motionCommand(1, 0, 0);
167 mountMotionLayout.focus =
true;
172 source:
"go-northwest.png"
178 Layout.fillHeight:
true
179 Layout.fillWidth:
true
184 color: north.pressed ?
"red" : rectangle.buttonColor
197 north.pressed ?
mount.motionCommand(0, 0, -1) :
mount.motionCommand(1, 0, -1);
202 mountMotionLayout.focus =
true;
207 source:
"go-north.png"
213 Layout.fillHeight:
true
214 Layout.fillWidth:
true
219 color: northEast.pressed ?
"red" : rectangle.buttonColor
224 northEast.pressed ?
mount.motionCommand(0, 0, 1) :
mount.motionCommand(1, 0, 1);
229 mountMotionLayout.focus =
true;
234 source:
"go-northeast.png"
240 Layout.fillHeight:
true
241 Layout.fillWidth:
true
246 color: west.pressed ?
"red" : rectangle.buttonColor
259 west.pressed ?
mount.motionCommand(0, -1, 0) :
mount.motionCommand(1, -1, 0);
264 mountMotionLayout.focus =
true;
269 source:
"go-west.png"
275 Layout.fillHeight:
true
276 Layout.fillWidth:
true
281 color:
stop.pressed ?
"red" : rectangle.buttonColor
292 mountMotionLayout.focus =
true;
300 Layout.fillHeight:
true
301 Layout.fillWidth:
true
306 color: east.pressed ?
"red" : rectangle.buttonColor
319 east.pressed ?
mount.motionCommand(0, -1, 1) :
mount.motionCommand(1, -1, 1);
324 mountMotionLayout.focus =
true;
329 source:
"go-east.png"
335 Layout.fillHeight:
true
336 Layout.fillWidth:
true
341 color: southWest.pressed ?
"red" : rectangle.buttonColor
346 southWest.pressed ?
mount.motionCommand(0, 1, 0) :
mount.motionCommand(1, 1, 0);
351 mountMotionLayout.focus =
true;
356 source:
"go-southwest.png"
362 Layout.fillHeight:
true
363 Layout.fillWidth:
true
368 color: south.pressed ?
"red" : rectangle.buttonColor
381 south.pressed ?
mount.motionCommand(0, 1, -1) :
mount.motionCommand(1, 1, -1);
382 mountMotionLayout.focus =
true;
387 source:
"go-south.png"
393 Layout.fillHeight:
true
394 Layout.fillWidth:
true
399 color: southEast.pressed ?
"red" : rectangle.buttonColor
404 southEast.pressed ?
mount.motionCommand(0, 1, 1) :
mount.motionCommand(1, 1, 1);
409 mountMotionLayout.focus =
true;
414 source:
"go-southeast.png"
421 id: mountReverseLayout
422 Layout.fillWidth:
true
423 Layout.alignment:
Qt.AlignHCenter
427 text:
xi18n(
"Reverse")
428 renderType: Text.QtRendering
444 objectName:
"upDownCheckObject"
445 onClicked:
mount.setUpDownReversed(checked)
460 objectName:
"leftRightCheckObject"
461 onClicked:
mount.setLeftRightReversed(checked)
468 anchors.horizontalCenter: parent.Center
469 Layout.alignment:
Qt.AlignHCenter |
Qt.AlignVCenter
470 Layout.fillHeight:
false
471 Layout.fillWidth:
true
475 x: fontMetrics.height * 0.1
477 width: fontMetrics.height * 1.5
478 objectName:
"speedSliderObject"
479 Layout.fillWidth:
true
480 Layout.maximumWidth: fontMetrics.height * 7.5
488 mount.setSlewRate(speedSlider.value)
494 width: fontMetrics.height * 3.75
495 objectName:
"speedLabelObject"
497 renderType: Text.QtRendering
498 horizontalAlignment: Text.AlignHCenter
499 Layout.alignment:
Qt.AlignHCenter |
Qt.AlignVCenter
500 Layout.maximumWidth: fontMetrics.height * 3.75
501 Layout.minimumWidth: fontMetrics.height * 3.75
502 font.weight: Font.Bold
505 font.family: "Verdana"
506 fontSizeMode: Text.Fit
507 verticalAlignment: Text.AlignVCenter
508 Layout.fillWidth: true
514 id: mountCoordsLayout
515 anchors.horizontalCenter: parent.Center
516 Layout.alignment:
Qt.AlignHCenter |
Qt.AlignVCenter
517 Layout.fillWidth:
true
521 Layout.alignment:
Qt.AlignHCenter |
Qt.AlignVCenter
522 property bool toggle:
false
525 targetRAText.text =
""
526 targetDEText.text =
""
529 if (coordGroup.lastChecked == 0) {
530 targetRAText.text = raValue.text
531 targetDEText.text = deValue.text
533 if (coordGroup.lastChecked == 1) {
534 targetRAText.text = azValue.text
535 targetDEText.text = altValue.text
537 if (coordGroup.lastChecked == 2) {
538 targetRAText.text = haValue.text
539 targetDEText.text = deValue.text
549 renderType: Text.QtRendering
552 fontSizeMode: Text.Fit
557 objectName:
"raValueObject"
560 renderType: Text.QtRendering
561 Layout.fillWidth:
true
569 renderType: Text.QtRendering
570 Layout.fillWidth: false
571 fontSizeMode: Text.Fit
577 objectName:
"azValueObject"
580 renderType: Text.QtRendering
581 Layout.fillWidth:
true
589 renderType: Text.QtRendering
590 fontSizeMode: Text.Fit
596 objectName:
"deValueObject"
599 renderType: Text.QtRendering
600 Layout.fillWidth:
true
608 renderType: Text.QtRendering
609 fontSizeMode: Text.Fit
615 objectName:
"altValueObject"
618 renderType: Text.QtRendering
619 Layout.fillWidth:
true
627 renderType: Text.QtRendering
628 fontSizeMode: Text.Fit
634 objectName:
"haValueObject"
637 renderType: Text.QtRendering
638 Layout.fillWidth:
true
646 renderType: Text.QtRendering
647 fontSizeMode: Text.Fit
653 objectName:
"zaValueObject"
656 renderType: Text.QtRendering
657 Layout.fillWidth:
true
665 Layout.fillWidth:
true
666 Layout.alignment:
Qt.AlignHCenter
671 text:
xi18n(
"Target:")
672 renderType: Text.QtRendering
673 verticalAlignment: Text.AlignVCenter
674 Layout.fillHeight: true
675 Layout.fillWidth: false
682 objectName:
"targetTextObject"
683 placeholderText:
"Click Find Icon"
698 radius: fontMetrics.height * 0.25
702 border.color:
"#D4AF37"
703 border.width: fontMetrics.height * 0.05
705 verticalAlignment: Text.AlignVCenter
706 horizontalAlignment: Text.AlignHCenter
707 Layout.fillHeight:
false
708 Layout.fillWidth:
true
715 objectName:
"findButtonObject"
716 Layout.fillWidth:
false
718 Layout.alignment:
Qt.AlignRight
719 Layout.minimumHeight: fontMetrics.height * 1.4
720 Layout.maximumHeight: fontMetrics.height * 1.4
721 Layout.minimumWidth: fontMetrics.height * 1.5
722 Layout.maximumWidth: fontMetrics.height * 1.5
733 id: targetCoordsLayout
734 Layout.alignment:
Qt.AlignHCenter |
Qt.AlignVCenter
735 Layout.fillWidth:
true
740 objectName:
"targetRALabelObject"
743 renderType: Text.QtRendering
750 objectName:
"targetRATextObject"
751 placeholderText:
"HH:MM:SS"
763 horizontalAlignment: Text.AlignHCenter
764 Layout.minimumWidth: fontMetrics.height * 7
767 Layout.minimumHeight: fontMetrics.height * 1.4
768 Layout.fillWidth:
true
773 objectName:
"targetDELabelObject"
776 renderType: Text.QtRendering
783 objectName:
"targetDETextObject"
784 placeholderText:
"DD:MM:SS"
796 width: fontMetrics.height * 7.5
797 horizontalAlignment: Text.AlignHCenter
798 Layout.fillHeight:
false
799 Layout.minimumWidth: fontMetrics.height * 7
802 Layout.minimumHeight: fontMetrics.height * 1.4
803 Layout.fillWidth:
true
809 renderType: Text.QtRendering
816 objectName:
"coordGroupObject"
817 property int lastChecked: 0
818 property bool valid:
false
823 objectName:
"equatorialCheckObject"
834 ButtonGroup.group: coordGroup
837 targetRALabel.text =
xi18n(
"RA:")
838 targetDELabel.text = xi18n("DE:")
839 targetRAText.placeholderText = "HH:MM:SS"
840 if (targetRAText.text == "" ||
841 targetDEText.text == "") {
842 targetRAText.text =
""
843 targetDEText.text =
""
846 if (coordGroup.lastChecked == 1)
847 coordGroup.valid =
mount.azAltToRaDec(
848 targetRAText.text, targetDEText.text)
850 coordGroup.valid =
mount.haDecToRaDec(
852 if (!coordGroup.valid) {
853 targetRAText.text =
""
854 targetDEText.text =
""
857 targetRAText.focus =
false
858 targetDEText.focus =
false
859 coordGroup.lastChecked = 0
866 ButtonGroup.group: coordGroup
867 objectName:
"horizontalCheckObject"
881 targetRALabel.text =
xi18n(
"AZ:")
882 targetDELabel.text = xi18n("AL:")
883 targetRAText.placeholderText = "DDD:MM:SS"
884 if (targetRAText.text == "" ||
885 targetDEText.text == "") {
886 targetRAText.text =
""
887 targetDEText.text =
""
890 if (coordGroup.lastChecked == 0)
891 coordGroup.valid =
mount.raDecToAzAlt(
892 targetRAText.text, targetDEText.text)
894 coordGroup.valid =
mount.haDecToAzAlt(
895 targetRAText.text, targetDEText.text)
896 if (!coordGroup.valid) {
897 targetRAText.text =
""
898 targetDEText.text =
""
901 targetRAText.focus =
false
902 targetDEText.focus =
false
903 coordGroup.lastChecked = 1
909 id: haEquatorialCheck
919 ButtonGroup.group: coordGroup
920 objectName:
"haEquatorialCheckObject"
925 targetRALabel.text =
xi18n(
"HA:")
926 targetDELabel.text = xi18n("DE:")
927 targetRAText.placeholderText = "HH:MM:SS"
928 if (targetRAText.text == "" ||
929 targetDEText.text == "") {
930 targetRAText.text =
""
931 targetDEText.text =
""
934 if (coordGroup.lastChecked == 1)
935 coordGroup.valid =
mount.azAltToHaDec(
936 targetRAText.text, targetDEText.text)
938 coordGroup.valid =
mount.raDecToHaDec(
940 if (!coordGroup.valid) {
941 targetRAText.text =
""
942 targetDEText.text =
""
945 targetRAText.focus =
false
946 targetDEText.focus =
false
947 coordGroup.lastChecked = 2
955 text:
xi18n(
"Epoch:")
956 renderType: Text.QtRendering
961 ButtonGroup { id: epochGroup }
965 objectName:
"jnowCheckObject"
976 ButtonGroup.group: epochGroup
981 objectName:
"j2000CheckObject"
991 ButtonGroup.group: epochGroup
998 Layout.fillHeight:
false
999 Layout.fillWidth:
true
1000 Layout.alignment:
Qt.AlignHCenter
1005 objectName:
"gotoButtonObject"
1007 Layout.fillWidth: true
1011 mount.slew(targetRAText.text, targetDEText.text);
1012 mountMotionLayout.focus =
true;
1018 objectName:
"syncButtonObject"
1020 Layout.fillWidth: true
1024 mount.sync(targetRAText.text, targetDEText.text);
1025 mountMotionLayout.focus =
true;
1031 objectName:
"parkButtonObject"
1033 Layout.fillWidth: true
1043 objectName:
"unparkButtonObject"
1044 text:
xi18n(
"UNPARK")
1045 Layout.fillWidth: true
1056 Layout.fillHeight:
false
1057 Layout.fillWidth:
true
1058 Layout.alignment:
Qt.AlignHCenter
1063 text:
xi18n(
"Status:")
1064 renderType: Text.QtRendering
1071 objectName:
"statusTextObject"
1074 renderType: Text.QtRendering
1075 Layout.fillWidth: true
1076 Layout.minimumWidth: fontMetrics.height * 5
1083 Layout.minimumWidth: fontMetrics.height * 1.4
1084 Layout.minimumHeight: fontMetrics.height * 1.4
QString xi18n(const char *text, const TYPE &arg...)
AKONADI_CALENDAR_EXPORT KCalendarCore::Event::Ptr event(const Akonadi::Item &item)
KIOCORE_EXPORT SimpleJob * mount(bool ro, const QByteArray &fstype, const QString &dev, const QString &point, JobFlags flags=DefaultFlags)
const QList< QKeySequence > & up()
QTextStream & left(QTextStream &stream)
QTextStream & right(QTextStream &stream)