StelLocaleMgr.hpp   StelLocaleMgr.hpp 
skipping to change at line 24 skipping to change at line 24
* *
* You should have received a copy of the GNU General Public License * You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software * along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Suite 500, Boston, MA 02110-1335, USA. * Foundation, Inc., 51 Franklin Street, Suite 500, Boston, MA 02110-1335, USA.
*/ */
#ifndef _STELLOCALEMGR_HPP_ #ifndef _STELLOCALEMGR_HPP_
#define _STELLOCALEMGR_HPP_ #define _STELLOCALEMGR_HPP_
#include "StelTranslator.hpp" #include "StelTranslator.hpp"
#include "StelCore.hpp"
//! @class StelLocaleMgr //! @class StelLocaleMgr
//! Manage i18n operations such as message translation and date/time locali zation. //! Manage i18n operations such as message translation and date/time locali zation.
//! @author Fabien Chereau //! @author Fabien Chereau
class StelLocaleMgr class StelLocaleMgr
{ {
public: public:
StelLocaleMgr(); StelLocaleMgr();
~StelLocaleMgr(); ~StelLocaleMgr();
skipping to change at line 56 skipping to change at line 57
QString getAppLanguage() const { return StelTranslator::globalTransl ator->getTrueLocaleName(); } QString getAppLanguage() const { return StelTranslator::globalTransl ator->getTrueLocaleName(); }
//! Set the application language. //! Set the application language.
//! This applies to GUI etc. This function has no permanent effect o n the global locale. //! This applies to GUI etc. This function has no permanent effect o n the global locale.
//! @param newAppLangName the abbreviated name of the language (e.g fr). //! @param newAppLangName the abbreviated name of the language (e.g fr).
void setAppLanguage(const QString& newAppLangName, bool refreshAll=t rue); void setAppLanguage(const QString& newAppLangName, bool refreshAll=t rue);
//! Get the StelTranslator object currently used for global applicat ion. //! Get the StelTranslator object currently used for global applicat ion.
const StelTranslator& getAppStelTranslator() const; const StelTranslator& getAppStelTranslator() const;
//! Get the type (RTL or LTR) of application language currently used
for GUI etc.
bool isAppRTL() const;
//! Get the language currently used for sky objects. //! Get the language currently used for sky objects.
//! This function has no permanent effect on the global locale. //! This function has no permanent effect on the global locale.
//! @return the name of the language (e.g fr). //! @return the name of the language (e.g fr).
QString getSkyLanguage() const; QString getSkyLanguage() const;
//! Set the sky language and reload the sky object names with the ne w //! Set the sky language and reload the sky object names with the ne w
//! translation. This function has no permanent effect on the globa l locale. //! translation. This function has no permanent effect on the globa l locale.
//! @param newSkyLangName The abbreviated name of the locale (e.g fr ) to use //! @param newSkyLangName The abbreviated name of the locale (e.g fr ) to use
//! for sky object labels. //! for sky object labels.
void setSkyLanguage(const QString& newSkyLangName, bool refreshAll=t rue); void setSkyLanguage(const QString& newSkyLangName, bool refreshAll=t rue);
//! Get a reference to the StelTranslator object currently used for sky objects. //! Get a reference to the StelTranslator object currently used for sky objects.
const StelTranslator &getSkyTranslator() const; const StelTranslator &getSkyTranslator() const;
//! Get the type (RTL or LTR) of language currently used for sky obj
ects
bool isSkyRTL() const;
//////////////////////////////////////////////////////////////////// /////// //////////////////////////////////////////////////////////////////// ///////
// DATE & TIME LOCALIZATION // DATE & TIME LOCALIZATION
//////////////////////////////////////////////////////////////////// /////// //////////////////////////////////////////////////////////////////// ///////
//! Get the format string which describes the current time format. //! Get the format string which describes the current time format.
//! Valid values are: //! Valid values are:
//! - "system_default" //! - "system_default"
//! - "24h" //! - "24h"
//! - "12h" //! - "12h"
//! //!
//! These values correspond to the similarly named values in the STi meFormat enum. //! These values correspond to the similarly named values in the STi meFormat enum.
skipping to change at line 98 skipping to change at line 105
//! - "system_default" //! - "system_default"
//! - "yyyymmdd" //! - "yyyymmdd"
//! //!
//! These values correspond to the similarly named values in the SDa teFormat enum. //! These values correspond to the similarly named values in the SDa teFormat enum.
QString getDateFormatStr(void) const {return sDateFormatToString(dat eFormat);} QString getDateFormatStr(void) const {return sDateFormatToString(dat eFormat);}
void setDateFormatStr(const QString& df) {dateFormat=stringToSDateFo rmat(df);} void setDateFormatStr(const QString& df) {dateFormat=stringToSDateFo rmat(df);}
//! Get the format string which describes the current date format (Q t style). //! Get the format string which describes the current date format (Q t style).
QString getQtDateFormatStr(void) const; QString getQtDateFormatStr(void) const;
//! Set the time zone.
//! @param tZ the time zone string as parsed from the TZ environment
//! varibale by the tzset function from libc.
void setCustomTimezone(QString tZ) { setCustomTzName(tZ); }
//! @enum STimeFormat //! @enum STimeFormat
//! The time display format. //! The time display format.
enum STimeFormat { enum STimeFormat {
STime24h, //!< 24 hour clock, e.g. "18:22:00" STime24h, //!< 24 hour clock, e.g. "18:22:00"
STime12h, //!< 12 hour clock, e.g. "06:22:00 p m" STime12h, //!< 12 hour clock, e.g. "06:22:00 p m"
STimeSystemDefault //!< use the system default format. STimeSystemDefault //!< use the system default format.
}; };
//! @enum SDateFormat //! @enum SDateFormat
//! The date display format. //! The date display format.
skipping to change at line 129 skipping to change at line 131
//! Get a localized, formatted string representation of the date com ponent of a Julian date. //! Get a localized, formatted string representation of the date com ponent of a Julian date.
QString getPrintableDateLocal(double JD) const; QString getPrintableDateLocal(double JD) const;
//! Get a localized, formatted string representation of the time com ponent of a Julian date. //! Get a localized, formatted string representation of the time com ponent of a Julian date.
QString getPrintableTimeLocal(double JD) const; QString getPrintableTimeLocal(double JD) const;
//! Get a localized, formatted string representation of the time zon e of a Julian date. //! Get a localized, formatted string representation of the time zon e of a Julian date.
QString getPrintableTimeZoneLocal(double JD) const; QString getPrintableTimeZoneLocal(double JD) const;
//! @enum STzFormat
enum STzFormat
{
STzCustom, //!< User-specified timezone.
STzGMTShift, //!< GMT + offset.
STzSystemDefault //!< System default.
};
//! Get the current time shift at observator time zone with respect
to GMT time.
void setGMTShift(int t)
{
GMTShift=t;
}
//! Get the current time shift in hours at observator time zone with
respect to GMT time.
float getGMTShift(double JD = 0) const;
//! Set the timezone by a TZ-style string (see tzset in the libc man
ual).
void setCustomTzName(const QString& tzname);
//! Get the timezone name (a TZ-style string - see tzset in the libc
manual).
QString getCustomTzName(void) const
{
return customTzName;
}
//! Get the current timezone format mode.
STzFormat getTzFormat(void) const
{
return timeZoneMode;
}
//! Return the time in ISO 8601 format that is : %Y-%m-%dT%H:%M:%S //! Return the time in ISO 8601 format that is : %Y-%m-%dT%H:%M:%S
//! @param JD the time and date expressed as a Julian date value. //! @param JD the time and date expressed as a Julian date value.
QString getISO8601TimeLocal(double JD) const; QString getISO8601TimeLocal(double JD) const;
//! Return the JD time for a local time ISO 8601 format that is: //! Return the JD time for a local time ISO 8601 format that is:
//! %Y-%m-%dT%H:%M:%S, but %Y can be a large number with sign, and //! %Y-%m-%dT%H:%M:%S, but %Y can be a large number with sign, and
//! %Y can be zero. //! %Y can be zero.
//! @param str the local time in ISO 8601 format. //! @param str the local time in ISO 8601 format.
//! @param ok set to false if the string was an invalid date. //! @param ok set to false if the string was an invalid date.
double getJdFromISO8601TimeLocal(const QString& str, bool* ok) const ; double getJdFromISO8601TimeLocal(const QString& str, bool* ok) const ;
//! Convert a 2 letter country code to string //! Convert a 2 letter country code to string
static QString countryCodeToString(const QString& countryCode); static QString countryCodeToString(const QString& countryCode);
//! Return an alphabetically ordered list of all the known country n ames //! Return an alphabetically ordered list of all the known country n ames
static QStringList getAllCountryNames(); static QStringList getAllCountryNames();
private: private:
// The translator used for astronomical object naming // The translator used for astronomical object naming
StelTranslator* skyTranslator; StelTranslator* skyTranslator;
StelCore* core;
// Date and time variables // Date and time variables
STimeFormat timeFormat; STimeFormat timeFormat;
SDateFormat dateFormat; SDateFormat dateFormat;
STzFormat timeZoneMode; // Can be the system default or a us
er defined value
QString customTzName; // Something like "Europe/Pa
ris"
float GMTShift; // Time shift between GMT ti
me and local time in hour. (positive for Est of GMT)
// Convert the time format enum to its associated string and reverse // Convert the time format enum to its associated string and reverse
STimeFormat stringToSTimeFormat(const QString&) const; STimeFormat stringToSTimeFormat(const QString&) const;
QString sTimeFormatToString(STimeFormat) const; QString sTimeFormatToString(STimeFormat) const;
// Convert the date format enum to its associated string and reverse // Convert the date format enum to its associated string and reverse
SDateFormat stringToSDateFormat(const QString& df) const; SDateFormat stringToSDateFormat(const QString& df) const;
QString sDateFormatToString(SDateFormat df) const; QString sDateFormatToString(SDateFormat df) const;
static QMap<QString, QString> countryCodeToStringMap; static QMap<QString, QString> countryCodeToStringMap;
 End of changes. 7 change blocks. 
44 lines changed or deleted 10 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/