diff options
Diffstat (limited to 'src/plugins')
| -rw-r--r-- | src/plugins/General/mpris/playerobject.cpp | 8 | ||||
| -rw-r--r-- | src/plugins/General/mpris/playerobject.h | 2 | ||||
| -rw-r--r-- | src/plugins/General/mpris/tracklistobject.cpp | 23 | ||||
| -rw-r--r-- | src/plugins/General/mpris/tracklistobject.h | 4 |
4 files changed, 29 insertions, 8 deletions
diff --git a/src/plugins/General/mpris/playerobject.cpp b/src/plugins/General/mpris/playerobject.cpp index 3c9d374d1..160d32e56 100644 --- a/src/plugins/General/mpris/playerobject.cpp +++ b/src/plugins/General/mpris/playerobject.cpp @@ -64,6 +64,7 @@ PlayerObject::PlayerObject(QObject *parent) connect(m_core, SIGNAL(stateChanged (Qmmp::State)), SLOT(updateStatus())); connect(m_model, SIGNAL(repeatableListChanged(bool)), SLOT(updateStatus())); connect(m_model, SIGNAL(shuffleChanged(bool)), SLOT(updateStatus())); + connect(m_player, SIGNAL(repeatableChanged(bool)), SLOT(updateStatus())); } PlayerObject::~PlayerObject() @@ -94,6 +95,11 @@ void PlayerObject::Play() m_player->play(); } +void PlayerObject::Repeat(bool in0) +{ + m_player->setRepeatable(in0); +} + PlayerStatus PlayerObject::GetStatus() { PlayerStatus st; @@ -112,7 +118,7 @@ PlayerStatus PlayerObject::GetStatus() st.state = 1; }; st.random = int(m_model->isShuffle()); - st.repeat = 0; //TODO add suppot for this + st.repeat = int(m_player->isRepeatable()); st.repeatPlayList = int(m_model->isRepeatableList()); return st; } diff --git a/src/plugins/General/mpris/playerobject.h b/src/plugins/General/mpris/playerobject.h index ea8cbe1c1..dbd7e771c 100644 --- a/src/plugins/General/mpris/playerobject.h +++ b/src/plugins/General/mpris/playerobject.h @@ -72,7 +72,7 @@ public slots: void Pause(); void Stop(); void Play(); - //void Repeat(); + void Repeat(bool in0); PlayerStatus GetStatus(); QVariantMap GetMetadata(); int GetCaps(); diff --git a/src/plugins/General/mpris/tracklistobject.cpp b/src/plugins/General/mpris/tracklistobject.cpp index dfce2d8af..6b3699a0c 100644 --- a/src/plugins/General/mpris/tracklistobject.cpp +++ b/src/plugins/General/mpris/tracklistobject.cpp @@ -19,6 +19,7 @@ ***************************************************************************/ #include <QFile> +#include <QUrl> #include <qmmpui/playlistmodel.h> #include <qmmpui/mediaplayer.h> @@ -39,15 +40,29 @@ TrackListObject::~TrackListObject() { } -/*int TrackListObject::AddTrack(const QString &in0, bool in1) +int TrackListObject::AddTrack(const QString &in0, bool in1) { - m_model->addFile(in0); + int old_count = m_model->count(); + if(in0.startsWith("file://")) + m_model->addFile(QUrl(in0).toLocalFile ()); //converts url to local file path + else + m_model->addFile(in0); + int new_count = m_model->count(); + if(new_count == old_count) + return 0; if(in1) { - m_model->set + m_model->setCurrent(new_count-1); + m_player->stop(); + m_player->play(); } return 1; -}*/ +} + +void TrackListObject::DelTrack(int in0) +{ + m_model->removeAt(in0); +} int TrackListObject::GetCurrentTrack() { diff --git a/src/plugins/General/mpris/tracklistobject.h b/src/plugins/General/mpris/tracklistobject.h index c1ff169b1..856ebd5df 100644 --- a/src/plugins/General/mpris/tracklistobject.h +++ b/src/plugins/General/mpris/tracklistobject.h @@ -41,8 +41,8 @@ public: ~TrackListObject(); public slots: - //int AddTrack(const QString &in0, bool in1); - /*void DelTrack(int in0);*/ + int AddTrack(const QString &in0, bool in1); + void DelTrack(int in0); int GetCurrentTrack(); int GetLength(); QVariantMap GetMetadata(int in0); |
