StelLocationMgr.hpp   StelLocationMgr.hpp 
skipping to change at line 28 skipping to change at line 28
#ifndef _STELLOCATIONMGR_HPP_ #ifndef _STELLOCATIONMGR_HPP_
#define _STELLOCATIONMGR_HPP_ #define _STELLOCATIONMGR_HPP_
#include "StelLocation.hpp" #include "StelLocation.hpp"
#include <QString> #include <QString>
#include <QObject> #include <QObject>
#include <QMetaType> #include <QMetaType>
#include <QMap> #include <QMap>
class QStringListModel; typedef QList<StelLocation> LocationList;
typedef QMap<QString,StelLocation> LocationMap;
//! @class StelLocationMgr //! @class StelLocationMgr
//! Manage the list of available location. //! Manage the list of available location.
class StelLocationMgr : public QObject class StelLocationMgr : public QObject
{ {
Q_OBJECT Q_OBJECT
public: public:
//! Default constructor //! Default constructor which loads the list of locations from the b ase and user location files.
StelLocationMgr(); StelLocationMgr();
//! Destructor
~StelLocationMgr();
//! Return the model containing all the city //! Construct a StelLocationMgr which uses the locations given inste
QStringListModel* getModelAll() {return modelAllLocation;} ad of loading them from the files.
//! Return the model containing picked (nearby) cities or cities fro StelLocationMgr(const LocationList& locations);
m a single country, or other preselection.
QStringListModel* getModelPicked() {return modelPickedLocation;} //! Replaces the loaded location list
void setLocations(const LocationList& locations);
//! Return the list of all loaded locations //! Return the list of all loaded locations
QList<StelLocation> getAll() const {return locations.values();} LocationList getAll() const {return locations.values();}
//! Return the StelLocation for a given string //! Returns a map of all loaded locations. The key is the location I
//! Can match location name, or coordinates D, suitable for a list view.
const StelLocation locationForString(const QString& s) const; LocationMap getAllMap() const { return locations; }
//! Return the StelLocation from a CLI //! Return the StelLocation from a CLI
const StelLocation locationFromCLI() const; const StelLocation locationFromCLI() const;
//! Return a valid location when no valid one was found. //! Return a valid location when no valid one was found.
const StelLocation& getLastResortLocation() const {return lastResort Location;} const StelLocation& getLastResortLocation() const {return lastResort Location;}
//! Get whether a location can be permanently added to the list of u ser locations //! Get whether a location can be permanently added to the list of u ser locations
//! The main constraint is that the small string must be unique //! The main constraint is that the small string must be unique
bool canSaveUserLocation(const StelLocation& loc) const; bool canSaveUserLocation(const StelLocation& loc) const;
skipping to change at line 81 skipping to change at line 80
bool canDeleteUserLocation(const QString& id) const; bool canDeleteUserLocation(const QString& id) const;
//! Delete permanently the given location from the list of user loca tions //! Delete permanently the given location from the list of user loca tions
//! If the location comes from the base read only list, it cannot be deleted and false is returned //! If the location comes from the base read only list, it cannot be deleted and false is returned
//! @param id the location ID //! @param id the location ID
bool deleteUserLocation(const QString& id); bool deleteUserLocation(const QString& id);
//! Find location via online lookup of IP address //! Find location via online lookup of IP address
void locationFromIP(); void locationFromIP();
//! Preselect list of locations within @param radiusDegrees of selec //! Find list of locations within @param radiusDegrees of selected (
ted (usually screen-clicked) coordinates. usually screen-clicked) coordinates.
//! The list can be retrieved by calling @name getModelPicked(). LocationMap pickLocationsNearby(const QString planetName, const floa
void pickLocationsNearby(const QString planetName, const float longi t longitude, const float latitude, const float radiusDegrees);
tude, const float latitude, const float radiusDegrees); //! Find list of locations in a particular country only.
//! Preselect list of locations in a particular country only. LocationMap pickLocationsInCountry(const QString country);
//! The list can be retrieved by calling @name getModelPicked().
void pickLocationsInCountry(const QString country);
public slots: public slots:
//! Return the StelLocation for a given string
//! Can match location name, or coordinates
const StelLocation locationForString(const QString& s) const;
//! Process answer from online lookup of IP address //! Process answer from online lookup of IP address
void changeLocationFromNetworkLookup(); void changeLocationFromNetworkLookup();
signals:
//! Can be used to detect changes to the full location list
//! i.e. when the user added or removed locations
void locationListChanged();
private: private:
void generateBinaryLocationFile(const QString& txtFile, bool isUserL ocation, const QString& binFile) const; void generateBinaryLocationFile(const QString& txtFile, bool isUserL ocation, const QString& binFile) const;
//! Load cities from a file //! Load cities from a file
QMap<QString, StelLocation> loadCities(const QString& fileName, bool static LocationMap loadCities(const QString& fileName, bool isUserLo
isUserLocation) const; cation);
QMap<QString, StelLocation> loadCitiesBin(const QString& fileName) c static LocationMap loadCitiesBin(const QString& fileName);
onst;
//! Model containing all the city information
QStringListModel* modelAllLocation;
//! Model containing selected city information
QStringListModel* modelPickedLocation;
//! The list of all loaded locations //! The list of all loaded locations
QMap<QString, StelLocation> locations; LocationMap locations;
//! A list of locations generated on-the-fly by filtering from @name
locations
QMap<QString, StelLocation> pickedLocations;
StelLocation lastResortLocation; StelLocation lastResortLocation;
}; };
#endif // _STELLOCATIONMGR_HPP_ #endif // _STELLOCATIONMGR_HPP_
 End of changes. 11 change blocks. 
34 lines changed or deleted 32 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/