]> git.sesse.net Git - kdenlive/commitdiff
Changing the timecode format in statur bar (from hh:mm:ss:ff to frames) now also...
authorJean-Baptiste Mardelle <jb@kdenlive.org>
Wed, 29 Jul 2009 22:02:36 +0000 (22:02 +0000)
committerJean-Baptiste Mardelle <jb@kdenlive.org>
Wed, 29 Jul 2009 22:02:36 +0000 (22:02 +0000)
svn path=/trunk/kdenlive/; revision=3779

src/customtrackview.cpp
src/kdenlivesettings.kcfg
src/mainwindow.cpp
src/mainwindow.h
src/monitor.cpp
src/monitor.h

index 791bdf793123c616c21ce163aeb4f541203494b1..c0df9e9a7d0b7f4ba1451c81eaf78553e403144f 100644 (file)
@@ -1837,7 +1837,7 @@ void CustomTrackView::dropEvent(QDropEvent * event)
 
             if (item->baseClip()->isTransparent() && getTransitionItemAtStart(info.startPos, info.track) == NULL) {
                 // add transparency transition
-               QDomElement trans = MainWindow::transitions.getEffectByTag("composite", "composite").cloneNode().toElement();
+                QDomElement trans = MainWindow::transitions.getEffectByTag("composite", "composite").cloneNode().toElement();
                 new AddTransitionCommand(this, info, getPreviousVideoTrack(info.track), trans, false, true, addCommand);
             }
             info.track = m_document->tracksCount() - item->track();
index 693a449d8dc05432172daef641606fd6bfba13e9..7f2f773853db07b09125cd5a3290e478488bf2ac 100644 (file)
       <default>false</default>
     </entry>
 
+    <entry name="frametimecode" type="Bool">
+      <label>Show timecodes as frame number instead of hh:mm:ss:ff.</label>
+      <default>false</default>
+    </entry>
+
     <entry name="snaptopoints" type="Bool">
       <label>Snap movements to clips, guides and markers.</label>
       <default>true</default>
index 488975e9079595698f7b17a6e5be87f367c7a665..8dde1eb817556b477f45f4872ce574051d78b8f5 100644 (file)
@@ -380,20 +380,15 @@ MainWindow::MainWindow(const QString &MltPath, const KUrl & Url, QWidget *parent
 
 void MainWindow::queryQuit()
 {
-    delete m_effectStack;
-    delete m_activeTimeline;
-    delete m_projectMonitor;
-    kDebug() << "// DEL MON 1 done";
-    delete m_clipMonitor;
-    kDebug() << "// DEL MON 2 done";
-    delete m_activeDocument;
-    Mlt::Factory::close();
-    qApp->quit();
-    /*
-       if (queryClose()) {
-           Mlt::Factory::close();
-           kapp->quit();
-       }*/
+    if (queryClose()) {
+        delete m_effectStack;
+        delete m_activeTimeline;
+        delete m_projectMonitor;
+        delete m_clipMonitor;
+        delete m_activeDocument;
+        Mlt::Factory::close();
+        kapp->quit();
+    }
 }
 
 //virtual
@@ -661,6 +656,8 @@ void MainWindow::setupActions()
     m_timecodeFormat = new KComboBox(this);
     m_timecodeFormat->addItem(i18n("hh:mm:ss::ff"));
     m_timecodeFormat->addItem(i18n("Frames"));
+    if (KdenliveSettings::frametimecode()) m_timecodeFormat->setCurrentIndex(1);
+    connect(m_timecodeFormat, SIGNAL(activated(int)), this, SLOT(slotUpdateTimecodeFormat(int)));
 
     m_statusProgressBar = new QProgressBar(this);
     m_statusProgressBar->setMinimum(0);
@@ -2800,4 +2797,14 @@ void MainWindow::slotPrepareRendering(bool scriptExport, bool zoneOnly, const QS
     m_renderWidget->slotExport(scriptExport, m_activeTimeline->inPoint(), m_activeTimeline->outPoint(), playlistPath, scriptPath);
 }
 
+void MainWindow::slotUpdateTimecodeFormat(int ix)
+{
+    KdenliveSettings::setFrametimecode(ix == 1);
+    m_clipMonitor->updateTimecodeFormat();
+    m_projectMonitor->updateTimecodeFormat();
+}
+
+
+
+
 #include "mainwindow.moc"
index 9133655fcc352c0d5703e74cc74cce1ab2e8cf1d..98d6fd87ea6e502ad3cea6ee0aa8b75c0861b86b 100644 (file)
@@ -302,6 +302,7 @@ private slots:
     void slotTranscodeClip();
     void slotSetDocumentRenderProfile(const QString &dest, const QString &name, const QString &file);
     void slotPrepareRendering(bool scriptExport, bool zoneOnly, const QString &chapterFile);
+    void slotUpdateTimecodeFormat(int ix);
 
 signals:
     Q_SCRIPTABLE void abortRenderJob(const QString &url);
index 0c12a74df5c20e0e6c5ff9ba4686ac6e8ea13fef..85f52c5940b8e6d9399bb153bcad472488efde4d 100644 (file)
@@ -106,7 +106,9 @@ Monitor::Monitor(QString name, MonitorManager *manager, QWidget *parent) :
     toolbar->addWidget(spacer);
     m_timePos = new KRestrictedLine(this);
     m_timePos->setSizePolicy(QSizePolicy::Maximum, QSizePolicy::MinimumExpanding);
-    m_timePos->setInputMask("99:99:99:99");
+    m_frametimecode = KdenliveSettings::frametimecode();
+    if (m_frametimecode) m_timePos->setInputMask("999999999");
+    else m_timePos->setInputMask("99:99:99:99");
     toolbar->addWidget(m_timePos);
 
     connect(m_timePos, SIGNAL(editingFinished()), this, SLOT(slotSeek()));
@@ -450,13 +452,18 @@ void Monitor::activateMonitor()
 
 void Monitor::setTimePos(const QString &pos)
 {
-    m_timePos->setText(pos);
+    if (m_frametimecode) {
+        int frames = m_monitorManager->timecode().getFrameCount(pos, m_monitorManager->timecode().fps());
+        m_timePos->setText(QString::number(frames));
+    } else m_timePos->setText(pos);
     slotSeek();
 }
 
 void Monitor::slotSeek()
 {
-    const int frames = m_monitorManager->timecode().getFrameCount(m_timePos->text(), m_monitorManager->timecode().fps());
+    int frames;
+    if (m_frametimecode) frames = m_timePos->text().toInt();
+    else frames = m_monitorManager->timecode().getFrameCount(m_timePos->text(), m_monitorManager->timecode().fps());
     slotSeek(frames);
 }
 
@@ -560,7 +567,8 @@ void Monitor::seekCursor(int pos)
 {
     activateMonitor();
     checkOverlay();
-    m_timePos->setText(m_monitorManager->timecode().getTimecodeFromFrames(pos));
+    if (m_frametimecode) m_timePos->setText(QString::number(pos));
+    else m_timePos->setText(m_monitorManager->timecode().getTimecodeFromFrames(pos));
     m_ruler->slotNewValue(pos);
 }
 
@@ -575,7 +583,8 @@ void Monitor::rendererStopped(int pos)
     }
     m_ruler->slotNewValue(pos);
     checkOverlay();
-    m_timePos->setText(m_monitorManager->timecode().getTimecodeFromFrames(pos));
+    if (m_frametimecode) m_timePos->setText(QString::number(pos));
+    else m_timePos->setText(m_monitorManager->timecode().getTimecodeFromFrames(pos));
     m_playAction->setChecked(false);
     m_playAction->setIcon(m_playIcon);
 }
@@ -753,6 +762,20 @@ void Monitor::slotSwitchMonitorInfo(bool show)
     }
 }
 
+void Monitor::updateTimecodeFormat()
+{
+    m_frametimecode = KdenliveSettings::frametimecode();
+    if (m_frametimecode) {
+        int frames = m_monitorManager->timecode().getFrameCount(m_timePos->text(), m_monitorManager->timecode().fps());
+        m_timePos->setInputMask("999999999");
+        m_timePos->setText(QString::number(frames));
+    } else {
+        int pos = m_timePos->text().toInt();
+        m_timePos->setInputMask("99:99:99:99");
+        m_timePos->setText(m_monitorManager->timecode().getTimecodeFromFrames(pos));
+    }
+}
+
 
 MonitorRefresh::MonitorRefresh(QWidget* parent) : \
         QWidget(parent),
index 2cffb9498dc72a68f191226852fd693d189da7e4..35b539e96ab48ba2d650413d324912ccd9217f87 100644 (file)
@@ -78,6 +78,7 @@ public:
     DocClipBase *activeClip();
     GenTime position();
     void checkOverlay();
+    void updateTimecodeFormat();
 
 protected:
     virtual void mousePressEvent(QMouseEvent * event);
@@ -112,6 +113,7 @@ private:
     QMenu *m_playMenu;
     QPoint m_DragStartPosition;
     GenTime getSnapForPos(bool previous);
+    bool m_frametimecode;
 
 private slots:
     void seekCursor(int pos);