]> git.sesse.net Git - kdenlive/blobdiff - src/documentvalidator.cpp
Merge branch 'master' of git://anongit.kde.org/kdenlive
[kdenlive] / src / documentvalidator.cpp
index 1226a85c96b6adc13f97aa964e2fde1575891789..194a55ad437a343220f7592e0bade4a5cf352339 100644 (file)
@@ -66,6 +66,16 @@ bool DocumentValidator::validate(const double currentVersion)
         // WARNING: what should be done in case the locale does not exist on the system?
         setlocale(LC_NUMERIC, mlt.attribute("LC_NUMERIC").toUtf8().constData());
         documentLocale = QLocale(mlt.attribute("LC_NUMERIC"));
+        
+        // Make sure Qt locale and C++ locale have the same numeric separator, might not be the case
+        // With some locales since C++ and Qt use a different database for locales
+        char *separator = localeconv()->decimal_point;
+        if (separator != documentLocale.decimalPoint()) {
+            kDebug()<<"------\n!!! system locale is not similar to Qt's locale... be prepared for bugs!!!\n------";
+            // HACK: There is a locale conflict, so set locale to at least have correct decimal point
+            if (strncmp(separator, ".", 1) == 0) documentLocale = QLocale::c();
+            else if (strncmp(separator, ",", 1) == 0) documentLocale = QLocale("fr_FR.UTF-8");
+        }
     }
     
     documentLocale.setNumberOptions(QLocale::OmitGroupSeparator);
@@ -78,10 +88,6 @@ bool DocumentValidator::validate(const double currentVersion)
         initEffects::parseEffectFiles();
     }
 
-    // TODO: remove after string freeze
-    if (0)
-        KMessageBox::sorry(kapp->activeWindow(), i18n("The document you are opening uses a different locale (%1) than your system. You can only open and render it, no editing is supported unless you change your system's locale.", mlt.attribute("LC_NUMERIC")), i18n("Read only project"));
-
     // Upgrade the document to the latest version
     if (!upgrade(documentLocale.toDouble(kdenliveDoc.attribute("version")), currentVersion))
         return false;