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 template<typename A, typename B>
28 class QMap;
29 
30 namespace Util
31 {
36  namespace Language
37  {
44  QString getSharePath(const QString& fourLetter);
45 
52  QString getFtpPath(const QString& fourLetter);
53 
60  QString getHttpPath(const QString& fourLetter);
61 
67  QString getChecksumFtpPath();
68 
74  QString getChecksumHttpPath();
75 
82  QString getHomeTargetPath(const QString& fourLetter);
83 
91  QString getUsedLanguageFile(const QString& fourLetter);
92 
99  QString getIconPath(const QString& fourLetter);
100 
107  QString extractFourLetter(const QString& language_file);
108 
116  QString getChecksum(const QString& fourLetter);
117 
125  QString getLanguageVersion(const QString& fourLetter);
126 
133  void updateLanguageVersion(const QString& fourLetter);
134 
142  bool isOutdated(const QString& fourLetter);
143 
151  QString getSimilarLanguage4(const QString& fourLetter);
152 
153  #ifdef SAYONARA_WITH_TESTS
154  void setTestMode();
155  void setLanguageVersion(const QString& fourLetter, const QString& version);
156  #endif
157  }
158 }
159 
160 #endif // LANGUAGEUTILS_H
QString getSharePath(const QString &fourLetter)
get the complete path to a language file out of the share directory
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.
Definition: org_mpris_media_player2_adaptor.h:21
QString getHomeTargetPath(const QString &fourLetter)
get_home_target_path