Skip to content
Extraits de code Groupes Projets

Add the ASS sub document and the ASS tree

Fusionnées Kubat a demandé de fusionner ass-sub-document vers master
2 fichiers
+ 20
2
Comparer les modifications
  • Côte à côte
  • En ligne
Fichiers
2
+ 16
1
@@ -6,10 +6,25 @@ using namespace Vivy::Ass;
Syl::Syl(Line *const line, const QString &lineString, ConstructMode mode) noexcept
: content(lineString)
, styleProperties(line->getStyleProperties())
, dur(line->getDuration())
, duration(line->getDuration())
, parentLine(line)
{
// Will override the `content`, but will be heavy anyway
if (mode == ConstructMode::ReadAssTags) {
const int textBegin = lineString.lastIndexOf('}') + 1;
content = (textBegin >= lineString.size()) ? "" : lineString.mid(textBegin);
duration = getDurationFromString(lineString);
}
}
quint64
Syl::getDurationFromString(const QString &line) noexcept
{
QRegExp re("\\\\(?:k|K|ko|kf)(\\d+)");
int pos = 0;
quint64 duration = 0;
while ((pos = re.indexIn(line, pos)) != -1) {
duration += re.cap(1).toUInt();
}
return duration;
}
Chargement en cours