Working playlist in Promoe!
This commit is contained in:
parent
3ce3581d04
commit
9693e64dab
7 changed files with 256 additions and 35 deletions
|
@ -43,8 +43,8 @@ MainDisplay::MainDisplay (QWidget *parent) : SkinDisplay(parent)
|
||||||
m_playstatus = new PlayStatus (this);
|
m_playstatus = new PlayStatus (this);
|
||||||
m_playstatus->move (24, 28);
|
m_playstatus->move (24, 28);
|
||||||
|
|
||||||
connect (xmmsh, SIGNAL(mediainfoChanged(QString,int,int,int,int)),
|
connect (xmmsh, SIGNAL(currentSong (QHash<QString, QString>)),
|
||||||
this, SLOT(setMediainfo(QString,int,int,int,int)));
|
this, SLOT(setMediainfo (QHash<QString, QString>)));
|
||||||
connect (xmmsh, SIGNAL(playbackStatusChanged(uint)),
|
connect (xmmsh, SIGNAL(playbackStatusChanged(uint)),
|
||||||
this, SLOT(setStatus(uint)));
|
this, SLOT(setStatus(uint)));
|
||||||
connect (xmmsh, SIGNAL(playtimeChanged(uint)),
|
connect (xmmsh, SIGNAL(playtimeChanged(uint)),
|
||||||
|
@ -91,22 +91,27 @@ MainDisplay::setPlaytime (uint time)
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
MainDisplay::setMediainfo (QString str, int bitrate, int samplerate,
|
MainDisplay::setMediainfo (QHash<QString, QString> h)
|
||||||
int channels, int duration)
|
|
||||||
{
|
{
|
||||||
m_text->setText (str);
|
QString n;
|
||||||
m_kbps->setNumber (bitrate/1000, 3);
|
if (h.contains ("artist") && h.contains ("album") && h.contains ("title")) {
|
||||||
m_khz->setNumber (samplerate/1000, 2);
|
n = h.value("artist") + " - " + h.value("album") + " - " + h.value("title");
|
||||||
if (channels > 1) {
|
} else {
|
||||||
|
n = h.value("url");
|
||||||
|
}
|
||||||
|
m_text->setText (n);
|
||||||
|
|
||||||
|
m_kbps->setNumber (h.value("bitrate").toUInt()/1000, 3);
|
||||||
|
m_khz->setNumber (h.value("samplerate").toUInt()/1000, 2);
|
||||||
|
if (h.value("channels:in").toUInt() > 1) {
|
||||||
m_stereo->setStereoMono (1, 0);
|
m_stereo->setStereoMono (1, 0);
|
||||||
} else {
|
} else {
|
||||||
m_stereo->setStereoMono (0, 1);
|
m_stereo->setStereoMono (0, 1);
|
||||||
}
|
}
|
||||||
m_slider->setMax (duration);
|
m_slider->setMax (h.value("duration").toUInt());
|
||||||
m_slider->hideBar (false);
|
m_slider->hideBar (false);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void
|
void
|
||||||
MainDisplay::SetupToggleButtons (void)
|
MainDisplay::SetupToggleButtons (void)
|
||||||
{
|
{
|
||||||
|
|
|
@ -50,8 +50,7 @@ class MainDisplay : public SkinDisplay
|
||||||
void setPixmaps(Skin *skin);
|
void setPixmaps(Skin *skin);
|
||||||
void setStatus (uint status);
|
void setStatus (uint status);
|
||||||
void setPlaytime (uint time);
|
void setPlaytime (uint time);
|
||||||
void setMediainfo (QString str, int bitrate, int samplerate,
|
void setMediainfo (QHash<QString,QString>);
|
||||||
int channels, int duration);
|
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
void SetupPushButtons (void);
|
void SetupPushButtons (void);
|
||||||
|
|
|
@ -26,7 +26,6 @@ PlayStatus::setPixmaps (Skin *skin)
|
||||||
void
|
void
|
||||||
PlayStatus::setStatus (uint status)
|
PlayStatus::setStatus (uint status)
|
||||||
{
|
{
|
||||||
qDebug("funkar");
|
|
||||||
if (status == XMMS_PLAYBACK_STATUS_STOP) {
|
if (status == XMMS_PLAYBACK_STATUS_STOP) {
|
||||||
m_pixmap = m_pixmap_stop;
|
m_pixmap = m_pixmap_stop;
|
||||||
} else if (status == XMMS_PLAYBACK_STATUS_PLAY) {
|
} else if (status == XMMS_PLAYBACK_STATUS_PLAY) {
|
||||||
|
|
157
PlaylistList.cpp
157
PlaylistList.cpp
|
@ -1,3 +1,5 @@
|
||||||
|
#include "XMMSHandler.h"
|
||||||
|
|
||||||
#include "PlaylistList.h"
|
#include "PlaylistList.h"
|
||||||
#include "Playlist.h"
|
#include "Playlist.h"
|
||||||
|
|
||||||
|
@ -7,23 +9,146 @@ PlaylistItem::PlaylistItem (PlaylistList *pl, uint id)
|
||||||
{
|
{
|
||||||
m_pl = pl;
|
m_pl = pl;
|
||||||
m_id = id;
|
m_id = id;
|
||||||
|
m_isactive = false;
|
||||||
|
m_isselected = false;
|
||||||
|
m_req = false;
|
||||||
|
if (getSelected ()) {
|
||||||
|
qDebug ("trasigt!");
|
||||||
|
}
|
||||||
pl->addItem (this);
|
pl->addItem (this);
|
||||||
}
|
}
|
||||||
|
|
||||||
QString
|
QString
|
||||||
PlaylistItem::text (void)
|
PlaylistItem::text (void)
|
||||||
{
|
{
|
||||||
return QString::fromUtf8 ("Entry entry entry");
|
XMMSHandler *xmmsh = XMMSHandler::getInstance ();
|
||||||
|
|
||||||
|
if (m_text.count() < 1) {
|
||||||
|
|
||||||
|
if (!m_req) {
|
||||||
|
xmmsh->requestMediainfo (m_id);
|
||||||
|
m_req = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
QString q;
|
||||||
|
q.setNum (m_id);
|
||||||
|
return q;
|
||||||
|
} else {
|
||||||
|
m_req = false;
|
||||||
|
return m_text;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
PlaylistList::PlaylistList (QWidget *parent) : QWidget (parent)
|
PlaylistList::PlaylistList (QWidget *parent) : QWidget (parent)
|
||||||
{
|
{
|
||||||
|
XMMSHandler *xmmsh = XMMSHandler::getInstance ();
|
||||||
|
|
||||||
PlaylistWindow *pl = dynamic_cast<PlaylistWindow*>(window ());
|
PlaylistWindow *pl = dynamic_cast<PlaylistWindow*>(window ());
|
||||||
connect (pl->getSkin (), SIGNAL (skinChanged (Skin *)), this, SLOT (setPixmaps(Skin *)));
|
connect (pl->getSkin (), SIGNAL (skinChanged (Skin *)), this, SLOT (setPixmaps(Skin *)));
|
||||||
m_font = NULL;
|
m_font = NULL;
|
||||||
m_fontmetrics = NULL;
|
m_fontmetrics = NULL;
|
||||||
m_items = new QList<PlaylistItem *>;
|
m_items = new QList<PlaylistItem *>;
|
||||||
|
m_selected = new QList<uint>;
|
||||||
|
m_itemmap = new QHash<uint, PlaylistItem *>;
|
||||||
m_offset = 0;
|
m_offset = 0;
|
||||||
|
|
||||||
|
connect (xmmsh, SIGNAL(playlistList(QList<uint>)), this, SLOT(playlistList(QList<uint>)));
|
||||||
|
connect (xmmsh, SIGNAL(currentID(uint)), this, SLOT(currentID(uint)));
|
||||||
|
connect (xmmsh, SIGNAL(mediainfoChanged(uint, QHash<QString, QString>)),
|
||||||
|
this, SLOT(mediainfoChanged(uint, QHash<QString, QString>)));
|
||||||
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
PlaylistList::currentID (uint id)
|
||||||
|
{
|
||||||
|
PlaylistItem *i = m_itemmap->value (id);
|
||||||
|
if (!i) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
i->setActive (true);
|
||||||
|
|
||||||
|
i = m_itemmap->value (m_active);
|
||||||
|
if (!i) {
|
||||||
|
update ();
|
||||||
|
m_active = id;
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
i->setActive (false);
|
||||||
|
|
||||||
|
m_active = id;
|
||||||
|
update ();
|
||||||
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
PlaylistList::mediainfoChanged (uint id, QHash<QString, QString> h)
|
||||||
|
{
|
||||||
|
PlaylistItem *i = m_itemmap->value (id);
|
||||||
|
if (i) {
|
||||||
|
QString n;
|
||||||
|
if (h.contains ("artist") && h.contains ("album") && h.contains ("title")) {
|
||||||
|
n = h.value("artist") + " - " + h.value("album") + " - " + h.value("title");
|
||||||
|
} else {
|
||||||
|
n = h.value("url");
|
||||||
|
}
|
||||||
|
i->setText (n);
|
||||||
|
}
|
||||||
|
|
||||||
|
update ();
|
||||||
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
PlaylistList::playlistList (QList<uint> l)
|
||||||
|
{
|
||||||
|
for (int i = 0; i < l.count(); i++) {
|
||||||
|
new PlaylistItem (this, l.value(i));
|
||||||
|
}
|
||||||
|
|
||||||
|
update ();
|
||||||
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
PlaylistList::mousePressEvent (QMouseEvent *event)
|
||||||
|
{
|
||||||
|
if (m_items->count() < 1) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
int i = ((event->pos().y()+m_offset) / getFontH());
|
||||||
|
if (i < 0) {
|
||||||
|
i = 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (event->modifiers() & Qt::ShiftModifier) {
|
||||||
|
if (m_selected->count () > 0) {
|
||||||
|
int o = m_selected->last ();
|
||||||
|
if (o < i) {
|
||||||
|
for (int y = o; y <= i; y++) {
|
||||||
|
m_selected->append (y);
|
||||||
|
m_items->value(y)->setSelected (true);
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
for (int y = i; y <= o; y++) {
|
||||||
|
m_selected->append (y);
|
||||||
|
m_items->value(y)->setSelected (true);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
m_selected->append (i);
|
||||||
|
m_items->value(i)->setSelected (true);
|
||||||
|
}
|
||||||
|
} else if (event->modifiers () & Qt::ControlModifier) {
|
||||||
|
m_items->value(i)->setSelected (true);
|
||||||
|
m_selected->append (i);
|
||||||
|
} else {
|
||||||
|
for (int y = 0; y < m_selected->count(); y++) {
|
||||||
|
m_items->value(m_selected->value(y))->setSelected (false);
|
||||||
|
}
|
||||||
|
m_selected->clear();
|
||||||
|
|
||||||
|
m_items->value(i)->setSelected (true);
|
||||||
|
m_selected->append(i);
|
||||||
|
}
|
||||||
|
|
||||||
|
update ();
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
|
@ -34,6 +159,7 @@ PlaylistList::paintEvent (QPaintEvent *event)
|
||||||
paint.begin (this);
|
paint.begin (this);
|
||||||
paint.setFont (*m_font);
|
paint.setFont (*m_font);
|
||||||
paint.setClipping (false);
|
paint.setClipping (false);
|
||||||
|
paint.setPen (QPen (m_color_normal));
|
||||||
|
|
||||||
int cy = event->rect().y () + m_offset;
|
int cy = event->rect().y () + m_offset;
|
||||||
int ch = event->rect().height();
|
int ch = event->rect().height();
|
||||||
|
@ -46,11 +172,25 @@ PlaylistList::paintEvent (QPaintEvent *event)
|
||||||
for (i = sitem; i < eitem; i++) {
|
for (i = sitem; i < eitem; i++) {
|
||||||
QRect r (3, getFontH()*(i-sitem), size().width(), getFontH());
|
QRect r (3, getFontH()*(i-sitem), size().width(), getFontH());
|
||||||
if (event->region().contains (r)) {
|
if (event->region().contains (r)) {
|
||||||
|
PlaylistItem *item = m_items->value (i);
|
||||||
QString q;
|
QString q;
|
||||||
q.sprintf ("%d. ", i+1);
|
q.sprintf ("%d. ", i+1);
|
||||||
q += m_items->value(i)->text ();
|
q += item->text ();
|
||||||
paint.eraseRect (r);
|
|
||||||
paint.drawText (r, q);
|
if (item->getSelected ()) {
|
||||||
|
paint.fillRect (r, QBrush (m_color_selected));
|
||||||
|
} else {
|
||||||
|
paint.eraseRect (r);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (item->getActive ()) {
|
||||||
|
paint.setPen (QPen (m_color_active));
|
||||||
|
paint.drawText (r, q);
|
||||||
|
paint.setPen (QPen (m_color_normal));
|
||||||
|
} else {
|
||||||
|
paint.drawText (r, q);
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -67,6 +207,7 @@ void
|
||||||
PlaylistList::addItem (PlaylistItem *i)
|
PlaylistList::addItem (PlaylistItem *i)
|
||||||
{
|
{
|
||||||
m_items->append (i);
|
m_items->append (i);
|
||||||
|
m_itemmap->insert (i->getID(), i);
|
||||||
if (m_items->count()*getFontH () > size().height()) {
|
if (m_items->count()*getFontH () > size().height()) {
|
||||||
resize (size().width(), m_items->count ()*getFontH ());
|
resize (size().width(), m_items->count ()*getFontH ());
|
||||||
}
|
}
|
||||||
|
@ -102,10 +243,11 @@ PlaylistList::setPixmaps (Skin *skin)
|
||||||
}
|
}
|
||||||
m_fontmetrics = new QFontMetrics (*m_font);
|
m_fontmetrics = new QFontMetrics (*m_font);
|
||||||
|
|
||||||
for (int i = 0; i < 100; i++) {
|
m_color_active.setNamedColor (skin->getPLeditValue ("current"));
|
||||||
PlaylistItem (this, i);
|
m_color_selected.setNamedColor (skin->getPLeditValue ("selectedbg"));
|
||||||
}
|
m_color_normal.setNamedColor (skin->getPLeditValue ("normal"));
|
||||||
|
|
||||||
|
update ();
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
|
@ -123,6 +265,7 @@ PlaylistList::setSize (int width, int height)
|
||||||
ny = size().height();
|
ny = size().height();
|
||||||
}
|
}
|
||||||
resize (nx, ny);
|
resize (nx, ny);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -3,6 +3,7 @@
|
||||||
|
|
||||||
#include "Skin.h"
|
#include "Skin.h"
|
||||||
#include <QWidget>
|
#include <QWidget>
|
||||||
|
#include <QHash>
|
||||||
|
|
||||||
class PlaylistItem;
|
class PlaylistItem;
|
||||||
|
|
||||||
|
@ -19,15 +20,28 @@ class PlaylistList : public QWidget {
|
||||||
|
|
||||||
public slots:
|
public slots:
|
||||||
void setPixmaps (Skin *skin);
|
void setPixmaps (Skin *skin);
|
||||||
|
void playlistList (QList<uint>);
|
||||||
|
void mediainfoChanged (uint, QHash<QString,QString>);
|
||||||
|
void currentID (uint);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
void paintEvent (QPaintEvent *event);
|
void paintEvent (QPaintEvent *event);
|
||||||
|
void mousePressEvent (QMouseEvent *event);
|
||||||
|
void mouseMoveEvent (QMouseEvent *event) {}
|
||||||
|
|
||||||
QList<PlaylistItem*> *m_items;
|
QList<PlaylistItem*> *m_items;
|
||||||
|
QList<uint> *m_selected;
|
||||||
|
QHash<uint,PlaylistItem*> *m_itemmap;
|
||||||
|
|
||||||
QFont *m_font;
|
QFont *m_font;
|
||||||
QFontMetrics *m_fontmetrics;
|
QFontMetrics *m_fontmetrics;
|
||||||
|
QColor m_color_active;
|
||||||
|
QColor m_color_selected;
|
||||||
|
QColor m_color_normal;
|
||||||
|
|
||||||
int getFontH (void);
|
int getFontH (void);
|
||||||
int m_offset;
|
int m_offset;
|
||||||
|
int m_active;
|
||||||
};
|
};
|
||||||
|
|
||||||
class PlaylistItem {
|
class PlaylistItem {
|
||||||
|
@ -37,9 +51,24 @@ class PlaylistItem {
|
||||||
|
|
||||||
QString text (void);
|
QString text (void);
|
||||||
|
|
||||||
|
void setActive (bool b) { m_isactive = b; }
|
||||||
|
bool getActive (void) { return m_isactive; }
|
||||||
|
|
||||||
|
void setSelected (bool b) { m_isselected = b; }
|
||||||
|
bool getSelected (void) { return m_isselected; }
|
||||||
|
|
||||||
|
uint getID (void) { return m_id; }
|
||||||
|
|
||||||
|
void setText (QString s) { m_text = s; }
|
||||||
|
|
||||||
private:
|
private:
|
||||||
uint m_id;
|
uint m_id;
|
||||||
PlaylistList *m_pl;
|
PlaylistList *m_pl;
|
||||||
|
|
||||||
|
bool m_isactive;
|
||||||
|
bool m_isselected;
|
||||||
|
bool m_req;
|
||||||
|
QString m_text;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -4,6 +4,7 @@
|
||||||
#include "XMMSHandler.h"
|
#include "XMMSHandler.h"
|
||||||
|
|
||||||
#include <QErrorMessage>
|
#include <QErrorMessage>
|
||||||
|
#include <QHash>
|
||||||
|
|
||||||
XMMSHandler *XMMSHandler::singleton = NULL;
|
XMMSHandler *XMMSHandler::singleton = NULL;
|
||||||
|
|
||||||
|
@ -28,6 +29,9 @@ XMMSHandler::XMMSHandler (void) : sigc::trackable ()
|
||||||
}
|
}
|
||||||
m_qt4 = new XmmsQT4 (m_xmmsc->getConn (), qApp);
|
m_qt4 = new XmmsQT4 (m_xmmsc->getConn (), qApp);
|
||||||
|
|
||||||
|
XMMSResultValueList<uint> *l = m_xmmsc->playlist_list ();
|
||||||
|
l->connect (sigc::mem_fun (this, &XMMSHandler::playlist_list));
|
||||||
|
|
||||||
XMMSResultValue<uint> *r = m_xmmsc->signal_playback_playtime ();
|
XMMSResultValue<uint> *r = m_xmmsc->signal_playback_playtime ();
|
||||||
r->connect (sigc::mem_fun (this, &XMMSHandler::playback_playtime));
|
r->connect (sigc::mem_fun (this, &XMMSHandler::playback_playtime));
|
||||||
|
|
||||||
|
@ -39,14 +43,27 @@ XMMSHandler::XMMSHandler (void) : sigc::trackable ()
|
||||||
|
|
||||||
r = m_xmmsc->broadcast_playback_status ();
|
r = m_xmmsc->broadcast_playback_status ();
|
||||||
r->connect (sigc::mem_fun (this, &XMMSHandler::playback_status));
|
r->connect (sigc::mem_fun (this, &XMMSHandler::playback_status));
|
||||||
|
}
|
||||||
|
|
||||||
XMMSResultValueList<uint> *l = m_xmmsc->playlist_list ();
|
void
|
||||||
l->connect (sigc::mem_fun (this, &XMMSHandler::playlist_list));
|
XMMSHandler::requestMediainfo (uint id)
|
||||||
|
{
|
||||||
|
XMMSResultDict *r = m_xmmsc->medialib_get_info (id);
|
||||||
|
r->connect (sigc::mem_fun (this, &XMMSHandler::medialib_info));
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
XMMSHandler::playlist_list (XMMSResultValueList<uint> *res)
|
XMMSHandler::playlist_list (XMMSResultValueList<uint> *res)
|
||||||
{
|
{
|
||||||
|
QList<uint> list;
|
||||||
|
for (;res->listValid (); res->listNext()) {
|
||||||
|
uint i;
|
||||||
|
if (res->getValue (&i)) {
|
||||||
|
list.append (i);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
emit playlistList (list);
|
||||||
|
|
||||||
delete res;
|
delete res;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -76,11 +93,15 @@ XMMSHandler::playback_current_id (XMMSResultValue<uint> *res)
|
||||||
uint i;
|
uint i;
|
||||||
res->getValue (&i);
|
res->getValue (&i);
|
||||||
|
|
||||||
|
m_currentid = i;
|
||||||
|
|
||||||
if (i > 0) {
|
if (i > 0) {
|
||||||
XMMSResultDict *r = m_xmmsc->medialib_get_info (i);
|
XMMSResultDict *r = m_xmmsc->medialib_get_info (i);
|
||||||
r->connect (sigc::mem_fun (this, &XMMSHandler::medialib_info));
|
r->connect (sigc::mem_fun (this, &XMMSHandler::medialib_info));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
emit currentID(i);
|
||||||
|
|
||||||
if (res->getClass() == XMMSC_RESULT_CLASS_DEFAULT) {
|
if (res->getClass() == XMMSC_RESULT_CLASS_DEFAULT) {
|
||||||
delete res;
|
delete res;
|
||||||
}
|
}
|
||||||
|
@ -100,20 +121,39 @@ XMMSHandler::setPlaytime (void)
|
||||||
void
|
void
|
||||||
XMMSHandler::medialib_info (XMMSResultDict *res)
|
XMMSHandler::medialib_info (XMMSResultDict *res)
|
||||||
{
|
{
|
||||||
int bitrate, samplerate, channels, duration;
|
int id;
|
||||||
char str[4096];
|
QHash<QString, QString> h;
|
||||||
|
std::list<const char *> l = res->getPropDictKeys ();
|
||||||
|
|
||||||
// Make this NICER!
|
std::list<const char *>::const_iterator it;
|
||||||
res->entryFormat (str, 4096, "${artist} - ${album} - ${title}");
|
for(it=l.begin(); it!=l.end(); ++it)
|
||||||
|
{
|
||||||
|
if (res->getDictValueType (*it) == XMMSC_RESULT_VALUE_TYPE_UINT32) {
|
||||||
|
uint i;
|
||||||
|
res->getValue (*it, &i);
|
||||||
|
QString t;
|
||||||
|
t.setNum (i);
|
||||||
|
h.insert (QString::fromLatin1(*it), t);
|
||||||
|
} else if (res->getDictValueType (*it) == XMMSC_RESULT_VALUE_TYPE_INT32) {
|
||||||
|
int i;
|
||||||
|
res->getValue (*it, &i);
|
||||||
|
QString t;
|
||||||
|
t.setNum (i);
|
||||||
|
h.insert (QString::fromLatin1(*it), t);
|
||||||
|
} else if (res->getDictValueType (*it) == XMMSC_RESULT_VALUE_TYPE_STRING) {
|
||||||
|
char *c;
|
||||||
|
res->getValue (*it, &c);
|
||||||
|
h.insert (QString::fromLatin1(*it), QString::fromUtf8 (c));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
res->getValue ("id", &id);
|
||||||
|
|
||||||
res->getValue ("bitrate", &bitrate);
|
emit mediainfoChanged (id, h);
|
||||||
res->getValue ("samplerate", &samplerate);
|
|
||||||
res->getValue ("channels:out", &channels);
|
|
||||||
res->getValue ("duration", &duration);
|
|
||||||
|
|
||||||
emit mediainfoChanged (QString::fromUtf8 (str), bitrate,
|
if (id == m_currentid) {
|
||||||
samplerate, channels, duration);
|
emit currentSong (h);
|
||||||
|
}
|
||||||
|
|
||||||
delete res;
|
delete res;
|
||||||
}
|
}
|
||||||
|
|
|
@ -6,6 +6,7 @@
|
||||||
#include "XmmsQT4.h"
|
#include "XmmsQT4.h"
|
||||||
|
|
||||||
#include <QObject>
|
#include <QObject>
|
||||||
|
#include <QHash>
|
||||||
|
|
||||||
class XMMSHandler : public QObject, public sigc::trackable {
|
class XMMSHandler : public QObject, public sigc::trackable {
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
|
@ -19,6 +20,8 @@ class XMMSHandler : public QObject, public sigc::trackable {
|
||||||
void playback_status (XMMSResultValue<uint> *res);
|
void playback_status (XMMSResultValue<uint> *res);
|
||||||
void playlist_list (XMMSResultValueList<uint> *res);
|
void playlist_list (XMMSResultValueList<uint> *res);
|
||||||
|
|
||||||
|
void requestMediainfo (uint id);
|
||||||
|
|
||||||
const XMMSClient *getXMMS () { return m_xmmsc; }
|
const XMMSClient *getXMMS () { return m_xmmsc; }
|
||||||
|
|
||||||
public slots:
|
public slots:
|
||||||
|
@ -39,13 +42,16 @@ class XMMSHandler : public QObject, public sigc::trackable {
|
||||||
signals:
|
signals:
|
||||||
void playbackStatusChanged (uint status);
|
void playbackStatusChanged (uint status);
|
||||||
void playtimeChanged (uint time);
|
void playtimeChanged (uint time);
|
||||||
void mediainfoChanged (QString str, int bitrate, int samplerate,
|
void mediainfoChanged (uint, QHash<QString, QString>);
|
||||||
int channels, int duration);
|
void currentSong (QHash<QString, QString>);
|
||||||
|
void playlistList (QList<uint>);
|
||||||
|
void currentID (uint);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
XmmsQT4 *m_qt4;
|
XmmsQT4 *m_qt4;
|
||||||
XMMSClient *m_xmmsc;
|
XMMSClient *m_xmmsc;
|
||||||
static XMMSHandler *singleton;
|
static XMMSHandler *singleton;
|
||||||
|
uint m_currentid;
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue