Пример #1
0
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;
    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));
    text.append(':');
    text.append(QString::number(seconds).rightJustified(2, '0', false));
    if (m_dropFrameTimecode)
        text.append(',');
    else
        text.append(':');
    text.append(QString::number(hundredths).rightJustified(2, '0', false));

    return text;
}
Пример #2
0
const QString Timecode::getTimecodeSeconds(const GenTime & time) const
{
    QLocale locale;
    locale.setNumberOptions(QLocale::OmitGroupSeparator);
    return locale.toString(time.seconds());
}