Kstars

opsalign.cpp
1 /*
2  SPDX-FileCopyrightText: 2017 Jasem Mutlaq <[email protected]>
3  SPDX-FileCopyrightText: 2017 Robert Lancaster <[email protected]>
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 
21 namespace Ekos
22 {
23 OpsAlign::OpsAlign(Align *parent) : QWidget(KStars::Instance())
24 {
25  setupUi(this);
26 
27  alignModule = parent;
28 
29  //Get a pointer to the KConfigDialog
30  m_ConfigDialog = KConfigDialog::exists("alignsettings");
31 
32  editSolverProfile->setIcon(QIcon::fromTheme("document-edit"));
33  editSolverProfile->setAttribute(Qt::WA_LayoutUsesWidgetRect);
34  connect(editSolverProfile, &QAbstractButton::clicked, this, [this]
35  {
36  emit needToLoadProfile(kcfg_SolveOptionsProfile->currentIndex());
37  });
38 
39  reloadOptionsProfiles();
40 
41  connect(m_ConfigDialog->button(QDialogButtonBox::Apply), SIGNAL(clicked()), SLOT(slotApply()));
42  connect(m_ConfigDialog->button(QDialogButtonBox::Ok), SIGNAL(clicked()), SLOT(slotApply()));
43 }
44 
45 void OpsAlign::reloadOptionsProfiles()
46 {
47  QString savedOptionsProfiles = QDir(KSPaths::writableLocation(
48  QStandardPaths::AppLocalDataLocation)).filePath("SavedAlignProfiles.ini");
49 
50  if(QFile(savedOptionsProfiles).exists())
51  optionsList = StellarSolver::loadSavedOptionsProfiles(savedOptionsProfiles);
52  else
53  optionsList = getDefaultAlignOptionsProfiles();
54  int currentIndex = kcfg_SolveOptionsProfile->currentIndex();
55  kcfg_SolveOptionsProfile->clear();
56  for(auto &param : optionsList)
57  kcfg_SolveOptionsProfile->addItem(param.listName);
58 
59  if (currentIndex >= 0)
60  {
61  kcfg_SolveOptionsProfile->setCurrentIndex(currentIndex);
62  Options::setSolveOptionsProfile(currentIndex);
63  }
64  else
65  kcfg_SolveOptionsProfile->setCurrentIndex(Options::solveOptionsProfile());
66 }
67 
68 void OpsAlign::slotApply()
69 {
70  emit settingsUpdated();
71 }
72 }
Ekos is an advanced Astrophotography tool for Linux. It is based on a modular extensible framework to...
Definition: align.cpp:70
void clicked(bool checked)
QIcon fromTheme(const QString &name)
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:92
void setupUi(QWidget *widget)
QString filePath(const QString &fileName) const const
QObject * parent() const const
WA_LayoutUsesWidgetRect
This file is part of the KDE documentation.
Documentation copyright © 1996-2022 The KDE developers.
Generated on Tue Aug 9 2022 04:06:05 by doxygen 1.8.17 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.