Kstars

detailstable.h
1 /*
2  SPDX-FileCopyrightText: 2011 Rafał Kułaga <[email protected]>
3 
4  SPDX-License-Identifier: GPL-2.0-or-later
5 */
6 
7 #ifndef DETAILSTABLE_H
8 #define DETAILSTABLE_H
9 
10 #include "QTextTableFormat"
11 #include "QTextCharFormat"
12 
13 class SkyObject;
14 class KStarsDateTime;
15 class GeoLocation;
16 class QTextDocument;
17 
18 /**
19  * \class DetailsTable
20  * \brief Represents details tables that can be inserted to finder charts and logging forms.
21  * DetailsTable class is used for creating QTextTables filled with details about objects of all types.
22  * Created tables are stored inside QTextDocument, which can be obtained by DetailsTable::getDocument() and
23  * inserted into other QTextDocument as fragment.
24  * Four types of details tables are supported: general details, position details, Rise/Set/Transit details and
25  * Asteroid/Comet details.
26  * \author Rafał Kułaga
27  */
29 {
30  public:
31  /**
32  * \short Default constructor - creates empty details table.
33  */
34  DetailsTable();
35 
36  /**
37  * \short Destructor.
38  */
39  ~DetailsTable();
40 
41  /**
42  * \short Get table format.
43  * \return Current table format.
44  */
45  inline QTextTableFormat getTableFormat() { return m_TableFormat; }
46 
47  /**
48  * \short Get table title character format.
49  * \return Current table title character format.
50  */
51  inline QTextCharFormat getTableTitleCharFormat() { return m_TableTitleCharFormat; }
52 
53  /**
54  * \short Get table item name character format.
55  * \return Current table item name character format.
56  */
57  inline QTextCharFormat getItemNameCharFormat() { return m_ItemNameCharFormat; }
58 
59  /**
60  * \short Get table item value character format.
61  * \return Current table item value character format.
62  */
63  inline QTextCharFormat getItemValueCharFormat() { return m_ItemValueCharFormat; }
64 
65  /**
66  * \short Set table format.
67  * \param format New table format.
68  */
69  inline void setTableFormat(const QTextTableFormat &format) { m_TableFormat = format; }
70 
71  /**
72  * \short Set table title character format.
73  * \param format New table title character format.
74  */
75  inline void setTableTitleCharFormat(const QTextCharFormat &format) { m_TableTitleCharFormat = format; }
76 
77  /**
78  * \short Set table item name character format.
79  * \param format New table item name character format.
80  */
81  inline void setItemNameCharFormat(const QTextCharFormat &format) { m_ItemNameCharFormat = format; }
82 
83  /**
84  * \short Set table item value character format.
85  * \param format New table item value character format.
86  */
87  inline void setItemValueCharFormat(const QTextCharFormat &format) { m_ItemValueCharFormat = format; }
88 
89  /**
90  * \short Create general details table.
91  * \param obj SkyObject for which table will be created.
92  */
93  void createGeneralTable(SkyObject *obj);
94 
95  /**
96  * \short Create Asteroid/Comet details table.
97  * \param obj Sky object (Asteroid/Comet) for which table will be created.
98  */
100 
101  /**
102  * \short Create coordinates details table.
103  * \param obj Sky object for which table will be created.
104  * \param ut Date and time.
105  * \param geo Geographic location.
106  */
107  void createCoordinatesTable(SkyObject *obj, const KStarsDateTime &ut, GeoLocation *geo);
108 
109  /**
110  * \short Create Rise/Set/Transit details table.
111  * \param obj Sky object for which table will be created.
112  * \param ut Date and time.
113  * \param geo Geographic location.
114  */
115  void createRSTTAble(SkyObject *obj, const KStarsDateTime &ut, GeoLocation *geo);
116 
117  /**
118  * \short Clear current table.
119  */
120  void clearContents();
121 
122  /**
123  * \short Get table document.
124  * \return Table document.
125  */
126  inline QTextDocument *getDocument() { return m_Document; }
127 
128  private:
129  /**
130  * \short Sets default table formatting.
131  */
132  void setDefaultFormatting();
133 
134  QTextDocument *m_Document;
135 
136  QTextTableFormat m_TableFormat;
137  QTextCharFormat m_TableTitleCharFormat;
138  QTextCharFormat m_ItemNameCharFormat;
139  QTextCharFormat m_ItemValueCharFormat;
140 };
141 
142 #endif // DETAILSTABLE_H
Extension of QDateTime for KStars KStarsDateTime can represent the date/time as a Julian Day,...
QTextCharFormat getTableTitleCharFormat()
Get table title character format.
Definition: detailstable.h:51
void setTableFormat(const QTextTableFormat &format)
Set table format.
Definition: detailstable.h:69
QTextTableFormat getTableFormat()
Get table format.
Definition: detailstable.h:45
void createCoordinatesTable(SkyObject *obj, const KStarsDateTime &ut, GeoLocation *geo)
Create coordinates details table.
void createRSTTAble(SkyObject *obj, const KStarsDateTime &ut, GeoLocation *geo)
Create Rise/Set/Transit details table.
void createGeneralTable(SkyObject *obj)
Create general details table.
void setItemValueCharFormat(const QTextCharFormat &format)
Set table item value character format.
Definition: detailstable.h:87
void setTableTitleCharFormat(const QTextCharFormat &format)
Set table title character format.
Definition: detailstable.h:75
QTextCharFormat getItemNameCharFormat()
Get table item name character format.
Definition: detailstable.h:57
void setItemNameCharFormat(const QTextCharFormat &format)
Set table item name character format.
Definition: detailstable.h:81
DetailsTable()
Default constructor - creates empty details table.
Represents details tables that can be inserted to finder charts and logging forms....
Definition: detailstable.h:28
~DetailsTable()
Destructor.
void createAsteroidCometTable(SkyObject *obj)
Create Asteroid/Comet details table.
QTextDocument * getDocument()
Get table document.
Definition: detailstable.h:126
Information about an object in the sky.
Definition: skyobject.h:41
QTextCharFormat getItemValueCharFormat()
Get table item value character format.
Definition: detailstable.h:63
void clearContents()
Clear current table.
Relevant data about an observing location on Earth.
Definition: geolocation.h:27
This file is part of the KDE documentation.
Documentation copyright © 1996-2022 The KDE developers.
Generated on Fri Aug 12 2022 04:00:53 by doxygen 1.8.17 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.