When user wants to display timecode in frames, use frames for all timecode...

When user wants to display timecode in frames, use frames for all timecode display (keyframes, markers, ...):
http://www.kdenlive.org/mantis/view.php?id=1421

svn path=/trunk/kdenlive/; revision=4303
parent 2feaf66f
......@@ -187,16 +187,20 @@ void CustomRuler::mouseMoveEvent(QMouseEvent * event)
if (event->y() <= 10) setCursor(Qt::ArrowCursor);
else if (qAbs(pos - m_zoneStart * m_factor) < 4) {
setCursor(KCursor("left_side", Qt::SizeHorCursor));
setToolTip(i18n("Zone start: %1", m_timecode.getTimecodeFromFrames(m_zoneStart)));
if (KdenliveSettings::frametimecode()) setToolTip(i18n("Zone start: %1", m_zoneStart));
else setToolTip(i18n("Zone start: %1", m_timecode.getTimecodeFromFrames(m_zoneStart)));
} else if (qAbs(pos - m_zoneEnd * m_factor) < 4) {
setCursor(KCursor("right_side", Qt::SizeHorCursor));
setToolTip(i18n("Zone end: %1", m_timecode.getTimecodeFromFrames(m_zoneEnd)));
if (KdenliveSettings::frametimecode()) setToolTip(i18n("Zone end: %1", m_zoneEnd));
else setToolTip(i18n("Zone end: %1", m_timecode.getTimecodeFromFrames(m_zoneEnd)));
} else if (qAbs(pos - (m_zoneStart + (m_zoneEnd - m_zoneStart) / 2) * m_factor) < 4) {
setCursor(Qt::SizeHorCursor);
setToolTip(i18n("Zone duration: %1", m_timecode.getTimecodeFromFrames(m_zoneEnd - m_zoneStart)));
if (KdenliveSettings::frametimecode()) setToolTip(i18n("Zone duration: %1", m_zoneEnd - m_zoneStart));
else setToolTip(i18n("Zone duration: %1", m_timecode.getTimecodeFromFrames(m_zoneEnd - m_zoneStart)));
} else {
setCursor(Qt::ArrowCursor);
setToolTip(i18n("Position: %1", m_timecode.getTimecodeFromFrames(pos / m_factor)));
if (KdenliveSettings::frametimecode()) setToolTip(i18n("Position: %1", (int)(pos / m_factor)));
else setToolTip(i18n("Position: %1", m_timecode.getTimecodeFromFrames(pos / m_factor)));
}
}
}
......
......@@ -5772,3 +5772,12 @@ void CustomTrackView::insertZoneOverwrite(QStringList data, int in)
new AddTimelineClipCommand(this, clip->toXML(), clip->getId(), info, EffectsList(), true, false, true, false, addCommand);
m_commandStack->push(addCommand);
}
void CustomTrackView::clearSelection()
{
resetSelectionGroup();
scene()->clearSelection();
m_dragItem = NULL;
emit clipItemSelected(NULL);
}
......@@ -130,6 +130,7 @@ public:
QStringList extractTransitionsLumas();
void setEditMode(EDITMODE mode);
void insertClipCut(DocClipBase *clip, int in, int out);
void clearSelection();
public slots:
void setCursorPos(int pos, bool seek = true);
......
......@@ -482,9 +482,9 @@ bool KdenliveDoc::saveSceneList(const QString &path, const QString &scene)
sceneList.setContent(scene, true);
QDomElement mlt = sceneList.firstChildElement("mlt");
if (mlt.isNull() || !mlt.hasChildNodes()) {
//Make sure we don't save if scenelist is corrupted
KMessageBox::error(kapp->activeWindow(), i18n("Cannot write to file %1", path));
return false;
//Make sure we don't save if scenelist is corrupted
KMessageBox::error(kapp->activeWindow(), i18n("Cannot write to file %1", path));
return false;
}
QDomElement addedXml = sceneList.createElement("kdenlivedoc");
mlt.appendChild(addedXml);
......
......@@ -96,7 +96,7 @@ KdenliveSettingsDialog::KdenliveSettingsDialog(QWidget * parent) :
QWidget *p6 = new QWidget;
m_configSdl.setupUi(p6);
// Disable drop B frames, see Kdenlive issue #1330
m_configSdl.groupBox->setHidden(true);
......
This diff is collapsed.
......@@ -426,7 +426,7 @@ MainWindow::MainWindow(const QString &MltPath, const KUrl & Url, QWidget *parent
m_monitorManager->initMonitors(m_clipMonitor, m_projectMonitor);
slotConnectMonitors();
// Disable drop B frames, see Kdenlive issue #1330, see also kdenlivesettingsdialog.cpp
KdenliveSettings::setDropbframes(false);
......@@ -3164,6 +3164,7 @@ void MainWindow::slotUpdateTimecodeFormat(int ix)
KdenliveSettings::setFrametimecode(ix == 1);
m_clipMonitor->updateTimecodeFormat();
m_projectMonitor->updateTimecodeFormat();
m_activeTimeline->projectView()->clearSelection();
}
void MainWindow::slotRemoveFocus()
......
......@@ -82,7 +82,10 @@ MarkerDialog::MarkerDialog(DocClipBase *clip, CommentedTime t, Timecode tc, cons
connect(marker_position, SIGNAL(textChanged(const QString &)), this, SIGNAL(updateThumb()));
} else clip_thumb->setHidden(true);
marker_position->setText(tc.getTimecode(t.time()));
if (KdenliveSettings::frametimecode()) {
marker_position->setInputMask("000000000000");
marker_position->setText(QString::number((int) t.time().frames(m_fps)));
} else marker_position->setText(tc.getTimecode(t.time()));
marker_comment->setText(t.comment());
marker_comment->selectAll();
......@@ -104,7 +107,9 @@ MarkerDialog::~MarkerDialog()
void MarkerDialog::slotUpdateThumb()
{
m_previewTimer->stop();
int pos = m_tc.getFrameCount(marker_position->text());
int pos;
if (KdenliveSettings::frametimecode()) pos = marker_position->text().toInt();
else pos = m_tc.getFrameCount(marker_position->text());
int width = 100.0 * m_dar;
if (width % 2 == 1) width++;
QPixmap p = QPixmap::fromImage(KThumb::getFrame(m_producer, pos, width, 100));
......@@ -114,22 +119,29 @@ void MarkerDialog::slotUpdateThumb()
void MarkerDialog::slotTimeUp()
{
int duration = m_tc.getFrameCount(marker_position->text());
int duration;
if (KdenliveSettings::frametimecode()) duration = marker_position->text().toInt();
else duration = m_tc.getFrameCount(marker_position->text());
if (m_clip && duration >= m_clip->duration().frames(m_fps)) return;
duration ++;
marker_position->setText(m_tc.getTimecode(GenTime(duration, m_fps)));
if (KdenliveSettings::frametimecode()) marker_position->setText(QString::number(duration));
else marker_position->setText(m_tc.getTimecode(GenTime(duration, m_fps)));
}
void MarkerDialog::slotTimeDown()
{
int duration = m_tc.getFrameCount(marker_position->text());
int duration;
if (KdenliveSettings::frametimecode()) duration = marker_position->text().toInt();
else duration = m_tc.getFrameCount(marker_position->text());
if (duration <= 0) return;
duration --;
marker_position->setText(m_tc.getTimecode(GenTime(duration, m_fps)));
if (KdenliveSettings::frametimecode()) marker_position->setText(QString::number(duration));
else marker_position->setText(m_tc.getTimecode(GenTime(duration, m_fps)));
}
CommentedTime MarkerDialog::newMarker()
{
if (KdenliveSettings::frametimecode()) return CommentedTime(GenTime(marker_position->text().toInt(), m_fps), marker_comment->text());
return CommentedTime(GenTime(m_tc.getFrameCount(marker_position->text()), m_fps), marker_comment->text());
}
......
......@@ -30,7 +30,10 @@ PositionEdit::PositionEdit(const QString name, int pos, int min, int max, const
connect(m_ui.horizontalSlider, SIGNAL(valueChanged(int)), this, SLOT(slotUpdateTimecode()));
connect(m_ui.krestrictedline, SIGNAL(editingFinished()), this, SLOT(slotUpdatePosition()));
m_ui.horizontalSlider->setValue(pos);
m_ui.krestrictedline->setText(m_tc.getTimecodeFromFrames(pos));
if (KdenliveSettings::frametimecode()) {
m_ui.krestrictedline->setInputMask("000000000000");
m_ui.krestrictedline->setText(QString::number(pos));
} else m_ui.krestrictedline->setText(m_tc.getTimecodeFromFrames(pos));
}
int PositionEdit::getPosition() const
......@@ -41,23 +44,28 @@ int PositionEdit::getPosition() const
void PositionEdit::setPosition(int pos)
{
m_ui.horizontalSlider->setValue(pos);
m_ui.krestrictedline->setText(m_tc.getTimecodeFromFrames(pos));
if (KdenliveSettings::frametimecode()) m_ui.krestrictedline->setText(QString::number(pos));
else m_ui.krestrictedline->setText(m_tc.getTimecodeFromFrames(pos));
}
void PositionEdit::slotUpdateTimecode()
{
m_ui.krestrictedline->setText(m_tc.getTimecodeFromFrames(m_ui.horizontalSlider->value()));
if (KdenliveSettings::frametimecode()) m_ui.krestrictedline->setText(QString::number(m_ui.horizontalSlider->value()));
else m_ui.krestrictedline->setText(m_tc.getTimecodeFromFrames(m_ui.horizontalSlider->value()));
emit parameterChanged();
}
void PositionEdit::slotUpdatePosition()
{
m_ui.horizontalSlider->blockSignals(true);
int pos = m_tc.getFrameCount(m_ui.krestrictedline->text());
int pos;
if (KdenliveSettings::frametimecode()) pos = m_ui.krestrictedline->text().toInt();
else pos = m_tc.getFrameCount(m_ui.krestrictedline->text());
m_ui.horizontalSlider->setValue(pos);
if (pos != m_ui.horizontalSlider->value()) {
// Value out of range
m_ui.krestrictedline->setText(m_tc.getTimecodeFromFrames(m_ui.horizontalSlider->value()));
if (KdenliveSettings::frametimecode()) m_ui.krestrictedline->setText(QString::number(m_ui.horizontalSlider->value()));
else m_ui.krestrictedline->setText(m_tc.getTimecodeFromFrames(m_ui.horizontalSlider->value()));
}
m_ui.horizontalSlider->blockSignals(false);
emit parameterChanged();
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment