mirror of https://github.com/KDE/kasts.git
Solve problem with MPRIS2 handles not working
This only happened when no track was loaded at startup. According to the MPRIS2 spec, a special "properties changed" signal needs to be sent.
This commit is contained in:
parent
2afc8803f8
commit
3cc8eeffb4
|
@ -37,14 +37,6 @@ MediaPlayer2Player::MediaPlayer2Player(AudioManager *audioPlayer, bool showProgr
|
||||||
// this, &MediaPlayer2Player::mimimumRateChanged);
|
// this, &MediaPlayer2Player::mimimumRateChanged);
|
||||||
//connect(m_audioPlayer, &AudioManager::maximumRateChanged,
|
//connect(m_audioPlayer, &AudioManager::maximumRateChanged,
|
||||||
// this, &MediaPlayer2Player::maximumRateChanged);
|
// this, &MediaPlayer2Player::maximumRateChanged);
|
||||||
connect(m_audioPlayer, &AudioManager::canSkipForwardChanged,
|
|
||||||
this, &MediaPlayer2Player::canGoNextChanged);
|
|
||||||
connect(m_audioPlayer, &AudioManager::canSkipBackwardChanged,
|
|
||||||
this, &MediaPlayer2Player::canGoPreviousChanged);
|
|
||||||
connect(m_audioPlayer, &AudioManager::canPlayChanged,
|
|
||||||
this, &MediaPlayer2Player::canPlayChanged);
|
|
||||||
connect(m_audioPlayer, &AudioManager::canPauseChanged,
|
|
||||||
this, &MediaPlayer2Player::canPauseChanged);
|
|
||||||
connect(m_audioPlayer, &AudioManager::seekableChanged,
|
connect(m_audioPlayer, &AudioManager::seekableChanged,
|
||||||
this, &MediaPlayer2Player::canSeekChanged);
|
this, &MediaPlayer2Player::canSeekChanged);
|
||||||
|
|
||||||
|
@ -55,6 +47,16 @@ MediaPlayer2Player::MediaPlayer2Player(AudioManager *audioPlayer, bool showProgr
|
||||||
this, &MediaPlayer2Player::playerVolumeChanged);
|
this, &MediaPlayer2Player::playerVolumeChanged);
|
||||||
connect(m_audioPlayer, &AudioManager::positionChanged,
|
connect(m_audioPlayer, &AudioManager::positionChanged,
|
||||||
this, &MediaPlayer2Player::playerSeeked); // Implement Seeked signal
|
this, &MediaPlayer2Player::playerSeeked); // Implement Seeked signal
|
||||||
|
connect(m_audioPlayer, &AudioManager::canSkipForwardChanged,
|
||||||
|
this, &MediaPlayer2Player::playerCanGoNextChanged);
|
||||||
|
connect(m_audioPlayer, &AudioManager::canSkipBackwardChanged,
|
||||||
|
this, &MediaPlayer2Player::playerCanGoPreviousChanged);
|
||||||
|
connect(m_audioPlayer, &AudioManager::canPlayChanged,
|
||||||
|
this, &MediaPlayer2Player::playerCanPlayChanged);
|
||||||
|
connect(m_audioPlayer, &AudioManager::canPauseChanged,
|
||||||
|
this, &MediaPlayer2Player::playerCanPauseChanged);
|
||||||
|
connect(m_audioPlayer, &AudioManager::seekableChanged,
|
||||||
|
this, &MediaPlayer2Player::playerCanSeekChanged);
|
||||||
|
|
||||||
// signals needed for progress indicator on taskbar
|
// signals needed for progress indicator on taskbar
|
||||||
connect(m_audioPlayer, &AudioManager::durationChanged,
|
connect(m_audioPlayer, &AudioManager::durationChanged,
|
||||||
|
@ -289,6 +291,36 @@ void MediaPlayer2Player::playerVolumeChanged()
|
||||||
setVolume(m_audioPlayer->volume() / 100.0);
|
setVolume(m_audioPlayer->volume() / 100.0);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void MediaPlayer2Player::playerCanPlayChanged()
|
||||||
|
{
|
||||||
|
signalPropertiesChange(QStringLiteral("CanPlay"), CanPlay());
|
||||||
|
//Q_EMIT canPlayChanged();
|
||||||
|
}
|
||||||
|
|
||||||
|
void MediaPlayer2Player::playerCanPauseChanged()
|
||||||
|
{
|
||||||
|
signalPropertiesChange(QStringLiteral("CanPause"), CanPause());
|
||||||
|
//Q_EMIT canPauseChanged();
|
||||||
|
}
|
||||||
|
|
||||||
|
void MediaPlayer2Player::playerCanGoNextChanged()
|
||||||
|
{
|
||||||
|
signalPropertiesChange(QStringLiteral("CanGoNext"), CanGoNext());
|
||||||
|
//Q_EMIT canGoNextChanged();
|
||||||
|
}
|
||||||
|
|
||||||
|
void MediaPlayer2Player::playerCanGoPreviousChanged()
|
||||||
|
{
|
||||||
|
signalPropertiesChange(QStringLiteral("CanGoPrevious"), CanGoNext());
|
||||||
|
//Q_EMIT canGoPreviousChanged();
|
||||||
|
}
|
||||||
|
|
||||||
|
void MediaPlayer2Player::playerCanSeekChanged()
|
||||||
|
{
|
||||||
|
signalPropertiesChange(QStringLiteral("CanSeek"), CanSeek());
|
||||||
|
//Q_EMIT canSeekChanged();
|
||||||
|
}
|
||||||
|
|
||||||
void MediaPlayer2Player::setEntry(Entry* entry)
|
void MediaPlayer2Player::setEntry(Entry* entry)
|
||||||
{
|
{
|
||||||
if (m_audioPlayer) {
|
if (m_audioPlayer) {
|
||||||
|
|
|
@ -92,6 +92,11 @@ private Q_SLOTS:
|
||||||
void playerPlaybackStateChanged();
|
void playerPlaybackStateChanged();
|
||||||
void playerSeeked(qint64 position);
|
void playerSeeked(qint64 position);
|
||||||
void playerVolumeChanged();
|
void playerVolumeChanged();
|
||||||
|
void playerCanGoNextChanged();
|
||||||
|
void playerCanGoPreviousChanged();
|
||||||
|
void playerCanPlayChanged();
|
||||||
|
void playerCanPauseChanged();
|
||||||
|
void playerCanSeekChanged();
|
||||||
|
|
||||||
// progress on taskbar
|
// progress on taskbar
|
||||||
void audioPositionChanged();
|
void audioPositionChanged();
|
||||||
|
|
Loading…
Reference in New Issue