Preferences/__init__.py

branch
QtWebEngine
changeset 4816
4f5ca06fa93a
parent 4806
5c0745cb26ea
parent 4815
74a3a3603ac5
child 4817
0a4e2fb0e93c
diff -r b91c80b5a815 -r 4f5ca06fa93a Preferences/__init__.py
--- a/Preferences/__init__.py	Sun Mar 06 13:31:05 2016 +0100
+++ b/Preferences/__init__.py	Sun Mar 06 14:12:58 2016 +0100
@@ -1166,9 +1166,9 @@
     }
 
     # defaults for Qt related stuff
-    # TODO: introduce Qt5TranslationsDir and use it depending on Qt version
     qtDefaults = {
         "Qt4TranslationsDir": "",
+        "Qt5TranslationsDir": "",
         "QtToolsPrefix4": "",
         "QtToolsPostfix4": "",
         "PyuicIndent": 4,
@@ -2922,14 +2922,20 @@
 
 def getQtTranslationsDir(prefClass=Prefs):
     """
-    Module function to retrieve the Qt4TranslationsDir setting (Name kept for
-    backward compatibility).
+    Module function to retrieve the Qt4TranslationsDir or Qt5TranslationsDir
+    setting depending on the current Qt version.
     
     @param prefClass preferences class used as the storage area
-    @return the requested Qt4TranslationsDir setting (string)
+    @return the requested setting (string)
     """
-    s = prefClass.settings.value(
-        "Qt/Qt4TranslationsDir", prefClass.qtDefaults["Qt4TranslationsDir"])
+    if qVersion() < "5.0.0":
+        s = prefClass.settings.value(
+            "Qt/Qt4TranslationsDir",
+            prefClass.qtDefaults["Qt4TranslationsDir"])
+    else:
+        s = prefClass.settings.value(
+            "Qt/Qt5TranslationsDir",
+            prefClass.qtDefaults["Qt5TranslationsDir"])
     if s == "":
         s = os.getenv("QTTRANSLATIONSDIR", "")
     if s == "":
@@ -2954,7 +2960,7 @@
     @param prefClass preferences class used as the storage area
     @return the requested Qt setting
     """
-    if key == "Qt4TranslationsDir":
+    if key in ["Qt4TranslationsDir", "Qt5TranslationsDir"]:
         return getQtTranslationsDir(prefClass)
     elif key in ["PyuicIndent"]:
         return int(prefClass.settings.value(

eric ide

mercurial