Skip to content
Extraits de code Groupes Projets
Vérifiée Valider 7e72f8d5 rédigé par Kubat's avatar Kubat
Parcourir les fichiers

ASS: Correct construct of lines, still not the times

parent 6e4f1d4d
Aucune branche associée trouvée
Aucune étiquette associée trouvée
1 requête de fusion!7Add the ASS sub document and the ASS tree
......@@ -69,6 +69,8 @@ AssFactory::initFromStorage() noexcept
qCritical() << "Failed to create ASS style or events with error:" << e.what();
}
qDebug() << "Got" << assLines.size() << "ASS dialog lines";
return true;
}
......
......@@ -27,18 +27,17 @@ Line::Line(AssFactory *const factory, const QString &lineString)
throw std::runtime_error(("invalid event line header: " + lineString).toStdString());
const QString lineContent = lineString.mid(lineString.indexOf(": ") + 2 /* strlen ": " */);
const QStringList contentList = lineContent.split(",", Qt::KeepEmptyParts, Qt::CaseInsensitive);
QStringList contentList = lineContent.split(",", Qt::KeepEmptyParts, Qt::CaseInsensitive);
if (contentList.size() != LineIndex::PastLastCode)
throw std::runtime_error(("invalid number of items " + QString::number(content.size()) +
" instead of " + QString::number(PastLastCode) +
" for line: " + lineContent)
if (contentList.size() < LineIndex::PastLastCode)
throw std::runtime_error(("invalid number of items " + QString::number(contentList.size()) +
" instead of something superiror or equal to " +
QString::number(PastLastCode) + " for line: " + lineContent)
.toStdString());
layer = Utils::decodeLineToInteger(contentList[LineIndex::Layer], "Layer is not an integer");
effect = contentList[LineIndex::Effect];
nameOrActor = contentList[LineIndex::Name];
___contentAsText = lineContent[LineIndex::Text];
styleProperties.marginL =
Utils::decodeLineToInteger(contentList[LineIndex::MarginL], "MarginL is not an integer");
styleProperties.marginR =
......@@ -50,6 +49,11 @@ Line::Line(AssFactory *const factory, const QString &lineString)
if (!assFactory->hasStyle(style))
throw std::runtime_error(("Invalid or not declared style name: " + style).toStdString());
lineStyle = assFactory->getStyle(style);
// Pop all but the text, it may contains `,` characters
for (int i = 0; i < LineIndex::Text; ++i)
contentList.removeFirst();
___contentAsText = contentList.join("");
}
void
......
0% Chargement en cours ou .
You are about to add 0 people to the discussion. Proceed with caution.
Veuillez vous inscrire ou vous pour commenter