]> git.sesse.net Git - kdenlive/blobdiff - src/documentvalidator.cpp
Required changes to make Kdenlive work with some locales that have a comma (,) as...
[kdenlive] / src / documentvalidator.cpp
index 44fd3a41b43d2ba8428dfddc8c3c025e2576580c..d3eda935a27904f67047935f60c1a42b44800c1b 100644 (file)
@@ -48,8 +48,25 @@ bool DocumentValidator::validate(const double currentVersion)
     // Check if we're validating a Kdenlive project
     if (kdenliveDoc.isNull())
         return false;
+    
+    QLocale documentLocale;
+    
+    if (mlt.hasAttribute("LC_NUMERIC")) {
+        // Set locale for the document
+        documentLocale = QLocale(mlt.attribute("LC_NUMERIC"));
+        if (documentLocale.decimalPoint() != QLocale().decimalPoint()) {
+            QDomElement docProperties = kdenliveDoc.firstChildElement("documentproperties");
+            if (docProperties.isNull()) {
+                docProperties = m_doc.createElement("documentproperties");
+                kdenliveDoc.appendChild(docProperties);
+            }
+            docProperties.setAttribute("readonly", 1);
+            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(kdenliveDoc.attribute("version").toDouble(), currentVersion))
+    if (!upgrade(documentLocale.toDouble(kdenliveDoc.attribute("version")), currentVersion))
         return false;
 
     /*