Skip to content

Commit

Permalink
fix scrub bar and rulers ignore Settings > Time Format
Browse files Browse the repository at this point in the history
  • Loading branch information
ddennedy committed Nov 24, 2024
1 parent fec7e91 commit 0ec9aa0
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 4 deletions.
2 changes: 1 addition & 1 deletion src/qmltypes/qmlapplication.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -142,7 +142,7 @@ void QmlApplication::pasteFilters()
QString QmlApplication::clockFromFrames(int frames)
{
if (MLT.producer()) {
return MLT.producer()->frames_to_time(frames, mlt_time_clock);
return MLT.producer()->frames_to_time(frames, Settings.timeFormat());
}
return QString();
}
Expand Down
8 changes: 5 additions & 3 deletions src/scrubbar.cpp
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2011-2023 Meltytech, LLC
* Copyright (c) 2011-2024 Meltytech, LLC
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
Expand All @@ -17,6 +17,7 @@

#include "scrubbar.h"
#include "mltcontroller.h"
#include "settings.h"

#include <QToolTip>
#include <QtWidgets>
Expand Down Expand Up @@ -171,7 +172,7 @@ void ScrubBar::mouseMoveEvent(QMouseEvent *event)
}
emit seeked(pos);
} else if (event->buttons() == Qt::NoButton && MLT.producer()) {
QString text = QString::fromLatin1(MLT.producer()->frames_to_time(pos));
QString text = QString::fromLatin1(MLT.producer()->frames_to_time(pos, Settings.timeFormat()));
QToolTip::showText(event->globalPosition().toPoint(), text);
}
}
Expand Down Expand Up @@ -305,12 +306,13 @@ void ScrubBar::updatePixmap()
}

// draw timecode
const auto timeFormat = Settings.timeFormat();
if (l_interval > l_timecodeWidth && MLT.producer()) {
int x = l_margin;
for (int i = 0; x < l_width - l_margin - l_timecodeWidth; i++, x += l_interval) {
int y = l_selectionSize + fontMetrics().ascent() - 2 * ratio;
int frames = qRound(i * m_fps * m_secondsPerTick);
p.drawText(x + 2 * ratio, y, QString(MLT.producer()->frames_to_time(frames)).left(8));
p.drawText(x + 2 * ratio, y, QString(MLT.producer()->frames_to_time(frames, timeFormat)).left(8));
}
}

Expand Down

0 comments on commit 0ec9aa0

Please sign in to comment.