Skip to content

Commit aef7806

Browse files
committed
Render when tags are modified
1 parent 81815e1 commit aef7806

2 files changed

Lines changed: 32 additions & 20 deletions

File tree

taglib/matroska/matroskatag.cpp

Lines changed: 31 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -123,39 +123,48 @@ void Matroska::Tag::setSegmentTitle(const String& title)
123123
d->segmentTitle = title;
124124
}
125125

126+
bool Matroska::Tag::setTag(const String &key, const String &value)
127+
{
128+
bool found = d->setTag(key, value);
129+
if(found) {
130+
setNeedsRender(true);
131+
}
132+
return found;
133+
}
134+
126135
void Matroska::Tag::setTitle(const String &s)
127136
{
128-
d->setTag("TITLE", s);
137+
setTag("TITLE", s);
129138
}
130139

131140
void Matroska::Tag::setArtist(const String &s)
132141
{
133-
d->setTag("ARTIST", s);
142+
setTag("ARTIST", s);
134143
}
135144

136145
void Matroska::Tag::setAlbum(const String &s)
137146
{
138-
d->setTag("ALBUM", s);
147+
setTag("ALBUM", s);
139148
}
140149

141150
void Matroska::Tag::setComment(const String &s)
142151
{
143-
d->setTag("COMMENT", s);
152+
setTag("COMMENT", s);
144153
}
145154

146155
void Matroska::Tag::setGenre(const String &s)
147156
{
148-
d->setTag("GENRE", s);
157+
setTag("GENRE", s);
149158
}
150159

151160
void Matroska::Tag::setYear(unsigned int i)
152161
{
153-
d->setTag("DATE", i != 0 ? String::number(i) : String());
162+
setTag("DATE", i != 0 ? String::number(i) : String());
154163
}
155164

156165
void Matroska::Tag::setTrack(unsigned int i)
157166
{
158-
d->setTag("TRACKNUMBER", i != 0 ? String::number(i) : String());
167+
setTag("TRACKNUMBER", i != 0 ? String::number(i) : String());
159168
}
160169

161170
String Matroska::Tag::title() const
@@ -468,11 +477,12 @@ PropertyMap Matroska::Tag::setProperties(const PropertyMap &propertyMap)
468477

469478
void Matroska::Tag::removeUnsupportedProperties(const StringList& properties)
470479
{
471-
d->removeSimpleTags(
472-
[&properties](const SimpleTag &t) {
473-
return properties.contains(t.name());
474-
}
475-
);
480+
if(d->removeSimpleTags(
481+
[&properties](const SimpleTag& t) {
482+
return properties.contains(t.name());
483+
}) > 0) {
484+
setNeedsRender(true);
485+
}
476486
}
477487

478488
StringList Matroska::Tag::complexPropertyKeys() const
@@ -526,14 +536,15 @@ bool Matroska::Tag::setComplexProperties(const String& key, const List<VariantMa
526536
// Pictures are handled at the file level
527537
return false;
528538
}
529-
d->removeSimpleTags(
530-
[&key](const SimpleTag &t) {
531-
return t.name() == key &&
532-
(t.type() != SimpleTag::StringType ||
533-
t.trackUid() != 0 ||
534-
translateTag(t.name(), t.targetTypeValue()).isEmpty());
535-
}
536-
);
539+
if(d->removeSimpleTags(
540+
[&key](const SimpleTag &t) {
541+
return t.name() == key &&
542+
(t.type() != SimpleTag::StringType ||
543+
t.trackUid() != 0 ||
544+
translateTag(t.name(), t.targetTypeValue()).isEmpty());
545+
}) > 0) {
546+
setNeedsRender(true);
547+
}
537548
bool result = false;
538549
for(const auto &property : value) {
539550
if(property.value("name").value<String>() == key &&

taglib/matroska/matroskatag.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -99,6 +99,7 @@ namespace TagLib {
9999
friend class EBML::MkTags;
100100
class TagPrivate;
101101

102+
bool setTag(const String &key, const String &value);
102103
void setSegmentTitle(const String &title);
103104

104105
// private Element implementation

0 commit comments

Comments
 (0)