File indexing completed on 2024-04-21 03:49:43

0001 // SPDX-License-Identifier: LGPL-2.1-or-later
0002 //
0003 // SPDX-FileCopyrightText: 2006-2007 Torsten Rahn <tackat@kde.org>
0004 // SPDX-FileCopyrightText: 2007 Inge Wallin <ingwa@kde.org>
0005 // SPDX-FileCopyrightText: 2015 Ilya Kowalewski <illya.kovalevskyy@gmail.com>
0006 //
0007 
0008 #ifndef MARBLE_MARBLELOCALE_H
0009 #define MARBLE_MARBLELOCALE_H
0010 
0011 #include "marble_export.h"
0012 
0013 #include <QtGlobal>
0014 
0015 namespace Marble
0016 {
0017 
0018 class MarbleLocalePrivate;
0019 
0020 /**
0021  * @short A class that contains all localization stuff for Marble.
0022  *
0023  * The class stores properties like the measurement system.
0024  */
0025 
0026 class MARBLE_EXPORT MarbleLocale
0027 {
0028  public:
0029     MarbleLocale();
0030     ~MarbleLocale();
0031 
0032     enum MeasurementSystem {
0033         MetricSystem = 0,
0034         ImperialSystem,
0035         NauticalSystem
0036     };
0037 
0038     enum MeasureUnit {
0039         Meter = 0,
0040         Kilometer,
0041         Milimeter,
0042         Centimeter,
0043 
0044         Foot,
0045         Inch,
0046         Yard,
0047         Mile,
0048 
0049         NauticalMile
0050     };
0051 
0052     void setMeasurementSystem( MarbleLocale::MeasurementSystem measurementSystem );
0053     MarbleLocale::MeasurementSystem measurementSystem() const;
0054 
0055     static QString languageCode();
0056 
0057     /**
0058      * @brief meterToCustomUnit Converts @p meters to @p targetValue of @p targetUnit in @p targetSystem
0059      */
0060     static void meterToTargetUnit(qreal meters, MeasurementSystem targetSystem,
0061                                   qreal &targetValue, MeasureUnit &targetUnit);
0062 
0063     /**
0064      * @brief unitAbbreviation Represents a short string form of @p unit, e.g. "km" for Kilometer
0065      */
0066     static QString unitAbbreviation(MeasureUnit unit);
0067 
0068  private:
0069     Q_DISABLE_COPY( MarbleLocale )
0070     MarbleLocalePrivate  * const d;
0071 };
0072 
0073 }
0074 
0075 #endif