forked from mia/Aegisub
Check for uses of styles other than "Default" in CanSave rather than customized styles
Customizable default styles makes the latter check awkward to implement, and the previous logic of comparing against the hardcoded default wrong.
This commit is contained in:
parent
bc2f862909
commit
562a2259f5
2 changed files with 7 additions and 10 deletions
|
@ -86,14 +86,9 @@ bool SubtitleFormat::CanSave(const AssFile *subs) const {
|
|||
if (!subs->Attachments.empty())
|
||||
return false;
|
||||
|
||||
std::string defstyle = AssStyle().GetEntryData();
|
||||
for (auto const& line : subs->Styles) {
|
||||
if (line.GetEntryData() != defstyle)
|
||||
return false;
|
||||
}
|
||||
|
||||
auto def = boost::flyweight<std::string>("Default");
|
||||
for (auto const& line : subs->Events) {
|
||||
if (line.GetStrippedText() != line.Text)
|
||||
if (line.Style != def || line.GetStrippedText() != line.Text)
|
||||
return false;
|
||||
}
|
||||
|
||||
|
|
|
@ -334,9 +334,7 @@ SRTSubtitleFormat::SRTSubtitleFormat()
|
|||
}
|
||||
|
||||
std::vector<std::string> SRTSubtitleFormat::GetReadWildcards() const {
|
||||
std::vector<std::string> formats;
|
||||
formats.push_back("srt");
|
||||
return formats;
|
||||
return {"srt"};
|
||||
}
|
||||
|
||||
std::vector<std::string> SRTSubtitleFormat::GetWriteWildcards() const {
|
||||
|
@ -494,7 +492,11 @@ bool SRTSubtitleFormat::CanSave(const AssFile *file) const {
|
|||
if (!file->Attachments.empty())
|
||||
return false;
|
||||
|
||||
auto def = boost::flyweight<std::string>("Default");
|
||||
for (auto const& line : file->Events) {
|
||||
if (line.Style != def)
|
||||
return false;
|
||||
|
||||
auto blocks = line.ParseTags();
|
||||
for (auto ovr : blocks | agi::of_type<AssDialogueBlockOverride>()) {
|
||||
// Verify that all overrides used are supported
|
||||
|
|
Loading…
Reference in a new issue