diff options
| author | trialuser02 <trialuser02@90c681e8-e032-0410-971d-27865f9a5e38> | 2009-11-12 22:00:02 +0000 |
|---|---|---|
| committer | trialuser02 <trialuser02@90c681e8-e032-0410-971d-27865f9a5e38> | 2009-11-12 22:00:02 +0000 |
| commit | 90d3aeb642ba4d6445932343010294a39b33efe2 (patch) | |
| tree | ea9380c8aa1c8086b2258a8c21e8bf6486fcc141 /src/plugins/General/mpris | |
| parent | e7115704de07fd7a4a474447b36ae2c9cc8a8f25 (diff) | |
| download | qmmp-90d3aeb642ba4d6445932343010294a39b33efe2.tar.gz qmmp-90d3aeb642ba4d6445932343010294a39b33efe2.tar.bz2 qmmp-90d3aeb642ba4d6445932343010294a39b33efe2.zip | |
added multiple playlists support
git-svn-id: http://svn.code.sf.net/p/qmmp-dev/code/trunk/qmmp@1363 90c681e8-e032-0410-971d-27865f9a5e38
Diffstat (limited to 'src/plugins/General/mpris')
| -rw-r--r-- | src/plugins/General/mpris/playerobject.cpp | 17 | ||||
| -rw-r--r-- | src/plugins/General/mpris/playerobject.h | 6 | ||||
| -rw-r--r-- | src/plugins/General/mpris/tracklistobject.cpp | 19 | ||||
| -rw-r--r-- | src/plugins/General/mpris/tracklistobject.h | 5 |
4 files changed, 30 insertions, 17 deletions
diff --git a/src/plugins/General/mpris/playerobject.cpp b/src/plugins/General/mpris/playerobject.cpp index 894b68617..d7166e964 100644 --- a/src/plugins/General/mpris/playerobject.cpp +++ b/src/plugins/General/mpris/playerobject.cpp @@ -1,5 +1,5 @@ /*************************************************************************** - * Copyright (C) 2008 by Ilya Kotov * + * Copyright (C) 2008-2009 by Ilya Kotov * * forkotov02@hotmail.ru * * * * This program is free software; you can redistribute it and/or modify * @@ -24,7 +24,7 @@ #include <qmmp/soundcore.h> #include <qmmp/metadatamanager.h> #include <qmmpui/mediaplayer.h> -#include <qmmpui/playlistmodel.h> +#include <qmmpui/playlistmanager.h> #include "playerobject.h" @@ -53,18 +53,17 @@ const QDBusArgument &operator >> (const QDBusArgument &arg, PlayerStatus &status return arg; } -PlayerObject::PlayerObject(QObject *parent) - : QObject(parent) +PlayerObject::PlayerObject(QObject *parent) : QObject(parent) { qDBusRegisterMetaType<PlayerStatus>(); m_core = SoundCore::instance(); m_player = MediaPlayer::instance(); - m_model = m_player->playListModel(); + m_pl_manager = m_player->playListManager(); 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())); - connect(m_model, SIGNAL(repeatableListChanged(bool)), SLOT(updateStatus())); - connect(m_model, SIGNAL(shuffleChanged(bool)), SLOT(updateStatus())); + connect(m_pl_manager, SIGNAL(repeatableListChanged(bool)), SLOT(updateStatus())); + connect(m_pl_manager, SIGNAL(shuffleChanged(bool)), SLOT(updateStatus())); connect(m_player, SIGNAL(repeatableChanged(bool)), SLOT(updateStatus())); } @@ -118,9 +117,9 @@ PlayerStatus PlayerObject::GetStatus() case Qmmp::Paused: st.state = 1; }; - st.random = int(m_model->isShuffle()); + st.random = int(m_pl_manager->isShuffle()); st.repeat = int(m_player->isRepeatable()); - st.repeatPlayList = int(m_model->isRepeatableList()); + st.repeatPlayList = int(m_pl_manager->isRepeatableList()); return st; } diff --git a/src/plugins/General/mpris/playerobject.h b/src/plugins/General/mpris/playerobject.h index dbd7e771c..709357387 100644 --- a/src/plugins/General/mpris/playerobject.h +++ b/src/plugins/General/mpris/playerobject.h @@ -1,5 +1,5 @@ /*************************************************************************** - * Copyright (C) 2008 by Ilya Kotov * + * Copyright (C) 2008-2009 by Ilya Kotov * * forkotov02@hotmail.ru * * * * This program is free software; you can redistribute it and/or modify * @@ -25,7 +25,7 @@ class SoundCore; class MediaPlayer; -class PlayListModel; +class PlayListManager; /** @author Ilya Kotov <forkotov02@hotmail.ru> @@ -94,7 +94,7 @@ private slots: private: SoundCore *m_core; MediaPlayer *m_player; - PlayListModel *m_model; + PlayListManager *m_pl_manager; }; diff --git a/src/plugins/General/mpris/tracklistobject.cpp b/src/plugins/General/mpris/tracklistobject.cpp index 6b3699a0c..3ca1830ba 100644 --- a/src/plugins/General/mpris/tracklistobject.cpp +++ b/src/plugins/General/mpris/tracklistobject.cpp @@ -21,18 +21,20 @@ #include <QFile> #include <QUrl> -#include <qmmpui/playlistmodel.h> +#include <qmmpui/playlistmanager.h> #include <qmmpui/mediaplayer.h> #include <qmmpui/playlistitem.h> #include "tracklistobject.h" -TrackListObject::TrackListObject(QObject *parent) - : QObject(parent) +TrackListObject::TrackListObject(QObject *parent) : QObject(parent) { m_player = MediaPlayer::instance(); - m_model = m_player->playListModel(); + m_pl_manager = m_player->playListManager(); + m_model = m_pl_manager->currentPlayList(); connect (m_model, SIGNAL(listChanged()), SLOT(updateTrackList())); + connect (m_pl_manager, SIGNAL(currentPlayListChanged(PlayListModel*,PlayListModel*)), + SLOT(switchPlayList(PlayListModel*,PlayListModel*))); } @@ -111,3 +113,12 @@ void TrackListObject::updateTrackList() { emit TrackListChange(m_model->count()); } + +void TrackListObject::switchPlayList(PlayListModel *cur, PlayListModel *prev) +{ + m_model = cur; + connect (m_model, SIGNAL(listChanged()), SLOT(updateTrackList())); + if(prev) + disconnect(prev,0,this,0); + updateTrackList(); +} diff --git a/src/plugins/General/mpris/tracklistobject.h b/src/plugins/General/mpris/tracklistobject.h index 856ebd5df..0004f25b9 100644 --- a/src/plugins/General/mpris/tracklistobject.h +++ b/src/plugins/General/mpris/tracklistobject.h @@ -1,5 +1,5 @@ /*************************************************************************** - * Copyright (C) 2008 by Ilya Kotov * + * Copyright (C) 2008-2009 by Ilya Kotov * * forkotov02@hotmail.ru * * * * This program is free software; you can redistribute it and/or modify * @@ -25,6 +25,7 @@ #include <QVariantMap> class PlayListModel; +class PlayListManager; class MediaPlayer; /** @@ -54,9 +55,11 @@ signals: private slots: void updateTrackList(); + void switchPlayList(PlayListModel *cur, PlayListModel *prev); private: PlayListModel *m_model; + PlayListManager *m_pl_manager; MediaPlayer *m_player; }; |
