service/mpris: add trackChanged signal

This commit is contained in:
outfoxxed 2024-05-21 05:07:24 -07:00
parent af45502913
commit ed3708f5cb
Signed by: outfoxxed
GPG key ID: 4C88A185FB89301E
2 changed files with 9 additions and 1 deletions

View file

@ -258,7 +258,13 @@ void MprisPlayer::onMetadataChanged() {
auto trackidVariant = this->pMetadata.get().value("mpris:trackid"); auto trackidVariant = this->pMetadata.get().value("mpris:trackid");
if (trackidVariant.isValid() && trackidVariant.canConvert<QString>()) { if (trackidVariant.isValid() && trackidVariant.canConvert<QString>()) {
this->mTrackId = trackidVariant.value<QString>(); auto trackId = trackidVariant.value<QString>();
if (trackId != this->mTrackId) {
this->mTrackId = trackId;
emit this->trackChanged();
}
this->onSeek(0); this->onSeek(0);
} }

View file

@ -242,6 +242,8 @@ public:
[[nodiscard]] QList<QString> supportedMimeTypes() const; [[nodiscard]] QList<QString> supportedMimeTypes() const;
signals: signals:
void trackChanged();
QSDOC_HIDE void ready(); QSDOC_HIDE void ready();
void canControlChanged(); void canControlChanged();
void canPlayChanged(); void canPlayChanged();