r22062 by jghali - second step to get rid of GUI language empty value: get rid of it!

scribus-commit scribus-commit at lists.scribus.net
Sun Jun 11 21:40:01 UTC 2017


Author: jghali
Date: Sun Jun 11 21:40:01 2017
New Revision: 22062

URL: http://scribus.net/websvn/listing.php?repname=Scribus&sc=1&rev=22062
Log:
second step to get rid of GUI language empty value: get rid of it!

Modified:
    trunk/Scribus/scribus/ui/prefs_userinterface.cpp

Modified: trunk/Scribus/scribus/ui/prefs_userinterface.cpp
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=22062&path=/trunk/Scribus/scribus/ui/prefs_userinterface.cpp
==============================================================================
--- trunk/Scribus/scribus/ui/prefs_userinterface.cpp	(original)
+++ trunk/Scribus/scribus/ui/prefs_userinterface.cpp	Sun Jun 11 21:40:01 2017
@@ -27,9 +27,16 @@
 	languageChange();
 
 	QStringList languageList;
-	languageList <<"";
 	LanguageManager::instance()->fillInstalledGUIStringList(&languageList);
-	languageComboBox->addItems( languageList );
+	if (languageList.isEmpty())
+	{
+		QString currentGUILang = ScQApp->currGUILanguage();
+		if (!currentGUILang.isEmpty())
+			languageList << LanguageManager::instance()->getLangFromAbbrev(currentGUILang);
+		else
+			languageList << LanguageManager::instance()->getLangFromAbbrev("en_GB");
+	}
+	languageComboBox->addItems(languageList);
 
 	// qt styles
 	QStringList styleList = QStyleFactory::keys();
@@ -69,7 +76,18 @@
 	selectedGUILang = prefsData->uiPrefs.language;
 	if (selectedGUILang.isEmpty())
 		selectedGUILang = ScQApp->currGUILanguage();
-	setCurrentComboItem(languageComboBox, LanguageManager::instance()->getLangFromAbbrev(selectedGUILang));
+	QString langString = LanguageManager::instance()->getLangFromAbbrev(selectedGUILang);
+	if (languageComboBox->findText(langString) < 0)
+	{
+		selectedGUILang = ScQApp->currGUILanguage();
+		langString = LanguageManager::instance()->getLangFromAbbrev(selectedGUILang);
+	}
+	if (languageComboBox->findText(langString) < 0)
+	{
+		selectedGUILang = "en_GB";
+		langString = LanguageManager::instance()->getLangFromAbbrev(selectedGUILang);
+	}
+	setCurrentComboItem(languageComboBox, langString);
 	setCurrentComboItem(themeComboBox, prefsData->uiPrefs.style);
 	setCurrentComboItem(iconSetComboBox, prefsData->uiPrefs.iconSet);
 	fontSizeMenuSpinBox->setValue( prefsData->uiPrefs.applicationFontSize );




More information about the scribus-commit mailing list