Kstars

opsguide.cpp
1 /*
2  SPDX-FileCopyrightText: 2003 Jasem Mutlaq <[email protected]>
3 
4  SPDX-License-Identifier: GPL-2.0-or-later
5 */
6 
7 #include "opsguide.h"
8 
9 #include "Options.h"
10 #include "kstars.h"
11 #include "auxiliary/ksnotification.h"
12 #include "internalguide/internalguider.h"
13 
14 #include <KConfigDialog>
15 
16 #include <QCheckBox>
17 #include <QComboBox>
18 #include <QFileDialog>
19 #include <QPushButton>
20 #include <QStringList>
21 
22 namespace Ekos
23 {
24 OpsGuide::OpsGuide() : QFrame(KStars::Instance())
25 {
26  setupUi(this);
27 
28  //Get a pointer to the KConfigDialog
29  m_ConfigDialog = KConfigDialog::exists("guidesettings");
30 
31  editGuideProfile->setIcon(QIcon::fromTheme("document-edit"));
32  editGuideProfile->setAttribute(Qt::WA_LayoutUsesWidgetRect);
33 
34  connect(editGuideProfile, &QAbstractButton::clicked, this, [this]()
35  {
36  KConfigDialog *optionsEditor = new KConfigDialog(this, "OptionsProfileEditor", Options::self());
37  optionsProfileEditor = new StellarSolverProfileEditor(this, Ekos::GuideProfiles, optionsEditor);
38 #ifdef Q_OS_OSX
40 #endif
41  KPageWidgetItem *mainPage = optionsEditor->addPage(optionsProfileEditor, i18n("Guide Options Profile Editor"));
42  mainPage->setIcon(QIcon::fromTheme("configure"));
43  connect(optionsProfileEditor, &StellarSolverProfileEditor::optionsProfilesUpdated, this, &OpsGuide::loadOptionsProfiles);
44  optionsProfileEditor->loadProfile(kcfg_GuideOptionsProfile->currentIndex());
45  optionsEditor->show();
46  });
47 
48  loadOptionsProfiles();
49 
50  connect(m_ConfigDialog, SIGNAL(settingsChanged(QString)), this, SIGNAL(settingsUpdated()));
51 
52 }
53 
54 void OpsGuide::loadOptionsProfiles()
55 {
56  QString savedOptionsProfiles = QDir(KSPaths::writableLocation(QStandardPaths::AppLocalDataLocation)).filePath("SavedGuideProfiles.ini");
57  if(QFile(savedOptionsProfiles).exists())
58  optionsList = StellarSolver::loadSavedOptionsProfiles(savedOptionsProfiles);
59  else
60  optionsList = getDefaultGuideOptionsProfiles();
61  kcfg_GuideOptionsProfile->clear();
62  for(SSolver::Parameters param : optionsList)
63  kcfg_GuideOptionsProfile->addItem(param.listName);
64  kcfg_GuideOptionsProfile->setCurrentIndex(Options::guideOptionsProfile());
65 }
66 }
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)
void setIcon(const QIcon &icon)
QString i18n(const char *text, const TYPE &arg...)
void setWindowFlags(Qt::WindowFlags type)
KPageWidgetItem * addPage(QWidget *page, const QString &itemName, const QString &pixmapName=QString(), const QString &header=QString(), bool manage=true)
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)
void show()
QString filePath(const QString &fileName) const const
WA_LayoutUsesWidgetRect
This file is part of the KDE documentation.
Documentation copyright © 1996-2022 The KDE developers.
Generated on Fri Aug 12 2022 04:00:56 by doxygen 1.8.17 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.