Kstars

opscalibration.cpp
1 /*
2  SPDX-FileCopyrightText: 2003 Jasem Mutlaq <[email protected]>
3 
4  SPDX-License-Identifier: GPL-2.0-or-later
5 */
6 
7 #include "opscalibration.h"
8 
9 #include "guide.h"
10 #include "kstars.h"
11 #include "Options.h"
12 #include "internalguide/internalguider.h"
13 #include "internalguide/calibration.h"
14 
15 #include <QPushButton>
16 #include <QFileDialog>
17 #include <QCheckBox>
18 #include <QStringList>
19 #include <QComboBox>
20 
21 #include <KConfigDialog>
22 
23 namespace Ekos
24 {
25 OpsCalibration::OpsCalibration(InternalGuider *guiderObject) : QFrame(KStars::Instance())
26 {
27  setupUi(this);
28 
29  guider = guiderObject;
30 
31  //Get a pointer to the KConfigDialog
32  m_ConfigDialog = KConfigDialog::exists("guidesettings");
33 
34  connect(m_ConfigDialog->button(QDialogButtonBox::Apply), SIGNAL(clicked()), SLOT(slotApply()));
35  connect(m_ConfigDialog->button(QDialogButtonBox::Ok), SIGNAL(clicked()), SLOT(slotApply()));
36 }
37 
38 void OpsCalibration::showEvent(QShowEvent *)
39 {
40  double x, y;
41  guider->getReticleParameters(&x, &y);
42 
43  spinBox_ReticleX->setValue(x);
44  spinBox_ReticleY->setValue(y);
45 
46  uint16_t subX, subY, subW, subH, subBinX, subBinY;
47  guider->getFrameParams(&subX, &subY, &subW, &subH, &subBinX, &subBinY);
48 
49  spinBox_ReticleX->setMaximum(subW);
50  spinBox_ReticleY->setMaximum(subH);
51 
52  auto cal = guider->getCalibration();
53  if (cal.isInitialized())
54  {
55  ra_cal_degrees->setText(QString::number(cal.getRAAngle(), 'f', 1));
56  ra_cal_mspp->setText(QString::number(cal.raPulseMillisecondsPerArcsecond(), 'f', 1));
57  dec_cal_degrees->setText(QString::number(cal.getDECAngle(), 'f', 1));
58  dec_cal_mspp->setText(QString::number(cal.decPulseMillisecondsPerArcsecond(), 'f', 1));
59  dec_cal_degrees_unit->setText(
60  cal.declinationSwapEnabled() ? "degrees (swapped)" : "degrees");
61  }
62  else
63  {
64  ra_cal_degrees->setText("xxxx");
65  ra_cal_mspp->setText("xxxx");
66  dec_cal_degrees->setText("xxxx");
67  dec_cal_degrees_unit->setText("degrees");
68  dec_cal_mspp->setText("xxxx");
69  }
70 }
71 
72 void OpsCalibration::slotApply()
73 {
74  // HY (7/12/20):
75  // This can be an issue if the window is opened and then the reticle changes, e.g.
76  // if the options window is opened before guiding starts!
77  // I've seen a few other random unintended changes of the reticle when setting other params.
78  // Commenting it out.
79  // guider->setReticleParameters(spinBox_ReticleX->value(), spinBox_ReticleY->value());
80 }
81 }
QString number(int n, int base)
Ekos is an advanced Astrophotography tool for Linux. It is based on a modular extensible framework to...
Definition: align.cpp:76
QMetaObject::Connection connect(const QObject *sender, const char *signal, const QObject *receiver, const char *method, Qt::ConnectionType type)
static KConfigDialog * exists(const QString &name)
This is the main window for KStars. In addition to the GUI elements, the class contains the program c...
Definition: kstars.h:90
void setupUi(QWidget *widget)
This file is part of the KDE documentation.
Documentation copyright © 1996-2023 The KDE developers.
Generated on Mon Dec 11 2023 04:03:20 by doxygen 1.8.17 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.