comparison src/gui/locale.cc @ 118:39521c47c7a3

*: another huge megacommit, SORRY The torrents page works a lot better now Added the edit option to the anime list right click menu Vectorized currently playing files Available player and extensions are now loaded at runtime from files in (dotpath)/players.json and (dotpath)/extensions.json These paths are not permanent and will likely be moved to (dotpath)/recognition ... ... ...
author Paper <mrpapersonic@gmail.com>
date Tue, 07 Nov 2023 23:40:54 -0500
parents 79714c95a145
children 9613d72b097e
comparison
equal deleted inserted replaced
117:2c1b6782e1d0 118:39521c47c7a3
29 Locale::Locale(const std::string& name) { 29 Locale::Locale(const std::string& name) {
30 RefreshAvailableLocales(); 30 RefreshAvailableLocales();
31 SetActiveLocale(QLocale(Strings::ToQString(name))); 31 SetActiveLocale(QLocale(Strings::ToQString(name)));
32 } 32 }
33 33
34 QLocale Locale::GetLocale() { 34 QLocale Locale::GetLocale() const {
35 return _locale; 35 return _locale;
36 } 36 }
37 37
38 std::vector<QLocale> Locale::GetAvailableLocales() { 38 std::vector<QLocale> Locale::GetAvailableLocales() const {
39 return _available_translations; 39 return _available_translations;
40 } 40 }
41 41
42 void Locale::RefreshAvailableLocales() { 42 void Locale::RefreshAvailableLocales() {
43 _available_translations.clear(); 43 _available_translations.clear();
55 for (const QString& str : translations) { 55 for (const QString& str : translations) {
56 _available_translations.push_back(QLocale(str.mid(0, str.lastIndexOf(".")))); 56 _available_translations.push_back(QLocale(str.mid(0, str.lastIndexOf("."))));
57 } 57 }
58 } 58 }
59 59
60 bool Locale::IsLocaleAvailable(const QLocale& locale) { 60 bool Locale::IsLocaleAvailable(const QLocale& locale) const {
61 for (const QLocale& l : _available_translations) 61 for (const QLocale& l : _available_translations)
62 if (l == locale) 62 if (l == locale)
63 return true; 63 return true;
64 return false; 64 return false;
65 } 65 }