Kstars

manualpulse.cpp
1/*
2 SPDX-FileCopyrightText: 2023 Jasem Mutlaq <mutlaqja@ikarustech.com>
3
4 SPDX-License-Identifier: GPL-2.0-or-later
5*/
6
7#include "manualpulse.h"
8
9namespace Ekos
10{
11ManualPulse::ManualPulse(QWidget *parent) : QDialog(parent)
12{
13 setupUi(this);
14
15 connect(northPulseB, &QPushButton::clicked, this, [this]()
16 {
17 emit newSinglePulse(DEC_INC_DIR, pulseDuration->value(), DontCaptureAfterPulses);
18 northPulseB->setEnabled(false);
19 QTimer::singleShot(pulseDuration->value(), this, [this]()
20 {
21 northPulseB->setEnabled(true);
22 });
23 });
24
25 connect(southPulseB, &QPushButton::clicked, this, [this]()
26 {
27 emit newSinglePulse(DEC_DEC_DIR, pulseDuration->value(), DontCaptureAfterPulses);
28 southPulseB->setEnabled(false);
29 QTimer::singleShot(pulseDuration->value(), this, [this]()
30 {
31 southPulseB->setEnabled(true);
32 });
33 });
34
35 connect(westPulseB, &QPushButton::clicked, this, [this]()
36 {
37 emit newSinglePulse(RA_INC_DIR, pulseDuration->value(), DontCaptureAfterPulses);
38 westPulseB->setEnabled(false);
39 QTimer::singleShot(pulseDuration->value(), this, [this]()
40 {
41 westPulseB->setEnabled(true);
42 });
43 });
44
45 connect(eastPulseB, &QPushButton::clicked, this, [this]()
46 {
47 emit newSinglePulse(RA_DEC_DIR, pulseDuration->value(), DontCaptureAfterPulses);
48 eastPulseB->setEnabled(false);
49 QTimer::singleShot(pulseDuration->value(), this, [this]()
50 {
51 eastPulseB->setEnabled(true);
52 });
53 });
54
55 connect(resetB, &QPushButton::clicked, this, &ManualPulse::reset);
56}
57
58void ManualPulse::reset()
59{
60 m_LastCoord = SkyPoint();
61 raOffset->setText("0");
62 raOffset->setStyleSheet(QString());
63 deOffset->setText("0");
64 deOffset->setStyleSheet(QString());
65}
66
67void ManualPulse::setMountCoords(const SkyPoint &position)
68{
69 if (m_LastCoord.ra().Degrees() < 0)
70 {
71 m_LastCoord = position;
72 return;
73 }
74
75 auto raDiff = position.ra().deltaAngle(m_LastCoord.ra()).Degrees() * 3600;
76 auto deDiff = position.dec().deltaAngle(m_LastCoord.dec()).Degrees() * 3600;
77
78 if (raDiff > 0)
79 raOffset->setStyleSheet("color:green");
80 else if (raDiff < 0)
81 raOffset->setStyleSheet("color:red");
82
83 if (deDiff > 0)
84 deOffset->setStyleSheet("color:green");
85 else if (deDiff < 0)
86 deOffset->setStyleSheet("color:red");
87
88 raOffset->setText(QString::number(raDiff, 'f', 2));
89 deOffset->setText(QString::number(deDiff, 'f', 2));
90}
91}
The sky coordinates of a point in the sky.
Definition skypoint.h:45
const CachingDms & dec() const
Definition skypoint.h:269
const CachingDms & ra() const
Definition skypoint.h:263
const dms deltaAngle(dms angle) const
deltaAngle Return the shortest difference (path) between this angle and the supplied angle.
Definition dms.cpp:267
const double & Degrees() const
Definition dms.h:141
Ekos is an advanced Astrophotography tool for Linux.
Definition align.cpp:83
void clicked(bool checked)
QString number(double n, char format, int precision)
QFuture< ArgsType< Signal > > connect(Sender *sender, Signal signal)
This file is part of the KDE documentation.
Documentation copyright © 1996-2024 The KDE developers.
Generated on Mon Nov 18 2024 12:16:40 by doxygen 1.12.0 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.