]> git.sesse.net Git - kdenlive/commitdiff
Fix issues when switching between projects with different locales.
authorTill Theato <root@ttill.de>
Sun, 28 Aug 2011 18:27:23 +0000 (18:27 +0000)
committerTill Theato <root@ttill.de>
Sun, 28 Aug 2011 18:27:23 +0000 (18:27 +0000)
svn path=/trunk/kdenlive/; revision=5843

src/documentvalidator.cpp
src/kdenlivedoc.cpp
src/mainwindow.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
index ddc79e2976bf61620519fc290a2e9dc883681c62..11a7a9cf4079de8786bcf80ee04382cdc8d5d221 100644 (file)
@@ -53,6 +53,9 @@
 
 #include <mlt++/Mlt.h>
 
+#include "locale.h"
+
+
 const double DOCUMENTVERSION = 0.88;
 
 KdenliveDoc::KdenliveDoc(const KUrl &url, const KUrl &projectFolder, QUndoGroup *undoGroup, QString profileName, QMap <QString, QString> properties, const QPoint tracks, Render *render, KTextEdit *notes, bool *openBackup, MainWindow *parent, KProgressDialog *progressDialog) :
@@ -96,7 +99,10 @@ KdenliveDoc::KdenliveDoc(const KUrl &url, const KUrl &projectFolder, QUndoGroup
         m_documentProperties[i.key()] = i.value();
     }
 
-    if (QLocale() != QLocale::system()) {
+    QLocale locale = QLocale::system();
+    locale.setNumberOptions(QLocale::OmitGroupSeparator);
+    if (QLocale() != locale) {
+        setlocale(LC_NUMERIC, "");
         QLocale::setDefault(QLocale::system());
         // locale conversion might need to be redone
         initEffects::parseEffectFiles();
index 8d9b0edc70a3752f72c30d3778c9f56098d7d565..c3efd3dabd70eab4dd1ee5422be529f0b67f5c73 100644 (file)
@@ -154,7 +154,6 @@ MainWindow::MainWindow(const QString &MltPath, const KUrl & Url, const QString &
     new MainWindowAdaptor(this);
     QDBusConnection dbus = QDBusConnection::sessionBus();
     dbus.registerObject("/MainWindow", this);
-    //setlocale(LC_NUMERIC, "POSIX");
     if (!KdenliveSettings::colortheme().isEmpty()) slotChangePalette(NULL, KdenliveSettings::colortheme());
     setFont(KGlobalSettings::toolBarFont());
     parseProfiles(MltPath);