diff options
| author | trialuser02 <trialuser02@90c681e8-e032-0410-971d-27865f9a5e38> | 2008-11-24 21:54:59 +0000 |
|---|---|---|
| committer | trialuser02 <trialuser02@90c681e8-e032-0410-971d-27865f9a5e38> | 2008-11-24 21:54:59 +0000 |
| commit | a9946929bc45b96acd171a8137600277d122ccd9 (patch) | |
| tree | 5e675c6dbc697ac80ed3920c768c7fd6c328df0f /src/plugins/General/notifier/notifier.cpp | |
| parent | 52cdbf3b10333908693f21a7c04ff7983baf923e (diff) | |
| download | qmmp-a9946929bc45b96acd171a8137600277d122ccd9.tar.gz qmmp-a9946929bc45b96acd171a8137600277d122ccd9.tar.bz2 qmmp-a9946929bc45b96acd171a8137600277d122ccd9.zip | |
general api cleanup
git-svn-id: http://svn.code.sf.net/p/qmmp-dev/code/trunk/qmmp@631 90c681e8-e032-0410-971d-27865f9a5e38
Diffstat (limited to 'src/plugins/General/notifier/notifier.cpp')
| -rw-r--r-- | src/plugins/General/notifier/notifier.cpp | 28 |
1 files changed, 16 insertions, 12 deletions
diff --git a/src/plugins/General/notifier/notifier.cpp b/src/plugins/General/notifier/notifier.cpp index 9f6006366..2d4f0e951 100644 --- a/src/plugins/General/notifier/notifier.cpp +++ b/src/plugins/General/notifier/notifier.cpp @@ -22,6 +22,7 @@ #include <QFile> #include <QDir> #include <QSettings> +#include <qmmp/soundcore.h> #include "popupwidget.h" #include "notifier.h" @@ -36,24 +37,27 @@ Notifier::Notifier(QObject *parent) m_desktop = settings.value("desktop_notification", TRUE).toBool(); m_psi = settings.value("psi_notification", FALSE).toBool(); settings.endGroup(); + m_core = SoundCore::instance(); + connect (m_core, SIGNAL(metaDataChanged ()), SLOT(showMetaData())); + connect (m_core, SIGNAL(stateChanged (Qmmp::State)), SLOT(setState(Qmmp::State))); } Notifier::~Notifier() {} -void Notifier::setState(const uint &state) +void Notifier::setState(Qmmp::State state) { - switch ((uint) state) + switch ((uint) state) { - case General::Playing: + case Qmmp::Playing: { break; } - case General::Paused: + case Qmmp::Paused: { break; } - case General::Stopped: + case Qmmp::Stopped: { QFile::remove(QDir::homePath()+"/.psi/tune"); break; @@ -61,20 +65,20 @@ void Notifier::setState(const uint &state) } } -void Notifier::setSongInfo(const SongInfo &song) +void Notifier::showMetaData() { if (m_popupWidget) delete m_popupWidget; if(m_desktop) - m_popupWidget = new PopupWidget(song); + m_popupWidget = new PopupWidget(); if(!m_psi) return; QFile file(QDir::homePath()+"/.psi/tune"); //psi file file.open(QIODevice::WriteOnly | QIODevice::Text); - file.write(song.title().toUtf8()+"\n"); - file.write(song.artist().toUtf8()+"\n"); - file.write(song.album().toUtf8()+"\n"); - file.write(QString("%1").arg(song.track()).toUtf8()+"\n"); - file.write(QString("%1").arg(song.length()).toUtf8()+"\n"); + file.write(m_core->metaData(Qmmp::TITLE).toUtf8()+"\n"); + file.write(m_core->metaData(Qmmp::ARTIST).toUtf8()+"\n"); + file.write(m_core->metaData(Qmmp::ALBUM).toUtf8()+"\n"); + file.write(m_core->metaData(Qmmp::TRACK).toUtf8()+"\n"); + file.write(QString("%1").arg(m_core->length()).toUtf8()+"\n"); file.close(); } |
