]> git.sesse.net Git - kdenlive/blobdiff - src/documentvalidator.cpp
Fix issues when switching between projects with different locales.
[kdenlive] / src / documentvalidator.cpp
index 3cc588b8d96fb9c6024ec7cb642d27229d713bee..185d597e36934db512640e7c1b97a17ca1dd992d 100644 (file)
 
 #include <QFile>
 #include <QColor>
+#include <QString>
 
 #include <mlt++/Mlt.h>
 
+#include "locale.h"
+
 
 DocumentValidator::DocumentValidator(QDomDocument doc):
         m_doc(doc),
@@ -51,13 +54,17 @@ bool DocumentValidator::validate(const double currentVersion)
         return false;
 
     // Previous MLT / Kdenlive versions used C locale by default
-    QLocale documentLocale("C");
+    QLocale documentLocale = QLocale::c();
     
     if (mlt.hasAttribute("LC_NUMERIC")) {
         // Set locale for the document
+        // 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"));
     }
 
+    documentLocale.setNumberOptions(QLocale::OmitGroupSeparator);
+
     if (documentLocale != QLocale()) {
         QLocale::setDefault(documentLocale);
         // locale conversion might need to be redone