Warning, /education/kstars/kstars/data/qml/mount/mountbox.qml is written in an unsupported language. File is not indexed.

0001 import QtQuick 2.5
0002 import QtQuick.Controls 1.4
0003 import QtQuick.Layouts 1.1
0004 import QtQuick.Controls.Styles 1.4
0005 
0006 Rectangle {
0007     id: rectangle
0008     objectName: "mountControlObject"
0009 
0010     color: "#000000"
0011 
0012     property color buttonColor: "silver"
0013     property color coordsColor: "gold"
0014 
0015     FontMetrics {
0016         id: fontMetrics
0017         font.family: "Arial"
0018         font.bold: false
0019         font.italic: false
0020         font.underline:false
0021         font.pointSize: 12
0022     }
0023 
0024     width:  (Qt.platform.os === "osx") ? fontMetrics.height * 13.5 /.75 : fontMetrics.height * 13.5
0025     height: (Qt.platform.os === "osx") ? fontMetrics.height * 29.5 /.75 : fontMetrics.height * 29.5
0026 
0027     MouseArea {
0028         anchors.fill: parent
0029         onClicked: mountMotionLayout.focus = true
0030          
0031         ColumnLayout {
0032             id: mainVerticalLayout
0033             anchors.fill: parent
0034             anchors.margins: fontMetrics.height * 0.25
0035 
0036             GridLayout {
0037                 id: mountMotionLayout
0038                 rowSpacing: fontMetrics.height * 0.05
0039                 columnSpacing: fontMetrics.height * 0.05
0040                 Layout.minimumHeight: fontMetrics.height * 8
0041                 Layout.maximumHeight: fontMetrics.height * 8
0042                 Layout.minimumWidth: fontMetrics.height * 10
0043                 Layout.maximumWidth: fontMetrics.height * 10
0044                 Layout.alignment: Qt.AlignHCenter | Qt.AlignVCenter
0045                 columns: 3
0046 
0047                 focus: true
0048                 Keys.onPressed: {
0049                     event.accepted = true;
0050                     if (!event.isAutoRepeat)
0051                         onPressedChanged(event, true);
0052                 }
0053 
0054                 Keys.onReleased: {
0055                     event.accepted = true;
0056                     if (!event.isAutoRepeat)
0057                         onPressedChanged(event, false);
0058                 }
0059 
0060                 function setTimeout(delay_ms, cb) {
0061                     var component = Qt.createComponent("timer.qml");
0062                     var timer = component.createObject(rectangle, {x: 0, y: 0});
0063 
0064                     if (timer === null) {
0065                         console.error("Error creating timer object");
0066                     }
0067 
0068                     timer.callback = function() {
0069                         cb();
0070                         this.destroy();
0071                     };
0072                     timer.interval = delay_ms;
0073                     timer.running = true;
0074                 }
0075 
0076                 property var keyState: ({})
0077                  // -1 means not moving
0078                 property var motionState: ({ns: -1, we: -1})
0079                 // It appears [Qt.Key_Up] is not a valid subsituion in QML like Javascript in older versions?
0080                 //property var filteredKeyState: ({[Qt.Key_Up]: false, [Qt.Key_Down]: false, [Qt.Key_Left]: false, [Qt.Key_Right]: false})
0081                 // Replacing it with direct values and confirmed works with older Qt versions:
0082                 // true means pressed
0083                 property var filteredKeyState: {0x13: false, 0x15: false, 0x12: false, 0x14: false}
0084                 function moveMount() {
0085                     var up = filteredKeyState[Qt.Key_Up];
0086                     var down = filteredKeyState[Qt.Key_Down];
0087                     var left = filteredKeyState[Qt.Key_Left];
0088                     var right = filteredKeyState[Qt.Key_Right];
0089 
0090                     var ns = -1;
0091                     var we = -1;
0092                     if (up !== down) {
0093                         if (up){
0094                             ns = 0;
0095                         } else if (down) {
0096                             ns = 1;
0097                         }
0098                         mount.motionCommand(0, ns, -1);
0099                         motionState.ns = ns;
0100                     } else if (motionState.ns !== -1) {
0101                         mount.motionCommand(1, motionState.ns, -1);
0102                         motionState.ns = -1;
0103                     }
0104                     if (left !== right) {
0105                         if (left){
0106                             we = 0;
0107                         } else if (right) {
0108                             we = 1;
0109                         }
0110                         mount.motionCommand(0, -1, we);
0111                         motionState.we = we;
0112                     } else if (motionState.we !== -1) {
0113                         mount.motionCommand(1, -1, motionState.we);
0114                         motionState.we = -1;
0115                     }
0116 
0117                     if (ns === 0) {
0118                         northRect.opacity = 1;
0119                     } else if (ns === 1) {
0120                         southRect.opacity = 1;
0121                     } else {
0122                         northRect.opacity = 0;
0123                         southRect.opacity = 0;
0124                     }
0125                     if (we === 0) {
0126                         westRect.opacity = 1;
0127                     } else if (we === 1) {
0128                         eastRect.opacity = 1;
0129                     } else {
0130                         westRect.opacity = 0;
0131                         eastRect.opacity = 0;
0132                     }
0133                 }
0134 
0135                 function deflicker(key, pressed) {
0136                     keyState[key] = pressed;
0137                     setTimeout(5, function() {
0138                         if (pressed === keyState[key] && pressed !== filteredKeyState[key]) {
0139                             filteredKeyState[key] = pressed;
0140                             moveMount();
0141                         }
0142                     });
0143                 }
0144 
0145                 function onPressedChanged(event, pressed) {
0146                     deflicker(event.key, pressed);
0147                 }
0148 
0149                 Button
0150                 {
0151                     id: northWest
0152                     Layout.fillHeight: true
0153                     Layout.fillWidth: true
0154 
0155                     Rectangle
0156                     {
0157                         anchors.fill: parent
0158                         color: northWest.pressed ? "red" : rectangle.buttonColor
0159                     }
0160 
0161                     onPressedChanged:
0162                     {
0163                         northWest.pressed ? mount.motionCommand(0, 0, 0) : mount.motionCommand(1, 0, 0);
0164                     }
0165 
0166                     onClicked:
0167                     {
0168                         mountMotionLayout.focus = true;
0169                     }
0170                     
0171                     Image {
0172                         anchors.fill: parent
0173                         source: "go-northwest.png"
0174                     }
0175                 }
0176 
0177                 Button {
0178                     id: north
0179                     Layout.fillHeight: true
0180                     Layout.fillWidth: true
0181 
0182                     Rectangle
0183                     {
0184                         anchors.fill: parent
0185                         color: north.pressed ? "red" : rectangle.buttonColor
0186                     }
0187 
0188                     Rectangle
0189                     {
0190                         id: northRect
0191                         opacity: 0
0192                         anchors.fill: parent
0193                         color: "red"
0194                     }
0195 
0196                     onPressedChanged:
0197                     {
0198                         north.pressed ? mount.motionCommand(0, 0, -1) : mount.motionCommand(1, 0, -1);
0199                     }
0200 
0201                     onClicked:
0202                     {
0203                         mountMotionLayout.focus = true;
0204                     }
0205 
0206                     Image {
0207                         anchors.fill: parent
0208                         source: "go-north.png"
0209                     }
0210                 }
0211 
0212                 Button {
0213                     id: northEast
0214                     Layout.fillHeight: true
0215                     Layout.fillWidth: true
0216 
0217                     Rectangle
0218                     {
0219                         anchors.fill: parent
0220                         color: northEast.pressed ? "red" : rectangle.buttonColor
0221                     }
0222 
0223                     onPressedChanged:
0224                     {
0225                         northEast.pressed ? mount.motionCommand(0, 0, 1) : mount.motionCommand(1, 0, 1);
0226                     }
0227 
0228                     onClicked:
0229                     {
0230                         mountMotionLayout.focus = true;
0231                     }
0232 
0233                     Image {
0234                         anchors.fill: parent
0235                         source: "go-northeast.png"
0236                     }
0237                 }
0238 
0239             Button {
0240                     id: west
0241                     Layout.fillHeight: true
0242                     Layout.fillWidth: true
0243 
0244                     Rectangle
0245                     {
0246                         anchors.fill: parent
0247                         color: west.pressed ? "red" : rectangle.buttonColor
0248                     }
0249 
0250                     Rectangle
0251                     {
0252                         id: westRect
0253                         opacity: 0
0254                         anchors.fill: parent
0255                         color: "red"
0256                     }
0257 
0258                     onPressedChanged:
0259                     {
0260                         west.pressed ? mount.motionCommand(0, -1, 0) : mount.motionCommand(1, -1, 0);
0261                     }
0262                     
0263                     onClicked:
0264                     {
0265                         mountMotionLayout.focus = true;
0266                     }
0267 
0268                     Image {
0269                         anchors.fill: parent
0270                         source: "go-west.png"
0271                     }
0272                 }
0273 
0274                 Button {
0275                     id: stop
0276                     Layout.fillHeight: true
0277                     Layout.fillWidth: true
0278 
0279                     Rectangle
0280                     {
0281                         anchors.fill: parent
0282                         color: stop.pressed ? "red" : rectangle.buttonColor
0283                     }
0284 
0285                     Image {
0286                         anchors.fill: parent
0287                         source: "stop.png"
0288                     }
0289 
0290                     onClicked:
0291                     {
0292                         mount.abort();
0293                         mountMotionLayout.focus = true;
0294                     }
0295 
0296 
0297                 }
0298 
0299                 Button {
0300                     id: east
0301                     Layout.fillHeight: true
0302                     Layout.fillWidth: true
0303 
0304                     Rectangle
0305                     {
0306                         anchors.fill: parent
0307                         color: east.pressed ? "red" : rectangle.buttonColor
0308                     }
0309 
0310                     Rectangle
0311                     {
0312                         id: eastRect
0313                         opacity: 0
0314                         anchors.fill: parent
0315                         color: "red"
0316                     }
0317 
0318                     onPressedChanged:
0319                     {
0320                         east.pressed ? mount.motionCommand(0, -1, 1) : mount.motionCommand(1, -1, 1);
0321                     }
0322 
0323                     onClicked:
0324                     {
0325                         mountMotionLayout.focus = true;
0326                     }
0327 
0328                     Image {
0329                         anchors.fill: parent
0330                         source: "go-east.png"
0331                     }
0332                 }
0333 
0334                 Button {
0335                     id: southWest
0336                     Layout.fillHeight: true
0337                     Layout.fillWidth: true
0338 
0339                     Rectangle
0340                     {
0341                         anchors.fill: parent
0342                         color: southWest.pressed ? "red" : rectangle.buttonColor
0343                     }
0344 
0345                     onPressedChanged:
0346                     {
0347                         southWest.pressed ? mount.motionCommand(0, 1, 0) : mount.motionCommand(1, 1, 0);
0348                     }
0349 
0350                     onClicked:
0351                     {
0352                         mountMotionLayout.focus = true;
0353                     }
0354 
0355                     Image {
0356                         anchors.fill: parent
0357                         source: "go-southwest.png"
0358                     }
0359                 }
0360 
0361                 Button {
0362                     id: south
0363                     Layout.fillHeight: true
0364                     Layout.fillWidth: true
0365 
0366                     Rectangle
0367                     {
0368                         anchors.fill: parent
0369                         color: south.pressed ? "red" : rectangle.buttonColor
0370                     }
0371 
0372                     Rectangle
0373                     {
0374                         id: southRect
0375                         opacity: 0
0376                         anchors.fill: parent
0377                         color: "red"
0378                     }
0379 
0380                     onPressedChanged:
0381                     {
0382                         south.pressed ? mount.motionCommand(0, 1, -1) : mount.motionCommand(1, 1, -1);
0383                         mountMotionLayout.focus = true;
0384                     }
0385 
0386                     Image {
0387                         anchors.fill: parent
0388                         source: "go-south.png"
0389                     }
0390                 }
0391 
0392                 Button {
0393                     id: southEast
0394                     Layout.fillHeight: true
0395                     Layout.fillWidth: true
0396 
0397                     Rectangle
0398                     {
0399                         anchors.fill: parent
0400                         color: southEast.pressed ? "red" : rectangle.buttonColor
0401                     }
0402 
0403                     onPressedChanged:
0404                     {
0405                         southEast.pressed ? mount.motionCommand(0, 1, 1) : mount.motionCommand(1, 1, 1);
0406                     }
0407 
0408                     onClicked:
0409                     {
0410                         mountMotionLayout.focus = true;
0411                     }
0412 
0413                     Image {
0414                         anchors.fill: parent
0415                         source: "go-southeast.png"
0416                     }
0417                 }
0418             }
0419 
0420 
0421             RowLayout {
0422                 id: mountReverseLayout
0423                 Layout.fillWidth: true
0424                 Layout.alignment: Qt.AlignHCenter
0425 
0426                 Label
0427                 {
0428                     text: xi18n("Reverse")
0429                     renderType: Text.QtRendering
0430                 }
0431 
0432                 CheckBox
0433                 {
0434                     id: updownReverse
0435                     style:CheckBoxStyle{
0436                         label:Text{
0437                             text: xi18n("Up/Down")
0438                             renderType: Text.QtRendering
0439                             color: "white"
0440                         }
0441                     }
0442 
0443                     objectName: "upDownCheckObject"
0444                     onClicked: mount.setUpDownReversed(checked)
0445                 }
0446 
0447                 CheckBox
0448                 {
0449                     id: leftRightReverse
0450                     style:CheckBoxStyle{
0451                         label:Text{
0452                             text: xi18n("Left/Right")
0453                             renderType: Text.QtRendering
0454                             color: "white"
0455                         }
0456                     }
0457                     objectName: "leftRightCheckObject"
0458                     onClicked: mount.setLeftRightReversed(checked)
0459                 }
0460 
0461             }
0462 
0463             RowLayout {
0464                 id: mountSpeedLayout
0465                 anchors.horizontalCenter: parent.Center
0466                 Layout.alignment: Qt.AlignHCenter | Qt.AlignVCenter
0467                 Layout.fillHeight: false
0468                 Layout.fillWidth: true
0469 
0470                 Slider {
0471                     id: speedSlider
0472                     x: fontMetrics.height * 0.1
0473                     y: 0
0474                     width: fontMetrics.height * 1.5
0475                     objectName: "speedSliderObject"
0476                     Layout.fillWidth: true
0477                     Layout.maximumWidth: fontMetrics.height * 7.5
0478                     stepSize: 1
0479                     minimumValue: 0
0480                     maximumValue: 4
0481                     value: 0
0482 
0483                     onValueChanged:
0484                     {
0485                         mount.setSlewRate(speedSlider.value)
0486                     }
0487                 }
0488 
0489                 Label {
0490                     id: speedLabel
0491                     width: fontMetrics.height * 3.75
0492                     objectName: "speedLabelObject"
0493                     text: xi18n("1x")
0494                     renderType: Text.QtRendering
0495                     horizontalAlignment: Text.AlignHCenter
0496                     Layout.alignment: Qt.AlignHCenter | Qt.AlignVCenter
0497                     Layout.maximumWidth: fontMetrics.height * 3.75
0498                     Layout.minimumWidth: fontMetrics.height * 3.75
0499                     font.weight: Font.Bold
0500                     font.bold: true
0501                     font.pointSize: 12
0502                     font.family: "Verdana"
0503                     fontSizeMode: Text.Fit
0504                     verticalAlignment: Text.AlignVCenter
0505                     Layout.fillWidth: true
0506                     color: "white"
0507                 }
0508             }
0509 
0510             GridLayout {
0511                 id: mountCoordsLayout
0512                 anchors.horizontalCenter: parent.Center
0513                 Layout.alignment: Qt.AlignHCenter | Qt.AlignVCenter
0514                 Layout.fillWidth: true
0515                 columns: 4
0516 
0517                 MouseArea {
0518                     Layout.alignment: Qt.AlignHCenter | Qt.AlignVCenter
0519                     property bool toggle: false
0520                     onClicked: {
0521                         if (toggle) {
0522                             targetRAText.text = ""
0523                             targetDEText.text = ""
0524                         }
0525                         else {
0526                             if (coordGroup.lastChecked == 0) {
0527                                 targetRAText.text = raValue.text
0528                                 targetDEText.text = deValue.text
0529                             }
0530                             if (coordGroup.lastChecked == 1) {
0531                                 targetRAText.text = azValue.text
0532                                 targetDEText.text = altValue.text
0533                             }
0534                             if (coordGroup.lastChecked == 2) {
0535                                 targetRAText.text = haValue.text
0536                                 targetDEText.text = deValue.text
0537                             }
0538                         }
0539                         toggle = !toggle
0540                     }
0541                 }
0542 
0543                 Label {
0544                     id: raLabel
0545                     text: xi18n("RA:")
0546                     renderType: Text.QtRendering
0547                     font.bold: true
0548                     color: "white"
0549                     fontSizeMode: Text.Fit
0550                 }
0551 
0552                 Label {
0553                     id: raValue
0554                     objectName: "raValueObject"
0555                     color: coordsColor
0556                     text: "00:00:00"
0557                     renderType: Text.QtRendering
0558                     Layout.fillWidth: true
0559                     font.pointSize: 11
0560                 }
0561 
0562                 Label {
0563                     id: azLabel
0564                     color: "#ffffff"
0565                     text: xi18n("AZ:")
0566                     renderType: Text.QtRendering
0567                     Layout.fillWidth: false
0568                     fontSizeMode: Text.Fit
0569                     font.bold: true
0570                 }
0571 
0572                 Label {
0573                     id: azValue
0574                     objectName: "azValueObject"
0575                     color: coordsColor
0576                     text: "00:00:00"
0577                     renderType: Text.QtRendering
0578                     Layout.fillWidth: true
0579                     font.pointSize: 11
0580                 }
0581 
0582                 Label {
0583                     id: deLabel
0584                     color: "#ffffff"
0585                     text: xi18n("DE:")
0586                     renderType: Text.QtRendering
0587                     fontSizeMode: Text.Fit
0588                     font.bold: true
0589                 }
0590 
0591                 Label {
0592                     id: deValue
0593                     objectName: "deValueObject"
0594                     color: coordsColor
0595                     text: "00:00:00"
0596                     renderType: Text.QtRendering
0597                     Layout.fillWidth: true
0598                     font.pointSize: 11
0599                 }
0600 
0601                 Label {
0602                     id: altLabel
0603                     color: "#ffffff"
0604                     text: xi18n("AL:")
0605                     renderType: Text.QtRendering
0606                     fontSizeMode: Text.Fit
0607                     font.bold: true
0608                 }
0609 
0610                 Label {
0611                     id: altValue
0612                     objectName: "altValueObject"
0613                     color: coordsColor
0614                     text: "00:00:00"
0615                     renderType: Text.QtRendering
0616                     Layout.fillWidth: true
0617                     font.pointSize: 11
0618                 }
0619 
0620                 Label {
0621                     id: haLabel
0622                     color: "#ffffff"
0623                     text: xi18n("HA:")
0624                     renderType: Text.QtRendering
0625                     fontSizeMode: Text.Fit
0626                     font.bold: true
0627                 }
0628 
0629                 Label {
0630                     id: haValue
0631                     objectName: "haValueObject"
0632                     color: coordsColor
0633                     text: "00:00:00"
0634                     renderType: Text.QtRendering
0635                     Layout.fillWidth: true
0636                     font.pointSize: 11
0637                 }
0638 
0639                 Label {
0640                     id: zaLabel
0641                     color: "#ffffff"
0642                     text: xi18n("ZA:")
0643                     renderType: Text.QtRendering
0644                     fontSizeMode: Text.Fit
0645                     font.bold: true
0646                 }
0647 
0648                 Label {
0649                     id: zaValue
0650                     objectName: "zaValueObject"
0651                     color: coordsColor
0652                     text: "00:00:00"
0653                     renderType: Text.QtRendering
0654                     Layout.fillWidth: true
0655                     font.pointSize: 11
0656                 }
0657             }
0658 
0659             RowLayout
0660             {
0661                 id: targetFindLayout
0662                 Layout.fillWidth: true
0663                 Layout.alignment: Qt.AlignHCenter
0664 
0665                 Label {
0666                     id: targetLabel
0667                     color: "#ffffff"
0668                     text: xi18n("Target:")
0669                     renderType: Text.QtRendering
0670                     verticalAlignment: Text.AlignVCenter
0671                     Layout.fillHeight: true
0672                     Layout.fillWidth: false
0673                     font.pointSize: 14
0674                     font.bold: true
0675                 }
0676 
0677                 TextField {
0678                     id: targetText
0679                     objectName: "targetTextObject"
0680                     placeholderText: "Click Find Icon"
0681                     style: TextFieldStyle {
0682                         textColor: "white"
0683                         placeholderTextColor: "gray"
0684                         renderType: Text.QtRendering
0685                         background: Rectangle {
0686                             color: "#202020"
0687                         }
0688                     }
0689                     readOnly: true
0690                     Rectangle
0691                     {
0692                         color: "black"
0693                         radius: fontMetrics.height * 0.25
0694                         anchors.fill: parent
0695                         clip: true
0696                         opacity: 0.5
0697                         border.color: "#D4AF37"
0698                         border.width: fontMetrics.height * 0.05
0699                     }
0700                     verticalAlignment: Text.AlignVCenter
0701                     horizontalAlignment: Text.AlignHCenter
0702                     Layout.fillHeight: false
0703                     Layout.fillWidth: true
0704                     font.pointSize: 14
0705                     font.bold: true
0706                 }
0707 
0708                 Button {
0709                     id: findButton
0710                     objectName: "findButtonObject"
0711                     Layout.fillWidth: false
0712                     iconName: "view-history"
0713                     Layout.alignment: Qt.AlignRight
0714                     Layout.minimumHeight: fontMetrics.height * 1.4
0715                     Layout.maximumHeight: fontMetrics.height * 1.4
0716                     Layout.minimumWidth: fontMetrics.height * 1.5
0717                     Layout.maximumWidth: fontMetrics.height * 1.5
0718                     onClicked:
0719                     {
0720                         mount.findTarget()
0721                     }
0722                 }
0723 
0724             }
0725 
0726 
0727             GridLayout {
0728                 id: targetCoordsLayout
0729                 Layout.alignment: Qt.AlignHCenter | Qt.AlignVCenter
0730                 Layout.fillWidth: true
0731                 columns: 2
0732 
0733                 Label {
0734                     id: targetRALabel
0735                     objectName: "targetRALabelObject"
0736                     color: "#ffffff"
0737                     text: xi18n("RA:")
0738                     renderType: Text.QtRendering
0739                     font.pointSize: 14
0740                     font.bold: true
0741                 }
0742 
0743                 TextField {
0744                     id: targetRAText
0745                     objectName: "targetRATextObject"
0746                     placeholderText: "HH:MM:SS"
0747                     style: TextFieldStyle {
0748                         textColor: "white"
0749                         placeholderTextColor: "gray"
0750                         renderType: Text.QtRendering
0751                         background: Rectangle {
0752                             color: "#202020"
0753                         }
0754                     }
0755                     font.pointSize: 14
0756                     horizontalAlignment: Text.AlignHCenter
0757                     Layout.minimumWidth: fontMetrics.height * 7
0758                     clip: true
0759                     font.bold: true
0760                     Layout.minimumHeight: fontMetrics.height * 1.4
0761                     Layout.fillWidth: true
0762                 }
0763 
0764                 Label {
0765                     id: targetDELabel
0766                     objectName: "targetDELabelObject"
0767                     color: "#ffffff"
0768                     text: xi18n("DE:")
0769                     renderType: Text.QtRendering
0770                     font.pointSize: 14
0771                     font.bold: true
0772                 }
0773 
0774                 TextField {
0775                     id: targetDEText
0776                     objectName: "targetDETextObject"
0777                     placeholderText: "DD:MM:SS"
0778                     style: TextFieldStyle {
0779                         textColor: "white"
0780                         placeholderTextColor: "gray"
0781                         renderType: Text.QtRendering
0782                         background: Rectangle {
0783                             color: "#202020"
0784                         }
0785                     }
0786                     font.pointSize: 14
0787                     width: fontMetrics.height * 7.5
0788                     horizontalAlignment: Text.AlignHCenter
0789                     Layout.fillHeight: false
0790                     Layout.minimumWidth: fontMetrics.height * 7
0791                     clip: true
0792                     font.bold: true
0793                     Layout.minimumHeight: fontMetrics.height * 1.4
0794                     Layout.fillWidth: true
0795                 }
0796 
0797                 Label {
0798                     id: coordLabel
0799                     text: xi18n("Type:")
0800                     renderType: Text.QtRendering
0801                 }
0802 
0803                 RowLayout
0804                 {
0805                     ExclusiveGroup {
0806                         id: coordGroup
0807                         objectName: "coordGroupObject"
0808                         property int lastChecked: 0
0809                         property bool valid: false
0810                     }
0811 
0812                     RadioButton {
0813                         id: equatorialCheck
0814                         objectName: "equatorialCheckObject"
0815                         checked: true
0816                         style:RadioButtonStyle{
0817                             label:Text{
0818                                 text: xi18n("RA/DE")
0819                                 renderType: Text.QtRendering
0820                                 color: "white"
0821                             }
0822                         }
0823                         exclusiveGroup: coordGroup
0824                         onCheckedChanged: {
0825                             if (checked) {
0826                                 targetRALabel.text = xi18n("RA:")
0827                                 targetDELabel.text = xi18n("DE:")
0828                                 targetRAText.placeholderText = "HH:MM:SS"
0829                                 if (targetRAText.text == "" ||
0830                                     targetDEText.text == "") {
0831                                     targetRAText.text = ""
0832                                     targetDEText.text = ""
0833                                 }
0834                                 else {
0835                                     if (coordGroup.lastChecked == 1)
0836                                         coordGroup.valid = mount.azAltToRaDec(
0837                                             targetRAText.text, targetDEText.text)
0838                                     else
0839                                         coordGroup.valid = mount.haDecToRaDec(
0840                                             targetRAText.text)
0841                                     if (!coordGroup.valid) {
0842                                         targetRAText.text = ""
0843                                         targetDEText.text = ""
0844                                     }
0845                                 }
0846                                 targetRAText.focus = false
0847                                 targetDEText.focus = false
0848                                 coordGroup.lastChecked = 0
0849                             }
0850                         }
0851                     }
0852 
0853                     RadioButton {
0854                         id: horizontalCheck
0855                         exclusiveGroup: coordGroup
0856                         objectName: "horizontalCheckObject"
0857                         style:RadioButtonStyle{
0858                             label:Text{
0859                                 text: xi18n("AZ/AL")
0860                                 renderType: Text.QtRendering
0861                                 color: "white"
0862                             }
0863                         }
0864                         checked: false
0865                         onCheckedChanged: {
0866                             if (checked) {
0867                                 targetText.text = ""
0868                                 targetRALabel.text = xi18n("AZ:")
0869                                 targetDELabel.text = xi18n("AL:")
0870                                 targetRAText.placeholderText = "DDD:MM:SS"
0871                                 if (targetRAText.text == "" ||
0872                                     targetDEText.text == "") {
0873                                     targetRAText.text = ""
0874                                     targetDEText.text = ""
0875                                 }
0876                                 else {
0877                                     if (coordGroup.lastChecked == 0)
0878                                         coordGroup.valid = mount.raDecToAzAlt(
0879                                             targetRAText.text, targetDEText.text)
0880                                     else
0881                                         coordGroup.valid = mount.haDecToAzAlt(
0882                                             targetRAText.text, targetDEText.text)
0883                                     if (!coordGroup.valid) {
0884                                         targetRAText.text = ""
0885                                         targetDEText.text = ""
0886                                     }
0887                                 }
0888                                 targetRAText.focus = false
0889                                 targetDEText.focus = false
0890                                 coordGroup.lastChecked = 1
0891                             }
0892                         }
0893                     }
0894 
0895                     RadioButton {
0896                         id: haEquatorialCheck
0897                         style:RadioButtonStyle{
0898                             label:Text{
0899                                 text: xi18n("HA/DE")
0900                                 renderType: Text.QtRendering
0901                                 color: "white"
0902                             }
0903                         }
0904                         exclusiveGroup: coordGroup
0905                         objectName: "haEquatorialCheckObject"
0906                         checked: false
0907                         onCheckedChanged: {
0908                             if (checked) {
0909                                 targetText.text = ""
0910                                 targetRALabel.text = xi18n("HA:")
0911                                 targetDELabel.text = xi18n("DE:")
0912                                 targetRAText.placeholderText = "HH:MM:SS"
0913                                 if (targetRAText.text == "" ||
0914                                     targetDEText.text == "") {
0915                                     targetRAText.text = ""
0916                                     targetDEText.text = ""
0917                                 }
0918                                 else {
0919                                     if (coordGroup.lastChecked == 1)
0920                                         coordGroup.valid = mount.azAltToHaDec(
0921                                             targetRAText.text, targetDEText.text)
0922                                     else
0923                                         coordGroup.valid = mount.raDecToHaDec(
0924                                             targetRAText.text)
0925                                     if (!coordGroup.valid) {
0926                                         targetRAText.text = ""
0927                                         targetDEText.text = ""
0928                                     }
0929                                 }
0930                                 targetRAText.focus = false
0931                                 targetDEText.focus = false
0932                                 coordGroup.lastChecked = 2
0933                             }
0934                         }
0935                     }
0936                 }
0937 
0938                 Label {
0939                     id: epochLabel
0940                     text: xi18n("Epoch:")
0941                     renderType: Text.QtRendering
0942                 }
0943 
0944                 RowLayout
0945                 {
0946                     ExclusiveGroup { id: epochGroup }
0947 
0948                     RadioButton {
0949                         id: jnowCheck
0950                         objectName: "jnowCheckObject"
0951                         checked: true
0952                         style:RadioButtonStyle{
0953                             label:Text{
0954                                 text: xi18n("JNow")
0955                                 renderType: Text.QtRendering
0956                                 color: "white"
0957                             }
0958                         }
0959                         exclusiveGroup: epochGroup
0960                     }
0961 
0962                     RadioButton {
0963                         id: j2000Check
0964                         objectName: "j2000CheckObject"
0965                         style:RadioButtonStyle{
0966                             label:Text{
0967                                 text: xi18n("J2000")
0968                                 renderType: Text.QtRendering
0969                                 color: "white"
0970                             }
0971                         }
0972                         exclusiveGroup: epochGroup
0973                     }
0974                 }
0975             }
0976 
0977             GridLayout {
0978                 id: actionLayout
0979                 Layout.fillHeight: false
0980                 Layout.fillWidth: true
0981                 Layout.alignment: Qt.AlignHCenter
0982                 columns: 2
0983 
0984                 Button {
0985                     id: gotoButton
0986                     objectName: "gotoButtonObject"
0987                     text: xi18n("GOTO")
0988                     Layout.fillWidth: true
0989 
0990                     onClicked:
0991                     {
0992                         mount.slew(targetRAText.text, targetDEText.text);
0993                         mountMotionLayout.focus = true;
0994                     }
0995                 }
0996 
0997                 Button {
0998                     id: syncButton
0999                     objectName: "syncButtonObject"
1000                     text: xi18n("SYNC")
1001                     Layout.fillWidth: true
1002 
1003                     onClicked:
1004                     {
1005                         mount.sync(targetRAText.text, targetDEText.text);
1006                         mountMotionLayout.focus = true;
1007                     }
1008                 }
1009 
1010                 Button {
1011                     id: parkButton
1012                     objectName: "parkButtonObject"
1013                     text: xi18n("PARK")
1014                     Layout.fillWidth: true
1015 
1016                     onClicked:
1017                     {
1018                         mount.park()
1019                     }
1020                 }
1021 
1022                 Button {
1023                     id: unparkButton
1024                     objectName: "unparkButtonObject"
1025                     text: xi18n("UNPARK")
1026                     Layout.fillWidth: true
1027 
1028                     onClicked:
1029                     {
1030                         mount.unpark()
1031                     }
1032                 }
1033             }
1034 
1035             RowLayout {
1036                 id: statusLayout
1037                 Layout.fillHeight: false
1038                 Layout.fillWidth: true
1039                 Layout.alignment: Qt.AlignHCenter
1040 
1041                 Label {
1042                     id: statusLabel
1043                     color: "#ffffff"
1044                     text: xi18n("Status:")
1045                     renderType: Text.QtRendering
1046                     font.pointSize: 12
1047                     font.bold: true
1048                 }
1049 
1050                 Label {
1051                     id: statusText
1052                     objectName: "statusTextObject"
1053                     color: "#ffffff"
1054                     text: xi18n("Idle")
1055                     renderType: Text.QtRendering
1056                     Layout.fillWidth: true
1057                     Layout.minimumWidth: fontMetrics.height * 5
1058                     font.pointSize: 12
1059                     font.bold: true
1060                 }
1061 
1062                 Button {
1063                     id: centerMount
1064                     Layout.minimumWidth: fontMetrics.height * 1.4
1065                     Layout.minimumHeight: fontMetrics.height * 1.4
1066                     iconName: "crosshairs"
1067 
1068                     onClicked:
1069                     {
1070                         mount.centerMount()
1071                     }
1072                 }
1073             }
1074         }
1075     }
1076 }
1077 
1078 /*##^##
1079 Designer {
1080     D{i:0;autoSize:true;height:480;width:640}
1081 }
1082 ##^##*/