OTHER: Replaced code for current_id handling
Now the current_id changed broadcast is handled in xclientcache, the now unused code from XMMSHandler has been removed
This commit is contained in:
parent
058e2d0987
commit
20cfdad68d
11 changed files with 82 additions and 111 deletions
|
@ -46,6 +46,11 @@ XClientCache::got_connection (XClient *client)
|
||||||
|
|
||||||
client->medialib ()->broadcastEntryChanged () (
|
client->medialib ()->broadcastEntryChanged () (
|
||||||
Xmms::bind (&XClientCache::handle_mlib_entry_changed, this));
|
Xmms::bind (&XClientCache::handle_mlib_entry_changed, this));
|
||||||
|
|
||||||
|
client->playback ()->broadcastCurrentID () (
|
||||||
|
Xmms::bind (&XClientCache::handle_current_id_changed, this));
|
||||||
|
client->playback ()->currentID () (
|
||||||
|
Xmms::bind (&XClientCache::handle_current_id_changed, this));
|
||||||
}
|
}
|
||||||
|
|
||||||
bool
|
bool
|
||||||
|
@ -60,12 +65,16 @@ XClientCache::handle_medialib_info_error (const std::string &error, uint32_t id)
|
||||||
bool
|
bool
|
||||||
XClientCache::handle_medialib_info (const Xmms::PropDict &info)
|
XClientCache::handle_medialib_info (const Xmms::PropDict &info)
|
||||||
{
|
{
|
||||||
int32_t id = info.get<int32_t> ("id");
|
uint32_t id = info.get<int32_t> ("id");
|
||||||
QHash<QString, QVariant> hash = XClient::convert_propdict (info);
|
QHash<QString, QVariant> hash = XClient::convert_propdict (info);
|
||||||
|
|
||||||
m_info.insert (id, hash);
|
m_info.insert (id, hash);
|
||||||
emit entryChanged (id);
|
emit entryChanged (id);
|
||||||
|
|
||||||
|
if (id == m_current_id) {
|
||||||
|
emit activeEntryChanged (hash);
|
||||||
|
}
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -165,6 +174,20 @@ XClientCache::handle_mlib_entry_changed (const uint32_t &id)
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool
|
||||||
|
XClientCache::handle_current_id_changed (const uint32_t &id)
|
||||||
|
{
|
||||||
|
m_current_id = id;
|
||||||
|
if (!m_info.contains (id)) {
|
||||||
|
// get_info fetches the metadata from the server, and calls handle_medialib_info.
|
||||||
|
// handle_medialib_info sends the activeEntryChanged Signal
|
||||||
|
get_info (id);
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
emit activeEntryChanged (m_info[id]);
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
bool
|
bool
|
||||||
XClientCache::handle_playtime (const unsigned int &tme)
|
XClientCache::handle_playtime (const unsigned int &tme)
|
||||||
|
|
|
@ -38,6 +38,8 @@ class QIcon;
|
||||||
class QPixmap;
|
class QPixmap;
|
||||||
//#include <QPixmapCache>
|
//#include <QPixmapCache>
|
||||||
|
|
||||||
|
typedef QHash<QString, QVariant> QVariantHash;
|
||||||
|
|
||||||
class XClientCache : public QObject
|
class XClientCache : public QObject
|
||||||
{
|
{
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
|
@ -45,6 +47,7 @@ class XClientCache : public QObject
|
||||||
XClientCache (XClient *);
|
XClientCache (XClient *);
|
||||||
|
|
||||||
QHash<QString, QVariant> get_info (uint32_t id);
|
QHash<QString, QVariant> get_info (uint32_t id);
|
||||||
|
QVariantHash get_current_info () {return get_info (m_current_id);}
|
||||||
QIcon get_icon (uint32_t id);
|
QIcon get_icon (uint32_t id);
|
||||||
QPixmap get_pixmap (uint32_t id);
|
QPixmap get_pixmap (uint32_t id);
|
||||||
QVariant extra_info_get (uint32_t, const QString &);
|
QVariant extra_info_get (uint32_t, const QString &);
|
||||||
|
@ -65,14 +68,17 @@ class XClientCache : public QObject
|
||||||
void entryRemoved (uint32_t);
|
void entryRemoved (uint32_t);
|
||||||
void playtime (uint32_t);
|
void playtime (uint32_t);
|
||||||
|
|
||||||
|
void activeEntryChanged (QVariantHash);
|
||||||
|
|
||||||
public slots:
|
public slots:
|
||||||
void got_connection (XClient *);
|
void got_connection (XClient *);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
bool handle_medialib_info (const Xmms::PropDict &info);
|
bool handle_medialib_info (const Xmms::PropDict &info);
|
||||||
bool handle_medialib_info_error (const std::string &, uint32_t);
|
bool handle_medialib_info_error (const std::string &, uint32_t);
|
||||||
|
|
||||||
bool handle_mlib_entry_changed (const uint32_t &id);
|
bool handle_mlib_entry_changed (const uint32_t &id);
|
||||||
|
bool handle_current_id_changed (const uint32_t &id);
|
||||||
bool handle_bindata (const Xmms::bin &, const QString &);
|
bool handle_bindata (const Xmms::bin &, const QString &);
|
||||||
|
|
||||||
bool handle_playtime (const unsigned int &tme);
|
bool handle_playtime (const unsigned int &tme);
|
||||||
|
@ -82,6 +88,8 @@ class XClientCache : public QObject
|
||||||
QHash < QString, QList <uint32_t> > m_icon_map;
|
QHash < QString, QList <uint32_t> > m_icon_map;
|
||||||
QHash < int, QHash < QString, QVariant > > m_extra_info;
|
QHash < int, QHash < QString, QVariant > > m_extra_info;
|
||||||
|
|
||||||
|
uint32_t m_current_id;
|
||||||
|
|
||||||
XClient *m_client;
|
XClient *m_client;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -126,6 +126,8 @@ TextScroller::setText (QString text)
|
||||||
} else {
|
} else {
|
||||||
drawBitmapFont (text);
|
drawBitmapFont (text);
|
||||||
}
|
}
|
||||||
|
m_x_off = 0;
|
||||||
|
m_x2_off = 0;
|
||||||
update ();
|
update ();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -148,6 +150,7 @@ TextScroller::drawBitmapFont (QString text)
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
m_pixmap = QPixmap (m_w, m_h);
|
m_pixmap = QPixmap (m_w, m_h);
|
||||||
|
m_timer->stop ();
|
||||||
}
|
}
|
||||||
QByteArray temp2 = temp.toLatin1();
|
QByteArray temp2 = temp.toLatin1();
|
||||||
const char *t = temp2.data();
|
const char *t = temp2.data();
|
||||||
|
@ -201,6 +204,7 @@ TextScroller::drawQtFont (QString text)
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
m_pixmap = QPixmap (m_w, m_h);
|
m_pixmap = QPixmap (m_w, m_h);
|
||||||
|
m_timer->stop ();
|
||||||
}
|
}
|
||||||
|
|
||||||
QPainter paint;
|
QPainter paint;
|
||||||
|
|
|
@ -61,62 +61,18 @@ XMMSHandler::connect_handler (const char *ipcpath, const bool &sync, QWidget *pa
|
||||||
connect(ipcpath, sync, parent);
|
connect(ipcpath, sync, parent);
|
||||||
|
|
||||||
using Xmms::bind;
|
using Xmms::bind;
|
||||||
m_client->medialib.broadcastEntryChanged () (
|
|
||||||
bind (&XMMSHandler::medialib_entry_changed, this));
|
|
||||||
|
|
||||||
m_client->playback.currentID () (
|
|
||||||
bind (&XMMSHandler::playback_current_id, this));
|
|
||||||
m_client->playback.broadcastCurrentID () (
|
|
||||||
bind (&XMMSHandler::playback_current_id, this));
|
|
||||||
|
|
||||||
m_client->playback.broadcastVolumeChanged () (
|
m_client->playback.broadcastVolumeChanged () (
|
||||||
bind (&XMMSHandler::volume_changed, this));
|
bind (&XMMSHandler::volume_changed, this));
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
Xmms::Client *
|
|
||||||
XMMSHandler::getClient ()
|
|
||||||
{
|
|
||||||
return m_client;
|
|
||||||
}
|
|
||||||
|
|
||||||
bool
|
|
||||||
XMMSHandler::medialib_entry_changed (const unsigned int &id)
|
|
||||||
{
|
|
||||||
if (id > 0) {
|
|
||||||
requestMediainfo (id);
|
|
||||||
}
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
void
|
void
|
||||||
XMMSHandler::playlistAddURL (const QString &s)
|
XMMSHandler::playlistAddURL (const QString &s)
|
||||||
{
|
{
|
||||||
m_client->playlist.addUrl (s.toAscii ().constData ()) ();
|
m_client->playlist.addUrl (s.toAscii ().constData ()) ();
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
|
||||||
XMMSHandler::requestMediainfo (uint id)
|
|
||||||
{
|
|
||||||
m_client->medialib.getInfo (id) (
|
|
||||||
Xmms::bind (&XMMSHandler::medialib_info, this));
|
|
||||||
}
|
|
||||||
|
|
||||||
bool
|
|
||||||
XMMSHandler::playback_current_id (const unsigned int &id)
|
|
||||||
{
|
|
||||||
m_currentid = id;
|
|
||||||
|
|
||||||
if (id > 0) {
|
|
||||||
requestMediainfo (id);
|
|
||||||
}
|
|
||||||
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
void
|
void
|
||||||
XMMSHandler::DictToQHash (const std::string &key,
|
XMMSHandler::DictToQHash (const std::string &key,
|
||||||
const Xmms::Dict::Variant &value,
|
const Xmms::Dict::Variant &value,
|
||||||
|
@ -176,18 +132,6 @@ XMMSHandler::medialib_select (XMMSResultDictList *res)
|
||||||
}
|
}
|
||||||
*/
|
*/
|
||||||
|
|
||||||
bool
|
|
||||||
XMMSHandler::medialib_info (const Xmms::PropDict &propdict)
|
|
||||||
{
|
|
||||||
unsigned int id = propdict.get<int32_t>("id");
|
|
||||||
emit mediainfoChanged (id, propdict);
|
|
||||||
|
|
||||||
if (id == m_currentid) {
|
|
||||||
emit currentSong (propdict);
|
|
||||||
}
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
bool
|
bool
|
||||||
XMMSHandler::volume_error (const std::string &error)
|
XMMSHandler::volume_error (const std::string &error)
|
||||||
{
|
{
|
||||||
|
|
|
@ -36,12 +36,8 @@ class XMMSHandler : public XClient {
|
||||||
|
|
||||||
bool connect_handler (const char *ipcpath = NULL, const bool &sync = false, QWidget *parent = NULL);
|
bool connect_handler (const char *ipcpath = NULL, const bool &sync = false, QWidget *parent = NULL);
|
||||||
|
|
||||||
bool playback_current_id (const unsigned int &id);
|
|
||||||
bool medialib_info (const Xmms::PropDict &propdict);
|
|
||||||
bool medialib_entry_changed (const unsigned int &id);
|
|
||||||
bool volume_changed (const Xmms::Dict &levels);
|
bool volume_changed (const Xmms::Dict &levels);
|
||||||
|
|
||||||
void requestMediainfo (uint id);
|
|
||||||
void playlistAddURL (const QString& url);
|
void playlistAddURL (const QString& url);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
@ -60,7 +56,7 @@ class XMMSHandler : public XClient {
|
||||||
|
|
||||||
void updateSettings () { emit settingsSaved (); }
|
void updateSettings () { emit settingsSaved (); }
|
||||||
|
|
||||||
Xmms::Client *getClient ();
|
Xmms::Client *getClient () { return m_client; }
|
||||||
|
|
||||||
PlaylistModel *getPlaylistModel () {return m_playlist_model; }
|
PlaylistModel *getPlaylistModel () {return m_playlist_model; }
|
||||||
|
|
||||||
|
@ -69,9 +65,6 @@ class XMMSHandler : public XClient {
|
||||||
|
|
||||||
signals:
|
signals:
|
||||||
void settingsSaved ();
|
void settingsSaved ();
|
||||||
void mediainfoChanged (uint, const Xmms::PropDict &);
|
|
||||||
void currentSong (const Xmms::PropDict &);
|
|
||||||
void playlistChanged (const Xmms::Dict &);
|
|
||||||
/*
|
/*
|
||||||
void medialibResponse (uint, const QList<QHash<QString, QString> > &);
|
void medialibResponse (uint, const QList<QHash<QString, QString> > &);
|
||||||
*/
|
*/
|
||||||
|
@ -91,7 +84,6 @@ class XMMSHandler : public XClient {
|
||||||
|
|
||||||
XmmsQT4 *m_qt4;
|
XmmsQT4 *m_qt4;
|
||||||
PlaylistModel *m_playlist_model;
|
PlaylistModel *m_playlist_model;
|
||||||
unsigned int m_currentid;
|
|
||||||
bool m_masterchan;
|
bool m_masterchan;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -104,8 +104,8 @@ MainDisplay::MainDisplay (QWidget *parent) : SkinDisplay(parent)
|
||||||
m_bslider->resize (skin->getSize (Skin::SLIDER_BALANCEBAR_BGS));
|
m_bslider->resize (skin->getSize (Skin::SLIDER_BALANCEBAR_BGS));
|
||||||
m_bslider->move (skin->getPos (Skin::SLIDER_BALANCEBAR_BGS));
|
m_bslider->move (skin->getPos (Skin::SLIDER_BALANCEBAR_BGS));
|
||||||
|
|
||||||
connect (&client, SIGNAL(currentSong (const Xmms::PropDict &)),
|
connect (client.cache (), SIGNAL (activeEntryChanged (QVariantHash)),
|
||||||
this, SLOT(setMediainfo (const Xmms::PropDict &)));
|
this, SLOT (setMediainfo (const QVariantHash)));
|
||||||
connect (client.xplayback (), SIGNAL(playbackStatusChanged(Xmms::Playback::Status)),
|
connect (client.xplayback (), SIGNAL(playbackStatusChanged(Xmms::Playback::Status)),
|
||||||
this, SLOT(setStatus(Xmms::Playback::Status)));
|
this, SLOT(setStatus(Xmms::Playback::Status)));
|
||||||
connect (client.cache () , SIGNAL (playtime (uint32_t)),
|
connect (client.cache () , SIGNAL (playtime (uint32_t)),
|
||||||
|
@ -221,46 +221,37 @@ MainDisplay::setPlaytime (uint32_t time)
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
MainDisplay::setMediainfo (const Xmms::PropDict &info)
|
MainDisplay::setMediainfo (const QVariantHash info)
|
||||||
{
|
{
|
||||||
QString n;
|
QString n;
|
||||||
if (info.contains ("title")) {
|
if (info.contains ("title")) {
|
||||||
if (info.contains ("artist")) {
|
if (info.contains ("artist")) {
|
||||||
n = QString::fromUtf8 (info.get<std::string> ("artist").c_str ()) + " - ";
|
n = info["artist"].toString () + " - ";
|
||||||
}
|
}
|
||||||
if (info.contains ("album")) {
|
if (info.contains ("album")) {
|
||||||
n += QString::fromUtf8 (info.get<std::string> ("album").c_str ()) + " - ";
|
n += info["album"].toString () + " - ";
|
||||||
}
|
}
|
||||||
n += QString::fromUtf8 (info.get<std::string> ("title").c_str ());
|
n += info["title"].toString ();
|
||||||
} else if (info.contains ("channel")) {
|
} else if (info.contains ("channel")) {
|
||||||
n = QString::fromUtf8 (info.get<std::string> ("channel").c_str ()) + " - " +
|
n = info["channel"].toString () + " - " + info["title"].toString ();
|
||||||
QString::fromUtf8 (info.get<std::string> ("title").c_str ());
|
|
||||||
} else {
|
} else {
|
||||||
n = QString::fromUtf8 (info.get<std::string> ("url").c_str ());
|
n = info["url"].toString ();
|
||||||
n = n.section ("/", -1);
|
n = n.section ("/", -1);
|
||||||
}
|
}
|
||||||
m_text->setText (n);
|
m_text->setText (n);
|
||||||
|
|
||||||
if (info.contains ("bitrate")) {
|
|
||||||
m_kbps->setValue (info.get<int32_t> ("bitrate")/1000);
|
|
||||||
} else {
|
|
||||||
m_kbps->setValue (0);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (info.contains ("samplerate")) {
|
m_kbps->setValue (info.value ("bitrate", 0).toInt ()/1000);
|
||||||
m_khz->setValue (info.get<int32_t> ("samplerate")/1000);
|
m_khz->setValue (info.value ("samplerate", 0).toInt ()/1000);
|
||||||
} else {
|
|
||||||
m_khz->setValue(0);
|
|
||||||
}
|
|
||||||
if (info.contains ("channels") &&
|
if (info.contains ("channels") &&
|
||||||
info.get<int32_t> ("channels") > 1) {
|
info["channels"].toInt () > 1) {
|
||||||
m_stereo->setStereoMono (1, 0);
|
m_stereo->setStereoMono (1, 0);
|
||||||
} else {
|
} else {
|
||||||
m_stereo->setStereoMono (0, 1);
|
m_stereo->setStereoMono (0, 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (info.contains ("duration")) {
|
if (info.contains ("duration")) {
|
||||||
m_posbar->setMaximum (info.get<int32_t> ("duration"));
|
m_posbar->setMaximum (info["duration"].toInt ());
|
||||||
m_posbar->show ();
|
m_posbar->show ();
|
||||||
} else {
|
} else {
|
||||||
m_posbar->setMaximum (0);
|
m_posbar->setMaximum (0);
|
||||||
|
|
|
@ -29,9 +29,13 @@ class MainDisplay;
|
||||||
#include <QHash>
|
#include <QHash>
|
||||||
#include <QBrush>
|
#include <QBrush>
|
||||||
#include <QPalette>
|
#include <QPalette>
|
||||||
|
#include <QHash>
|
||||||
|
#include <QVariant>
|
||||||
|
|
||||||
#include "Display.h"
|
#include "Display.h"
|
||||||
|
|
||||||
|
typedef QHash<QString, QVariant> QVariantHash;
|
||||||
|
|
||||||
class PixmapButton;
|
class PixmapButton;
|
||||||
class PixmapNumberDisplay;
|
class PixmapNumberDisplay;
|
||||||
class PixmapSlider;
|
class PixmapSlider;
|
||||||
|
@ -67,7 +71,8 @@ class MainDisplay : public SkinDisplay
|
||||||
void setPixmaps(Skin *skin);
|
void setPixmaps(Skin *skin);
|
||||||
void setStatus (Xmms::Playback::Status status);
|
void setStatus (Xmms::Playback::Status status);
|
||||||
void setPlaytime (uint32_t time);
|
void setPlaytime (uint32_t time);
|
||||||
void setMediainfo (const Xmms::PropDict &);
|
// void setMediainfo (const Xmms::PropDict &);
|
||||||
|
void setMediainfo (const QVariantHash);
|
||||||
void updateVolume (uint volume);
|
void updateVolume (uint volume);
|
||||||
void setVolume (int volume);
|
void setVolume (int volume);
|
||||||
|
|
||||||
|
|
|
@ -79,8 +79,8 @@ ShadedDisplay::ShadedDisplay (QWidget *parent) : SkinDisplay (parent)
|
||||||
this, SLOT(setStatus(Xmms::Playback::Status)));
|
this, SLOT(setStatus(Xmms::Playback::Status)));
|
||||||
connect (client.cache (), SIGNAL (playtime (uint32_t)),
|
connect (client.cache (), SIGNAL (playtime (uint32_t)),
|
||||||
this, SLOT ( setPlaytime(uint32_t)));
|
this, SLOT ( setPlaytime(uint32_t)));
|
||||||
connect (&client, SIGNAL(currentSong (const Xmms::PropDict &)),
|
connect (client.cache (), SIGNAL (activeEntryChanged (QVariantHash)),
|
||||||
this, SLOT(setMediainfo (const Xmms::PropDict &)));
|
this, SLOT (setMediainfo (QVariantHash)));
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
|
@ -90,22 +90,20 @@ ShadedDisplay::setPixmaps (Skin *skin)
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
ShadedDisplay::setMediainfo (const Xmms::PropDict &info)
|
ShadedDisplay::setMediainfo (QVariantHash info)
|
||||||
{
|
{
|
||||||
QString n;
|
QString n;
|
||||||
if (info.contains ("artist") && info.contains ("album") &&
|
if (info.contains ("artist") && info.contains ("album") &&
|
||||||
info.contains ("title")) {
|
info.contains ("title")) {
|
||||||
n = QString::fromUtf8 (info.get<std::string> ("artist").c_str ())
|
n = info["artist"].toString () + " - "
|
||||||
+ " - " +
|
+ info["album"].toString () + " - "
|
||||||
QString::fromUtf8 (info.get<std::string> ("album").c_str ())
|
+ info["title"].toString ();
|
||||||
+ " - " +
|
|
||||||
QString::fromUtf8 (info.get<std::string> ("title").c_str ());
|
|
||||||
} else {
|
} else {
|
||||||
n = QString::fromUtf8 (info.get<std::string> ("url").c_str ());
|
n = info["url"].toString ();
|
||||||
}
|
}
|
||||||
|
|
||||||
if (info.contains ("duration")) {
|
if (info.contains ("duration")) {
|
||||||
m_duration = (info.get<int32_t> ("duration"));
|
m_duration = info["duration"].toInt ();
|
||||||
} else {
|
} else {
|
||||||
m_duration = 0;
|
m_duration = 0;
|
||||||
}
|
}
|
||||||
|
|
|
@ -20,6 +20,10 @@ class ShadedDisplay;
|
||||||
|
|
||||||
#include <xmmsclient/xmmsclient++.h>
|
#include <xmmsclient/xmmsclient++.h>
|
||||||
#include "Display.h"
|
#include "Display.h"
|
||||||
|
#include <QHash>
|
||||||
|
#include <QVariant>
|
||||||
|
|
||||||
|
typedef QHash<QString, QVariant> QVariantHash;
|
||||||
|
|
||||||
class MainWindow;
|
class MainWindow;
|
||||||
class Skin;
|
class Skin;
|
||||||
|
@ -53,7 +57,7 @@ class ShadedDisplay : public SkinDisplay
|
||||||
public slots:
|
public slots:
|
||||||
void setStatus (Xmms::Playback::Status status);
|
void setStatus (Xmms::Playback::Status status);
|
||||||
void setPlaytime (uint32_t time);
|
void setPlaytime (uint32_t time);
|
||||||
void setMediainfo (const Xmms::PropDict &info);
|
void setMediainfo (QVariantHash info);
|
||||||
void setPixmaps (Skin *skin);
|
void setPixmaps (Skin *skin);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -15,6 +15,7 @@
|
||||||
|
|
||||||
#include "XMMSHandler.h"
|
#include "XMMSHandler.h"
|
||||||
#include <xmmsclient/xmmsclient++.h>
|
#include <xmmsclient/xmmsclient++.h>
|
||||||
|
#include "xclientcache.h"
|
||||||
|
|
||||||
#include "playlistshade.h"
|
#include "playlistshade.h"
|
||||||
#include "playlistwindow.h"
|
#include "playlistwindow.h"
|
||||||
|
@ -45,8 +46,8 @@ PlaylistShade::PlaylistShade (PlaylistWindow *parent) : QWidget (parent)
|
||||||
connect (m_unshadebtn, SIGNAL (clicked ()),
|
connect (m_unshadebtn, SIGNAL (clicked ()),
|
||||||
parent, SLOT (switchDisplay ()));
|
parent, SLOT (switchDisplay ()));
|
||||||
|
|
||||||
connect (&xmmsh, SIGNAL(currentSong (const Xmms::PropDict &)),
|
connect (xmmsh.cache (), SIGNAL (activeEntryChanged (QVariantHash)),
|
||||||
this, SLOT(setMediainfo (const Xmms::PropDict &)));
|
this, SLOT (setMediainfo (QVariantHash)));
|
||||||
|
|
||||||
connect (&xmmsh, SIGNAL(settingsSaved ()),
|
connect (&xmmsh, SIGNAL(settingsSaved ()),
|
||||||
this, SLOT(settingsSaved ()));
|
this, SLOT(settingsSaved ()));
|
||||||
|
@ -65,18 +66,16 @@ PlaylistShade::settingsSaved ()
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
PlaylistShade::setMediainfo (const Xmms::PropDict &info)
|
PlaylistShade::setMediainfo (QVariantHash info)
|
||||||
{
|
{
|
||||||
QString n;
|
QString n;
|
||||||
if (info.contains ("artist") && info.contains ("album") &&
|
if (info.contains ("artist") && info.contains ("album") &&
|
||||||
info.contains ("title")) {
|
info.contains ("title")) {
|
||||||
n = QString::fromUtf8 (info.get<std::string> ("artist").c_str ())
|
n = info["artist"].toString () + " - "
|
||||||
+ " - " +
|
+ info["album"].toString () + " - "
|
||||||
QString::fromUtf8 (info.get<std::string> ("album").c_str ())
|
+ info["title"].toString ();
|
||||||
+ " - " +
|
|
||||||
QString::fromUtf8 (info.get<std::string> ("title").c_str ());
|
|
||||||
} else {
|
} else {
|
||||||
n = QString::fromUtf8 (info.get<std::string> ("url").c_str ());
|
n = info["url"].toString ();
|
||||||
}
|
}
|
||||||
m_text = (n);
|
m_text = (n);
|
||||||
|
|
||||||
|
|
|
@ -21,6 +21,9 @@
|
||||||
|
|
||||||
#include <QWidget>
|
#include <QWidget>
|
||||||
#include <QHash>
|
#include <QHash>
|
||||||
|
#include <QVariant>
|
||||||
|
|
||||||
|
typedef QHash<QString, QVariant> QVariantHash;
|
||||||
|
|
||||||
class QResizeEvent;
|
class QResizeEvent;
|
||||||
class PixmapButton;
|
class PixmapButton;
|
||||||
|
@ -39,7 +42,7 @@ class PlaylistShade : public QWidget {
|
||||||
|
|
||||||
public slots:
|
public slots:
|
||||||
void setPixmaps (Skin *skin);
|
void setPixmaps (Skin *skin);
|
||||||
void setMediainfo (const Xmms::PropDict &info);
|
void setMediainfo (QVariantHash);
|
||||||
void settingsSaved ();
|
void settingsSaved ();
|
||||||
void resizeEvent (QResizeEvent *);
|
void resizeEvent (QResizeEvent *);
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue