diff options
| -rw-r--r-- | src/plugins/General/mpris/mpris.cpp | 13 | ||||
| -rw-r--r-- | src/plugins/General/mpris/mpris.h | 16 | ||||
| -rw-r--r-- | src/plugins/General/mpris/playerobject.cpp | 9 | ||||
| -rw-r--r-- | src/plugins/General/mpris/playerobject.h | 2 | ||||
| -rw-r--r-- | src/plugins/General/mpris/tracklistobject.cpp | 10 | ||||
| -rw-r--r-- | src/plugins/General/mpris/tracklistobject.h | 4 | ||||
| -rw-r--r-- | src/qmmpui/playlistmodel.cpp | 12 | ||||
| -rw-r--r-- | src/qmmpui/playlistmodel.h | 10 | ||||
| -rw-r--r-- | src/ui/display.cpp | 5 | ||||
| -rw-r--r-- | src/ui/togglebutton.h | 2 |
10 files changed, 43 insertions, 40 deletions
diff --git a/src/plugins/General/mpris/mpris.cpp b/src/plugins/General/mpris/mpris.cpp index 40c43cf73..4c6474311 100644 --- a/src/plugins/General/mpris/mpris.cpp +++ b/src/plugins/General/mpris/mpris.cpp @@ -36,10 +36,6 @@ MPRIS::MPRIS(QObject *parent) connection.registerObject("/Player", player, QDBusConnection::ExportAllContents); connection.registerObject("/", root, QDBusConnection::ExportAllContents); connection.registerService("org.mpris.qmmp"); - m_left = 0; - m_right = 0; - m_time = 0; - //m_state = General::Stopped; } @@ -47,13 +43,4 @@ MPRIS::~MPRIS() { } -int MPRIS::leftVolume() -{ - return m_left; -} - -int MPRIS::rightVolume() -{ - return m_right; -} diff --git a/src/plugins/General/mpris/mpris.h b/src/plugins/General/mpris/mpris.h index 8b90d2881..370809da7 100644 --- a/src/plugins/General/mpris/mpris.h +++ b/src/plugins/General/mpris/mpris.h @@ -36,22 +36,6 @@ public: MPRIS(QObject *parent = 0); ~MPRIS(); - -signals: - void stateChanged(); - void timeChanged(); - void volumeChanged(); - void songChanged(); - -public slots: - int leftVolume(); - int rightVolume(); - -private: - DBUSAdaptor *m_adaptor; - int m_left, m_right; - uint m_state; - int m_time; }; #endif diff --git a/src/plugins/General/mpris/playerobject.cpp b/src/plugins/General/mpris/playerobject.cpp index 4e3cc1a10..3c9d374d1 100644 --- a/src/plugins/General/mpris/playerobject.cpp +++ b/src/plugins/General/mpris/playerobject.cpp @@ -58,9 +58,12 @@ PlayerObject::PlayerObject(QObject *parent) qDBusRegisterMetaType<PlayerStatus>(); m_core = SoundCore::instance(); m_player = MediaPlayer::instance(); + m_model = m_player->playListModel(); 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())); } PlayerObject::~PlayerObject() @@ -108,9 +111,9 @@ PlayerStatus PlayerObject::GetStatus() case Qmmp::Paused: st.state = 1; }; - st.random = 0; //TODO playlist support - st.repeat = 0; - st.repeatPlayList = 0; + st.random = int(m_model->isShuffle()); + st.repeat = 0; //TODO add suppot for this + 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 1335b1138..ea8cbe1c1 100644 --- a/src/plugins/General/mpris/playerobject.h +++ b/src/plugins/General/mpris/playerobject.h @@ -25,6 +25,7 @@ class SoundCore; class MediaPlayer; +class PlayListModel; /** @author Ilya Kotov <forkotov02@hotmail.ru> @@ -93,6 +94,7 @@ private slots: private: SoundCore *m_core; MediaPlayer *m_player; + PlayListModel *m_model; }; diff --git a/src/plugins/General/mpris/tracklistobject.cpp b/src/plugins/General/mpris/tracklistobject.cpp index ba8e2c1ba..dfce2d8af 100644 --- a/src/plugins/General/mpris/tracklistobject.cpp +++ b/src/plugins/General/mpris/tracklistobject.cpp @@ -82,6 +82,16 @@ QVariantMap TrackListObject::GetMetadata(int in0) return map; } +void TrackListObject::SetLoop(bool in0) +{ + m_model->prepareForRepeatablePlaying(in0); +} + +void TrackListObject::SetRandom(bool in0) +{ + m_model->prepareForShufflePlaying(in0); +} + void TrackListObject::updateTrackList() { emit TrackListChange(m_model->count()); diff --git a/src/plugins/General/mpris/tracklistobject.h b/src/plugins/General/mpris/tracklistobject.h index 736ef1f2b..c1ff169b1 100644 --- a/src/plugins/General/mpris/tracklistobject.h +++ b/src/plugins/General/mpris/tracklistobject.h @@ -46,8 +46,8 @@ public slots: int GetCurrentTrack(); int GetLength(); QVariantMap GetMetadata(int in0); - /*void SetLoop(bool in0); - void SetRandom(bool in0);*/ + void SetLoop(bool in0); + void SetRandom(bool in0); signals: void TrackListChange(int in0); diff --git a/src/qmmpui/playlistmodel.cpp b/src/qmmpui/playlistmodel.cpp index 97d18e156..812ae51b2 100644 --- a/src/qmmpui/playlistmodel.cpp +++ b/src/qmmpui/playlistmodel.cpp @@ -826,11 +826,13 @@ void PlayListModel::prepareForShufflePlaying(bool val) else m_play_state = new NormalPlayState(this); + emit shuffleChanged(val); } void PlayListModel::prepareForRepeatablePlaying(bool val) { is_repeatable_list = val; + emit repeatableListChanged(val); } void PlayListModel::doCurrentVisibleRequest() @@ -895,6 +897,16 @@ void PlayListModel::savePlaylist(const QString & f_name) } } +bool PlayListModel::isRepeatableList() const +{ + return is_repeatable_list; +} + +bool PlayListModel::isShuffle() const +{ + return FALSE; //TODO fix this +} + bool PlayListModel::isFileLoaderRunning() const { foreach(FileLoader* l,m_running_loaders) diff --git a/src/qmmpui/playlistmodel.h b/src/qmmpui/playlistmodel.h index 04665b88c..c0a4e1168 100644 --- a/src/qmmpui/playlistmodel.h +++ b/src/qmmpui/playlistmodel.h @@ -116,11 +116,6 @@ public: */ bool isQueued(PlayListItem* item) const; - bool isRepeatableList()const - { - return is_repeatable_list; - } - /*! * Sets current song to the file that is nex in queue, if queue is empty - does nothing */ @@ -187,6 +182,9 @@ public: */ void savePlaylist(const QString& f_name); + bool isRepeatableList() const; + bool isShuffle() const; + /*! * Enum of available sort modes */ @@ -199,6 +197,8 @@ signals: void listChanged(); void currentChanged(); void firstAdded(); + void repeatableListChanged(bool); + void shuffleChanged(bool); public slots: void load(PlayListItem *); diff --git a/src/ui/display.cpp b/src/ui/display.cpp index 74c946fd3..13a85989e 100644 --- a/src/ui/display.cpp +++ b/src/ui/display.cpp @@ -26,6 +26,8 @@ #include <qmmp/output.h> #include <qmmp/soundcore.h> +#include <qmmpui/mediaplayer.h> +#include <qmmpui/playlistmodel.h> #include "skin.h" #include "mainvisual.h" #include "button.h" @@ -146,6 +148,9 @@ MainDisplay::MainDisplay (QWidget *parent) connect(m_core, SIGNAL(channelsChanged(int)), m_monoster, SLOT(setChannels(int))); connect(m_core, SIGNAL(stateChanged(Qmmp::State)), SLOT(setState(Qmmp::State))); connect(m_core, SIGNAL(volumeChanged(int,int)), SLOT(setVolume(int, int))); + PlayListModel *model = MediaPlayer::instance()->playListModel(); + connect(model, SIGNAL(repeatableListChanged(bool)), m_repeatButton, SLOT(setON(bool))); + connect(model, SIGNAL(shuffleChanged(bool)), m_shuffleButton, SLOT(setON(bool))); } diff --git a/src/ui/togglebutton.h b/src/ui/togglebutton.h index a15d7476f..0071e0321 100644 --- a/src/ui/togglebutton.h +++ b/src/ui/togglebutton.h @@ -36,12 +36,12 @@ public: ~ToggleButton(); bool isChecked(); - void setON(bool); signals: void clicked(bool); public slots: + void setON(bool); void click(); private slots: |
