Add missing bit for MPRIS taskbar progress (which still doesn't work)

This commit is contained in:
Bart De Vries 2021-04-14 21:11:03 +02:00
parent 49baa7915b
commit 0d778c2a47
1 changed files with 16 additions and 0 deletions

View File

@ -89,6 +89,22 @@ QString MediaPlayer2Player::PlaybackStatus() const
result = QStringLiteral("Paused");
}
if (mShowProgressOnTaskBar) {
QVariantMap parameters;
if (m_audioPlayer->playbackState() == QMediaPlayer::StoppedState || m_audioPlayer->duration() == 0) {
parameters.insert(QStringLiteral("progress-visible"), false);
parameters.insert(QStringLiteral("progress"), 0);
} else {
parameters.insert(QStringLiteral("progress-visible"), true);
parameters.insert(QStringLiteral("progress"), qRound(static_cast<double>(m_position / m_audioPlayer->duration())) / 1000.0);
}
mProgressIndicatorSignal.setArguments({QStringLiteral("application://org.kde.alligator.desktop"), parameters});
QDBusConnection::sessionBus().send(mProgressIndicatorSignal);
}
return result;
}