From 90b71df1362b7e128ca99ee09cc8402b8421f76d Mon Sep 17 00:00:00 2001 From: trialuser02 Date: Sat, 21 Nov 2009 17:13:34 +0000 Subject: added metadata formatter git-svn-id: http://svn.code.sf.net/p/qmmp-dev/code/trunk/qmmp@1389 90c681e8-e032-0410-971d-27865f9a5e38 --- src/plugins/General/notifier/popupwidget.cpp | 27 +++++++++------------------ 1 file changed, 9 insertions(+), 18 deletions(-) (limited to 'src/plugins/General/notifier/popupwidget.cpp') diff --git a/src/plugins/General/notifier/popupwidget.cpp b/src/plugins/General/notifier/popupwidget.cpp index 6ce89da44..e7b34b99e 100644 --- a/src/plugins/General/notifier/popupwidget.cpp +++ b/src/plugins/General/notifier/popupwidget.cpp @@ -30,6 +30,7 @@ #include #include #include +#include #include "popupwidget.h" @@ -57,6 +58,7 @@ PopupWidget::PopupWidget(QWidget *parent) setWindowOpacity(settings.value("opacity", 1.0).toDouble()); QString fontname = settings.value("font").toString(); m_coverSize = settings.value("cover_size", 64).toInt(); + m_template = settings.value("template","").toString(); settings.endGroup(); //font QFont font; @@ -81,30 +83,19 @@ void PopupWidget::mousePressEvent (QMouseEvent *) void PopupWidget::showMetaData() { m_timer->stop(); + QString title = m_template; + SoundCore *core = SoundCore::instance(); - QString title = ""; - if (core->metaData(Qmmp::TITLE).isEmpty()) - title.append(core->metaData(Qmmp::URL).section('/',-1)); - else - title.append(core->metaData(Qmmp::TITLE)); - title.append(""); if (core->totalTime() > 0) { - title.append(" "); int l = core->totalTime()/1000; - title.append(QString("(%1:%2)").arg(l/60).arg(l%60, 2, 10, QChar('0'))); - } - if(!core->metaData(Qmmp::ARTIST).isEmpty()) - { - title.append("
"); - title.append(core->metaData(Qmmp::ARTIST)); + title.replace("%l",QString("%1:%2").arg(l/60).arg(l%60, 2, 10, QChar('0'))); } + else + title.replace("%l",""); + MetaDataFormatter f(title); + title = f.parse(core->metaData()); - if(!core->metaData(Qmmp::ALBUM).isEmpty()) - { - title.append("
"); - title.append(core->metaData(Qmmp::ALBUM)); - } m_label1->setText(title); QPixmap pix = MetaDataManager::instance()->getCover(core->metaData(Qmmp::URL)); -- cgit v1.2.3-13-gbd6f