MultiLevelJsonBase.hpp   MultiLevelJsonBase.hpp 
skipping to change at line 27 skipping to change at line 27
*/ */
#ifndef _MULTILEVELJSONBASE_HPP_ #ifndef _MULTILEVELJSONBASE_HPP_
#define _MULTILEVELJSONBASE_HPP_ #define _MULTILEVELJSONBASE_HPP_
#include <QList> #include <QList>
#include <QString> #include <QString>
#include <QVariantMap> #include <QVariantMap>
#include <QNetworkReply> #include <QNetworkReply>
#include "StelSkyLayer.hpp"
class QIODevice; class QIODevice;
class StelCore; class StelCore;
//! Abstract base class for managing multi-level tree objects stored in JSO //! Abstract base class for managing multi-level tree objects stored in JSO
N format N format.
class MultiLevelJsonBase : public QObject //! The JSON files can be stored on disk or remotely and are loaded into th
reads.
class MultiLevelJsonBase : public StelSkyLayer
{ {
Q_OBJECT Q_OBJECT
friend class JsonLoadThread; friend class JsonLoadThread;
public: public:
//! Default constructor //! Default constructor.
MultiLevelJsonBase(MultiLevelJsonBase* parent=NULL); MultiLevelJsonBase(MultiLevelJsonBase* parent=NULL);
//! Init the element from a URL //! Init the element from a URL.
//! This method should be called by the constructors of the subclass //! This method should be called by the constructors of the subclass
.
void initFromUrl(const QString& url); void initFromUrl(const QString& url);
//! Init the element from a QVariantMap //! Init the element from a QVariantMap.
//! This method should be called by the constructors of the subclass //! This method should be called by the constructors of the subclass
.
void initFromQVariantMap(const QVariantMap& map); void initFromQVariantMap(const QVariantMap& map);
//! Destructor //! Destructor.
~MultiLevelJsonBase(); ~MultiLevelJsonBase();
//! Return the short name for this image to be used in the loading b ar //! Return the short name for this image to be used in the loading b ar.
QString getShortName() const {return shortName;} QString getShortName() const {return shortName;}
//! Return true if an error occured while loading the data //! Return true if an error occured while loading the data.
bool hasErrorOccured() const {return errorOccured;} bool hasErrorOccured() const {return errorOccured;}
//! Get the depth level in the tree //! Get the depth level in the tree.
int getLevel() const {return parent()==NULL ? 0 : (qobject_cast<Mult iLevelJsonBase*>(parent()))->getLevel()+1;} int getLevel() const {return parent()==NULL ? 0 : (qobject_cast<Mult iLevelJsonBase*>(parent()))->getLevel()+1;}
//! Convert the image informations to a map following the JSON struc ture. //! Convert the image informations to a map following the JSON struc ture.
//! It can be saved as JSON using the StelJsonParser methods. //! It can be saved as JSON using the StelJsonParser methods.
QVariantMap toQVariantMap() const; QVariantMap toQVariantMap() const;
//! Schedule a deletion for all the childs. It will practically occu //! Schedule a deletion for all the childs.
r after the delay passed as argument to deleteUnusedTiles() has expired //! It will practically occur after the delay passed as argument to
deleteUnusedTiles() has expired.
void scheduleChildsDeletion(); void scheduleChildsDeletion();
signals:
//! Emitted when loading of data started or stopped
//! @param b true if data loading started, false if finished
void loadingStateChanged(bool b);
//! Emitted when the percentage of loading tiles/tiles to be display
ed changed
//! @param percentage the percentage of loaded data
void percentLoadedChanged(int percentage);
private slots: private slots:
//! Called when the download for the JSON file terminated //! Called when the download for the JSON file terminated.
void downloadFinished(); void downloadFinished();
//! Called when the JSON file is loaded //! Called when the JSON file is loaded.
void jsonLoadFinished(); void jsonLoadFinished();
protected: protected:
//! Return true if a deletion is currently scheduled //! Load the element from a valid QVariantMap.
//! This method is called after the JSON files are downloaded and pa
rsed into a QVariantMap.
virtual void loadFromQVariantMap(const QVariantMap& map)=0;
//! Return true if a deletion is currently scheduled.
bool isDeletionScheduled() const {return timeWhenDeletionScheduled>0 .;} bool isDeletionScheduled() const {return timeWhenDeletionScheduled>0 .;}
//! The very short name for this image set to be used in loading bar //! The very short name for this image set to be used in loading bar .
QString shortName; QString shortName;
//! Base URL to prefix to relative URL //! Base URL to prefix to relative URL
QString baseUrl; QString baseUrl;
//! The relative URL passed to the constructor //! The relative URL passed to the constructor
QString contructorUrl; QString contructorUrl;
//! The list of all the subTiles URL or already loaded JSON map for
this tile
QVariantList subTilesUrls;
//! The list of all the created subtiles for this tile //! The list of all the created subtiles for this tile
QList<MultiLevelJsonBase*> subTiles; QList<MultiLevelJsonBase*> subTiles;
//! Set to true if an error occured with this tile and it should not be displayed //! Set to true if an error occured with this tile and it should not be displayed
bool errorOccured; bool errorOccured;
//! Load the element from a valid QVariantMap
virtual void loadFromQVariantMap(const QVariantMap& map)=0;
void updatePercent(int tot, int numToBeLoaded); void updatePercent(int tot, int numToBeLoaded);
//! Delete all the subtiles which were not displayed since more than lastDrawTrigger seconds //! Delete all the subtiles which were not displayed since more than lastDrawTrigger seconds
void deleteUnusedSubTiles(); void deleteUnusedSubTiles();
//! true if the JSON descriptor file is currently downloading //! true if the JSON descriptor file is currently downloading
bool downloading; bool downloading;
//! If a deletion was scheduled, cancel it. //! If a deletion was scheduled, cancel it.
void cancelDeletion(); void cancelDeletion();
 End of changes. 17 change blocks. 
35 lines changed or deleted 30 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/