diff options
| author | trialuser02 <trialuser02@90c681e8-e032-0410-971d-27865f9a5e38> | 2015-02-02 14:57:42 +0000 |
|---|---|---|
| committer | trialuser02 <trialuser02@90c681e8-e032-0410-971d-27865f9a5e38> | 2015-02-02 14:57:42 +0000 |
| commit | 96cfa27dc27e4dc81385df243215fd516b043673 (patch) | |
| tree | f6ba582f37b2584406d1f697240f8175fdf98f8f /src/plugins/General | |
| parent | 017c9101557477b942ced1739a5668187c5254e0 (diff) | |
| download | qmmp-96cfa27dc27e4dc81385df243215fd516b043673.tar.gz qmmp-96cfa27dc27e4dc81385df243215fd516b043673.tar.bz2 qmmp-96cfa27dc27e4dc81385df243215fd516b043673.zip | |
reduced number of template compilation
git-svn-id: http://svn.code.sf.net/p/qmmp-dev/code/trunk/qmmp@4716 90c681e8-e032-0410-971d-27865f9a5e38
Diffstat (limited to 'src/plugins/General')
| -rw-r--r-- | src/plugins/General/notifier/popupwidget.cpp | 17 | ||||
| -rw-r--r-- | src/plugins/General/notifier/popupwidget.h | 5 |
2 files changed, 6 insertions, 16 deletions
diff --git a/src/plugins/General/notifier/popupwidget.cpp b/src/plugins/General/notifier/popupwidget.cpp index b29b5c6f0..b14ba6396 100644 --- a/src/plugins/General/notifier/popupwidget.cpp +++ b/src/plugins/General/notifier/popupwidget.cpp @@ -30,8 +30,6 @@ #include <QFont> #include <qmmp/soundcore.h> #include <qmmp/metadatamanager.h> -#include <qmmpui/metadataformatter.h> - #include "popupwidget.h" PopupWidget::PopupWidget(QWidget *parent) @@ -59,7 +57,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",DEFAULT_TEMPLATE).toString(); + m_formatter.setPattern(settings.value("template",DEFAULT_TEMPLATE).toString()); settings.endGroup(); //font QFont font; @@ -84,18 +82,9 @@ void PopupWidget::mousePressEvent (QMouseEvent *) void PopupWidget::showMetaData() { m_timer->stop(); - QString title = m_template; - SoundCore *core = SoundCore::instance(); - if (core->totalTime() > 0) - { - int l = core->totalTime()/1000; - 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.format(core->metaData()); + + QString title = m_formatter.format(core->metaData(), core->totalTime() / 1000); m_label1->setText(title); diff --git a/src/plugins/General/notifier/popupwidget.h b/src/plugins/General/notifier/popupwidget.h index bed2418af..0eb625c50 100644 --- a/src/plugins/General/notifier/popupwidget.h +++ b/src/plugins/General/notifier/popupwidget.h @@ -1,5 +1,5 @@ /*************************************************************************** - * Copyright (C) 2008-2012 by Ilya Kotov * + * Copyright (C) 2008-2015 by Ilya Kotov * * forkotov02@hotmail.ru * * * * This program is free software; you can redistribute it and/or modify * @@ -22,6 +22,7 @@ #include <QWidget> #include <QFrame> +#include <qmmpui/metadataformatter.h> #define DEFAULT_TEMPLATE "<b>%if(%t,%t,%f)</b> %if(%l,\\(%l\\),) \n%if(%p,<br>%p,)\n%if(%a,<br>%a,)" @@ -63,7 +64,7 @@ private: QTimer *m_timer; QLabel *m_label1; QLabel *m_pixlabel; - QString m_template; + MetaDataFormatter m_formatter; uint m_pos; int m_coverSize; |
