Supernovae.hpp   Supernovae.hpp 
skipping to change at line 42 skipping to change at line 42
class QNetworkAccessManager; class QNetworkAccessManager;
class QNetworkReply; class QNetworkReply;
class QProgressBar; class QProgressBar;
class QSettings; class QSettings;
class QTimer; class QTimer;
class SupernovaeDialog; class SupernovaeDialog;
typedef QSharedPointer<Supernova> SupernovaP; typedef QSharedPointer<Supernova> SupernovaP;
//! This is an example of a plug-in which can be dynamically loaded into st /*! @mainpage notitle
ellarium @section overview Plugin Overview
The %Supernovae plugin displays the positions some historical
supernovae brighter than 10 visual magnitude.
@section sncat Supernovae Catalog
The supernovae catalog is stored on the disk in [JSON](http://www.json.org/
)
format, in a file named "supernovae.json". A default copy is embedded in th
e
plug-in at compile time. A working copy is kept in the user data directory.
@section config Configuration
The plug-ins' configuration data is stored in Stellarium's main configurati
on
file.
*/
//! @class Supernovae
//! Main class of the %Historical Supernovae plugin.
//! @author Alexander Wolf
class Supernovae : public StelObjectModule class Supernovae : public StelObjectModule
{ {
Q_OBJECT Q_OBJECT
public: public:
//! @enum UpdateState //! @enum UpdateState
//! Used for keeping for track of the download/update status //! Used for keeping for track of the download/update status
enum UpdateState { enum UpdateState {
Updating, //!< Update in progress Updating, //!< Update in progress
CompleteNoUpdates, //!< Update completed, there we no u pdates CompleteNoUpdates, //!< Update completed, there we no u pdates
CompleteUpdates, //!< Update completed, there were up dates CompleteUpdates, //!< Update completed, there were up dates
skipping to change at line 89 skipping to change at line 107
//! @param nameI18n The case in-sensistive satellite name //! @param nameI18n The case in-sensistive satellite name
virtual StelObjectP searchByNameI18n(const QString& nameI18n) const; virtual StelObjectP searchByNameI18n(const QString& nameI18n) const;
//! Return the matching satellite if exists or NULL. //! Return the matching satellite if exists or NULL.
//! @param name The case in-sensistive standard program name //! @param name The case in-sensistive standard program name
virtual StelObjectP searchByName(const QString& name) const; virtual StelObjectP searchByName(const QString& name) const;
//! Find and return the list of at most maxNbItem objects auto-compl eting the passed object I18n name. //! Find and return the list of at most maxNbItem objects auto-compl eting the passed object I18n name.
//! @param objPrefix the case insensitive first letters of the searc hed object //! @param objPrefix the case insensitive first letters of the searc hed object
//! @param maxNbItem the maximum number of returned object names //! @param maxNbItem the maximum number of returned object names
//! @param useStartOfWords the autofill mode for returned objects na mes
//! @return a list of matching object name by order of relevance, or an empty list if nothing match //! @return a list of matching object name by order of relevance, or an empty list if nothing match
virtual QStringList listMatchingObjectsI18n(const QString& objPrefix , int maxNbItem=5) const; virtual QStringList listMatchingObjectsI18n(const QString& objPrefix , int maxNbItem=5, bool useStartOfWords=false) const;
//! Find and return the list of at most maxNbItem objects auto-compl eting the passed object English name. //! Find and return the list of at most maxNbItem objects auto-compl eting the passed object English name.
//! @param objPrefix the case insensitive first letters of the searc hed object //! @param objPrefix the case insensitive first letters of the searc hed object
//! @param maxNbItem the maximum number of returned object names //! @param maxNbItem the maximum number of returned object names
//! @param useStartOfWords the autofill mode for returned objects na mes
//! @return a list of matching object name by order of relevance, or an empty list if nothing match //! @return a list of matching object name by order of relevance, or an empty list if nothing match
virtual QStringList listMatchingObjects(const QString& objPrefix, in t maxNbItem=5) const; virtual QStringList listMatchingObjects(const QString& objPrefix, in t maxNbItem=5, bool useStartOfWords=false) const;
virtual QStringList listAllObjects(bool inEnglish) const; virtual QStringList listAllObjects(bool inEnglish) const;
virtual QString getName() const { return "Historical Supernovae"; } virtual QString getName() const { return "Historical Supernovae"; }
//! get a supernova object by identifier //! get a supernova object by identifier
SupernovaP getByID(const QString& id); SupernovaP getByID(const QString& id);
//! Implement this to tell the main Stellarium GUI that there is a G UI element to configure this //! Implement this to tell the main Stellarium GUI that there is a G UI element to configure this
//! plugin. //! plugin.
virtual bool configureGui(bool show=true); virtual bool configureGui(bool show=true);
skipping to change at line 118 skipping to change at line 138
//! creates the default supernovae.json file from the resource embed ded in the plugin lib/dll file. //! creates the default supernovae.json file from the resource embed ded in the plugin lib/dll file.
void restoreDefaults(void); void restoreDefaults(void);
//! Read (or re-read) settings from the main config file. This will be called from init and also //! Read (or re-read) settings from the main config file. This will be called from init and also
//! when restoring defaults (i.e. from the configuration dialog / re store defaults button). //! when restoring defaults (i.e. from the configuration dialog / re store defaults button).
void readSettingsFromConfig(void); void readSettingsFromConfig(void);
//! Save the settings to the main configuration file. //! Save the settings to the main configuration file.
void saveSettingsToConfig(void); void saveSettingsToConfig(void);
//! get whether or not the plugin will try to update catalog data fr om the internet //! Get whether or not the plugin will try to update catalog data fr om the internet
//! @return true if updates are set to be done, false otherwise //! @return true if updates are set to be done, false otherwise
bool getUpdatesEnabled(void) {return updatesEnabled;} bool getUpdatesEnabled(void) {return updatesEnabled;}
//! set whether or not the plugin will try to update catalog data fr om the internet //! Set whether or not the plugin will try to update catalog data fr om the internet
//! @param b if true, updates will be enabled, else they will be dis abled //! @param b if true, updates will be enabled, else they will be dis abled
void setUpdatesEnabled(bool b) {updatesEnabled=b;} void setUpdatesEnabled(bool b) {updatesEnabled=b;}
//! get the date and time the supernovae were updated //! Get the date and time the supernovae were updated
QDateTime getLastUpdate(void) {return lastUpdate;} QDateTime getLastUpdate(void) {return lastUpdate;}
//! get the update frequency in days //! Get the update frequency in days
int getUpdateFrequencyDays(void) {return updateFrequencyDays;} int getUpdateFrequencyDays(void) {return updateFrequencyDays;}
void setUpdateFrequencyDays(int days) {updateFrequencyDays = days;} void setUpdateFrequencyDays(int days) {updateFrequencyDays = days;}
//! get the number of seconds till the next update //! Get the number of seconds till the next update
int getSecondsToUpdate(void); int getSecondsToUpdate(void);
//! Get the current updateState //! Get the current updateState
UpdateState getUpdateState(void) {return updateState;} UpdateState getUpdateState(void) {return updateState;}
//! get list of supernovae //! Get list of supernovae
QString getSupernovaeList(); QString getSupernovaeList();
//! Get lower limit of brightness for displayed supernovae
float getLowerLimitBrightness();
signals: signals:
//! @param state the new update state. //! @param state the new update state.
void updateStateChanged(Supernovae::UpdateState state); void updateStateChanged(Supernovae::UpdateState state);
//! emitted after a JSON update has run. //! Emitted after a JSON update has run.
void jsonUpdateComplete(void); void jsonUpdateComplete(void);
public slots: public slots:
// FIXME: Add functions for scripting support
//! Download JSON from web recources described in the module section of the //! Download JSON from web recources described in the module section of the
//! module.ini file and update the local JSON file. //! module.ini file and update the local JSON file.
void updateJSON(void); void updateJSON(void);
//! Display a message. This is used for plugin-specific warnings and such //! Display a message. 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");
void messageTimeout(void); void messageTimeout(void);
private: private:
// Font used for displaying our text // Font used for displaying our text
QFont font; QFont font;
// if existing, delete Satellites section in main config.ini, then c reate with default values // if existing, delete Satellites section in main config.ini, then c reate with default values
void restoreDefaultConfigIni(void); void restoreDefaultConfigIni(void);
//! replace the json file with the default from the compiled-in reso urce //! Replace the JSON file with the default from the compiled-in reso urce
void restoreDefaultJsonFile(void); void restoreDefaultJsonFile(void);
//! read the json file and create list of supernovae. //! Read the JSON file and create list of supernovae.
void readJsonFile(void); void readJsonFile(void);
//! Creates a backup of the supernovae.json file called supernovae.j son.old //! Creates a backup of the supernovae.json file called supernovae.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 backupJsonFile(bool deleteOriginal=false); bool backupJsonFile(bool deleteOriginal=false);
//! Get the version from the "version" value in the supernovas.json file //! Get the version from the "version" value in the supernovas.json file
//! @return version string, e.g. "1" //! @return version string, e.g. "1"
int getJsonFileVersion(void); int getJsonFileVersion(void);
//! parse JSON file and load supernovaes to map //! Parse JSON file and load supernovaes to map
QVariantMap loadSNeMap(QString path=QString()); QVariantMap loadSNeMap(QString path=QString());
//! set items for list of struct from data map //! Set items for list of struct from data map
void setSNeMap(const QVariantMap& map); void setSNeMap(const QVariantMap& map);
QString sneJsonPath; QString sneJsonPath;
class StelTextureNew* texPointer; class StelTextureNew* texPointer;
QList<SupernovaP> snstar; QList<SupernovaP> snstar;
QHash<QString, double> snlist; QHash<QString, double> snlist;
// variables and functions for the updater // variables and functions for the updater
UpdateState updateState; UpdateState updateState;
skipping to change at line 209 skipping to change at line 234
bool updatesEnabled; bool updatesEnabled;
QDateTime lastUpdate; QDateTime lastUpdate;
int updateFrequencyDays; int updateFrequencyDays;
QSettings* conf; QSettings* conf;
// GUI // GUI
SupernovaeDialog* configDialog; SupernovaeDialog* configDialog;
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);
void updateDownloadComplete(QNetworkReply* reply); void updateDownloadComplete(QNetworkReply* reply);
}; };
#include "fixx11h.h" #include "fixx11h.h"
#include <QObject> #include <QObject>
#include "StelPluginInterface.hpp" #include "StelPluginInterface.hpp"
 End of changes. 19 change blocks. 
16 lines changed or deleted 43 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/