Pulsars.hpp   Pulsars.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 _PULSARS_HPP_ #ifndef _PULSARS_HPP_
#define _PULSARS_HPP_ #define _PULSARS_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 "Pulsar.hpp" #include "Pulsar.hpp"
#include <QFont> #include <QFont>
#include <QVariantMap> #include <QVariantMap>
#include <QDateTime> #include <QDateTime>
#include <QList> #include <QList>
#include <QSharedPointer> #include <QSharedPointer>
class QNetworkAccessManager;
class QNetworkReply;
class QProgressBar;
class QSettings;
class QTimer;
class PulsarsDialog;
class StelPainter; class StelPainter;
typedef QSharedPointer<Pulsar> PulsarP; typedef QSharedPointer<Pulsar> PulsarP;
//! 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 Pulsars : public StelObjectModule class Pulsars : 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
};
Pulsars(); Pulsars();
virtual ~Pulsars(); virtual ~Pulsars();
//////////////////////////////////////////////////////////////////// /////// //////////////////////////////////////////////////////////////////// ///////
// 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 98
//! 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 Pulsar object by identifier //! get a Pulsar object by identifier
PulsarP getByID(const QString& id); PulsarP 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 pulsars.json file from the resource embedded
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;}
bool getDisplayMode(void) {return distributionEnabled;}
void setDisplayMode(bool b) {distributionEnabled=b;}
//! get the date and time the TLE elements 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;}
signals:
//! @param state the new update state.
void updateStateChanged(Pulsars::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 Pulsars. //! read the json file and create list of Pulsars.
void readJsonFile(void); void readJsonFile(void);
//! Creates a backup of the Pulsars.json file called catalog.json.ol d //! Creates a backup of the pulsars.json file called pulsars.json.ol d
//! @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 catalog.json fil //! Get the version from the "version" value in the pulsars.json fil
e e
//! @return version string, e.g. "0.1" //! @return version string, e.g. "2"
const QString getJsonFileVersion(void); int getJsonFileVersion(void);
//! parse JSON file and load pulsars to map //! parse JSON file and load pulsars to map
QVariantMap loadPSRMap(QString path=QString()); QVariantMap loadPSRMap(QString path=QString());
//! set items for list of struct from data map //! set items for list of struct from data map
void setPSRMap(const QVariantMap& map); void setPSRMap(const QVariantMap& map);
QString jsonCatalogPath; QString jsonCatalogPath;
StelTextureSP texPointer; StelTextureSP texPointer;
QList<PulsarP> psr; QList<PulsarP> psr;
// 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;
bool distributionEnabled;
QSettings* conf;
// GUI
PulsarsDialog* 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 PulsarsStelPluginInterface : public QObject, public StelPluginInterfa ce class PulsarsStelPluginInterface : public QObject, public StelPluginInterfa ce
{ {
Q_OBJECT Q_OBJECT
 End of changes. 9 change blocks. 
5 lines changed or deleted 125 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/