diff --git a/taglib/matroska/matroskatag.cpp b/taglib/matroska/matroskatag.cpp index 94a19e88..34a2b2d7 100644 --- a/taglib/matroska/matroskatag.cpp +++ b/taglib/matroska/matroskatag.cpp @@ -123,39 +123,48 @@ void Matroska::Tag::setSegmentTitle(const String& title) d->segmentTitle = title; } +bool Matroska::Tag::setTag(const String &key, const String &value) +{ + bool found = d->setTag(key, value); + if(found) { + setNeedsRender(true); + } + return found; +} + void Matroska::Tag::setTitle(const String &s) { - d->setTag("TITLE", s); + setTag("TITLE", s); } void Matroska::Tag::setArtist(const String &s) { - d->setTag("ARTIST", s); + setTag("ARTIST", s); } void Matroska::Tag::setAlbum(const String &s) { - d->setTag("ALBUM", s); + setTag("ALBUM", s); } void Matroska::Tag::setComment(const String &s) { - d->setTag("COMMENT", s); + setTag("COMMENT", s); } void Matroska::Tag::setGenre(const String &s) { - d->setTag("GENRE", s); + setTag("GENRE", s); } void Matroska::Tag::setYear(unsigned int i) { - d->setTag("DATE", i != 0 ? String::number(i) : String()); + setTag("DATE", i != 0 ? String::number(i) : String()); } void Matroska::Tag::setTrack(unsigned int i) { - d->setTag("TRACKNUMBER", i != 0 ? String::number(i) : String()); + setTag("TRACKNUMBER", i != 0 ? String::number(i) : String()); } String Matroska::Tag::title() const @@ -468,11 +477,12 @@ PropertyMap Matroska::Tag::setProperties(const PropertyMap &propertyMap) void Matroska::Tag::removeUnsupportedProperties(const StringList& properties) { - d->removeSimpleTags( - [&properties](const SimpleTag &t) { - return properties.contains(t.name()); - } - ); + if(d->removeSimpleTags( + [&properties](const SimpleTag& t) { + return properties.contains(t.name()); + }) > 0) { + setNeedsRender(true); + } } StringList Matroska::Tag::complexPropertyKeys() const @@ -526,14 +536,15 @@ bool Matroska::Tag::setComplexProperties(const String& key, const ListremoveSimpleTags( - [&key](const SimpleTag &t) { - return t.name() == key && - (t.type() != SimpleTag::StringType || - t.trackUid() != 0 || - translateTag(t.name(), t.targetTypeValue()).isEmpty()); - } - ); + if(d->removeSimpleTags( + [&key](const SimpleTag &t) { + return t.name() == key && + (t.type() != SimpleTag::StringType || + t.trackUid() != 0 || + translateTag(t.name(), t.targetTypeValue()).isEmpty()); + }) > 0) { + setNeedsRender(true); + } bool result = false; for(const auto &property : value) { if(property.value("name").value() == key && diff --git a/taglib/matroska/matroskatag.h b/taglib/matroska/matroskatag.h index 81f83876..7af36d41 100644 --- a/taglib/matroska/matroskatag.h +++ b/taglib/matroska/matroskatag.h @@ -99,6 +99,7 @@ namespace TagLib { friend class EBML::MkTags; class TagPrivate; + bool setTag(const String &key, const String &value); void setSegmentTitle(const String &title); // private Element implementation