StelLocationMgr.hpp   StelLocationMgr.hpp 
skipping to change at line 32 skipping to change at line 32
#include "StelLocation.hpp" #include "StelLocation.hpp"
#include <QString> #include <QString>
#include <QObject> #include <QObject>
#include <QMetaType> #include <QMetaType>
#include <QMap> #include <QMap>
typedef QList<StelLocation> LocationList; typedef QList<StelLocation> LocationList;
typedef QMap<QString,StelLocation> LocationMap; typedef QMap<QString,StelLocation> LocationMap;
typedef QMap<QByteArray,QByteArray> TimezoneNameMap; typedef QMap<QByteArray,QByteArray> TimezoneNameMap;
class GPSLookupHelper;
//! @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 which loads the list of locations from the b ase and user location files. //! Default constructor which loads the list of locations from the b ase and user location files.
StelLocationMgr(); StelLocationMgr();
~StelLocationMgr();
//! Construct a StelLocationMgr which uses the locations given inste ad of loading them from the files. //! Construct a StelLocationMgr which uses the locations given inste ad of loading them from the files.
StelLocationMgr(const LocationList& locations); StelLocationMgr(const LocationList& locations);
//! Replaces the loaded location list //! Replaces the loaded location list
void setLocations(const LocationList& locations); void setLocations(const LocationList& locations);
//! Return the list of all loaded locations //! Return the list of all loaded locations
LocationList getAll() const {return locations.values();} LocationList getAll() const {return locations.values();}
skipping to change at line 78 skipping to change at line 81
//! Get whether a location can be deleted from the list of user loca tions //! Get whether a location can be deleted from the list of user loca tions
//! If the location comes from the base read only list, it cannot be deleted //! If the location comes from the base read only list, it cannot be deleted
//! @param id the location ID //! @param id the location ID
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
void locationFromIP();
//! Find list of locations within @param radiusDegrees of selected ( usually screen-clicked) coordinates. //! Find list of locations within @param radiusDegrees of selected ( usually screen-clicked) coordinates.
LocationMap pickLocationsNearby(const QString planetName, const floa t longitude, const float latitude, const float radiusDegrees); LocationMap pickLocationsNearby(const QString planetName, const floa t longitude, const float latitude, const float radiusDegrees);
//! Find list of locations in a particular country only. //! Find list of locations in a particular country only.
LocationMap pickLocationsInCountry(const QString country); LocationMap pickLocationsInCountry(const QString country);
public slots: public slots:
//! Return the StelLocation for a given string //! Return the StelLocation for a given string
//! Can match location name, or coordinates //! Can match location name, or coordinates
const StelLocation locationForString(const QString& s) const; const StelLocation locationForString(const QString& s) const;
//! Process answer from online lookup of IP address //! Find location via online lookup of IP address
void changeLocationFromNetworkLookup(); void locationFromIP();
#ifdef ENABLE_GPS
//! Try to get a location from GPS lookup.
//! This prefers GPSD on non-Windows platforms, and uses Qt position
ing/NMEA otherwise
//! Use the gpsResult() signal to determine if the location was set
successfully
//! @note When using GPSD not on localhost, don't forget the -G swit
ch when starting gpsd there!
//! @return true if a query has been made, false if not
bool locationFromGPS();
#endif
//! Check timezone string and return either the same or one that we use in the Stellarium location database. //! Check timezone string and return either the same or one that we use in the Stellarium location database.
//! If timezone name starts with "UTC", always return unchanged. //! If timezone name starts with "UTC", always return unchanged.
//! This is required to store timezone names exactly as we know them , and not mix ours and corrent-IANA spelling flavour. //! This is required to store timezone names exactly as we know them , and not mix ours and corrent-IANA spelling flavour.
static QString sanitizeTimezoneStringForLocationDB(QString tzString) ; static QString sanitizeTimezoneStringForLocationDB(QString tzString) ;
//! Attempt to translate a timezone name from those used in Stellari um's location database to a name which is known //! Attempt to translate a timezone name from those used in Stellari um's location database to a name which is known
//! to Qt at runtime as result of QTimeZone::availableTimeZoneIds(). That list may be updated by OS anytime and is known to differ //! to Qt at runtime as result of QTimeZone::availableTimeZoneIds(). That list may be updated by OS anytime and is known to differ
//! between OSes. Some spellings may be different, or in some cases some names get simply translated to "UTC+HH:MM" style. //! between OSes. Some spellings may be different, or in some cases some names get simply translated to "UTC+HH:MM" style.
//! The empty string gets translated to "UTC". //! The empty string gets translated to "UTC".
static QString sanitizeTimezoneStringFromLocationDB(QString dbString ); static QString sanitizeTimezoneStringFromLocationDB(QString dbString );
signals: signals:
//! Can be used to detect changes to the full location list //! Can be used to detect changes to the full location list
//! i.e. when the user added or removed locations //! i.e. when the user added or removed locations
void locationListChanged(); void locationListChanged();
#ifdef ENABLE_GPS
//! emitted when GPS location query and setting location either succ
eed or fail.
//! @param success true if successful, false in case of any error (n
o device, timeout, bad fix, ...).
void gpsQueryFinished(bool success);
#endif
private slots:
//! Process answer from online lookup of IP address
void changeLocationFromNetworkLookup();
#ifdef ENABLE_GPS
void changeLocationFromGPSQuery(const StelLocation& loc);
void gpsQueryError(const QString& err);
#endif
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
static LocationMap loadCities(const QString& fileName, bool isUserLo cation); static LocationMap loadCities(const QString& fileName, bool isUserLo cation);
static LocationMap loadCitiesBin(const QString& fileName); static LocationMap loadCitiesBin(const QString& fileName);
//! The list of all loaded locations //! The list of all loaded locations
LocationMap locations; LocationMap locations;
//! A Map which has to be used to replace, system- and Qt-version de pendent, //! A Map which has to be used to replace, system- and Qt-version de pendent,
skipping to change at line 130 skipping to change at line 151
//! Required to avoid https://bugs.launchpad.net/stellarium/+bug/166 2132, //! Required to avoid https://bugs.launchpad.net/stellarium/+bug/166 2132,
//! details on IANA names with Qt at http://doc.qt.io/qt-5/qtimezone .html. //! details on IANA names with Qt at http://doc.qt.io/qt-5/qtimezone .html.
//! This has nothing to do with the Windows timezone names! //! This has nothing to do with the Windows timezone names!
//! Key: TZ name as used in our database. //! Key: TZ name as used in our database.
//! Value: TZ name as may be available instead in the currently runn ing version of Qt. //! Value: TZ name as may be available instead in the currently runn ing version of Qt.
//! The list has to be maintained based on empirical observations. //! The list has to be maintained based on empirical observations.
//! @todo Make it load from a configurable external file. //! @todo Make it load from a configurable external file.
static TimezoneNameMap locationDBToIANAtranslations; static TimezoneNameMap locationDBToIANAtranslations;
StelLocation lastResortLocation; StelLocation lastResortLocation;
GPSLookupHelper *nmeaHelper,*libGpsHelper;
}; };
#endif // _STELLOCATIONMGR_HPP_ #endif // _STELLOCATIONMGR_HPP_
 End of changes. 6 change blocks. 
5 lines changed or deleted 33 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/