Kstars

opsimageoverlay.cpp
1/*
2 SPDX-FileCopyrightText: 2023 Hy Murveit <hy@murveit.com>
3
4 SPDX-License-Identifier: GPL-2.0-or-later
5*/
6
7#include "opsimageoverlay.h"
8
9#include "ekos/auxiliary/stellarsolverprofileeditor.h"
10#include "ksfilereader.h"
11#include "kspaths.h"
12#include "kstars.h"
13#include "kstarsdata.h"
14#include "Options.h"
15#include "skymap.h"
16#include "skycomponents/skymapcomposite.h"
17#include "skycomponents/imageoverlaycomponent.h"
18
19#include <KConfigDialog>
20
21#include <QPushButton>
22#include <QFileDialog>
23#include <QPushButton>
24#include <QDesktopServices>
25
26OpsImageOverlay::OpsImageOverlay() : QFrame(KStars::Instance())
27{
28 setupUi(this);
29
30 m_ConfigDialog = KConfigDialog::exists("settings");
31
32 connect(m_ConfigDialog->button(QDialogButtonBox::Apply), SIGNAL(clicked()), SLOT(slotApply()));
33 connect(m_ConfigDialog->button(QDialogButtonBox::Ok), SIGNAL(clicked()), SLOT(slotApply()));
34
36 KStarsData::Instance()->skyComposite()->imageOverlay());
37 connect(solveButton, &QPushButton::clicked, overlayComponent, &ImageOverlayComponent::startSolving,
39 connect(refreshB, &QPushButton::clicked, overlayComponent, &ImageOverlayComponent::reload,
42 {
43 Options::setShowImageOverlays(state);
44 });
46 {
47 Options::setShowSelectedImageOverlay(state);
48 });
50 {
51 Options::setShowImageOverlaysBelowCatalogs(state);
52 });
54 {
55 Options::setImageOverlayMaxDimension(value);
56 });
58 {
59 Options::setImageOverlayTimeout(value);
60 });
62 {
63 Options::setImageOverlayDefaultScale(value);
64 });
66 {
67 QDesktopServices::openUrl(QUrl::fromLocalFile(QDir(KSPaths::writableLocation(
68 QStandardPaths::AppLocalDataLocation)).filePath("imageOverlays")));
69 });
70
71 editAlignProfile->setIcon(QIcon::fromTheme("document-edit"));
73
74 KConfigDialog * m_EditorDialog = new KConfigDialog(this, "imageOverlayProfileEditor", Options::self());
75 m_ProfileEditor.reset(new Ekos::StellarSolverProfileEditor(this, Ekos::AlignProfiles, m_EditorDialog));
76 KPageWidgetItem *page = m_EditorDialog->addPage(m_ProfileEditor.get(), i18n("Image Overlay Align Options Profiles Editor"));
77
79 {
80 m_ProfileEditor->loadProfile(imageOverlaySolverProfile->currentText());
81 KConfigDialog * d = KConfigDialog::exists("imageOverlayProfileEditor");
82 if(d)
83 {
84 d->setCurrentPage(page);
85 d->show();
86 }
87 });
88
89 syncOptions();
90}
91
92QTableWidget *OpsImageOverlay::table ()
93{
94 return imageOverlayTable;
95}
96
97QGroupBox *OpsImageOverlay::tableTitleBox()
98{
100}
101
102QPlainTextEdit *OpsImageOverlay::statusDisplay ()
103{
104 return imageOverlayStatus;
105}
106
107QPushButton *OpsImageOverlay::solvePushButton ()
108{
109 return solveButton;
110}
111QComboBox *OpsImageOverlay::solverProfile ()
112{
114}
115
116void OpsImageOverlay::syncOptions()
117{
118 kcfg_ShowImageOverlays->setChecked(Options::showImageOverlays());
119 kcfg_ImageOverlayMaxDimension->setValue(Options::imageOverlayMaxDimension());
120 kcfg_ImageOverlayTimeout->setValue(Options::imageOverlayTimeout());
121 kcfg_ImageOverlayDefaultScale->setValue(Options::imageOverlayDefaultScale());
122}
123
124void OpsImageOverlay::slotApply()
125{
126 KStarsData *data = KStarsData::Instance();
127 SkyMap *map = SkyMap::Instance();
128
129 data->setFullTimeUpdate();
130 KStars::Instance()->updateTime();
131 map->forceUpdate();
132}
Represents the ImageOverlay overlay.
KPageWidgetItem * addPage(QWidget *page, const QString &itemName, const QString &pixmapName=QString(), const QString &header=QString(), bool manage=true)
static KConfigDialog * exists(const QString &name)
KStarsData is the backbone of KStars.
Definition kstarsdata.h:72
void setFullTimeUpdate()
The Sky is updated more frequently than the moon, which is updated more frequently than the planets.
This is the main window for KStars.
Definition kstars.h:91
static KStars * Instance()
Definition kstars.h:123
This is the canvas on which the sky is painted.
Definition skymap.h:54
QString i18n(const char *text, const TYPE &arg...)
void clicked(bool checked)
void stateChanged(int state)
bool openUrl(const QUrl &url)
void valueChanged(double d)
QIcon fromTheme(const QString &name)
void valueChanged(int i)
UniqueConnection
WA_LayoutUsesWidgetRect
QFuture< void > map(Iterator begin, Iterator end, MapFunctor &&function)
QFuture< ArgsType< Signal > > connect(Sender *sender, Signal signal)
QUrl fromLocalFile(const QString &localFile)
This file is part of the KDE documentation.
Documentation copyright © 1996-2024 The KDE developers.
Generated on Fri May 3 2024 11:49:52 by doxygen 1.10.0 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.