diff options
| author | trialuser02 <trialuser02@90c681e8-e032-0410-971d-27865f9a5e38> | 2009-11-21 17:13:34 +0000 |
|---|---|---|
| committer | trialuser02 <trialuser02@90c681e8-e032-0410-971d-27865f9a5e38> | 2009-11-21 17:13:34 +0000 |
| commit | 90b71df1362b7e128ca99ee09cc8402b8421f76d (patch) | |
| tree | 24faee1a7b7b0f7610015a8f57ffa60b2865f7c9 /src/plugins/General/notifier/popupwidget.cpp | |
| parent | bfda47d04f9f520638f652bdb7fffb6de3dfd992 (diff) | |
| download | qmmp-90b71df1362b7e128ca99ee09cc8402b8421f76d.tar.gz qmmp-90b71df1362b7e128ca99ee09cc8402b8421f76d.tar.bz2 qmmp-90b71df1362b7e128ca99ee09cc8402b8421f76d.zip | |
added metadata formatter
git-svn-id: http://svn.code.sf.net/p/qmmp-dev/code/trunk/qmmp@1389 90c681e8-e032-0410-971d-27865f9a5e38
Diffstat (limited to 'src/plugins/General/notifier/popupwidget.cpp')
| -rw-r--r-- | src/plugins/General/notifier/popupwidget.cpp | 27 |
1 files changed, 9 insertions, 18 deletions
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 <QFont> #include <qmmp/soundcore.h> #include <qmmp/metadatamanager.h> +#include <qmmpui/metadataformatter.h> #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 = "<b>"; - if (core->metaData(Qmmp::TITLE).isEmpty()) - title.append(core->metaData(Qmmp::URL).section('/',-1)); - else - title.append(core->metaData(Qmmp::TITLE)); - title.append("</b>"); 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("<br>"); - 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("<br>"); - title.append(core->metaData(Qmmp::ALBUM)); - } m_label1->setText(title); QPixmap pix = MetaDataManager::instance()->getCover(core->metaData(Qmmp::URL)); |
