File indexing completed on 2024-04-21 03:44:28
0001 /* 0002 SPDX-FileCopyrightText: 2011 Rafał Kułaga <rl.kulaga@gmail.com> 0003 0004 SPDX-License-Identifier: GPL-2.0-or-later 0005 */ 0006 0007 #ifndef DETAILSTABLE_H 0008 #define DETAILSTABLE_H 0009 0010 #include "QTextTableFormat" 0011 #include "QTextCharFormat" 0012 0013 class SkyObject; 0014 class KStarsDateTime; 0015 class GeoLocation; 0016 class QTextDocument; 0017 0018 /** 0019 * \class DetailsTable 0020 * \brief Represents details tables that can be inserted to finder charts and logging forms. 0021 * DetailsTable class is used for creating QTextTables filled with details about objects of all types. 0022 * Created tables are stored inside QTextDocument, which can be obtained by DetailsTable::getDocument() and 0023 * inserted into other QTextDocument as fragment. 0024 * Four types of details tables are supported: general details, position details, Rise/Set/Transit details and 0025 * Asteroid/Comet details. 0026 * \author Rafał Kułaga 0027 */ 0028 class DetailsTable 0029 { 0030 public: 0031 /** 0032 * \short Default constructor - creates empty details table. 0033 */ 0034 DetailsTable(); 0035 0036 /** 0037 * \short Destructor. 0038 */ 0039 ~DetailsTable(); 0040 0041 /** 0042 * \short Get table format. 0043 * \return Current table format. 0044 */ 0045 inline QTextTableFormat getTableFormat() { return m_TableFormat; } 0046 0047 /** 0048 * \short Get table title character format. 0049 * \return Current table title character format. 0050 */ 0051 inline QTextCharFormat getTableTitleCharFormat() { return m_TableTitleCharFormat; } 0052 0053 /** 0054 * \short Get table item name character format. 0055 * \return Current table item name character format. 0056 */ 0057 inline QTextCharFormat getItemNameCharFormat() { return m_ItemNameCharFormat; } 0058 0059 /** 0060 * \short Get table item value character format. 0061 * \return Current table item value character format. 0062 */ 0063 inline QTextCharFormat getItemValueCharFormat() { return m_ItemValueCharFormat; } 0064 0065 /** 0066 * \short Set table format. 0067 * \param format New table format. 0068 */ 0069 inline void setTableFormat(const QTextTableFormat &format) { m_TableFormat = format; } 0070 0071 /** 0072 * \short Set table title character format. 0073 * \param format New table title character format. 0074 */ 0075 inline void setTableTitleCharFormat(const QTextCharFormat &format) { m_TableTitleCharFormat = format; } 0076 0077 /** 0078 * \short Set table item name character format. 0079 * \param format New table item name character format. 0080 */ 0081 inline void setItemNameCharFormat(const QTextCharFormat &format) { m_ItemNameCharFormat = format; } 0082 0083 /** 0084 * \short Set table item value character format. 0085 * \param format New table item value character format. 0086 */ 0087 inline void setItemValueCharFormat(const QTextCharFormat &format) { m_ItemValueCharFormat = format; } 0088 0089 /** 0090 * \short Create general details table. 0091 * \param obj SkyObject for which table will be created. 0092 */ 0093 void createGeneralTable(SkyObject *obj); 0094 0095 /** 0096 * \short Create Asteroid/Comet details table. 0097 * \param obj Sky object (Asteroid/Comet) for which table will be created. 0098 */ 0099 void createAsteroidCometTable(SkyObject *obj); 0100 0101 /** 0102 * \short Create coordinates details table. 0103 * \param obj Sky object for which table will be created. 0104 * \param ut Date and time. 0105 * \param geo Geographic location. 0106 */ 0107 void createCoordinatesTable(SkyObject *obj, const KStarsDateTime &ut, GeoLocation *geo); 0108 0109 /** 0110 * \short Create Rise/Set/Transit details table. 0111 * \param obj Sky object for which table will be created. 0112 * \param ut Date and time. 0113 * \param geo Geographic location. 0114 */ 0115 void createRSTTAble(SkyObject *obj, const KStarsDateTime &ut, GeoLocation *geo); 0116 0117 /** 0118 * \short Clear current table. 0119 */ 0120 void clearContents(); 0121 0122 /** 0123 * \short Get table document. 0124 * \return Table document. 0125 */ 0126 inline QTextDocument *getDocument() { return m_Document; } 0127 0128 private: 0129 /** 0130 * \short Sets default table formatting. 0131 */ 0132 void setDefaultFormatting(); 0133 0134 QTextDocument *m_Document; 0135 0136 QTextTableFormat m_TableFormat; 0137 QTextCharFormat m_TableTitleCharFormat; 0138 QTextCharFormat m_ItemNameCharFormat; 0139 QTextCharFormat m_ItemValueCharFormat; 0140 }; 0141 0142 #endif // DETAILSTABLE_H