Skip to content
GitLab
Explorer
Connexion
Navigation principale
Rechercher ou aller à…
Projet
Aegisub
Gestion
Activité
Membres
Labels
Programmation
Tickets
Tableaux des tickets
Jalons
Wiki
Code
Requêtes de fusion
Dépôt
Branches
Validations
Étiquettes
Graphe du dépôt
Comparer les révisions
Extraits de code
Déploiement
Releases
Registre de paquets
Registre de conteneurs
Registre de modèles
Opération
Modules Terraform
Surveillance
Incidents
Analyse
Données d'analyse des chaînes de valeur
Analyse des contributeurs
Données d'analyse du dépôt
Expériences du modèle
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
Ce projet est archivé. Le dépôt et les autres ressources du projet sont en lecture seule.
Afficher davantage de fils d'Ariane
Kubat
Aegisub
Validations
1a284701
Valider
1a284701
rédigé
Il y a 11 ans
par
Thomas Goyne
Parcourir les fichiers
Options
Téléchargements
Correctifs
Plain Diff
Kill the awkward automatic subtitle format (de)registration
parent
9f612422
Aucune branche associée trouvée
Aucune étiquette associée trouvée
Aucune requête de fusion associée trouvée
Modifications
3
Afficher les modifications d'espaces
En ligne
Côte à côte
Affichage de
3 fichiers modifiés
aegisub/src/main.cpp
+0
-1
0 ajout, 1 suppression
aegisub/src/main.cpp
aegisub/src/subtitle_format.cpp
+19
-24
19 ajouts, 24 suppressions
aegisub/src/subtitle_format.cpp
aegisub/src/subtitle_format.h
+0
-7
0 ajout, 7 suppressions
aegisub/src/subtitle_format.h
avec
19 ajouts
et
32 suppressions
aegisub/src/main.cpp
+
0
−
1
Voir le fichier @
1a284701
...
@@ -294,7 +294,6 @@ int AegisubApp::OnExit() {
...
@@ -294,7 +294,6 @@ int AegisubApp::OnExit() {
wxTheClipboard
->
Close
();
wxTheClipboard
->
Close
();
}
}
SubtitleFormat
::
DestroyFormats
();
delete
config
::
opt
;
delete
config
::
opt
;
delete
config
::
mru
;
delete
config
::
mru
;
hotkey
::
clear
();
hotkey
::
clear
();
...
...
Ce diff est replié.
Cliquez pour l'agrandir.
aegisub/src/subtitle_format.cpp
+
19
−
24
Voir le fichier @
1a284701
...
@@ -53,11 +53,11 @@
...
@@ -53,11 +53,11 @@
#include
"subtitle_format_transtation.h"
#include
"subtitle_format_transtation.h"
#include
"subtitle_format_ttxt.h"
#include
"subtitle_format_ttxt.h"
#include
"subtitle_format_txt.h"
#include
"subtitle_format_txt.h"
#include
"utils.h"
#include
"video_context.h"
#include
"video_context.h"
#include
<libaegisub/fs.h>
#include
<libaegisub/fs.h>
#include
<libaegisub/of_type_adaptor.h>
#include
<libaegisub/of_type_adaptor.h>
#include
<libaegisub/util.h>
#include
<algorithm>
#include
<algorithm>
#include
<boost/algorithm/string/join.hpp>
#include
<boost/algorithm/string/join.hpp>
...
@@ -66,15 +66,16 @@
...
@@ -66,15 +66,16 @@
using
namespace
std
::
placeholders
;
using
namespace
std
::
placeholders
;
namespace
{
std
::
vector
<
std
::
unique_ptr
<
SubtitleFormat
>>
formats
;
}
SubtitleFormat
::
SubtitleFormat
(
std
::
string
name
)
SubtitleFormat
::
SubtitleFormat
(
std
::
string
name
)
:
name
(
std
::
move
(
name
))
:
name
(
std
::
move
(
name
))
{
{
formats
.
push_back
(
this
);
}
}
SubtitleFormat
::~
SubtitleFormat
()
{
SubtitleFormat
::~
SubtitleFormat
()
{
}
formats
.
erase
(
remove
(
begin
(
formats
),
end
(
formats
),
this
));
}
bool
SubtitleFormat
::
CanReadFile
(
agi
::
fs
::
path
const
&
filename
,
std
::
string
const
&
)
const
{
bool
SubtitleFormat
::
CanReadFile
(
agi
::
fs
::
path
const
&
filename
,
std
::
string
const
&
)
const
{
auto
wildcards
=
GetReadWildcards
();
auto
wildcards
=
GetReadWildcards
();
...
@@ -307,33 +308,27 @@ void SubtitleFormat::MergeIdentical(AssFile &file) {
...
@@ -307,33 +308,27 @@ void SubtitleFormat::MergeIdentical(AssFile &file) {
}
}
}
}
std
::
vector
<
SubtitleFormat
*>
SubtitleFormat
::
formats
;
void
SubtitleFormat
::
LoadFormats
()
{
void
SubtitleFormat
::
LoadFormats
()
{
if
(
formats
.
empty
())
{
if
(
formats
.
empty
())
{
new
AssSubtitleFormat
;
formats
.
emplace_back
(
agi
::
util
::
make_unique
<
AssSubtitleFormat
>
())
;
new
Ebu3264SubtitleFormat
;
formats
.
emplace_back
(
agi
::
util
::
make_unique
<
Ebu3264SubtitleFormat
>
())
;
new
EncoreSubtitleFormat
;
formats
.
emplace_back
(
agi
::
util
::
make_unique
<
EncoreSubtitleFormat
>
())
;
new
MKVSubtitleFormat
;
formats
.
emplace_back
(
agi
::
util
::
make_unique
<
MKVSubtitleFormat
>
())
;
new
MicroDVDSubtitleFormat
;
formats
.
emplace_back
(
agi
::
util
::
make_unique
<
MicroDVDSubtitleFormat
>
())
;
new
SRTSubtitleFormat
;
formats
.
emplace_back
(
agi
::
util
::
make_unique
<
SRTSubtitleFormat
>
())
;
new
TTXTSubtitleFormat
;
formats
.
emplace_back
(
agi
::
util
::
make_unique
<
TTXTSubtitleFormat
>
())
;
new
TXTSubtitleFormat
;
formats
.
emplace_back
(
agi
::
util
::
make_unique
<
TXTSubtitleFormat
>
())
;
new
TranStationSubtitleFormat
;
formats
.
emplace_back
(
agi
::
util
::
make_unique
<
TranStationSubtitleFormat
>
())
;
}
}
}
}
void
SubtitleFormat
::
DestroyFormats
()
{
while
(
!
formats
.
empty
())
delete
formats
.
back
();
}
template
<
class
Cont
,
class
Pred
>
template
<
class
Cont
,
class
Pred
>
SubtitleFormat
*
find_or_throw
(
Cont
&
container
,
Pred
pred
)
{
SubtitleFormat
*
find_or_throw
(
Cont
&
container
,
Pred
pred
)
{
auto
it
=
find_if
(
container
.
begin
(),
container
.
end
(),
pred
);
auto
it
=
find_if
(
container
.
begin
(),
container
.
end
(),
pred
);
if
(
it
==
container
.
end
())
if
(
it
==
container
.
end
())
throw
UnknownSubtitleFormatError
(
"Subtitle format for extension not found"
,
nullptr
);
throw
UnknownSubtitleFormatError
(
"Subtitle format for extension not found"
,
nullptr
);
return
*
it
;
return
it
->
get
()
;
}
}
const
SubtitleFormat
*
SubtitleFormat
::
GetReader
(
agi
::
fs
::
path
const
&
filename
,
std
::
string
const
&
encoding
)
{
const
SubtitleFormat
*
SubtitleFormat
::
GetReader
(
agi
::
fs
::
path
const
&
filename
,
std
::
string
const
&
encoding
)
{
...
@@ -352,11 +347,11 @@ std::string SubtitleFormat::GetWildcards(int mode) {
...
@@ -352,11 +347,11 @@ std::string SubtitleFormat::GetWildcards(int mode) {
std
::
vector
<
std
::
string
>
all
;
std
::
vector
<
std
::
string
>
all
;
std
::
string
final
;
std
::
string
final
;
for
(
auto
format
:
formats
)
{
for
(
auto
const
&
format
:
formats
)
{
std
::
vector
<
std
::
string
>
cur
=
mode
==
0
?
format
->
GetReadWildcards
()
:
format
->
GetWriteWildcards
();
auto
cur
=
mode
==
0
?
format
->
GetReadWildcards
()
:
format
->
GetWriteWildcards
();
if
(
cur
.
empty
())
continue
;
if
(
cur
.
empty
())
continue
;
for
_each
(
cur
.
begin
(),
cur
.
end
(),
[](
std
::
string
&
str
)
{
str
.
insert
(
0
,
"*."
);
});
for
(
auto
&
str
:
cur
)
str
.
insert
(
0
,
"*."
);
all
.
insert
(
all
.
end
(),
begin
(
cur
),
end
(
cur
));
all
.
insert
(
all
.
end
(),
begin
(
cur
),
end
(
cur
));
final
+=
"|"
+
format
->
GetName
()
+
" ("
+
boost
::
join
(
cur
,
","
)
+
")|"
+
boost
::
join
(
cur
,
";"
);
final
+=
"|"
+
format
->
GetName
()
+
" ("
+
boost
::
join
(
cur
,
","
)
+
")|"
+
boost
::
join
(
cur
,
";"
);
}
}
...
...
Ce diff est replié.
Cliquez pour l'agrandir.
aegisub/src/subtitle_format.h
+
0
−
7
Voir le fichier @
1a284701
...
@@ -52,9 +52,6 @@ class SubtitleFormat {
...
@@ -52,9 +52,6 @@ class SubtitleFormat {
/// Get this format's wildcards for a save dialog
/// Get this format's wildcards for a save dialog
virtual
std
::
vector
<
std
::
string
>
GetWriteWildcards
()
const
{
return
{};
}
virtual
std
::
vector
<
std
::
string
>
GetWriteWildcards
()
const
{
return
{};
}
/// List of loaded subtitle formats
static
std
::
vector
<
SubtitleFormat
*>
formats
;
public
:
public
:
/// Strip override tags
/// Strip override tags
static
void
StripTags
(
AssFile
&
file
);
static
void
StripTags
(
AssFile
&
file
);
...
@@ -80,10 +77,8 @@ public:
...
@@ -80,10 +77,8 @@ public:
/// Constructor
/// Constructor
/// @param Subtitle format name
/// @param Subtitle format name
/// @note Automatically registers the format
SubtitleFormat
(
std
::
string
name
);
SubtitleFormat
(
std
::
string
name
);
/// Destructor
/// Destructor
/// @note Automatically unregisters the format
virtual
~
SubtitleFormat
();
virtual
~
SubtitleFormat
();
/// Get this format's name
/// Get this format's name
...
@@ -129,8 +124,6 @@ public:
...
@@ -129,8 +124,6 @@ public:
static
const
SubtitleFormat
*
GetWriter
(
agi
::
fs
::
path
const
&
filename
);
static
const
SubtitleFormat
*
GetWriter
(
agi
::
fs
::
path
const
&
filename
);
/// Initialize subtitle formats
/// Initialize subtitle formats
static
void
LoadFormats
();
static
void
LoadFormats
();
/// Deinitialize subtitle formats
static
void
DestroyFormats
();
};
};
DEFINE_SIMPLE_EXCEPTION
(
SubtitleFormatParseError
,
agi
::
InvalidInputException
,
"subtitle_io/parse/generic"
)
DEFINE_SIMPLE_EXCEPTION
(
SubtitleFormatParseError
,
agi
::
InvalidInputException
,
"subtitle_io/parse/generic"
)
...
...
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