r22061 by jghali - first step to get rid of GUI language empty value in prefs

scribus-commit scribus-commit at lists.scribus.net
Sun Jun 11 20:31:19 UTC 2017


Author: jghali
Date: Sun Jun 11 20:31:19 2017
New Revision: 22061

URL: http://scribus.net/websvn/listing.php?repname=Scribus&sc=1&rev=22061
Log:
first step to get rid of GUI language empty value in prefs

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

Modified: trunk/Scribus/scribus/prefsmanager.cpp
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=22061&path=/trunk/Scribus/scribus/prefsmanager.cpp
==============================================================================
--- trunk/Scribus/scribus/prefsmanager.cpp	(original)
+++ trunk/Scribus/scribus/prefsmanager.cpp	Sun Jun 11 20:31:19 2017
@@ -182,6 +182,9 @@
 	appPrefs.uiPrefs.mainWinState = QByteArray();
 	appPrefs.uiPrefs.RecentDocs.clear();
 	appPrefs.uiPrefs.recentDocCount = 5;
+	appPrefs.uiPrefs.language = ScQApp->currGUILanguage();
+	if (appPrefs.uiPrefs.language.isEmpty())
+		appPrefs.uiPrefs.language = "en_GB";
 	appPrefs.uiPrefs.showStartupDialog = true;
 	appPrefs.uiPrefs.showSplashOnStartup = true;
 	appPrefs.uiPrefs.useSmallWidgets = false;
@@ -948,7 +951,13 @@
 		PrefsContext* userprefsContext = prefsFile->getContext("user_preferences");
 		if (userprefsContext)
 		{
-			appPrefs.uiPrefs.language = userprefsContext->get("gui_language","");
+			QString guiLanguage = userprefsContext->get("gui_language", "");
+			if (!guiLanguage.isEmpty())
+				appPrefs.uiPrefs.language = guiLanguage;
+			if (appPrefs.uiPrefs.language.isEmpty())
+				appPrefs.uiPrefs.language = ScQApp->currGUILanguage();
+			if (appPrefs.uiPrefs.language.isEmpty())
+				appPrefs.uiPrefs.language = "en_GB";
 			appPrefs.uiPrefs.mainWinState = QByteArray::fromBase64(userprefsContext->get("mainwinstate","").toLatin1());
 			appPrefs.uiPrefs.tabbedPalettes.clear();
 			PrefsTable *tabsTable = userprefsContext->getTable("tabbedPalettes");

Modified: trunk/Scribus/scribus/scribus.cpp
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=22061&path=/trunk/Scribus/scribus/scribus.cpp
==============================================================================
--- trunk/Scribus/scribus/scribus.cpp	(original)
+++ trunk/Scribus/scribus/scribus.cpp	Sun Jun 11 20:31:19 2017
@@ -6621,6 +6621,7 @@
 		QString newUILanguage = m_prefsManager->uiLanguage();
 		if (oldPrefs.uiPrefs.language != newUILanguage || ScQApp->currGUILanguage()!=newUILanguage)
 			ScQApp->changeGUILanguage(newUILanguage);
+		m_prefsManager->appPrefs.uiPrefs.language = ScQApp->currGUILanguage();
 		QString newUIStyle = m_prefsManager->guiStyle();
 		if (oldPrefs.uiPrefs.style != newUIStyle)
 		{

Modified: trunk/Scribus/scribus/scribusapp.cpp
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=22061&path=/trunk/Scribus/scribus/scribusapp.cpp
==============================================================================
--- trunk/Scribus/scribus/scribusapp.cpp	(original)
+++ trunk/Scribus/scribus/scribusapp.cpp	Sun Jun 11 20:31:19 2017
@@ -103,7 +103,7 @@
 
 ScribusQApp::ScribusQApp( int & argc, char ** argv ) : QApplication(argc, argv),
 	m_lang(""),
-	m_GUILang("")
+	m_GUILang("en_GB")
 {
 	ScQApp = this;
 	ScCore = 0;

Modified: trunk/Scribus/scribus/ui/prefs_userinterface.cpp
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=22061&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 20:31:19 2017
@@ -67,6 +67,8 @@
 void Prefs_UserInterface::restoreDefaults(struct ApplicationPrefs *prefsData)
 {
 	selectedGUILang = prefsData->uiPrefs.language;
+	if (selectedGUILang.isEmpty())
+		selectedGUILang = ScQApp->currGUILanguage();
 	setCurrentComboItem(languageComboBox, LanguageManager::instance()->getLangFromAbbrev(selectedGUILang));
 	setCurrentComboItem(themeComboBox, prefsData->uiPrefs.style);
 	setCurrentComboItem(iconSetComboBox, prefsData->uiPrefs.iconSet);




More information about the scribus-commit mailing list