]> git.sesse.net Git - kdenlive/commitdiff
When opening a document from a different locale, MLT was resetting to default system...
authorJean-Baptiste Mardelle <jb@kdenlive.org>
Mon, 14 May 2012 13:59:34 +0000 (15:59 +0200)
committerJean-Baptiste Mardelle <jb@kdenlive.org>
Mon, 14 May 2012 13:59:34 +0000 (15:59 +0200)
breaking the document

ChangeLog
src/documentvalidator.cpp
src/initeffects.cpp
src/initeffects.h
src/kdenlivedoc.cpp

index 325fd81be9a8c06aafd0cb7fdfb10da4a68e68ec..48e92bd1e7d5c9b03137c923bd8cef92281e7c2e 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,4 +1,6 @@
 0.8.4
+    * Improve detection of locale issues (default to POSIX when there is a locale conflict on the system)
+    * Improve timeline operation for small clips (disable resizing, only allow move)
     * Add background color parameter to "Rotate" and "Pan and Zoom" effects
     * Allow to scroll using the mouse wheel in monitor editing scene
     * Zoom to mouse when using CTRL + mouse wheel in monitor editing scene
index f18b73f23bb3fe0fb2dec8a841d2b86914a4324b..896d9cf682199dec74dcb5e234d4f7e2404a911b 100644 (file)
@@ -73,7 +73,7 @@ bool DocumentValidator::validate(const double currentVersion)
     
     if (mlt.hasAttribute("LC_NUMERIC")) {
         // Set locale for the document        
-        QString newLocale = setlocale(LC_NUMERIC, mlt.attribute("LC_NUMERIC").toUtf8().constData());
+        const QString newLocale = 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
@@ -96,11 +96,13 @@ bool DocumentValidator::validate(const double currentVersion)
     documentLocale.setNumberOptions(QLocale::OmitGroupSeparator);
     if (documentLocale.decimalPoint() != QLocale().decimalPoint()) {
         // If loading an older MLT file without LC_NUMERIC, set locale to C which was previously the default
-        if (!mlt.hasAttribute("LC_NUMERIC")) setlocale(LC_NUMERIC, "C");
+        if (!mlt.hasAttribute("LC_NUMERIC")) {
+           setlocale(LC_NUMERIC, "C");
+       }
 
         QLocale::setDefault(documentLocale);
         // locale conversion might need to be redone
-        initEffects::parseEffectFiles();
+        initEffects::parseEffectFiles(setlocale(LC_NUMERIC, NULL));
     }
 
     bool ok;
index abe49c4eb7012d6ae5eaf5cde14f4a7548a9f6a8..74ea0a83dfa9f19c5980c4a836833b57637a79dd 100644 (file)
@@ -31,6 +31,8 @@
 #include <QDir>
 #include <QIcon>
 
+#include "locale.h"
+
 initEffectsThumbnailer::initEffectsThumbnailer() :
     QThread()
 {
@@ -133,7 +135,7 @@ QDomDocument initEffects::getUsedCustomEffects(QMap <QString, QString> effectids
 }
 
 //static
-void initEffects::parseEffectFiles()
+void initEffects::parseEffectFiles(const QString &locale)
 {
     QStringList::Iterator more;
     QStringList::Iterator it;
@@ -146,6 +148,9 @@ void initEffects::parseEffectFiles()
         return;
     }
 
+    // Warning: Mlt::Factory::init() resets the locale to the default system value, make sure we keep correct locale
+    if (!locale.isEmpty()) setlocale(LC_NUMERIC, locale.toUtf8().constData());
+    
     // Retrieve the list of MLT's available effects.
     Mlt::Properties *filters = repository->filters();
     QStringList filtersList;
index cbc06d0858d5d55ff93cbde663a6dbfcc0825586..5230046703923410f95a30517c8753a601e6a59f 100644 (file)
@@ -54,7 +54,7 @@ public:
      * It checks for all available effects and transitions, removes blacklisted
      * ones, calls fillTransitionsList() and parseEffectFile() to fill the lists
      * (with sorted, unique items) and then fills the global lists. */
-    static void parseEffectFiles();
+    static void parseEffectFiles(const QString &locale = QString());
     static void refreshLumas();
     static QDomDocument createDescriptionFromMlt(Mlt::Repository* repository, const QString& type, const QString& name);
     static QDomDocument getUsedCustomEffects(QMap <QString, QString> effectids);
index f431a26f2cb19d7e672fb9f58d309164cd7d07cb..bd8335deec768e02471b026fe490132759818830 100644 (file)
@@ -125,7 +125,7 @@ KdenliveDoc::KdenliveDoc(const KUrl &url, const KUrl &projectFolder, QUndoGroup
         systemLocale.setNumberOptions(QLocale::OmitGroupSeparator);
         QLocale::setDefault(systemLocale);
         // locale conversion might need to be redone
-        initEffects::parseEffectFiles();
+       initEffects::parseEffectFiles(setlocale(LC_NUMERIC, NULL));
     }
 
     *openBackup = false;