diff options
| author | trialuser02 <trialuser02@90c681e8-e032-0410-971d-27865f9a5e38> | 2008-12-14 14:39:02 +0000 |
|---|---|---|
| committer | trialuser02 <trialuser02@90c681e8-e032-0410-971d-27865f9a5e38> | 2008-12-14 14:39:02 +0000 |
| commit | 7f928395e907e0095e44da0a0998347dd689205f (patch) | |
| tree | 6f1703dd0fea4ccc52484cedb59e7108c74970d6 | |
| parent | fc9caa4c02a9b0a2f2dea075f8dad80d4c4d2797 (diff) | |
| download | qmmp-7f928395e907e0095e44da0a0998347dd689205f.tar.gz qmmp-7f928395e907e0095e44da0a0998347dd689205f.tar.bz2 qmmp-7f928395e907e0095e44da0a0998347dd689205f.zip | |
better mpris support
git-svn-id: http://svn.code.sf.net/p/qmmp-dev/code/trunk/qmmp@683 90c681e8-e032-0410-971d-27865f9a5e38
| -rw-r--r-- | src/plugins/General/mpris/playerobject.cpp | 16 | ||||
| -rw-r--r-- | src/plugins/General/mpris/playerobject.h | 2 | ||||
| -rw-r--r-- | src/qmmpui/mediaplayer.cpp | 5 | ||||
| -rw-r--r-- | src/qmmpui/mediaplayer.h | 1 |
4 files changed, 18 insertions, 6 deletions
diff --git a/src/plugins/General/mpris/playerobject.cpp b/src/plugins/General/mpris/playerobject.cpp index 6a4aeb025..8175df301 100644 --- a/src/plugins/General/mpris/playerobject.cpp +++ b/src/plugins/General/mpris/playerobject.cpp @@ -22,6 +22,8 @@ #include <QDBusMetaType> #include <QDBusArgument> #include <qmmp/soundcore.h> +#include <qmmpui/mediaplayer.h> +#include <qmmpui/playlistmodel.h> #include "playerobject.h" @@ -55,6 +57,7 @@ PlayerObject::PlayerObject(QObject *parent) { qDBusRegisterMetaType<PlayerStatus>(); m_core = SoundCore::instance(); + m_player = MediaPlayer::instance(); connect(m_core, SIGNAL(stateChanged (Qmmp::State)), SLOT(updateCaps())); connect(m_core, SIGNAL(metaDataChanged ()), SLOT(updateTrack())); connect(m_core, SIGNAL(stateChanged (Qmmp::State)), SLOT(updateStatus())); @@ -65,12 +68,12 @@ PlayerObject::~PlayerObject() void PlayerObject::Next() { - + m_player->next(); } void PlayerObject::Prev() { - + m_player->previous(); } void PlayerObject::Pause() @@ -80,12 +83,12 @@ void PlayerObject::Pause() void PlayerObject::Stop() { - m_core->stop(); + m_player->stop(); } void PlayerObject::Play() { - QMetaObject::invokeMethod(parent(), "play"); + m_player->play(); } PlayerStatus PlayerObject::GetStatus() @@ -140,9 +143,10 @@ int PlayerObject::GetCaps() caps |= CAN_PAUSE; else caps |= CAN_PLAY; - if (GetStatus().state < 2) + if ((GetStatus().state < 2) && (m_core->length() > 0)) caps |= CAN_SEEK; - caps |= CAN_PROVIDE_METADATA; + caps |= CAN_GO_NEXT; + caps |= CAN_GO_PREV; return caps; } diff --git a/src/plugins/General/mpris/playerobject.h b/src/plugins/General/mpris/playerobject.h index 0f60c85c9..1335b1138 100644 --- a/src/plugins/General/mpris/playerobject.h +++ b/src/plugins/General/mpris/playerobject.h @@ -24,6 +24,7 @@ #include <QVariantMap> class SoundCore; +class MediaPlayer; /** @author Ilya Kotov <forkotov02@hotmail.ru> @@ -91,6 +92,7 @@ private slots: private: SoundCore *m_core; + MediaPlayer *m_player; }; diff --git a/src/qmmpui/mediaplayer.cpp b/src/qmmpui/mediaplayer.cpp index d317473e8..311b195b9 100644 --- a/src/qmmpui/mediaplayer.cpp +++ b/src/qmmpui/mediaplayer.cpp @@ -56,6 +56,11 @@ void MediaPlayer::initialize(SoundCore *core, PlayListModel *model) connect(m_core, SIGNAL(finished()), SLOT(next())); } +PlayListModel *MediaPlayer::playListModel() +{ + return m_model; +} + void MediaPlayer::play() { m_model->doCurrentVisibleRequest(); diff --git a/src/qmmpui/mediaplayer.h b/src/qmmpui/mediaplayer.h index f1717360b..fefc42978 100644 --- a/src/qmmpui/mediaplayer.h +++ b/src/qmmpui/mediaplayer.h @@ -39,6 +39,7 @@ public: static MediaPlayer* instance(); void initialize(SoundCore *core, PlayListModel *model); + PlayListModel *playListModel(); public slots: void play(); |
