diff options
Diffstat (limited to 'src/plugins/General/notifier/notifier.cpp')
| -rw-r--r-- | src/plugins/General/notifier/notifier.cpp | 36 |
1 files changed, 29 insertions, 7 deletions
diff --git a/src/plugins/General/notifier/notifier.cpp b/src/plugins/General/notifier/notifier.cpp index 1340c0d5a..5bdba1595 100644 --- a/src/plugins/General/notifier/notifier.cpp +++ b/src/plugins/General/notifier/notifier.cpp @@ -31,15 +31,19 @@ Notifier::Notifier(QObject *parent) : General(parent) { m_popupWidget = 0; + m_l = -1; + m_r = -1; QFile::remove(QDir::homePath()+"/.psi/tune"); QSettings settings(Qmmp::configFile(), QSettings::IniFormat); settings.beginGroup("Notifier"); - m_desktop = settings.value("desktop_notification", TRUE).toBool(); + m_desktop = settings.value("song_notification", TRUE).toBool(); + m_showVolume = settings.value("volume_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))); + connect (m_core, SIGNAL(volumeChanged(int, int)), SLOT(showVolume(int, int))); } Notifier::~Notifier() @@ -47,7 +51,7 @@ Notifier::~Notifier() void Notifier::setState(Qmmp::State state) { - switch ((uint) state) + switch ((uint) state) { case Qmmp::Playing: { @@ -67,11 +71,14 @@ void Notifier::setState(Qmmp::State state) void Notifier::showMetaData() { - if (m_popupWidget) - delete m_popupWidget; - if(m_desktop) - m_popupWidget = new PopupWidget(); - if(!m_psi) + if (m_desktop) + { + if (!m_popupWidget) + m_popupWidget = new PopupWidget(); + m_popupWidget->showMetaData(); + } + + if (!m_psi) return; QFile file(QDir::homePath()+"/.psi/tune"); //psi file file.open(QIODevice::WriteOnly | QIODevice::Text); @@ -82,3 +89,18 @@ void Notifier::showMetaData() file.write(QString("%1").arg(m_core->length()).toUtf8()+"\n"); file.close(); } + +void Notifier::showVolume(int l, int r) +{ + if (((m_l != l) || (m_r != r)) && m_showVolume) + { + if (m_l >= 0) + { + if (!m_popupWidget) + m_popupWidget = new PopupWidget(); + m_popupWidget->showVolume(qMax(l,r)); + } + m_l = l; + m_r = r; + } +} |
