Go to the documentation of this file.
27 m_exitOnFinish(exitOnFinish),
58 LOG(VB_GENERAL, LOG_ALERT,
59 "Cannot load screen 'languageselection'");
105 if (langCode.isEmpty())
106 langCode = locale->GetLanguageCode();
107 QString localeCode = locale->GetLocaleCode();
108 QString countryCode = locale->GetCountryCode();
110 LOG(VB_GENERAL, LOG_INFO,
111 QString(
"System Locale (%1), Country (%2), Language (%3)")
112 .arg(localeCode, countryCode, langCode));
115 QStringList langs = langMap.values();
117 bool foundLanguage =
false;
118 for (
const auto& nativeLang : qAsConst(langs))
120 QString code = langMap.key(nativeLang);
123 item->SetText(language,
"language");
124 item->SetText(nativeLang,
"nativelanguage");
129 code == langCode || code == localeCode)
132 foundLanguage =
true;
138 LOG(VB_GUI, LOG_ERR,
"ERROR - Failed to load translations, at least "
139 "one translation file MUST be installed.");
142 "English (United States)");
143 item->SetText(
"English (United States)",
"language");
144 item->SetText(
"English (United States)",
"nativelanguage");
145 item->SetData(
"en_US");
152 QStringList locales = localesMap.values();
154 for (
const auto& country : qAsConst(locales))
156 QString code = localesMap.key(country);
160 item->SetText(country,
"country");
161 item->SetText(nativeCountry,
"nativecountry");
162 item->SetImage(QString(
"locale/%1.png").arg(code.toLower()));
164 if (code ==
m_country || code == countryCode)
179 if (
force || language.isEmpty() || country.isEmpty())
187 if (langSettings->Create())
189 mainStack->
AddScreen(langSettings,
false);
190 langSettings->m_loop->exec();
191 mainStack->
PopScreen(langSettings,
false);
208 "LanguageSelection::Save called without current languageList");
212 QString langCode = item->
GetData().toString();
221 "LanguageSelection::Save called without current countryList");
225 QString countryCode = item->
GetData().toString();
MythScreenStack * GetMainStack()
MythUIButtonList * m_languageList
QString GetISO639EnglishLanguageName(const QString &iso639_1)
~LanguageSelection(void) override
MythLocale * GetLocale(void) const
void Load(void) override
Load data which will ultimately be displayed on-screen or used to determine what appears on-screen (S...
LanguageSelection(MythScreenStack *parent, bool exitOnFinish=false)
#define LOG(_MASK_, _LEVEL_, _QSTRING_)
Screen in which all other widgets are contained and rendered.
QString GetISO3166CountryName(const QString &iso3166Code)
static QMap< QString, QString > getLanguages(void)
MythUIButton * m_cancelButton
ISO3166ToNameMap GetISO3166EnglishCountryMap(void)
Returns a map of ISO-3166 country codes mapped to the country name in English.
void BuildFocusList(void)
QString GetLocaleSetting(const QString &key)
MythCoreContext * gCoreContext
This global variable contains the MythCoreContext instance for the app.
static bool Assign(ContainerType *container, UIType *&item, const QString &name, bool *err=nullptr)
bool Create(void) override
MythUIButtonList * m_countryList
static bool LoadWindowFromXML(const QString &xmlfile, const QString &windowname, MythUIType *parent)
static bool prompt(bool force=false)
Ask the user for the language to use.
ISO 3166-1 support functions.
virtual void PopScreen(MythScreenType *screen=nullptr, bool allowFade=true, bool deleteScreen=true)
MythMainWindow * GetMythMainWindow(void)
void Close(void) override
ISO 639-1 and ISO 639-2 support functions.
MythUIButton * m_saveButton
static bool m_languageChanged
virtual void AddScreen(MythScreenType *screen, bool allowFade=true)
QMap< QString, QString > ISO3166ToNameMap
bool SaveSettingOnHost(const QString &key, const QString &newValue, const QString &host)
QString GetSetting(const QString &key, const QString &defaultval="")