aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authortrialuser02 <trialuser02@90c681e8-e032-0410-971d-27865f9a5e38>2008-03-07 20:40:21 +0000
committertrialuser02 <trialuser02@90c681e8-e032-0410-971d-27865f9a5e38>2008-03-07 20:40:21 +0000
commit235db3c44f6ff072a055ab67231c017344a969f5 (patch)
treedbb95355b739410a76ae5ff402301f8dd418a19f
parent892d61b4dc43869940959a82197d865390c04509 (diff)
downloadqmmp-235db3c44f6ff072a055ab67231c017344a969f5.tar.gz
qmmp-235db3c44f6ff072a055ab67231c017344a969f5.tar.bz2
qmmp-235db3c44f6ff072a055ab67231c017344a969f5.zip
psi now playing notification support
git-svn-id: http://svn.code.sf.net/p/qmmp-dev/code/trunk/qmmp@264 90c681e8-e032-0410-971d-27865f9a5e38
-rw-r--r--src/plugins/General/notifier/notifier.cpp27
-rw-r--r--src/plugins/General/notifier/notifier.h2
-rw-r--r--src/plugins/General/notifier/notifierfactory.cpp2
-rw-r--r--src/plugins/General/notifier/settingsdialog.cpp4
-rw-r--r--src/plugins/General/notifier/settingsdialog.ui300
5 files changed, 195 insertions, 140 deletions
diff --git a/src/plugins/General/notifier/notifier.cpp b/src/plugins/General/notifier/notifier.cpp
index 2c2c53ae4..9f6006366 100644
--- a/src/plugins/General/notifier/notifier.cpp
+++ b/src/plugins/General/notifier/notifier.cpp
@@ -19,6 +19,9 @@
***************************************************************************/
#include <QTimer>
+#include <QFile>
+#include <QDir>
+#include <QSettings>
#include "popupwidget.h"
#include "notifier.h"
@@ -26,7 +29,13 @@
Notifier::Notifier(QObject *parent)
: General(parent)
{
- m_popupWidget = 0;
+ m_popupWidget = 0;
+ QFile::remove(QDir::homePath()+"/.psi/tune");
+ QSettings settings(QDir::homePath()+"/.qmmp/qmmprc", QSettings::IniFormat);
+ settings.beginGroup("Notifier");
+ m_desktop = settings.value("desktop_notification", TRUE).toBool();
+ m_psi = settings.value("psi_notification", FALSE).toBool();
+ settings.endGroup();
}
Notifier::~Notifier()
@@ -46,6 +55,7 @@ void Notifier::setState(const uint &state)
}
case General::Stopped:
{
+ QFile::remove(QDir::homePath()+"/.psi/tune");
break;
}
}
@@ -53,7 +63,18 @@ void Notifier::setState(const uint &state)
void Notifier::setSongInfo(const SongInfo &song)
{
- if(m_popupWidget)
+ if (m_popupWidget)
delete m_popupWidget;
- m_popupWidget = new PopupWidget(song);
+ if(m_desktop)
+ m_popupWidget = new PopupWidget(song);
+ 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.close();
}
diff --git a/src/plugins/General/notifier/notifier.h b/src/plugins/General/notifier/notifier.h
index d2d2f706f..cc93b2ea5 100644
--- a/src/plugins/General/notifier/notifier.h
+++ b/src/plugins/General/notifier/notifier.h
@@ -43,6 +43,8 @@ public:
private:
QPointer<PopupWidget> m_popupWidget;
+ bool m_desktop;
+ bool m_psi;
};
diff --git a/src/plugins/General/notifier/notifierfactory.cpp b/src/plugins/General/notifier/notifierfactory.cpp
index d99a11064..708c1e1dd 100644
--- a/src/plugins/General/notifier/notifierfactory.cpp
+++ b/src/plugins/General/notifier/notifierfactory.cpp
@@ -46,7 +46,7 @@ QDialog *NotifierFactory::createConfigDialog(QWidget *parent)
void NotifierFactory::showAbout(QWidget *parent)
{
QMessageBox::about (parent, tr("About Notifier Plugin"),
- tr("Qmmp Desktop Notifier Plugin")+"\n"+
+ tr("Qmmp Notifier Plugin")+"\n"+
tr("Writen by: Ilya Kotov <forkotov02@hotmail.ru>"));
}
diff --git a/src/plugins/General/notifier/settingsdialog.cpp b/src/plugins/General/notifier/settingsdialog.cpp
index a460d5af9..3899216ec 100644
--- a/src/plugins/General/notifier/settingsdialog.cpp
+++ b/src/plugins/General/notifier/settingsdialog.cpp
@@ -44,6 +44,8 @@ SettingsDialog::SettingsDialog(QWidget *parent)
ui.messageDelaySpinBox->setValue(settings.value("message_delay", 2000).toInt());
uint pos = settings.value("message_pos", PopupWidget::BOTTOMLEFT).toUInt();
m_buttons.value(pos)->setChecked(TRUE);
+ ui.psiCheckBox->setChecked(settings.value("psi_notification", FALSE).toBool());
+ ui.desktopCheckBox->setChecked(settings.value("desktop_notification", TRUE).toBool());
settings.endGroup();
connect(ui.okButton, SIGNAL(clicked()), SLOT(writeSettings()));
}
@@ -64,6 +66,8 @@ void SettingsDialog::writeSettings()
pos = m_buttons.key(button);
}
settings.setValue("message_pos", pos);
+ settings.setValue("psi_notification", ui.psiCheckBox->isChecked());
+ settings.setValue("desktop_notification", ui.desktopCheckBox->isChecked());
settings.endGroup();
accept();
}
diff --git a/src/plugins/General/notifier/settingsdialog.ui b/src/plugins/General/notifier/settingsdialog.ui
index db6a1ec24..063329379 100644
--- a/src/plugins/General/notifier/settingsdialog.ui
+++ b/src/plugins/General/notifier/settingsdialog.ui
@@ -5,8 +5,8 @@
<rect>
<x>0</x>
<y>0</y>
- <width>268</width>
- <height>273</height>
+ <width>278</width>
+ <height>355</height>
</rect>
</property>
<property name="windowTitle" >
@@ -14,172 +14,200 @@
</property>
<layout class="QVBoxLayout" >
<item>
- <widget class="QGroupBox" name="groupBox_4" >
+ <widget class="QGroupBox" name="groupBox_2" >
<property name="title" >
- <string>General</string>
+ <string>Psi Notification</string>
</property>
- <widget class="QLabel" name="label_3" >
- <property name="geometry" >
- <rect>
- <x>10</x>
- <y>30</y>
- <width>141</width>
- <height>23</height>
- </rect>
- </property>
- <property name="text" >
- <string>Message delay, ms:</string>
- </property>
- <property name="alignment" >
- <set>Qt::AlignLeading|Qt::AlignLeft|Qt::AlignVCenter</set>
- </property>
- </widget>
- <widget class="QSpinBox" name="messageDelaySpinBox" >
- <property name="geometry" >
- <rect>
- <x>140</x>
- <y>30</y>
- <width>71</width>
- <height>23</height>
- </rect>
- </property>
- <property name="minimum" >
- <number>100</number>
- </property>
- <property name="maximum" >
- <number>10000</number>
- </property>
- <property name="singleStep" >
- <number>100</number>
- </property>
- <property name="value" >
- <number>1000</number>
- </property>
- </widget>
+ <layout class="QVBoxLayout" >
+ <item>
+ <widget class="QCheckBox" name="psiCheckBox" >
+ <property name="text" >
+ <string>Enable Psi notification</string>
+ </property>
+ </widget>
+ </item>
+ </layout>
</widget>
</item>
<item>
<widget class="QGroupBox" name="groupBox" >
<property name="title" >
- <string>Position</string>
+ <string>Desktop Notification</string>
</property>
<layout class="QGridLayout" >
- <item row="0" column="0" >
- <widget class="QPushButton" name="topLeftButton" >
- <property name="text" >
- <string/>
- </property>
- <property name="checkable" >
- <bool>true</bool>
- </property>
- <property name="autoExclusive" >
- <bool>true</bool>
- </property>
- </widget>
- </item>
- <item row="0" column="1" >
- <widget class="QPushButton" name="topButton" >
- <property name="text" >
- <string/>
- </property>
- <property name="checkable" >
- <bool>true</bool>
- </property>
- <property name="autoExclusive" >
- <bool>true</bool>
- </property>
- </widget>
- </item>
- <item row="0" column="2" >
- <widget class="QPushButton" name="topRightButton" >
+ <item row="0" column="0" colspan="2" >
+ <widget class="QCheckBox" name="desktopCheckBox" >
<property name="text" >
- <string/>
- </property>
- <property name="checkable" >
- <bool>true</bool>
- </property>
- <property name="autoExclusive" >
- <bool>true</bool>
+ <string>Enable desktop notification</string>
</property>
</widget>
</item>
<item row="1" column="0" >
- <widget class="QPushButton" name="leftButton" >
+ <widget class="QLabel" name="label_3" >
<property name="text" >
- <string/>
- </property>
- <property name="checkable" >
- <bool>true</bool>
+ <string>Message delay, ms:</string>
</property>
- <property name="autoExclusive" >
- <bool>true</bool>
+ <property name="alignment" >
+ <set>Qt::AlignLeading|Qt::AlignLeft|Qt::AlignVCenter</set>
</property>
</widget>
</item>
- <item row="1" column="2" >
- <widget class="QPushButton" name="rightButton" >
- <property name="text" >
- <string/>
- </property>
- <property name="checkable" >
- <bool>true</bool>
- </property>
- <property name="autoExclusive" >
- <bool>true</bool>
+ <item row="1" column="1" >
+ <widget class="QSpinBox" name="messageDelaySpinBox" >
+ <property name="minimum" >
+ <number>100</number>
</property>
- </widget>
- </item>
- <item row="2" column="0" >
- <widget class="QPushButton" name="bottomLeftButton" >
- <property name="text" >
- <string/>
+ <property name="maximum" >
+ <number>10000</number>
</property>
- <property name="checkable" >
- <bool>true</bool>
+ <property name="singleStep" >
+ <number>100</number>
</property>
- <property name="autoExclusive" >
- <bool>true</bool>
+ <property name="value" >
+ <number>1000</number>
</property>
</widget>
</item>
- <item row="2" column="1" >
- <widget class="QPushButton" name="bottomButton" >
+ <item row="2" column="0" >
+ <widget class="QLabel" name="label" >
<property name="text" >
- <string/>
- </property>
- <property name="checkable" >
- <bool>true</bool>
- </property>
- <property name="autoExclusive" >
- <bool>true</bool>
+ <string>Position</string>
</property>
</widget>
</item>
- <item row="2" column="2" >
- <widget class="QPushButton" name="bottomRightButton" >
- <property name="text" >
- <string/>
- </property>
- <property name="checkable" >
- <bool>true</bool>
- </property>
- <property name="autoExclusive" >
- <bool>true</bool>
- </property>
- </widget>
+ <item row="3" column="0" >
+ <layout class="QGridLayout" >
+ <item row="0" column="0" >
+ <widget class="QPushButton" name="topLeftButton" >
+ <property name="text" >
+ <string/>
+ </property>
+ <property name="checkable" >
+ <bool>true</bool>
+ </property>
+ <property name="autoExclusive" >
+ <bool>true</bool>
+ </property>
+ </widget>
+ </item>
+ <item row="0" column="1" >
+ <widget class="QPushButton" name="topButton" >
+ <property name="text" >
+ <string/>
+ </property>
+ <property name="checkable" >
+ <bool>true</bool>
+ </property>
+ <property name="autoExclusive" >
+ <bool>true</bool>
+ </property>
+ </widget>
+ </item>
+ <item row="0" column="2" >
+ <widget class="QPushButton" name="topRightButton" >
+ <property name="text" >
+ <string/>
+ </property>
+ <property name="checkable" >
+ <bool>true</bool>
+ </property>
+ <property name="autoExclusive" >
+ <bool>true</bool>
+ </property>
+ </widget>
+ </item>
+ <item row="1" column="0" >
+ <widget class="QPushButton" name="leftButton" >
+ <property name="text" >
+ <string/>
+ </property>
+ <property name="checkable" >
+ <bool>true</bool>
+ </property>
+ <property name="autoExclusive" >
+ <bool>true</bool>
+ </property>
+ </widget>
+ </item>
+ <item row="1" column="1" >
+ <widget class="QPushButton" name="centerButton" >
+ <property name="text" >
+ <string/>
+ </property>
+ <property name="checkable" >
+ <bool>true</bool>
+ </property>
+ <property name="autoExclusive" >
+ <bool>true</bool>
+ </property>
+ </widget>
+ </item>
+ <item row="1" column="2" >
+ <widget class="QPushButton" name="rightButton" >
+ <property name="text" >
+ <string/>
+ </property>
+ <property name="checkable" >
+ <bool>true</bool>
+ </property>
+ <property name="autoExclusive" >
+ <bool>true</bool>
+ </property>
+ </widget>
+ </item>
+ <item row="2" column="0" >
+ <widget class="QPushButton" name="bottomLeftButton" >
+ <property name="text" >
+ <string/>
+ </property>
+ <property name="checkable" >
+ <bool>true</bool>
+ </property>
+ <property name="autoExclusive" >
+ <bool>true</bool>
+ </property>
+ </widget>
+ </item>
+ <item row="2" column="1" >
+ <widget class="QPushButton" name="bottomButton" >
+ <property name="text" >
+ <string/>
+ </property>
+ <property name="checkable" >
+ <bool>true</bool>
+ </property>
+ <property name="autoExclusive" >
+ <bool>true</bool>
+ </property>
+ </widget>
+ </item>
+ <item row="2" column="2" >
+ <widget class="QPushButton" name="bottomRightButton" >
+ <property name="text" >
+ <string/>
+ </property>
+ <property name="checkable" >
+ <bool>true</bool>
+ </property>
+ <property name="autoExclusive" >
+ <bool>true</bool>
+ </property>
+ </widget>
+ </item>
+ </layout>
</item>
- <item row="1" column="1" >
- <widget class="QPushButton" name="centerButton" >
- <property name="text" >
- <string/>
+ <item row="3" column="1" >
+ <spacer>
+ <property name="orientation" >
+ <enum>Qt::Horizontal</enum>
</property>
- <property name="checkable" >
- <bool>true</bool>
+ <property name="sizeHint" >
+ <size>
+ <width>40</width>
+ <height>20</height>
+ </size>
</property>
- <property name="autoExclusive" >
- <bool>true</bool>
- </property>
- </widget>
+ </spacer>
</item>
</layout>
</widget>