Kstars

opsalign.cpp
1/*
2 SPDX-FileCopyrightText: 2017 Jasem Mutlaq <mutlaqja@ikarustech.com>
3 SPDX-FileCopyrightText: 2017 Robert Lancaster <rlancaste@gmail.com>
4
5 SPDX-License-Identifier: GPL-2.0-or-later
6*/
7
8#include "opsalign.h"
9
10#include "align.h"
11#include "fov.h"
12#include "kstars.h"
13#include "ksnotification.h"
14#include "Options.h"
15#include "kspaths.h"
16#include "ekos/auxiliary/stellarsolverprofile.h"
17
18#include <KConfigDialog>
19#include <QProcess>
20#include <ekos_align_debug.h>
21
22namespace Ekos
23{
24OpsAlign::OpsAlign(Align *parent) : QWidget(KStars::Instance())
25{
26 setupUi(this);
27
28 alignModule = parent;
29
30 //Get a pointer to the KConfigDialog
31 m_ConfigDialog = KConfigDialog::exists("alignsettings");
32
33 editSolverProfile->setIcon(QIcon::fromTheme("document-edit"));
36 {
37 emit needToLoadProfile(kcfg_SolveOptionsProfile->currentText());
38 });
39
40 reloadOptionsProfiles();
41
42 connect(m_ConfigDialog->button(QDialogButtonBox::Apply), SIGNAL(clicked()), SLOT(slotApply()));
43 connect(m_ConfigDialog->button(QDialogButtonBox::Cancel), SIGNAL(clicked()), SLOT(slotApply()));
44 connect(m_ConfigDialog->button(QDialogButtonBox::Ok), SIGNAL(clicked()), SLOT(slotApply()));
45}
46
47void OpsAlign::setFlipPolicy(const Ekos::OpsAlign::FlipPriority Priority)
48{
49 if (Priority == Ekos::OpsAlign::ROTATOR_ANGLE)
50 kcfg_AstrometryFlipRotationAllowed->setChecked(true);
51 else if (Priority == Ekos::OpsAlign::POSITION_ANGLE)
52 FlipRotationNotAllowed->setChecked(true);
53 OpsAlign::update();
54 emit m_ConfigDialog->button(QDialogButtonBox::Apply)->click();
55}
56
57void OpsAlign::reloadOptionsProfiles()
58{
59 QString savedOptionsProfiles = QDir(KSPaths::writableLocation(
60 QStandardPaths::AppLocalDataLocation)).filePath("SavedAlignProfiles.ini");
61
62 if(QFile(savedOptionsProfiles).exists())
63 optionsList = StellarSolver::loadSavedOptionsProfiles(savedOptionsProfiles);
64 else
65 optionsList = getDefaultAlignOptionsProfiles();
66 int currentIndex = kcfg_SolveOptionsProfile->currentIndex();
68 for(auto &param : optionsList)
70
71 if (currentIndex >= 0)
72 {
73 kcfg_SolveOptionsProfile->setCurrentIndex(currentIndex);
74 Options::setSolveOptionsProfile(currentIndex);
75 }
76 else
77 kcfg_SolveOptionsProfile->setCurrentIndex(Options::solveOptionsProfile());
78}
79
80void OpsAlign::slotApply()
81{
82 emit settingsUpdated();
83}
84}
static KConfigDialog * exists(const QString &name)
This is the main window for KStars.
Definition kstars.h:91
Ekos is an advanced Astrophotography tool for Linux.
Definition align.cpp:79
void clicked(bool checked)
QString filePath(const QString &fileName) const const
QIcon fromTheme(const QString &name)
WA_LayoutUsesWidgetRect
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 Fri May 24 2024 11:49:21 by doxygen 1.10.0 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.