aboutsummaryrefslogtreecommitdiff
path: root/src/plugins/General/notifier
diff options
context:
space:
mode:
Diffstat (limited to 'src/plugins/General/notifier')
-rw-r--r--src/plugins/General/notifier/popupwidget.cpp17
-rw-r--r--src/plugins/General/notifier/popupwidget.h5
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;