Stellarium 0.11.1
Home · All Namespaces · All Classes · Functions · Coding Style · Scripting · Plugins · File Structure
Public Member Functions | Protected Member Functions | Static Protected Member Functions | Protected Attributes
MultiLevelJsonBase Class Reference

#include <MultiLevelJsonBase.hpp>

List of all members.

Public Member Functions

 MultiLevelJsonBase (MultiLevelJsonBase *parent=NULL)
void initFromUrl (const QString &url)
void initFromQVariantMap (const QVariantMap &map)
 ~MultiLevelJsonBase ()
QString getShortName () const
bool hasErrorOccured () const
int getLevel () const
QVariantMap toQVariantMap () const
void scheduleChildsDeletion ()

Protected Member Functions

virtual void loadFromQVariantMap (const QVariantMap &map)=0
bool isDeletionScheduled () const
void updatePercent (int tot, int numToBeLoaded)
void deleteUnusedSubTiles ()
void cancelDeletion ()

Static Protected Member Functions

static QVariantMap loadFromJSON (QIODevice &input, bool qZcompressed=false, bool gzCompressed=false)

Protected Attributes

QString shortName
QString baseUrl
QString contructorUrl
QList< MultiLevelJsonBase * > subTiles
bool errorOccured
bool downloading

Detailed Description

Abstract base class for managing multi-level tree objects stored in JSON format.

The JSON files can be stored on disk or remotely and are loaded into threads.

Member Function Documentation

void MultiLevelJsonBase::initFromQVariantMap ( const QVariantMap &  map)

Init the element from a QVariantMap.

This method should be called by the constructors of the subclass.

void MultiLevelJsonBase::initFromUrl ( const QString &  url)

Init the element from a URL.

This method should be called by the constructors of the subclass.

virtual void MultiLevelJsonBase::loadFromQVariantMap ( const QVariantMap &  map) [protected, pure virtual]

Load the element from a valid QVariantMap.

This method is called after the JSON files are downloaded and parsed into a QVariantMap.

Implemented in StelSkyImageTile, and StelSkyPolygon.

Schedule a deletion for all the childs.

It will practically occur after the delay passed as argument to deleteUnusedTiles() has expired.

QVariantMap MultiLevelJsonBase::toQVariantMap ( ) const

Convert the image informations to a map following the JSON structure.

It can be saved as JSON using the StelJsonParser methods.

Reimplemented in StelSkyImageTile, and StelSkyPolygon.