aboutsummaryrefslogtreecommitdiff
path: root/src/plugins/General/mpris
diff options
context:
space:
mode:
authortrialuser02 <trialuser02@90c681e8-e032-0410-971d-27865f9a5e38>2008-12-23 21:13:34 +0000
committertrialuser02 <trialuser02@90c681e8-e032-0410-971d-27865f9a5e38>2008-12-23 21:13:34 +0000
commitfedd13511bbf91914a0250b43c440f43e6d1e8c5 (patch)
tree03cca77aab98ce8c8c2b261f345655d64ae8e172 /src/plugins/General/mpris
parentac7a7dffc31afe8a20a51db4ab7749bf4fdea67c (diff)
downloadqmmp-fedd13511bbf91914a0250b43c440f43e6d1e8c5.tar.gz
qmmp-fedd13511bbf91914a0250b43c440f43e6d1e8c5.tar.bz2
qmmp-fedd13511bbf91914a0250b43c440f43e6d1e8c5.zip
full mpris support; new options: "repeat track", "show protocol"
git-svn-id: http://svn.code.sf.net/p/qmmp-dev/code/trunk/qmmp@698 90c681e8-e032-0410-971d-27865f9a5e38
Diffstat (limited to 'src/plugins/General/mpris')
-rw-r--r--src/plugins/General/mpris/playerobject.cpp8
-rw-r--r--src/plugins/General/mpris/playerobject.h2
-rw-r--r--src/plugins/General/mpris/tracklistobject.cpp23
-rw-r--r--src/plugins/General/mpris/tracklistobject.h4
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);