OTHER: Use Xmms::*Dict instead of QHash for various functions.
This commit is contained in:
parent
f16efc80e3
commit
c98cadb1f2
10 changed files with 96 additions and 74 deletions
|
|
@ -59,8 +59,8 @@ MainDisplay::MainDisplay (QWidget *parent) : SkinDisplay(parent)
|
|||
m_vslider->move (107, 57);
|
||||
|
||||
XMMSHandler &xmmsh = XMMSHandler::getInstance ();
|
||||
connect (&xmmsh, SIGNAL(currentSong (const QHash<QString, QString> &)),
|
||||
this, SLOT(setMediainfo (const QHash<QString, QString> &)));
|
||||
connect (&xmmsh, SIGNAL(currentSong (const Xmms::PropDict &)),
|
||||
this, SLOT(setMediainfo (const Xmms::PropDict &)));
|
||||
connect (&xmmsh, SIGNAL(playbackStatusChanged(Xmms::Playback::Status)),
|
||||
this, SLOT(setStatus(Xmms::Playback::Status)));
|
||||
connect (&xmmsh, SIGNAL(playtimeChanged(uint)),
|
||||
|
|
@ -123,24 +123,34 @@ MainDisplay::setPlaytime (uint time)
|
|||
}
|
||||
|
||||
void
|
||||
MainDisplay::setMediainfo (const QHash<QString, QString> &h)
|
||||
MainDisplay::setMediainfo (const Xmms::PropDict &info)
|
||||
{
|
||||
QString n;
|
||||
if (h.contains ("artist") && h.contains ("album") && h.contains ("title")) {
|
||||
n = h.value("artist") + " - " + h.value("album") + " - " + h.value("title");
|
||||
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 ());
|
||||
} else {
|
||||
n = h.value("url");
|
||||
n = QString::fromUtf8 (info.get<std::string> ("url").c_str ());
|
||||
}
|
||||
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_kbps->setNumber (info.get<uint32_t> ("bitrate")/1000, 3);
|
||||
if (info.contains ("samplerate")) {
|
||||
m_khz->setNumber (info.get<uint32_t> ("samplerate")/1000, 2);
|
||||
} else {
|
||||
m_khz->setNumber(0, 1);
|
||||
}
|
||||
if (info.contains ("channels:in") &&
|
||||
info.get<uint32_t> ("channels:in") > 1) {
|
||||
m_stereo->setStereoMono (1, 0);
|
||||
} else {
|
||||
m_stereo->setStereoMono (0, 1);
|
||||
}
|
||||
m_slider->setMax (h.value("duration").toUInt());
|
||||
m_slider->setMax (info.get<uint32_t> ("duration"));
|
||||
m_slider->hideBar (false);
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue