Quasars.hpp   Quasars.hpp 
skipping to change at line 35 skipping to change at line 35
#include "StelPainter.hpp" #include "StelPainter.hpp"
#include "Quasar.hpp" #include "Quasar.hpp"
#include <QFont> #include <QFont>
#include <QVariantMap> #include <QVariantMap>
#include <QDateTime> #include <QDateTime>
#include <QList> #include <QList>
#include <QSharedPointer> #include <QSharedPointer>
class StelPainter; class StelPainter;
class QNetworkAccessManager;
class QNetworkReply;
class QProgressBar;
class QSettings;
class QTimer;
class QuasarsDialog;
typedef QSharedPointer<Quasar> QuasarP; typedef QSharedPointer<Quasar> QuasarP;
//! 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 Quasars : public StelObjectModule class Quasars : 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
};
Quasars(); Quasars();
virtual ~Quasars(); virtual ~Quasars();
//////////////////////////////////////////////////////////////////// /////// //////////////////////////////////////////////////////////////////// ///////
// 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 97
//! 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 Quasar object by identifier //! get a Quasar object by identifier
QuasarP getByID(const QString& id); QuasarP 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 Quasars 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(Quasars::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 quasars. //! read the json file and create list of quasars.
void readJsonFile(void); void readJsonFile(void);
//! Creates a backup of the catalog.json file called catalog.json.ol d //! Creates a backup of the catalog.json file called catalog.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 e //! Get the version from the "version" value in the catalog.json fil e
//! @return version string, e.g. "0.2.1" //! @return version string, e.g. "0.2.1"
const QString getJsonFileVersion(void); int getJsonFileVersion(void);
//! parse JSON file and load quasars to map //! parse JSON file and load quasars to map
QVariantMap loadQSOMap(QString path=QString()); QVariantMap loadQSOMap(QString path=QString());
//! set items for list of struct from data map //! set items for list of struct from data map
void setQSOMap(const QVariantMap& map); void setQSOMap(const QVariantMap& map);
QString catalogJsonPath; QString catalogJsonPath;
StelTextureSP texPointer; StelTextureSP texPointer;
QList<QuasarP> QSO; QList<QuasarP> QSO;
// 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
QuasarsDialog* 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 QuasarsStelPluginInterface : public QObject, public StelPluginInterfa ce class QuasarsStelPluginInterface : public QObject, public StelPluginInterfa ce
{ {
Q_OBJECT Q_OBJECT
 End of changes. 7 change blocks. 
1 lines changed or deleted 120 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/