From 2b46b701a1a20a5daa519e6201e051fabca198ad Mon Sep 17 00:00:00 2001 From: Jean-Baptiste Mardelle Date: Wed, 29 Jul 2009 22:02:36 +0000 Subject: [PATCH] Changing the timecode format in statur bar (from hh:mm:ss:ff to frames) now also changes the timecode display in monitors svn path=/trunk/kdenlive/; revision=3779 --- src/customtrackview.cpp | 2 +- src/kdenlivesettings.kcfg | 5 +++++ src/mainwindow.cpp | 35 +++++++++++++++++++++-------------- src/mainwindow.h | 1 + src/monitor.cpp | 33 ++++++++++++++++++++++++++++----- src/monitor.h | 2 ++ 6 files changed, 58 insertions(+), 20 deletions(-) diff --git a/src/customtrackview.cpp b/src/customtrackview.cpp index 791bdf79..c0df9e9a 100644 --- a/src/customtrackview.cpp +++ b/src/customtrackview.cpp @@ -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(); diff --git a/src/kdenlivesettings.kcfg b/src/kdenlivesettings.kcfg index 693a449d..7f2f7738 100644 --- a/src/kdenlivesettings.kcfg +++ b/src/kdenlivesettings.kcfg @@ -407,6 +407,11 @@ false + + + false + + true diff --git a/src/mainwindow.cpp b/src/mainwindow.cpp index 488975e9..8dde1eb8 100644 --- a/src/mainwindow.cpp +++ b/src/mainwindow.cpp @@ -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" diff --git a/src/mainwindow.h b/src/mainwindow.h index 9133655f..98d6fd87 100644 --- a/src/mainwindow.h +++ b/src/mainwindow.h @@ -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); diff --git a/src/monitor.cpp b/src/monitor.cpp index 0c12a74d..85f52c59 100644 --- a/src/monitor.cpp +++ b/src/monitor.cpp @@ -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), diff --git a/src/monitor.h b/src/monitor.h index 2cffb949..35b539e9 100644 --- a/src/monitor.h +++ b/src/monitor.h @@ -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); -- 2.39.2