]> git.sesse.net Git - kdenlive/blobdiff - src/mainwindow.cpp
Fix rendering of documents that have a locale different than the system's locale
[kdenlive] / src / mainwindow.cpp
index 9ae246b65759157181e79435e1e128ce5c760eaf..d8a46d373371173a04b5243e8fe1b7aee0b637f5 100644 (file)
@@ -87,7 +87,6 @@
 #include <KProcess>
 #include <KActionMenu>
 #include <KMenu>
-#include <locale.h>
 #include <ktogglefullscreenaction.h>
 #include <KFileItem>
 #include <KNotification>
@@ -148,14 +147,19 @@ MainWindow::MainWindow(const QString &MltPath, const KUrl & Url, const QString &
 #endif /* NO_JOGSHUTTLE */
     m_findActivated(false),
     m_stopmotion(NULL)
-{
+{   
     qRegisterMetaType<QVector<int16_t> > ();
+
+    // Init locale
+    QLocale systemLocale = QLocale();
+    systemLocale.setNumberOptions(QLocale::OmitGroupSeparator);
+    QLocale::setDefault(systemLocale);
+
     // Create DBus interface
     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);
@@ -359,6 +363,7 @@ MainWindow::MainWindow(const QString &MltPath, const KUrl & Url, const QString &
 
 
     setupActions();
+    connect(m_commandStack, SIGNAL(cleanChanged(bool)), m_saveAction, SLOT(setDisabled(bool)));
 
 
     // Close non-general docks for the initial layout
@@ -1590,6 +1595,13 @@ void MainWindow::setupActions()
     connect(reloadClip , SIGNAL(triggered()), m_projectList, SLOT(slotReloadClip()));
     reloadClip->setEnabled(false);
 
+    QAction *proxyClip = new KAction(i18n("Proxy Clip"), this);
+    collection.addAction("proxy_clip", proxyClip);
+    proxyClip->setData("proxy_clip");
+    proxyClip->setCheckable(true);
+    proxyClip->setChecked(false);
+    connect(proxyClip, SIGNAL(toggled(bool)), m_projectList, SLOT(slotProxyCurrentItem(bool)));
+    
     QAction *stopMotion = new KAction(KIcon("image-x-generic"), i18n("Stop Motion Capture"), this);
     collection.addAction("stopmotion", stopMotion);
     connect(stopMotion , SIGNAL(triggered()), this, SLOT(slotOpenStopmotion()));
@@ -1603,6 +1615,7 @@ void MainWindow::setupActions()
     addClips->addAction(addFolderButton);
 
     addClips->addAction(reloadClip);
+    addClips->addAction(proxyClip);
     addClips->addAction(clipProperties);
     addClips->addAction(openClip);
     addClips->addAction(deleteClip);
@@ -1900,6 +1913,7 @@ bool MainWindow::saveFileAs(const QString &outputFileName)
     m_activeDocument->setModified(false);
     m_fileOpenRecent->addUrl(KUrl(outputFileName));
     m_fileRevert->setEnabled(true);
+    m_undoView->stack()->setClean();
     return true;
 }
 
@@ -2020,7 +2034,8 @@ void MainWindow::doOpenFile(const KUrl &url, KAutoSaveFile *stale)
         delete m_stopmotion;
         m_stopmotion = NULL;
     }
-
+    
+    m_timer.start();
     KProgressDialog progressDialog(this, i18n("Loading project"), i18n("Loading project"));
     progressDialog.setAllowCancel(false);
     progressDialog.progressBar()->setMaximum(4);
@@ -2517,6 +2532,7 @@ void MainWindow::connectDocument(TrackView *trackView, KdenliveDoc *doc)   //cha
     connect(trackView->projectView(), SIGNAL(activateDocumentMonitor()), m_projectMonitor, SLOT(activateMonitor()));
     connect(trackView, SIGNAL(zoneMoved(int, int)), this, SLOT(slotZoneMoved(int, int)));
     connect(m_projectList, SIGNAL(loadingIsOver()), trackView->projectView(), SLOT(slotUpdateAllThumbs()));
+    connect(m_projectList, SIGNAL(loadingIsOver()), this, SLOT(slotElapsedTime()));
     connect(m_projectList, SIGNAL(displayMessage(const QString&, int)), this, SLOT(slotGotProgressInfo(const QString&, int)));
     connect(m_projectList, SIGNAL(updateRenderStatus()), this, SLOT(slotCheckRenderStatus()));
 
@@ -3866,11 +3882,23 @@ void MainWindow::slotPrepareRendering(bool scriptExport, bool zoneOnly, const QS
     if (m_renderWidget->automaticAudioExport()) {
         exportAudio = m_activeTimeline->checkProjectAudio();
     } else exportAudio = m_renderWidget->selectedAudioExport();
+
+    // Set playlist audio volume to 100%
+    QDomDocument doc;
+    doc.setContent(playlistContent);
+    QDomElement tractor = doc.documentElement().firstChildElement("tractor");
+    if (!tractor.isNull()) {
+        QDomNodeList props = tractor.elementsByTagName("property");
+        for (int i = 0; i < props.count(); i++) {
+            if (props.at(i).toElement().attribute("name") == "meta.volume") {
+                props.at(i).firstChild().setNodeValue("1");
+                break;
+            }
+        }
+    }
     
     // Do we want proxy rendering
     if (m_projectList->useProxy() && !m_renderWidget->proxyRendering()) {
-        QDomDocument doc;
-        doc.setContent(playlistContent);
         QString root = doc.documentElement().attribute("root");
 
         // replace proxy clips with originals
@@ -3914,8 +3942,8 @@ void MainWindow::slotPrepareRendering(bool scriptExport, bool zoneOnly, const QS
                 playlistContent.replace(key, i.value());
             }
         }*/
-        playlistContent = doc.toString();
     }
+    playlistContent = doc.toString();
     
     // Do save scenelist
     QFile file(playlistPath);
@@ -4352,6 +4380,10 @@ void MainWindow::slotBlockClipMonitor(const QString id)
 }
 
 
+void MainWindow::slotElapsedTime()
+{
+    kDebug()<<"-----------------------------------------\n"<<"Time elapsed: "<<m_timer.elapsed()<<"\n-------------------------";
+}
 
 #include "mainwindow.moc"