Kstars

opsfits.cpp
1/*
2 SPDX-FileCopyrightText: 2017 Jasem Mutlaq <mutlaqja@ikarustech.com>
3
4 SPDX-License-Identifier: GPL-2.0-or-later
5*/
6
7#include "opsfits.h"
8
9#include "Options.h"
10#include "kstars.h"
11#include "kstarsdata.h"
12
13#ifdef HAVE_STELLARSOLVER
14#include "kspaths.h"
15#include "ekos/auxiliary/stellarsolverprofile.h"
16#include <stellarsolver.h>
17#endif
18
19OpsFITS::OpsFITS() : QFrame(KStars::Instance())
20{
21 setupUi(this);
22
23 connect(kcfg_LimitedResourcesMode, &QCheckBox::toggled, this, [this](bool toggled)
24 {
25 if (toggled)
26 {
27 kcfg_Auto3DCube->setChecked(false);
28 kcfg_AutoDebayer->setChecked(false);
29 kcfg_AutoWCS->setChecked(false);
30 }
31 });
32 connect(kcfg_Auto3DCube, &QCheckBox::toggled, this, [this](bool toggled)
33 {
34 if (toggled)
35 kcfg_LimitedResourcesMode->setChecked(false);
36 });
37 connect(kcfg_AutoDebayer, &QCheckBox::toggled, this, [this](bool toggled)
38 {
39 if (toggled)
40 kcfg_LimitedResourcesMode->setChecked(false);
41 });
42 connect(kcfg_AutoWCS, &QCheckBox::toggled, this, [this](bool toggled)
43 {
44 if (toggled)
45 kcfg_LimitedResourcesMode->setChecked(false);
46 });
47 hipsOpacity->setValue(Options::hIPSOpacity() * 100);
48 connect(hipsOpacity, &QSlider::valueChanged, this, [](int value)
49 {
50 Options::setHIPSOpacity(value / 100.0);
51 });
52 hipsOffsetX->setValue(Options::hIPSOffsetX());
54 {
55 Options::setHIPSOffsetX(value);
56 });
58 {
59 Options::setHIPSOffsetY(value);
60 });
61
62#ifdef HAVE_STELLARSOLVER
64#else
65 editHfrProfile->setEnabled(false);
66 HfrOptionsProfiles->setEnabled(false);
67#endif
68}
69
70#ifdef HAVE_STELLARSOLVER
71
72void OpsFITS::loadStellarSolverProfiles()
73{
74 QString savedOptionsProfiles = QDir(KSPaths::writableLocation(
75 QStandardPaths::AppLocalDataLocation)).filePath("SavedHFRProfiles.ini");
76 if(QFile(savedOptionsProfiles).exists())
77 m_StellarSolverProfiles = StellarSolver::loadSavedOptionsProfiles(savedOptionsProfiles);
78 else
79 m_StellarSolverProfiles = Ekos::getDefaultHFROptionsProfiles();
80 HfrOptionsProfiles->clear();
81 for(auto param : m_StellarSolverProfiles)
83 HfrOptionsProfiles->setCurrentIndex(Options::hFROptionsProfile());
84}
85
86void OpsFITS::setupHFROptions()
87{
88 editHfrProfile->setEnabled(true);
89 HfrOptionsProfiles->setEnabled(true);
90
91 editHfrProfile->setIcon(QIcon::fromTheme("document-edit"));
93
95 {
96 KConfigDialog *optionsEditor = new KConfigDialog(this, "OptionsProfileEditor", Options::self());
97 optionsProfileEditor = new Ekos::StellarSolverProfileEditor(this, Ekos::HFRProfiles, optionsEditor);
98#ifdef Q_OS_OSX
100#endif
101 KPageWidgetItem *mainPage = optionsEditor->addPage(optionsProfileEditor, i18n("HFR Options Profile Editor"));
102 mainPage->setIcon(QIcon::fromTheme("configure"));
103 connect(optionsProfileEditor, &Ekos::StellarSolverProfileEditor::optionsProfilesUpdated, this,
104 &OpsFITS::loadStellarSolverProfiles);
105 optionsProfileEditor->loadProfile(HfrOptionsProfiles->currentText());
106 optionsEditor->show();
107 });
108
109 loadStellarSolverProfiles();
110
112 {
113 Options::setHFROptionsProfile(index);
114 });
115}
116
117#endif
This is the main window for KStars.
Definition kstars.h:91
QString i18n(const char *text, const TYPE &arg...)
void clicked(bool checked)
void toggled(bool checked)
void valueChanged(int value)
void activated(int index)
QString filePath(const QString &fileName) const const
QIcon fromTheme(const QString &name)
QMetaObject::Connection connect(const QObject *sender, PointerToMemberFunction signal, Functor functor)
void valueChanged(int i)
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:22 by doxygen 1.10.0 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.