diff options
| author | trialuser02 <trialuser02@90c681e8-e032-0410-971d-27865f9a5e38> | 2008-12-26 18:14:26 +0000 |
|---|---|---|
| committer | trialuser02 <trialuser02@90c681e8-e032-0410-971d-27865f9a5e38> | 2008-12-26 18:14:26 +0000 |
| commit | 873b67f010d427b16ce575ef77b9ef7873a6d44a (patch) | |
| tree | 4096fecceaab3f1319f74109a91e2e3df1a78da6 /src/plugins/General/notifier/notifier.cpp | |
| parent | 9880f409f19df23715793f120bfe108eb978b57a (diff) | |
| download | qmmp-873b67f010d427b16ce575ef77b9ef7873a6d44a.tar.gz qmmp-873b67f010d427b16ce575ef77b9ef7873a6d44a.tar.bz2 qmmp-873b67f010d427b16ce575ef77b9ef7873a6d44a.zip | |
notification plugin: volume change notification, transparency settings
git-svn-id: http://svn.code.sf.net/p/qmmp-dev/code/trunk/qmmp@712 90c681e8-e032-0410-971d-27865f9a5e38
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; + } +} |
