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 
77  QString getChecksumHttpPath();
78 
85  QString getHomeTargetPath(const QString& fourLetter);
86 
94  QString getUsedLanguageFile(const QString& fourLetter);
95 
102  QString getIconPath(const QString& fourLetter);
103 
110  QString extractFourLetter(const QString& language_file);
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 
166  QStringList getCurrentQtTranslationPaths();
167 
168  #ifdef SAYONARA_WITH_TESTS
169  void setTestMode();
170  void setLanguageVersion(const QString& fourLetter, const QString& version);
171  #endif
172  }
173 }
174 
175 #endif // LANGUAGEUTILS_H
QString getSharePath(const QString &fourLetter)
get the complete path to a language file out of the share directory
QLocale getCurrentLocale()
get the current selected locale based on the current language file
QString getUsedLanguageFile(const QString &fourLetter)
Returns the correct language file either from share dir or home dir.
QString getLanguageVersion(const QString &fourLetter)
Get the language version out of translations/versions file in home dir.
QString getSimilarLanguage4(const QString &fourLetter)
get_similar_language_4
QString getChecksumHttpPath()
Returns the path where checksums can be fetched from.
QString getChecksum(const QString &fourLetter)
calculates the checksum for the currently used language file (either home or share directory)
bool isOutdated(const QString &fourLetter)
Returns if the language version in translations/versions file is smaller than the current sayonara ve...
QString extractFourLetter(const QString &language_file)
Extracts the language Code out of a sayonara_lang string.
Helper functions.
Definition: GenreView.h:35
QString getFtpPath(const QString &fourLetter)
get the complete path to a language file out of the ftp directory
QString getChecksumFtpPath()
Returns the path where checksums can be fetched from.
QString getIconPath(const QString &fourLetter)
Returns the icon path in share directory.
QString getHttpPath(const QString &fourLetter)
get the complete http url to a language file
void updateLanguageVersion(const QString &fourLetter)
Update language version in translations/versions file to current Sayonara Version.
QStringList getCurrentQtTranslationPaths()
get all qt paths which include translations
Definition: org_mpris_media_player2_adaptor.h:21
QString getHomeTargetPath(const QString &fourLetter)
get_home_target_path