Kstars

detaildialog.h
1/*
2 SPDX-FileCopyrightText: 2002 Jason Harris <kstars@30doradus.org>
3
4 SPDX-License-Identifier: GPL-2.0-or-later
5*/
6
7#pragma once
8
9#include "ui_details_data.h"
10#include "ui_details_data_comet.h"
11#include "ui_details_database.h"
12#include "ui_details_links.h"
13#include "ui_details_log.h"
14#include "ui_details_position.h"
15
16#include "skyobjectuserdata.h"
17#include <kpagedialog.h>
18
19#include <QPalette>
20#include <QString>
21
22#include <memory>
23
24class QListWidgetItem;
25class QPixmap;
26
27class DataCometWidget;
28class DataWidget;
29class GeoLocation;
30class KStars;
31class KStarsDateTime;
32class SkyObject;
33
34class PositionWidget;
35class LinksWidget;
36class DatabaseWidget;
37class LogWidget;
38
39struct ADVTreeData
40{
41 QString Name;
42 QString Link;
43 int Type;
44};
45
46/**
47 * @class DetailDialog
48 * DetailDialog is a window showing detailed information for a selected object.
49 * The window is split into four Tabs: General, Links, Advanced and Log.
50 * The General Tab displays some type-specific data about the object, as well as its
51 * present coordinates and Rise/Set/Transit times for the current date. The Type-specific
52 * data are:
53 * @li Stars: common name, genetive name, Spectral type, magnitude, distance
54 * @li Solar System: name, object type (planet/comet/asteroid), Distance, magnitude (TBD),
55 * angular size (TBD)
56 * @li Deep Sky: Common name, other names, object type, magnitude, angular size
57 *
58 * The Links Tab allows the user to manage the list of Image and Information links
59 * listed in the object's popup menu. The Advanced Tab allows the user to query
60 * a number of professional-grade online astronomical databases for data on the object.
61 * The Log tab allows the user to attach their own text notes about the object.
62 *
63 * The General Tab includes a clickable image of the object. Clicking the image opens
64 * a Thumbnail picker tool, which downloads a list of mages of the object from the
65 * network, which the user may select as the new image for this objects Details window.
66 *
67 * @author Jason Harris, Jasem Mutlaq
68 * @version 1.0
69 */
71{
73 public:
74 /** Constructor */
75 DetailDialog(SkyObject *o, const KStarsDateTime &ut, GeoLocation *geo, QWidget *parent = nullptr);
76
77 /** Destructor */
78 ~DetailDialog() override = default;
79
80 /** @return pointer to the QPixmap of the object's thumbnail image */
81 inline QPixmap *thumbnail() { return Thumbnail.get(); }
82
83 public slots:
84 /** @short Slot to add this object to the observing list. */
85 void addToObservingList();
86
87 /** @short Slot to center this object in the display. */
88 void centerMap();
89
90 /** @short Slot to center this object in the telescope. */
91 void centerTelescope();
92
93 //TODO: showThumbnail() is only called in the ctor; make it private and not a slot.
94 /** @short Slot to display the thumbnail image for the object */
95 void showThumbnail();
96
97 /**
98 * @short Slot to update thumbnail image for the object, using the Thumbnail
99 * Picker tool.
100 * @sa ThumbnailPicker
101 */
102 void updateThumbnail();
103
104 /** @short Slot for viewing the selected image or info URL in the web browser. */
105 void viewLink();
106
107 /**
108 * Popup menu function: Add a custom Image or Information URL.
109 * Opens the AddLinkDialog window.
110 */
111 void addLink();
112
113 /**
114 * @short Set the currently-selected URL resource.
115 *
116 * This function is needed because there are two QListWidgets,
117 * each with its own selection. We need to know which the user selected most recently.
118 */
120
121 /**
122 * @short Rebuild the Image and Info URL lists for this object.
123 * @note used when an item is added to either list.
124 */
125 void updateLists();
126
127 /**
128 * @short Open a dialog to edit a URL in either the Images or Info lists,
129 * and update the user's *url.dat file.
130 */
131 void editLinkDialog();
132
133 /**
134 * @short remove a URL entry from either the Images or Info lists, and
135 * update the user's *url.dat file.
136 */
137 void removeLinkDialog();
138
139 /**
140 * Open the web browser to the selected online astronomy database,
141 * with a query to the object of this Detail Dialog.
142 */
143 void viewADVData();
144
145 /** Save the User's text in the Log Tab to the userlog.dat file. */
146 void saveLogData();
147
148 /** Update View/Edit/Remove buttons */
149 void updateButtons();
150
151 private:
152 /** Build the General Data Tab for the current object. */
153 void createGeneralTab();
154
155 /** Build the Position Tab for the current object. */
156 void createPositionTab(const KStarsDateTime &ut, GeoLocation *geo);
157
158 /**
159 * Build the Links Tab, populating the image and info lists with the
160 * known URLs for the current Object.
161 */
162 void createLinksTab();
163
164 /** Build the Advanced Tab */
165 void createAdvancedTab();
166
167 /** Build the Log Tab */
168 void createLogTab();
169
170 /** Populate the TreeView of known astronomical databases in the Advanced Tab */
171 void populateADVTree();
172
173 /**
174 * Data for the Advanced Tab TreeView is stored in the file advinterface.dat.
175 * This function parses advinterface.dat.
176 */
177 QString parseADVData(const QString &link);
178
179 /**
180 * Update the local info_url and image_url files
181 * @param type The URL type. 0 for Info Links, 1 for Images.
182 * @param search_line The line to be search for in the local URL files
183 * @param replace_line The replacement line once search_line is found.
184 * @note If replace_line is empty, the function will remove search_line from the file
185 */
186 void updateLocalDatabase(int type, const QString &search_line, const QString &replace_line = QString());
187
188 SkyObject *selectedObject { nullptr };
189 QPalette titlePalette;
190 QListWidgetItem *m_CurrentLink { nullptr };
191 std::unique_ptr<QPixmap> Thumbnail;
192 DataWidget *Data { nullptr };
193 DataCometWidget *DataComet { nullptr };
194 PositionWidget *Pos { nullptr };
195 LinksWidget *Links { nullptr };
196 DatabaseWidget *Adv { nullptr };
197 LogWidget *Log { nullptr };
198 const SkyObjectUserdata::Data &m_user_data;
199};
200
201class DataWidget : public QFrame, public Ui::DetailsData
202{
204
205 public:
206 explicit DataWidget(QWidget *parent = nullptr);
207};
208
209class DataCometWidget : public QFrame, public Ui::DetailsDataComet
210{
212
213 public:
214 explicit DataCometWidget(QWidget *parent = nullptr);
215};
216
217class PositionWidget : public QFrame, public Ui::DetailsPosition
218{
220
221 public:
222 explicit PositionWidget(QWidget *parent = nullptr);
223};
224
225class LinksWidget : public QFrame, public Ui::DetailsLinks
226{
228
229 public:
230 explicit LinksWidget(QWidget *parent = nullptr);
231};
232
233class DatabaseWidget : public QFrame, public Ui::DetailsDatabase
234{
236
237 public:
238 explicit DatabaseWidget(QWidget *parent = nullptr);
239};
240
241class LogWidget : public QFrame, public Ui::DetailsLog
242{
244
245 public:
246 explicit LogWidget(QWidget *parent = nullptr);
247};
DetailDialog is a window showing detailed information for a selected object.
void centerMap()
Slot to center this object in the display.
void removeLinkDialog()
remove a URL entry from either the Images or Info lists, and update the user's *url....
~DetailDialog() override=default
Destructor.
QPixmap * thumbnail()
void showThumbnail()
Slot to display the thumbnail image for the object.
void setCurrentLink(QListWidgetItem *it)
Set the currently-selected URL resource.
void centerTelescope()
Slot to center this object in the telescope.
void updateLists()
Rebuild the Image and Info URL lists for this object.
void saveLogData()
Save the User's text in the Log Tab to the userlog.dat file.
void viewADVData()
Open the web browser to the selected online astronomy database, with a query to the object of this De...
void editLinkDialog()
Open a dialog to edit a URL in either the Images or Info lists, and update the user's *url....
void updateThumbnail()
Slot to update thumbnail image for the object, using the Thumbnail Picker tool.
void updateButtons()
Update View/Edit/Remove buttons.
void addToObservingList()
Slot to add this object to the observing list.
void viewLink()
Slot for viewing the selected image or info URL in the web browser.
DetailDialog(SkyObject *o, const KStarsDateTime &ut, GeoLocation *geo, QWidget *parent=nullptr)
Constructor.
void addLink()
Popup menu function: Add a custom Image or Information URL.
Contains all relevant information for specifying a location on Earth: City Name, State/Province name,...
Definition geolocation.h:28
Extension of QDateTime for KStars KStarsDateTime can represent the date/time as a Julian Day,...
This is the main window for KStars.
Definition kstars.h:89
Implementation of Open Astronomy Log (OAL) XML specifications to record observation logs.
Provides all necessary information about an object in the sky: its coordinates, name(s),...
Definition skyobject.h:42
Q_OBJECTQ_OBJECT
QObject * parent() const const
Stores Users' Logs, Pictures and Websites regarding an object in the sky.
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.