mpris2: Fix mpris:trackid type with Plasma 6
This commit is contained in:
parent
2ccb0af75e
commit
88b5cf2461
|
@ -379,8 +379,8 @@ void Mpris2::SetRating(double rating) {
|
|||
|
||||
}
|
||||
|
||||
QString Mpris2::current_track_id() const {
|
||||
return QString("/org/strawberrymusicplayer/strawberry/Track/%1").arg(QString::number(app_->playlist_manager()->active()->current_row()));
|
||||
QDBusObjectPath Mpris2::current_track_id() const {
|
||||
return QDBusObjectPath(QString("/org/strawberrymusicplayer/strawberry/Track/%1").arg(QString::number(app_->playlist_manager()->active()->current_row())));
|
||||
}
|
||||
|
||||
// We send Metadata change notification as soon as the process of changing song starts...
|
||||
|
@ -512,7 +512,7 @@ void Mpris2::Seek(qint64 offset) {
|
|||
|
||||
void Mpris2::SetPosition(const QDBusObjectPath &trackId, qint64 offset) {
|
||||
|
||||
if (CanSeek() && trackId.path() == current_track_id() && offset >= 0) {
|
||||
if (CanSeek() && trackId == current_track_id() && offset >= 0) {
|
||||
offset *= kNsecPerUsec;
|
||||
|
||||
if (offset < app_->player()->GetCurrentItem()->Metadata().length_nanosec()) {
|
||||
|
|
|
@ -225,7 +225,7 @@ class Mpris2 : public QObject {
|
|||
|
||||
QString PlaybackStatus(EngineBase::State state) const;
|
||||
|
||||
QString current_track_id() const;
|
||||
QDBusObjectPath current_track_id() const;
|
||||
|
||||
bool CanSeek(EngineBase::State state) const;
|
||||
|
||||
|
|
|
@ -28,6 +28,7 @@
|
|||
#include <QDateTime>
|
||||
#include <QString>
|
||||
#include <QStringList>
|
||||
#include <QDBusObjectPath>
|
||||
|
||||
namespace mpris {
|
||||
|
||||
|
@ -55,6 +56,10 @@ inline void AddMetadata(const QString &key, const QDateTime &metadata, QVariantM
|
|||
if (metadata.isValid()) (*map)[key] = metadata;
|
||||
}
|
||||
|
||||
inline void AddMetadata(const QString &key, const QDBusObjectPath &metadata, QVariantMap *map) {
|
||||
if (metadata.path().length() > 0) (*map)[key] = metadata;
|
||||
}
|
||||
|
||||
inline QString AsMPRISDateTimeType(const qint64 time) {
|
||||
return time != -1 ? QDateTime::fromSecsSinceEpoch(time).toString(Qt::ISODate) : "";
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue