summary |
shortlog |
log |
commit | commitdiff |
tree
raw |
patch |
inline | side by side (from parent 1:
dad333c)
Switching between projects with different locales can still cause problems.
[1] http://kdenlive.org/mantis/view.php?id=2270
svn path=/trunk/kdenlive/; revision=5841
#include "documentvalidator.h"
#include "definitions.h"
#include "documentvalidator.h"
#include "definitions.h"
+#include "initeffects.h"
#include <KDebug>
#include <KMessageBox>
#include <KDebug>
#include <KMessageBox>
if (mlt.hasAttribute("LC_NUMERIC")) {
// Set locale for the document
documentLocale = QLocale(mlt.attribute("LC_NUMERIC"));
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"));
- }
+ if (documentLocale != QLocale()) {
+ QLocale::setDefault(documentLocale);
+ // locale conversion might need to be redone
+ 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;
// Upgrade the document to the latest version
if (!upgrade(documentLocale.toDouble(kdenliveDoc.attribute("version")), currentVersion))
return false;
+ if (version <= 0.87) {
+ if (!m_doc.firstChildElement("mlt").hasAttribute("LC_NUMERIC")) {
+ m_doc.firstChildElement("mlt").setAttribute("LC_NUMERIC", "C");
+ }
+ }
+
// The document has been converted: mark it as modified
infoXml.setAttribute("version", currentVersion);
m_modified = true;
// The document has been converted: mark it as modified
infoXml.setAttribute("version", currentVersion);
m_modified = true;
-const double DOCUMENTVERSION = 0.87;
+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) :
QObject(parent),
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) :
QObject(parent),
m_documentProperties[i.key()] = i.value();
}
m_documentProperties[i.key()] = i.value();
}
+ if (QLocale() != QLocale::system()) {
+ QLocale::setDefault(QLocale::system());
+ // locale conversion might need to be redone
+ initEffects::parseEffectFiles();
+ }
+
*openBackup = false;
if (!url.isEmpty()) {
*openBackup = false;
if (!url.isEmpty()) {
void KdenliveDoc::setModified(bool mod)
{
void KdenliveDoc::setModified(bool mod)
{
- if (isReadOnly()) return;
if (!m_url.isEmpty() && mod && KdenliveSettings::crashrecovery()) {
m_autoSaveTimer->start(3000);
}
if (!m_url.isEmpty() && mod && KdenliveSettings::crashrecovery()) {
m_autoSaveTimer->start(3000);
}
-bool KdenliveDoc::isReadOnly() const
-{
- return m_documentProperties.contains("readonly");
-}
-
void KdenliveDoc::cleanupBackupFiles()
{
KUrl backupFile = m_projectFolder;
void KdenliveDoc::cleanupBackupFiles()
{
KUrl backupFile = m_projectFolder;
static double getDisplayRatio(const QString &path);
/** @brief Backup the project file */
void backupLastSavedVersion(const QString &path);
static double getDisplayRatio(const QString &path);
/** @brief Backup the project file */
void backupLastSavedVersion(const QString &path);
- /** @brief True if the document was opened in read only mode. */
- bool isReadOnly() const;
m_clipMonitor->refreshMonitor(true);
progressDialog.progressBar()->setValue(4);
m_clipMonitor->refreshMonitor(true);
progressDialog.progressBar()->setValue(4);
- bool readOnly = !doc->isReadOnly();
- factory()->container("edit", this)->setEnabled(readOnly);
- factory()->container("project", this)->setEnabled(readOnly);
- factory()->container("tool", this)->setEnabled(readOnly);
- factory()->container("clip", this)->setEnabled(readOnly);
- factory()->container("timeline", this)->setEnabled(readOnly);
- factory()->container("monitor", this)->setEnabled(readOnly);
if (openBackup) slotOpenBackupDialog(url);
}
if (openBackup) slotOpenBackupDialog(url);
}
void MainWindow::slotUpdateDocumentState(bool modified)
{
void MainWindow::slotUpdateDocumentState(bool modified)
{
- if (!m_activeDocument || m_activeDocument->isReadOnly()) return;
+ if (!m_activeDocument) return;
setCaption(m_activeDocument->description(), modified);
m_saveAction->setEnabled(modified);
if (modified) {
setCaption(m_activeDocument->description(), modified);
m_saveAction->setEnabled(modified);
if (modified) {
m_timecode = doc->timecode();
m_commandStack = doc->commandStack();
m_doc = doc;
m_timecode = doc->timecode();
m_commandStack = doc->commandStack();
m_doc = doc;
- setEnabled(!m_doc->isReadOnly());
QMap <QString, QString> flist = doc->clipManager()->documentFolderList();
QStringList openedFolders = doc->getExpandedFolders();
QMap <QString, QString> flist = doc->clipManager()->documentFolderList();
QStringList openedFolders = doc->getExpandedFolders();
static void kdenlive_callback(void* /*ptr*/, int level, const char* fmt, va_list vl)
{
static void kdenlive_callback(void* /*ptr*/, int level, const char* fmt, va_list vl)
{
+// kDebug() << "log level" << level << QString().vsprintf(fmt, vl).simplified();
if (level > MLT_LOG_ERROR) return;
QString error;
QApplication::postEvent(qApp->activeWindow(), new MltErrorEvent(error.vsprintf(fmt, vl).simplified()));
if (level > MLT_LOG_ERROR) return;
QString error;
QApplication::postEvent(qApp->activeWindow(), new MltErrorEvent(error.vsprintf(fmt, vl).simplified()));
- // WARNING: disabled because it caused crashes (see Kdenlive bug #2205 and #2206) - jbm
- /*if (KdenliveSettings::projectloading_avformatnovalidate())
- playlist.replace(">avformat</property>", ">avformat-novalidate</property>");
- else
- playlist.replace(">avformat-novalidate</property>", ">avformat</property>");*/
+
+ m_locale = QLocale();
+
m_mltProducer = new Mlt::Producer(*m_mltProfile, "xml-string", playlist.toUtf8().constData());
if (!m_mltProducer || !m_mltProducer->is_valid()) {
kDebug() << " WARNING - - - - -INVALID PLAYLIST: " << playlist.toUtf8().constData();
m_mltProducer = new Mlt::Producer(*m_mltProfile, "xml-string", playlist.toUtf8().constData());
if (!m_mltProducer || !m_mltProducer->is_valid()) {
kDebug() << " WARNING - - - - -INVALID PLAYLIST: " << playlist.toUtf8().constData();
slotChangeZoom(m_doc->zoom().x(), m_doc->zoom().y());
slotSetZone(m_doc->zone(), false);
slotChangeZoom(m_doc->zoom().x(), m_doc->zoom().y());
slotSetZone(m_doc->zone(), false);
- setEnabled(!doc->isReadOnly());
}
TrackView::~TrackView()
}
TrackView::~TrackView()
// parse project tracks
QDomElement mlt = doc.firstChildElement("mlt");
// parse project tracks
QDomElement mlt = doc.firstChildElement("mlt");
- if (mlt.hasAttribute("LC_NUMERIC")) m_locale = QLocale(mlt.attribute("LC_NUMERIC"));
QDomElement tractor = mlt.firstChildElement("tractor");
QDomNodeList tracks = tractor.elementsByTagName("track");
QDomNodeList playlists = doc.elementsByTagName("playlist");
QDomElement tractor = mlt.firstChildElement("tractor");
QDomNodeList tracks = tractor.elementsByTagName("track");
QDomNodeList playlists = doc.elementsByTagName("playlist");