Satellites.hpp   Satellites.hpp 
skipping to change at line 39 skipping to change at line 39
#include <QDateTime> #include <QDateTime>
#include <QFile> #include <QFile>
#include <QDir> #include <QDir>
#include <QUrl> #include <QUrl>
#include <QVariantMap> #include <QVariantMap>
class StelButton; class StelButton;
class Planet; class Planet;
class QNetworkAccessManager; class QNetworkAccessManager;
class QNetworkReply; class QNetworkReply;
class QPixmap;
class QProgressBar;
class QSettings; class QSettings;
class QTimer; class QTimer;
class SatellitesDialog; class SatellitesDialog;
class SatellitesListModel; class SatellitesListModel;
//! Data structure containing unvalidated TLE set as read from a TLE list f ile. //! Data structure containing unvalidated TLE set as read from a TLE list f ile.
struct TleData struct TleData
{ {
//! NORAD catalog number, as extracted from the TLE set. //! NORAD catalog number, as extracted from the TLE set.
skipping to change at line 125 skipping to change at line 123
file. file.
*/ */
//! @class Satellites //! @class Satellites
//! Main class of the %Satellites plugin. //! Main class of the %Satellites plugin.
//! @author Matthew Gates //! @author Matthew Gates
//! @author Bogdan Marinov //! @author Bogdan Marinov
class Satellites : public StelObjectModule class Satellites : public StelObjectModule
{ {
Q_OBJECT Q_OBJECT
Q_PROPERTY(bool hintsVisible
READ getFlagHints
WRITE setFlagHints)
Q_PROPERTY(bool labelsVisible
READ getFlagLabels
WRITE setFlagLabels)
Q_PROPERTY(bool autoAddEnabled Q_PROPERTY(bool autoAddEnabled
READ isAutoAddEnabled READ isAutoAddEnabled
WRITE enableAutoAdd WRITE enableAutoAdd
NOTIFY settingsChanged) NOTIFY settingsChanged)
Q_PROPERTY(bool autoRemoveEnabled Q_PROPERTY(bool autoRemoveEnabled
READ isAutoRemoveEnabled READ isAutoRemoveEnabled
WRITE enableAutoRemove WRITE enableAutoRemove
NOTIFY settingsChanged) NOTIFY settingsChanged)
Q_PROPERTY(bool realisticMode
READ getFlagRealisticMode
WRITE setFlagRelisticMode)
public: public:
//! @enum UpdateState //! @enum UpdateState
//! Used for keeping track of the download/update status //! Used for keeping track of the download/update status
enum UpdateState enum UpdateState
{ {
Updating, //!< Update in progress Updating, //!< Update in progress
CompleteNoUpdates, //!< Update completed, there we no upd ates CompleteNoUpdates, //!< Update completed, there we no upd ates
CompleteUpdates, //!< Update completed, there were upda tes CompleteUpdates, //!< Update completed, there were upda tes
DownloadError, //!< Error during download phase DownloadError, //!< Error during download phase
skipping to change at line 164 skipping to change at line 171
}; };
Satellites(); Satellites();
virtual ~Satellites(); virtual ~Satellites();
//////////////////////////////////////////////////////////////////// /////// //////////////////////////////////////////////////////////////////// ///////
// Methods defined in the StelModule class // Methods defined in the StelModule class
virtual void init(); virtual void init();
virtual void deinit(); virtual void deinit();
virtual void update(double deltaTime); virtual void update(double deltaTime);
virtual void draw(StelCore* core, class StelRenderer* renderer); virtual void draw(StelCore* core);
virtual void drawPointer(StelCore* core, class StelRenderer* rendere virtual void drawPointer(StelCore* core, StelPainter& painter);
r);
virtual double getCallOrder(StelModuleActionName actionName) const; virtual double getCallOrder(StelModuleActionName actionName) const;
//////////////////////////////////////////////////////////////////// /////// //////////////////////////////////////////////////////////////////// ///////
// Methods defined in StelObjectManager class // Methods defined in StelObjectManager class
//! Used to get a list of objects which are near to some position. //! Used to get a list of objects which are near to some position.
//! @param v a vector representing the position in th sky around whi ch to search for nebulae. //! @param v a vector representing the position in th sky around whi ch to search for nebulae.
//! @param limitFov the field of view around the position v in which to search for satellites. //! @param limitFov the field of view around the position v in which to search for satellites.
//! @param core the StelCore to use for computations. //! @param core the StelCore to use for computations.
//! @return an list containing the satellites located inside the lim itFov circle around position v. //! @return an list containing the satellites located inside the lim itFov circle around position v.
virtual QList<StelObjectP> searchAround(const Vec3d& v, double limit Fov, const StelCore* core) const; virtual QList<StelObjectP> searchAround(const Vec3d& v, double limit Fov, const StelCore* core) const;
skipping to change at line 293 skipping to change at line 300
//! saves them to the configuration file. Allows marking sources for //! saves them to the configuration file. Allows marking sources for
//! auto-addition by adding a prefix to the URL string. //! auto-addition by adding a prefix to the URL string.
//! @see updateUrls //! @see updateUrls
//! @param tleSources a list of valid URLs (http://, ftp://, file:// ), //! @param tleSources a list of valid URLs (http://, ftp://, file:// ),
//! allowed prefixes are "0,", "1," or no prefix. //! allowed prefixes are "0,", "1," or no prefix.
void setTleSources(QStringList tleSources); void setTleSources(QStringList tleSources);
//! Saves the current list of update URLs to the configuration file. //! Saves the current list of update URLs to the configuration file.
void saveTleSources(const QStringList& urls); void saveTleSources(const QStringList& urls);
//! Returns the module-specific style sheet.
//! The main StelStyle instance should be passed.
// TODO: Plugin-specific styles are no longer necessary?
const StelStyle getModuleStyleSheet(const StelStyle& style);
//! Reads update file(s) in celestrak's .txt format, and updates //! Reads update file(s) in celestrak's .txt format, and updates
//! the TLE elements for exisiting satellites from them. //! the TLE elements for exisiting satellites from them.
//! Indirectly emits signals updateStateChanged() and tleUpdateCompl ete(), //! Indirectly emits signals updateStateChanged() and tleUpdateCompl ete(),
//! as it calls updateSatellites(). //! as it calls updateSatellites().
//! See updateFromOnlineSources() for the other kind of update opera tion. //! See updateFromOnlineSources() for the other kind of update opera tion.
//! @param paths a list of paths to update files //! @param paths a list of paths to update files
//! @param deleteFiles if set, the update files are deleted after //! @param deleteFiles if set, the update files are deleted after
//! they are used, else they are left alone //! they are used, else they are left alone
void updateFromFiles(QStringList paths, bool deleteFiles=false); void updateFromFiles(QStringList paths, bool deleteFiles=false);
skipping to change at line 334 skipping to change at line 336
//! are overwritten with the new values. //! are overwritten with the new values.
//! \param openFile a reference to an \b open file. //! \param openFile a reference to an \b open file.
//! @param[in,out] tleList a hash with satellite IDs as keys. //! @param[in,out] tleList a hash with satellite IDs as keys.
//! @param[in] addFlagValue value to be set to TleData::addThis for all. //! @param[in] addFlagValue value to be set to TleData::addThis for all.
//! @todo If this can accept a QIODevice, it will be able to read di rectly //! @todo If this can accept a QIODevice, it will be able to read di rectly
//! QNetworkReply-s... --BM //! QNetworkReply-s... --BM
static void parseTleFile(QFile& openFile, static void parseTleFile(QFile& openFile,
TleDataHash& tleList, TleDataHash& tleList,
bool addFlagValue = false); bool addFlagValue = false);
//! Reads qs.mag file and its parsing for getting id and standard ma
gnitude
//! for satellites.
//! @note We are having permissions for use this file from Mike McCa
nts.
//! @param name of file
void parseQSMagFile(QString qsMagFile);
bool getFlagHints() {return hintFader;} bool getFlagHints() {return hintFader;}
//! get the label font size. //! get the label font size.
//! @return the pixel size of the font //! @return the pixel size of the font
int getLabelFontSize() {return labelFont.pixelSize();} int getLabelFontSize() {return labelFont.pixelSize();}
bool getFlagLabels(); bool getFlagLabels();
bool getFlagRealisticMode();
//! Get the current status of the orbit line rendering flag. //! Get the current status of the orbit line rendering flag.
bool getOrbitLinesFlag(); bool getOrbitLinesFlag();
bool isAutoAddEnabled() const { return autoAddEnabled; } bool isAutoAddEnabled() const { return autoAddEnabled; }
bool isAutoRemoveEnabled() const { return autoRemoveEnabled; } bool isAutoRemoveEnabled() const { return autoRemoveEnabled; }
signals: signals:
//! Emitted when some of the plugin settings have been changed. //! Emitted when some of the plugin settings have been changed.
//! Used to communicate with the configuration window. //! Used to communicate with the configuration window.
void settingsChanged(); void settingsChanged();
skipping to change at line 388 skipping to change at line 397
//! Set whether satellite position hints (icons) should be displayed . //! Set whether satellite position hints (icons) should be displayed .
//! Note that hint visibility also applies to satellite labels. //! Note that hint visibility also applies to satellite labels.
//! Emits settingsChanged() if the value changes. //! Emits settingsChanged() if the value changes.
void setFlagHints(bool b); void setFlagHints(bool b);
//! Set whether text labels should be displayed next to satellite hi nts. //! Set whether text labels should be displayed next to satellite hi nts.
//! Emits settingsChanged() if the value changes. //! Emits settingsChanged() if the value changes.
//! @todo Decide how to sync with "actionShow_Satellite_Labels". //! @todo Decide how to sync with "actionShow_Satellite_Labels".
void setFlagLabels(bool b); void setFlagLabels(bool b);
//! Emits settingsChanged() if the value changes.
void setFlagRelisticMode(bool b);
//! set the label font size. //! set the label font size.
//! @param size the pixel size of the font //! @param size the pixel size of the font
//! Emits settingsChanged() if the value changes. //! Emits settingsChanged() if the value changes.
void setLabelFontSize(int size); void setLabelFontSize(int size);
//! Set the Internet update frequency. //! Set the Internet update frequency.
//! Emits settingsChanged() if the value changes. //! Emits settingsChanged() if the value changes.
void setUpdateFrequencyHours(int hours); void setUpdateFrequencyHours(int hours);
//! Start an Internet update. //! Start an Internet update.
skipping to change at line 430 skipping to change at line 442
//! Display a message on the screen for a few seconds. //! Display a message on the screen for a few seconds.
//! This is used for plugin-specific warnings and such. //! This is used for plugin-specific warnings and such.
void displayMessage(const QString& message, const QString hexColor=" #999999"); void displayMessage(const QString& message, const QString hexColor=" #999999");
//! Hide all messages. //! Hide all messages.
void hideMessages(); void hideMessages();
//! Save the current satellite catalog to disk. //! Save the current satellite catalog to disk.
void saveCatalog(QString path=QString()); void saveCatalog(QString path=QString());
private slots: private slots:
void setStelStyle(const QString& section);
private: private:
//! Add to the current collection the satellite described by the dat a. //! Add to the current collection the satellite described by the dat a.
//! @warning Use only in other methods! Does not update satelliteLis tModel! //! @warning Use only in other methods! Does not update satelliteLis tModel!
//! @todo This probably could be done easier if Satellite had a cons tructor //! @todo This probably could be done easier if Satellite had a cons tructor
//! accepting TleData... --BM //! accepting TleData... --BM
//! @returns true if the addition was successful. //! @returns true if the addition was successful.
bool add(const TleData& tleData); bool add(const TleData& tleData);
//! Delete Satellites section in main config.ini, then create with d efault values. //! Delete Satellites section in main config.ini, then create with d efault values.
skipping to change at line 455 skipping to change at line 466
//! Removes existing satellites first if there are any. //! Removes existing satellites first if there are any.
//! this will be done once at init, and also if the defaults are res et. //! this will be done once at init, and also if the defaults are res et.
void loadCatalog(); void loadCatalog();
//! Creates a backup of the satellites.json file called satellites.j son.old //! Creates a backup of the satellites.json file called satellites.j son.old
//! @param deleteOriginal if true, the original file is removed, els e not //! @param deleteOriginal if true, the original file is removed, els e not
//! @return true on OK, false on failure //! @return true on OK, false on failure
bool backupCatalog(bool deleteOriginal=false); bool backupCatalog(bool deleteOriginal=false);
//! Read the version number from the "creator" value in the catalog file. //! Read the version number from the "creator" value in the catalog file.
//! @return version string, e.g. "0.6.1" //! @return version string, e.g. "0.6.1"
const QString readCatalogVersion(); const QString readCatalogVersion();
//! Replace the qs.mag file with the default one.
void restoreDefaultQSMagFile();
//! Checks valid range dates of life of satellites
bool isValidRangeDates() const;
//! Save a structure representing a satellite catalog to a JSON file . //! Save a structure representing a satellite catalog to a JSON file .
//! If no path is specified, catalogPath is used. //! If no path is specified, catalogPath is used.
//! @see createDataMap() //! @see createDataMap()
bool saveDataMap(const QVariantMap& map, QString path=QString()); bool saveDataMap(const QVariantMap& map, QString path=QString());
//! Load a structure representing a satellite catalog from a JSON fi le. //! Load a structure representing a satellite catalog from a JSON fi le.
//! If no path is specified, catalogPath is used. //! If no path is specified, catalogPath is used.
QVariantMap loadDataMap(QString path=QString()); QVariantMap loadDataMap(QString path=QString());
//! Parse a satellite catalog structure into internal satellite data . //! Parse a satellite catalog structure into internal satellite data .
void setDataMap(const QVariantMap& map); void setDataMap(const QVariantMap& map);
//! Make a satellite catalog structure from current satellite data. //! Make a satellite catalog structure from current satellite data.
//! @return a representation of a JSON file. //! @return a representation of a JSON file.
QVariantMap createDataMap(); QVariantMap createDataMap();
//! Sets lastUpdate to the current date/time and saves it to the set tings. //! Sets lastUpdate to the current date/time and saves it to the set tings.
void markLastUpdate(); void markLastUpdate();
//! Check format of the catalog of satellites
//! @return valid boolean, e.g. "true"
bool checkJsonFileFormat();
//! A fake method for strings marked for translation. //! A fake method for strings marked for translation.
//! Use it instead of translations.h for N_() strings, except perhap s for //! Use it instead of translations.h for N_() strings, except perhap s for
//! keyboard action descriptions. (It's better for them to be in a s ingle //! keyboard action descriptions. (It's better for them to be in a s ingle
//! place.) //! place.)
static void translations(); static void translations();
//! Path to the qs.mag file.
QString qsMagFilePath;
//! Path to the satellite catalog file. //! Path to the satellite catalog file.
QString catalogPath; QString catalogPath;
//! Plug-in data directory. //! Plug-in data directory.
//! Intialized by init(). Contains the catalog file (satellites.json ), //! Intialized by init(). Contains the catalog file (satellites.json ),
//! temporary TLE lists downloaded during an online update, or whate ver //! temporary TLE lists downloaded during an online update, or whate ver
//! other modifiable files the plug-in needs. //! other modifiable files the plug-in needs.
QDir dataDir; QDir dataDir;
QList<SatelliteP> satellites; QList<SatelliteP> satellites;
SatellitesListModel* satelliteListModel; SatellitesListModel* satelliteListModel;
QHash<QString, double> qsMagList;
//! Union of the groups used by all loaded satellites - see @ref gro ups. //! Union of the groups used by all loaded satellites - see @ref gro ups.
//! For simplicity, it can only grow until the plug-in is unloaded - //! For simplicity, it can only grow until the plug-in is unloaded -
//! a group is not removed even if there are no more satellites tagg ed with //! a group is not removed even if there are no more satellites tagg ed with
//! it. //! it.
QSet<QString> groups; QSet<QString> groups;
LinearFader hintFader; LinearFader hintFader;
class StelTextureNew* hintTexture; StelTextureSP texPointer;
class StelTextureNew* texPointer;
//! @name Bottom toolbar button //! @name Bottom toolbar button
//@{ //@{
QPixmap* pxmapGlow;
QPixmap* pxmapOnIcon;
QPixmap* pxmapOffIcon;
StelButton* toolbarButton; StelButton* toolbarButton;
//@} //@}
// FIXME: Possible bug with the Solar System recreated by the SSEdit or. // FIXME: Possible bug with the Solar System recreated by the SSEdit or.
QSharedPointer<Planet> earth; QSharedPointer<Planet> earth;
Vec3f defaultHintColor; Vec3f defaultHintColor;
Vec3f defaultOrbitColor; Vec3f defaultOrbitColor;
QFont labelFont; QFont labelFont;
//! @name Updater module //! @name Updater module
//@{ //@{
skipping to change at line 531 skipping to change at line 551
//! without a prefix are used only to update existing satellites. Th is //! without a prefix are used only to update existing satellites. Th is
//! system was introduced to avoid using a custom type as a paramete r in //! system was introduced to avoid using a custom type as a paramete r in
//! setTleSources(), which in turn allows it to be used in scripts. //! setTleSources(), which in turn allows it to be used in scripts.
QStringList updateUrls; QStringList updateUrls;
//! Temporary stores update URLs and files during an online update. //! Temporary stores update URLs and files during an online update.
//! In use only between updateFromOnlineSources() and the final call to //! In use only between updateFromOnlineSources() and the final call to
//! saveDownloadedUpdate(). @b DO @b NOT use elsewhere! //! saveDownloadedUpdate(). @b DO @b NOT use elsewhere!
//! As a side effect it prevents problems if the user calls //! As a side effect it prevents problems if the user calls
//! setTleSources() while an update is in progress. //! setTleSources() while an update is in progress.
TleSourceList updateSources; TleSourceList updateSources;
QProgressBar* progressBar; class StelProgressController* progressBar;
int numberDownloadsComplete; int numberDownloadsComplete;
QTimer* updateTimer; QTimer* updateTimer;
//! Flag enabling automatic Internet updates. //! Flag enabling automatic Internet updates.
bool updatesEnabled; bool updatesEnabled;
//! Flag enabling the automatic addition of new satellites on update . //! Flag enabling the automatic addition of new satellites on update .
//! This will apply only for the selected update sources. //! This will apply only for the selected update sources.
bool autoAddEnabled; bool autoAddEnabled;
//! Flag enabling the automatic removal of missing satellites on upd ate. //! Flag enabling the automatic removal of missing satellites on upd ate.
bool autoRemoveEnabled; bool autoRemoveEnabled;
QDateTime lastUpdate; QDateTime lastUpdate;
skipping to change at line 553 skipping to change at line 573
//@} //@}
//! @name Screen message infrastructure //! @name Screen message infrastructure
//@{ //@{
QTimer* messageTimer; QTimer* messageTimer;
QList<int> messageIDs; QList<int> messageIDs;
//@} //@}
// GUI // GUI
SatellitesDialog* configDialog; SatellitesDialog* configDialog;
QByteArray normalStyleSheet;
QByteArray nightStyleSheet;
private slots: private slots:
//! check to see if an update is required. This is called periodica lly by a timer //! check to see if an update is required. This is called periodica lly by a timer
//! if the last update was longer than updateFrequencyHours ago then the update is //! if the last update was longer than updateFrequencyHours ago then the update is
//! done. //! done.
void checkForUpdate(void); void checkForUpdate(void);
//! Save the downloaded file and finish the update if it's the last one. //! Save the downloaded file and finish the update if it's the last one.
//! Calls updateSatellites() and indirectly emits updateStateChanged () //! Calls updateSatellites() and indirectly emits updateStateChanged ()
//! and updateFinished(). //! and updateFinished().
//! Ends the update process started with updateFromOnlineSources(). //! Ends the update process started with updateFromOnlineSources().
//! @todo I've kept the previous behaviour, which was to save the up date to //! @todo I've kept the previous behaviour, which was to save the up date to
//! temporary files and then read them. If we give up on the idea to //! temporary files and then read them. If we give up on the idea to
//! re-use them later when adding manually satellites, parseTleFile( ) //! re-use them later when adding manually satellites, parseTleFile( )
//! can be modified to read directly form QNetworkReply-s. --BM //! can be modified to read directly form QNetworkReply-s. --BM
void saveDownloadedUpdate(QNetworkReply* reply); void saveDownloadedUpdate(QNetworkReply* reply);
void updateObserverLocation(StelLocation loc); void updateObserverLocation(StelLocation loc);
}; };
#include "fixx11h.h"
#include <QObject> #include <QObject>
#include "StelPluginInterface.hpp" #include "StelPluginInterface.hpp"
//! This class is used by Qt to manage a plug-in interface //! This class is used by Qt to manage a plug-in interface
class SatellitesStelPluginInterface : public QObject, public StelPluginInte rface class SatellitesStelPluginInterface : public QObject, public StelPluginInte rface
{ {
Q_OBJECT Q_OBJECT
Q_PLUGIN_METADATA(IID "stellarium.StelGuiPluginInterface/1.0")
Q_INTERFACES(StelPluginInterface) Q_INTERFACES(StelPluginInterface)
public: public:
virtual StelModule* getStelModule() const; virtual StelModule* getStelModule() const;
virtual StelPluginInfo getPluginInfo() const; virtual StelPluginInfo getPluginInfo() const;
}; };
#endif /*_SATELLITES_HPP_*/ #endif /*_SATELLITES_HPP_*/
 End of changes. 19 change blocks. 
20 lines changed or deleted 39 lines changed or added

This html diff was produced by rfcdiff 1.41. The latest version is available from http://tools.ietf.org/tools/rfcdiff/