Supernovae.hpp   Supernovae.hpp 
skipping to change at line 24 skipping to change at line 24
* You should have received a copy of the GNU General Public License * You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software * along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Suite 500, Boston, MA 02110-1335, USA. * Foundation, Inc., 51 Franklin Street, Suite 500, Boston, MA 02110-1335, USA.
*/ */
#ifndef _SUPERNOVAE_HPP_ #ifndef _SUPERNOVAE_HPP_
#define _SUPERNOVAE_HPP_ #define _SUPERNOVAE_HPP_
#include "StelObjectModule.hpp" #include "StelObjectModule.hpp"
#include "StelObject.hpp" #include "StelObject.hpp"
#include "StelFader.hpp"
#include "StelTextureTypes.hpp" #include "StelTextureTypes.hpp"
#include "StelPainter.hpp" #include "StelPainter.hpp"
#include "Supernova.hpp" #include "Supernova.hpp"
#include <QFont> #include <QFont>
#include <QVariantMap> #include <QVariantMap>
#include <QDateTime> #include <QDateTime>
#include <QList> #include <QList>
#include <QSharedPointer> #include <QSharedPointer>
#include <QHash>
class QNetworkAccessManager;
class QNetworkReply;
class QProgressBar;
class QSettings;
class QTimer;
class SupernovaeDialog;
class StelPainter; class StelPainter;
typedef QSharedPointer<Supernova> SupernovaP; typedef QSharedPointer<Supernova> SupernovaP;
//! This is an example of a plug-in which can be dynamically loaded into st ellarium //! This is an example of a plug-in which can be dynamically loaded into st ellarium
class Supernovae : public StelObjectModule class Supernovae : public StelObjectModule
{ {
Q_OBJECT
public: public:
//! @enum UpdateState
//! Used for keeping for track of the download/update status
enum UpdateState {
Updating, //!< Update in progress
CompleteNoUpdates, //!< Update completed, there we no u
pdates
CompleteUpdates, //!< Update completed, there were up
dates
DownloadError, //!< Error during download phase
OtherError //!< Other error
};
Supernovae(); Supernovae();
virtual ~Supernovae(); virtual ~Supernovae();
//////////////////////////////////////////////////////////////////// /////// //////////////////////////////////////////////////////////////////// ///////
// 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) {;} virtual void update(double) {;}
virtual void draw(StelCore* core); virtual void draw(StelCore* core);
virtual void drawPointer(StelCore* core, StelPainter& painter); virtual void drawPointer(StelCore* core, StelPainter& painter);
skipping to change at line 79 skipping to change at line 99
//! 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
//! @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) const;
//! 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
//! plugin.
virtual bool configureGui(bool show=true);
//! Set up the plugin with default values. This means clearing out
the Pulsars section in the
//! main config.ini (if one already exists), and populating it with
default values. It also
//! creates the default supernovae.json file from the resource embed
ded in the plugin lib/dll file.
void restoreDefaults(void);
//! 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).
void readSettingsFromConfig(void);
//! Save the settings to the main configuration file.
void saveSettingsToConfig(void);
//! 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
bool getUpdatesEnabled(void) {return updatesEnabled;}
//! 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
void setUpdatesEnabled(bool b) {updatesEnabled=b;}
//! get the date and time the supernovae were updated
QDateTime getLastUpdate(void) {return lastUpdate;}
//! get the update frequency in days
int getUpdateFrequencyDays(void) {return updateFrequencyDays;}
void setUpdateFrequencyDays(int days) {updateFrequencyDays = days;}
//! get the number of seconds till the next update
int getSecondsToUpdate(void);
//! Get the current updateState
UpdateState getUpdateState(void) {return updateState;}
//! get list of supernovae
QString getSupernovaeList();
signals:
//! @param state the new update state.
void updateStateChanged(Supernovae::UpdateState state);
//! emitted after a JSON update has run.
void jsonUpdateComplete(void);
public slots:
//! Download JSON from web recources described in the module section
of the
//! module.ini file and update the local JSON file.
void updateJSON(void);
//! Display a message. This is used for plugin-specific warnings and
such
void displayMessage(const QString& message, const QString hexColor="
#999999");
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
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. "0.2" //! @return version string, e.g. "1"
const QString 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;
StelTextureSP texPointer; StelTextureSP texPointer;
QList<SupernovaP> snstar; QList<SupernovaP> snstar;
QHash<QString, double> snlist;
// variables and functions for the updater
UpdateState updateState;
QNetworkAccessManager* downloadMgr;
QString updateUrl;
QString updateFile;
QProgressBar* progressBar;
QTimer* updateTimer;
QTimer* messageTimer;
QList<int> messageIDs;
bool updatesEnabled;
QDateTime lastUpdate;
int updateFrequencyDays;
QSettings* conf;
// GUI
SupernovaeDialog* configDialog;
private slots:
//! 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
//! done.
void checkForUpdate(void);
void updateDownloadComplete(QNetworkReply* reply);
}; };
#include "fixx11h.h" #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 SupernovaeStelPluginInterface : public QObject, public StelPluginInte rface class SupernovaeStelPluginInterface : public QObject, public StelPluginInte rface
{ {
 End of changes. 8 change blocks. 
2 lines changed or deleted 123 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/