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
|
|
@ -104,8 +104,8 @@ MainDisplay::MainDisplay (QWidget *parent) : SkinDisplay(parent)
|
|||
m_bslider->resize (skin->getSize (Skin::SLIDER_BALANCEBAR_BGS));
|
||||
m_bslider->move (skin->getPos (Skin::SLIDER_BALANCEBAR_BGS));
|
||||
|
||||
connect (&client, SIGNAL(currentSong (const Xmms::PropDict &)),
|
||||
this, SLOT(setMediainfo (const Xmms::PropDict &)));
|
||||
connect (client.cache (), SIGNAL (activeEntryChanged (QVariantHash)),
|
||||
this, SLOT (setMediainfo (const QVariantHash)));
|
||||
connect (client.xplayback (), SIGNAL(playbackStatusChanged(Xmms::Playback::Status)),
|
||||
this, SLOT(setStatus(Xmms::Playback::Status)));
|
||||
connect (client.cache () , SIGNAL (playtime (uint32_t)),
|
||||
|
|
@ -221,46 +221,37 @@ MainDisplay::setPlaytime (uint32_t time)
|
|||
}
|
||||
|
||||
void
|
||||
MainDisplay::setMediainfo (const Xmms::PropDict &info)
|
||||
MainDisplay::setMediainfo (const QVariantHash info)
|
||||
{
|
||||
QString n;
|
||||
if (info.contains ("title")) {
|
||||
if (info.contains ("artist")) {
|
||||
n = QString::fromUtf8 (info.get<std::string> ("artist").c_str ()) + " - ";
|
||||
n = info["artist"].toString () + " - ";
|
||||
}
|
||||
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")) {
|
||||
n = QString::fromUtf8 (info.get<std::string> ("channel").c_str ()) + " - " +
|
||||
QString::fromUtf8 (info.get<std::string> ("title").c_str ());
|
||||
n = info["channel"].toString () + " - " + info["title"].toString ();
|
||||
} else {
|
||||
n = QString::fromUtf8 (info.get<std::string> ("url").c_str ());
|
||||
n = info["url"].toString ();
|
||||
n = n.section ("/", -1);
|
||||
}
|
||||
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_khz->setValue (info.get<int32_t> ("samplerate")/1000);
|
||||
} else {
|
||||
m_khz->setValue(0);
|
||||
}
|
||||
m_kbps->setValue (info.value ("bitrate", 0).toInt ()/1000);
|
||||
m_khz->setValue (info.value ("samplerate", 0).toInt ()/1000);
|
||||
|
||||
if (info.contains ("channels") &&
|
||||
info.get<int32_t> ("channels") > 1) {
|
||||
info["channels"].toInt () > 1) {
|
||||
m_stereo->setStereoMono (1, 0);
|
||||
} else {
|
||||
m_stereo->setStereoMono (0, 1);
|
||||
}
|
||||
|
||||
if (info.contains ("duration")) {
|
||||
m_posbar->setMaximum (info.get<int32_t> ("duration"));
|
||||
m_posbar->setMaximum (info["duration"].toInt ());
|
||||
m_posbar->show ();
|
||||
} else {
|
||||
m_posbar->setMaximum (0);
|
||||
|
|
|
|||
|
|
@ -29,9 +29,13 @@ class MainDisplay;
|
|||
#include <QHash>
|
||||
#include <QBrush>
|
||||
#include <QPalette>
|
||||
#include <QHash>
|
||||
#include <QVariant>
|
||||
|
||||
#include "Display.h"
|
||||
|
||||
typedef QHash<QString, QVariant> QVariantHash;
|
||||
|
||||
class PixmapButton;
|
||||
class PixmapNumberDisplay;
|
||||
class PixmapSlider;
|
||||
|
|
@ -67,7 +71,8 @@ class MainDisplay : public SkinDisplay
|
|||
void setPixmaps(Skin *skin);
|
||||
void setStatus (Xmms::Playback::Status status);
|
||||
void setPlaytime (uint32_t time);
|
||||
void setMediainfo (const Xmms::PropDict &);
|
||||
// void setMediainfo (const Xmms::PropDict &);
|
||||
void setMediainfo (const QVariantHash);
|
||||
void updateVolume (uint volume);
|
||||
void setVolume (int volume);
|
||||
|
||||
|
|
|
|||
|
|
@ -79,8 +79,8 @@ ShadedDisplay::ShadedDisplay (QWidget *parent) : SkinDisplay (parent)
|
|||
this, SLOT(setStatus(Xmms::Playback::Status)));
|
||||
connect (client.cache (), SIGNAL (playtime (uint32_t)),
|
||||
this, SLOT ( setPlaytime(uint32_t)));
|
||||
connect (&client, SIGNAL(currentSong (const Xmms::PropDict &)),
|
||||
this, SLOT(setMediainfo (const Xmms::PropDict &)));
|
||||
connect (client.cache (), SIGNAL (activeEntryChanged (QVariantHash)),
|
||||
this, SLOT (setMediainfo (QVariantHash)));
|
||||
}
|
||||
|
||||
void
|
||||
|
|
@ -90,22 +90,20 @@ ShadedDisplay::setPixmaps (Skin *skin)
|
|||
}
|
||||
|
||||
void
|
||||
ShadedDisplay::setMediainfo (const Xmms::PropDict &info)
|
||||
ShadedDisplay::setMediainfo (QVariantHash info)
|
||||
{
|
||||
QString n;
|
||||
if (info.contains ("artist") && info.contains ("album") &&
|
||||
info.contains ("title")) {
|
||||
n = QString::fromUtf8 (info.get<std::string> ("artist").c_str ())
|
||||
+ " - " +
|
||||
QString::fromUtf8 (info.get<std::string> ("album").c_str ())
|
||||
+ " - " +
|
||||
QString::fromUtf8 (info.get<std::string> ("title").c_str ());
|
||||
n = info["artist"].toString () + " - "
|
||||
+ info["album"].toString () + " - "
|
||||
+ info["title"].toString ();
|
||||
} else {
|
||||
n = QString::fromUtf8 (info.get<std::string> ("url").c_str ());
|
||||
n = info["url"].toString ();
|
||||
}
|
||||
|
||||
if (info.contains ("duration")) {
|
||||
m_duration = (info.get<int32_t> ("duration"));
|
||||
m_duration = info["duration"].toInt ();
|
||||
} else {
|
||||
m_duration = 0;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -20,6 +20,10 @@ class ShadedDisplay;
|
|||
|
||||
#include <xmmsclient/xmmsclient++.h>
|
||||
#include "Display.h"
|
||||
#include <QHash>
|
||||
#include <QVariant>
|
||||
|
||||
typedef QHash<QString, QVariant> QVariantHash;
|
||||
|
||||
class MainWindow;
|
||||
class Skin;
|
||||
|
|
@ -53,7 +57,7 @@ class ShadedDisplay : public SkinDisplay
|
|||
public slots:
|
||||
void setStatus (Xmms::Playback::Status status);
|
||||
void setPlaytime (uint32_t time);
|
||||
void setMediainfo (const Xmms::PropDict &info);
|
||||
void setMediainfo (QVariantHash info);
|
||||
void setPixmaps (Skin *skin);
|
||||
};
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue