File indexing completed on 2024-04-28 15:09:03

0001 /*
0002     SPDX-FileCopyrightText: 2017 Jasem Mutlaq <mutlaqja@ikarustech.com>
0003     SPDX-FileCopyrightText: 2017 Robert Lancaster <rlancaste@gmail.com>
0004 
0005     SPDX-License-Identifier: GPL-2.0-or-later
0006 */
0007 
0008 #include "opsprograms.h"
0009 
0010 #include "align.h"
0011 #include "fov.h"
0012 #include "kstars.h"
0013 #include "ksnotification.h"
0014 #include "Options.h"
0015 
0016 #include <stellarsolver.h>
0017 #include <KConfigDialog>
0018 #include <QProcess>
0019 
0020 namespace Ekos
0021 {
0022 OpsPrograms::OpsPrograms(Align *parent) : QWidget(KStars::Instance())
0023 {
0024     setupUi(this);
0025 
0026     alignModule = parent;
0027 
0028     connect(defaultPathSelector, static_cast<void (QComboBox::*)(int)>(&QComboBox::currentIndexChanged), this,
0029             &OpsPrograms::loadDefaultPaths);
0030 
0031     //Get a pointer to the KConfigDialog
0032     m_ConfigDialog = KConfigDialog::exists("alignsettings");
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 
0039 void OpsPrograms::slotApply()
0040 {
0041     emit settingsUpdated();
0042 }
0043 
0044 void OpsPrograms::loadDefaultPaths(int option)
0045 {
0046     if(option == 0)
0047         return;
0048     ExternalProgramPaths paths = StellarSolver::getDefaultExternalPaths((SSolver::ComputerSystemType) (option - 1));
0049 
0050     kcfg_SextractorBinary->setText(paths.sextractorBinaryPath);
0051     kcfg_AstrometryConfFile->setText(paths.confPath);
0052     kcfg_AstrometrySolverBinary->setText(paths.solverPath);
0053     kcfg_ASTAPExecutable->setText(paths.astapBinaryPath);
0054     kcfg_WatneyBinary->setText(paths.watneyBinaryPath);
0055     kcfg_AstrometryWCSInfo->setText(paths.wcsPath);
0056 
0057     defaultPathSelector->setCurrentIndex(0);
0058 }
0059 }