Kstars

opsguide.cpp
1/*
2 SPDX-FileCopyrightText: 2003 Jasem Mutlaq <mutlaqja@ikarustech.com>
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#include "ekos/auxiliary/stellarsolverprofileeditor.h"
14#include "kspaths.h"
15
16#include <KConfigDialog>
17
18#include <QCheckBox>
19#include <QComboBox>
20#include <QFileDialog>
21#include <QPushButton>
22#include <QStringList>
23
24namespace Ekos
25{
26OpsGuide::OpsGuide() : QFrame(KStars::Instance())
27{
28 setupUi(this);
29
30 //Get a pointer to the KConfigDialog
31 m_ConfigDialog = KConfigDialog::exists("guidesettings");
32
33 editGuideProfile->setIcon(QIcon::fromTheme("document-edit"));
34 editGuideProfile->setAttribute(Qt::WA_LayoutUsesWidgetRect);
35
36 connect(editGuideProfile, &QAbstractButton::clicked, this, [this]()
37 {
38 KConfigDialog *optionsEditor = new KConfigDialog(this, "OptionsProfileEditor", Options::self());
39 optionsProfileEditor = new StellarSolverProfileEditor(this, Ekos::GuideProfiles, optionsEditor);
40#ifdef Q_OS_MACOS
42#endif
43 KPageWidgetItem *mainPage = optionsEditor->addPage(optionsProfileEditor, i18n("Guide Options Profile Editor"));
44 mainPage->setIcon(QIcon::fromTheme("configure"));
45 connect(optionsProfileEditor, &StellarSolverProfileEditor::optionsProfilesUpdated, this, &OpsGuide::loadOptionsProfiles);
46 optionsProfileEditor->loadProfile(kcfg_GuideOptionsProfile->currentText());
47 optionsEditor->show();
48 });
49
50 loadOptionsProfiles();
51
52 connect(m_ConfigDialog, &KConfigDialog::settingsChanged, this, &OpsGuide::settingsUpdated);
53
54}
55
56void OpsGuide::loadOptionsProfiles()
57{
58 QString savedOptionsProfiles = QDir(KSPaths::writableLocation(
59 QStandardPaths::AppLocalDataLocation)).filePath("SavedGuideProfiles.ini");
60 if(QFile(savedOptionsProfiles).exists())
61 optionsList = StellarSolver::loadSavedOptionsProfiles(savedOptionsProfiles);
62 else
63 optionsList = getDefaultGuideOptionsProfiles();
64 kcfg_GuideOptionsProfile->clear();
65 for(SSolver::Parameters param : optionsList)
66 kcfg_GuideOptionsProfile->addItem(param.listName);
67 kcfg_GuideOptionsProfile->setCurrentIndex(Options::guideOptionsProfile());
68}
69}
KPageWidgetItem * addPage(QWidget *page, const QString &itemName, const QString &pixmapName=QString(), const QString &header=QString(), bool manage=true)
static KConfigDialog * exists(const QString &name)
void settingsChanged(const QString &dialogName)
void setIcon(const QIcon &icon)
This is the main window for KStars.
Definition kstars.h:89
QString i18n(const char *text, const TYPE &arg...)
Ekos is an advanced Astrophotography tool for Linux.
Definition align.cpp:83
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)
void show()
void setWindowFlags(Qt::WindowFlags type)
This file is part of the KDE documentation.
Documentation copyright © 1996-2024 The KDE developers.
Generated on Mon Nov 18 2024 12:16:40 by doxygen 1.12.0 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.