• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

Stellarium / stellarium / 6093339559

06 Sep 2023 06:04AM UTC coverage: 11.86% (-0.004%) from 11.864%
6093339559

push

github

alex-w
A new plugin is translatable now

14815 of 124919 relevant lines covered (11.86%)

21886.49 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

0.0
/plugins/MissingStars/src/MissingStars.hpp
1
/*
2
 * Copyright (C) 2023 Alexander Wolf
3
 *
4
 * This program is free software; you can redistribute it and/or
5
 * modify it under the terms of the GNU General Public License
6
 * as published by the Free Software Foundation; either version 2
7
 * of the License, or (at your option) any later version.
8
 *
9
 * This program is distributed in the hope that it will be useful,
10
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
12
 * GNU General Public License for more details.
13
 *
14
 * You should have received a copy of the GNU General Public License
15
 * along with this program; if not, write to the Free Software
16
 * Foundation, Inc., 51 Franklin Street, Suite 500, Boston, MA  02110-1335, USA.
17
 */
18

19
#ifndef MISSINGSTARS_HPP
20
#define MISSINGSTARS_HPP
21

22
#include "StelObjectModule.hpp"
23
#include "StelObject.hpp"
24
#include "StelTextureTypes.hpp"
25
#include "MissingStar.hpp"
26
#include <QFont>
27
#include <QVariantMap>
28
#include <QDateTime>
29
#include <QList>
30
#include <QSharedPointer>
31

32
class QSettings;
33
class MissingStarsDialog;
34

35
class StelPainter;
36

37
/*! @defgroup missingStars Missing Stars Plug-in
38
@{
39
The %Missing Stars plugin displays the positions some missing stars.
40

41
<b>Missing Stars Catalog</b>
42

43
The missing stars catalog is stored on the disk in [JSON](http://www.json.org/)
44
format, in a file named "missingstars.json". A default copy is embedded in the
45
plug-in at compile time. A working copy is kept in the user data directory.
46

47
<b>Configuration</b>
48

49
The plug-ins' configuration data is stored in Stellarium's main configuration
50
file.
51

52
@}
53
*/
54

55
//! @ingroup missingStars
56
typedef QSharedPointer<MissingStar> MissingStarP;
57

58
//! @class MissingStars
59
//! Main class of the %Missing Stars plugin.
60
//! @author Alexander Wolf
61
//! @ingroup missingStars
62
class MissingStars : public StelObjectModule
63
{
64
        Q_OBJECT
65
public:        
66
        MissingStars();
67
        virtual ~MissingStars() Q_DECL_OVERRIDE;
68

69
        ///////////////////////////////////////////////////////////////////////////
70
        // Methods defined in the StelModule class
71
        virtual void init() Q_DECL_OVERRIDE;
72
        virtual void deinit() Q_DECL_OVERRIDE;
73
        virtual void draw(StelCore* core) Q_DECL_OVERRIDE;
74
        virtual void drawPointer(StelCore* core, StelPainter& painter);
75
        virtual double getCallOrder(StelModuleActionName actionName) const Q_DECL_OVERRIDE;
76

77
        ///////////////////////////////////////////////////////////////////////////
78
        // Methods defined in StelObjectModule class
79
        //! Used to get a list of objects which are near to some position.
80
        //! @param v a vector representing the position in th sky around which to search for missing stars.
81
        //! @param limitFov the field of view around the position v in which to search for missing stars.
82
        //! @param core the StelCore to use for computations.
83
        //! @return a list containing the missing stars located inside the limitFov circle around position v.
84
        virtual QList<StelObjectP> searchAround(const Vec3d& v, double limitFov, const StelCore* core) const Q_DECL_OVERRIDE;
85

86
        //! Return the matching missing stars object's pointer if exists or Q_NULLPTR.
87
        //! @param nameI18n The case in-sensitive localized star name
88
        virtual StelObjectP searchByNameI18n(const QString& nameI18n) const Q_DECL_OVERRIDE;
89

90
        //! Return the matching missing star if exists or Q_NULLPTR.
91
        //! @param name The case in-sensitive english star name
92
        virtual StelObjectP searchByName(const QString& name) const Q_DECL_OVERRIDE;
93

94
        //! Return the matching missing star if exists, or an "empty" pointer.
95
        //! @param id The missing star id
96
        virtual StelObjectP searchByID(const QString &id) const Q_DECL_OVERRIDE
×
97
        {
98
                return qSharedPointerCast<StelObject>(getByID(id));
×
99
        }
100

101
        virtual QStringList listAllObjects(bool inEnglish) const Q_DECL_OVERRIDE;
102

103
        virtual QString getName() const Q_DECL_OVERRIDE { return "Missing Stars"; }
×
104
        virtual QString getStelObjectType() const Q_DECL_OVERRIDE { return MissingStar::MISSINGSTAR_TYPE; }
×
105

106
        //! get a star object by identifier
107
        MissingStarP getByID(const QString& id) const;
108

109
        //! Get list of designations for missing stars
110
        QString getMissingStarsList() const;
111

112
        //! Implement this to tell the main Stellarium GUI that there is a GUI element to configure this
113
        //! plugin.
114
        virtual bool configureGui(bool show=true) Q_DECL_OVERRIDE;
115

116
public slots:
117
        //! Connect this to StelApp font size.
118
        void setFontSize(int s){font.setPixelSize(s);}
×
119
private:
120
        // Font used for displaying our text
121
        QFont font;
122

123
        //! Read the JSON file and create list of missing stars.
124
        void readJsonFile(void);
125

126
        //! Parse JSON file and load missing stars to map
127
        QVariantMap loadMissingStarsMap();
128

129
        //! Set items for list of struct from data map
130
        void setMissingStarsMap(const QVariantMap& map);
131

132
        StelTextureSP texPointer;
133
        QList<MissingStarP> missingstars;
134
        QStringList designations;
135

136
        QSettings* conf;
137

138
        // GUI
139
        MissingStarsDialog* configDialog;        
140
};
141

142
#include <QObject>
143
#include "StelPluginInterface.hpp"
144

145
//! This class is used by Qt to manage a plug-in interface
146
class MissingStarsStelPluginInterface : public QObject, public StelPluginInterface
147
{
148
        Q_OBJECT
149
        Q_PLUGIN_METADATA(IID StelPluginInterface_iid)
150
        Q_INTERFACES(StelPluginInterface)
151
public:
152
        virtual StelModule* getStelModule() const Q_DECL_OVERRIDE;
153
        virtual StelPluginInfo getPluginInfo() const Q_DECL_OVERRIDE;
154
        virtual QObjectList getExtensionList() const Q_DECL_OVERRIDE { return QObjectList(); }
×
155
};
156

157
#endif /* MISSINGSTARS_HPP */
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2025 Coveralls, Inc