2 import QtQuick.Controls 1.4
3 import QtQuick.Layouts 1.1
4 import QtQuick.Controls.Styles 1.4
8 objectName:
"mountControlObject"
12 property color buttonColor:
"silver"
13 property color coordsColor:
"gold"
24 width: (
Qt.platform.os ===
"osx") ? fontMetrics.height * 13.5 /.75 : fontMetrics.height * 13.5
25 height: (
Qt.platform.os ===
"osx") ? fontMetrics.height * 29.5 /.75 : fontMetrics.height * 29.5
29 onClicked: mountMotionLayout.focus =
true
32 id: mainVerticalLayout
34 anchors.margins: fontMetrics.height * 0.25
38 rowSpacing: fontMetrics.height * 0.05
39 columnSpacing: fontMetrics.height * 0.05
40 Layout.minimumHeight: fontMetrics.height * 8
41 Layout.maximumHeight: fontMetrics.height * 8
42 Layout.minimumWidth: fontMetrics.height * 10
43 Layout.maximumWidth: fontMetrics.height * 10
44 Layout.alignment:
Qt.AlignHCenter |
Qt.AlignVCenter
49 event.accepted =
true;
50 if (!
event.isAutoRepeat)
51 onPressedChanged(event,
true);
55 event.accepted =
true;
56 if (!
event.isAutoRepeat)
57 onPressedChanged(event,
false);
60 function setTimeout(delay_ms, cb) {
61 var component =
Qt.createComponent(
"timer.qml");
62 var timer = component.createObject(rectangle, {x: 0, y: 0});
65 console.error(
"Error creating timer object");
68 timer.callback =
function() {
72 timer.interval = delay_ms;
76 property var keyState: ({})
78 property var motionState: ({ns: -1, we: -1})
83 property var filteredKeyState: {0x13:
false, 0x15:
false, 0x12:
false, 0x14:
false}
84 function moveMount() {
85 var
up = filteredKeyState[
Qt.Key_Up];
86 var down = filteredKeyState[
Qt.Key_Down];
87 var
left = filteredKeyState[
Qt.Key_Left];
88 var
right = filteredKeyState[
Qt.Key_Right];
98 mount.motionCommand(0, ns, -1);
100 }
else if (motionState.ns !== -1) {
101 mount.motionCommand(1, motionState.ns, -1);
104 if (left !== right) {
110 mount.motionCommand(0, -1, we);
112 }
else if (motionState.we !== -1) {
113 mount.motionCommand(1, -1, motionState.we);
118 northRect.opacity = 1;
119 }
else if (ns === 1) {
120 southRect.opacity = 1;
122 northRect.opacity = 0;
123 southRect.opacity = 0;
126 westRect.opacity = 1;
127 }
else if (we === 1) {
128 eastRect.opacity = 1;
130 westRect.opacity = 0;
131 eastRect.opacity = 0;
135 function deflicker(key, pressed) {
136 keyState[key] = pressed;
137 setTimeout(5,
function() {
138 if (pressed === keyState[key] && pressed !== filteredKeyState[key]) {
139 filteredKeyState[key] = pressed;
145 function onPressedChanged(event, pressed) {
146 deflicker(
event.key, pressed);
152 Layout.fillHeight:
true
153 Layout.fillWidth:
true
158 color: northWest.pressed ?
"red" : rectangle.buttonColor
163 northWest.pressed ?
mount.motionCommand(0, 0, 0) :
mount.motionCommand(1, 0, 0);
168 mountMotionLayout.focus =
true;
173 source:
"go-northwest.png"
179 Layout.fillHeight:
true
180 Layout.fillWidth:
true
185 color: north.pressed ?
"red" : rectangle.buttonColor
198 north.pressed ?
mount.motionCommand(0, 0, -1) :
mount.motionCommand(1, 0, -1);
203 mountMotionLayout.focus =
true;
208 source:
"go-north.png"
214 Layout.fillHeight:
true
215 Layout.fillWidth:
true
220 color: northEast.pressed ?
"red" : rectangle.buttonColor
225 northEast.pressed ?
mount.motionCommand(0, 0, 1) :
mount.motionCommand(1, 0, 1);
230 mountMotionLayout.focus =
true;
235 source:
"go-northeast.png"
241 Layout.fillHeight:
true
242 Layout.fillWidth:
true
247 color: west.pressed ?
"red" : rectangle.buttonColor
260 west.pressed ?
mount.motionCommand(0, -1, 0) :
mount.motionCommand(1, -1, 0);
265 mountMotionLayout.focus =
true;
270 source:
"go-west.png"
276 Layout.fillHeight:
true
277 Layout.fillWidth:
true
282 color:
stop.pressed ?
"red" : rectangle.buttonColor
293 mountMotionLayout.focus =
true;
301 Layout.fillHeight:
true
302 Layout.fillWidth:
true
307 color: east.pressed ?
"red" : rectangle.buttonColor
320 east.pressed ?
mount.motionCommand(0, -1, 1) :
mount.motionCommand(1, -1, 1);
325 mountMotionLayout.focus =
true;
330 source:
"go-east.png"
336 Layout.fillHeight:
true
337 Layout.fillWidth:
true
342 color: southWest.pressed ?
"red" : rectangle.buttonColor
347 southWest.pressed ?
mount.motionCommand(0, 1, 0) :
mount.motionCommand(1, 1, 0);
352 mountMotionLayout.focus =
true;
357 source:
"go-southwest.png"
363 Layout.fillHeight:
true
364 Layout.fillWidth:
true
369 color: south.pressed ?
"red" : rectangle.buttonColor
382 south.pressed ?
mount.motionCommand(0, 1, -1) :
mount.motionCommand(1, 1, -1);
383 mountMotionLayout.focus =
true;
388 source:
"go-south.png"
394 Layout.fillHeight:
true
395 Layout.fillWidth:
true
400 color: southEast.pressed ?
"red" : rectangle.buttonColor
405 southEast.pressed ?
mount.motionCommand(0, 1, 1) :
mount.motionCommand(1, 1, 1);
410 mountMotionLayout.focus =
true;
415 source:
"go-southeast.png"
422 id: mountReverseLayout
423 Layout.fillWidth:
true
424 Layout.alignment:
Qt.AlignHCenter
428 text:
xi18n(
"Reverse")
434 text:
xi18n(
"Up/Down")
435 objectName: "upDownCheckObject"
436 onClicked: mount.setUpDownReversed(checked)
442 text:
xi18n(
"Left/Right")
443 objectName: "leftRightCheckObject"
444 onClicked: mount.setLeftRightReversed(checked)
451 anchors.horizontalCenter: parent.Center
452 Layout.alignment:
Qt.AlignHCenter |
Qt.AlignVCenter
453 Layout.fillHeight:
false
454 Layout.fillWidth:
true
458 x: fontMetrics.height * 0.1
460 width: fontMetrics.height * 1.5
461 objectName:
"speedSliderObject"
462 Layout.fillWidth:
true
463 Layout.maximumWidth: fontMetrics.height * 7.5
471 mount.setSlewRate(speedSlider.value)
477 width: fontMetrics.height * 3.75
478 objectName:
"speedLabelObject"
480 horizontalAlignment: Text.AlignHCenter
481 Layout.alignment:
Qt.AlignHCenter |
Qt.AlignVCenter
482 Layout.maximumWidth: fontMetrics.height * 3.75
483 Layout.minimumWidth: fontMetrics.height * 3.75
484 font.weight: Font.Bold
487 font.family: "Verdana"
488 fontSizeMode: Text.Fit
489 verticalAlignment: Text.AlignVCenter
490 Layout.fillWidth: true
496 id: mountCoordsLayout
497 anchors.horizontalCenter: parent.Center
498 Layout.alignment:
Qt.AlignHCenter |
Qt.AlignVCenter
499 Layout.fillWidth:
true
504 property bool toggle:
false
507 targetRAText.text =
""
508 targetDEText.text =
""
511 if (coordGroup.lastChecked == 0) {
512 targetRAText.text = raValue.text
513 targetDEText.text = deValue.text
515 if (coordGroup.lastChecked == 1) {
516 targetRAText.text = azValue.text
517 targetDEText.text = altValue.text
519 if (coordGroup.lastChecked == 2) {
520 targetRAText.text = haValue.text
521 targetDEText.text = deValue.text
533 fontSizeMode: Text.Fit
538 objectName:
"raValueObject"
541 Layout.fillWidth:
true
549 Layout.fillWidth: false
550 fontSizeMode: Text.Fit
556 objectName:
"azValueObject"
559 Layout.fillWidth:
true
567 fontSizeMode: Text.Fit
573 objectName:
"deValueObject"
576 Layout.fillWidth:
true
584 fontSizeMode: Text.Fit
590 objectName:
"altValueObject"
593 Layout.fillWidth:
true
601 fontSizeMode: Text.Fit
607 objectName:
"haValueObject"
610 Layout.fillWidth:
true
618 fontSizeMode: Text.Fit
624 objectName:
"zaValueObject"
627 Layout.fillWidth:
true
635 Layout.fillWidth:
true
636 Layout.alignment:
Qt.AlignHCenter
641 text:
xi18n(
"Target:")
642 verticalAlignment: Text.AlignVCenter
643 Layout.fillHeight: true
644 Layout.fillWidth: false
651 objectName:
"targetTextObject"
652 placeholderText:
"Click Find Icon"
657 radius: fontMetrics.height * 0.25
661 border.color:
"#D4AF37"
662 border.width: fontMetrics.height * 0.05
664 verticalAlignment: Text.AlignVCenter
665 horizontalAlignment: Text.AlignHCenter
666 Layout.fillHeight:
false
667 Layout.fillWidth:
true
674 objectName:
"findButtonObject"
675 Layout.fillWidth:
false
676 iconName:
"view-history"
677 Layout.alignment:
Qt.AlignRight
678 Layout.minimumHeight: fontMetrics.height * 1.4
679 Layout.maximumHeight: fontMetrics.height * 1.4
680 Layout.minimumWidth: fontMetrics.height * 1.5
681 Layout.maximumWidth: fontMetrics.height * 1.5
692 id: targetCoordsLayout
693 Layout.alignment:
Qt.AlignHCenter |
Qt.AlignVCenter
694 Layout.fillWidth:
true
699 objectName:
"targetRALabelObject"
708 objectName:
"targetRATextObject"
709 placeholderText:
"HH:MM:SS"
711 horizontalAlignment: Text.AlignHCenter
712 Layout.minimumWidth: fontMetrics.height * 7
715 Layout.minimumHeight: fontMetrics.height * 1.4
716 Layout.fillWidth:
true
721 objectName:
"targetDELabelObject"
730 objectName:
"targetDETextObject"
731 placeholderText:
"DD:MM:SS"
733 width: fontMetrics.height * 7.5
734 horizontalAlignment: Text.AlignHCenter
735 Layout.fillHeight:
false
736 Layout.minimumWidth: fontMetrics.height * 7
739 Layout.minimumHeight: fontMetrics.height * 1.4
740 Layout.fillWidth:
true
752 objectName:
"coordGroupObject"
753 property int lastChecked: 0
754 property bool valid:
false
759 objectName:
"equatorialCheckObject"
762 exclusiveGroup: coordGroup
765 targetRALabel.text =
xi18n(
"RA:")
766 targetDELabel.text = xi18n("DE:")
767 targetRAText.placeholderText = "HH:MM:SS"
768 if (targetRAText.text == "" ||
769 targetDEText.text == "") {
770 targetRAText.text =
""
771 targetDEText.text =
""
774 if (coordGroup.lastChecked == 1)
775 coordGroup.valid =
mount.azAltToRaDec(
776 targetRAText.text, targetDEText.text)
778 coordGroup.valid =
mount.haDecToRaDec(
780 if (!coordGroup.valid) {
781 targetRAText.text =
""
782 targetDEText.text =
""
785 targetRAText.focus =
false
786 targetDEText.focus =
false
787 coordGroup.lastChecked = 0
794 exclusiveGroup: coordGroup
795 objectName:
"horizontalCheckObject"
801 targetRALabel.text =
xi18n(
"AZ:")
802 targetDELabel.text = xi18n("AL:")
803 targetRAText.placeholderText = "DDD:MM:SS"
804 if (targetRAText.text == "" ||
805 targetDEText.text == "") {
806 targetRAText.text =
""
807 targetDEText.text =
""
810 if (coordGroup.lastChecked == 0)
811 coordGroup.valid =
mount.raDecToAzAlt(
812 targetRAText.text, targetDEText.text)
814 coordGroup.valid =
mount.haDecToAzAlt(
815 targetRAText.text, targetDEText.text)
816 if (!coordGroup.valid) {
817 targetRAText.text =
""
818 targetDEText.text =
""
821 targetRAText.focus =
false
822 targetDEText.focus =
false
823 coordGroup.lastChecked = 1
829 id: haEquatorialCheck
831 exclusiveGroup: coordGroup
832 objectName: "haEquatorialCheckObject"
837 targetRALabel.text =
xi18n(
"HA:")
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.azAltToHaDec(
848 targetRAText.text, targetDEText.text)
850 coordGroup.valid =
mount.raDecToHaDec(
852 if (!coordGroup.valid) {
853 targetRAText.text =
""
854 targetDEText.text =
""
857 targetRAText.focus =
false
858 targetDEText.focus =
false
859 coordGroup.lastChecked = 2
867 text:
xi18n(
"Epoch:")
872 ExclusiveGroup { id: epochGroup }
876 objectName:
"jnowCheckObject"
879 exclusiveGroup: epochGroup
884 objectName:
"j2000CheckObject"
886 exclusiveGroup: epochGroup
893 Layout.fillHeight:
false
894 Layout.fillWidth:
true
895 Layout.alignment:
Qt.AlignHCenter
900 objectName:
"gotoButtonObject"
902 Layout.fillWidth: true
906 mount.slew(targetRAText.text, targetDEText.text);
907 mountMotionLayout.focus =
true;
913 objectName:
"syncButtonObject"
915 Layout.fillWidth: true
919 mount.sync(targetRAText.text, targetDEText.text);
920 mountMotionLayout.focus =
true;
926 objectName:
"parkButtonObject"
928 Layout.fillWidth: true
938 objectName:
"unparkButtonObject"
939 text:
xi18n(
"UNPARK")
940 Layout.fillWidth: true
951 Layout.fillHeight:
false
952 Layout.fillWidth:
true
953 Layout.alignment:
Qt.AlignHCenter
958 text:
xi18n(
"Status:")
965 objectName:
"statusTextObject"
968 Layout.fillWidth: true
969 Layout.minimumWidth: fontMetrics.height * 5
976 Layout.minimumWidth: fontMetrics.height * 1.4
977 Layout.minimumHeight: fontMetrics.height * 1.4
978 iconName:
"crosshairs"