File indexing completed on 2024-05-12 07:36:25
0001 /* 0002 SPDX-FileCopyrightText: 2003 Jasem Mutlaq <mutlaqja@ikarustech.com> 0003 0004 SPDX-License-Identifier: GPL-2.0-or-later 0005 */ 0006 0007 #include "opscalibration.h" 0008 0009 #include "guide.h" 0010 #include "kstars.h" 0011 #include "Options.h" 0012 #include "internalguide/internalguider.h" 0013 #include "internalguide/calibration.h" 0014 0015 #include <QPushButton> 0016 #include <QFileDialog> 0017 #include <QCheckBox> 0018 #include <QStringList> 0019 #include <QComboBox> 0020 0021 #include <KConfigDialog> 0022 0023 namespace Ekos 0024 { 0025 OpsCalibration::OpsCalibration(InternalGuider *guiderObject) : QFrame(KStars::Instance()) 0026 { 0027 setupUi(this); 0028 0029 guider = guiderObject; 0030 0031 //Get a pointer to the KConfigDialog 0032 m_ConfigDialog = KConfigDialog::exists("guidesettings"); 0033 0034 connect(m_ConfigDialog->button(QDialogButtonBox::Apply), SIGNAL(clicked()), SLOT(slotApply())); 0035 connect(m_ConfigDialog->button(QDialogButtonBox::Ok), SIGNAL(clicked()), SLOT(slotApply())); 0036 } 0037 0038 void OpsCalibration::showEvent(QShowEvent *) 0039 { 0040 double x, y; 0041 guider->getReticleParameters(&x, &y); 0042 0043 spinBox_ReticleX->setValue(x); 0044 spinBox_ReticleY->setValue(y); 0045 0046 uint16_t subX, subY, subW, subH, subBinX, subBinY; 0047 guider->getFrameParams(&subX, &subY, &subW, &subH, &subBinX, &subBinY); 0048 0049 spinBox_ReticleX->setMaximum(subW); 0050 spinBox_ReticleY->setMaximum(subH); 0051 0052 auto cal = guider->getCalibration(); 0053 if (cal.isInitialized()) 0054 { 0055 ra_cal_degrees->setText(QString::number(cal.getRAAngle(), 'f', 1)); 0056 ra_cal_mspp->setText(QString::number(cal.raPulseMillisecondsPerArcsecond(), 'f', 1)); 0057 dec_cal_degrees->setText(QString::number(cal.getDECAngle(), 'f', 1)); 0058 dec_cal_mspp->setText(QString::number(cal.decPulseMillisecondsPerArcsecond(), 'f', 1)); 0059 dec_cal_degrees_unit->setText( 0060 cal.declinationSwapEnabled() ? "degrees (swapped)" : "degrees"); 0061 } 0062 else 0063 { 0064 ra_cal_degrees->setText("xxxx"); 0065 ra_cal_mspp->setText("xxxx"); 0066 dec_cal_degrees->setText("xxxx"); 0067 dec_cal_degrees_unit->setText("degrees"); 0068 dec_cal_mspp->setText("xxxx"); 0069 } 0070 } 0071 0072 void OpsCalibration::slotApply() 0073 { 0074 // HY (7/12/20): 0075 // This can be an issue if the window is opened and then the reticle changes, e.g. 0076 // if the options window is opened before guiding starts! 0077 // I've seen a few other random unintended changes of the reticle when setting other params. 0078 // Commenting it out. 0079 // guider->setReticleParameters(spinBox_ReticleX->value(), spinBox_ReticleY->value()); 0080 } 0081 }