Kstars

pwizfovsh.cpp
1 /*
2  SPDX-FileCopyrightText: 2011 Rafał Kułaga <[email protected]>
3 
4  SPDX-License-Identifier: GPL-2.0-or-later
5 */
6 
7 #include "pwizfovsh.h"
8 
9 #include "kstars.h"
10 #include "kstarsdata.h"
11 #include "pwizobjectselection.h"
12 #include "printingwizard.h"
13 #include "dialogs/finddialog.h"
14 #include "dialogs/detaildialog.h"
15 
16 #include <QPointer>
17 
18 PWizFovShUI::PWizFovShUI(PrintingWizard *wizard, QWidget *parent) : QFrame(parent), m_ParentWizard(wizard)
19 {
20  setupUi(this);
21 
22  setupWidgets();
23  setupConnections();
24 }
25 
27 {
28  m_ParentWizard->setShBeginObject(obj);
29  objInfoLabel->setText(PWizObjectSelectionUI::objectInfoString(obj));
30  objInfoLabel->setVisible(true);
31  detailsButton->setVisible(true);
32  captureButton->setEnabled(true);
33 }
34 
35 void PWizFovShUI::slotSelectFromList()
36 {
37  if (FindDialog::Instance()->exec() == QDialog::Accepted)
38  {
39  SkyObject *obj = FindDialog::Instance()->targetObject();
40  if (obj)
41  {
42  setBeginObject(obj);
43  }
44  }
45 }
46 
47 void PWizFovShUI::slotPointObject()
48 {
49  m_ParentWizard->beginShBeginPointing();
50 }
51 
52 void PWizFovShUI::slotDetails()
53 {
54  if (m_ParentWizard->getShBeginObject())
55  {
56  QPointer<DetailDialog> detailDlg(new DetailDialog(m_ParentWizard->getShBeginObject(),
57  KStars::Instance()->data()->ut(),
58  KStars::Instance()->data()->geo(), this));
59  detailDlg->exec();
60  delete detailDlg;
61  }
62 }
63 
64 void PWizFovShUI::slotBeginCapture()
65 {
66  m_ParentWizard->beginShFovCapture();
67 }
68 
69 void PWizFovShUI::setupWidgets()
70 {
71  QStringList fovNames;
72  foreach (FOV *fov, KStarsData::Instance()->getAvailableFOVs())
73  {
74  fovNames.append(fov->name());
75  }
76  fovCombo->addItems(fovNames);
77 
78  objInfoLabel->setVisible(false);
79  detailsButton->setVisible(false);
80  captureButton->setEnabled(false);
81 }
82 
83 void PWizFovShUI::setupConnections()
84 {
85  connect(selectFromListButton, SIGNAL(clicked()), this, SLOT(slotSelectFromList()));
86  connect(pointButton, SIGNAL(clicked()), this, SLOT(slotPointObject()));
87  connect(captureButton, SIGNAL(clicked()), this, SLOT(slotBeginCapture()));
88  connect(detailsButton, SIGNAL(clicked()), this, SLOT(slotDetails()));
89 }
void append(const T &value)
Definition: fov.h:27
SkyObject * getShBeginObject()
Get object at which star hopping will begin.
PWizFovShUI(PrintingWizard *wizard, QWidget *parent=nullptr)
Constructor.
Definition: pwizfovsh.cpp:18
static QString objectInfoString(SkyObject *obj)
Static function: get QString with basic information about SkyObject.
Class representing Printing Wizard for KStars printed documents (currently only finder charts).
void beginShFovCapture()
Capture FOV snapshots using star hopper-based method.
QMetaObject::Connection connect(const QObject *sender, const char *signal, const QObject *receiver, const char *method, Qt::ConnectionType type)
static KStars * Instance()
Definition: kstars.h:125
GeoLocation * geo()
Definition: kstarsdata.h:229
void beginShBeginPointing()
Enter star hopping begin pointing mode.
void setupUi(QWidget *widget)
const KStarsDateTime & ut() const
Definition: kstarsdata.h:156
KStarsData * data() const
Definition: kstars.h:137
void setBeginObject(SkyObject *obj)
Set object at which star hopper will begin.
Definition: pwizfovsh.cpp:26
void setShBeginObject(SkyObject *obj)
Set SkyObject at which star hopper will begin.
Information about an object in the sky.
Definition: skyobject.h:41
This file is part of the KDE documentation.
Documentation copyright © 1996-2022 The KDE developers.
Generated on Sat Aug 13 2022 04:01:57 by doxygen 1.8.17 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.