Skip to content
GitLab
Explorer
Connexion
Navigation principale
Rechercher ou aller à…
Projet
Vivy
Gestion
Activité
Membres
Labels
Programmation
Tickets
Tableaux des tickets
Jalons
Wiki
Wiki externe
Code
Requêtes de fusion
Dépôt
Branches
Validations
Étiquettes
Graphe du dépôt
Comparer les révisions
Compilation
Pipelines
Jobs
Planifications de pipeline
Artéfacts
Aide
Aide
Support
Documentation de GitLab
Comparer les forfaits GitLab
Forum de la communauté GitLab
Contribuer à GitLab
Donner votre avis
Raccourcis clavier
?
Extraits de code
Groupes
Projets
Afficher davantage de fils d'Ariane
Elliu
Vivy
Validations
a6eca143
Vérifiée
Valider
a6eca143
rédigé
11 juil. 2021
par
Kubat
Parcourir les fichiers
Options
Téléchargements
Correctifs
Plain Diff
ASS: Get end and begin times for lines
parent
7e72f8d5
Aucune branche associée trouvée
Aucune étiquette associée trouvée
1 requête de fusion
!7
Add the ASS sub document and the ASS tree
Modifications
4
Afficher les modifications d'espaces
En ligne
Côte à côte
Affichage de
4 fichiers modifiés
src/Lib/Ass/Line.cc
+3
-0
3 ajouts, 0 suppression
src/Lib/Ass/Line.cc
src/Lib/Ass/Syl.hh
+1
-1
1 ajout, 1 suppression
src/Lib/Ass/Syl.hh
src/Lib/Utils.cc
+32
-0
32 ajouts, 0 suppression
src/Lib/Utils.cc
src/Lib/Utils.hh
+13
-0
13 ajouts, 0 suppression
src/Lib/Utils.hh
avec
49 ajouts
et
1 suppression
src/Lib/Ass/Line.cc
+
3
−
0
Voir le fichier @
a6eca143
...
@@ -38,6 +38,9 @@ Line::Line(AssFactory *const factory, const QString &lineString)
...
@@ -38,6 +38,9 @@ Line::Line(AssFactory *const factory, const QString &lineString)
layer
=
Utils
::
decodeLineToInteger
(
contentList
[
LineIndex
::
Layer
],
"Layer is not an integer"
);
layer
=
Utils
::
decodeLineToInteger
(
contentList
[
LineIndex
::
Layer
],
"Layer is not an integer"
);
effect
=
contentList
[
LineIndex
::
Effect
];
effect
=
contentList
[
LineIndex
::
Effect
];
nameOrActor
=
contentList
[
LineIndex
::
Name
];
nameOrActor
=
contentList
[
LineIndex
::
Name
];
start
=
Utils
::
Time
::
fromString
(
contentList
[
LineIndex
::
Start
]).
toUInt
();
end
=
Utils
::
Time
::
fromString
(
contentList
[
LineIndex
::
End
]).
toUInt
();
styleProperties
.
marginL
=
styleProperties
.
marginL
=
Utils
::
decodeLineToInteger
(
contentList
[
LineIndex
::
MarginL
],
"MarginL is not an integer"
);
Utils
::
decodeLineToInteger
(
contentList
[
LineIndex
::
MarginL
],
"MarginL is not an integer"
);
styleProperties
.
marginR
=
styleProperties
.
marginR
=
...
...
Ce diff est replié.
Cliquez pour l'agrandir.
src/Lib/Ass/Syl.hh
+
1
−
1
Voir le fichier @
a6eca143
...
@@ -11,7 +11,7 @@ namespace Vivy::Ass
...
@@ -11,7 +11,7 @@ namespace Vivy::Ass
{
{
class
Line
;
class
Line
;
class
Syl
{
class
Syl
final
{
private:
private:
QVector
<
Char
>
content
;
QVector
<
Char
>
content
;
StyleProperties
styleProperties
;
StyleProperties
styleProperties
;
...
...
Ce diff est replié.
Cliquez pour l'agrandir.
src/Lib/Utils.cc
+
32
−
0
Voir le fichier @
a6eca143
#include
"Utils.hh"
#include
"Utils.hh"
#include
<QRegExp>
#include
<QFileInfo>
#include
<QFileInfo>
using
namespace
Vivy
;
using
namespace
Vivy
;
...
@@ -50,3 +51,34 @@ Utils::decodeLineToFloating(const QString &item, const QString &error)
...
@@ -50,3 +51,34 @@ Utils::decodeLineToFloating(const QString &item, const QString &error)
throw
std
::
runtime_error
((
"invalid line content: "
+
error
).
toStdString
());
throw
std
::
runtime_error
((
"invalid line content: "
+
error
).
toStdString
());
return
ret
;
return
ret
;
}
}
// The string must be of the form: `H:MM:SS.cs`
Utils
::
Time
Utils
::
Time
::
fromString
(
const
QString
&
str
)
{
QRegExp
re
(
"^(
\\
d+):(
\\
d
\\
d):(
\\
d
\\
d)
\\
.(
\\
d
\\
d)$"
);
// Here the toUint is safe because the RegExp is OK
if
(
re
.
indexIn
(
str
)
!=
-
1
)
return
{
.
hour
=
re
.
cap
(
1
).
toUInt
(),
.
minute
=
re
.
cap
(
2
).
toUInt
(),
.
second
=
re
.
cap
(
3
).
toUInt
(),
.
centisecond
=
re
.
cap
(
4
).
toUInt
()
};
else
throw
std
::
runtime_error
(
"The string is not of the format `H:MM:SS.cs`"
);
}
quint64
Utils
::
Time
::
toUInt
()
const
noexcept
{
return
((
hour
*
3600
)
+
(
minute
*
60
)
+
second
)
*
100
+
centisecond
;
}
// Get a string from a time
QString
Utils
::
Time
::
toString
()
const
noexcept
{
return
QString
::
number
(
hour
)
+
":"
+
QString
::
number
(
minute
)
+
":"
+
QString
::
number
(
second
)
+
"."
+
QString
::
number
(
centisecond
);
}
Ce diff est replié.
Cliquez pour l'agrandir.
src/Lib/Utils.hh
+
13
−
0
Voir le fichier @
a6eca143
...
@@ -84,6 +84,19 @@ toUnderlying(E e) noexcept
...
@@ -84,6 +84,19 @@ toUnderlying(E e) noexcept
return
static_cast
<
std
::
underlying_type_t
<
E
>>
(
e
);
return
static_cast
<
std
::
underlying_type_t
<
E
>>
(
e
);
}
}
// Structure used to represent the time as it is presented in an ASS file.
struct
Time
final
{
quint64
hour
;
quint64
minute
;
quint64
second
;
quint64
centisecond
;
static
Time
fromString
(
const
QString
&
);
QString
toString
()
const
noexcept
;
quint64
toUInt
()
const
noexcept
;
};
bool
detectDocumentType
(
const
QFileInfo
&
,
DocumentType
*
);
bool
detectDocumentType
(
const
QFileInfo
&
,
DocumentType
*
);
bool
decodeLineToBoolean
(
const
QString
&
item
,
const
QString
&
error
);
bool
decodeLineToBoolean
(
const
QString
&
item
,
const
QString
&
error
);
int
decodeLineToInteger
(
const
QString
&
item
,
const
QString
&
error
);
int
decodeLineToInteger
(
const
QString
&
item
,
const
QString
&
error
);
...
...
Ce diff est replié.
Cliquez pour l'agrandir.
Aperçu
0%
Chargement en cours
Veuillez réessayer
ou
joindre un nouveau fichier
.
Annuler
You are about to add
0
people
to the discussion. Proceed with caution.
Terminez d'abord l'édition de ce message.
Enregistrer le commentaire
Annuler
Veuillez vous
inscrire
ou vous
se connecter
pour commenter