QString Timecode::getStringTimecode(int frames, const double &fps)
{
// Returns the timecode in an hh:mm:ss format
+
+ bool negative = false;
+ if (frames < 0) {
+ negative = true;
+ frames = qAbs(frames);
+ }
+
int seconds = (int)(frames / fps);
int minutes = seconds / 60;
seconds = seconds % 60;
int hours = minutes / 60;
minutes = minutes % 60;
QString text;
+ if (negative)
+ text.append('-');
text.append(QString::number(hours).rightJustified(2, '0', false));
text.append(':');
text.append(QString::number(minutes).rightJustified(2, '0', false));
{
// Returns the timecode in an easily read display, like 3 min. 5 sec.
int frames = (int) time.frames(fps);
+
+ bool negative = false;
+ if (frames < 0) {
+ negative = true;
+ frames = qAbs(frames);
+ }
+
int seconds = (int)(frames / fps);
frames = frames - ((int)(fps * seconds));
QString text;
bool trim = false;
+ if (negative)
+ text.append('-');
if (hours != 0) {
text.append(QString::number(hours).rightJustified(2, '0', false));
text.append(' ' + i18n("hour") + ' ');
if (m_dropFrameTimecode) {
return getTimecodeDropFrame(frames);
}
+
+ bool negative = false;
+ if (frames < 0) {
+ negative = true;
+ frames = qAbs(frames);
+ }
+
int seconds = frames / m_displayedFramesPerSecond;
frames = frames % m_displayedFramesPerSecond;
minutes = minutes % 60;
QString text;
+ if (negative)
+ text.append('-');
text.append(QString::number(hours).rightJustified(2, '0', false));
text.append(':');
text.append(QString::number(minutes).rightJustified(2, '0', false));
const QString Timecode::getTimecodeHH_MM_SS_HH(const GenTime & time) const
{
int hundredths = (int)(time.seconds() * 100);
+
+ bool negative = false;
+ if (hundredths < 0) {
+ negative = true;
+ hundredths = qAbs(hundredths);
+ }
+
int seconds = hundredths / 100;
hundredths = hundredths % 100;
int minutes = seconds / 60;
minutes = minutes % 60;
QString text;
-
+ if (negative)
+ text.append('-');
text.append(QString::number(hours).rightJustified(2, '0', false));
text.append(':');
text.append(QString::number(minutes).rightJustified(2, '0', false));
//Given an int called framenumber and a double called framerate
//Framerate should be 29.97, 59.94, or 23.976, otherwise the calculations will be off.
+ bool negative = false;
+ if (framenumber < 0) {
+ negative = true;
+ framenumber = qAbs(framenumber);
+ }
+
int d = floor(framenumber / m_framesPer10Minutes);
int m = framenumber % m_framesPer10Minutes;
int hours = floor(floor(floor(framenumber / m_displayedFramesPerSecond) / 60) / 60);
QString text;
+ if (negative)
+ text.append('-');
text.append(QString::number(hours).rightJustified(2, '0', false));
text.append(':');
text.append(QString::number(minutes).rightJustified(2, '0', false));