Sayonara Player
LanguageUtils.h
1 /* LanguageUtils.h */
2 
3 /* Copyright (C) 2011-2020 Michael Lugmair (Lucio Carreras)
4  *
5  * This file is part of sayonara player
6  *
7  * This program is free software: you can redistribute it and/or modify
8  * it under the terms of the GNU General Public License as published by
9  * the Free Software Foundation, either version 3 of the License, or
10  * (at your option) any later version.
11 
12  * This program is distributed in the hope that it will be useful,
13  * but WITHOUT ANY WARRANTY; without even the implied warranty of
14  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15  * GNU General Public License for more details.
16 
17  * You should have received a copy of the GNU General Public License
18  * along with this program. If not, see <http://www.gnu.org/licenses/>.
19  */
20 
21 #ifndef LANGUAGEUTILS_H
22 #define LANGUAGEUTILS_H
23 
24 #include "Utils/Macros.h"
25 
26 class QString;
27 class QStringList;
28 class QLocale;
29 
30 template<typename A, typename B>
31 class QMap;
32 
33 namespace Util
34 {
39  namespace Language
40  {
47  QString getSharePath(const QString& fourLetter);
48 
55  QString getFtpPath(const QString& fourLetter);
56 
63  QString getHttpPath(const QString& fourLetter);
64 
70  QString getChecksumFtpPath();
71 
78 
85  QString getHomeTargetPath(const QString& fourLetter);
86 
94  QString getUsedLanguageFile(const QString& fourLetter);
95 
102  QString getIconPath(const QString& fourLetter);
103 
110  QString extractLanguageCode(const QString& languageFile);
111 
119  QString getChecksum(const QString& fourLetter);
120 
128  QString getLanguageVersion(const QString& fourLetter);
129 
136  void updateLanguageVersion(const QString& fourLetter);
137 
145  bool isOutdated(const QString& fourLetter);
146 
154  QString getSimilarLanguage4(const QString& fourLetter);
155 
160  QLocale getCurrentLocale();
161 
167 
174  bool importLanguageFile(const QString& filename);
175 
176 
177  #ifdef SAYONARA_WITH_TESTS
178  void setTestMode();
179  void setLanguageVersion(const QString& fourLetter, const QString& version);
180  #endif
181  }
182 }
183 
184 #endif // LANGUAGEUTILS_H
Util::Language::getHomeTargetPath
QString getHomeTargetPath(const QString &fourLetter)
get_home_target_path
Util::Language::getSharePath
QString getSharePath(const QString &fourLetter)
get the complete path to a language file out of the share directory
Util::Language::extractLanguageCode
QString extractLanguageCode(const QString &languageFile)
Extracts the language Code out of a sayonara_lang string.
Util::Language::getCurrentQtTranslationPaths
QStringList getCurrentQtTranslationPaths()
get all qt paths which include translations
Util::Language::getUsedLanguageFile
QString getUsedLanguageFile(const QString &fourLetter)
Returns the correct language file either from share dir or home dir.
Util::Language::getLanguageVersion
QString getLanguageVersion(const QString &fourLetter)
Get the language version out of translations/versions file in home dir.
Util::Language::getSimilarLanguage4
QString getSimilarLanguage4(const QString &fourLetter)
get_similar_language_4
QMap
Definition: org_mpris_media_player2_adaptor.h:21
Util
Helper functions.
Definition: GenreView.h:36
Util::Language::getChecksumHttpPath
QString getChecksumHttpPath()
Returns the path where checksums can be fetched from.
Util::Language::getChecksum
QString getChecksum(const QString &fourLetter)
calculates the checksum for the currently used language file (either home or share directory)
Util::Language::getCurrentLocale
QLocale getCurrentLocale()
get the current selected locale based on the current language file
Util::Language::getFtpPath
QString getFtpPath(const QString &fourLetter)
get the complete path to a language file out of the ftp directory
Util::Language::isOutdated
bool isOutdated(const QString &fourLetter)
Returns if the language version in translations/versions file is smaller than the current sayonara ve...
Util::Language::getChecksumFtpPath
QString getChecksumFtpPath()
Returns the path where checksums can be fetched from.
Util::Language::importLanguageFile
bool importLanguageFile(const QString &filename)
Imports a qm file. The filename must contain a valid four or two letter code.
Util::Language::getIconPath
QString getIconPath(const QString &fourLetter)
Returns the icon path in share directory.
Util::Language::updateLanguageVersion
void updateLanguageVersion(const QString &fourLetter)
Update language version in translations/versions file to current Sayonara Version.
Util::Language::getHttpPath
QString getHttpPath(const QString &fourLetter)
get the complete http url to a language file