From f8dc612c13b1924a19a6f98a93e58e7430e08a34 Mon Sep 17 00:00:00 2001 From: Jonne Lehtinen Date: Sat, 27 May 2006 19:49:25 +0300 Subject: [PATCH] OTHER: Use correct types for dict gets and use Xmms::List for playlistList signal. --- MainDisplay.cpp | 8 ++++---- PlaylistList.cpp | 16 ++++++++-------- PlaylistList.h | 2 +- XMMSHandler.cpp | 9 +++------ XMMSHandler.h | 2 +- 5 files changed, 17 insertions(+), 20 deletions(-) diff --git a/MainDisplay.cpp b/MainDisplay.cpp index 062734c..8f1e79e 100644 --- a/MainDisplay.cpp +++ b/MainDisplay.cpp @@ -138,19 +138,19 @@ MainDisplay::setMediainfo (const Xmms::PropDict &info) } m_text->setText (n); - m_kbps->setNumber (info.get ("bitrate")/1000, 3); + m_kbps->setNumber (info.get ("bitrate")/1000, 3); if (info.contains ("samplerate")) { - m_khz->setNumber (info.get ("samplerate")/1000, 2); + m_khz->setNumber (info.get ("samplerate")/1000, 2); } else { m_khz->setNumber(0, 1); } if (info.contains ("channels:in") && - info.get ("channels:in") > 1) { + info.get ("channels:in") > 1) { m_stereo->setStereoMono (1, 0); } else { m_stereo->setStereoMono (0, 1); } - m_slider->setMax (info.get ("duration")); + m_slider->setMax (info.get ("duration")); m_slider->hideBar (false); } diff --git a/PlaylistList.cpp b/PlaylistList.cpp index 6670689..cdef22c 100644 --- a/PlaylistList.cpp +++ b/PlaylistList.cpp @@ -75,8 +75,8 @@ PlaylistList::PlaylistList (QWidget *parent) : QWidget (parent) m_status = XMMS_PLAYBACK_STATUS_STOP; m_bar = -2; - connect (&xmmsh, SIGNAL(playlistList(const QList &)), - this, SLOT(playlistList(const QList &))); + connect (&xmmsh, SIGNAL(playlistList(const Xmms::List< unsigned int > &)), + this, SLOT(playlistList(const Xmms::List< unsigned int > &))); connect (&xmmsh, SIGNAL(currentID(uint)), this, SLOT(currentID(uint))); @@ -234,7 +234,7 @@ PlaylistList::mediainfoChanged (uint id, const Xmms::PropDict &info) i->setText (n); if (info.contains ("duration")) { - unsigned int duration = info.get ("duration"); + unsigned int duration = info.get ("duration"); QString dur; dur.sprintf ("%02d:%02d", duration/60000, (duration/1000)%60); i->setDuration (dur); @@ -246,13 +246,13 @@ PlaylistList::mediainfoChanged (uint id, const Xmms::PropDict &info) } void -PlaylistList::playlistList (const QList &l) +PlaylistList::playlistList (const Xmms::List< unsigned int > &list) { - for (int i = 0; i < l.count(); i++) { - if (m_itemmap->contains (l.value(i))) { - addItem (m_itemmap->value (l.value (i))); + for (list.first (); list.isValid (); ++list) { + if (m_itemmap->contains (*list)) { + addItem (m_itemmap->value (*list)); } else { - new PlaylistItem (this, l.value(i)); + new PlaylistItem (this, *list); } } diff --git a/PlaylistList.h b/PlaylistList.h index 8612c80..6ec0e71 100644 --- a/PlaylistList.h +++ b/PlaylistList.h @@ -26,7 +26,7 @@ class PlaylistList : public QWidget { public slots: void setPixmaps (Skin *skin); - void playlistList (const QList &); + void playlistList (const Xmms::List< unsigned int > &); void mediainfoChanged (uint, const Xmms::PropDict &); void playlistChanged (const Xmms::Dict &); void currentID (uint); diff --git a/XMMSHandler.cpp b/XMMSHandler.cpp index db0b3a0..c1b183c 100644 --- a/XMMSHandler.cpp +++ b/XMMSHandler.cpp @@ -5,6 +5,7 @@ #include #include +#include #include #include @@ -131,11 +132,7 @@ XMMSHandler::requestTrackChange (int pos) bool XMMSHandler::playlist_list (const Xmms::List< unsigned int > &playlist) { - QList list; - for (;playlist.isValid (); ++playlist) { - list.append (*playlist); - } - emit playlistList (list); + emit playlistList (playlist); return false; } @@ -241,7 +238,7 @@ XMMSHandler::playlist_changed (const Xmms::Dict &list) bool XMMSHandler::medialib_info (const Xmms::PropDict &propdict) { - unsigned int id = propdict.get("id"); + unsigned int id = propdict.get("id"); emit mediainfoChanged (id, propdict); if (id == m_currentid) { diff --git a/XMMSHandler.h b/XMMSHandler.h index d3ff7d9..08cad06 100644 --- a/XMMSHandler.h +++ b/XMMSHandler.h @@ -67,7 +67,7 @@ class XMMSHandler : public QObject { void playtimeChanged (uint time); void mediainfoChanged (uint, const Xmms::PropDict &); void currentSong (const Xmms::PropDict &); - void playlistList (const QList &); + void playlistList (const Xmms::List< unsigned int > &); void currentID (uint); void playlistChanged (const Xmms::Dict &); /*