Added Sound Notifications changes by callix, for Friend Connects and Chat Messages, need to be set a *.wav file on Sound Settings.

git-svn-id: http://svn.code.sf.net/p/retroshare/code/trunk@2849 b45a01b8-16f6-495d-af2f-9b41ad6348cc
This commit is contained in:
defnax 2010-05-05 11:47:29 +00:00
parent 8b9b8e9f6b
commit c720a32610
11 changed files with 273 additions and 350 deletions

View file

@ -69,6 +69,8 @@
#include <QHashIterator> #include <QHashIterator>
#include <QDesktopServices> #include <QDesktopServices>
#include <QSound>
/* Images for context menu icons */ /* Images for context menu icons */
#define IMAGE_REMOVEFRIEND ":/images/removefriend16.png" #define IMAGE_REMOVEFRIEND ":/images/removefriend16.png"
#define IMAGE_EXPIORTFRIEND ":/images/exportpeers_16x16.png" #define IMAGE_EXPIORTFRIEND ":/images/exportpeers_16x16.png"
@ -964,6 +966,7 @@ void PeersDialog::insertChat()
{ {
PopupChatDialog *pcd = getPrivateChat(it->rsid, it->name, chatflags); PopupChatDialog *pcd = getPrivateChat(it->rsid, it->name, chatflags);
pcd->addChatMsg(&(*it)); pcd->addChatMsg(&(*it));
playsound();
QApplication::alert(pcd); QApplication::alert(pcd);
continue; continue;
} }
@ -1832,3 +1835,19 @@ void PeersDialog::setCurrentFileName(const QString &fileName)
setWindowModified(false); setWindowModified(false);
} }
////play sound when recv a message
void PeersDialog::playsound(){
_settings = new RshareSettings();
_settings->beginGroup("Sound");
_settings->beginGroup("SoundFilePath");
QString OnlineSound= _settings->value("NewChatMessage","").toString();
_settings->endGroup();
_settings->beginGroup("Enable");
bool flag= _settings->value("NewChatMessage",false).toBool();
_settings->endGroup();
_settings->endGroup();
if(!OnlineSound.isEmpty()&&flag)
if(QSound::isAvailable())
QSound::play(OnlineSound);
}

View file

@ -154,6 +154,9 @@ private:
class QWidget *widget; class QWidget *widget;
class QWidgetAction *widgetAction; class QWidgetAction *widgetAction;
class QSpacerItem *spacerItem; class QSpacerItem *spacerItem;
///play the sound when recv a message
void playsound();
QString fileName; QString fileName;

View file

@ -283,6 +283,7 @@ void NotifyQt::UpdateGUI()
OnlineToaster * onlineToaster = new OnlineToaster(); OnlineToaster * onlineToaster = new OnlineToaster();
onlineToaster->setMessage(QString::fromStdString(realmsg)); onlineToaster->setMessage(QString::fromStdString(realmsg));
onlineToaster->show(); onlineToaster->show();
onlineToaster->play();
} }
break; break;
} }

View file

@ -35,7 +35,7 @@ SoundPage::SoundPage(QWidget * parent, Qt::WFlags flags)
_settings = new RshareSettings(); _settings = new RshareSettings();
connect(ui.cmd_openFile, SIGNAL(clicked(bool) ),this,SLOT(on_cmd_openFile())); connect(ui.cmd_openFile, SIGNAL(clicked(bool) ),this,SLOT(on_cmd_openFile()));
connect(ui.cmd_openFile_2,SIGNAL(clicked(bool) ),this,SLOT(on_cmd_openFile2())); //connect(ui.cmd_openFile_2,SIGNAL(clicked(bool) ),this,SLOT(on_cmd_openFile2()));
connect(ui.cmd_openFile_3,SIGNAL(clicked(bool) ),this,SLOT(on_cmd_openFile3())); connect(ui.cmd_openFile_3,SIGNAL(clicked(bool) ),this,SLOT(on_cmd_openFile3()));
connect(ui.cmd_openFile_4,SIGNAL(clicked(bool) ),this,SLOT(on_cmd_openFile4())); connect(ui.cmd_openFile_4,SIGNAL(clicked(bool) ),this,SLOT(on_cmd_openFile4()));
connect(ui.cmd_openFile_5,SIGNAL(clicked(bool) ),this,SLOT(on_cmd_openFile5())); connect(ui.cmd_openFile_5,SIGNAL(clicked(bool) ),this,SLOT(on_cmd_openFile5()));
@ -54,7 +54,7 @@ SoundPage::save(QString &errmsg)
_settings->beginGroup("Sound"); _settings->beginGroup("Sound");
_settings->beginGroup("Enable"); _settings->beginGroup("Enable");
_settings->setValue("User_go_Online",ui.checkBoxSound->isChecked()); _settings->setValue("User_go_Online",ui.checkBoxSound->isChecked());
_settings->setValue("User_go_Offline",ui.checkBoxSound_2->isChecked()); //_settings->setValue("User_go_Offline",ui.checkBoxSound_2->isChecked());
_settings->setValue("FileSend_Finished",ui.checkBoxSound_3->isChecked()); _settings->setValue("FileSend_Finished",ui.checkBoxSound_3->isChecked());
_settings->setValue("FileRecive_Incoming",ui.checkBoxSound_4->isChecked()); _settings->setValue("FileRecive_Incoming",ui.checkBoxSound_4->isChecked());
_settings->setValue("FileRecive_Finished",ui.checkBoxSound_5->isChecked()); _settings->setValue("FileRecive_Finished",ui.checkBoxSound_5->isChecked());
@ -62,7 +62,7 @@ SoundPage::save(QString &errmsg)
_settings->endGroup(); _settings->endGroup();
_settings->beginGroup("SoundFilePath"); _settings->beginGroup("SoundFilePath");
_settings->setValue("User_go_Online",ui.txt_SoundFile->text()); _settings->setValue("User_go_Online",ui.txt_SoundFile->text());
_settings->setValue("User_go_Offline",ui.txt_SoundFile2->text()); //_settings->setValue("User_go_Offline",ui.txt_SoundFile2->text());
_settings->setValue("FileSend_Finished",ui.txt_SoundFile3->text()); _settings->setValue("FileSend_Finished",ui.txt_SoundFile3->text());
_settings->setValue("FileRecive_Incoming",ui.txt_SoundFile4->text()); _settings->setValue("FileRecive_Incoming",ui.txt_SoundFile4->text());
_settings->setValue("FileRecive_Finished",ui.txt_SoundFile5->text()); _settings->setValue("FileRecive_Finished",ui.txt_SoundFile5->text());
@ -82,14 +82,14 @@ SoundPage::load()
_settings->beginGroup("Sound"); _settings->beginGroup("Sound");
_settings->beginGroup("SoundFilePath"); _settings->beginGroup("SoundFilePath");
ui.txt_SoundFile->setText(_settings->value("User_go_Online","").toString()); ui.txt_SoundFile->setText(_settings->value("User_go_Online","").toString());
ui.txt_SoundFile2->setText(_settings->value("User_go_Offline","").toString()); //ui.txt_SoundFile2->setText(_settings->value("User_go_Offline","").toString());
ui.txt_SoundFile3->setText(_settings->value("FileSend_Finished","").toString()); ui.txt_SoundFile3->setText(_settings->value("FileSend_Finished","").toString());
ui.txt_SoundFile4->setText(_settings->value("FileRecive_Incoming","").toString()); ui.txt_SoundFile4->setText(_settings->value("FileRecive_Incoming","").toString());
ui.txt_SoundFile5->setText(_settings->value("FileRecive_Finished","").toString()); ui.txt_SoundFile5->setText(_settings->value("FileRecive_Finished","").toString());
ui.txt_SoundFile6->setText(_settings->value("NewChatMessage","").toString()); ui.txt_SoundFile6->setText(_settings->value("NewChatMessage","").toString());
if(!ui.txt_SoundFile->text().isEmpty())ui.checkBoxSound->setEnabled(true); if(!ui.txt_SoundFile->text().isEmpty())ui.checkBoxSound->setEnabled(true);
if(!ui.txt_SoundFile2->text().isEmpty())ui.checkBoxSound_2->setEnabled(true); //if(!ui.txt_SoundFile2->text().isEmpty())ui.checkBoxSound_2->setEnabled(true);
if(!ui.txt_SoundFile3->text().isEmpty())ui.checkBoxSound_3->setEnabled(true); if(!ui.txt_SoundFile3->text().isEmpty())ui.checkBoxSound_3->setEnabled(true);
if(!ui.txt_SoundFile4->text().isEmpty())ui.checkBoxSound_4->setEnabled(true); if(!ui.txt_SoundFile4->text().isEmpty())ui.checkBoxSound_4->setEnabled(true);
if(!ui.txt_SoundFile5->text().isEmpty())ui.checkBoxSound_5->setEnabled(true); if(!ui.txt_SoundFile5->text().isEmpty())ui.checkBoxSound_5->setEnabled(true);
@ -99,7 +99,7 @@ SoundPage::load()
_settings->beginGroup("Enable"); _settings->beginGroup("Enable");
ui.checkBoxSound->setChecked(_settings->value("User_go_Online",false).toBool()); ui.checkBoxSound->setChecked(_settings->value("User_go_Online",false).toBool());
ui.checkBoxSound_2->setChecked(_settings->value("User_go_Offline",false).toBool()); //ui.checkBoxSound_2->setChecked(_settings->value("User_go_Offline",false).toBool());
ui.checkBoxSound_3->setChecked(_settings->value("FileSend_Finished",false).toBool()); ui.checkBoxSound_3->setChecked(_settings->value("FileSend_Finished",false).toBool());
ui.checkBoxSound_4->setChecked(_settings->value("FileRecive_Incoming",false).toBool()); ui.checkBoxSound_4->setChecked(_settings->value("FileRecive_Incoming",false).toBool());
ui.checkBoxSound_5->setChecked(_settings->value("FileRecive_Finished",false).toBool()); ui.checkBoxSound_5->setChecked(_settings->value("FileRecive_Finished",false).toBool());
@ -120,7 +120,7 @@ void SoundPage::on_cmd_openFile()
ui.checkBoxSound->setEnabled(true); ui.checkBoxSound->setEnabled(true);
} }
void SoundPage::on_cmd_openFile2() /*void SoundPage::on_cmd_openFile2()
{ {
ui.txt_SoundFile2->setText(QFileDialog::getOpenFileName(this,"Open File", ".", "wav (*.wav)")); ui.txt_SoundFile2->setText(QFileDialog::getOpenFileName(this,"Open File", ".", "wav (*.wav)"));
if(ui.txt_SoundFile2->text().isEmpty()){ if(ui.txt_SoundFile2->text().isEmpty()){
@ -130,7 +130,7 @@ void SoundPage::on_cmd_openFile2()
else else
ui.checkBoxSound_2->setEnabled(true); ui.checkBoxSound_2->setEnabled(true);
} }*/
void SoundPage::on_cmd_openFile3() void SoundPage::on_cmd_openFile3()
{ {
ui.txt_SoundFile3->setText(QFileDialog::getOpenFileName(this,"Open File", ".", "wav (*.wav)")); ui.txt_SoundFile3->setText(QFileDialog::getOpenFileName(this,"Open File", ".", "wav (*.wav)"));

View file

@ -47,7 +47,7 @@ public:
private slots: private slots:
void on_cmd_openFile(); void on_cmd_openFile();
void on_cmd_openFile2(); //void on_cmd_openFile2();
void on_cmd_openFile3(); void on_cmd_openFile3();
void on_cmd_openFile4(); void on_cmd_openFile4();
void on_cmd_openFile5(); void on_cmd_openFile5();

View file

@ -6,8 +6,8 @@
<rect> <rect>
<x>0</x> <x>0</x>
<y>0</y> <y>0</y>
<width>468</width> <width>463</width>
<height>407</height> <height>370</height>
</rect> </rect>
</property> </property>
<property name="palette"> <property name="palette">
@ -499,316 +499,185 @@
<property name="title"> <property name="title">
<string>Sound Events</string> <string>Sound Events</string>
</property> </property>
<widget class="QGroupBox" name="groupBox_12"> <layout class="QGridLayout" name="gridLayout_6">
<property name="geometry"> <item row="0" column="0">
<rect> <widget class="QGroupBox" name="groupBox_12">
<x>10</x> <property name="title">
<y>20</y> <string>User</string>
<width>421</width> </property>
<height>81</height> <layout class="QGridLayout" name="gridLayout_5">
</rect> <item row="0" column="0">
</property> <widget class="QCheckBox" name="checkBoxSound">
<property name="title"> <property name="enabled">
<string>User</string> <bool>false</bool>
</property> </property>
<widget class="QCheckBox" name="checkBoxSound"> <property name="text">
<property name="enabled"> <string>go Online</string>
<bool>false</bool> </property>
</property> </widget>
<property name="geometry"> </item>
<rect> <item row="0" column="1">
<x>10</x> <widget class="QLineEdit" name="txt_SoundFile">
<y>20</y> <property name="enabled">
<width>80</width> <bool>false</bool>
<height>23</height> </property>
</rect> </widget>
</property> </item>
<property name="text"> <item row="0" column="2">
<string>go Online</string> <widget class="QPushButton" name="cmd_openFile">
</property> <property name="text">
</widget> <string>Browse</string>
<widget class="QCheckBox" name="checkBoxSound_2"> </property>
<property name="enabled"> </widget>
<bool>false</bool> </item>
</property> </layout>
<property name="geometry"> </widget>
<rect> </item>
<x>10</x> <item row="1" column="0">
<y>50</y> <widget class="QGroupBox" name="groupBox_15">
<width>80</width> <property name="title">
<height>23</height> <string>Chatmessage</string>
</rect> </property>
</property> <layout class="QGridLayout" name="gridLayout_4">
<property name="text"> <item row="0" column="0">
<string>go Offline</string> <widget class="QCheckBox" name="checkBoxSound_6">
</property> <property name="enabled">
</widget> <bool>false</bool>
<widget class="QLineEdit" name="txt_SoundFile"> </property>
<property name="enabled"> <property name="text">
<bool>false</bool> <string>New Msg</string>
</property> </property>
<property name="geometry"> </widget>
<rect> </item>
<x>90</x> <item row="0" column="1">
<y>20</y> <widget class="QLineEdit" name="txt_SoundFile6">
<width>281</width> <property name="enabled">
<height>24</height> <bool>false</bool>
</rect> </property>
</property> </widget>
</widget> </item>
<widget class="QLineEdit" name="txt_SoundFile2"> <item row="0" column="2">
<property name="enabled"> <widget class="QPushButton" name="cmd_openFile_6">
<bool>false</bool> <property name="text">
</property> <string>Browse</string>
<property name="geometry"> </property>
<rect> </widget>
<x>90</x> </item>
<y>50</y> </layout>
<width>281</width> </widget>
<height>24</height> </item>
</rect> <item row="2" column="0">
</property> <widget class="QGroupBox" name="groupBox_13">
</widget> <property name="title">
<widget class="QPushButton" name="cmd_openFile"> <string>FileSend</string>
<property name="geometry"> </property>
<rect> <layout class="QGridLayout" name="gridLayout_3">
<x>380</x> <item row="0" column="0">
<y>20</y> <widget class="QCheckBox" name="checkBoxSound_3">
<width>31</width> <property name="enabled">
<height>21</height> <bool>false</bool>
</rect> </property>
</property> <property name="text">
<property name="text"> <string>Finished</string>
<string>...</string> </property>
</property> </widget>
</widget> </item>
<widget class="QPushButton" name="cmd_openFile_2"> <item row="0" column="1">
<property name="geometry"> <widget class="QLineEdit" name="txt_SoundFile3">
<rect> <property name="enabled">
<x>380</x> <bool>false</bool>
<y>50</y> </property>
<width>31</width> </widget>
<height>21</height> </item>
</rect> <item row="0" column="2">
</property> <widget class="QPushButton" name="cmd_openFile_3">
<property name="text"> <property name="text">
<string>...</string> <string>Brose</string>
</property> </property>
</widget> </widget>
</widget> </item>
<widget class="QGroupBox" name="groupBox_13"> </layout>
<property name="geometry"> <zorder>txt_SoundFile3</zorder>
<rect> <zorder>cmd_openFile_3</zorder>
<x>10</x> <zorder>checkBoxSound_3</zorder>
<y>100</y> <zorder>groupBox_15</zorder>
<width>421</width> </widget>
<height>61</height> </item>
</rect> <item row="3" column="0">
</property> <widget class="QGroupBox" name="groupBox_14">
<property name="title"> <property name="title">
<string>FileSend</string> <string>FileRecive</string>
</property> </property>
<widget class="QLineEdit" name="txt_SoundFile3"> <layout class="QGridLayout" name="gridLayout_2">
<property name="enabled"> <item row="0" column="0">
<bool>false</bool> <widget class="QCheckBox" name="checkBoxSound_4">
</property> <property name="enabled">
<property name="geometry"> <bool>false</bool>
<rect> </property>
<x>90</x> <property name="text">
<y>20</y> <string>Incoming</string>
<width>281</width> </property>
<height>24</height> </widget>
</rect> </item>
</property> <item row="0" column="1">
</widget> <widget class="QLineEdit" name="txt_SoundFile4">
<widget class="QPushButton" name="cmd_openFile_3"> <property name="enabled">
<property name="geometry"> <bool>false</bool>
<rect> </property>
<x>380</x> </widget>
<y>20</y> </item>
<width>31</width> <item row="0" column="2">
<height>21</height> <widget class="QPushButton" name="cmd_openFile_4">
</rect> <property name="text">
</property> <string>Browse</string>
<property name="text"> </property>
<string>...</string> </widget>
</property> </item>
</widget> <item row="1" column="0">
<widget class="QCheckBox" name="checkBoxSound_3"> <widget class="QCheckBox" name="checkBoxSound_5">
<property name="enabled"> <property name="enabled">
<bool>false</bool> <bool>false</bool>
</property> </property>
<property name="geometry"> <property name="text">
<rect> <string>Finished</string>
<x>10</x> </property>
<y>20</y> </widget>
<width>80</width> </item>
<height>23</height> <item row="1" column="1">
</rect> <widget class="QLineEdit" name="txt_SoundFile5">
</property> <property name="enabled">
<property name="text"> <bool>false</bool>
<string>Finished</string> </property>
</property> </widget>
</widget> </item>
</widget> <item row="1" column="2">
<widget class="QGroupBox" name="groupBox_14"> <widget class="QPushButton" name="cmd_openFile_5">
<property name="geometry"> <property name="text">
<rect> <string>Browse</string>
<x>10</x> </property>
<y>160</y> </widget>
<width>421</width> </item>
<height>91</height> </layout>
</rect> </widget>
</property> </item>
<property name="title"> <item row="4" column="0">
<string>FileRecive</string> <spacer name="verticalSpacer">
</property> <property name="orientation">
<widget class="QCheckBox" name="checkBoxSound_4"> <enum>Qt::Vertical</enum>
<property name="enabled"> </property>
<bool>false</bool> <property name="sizeHint" stdset="0">
</property> <size>
<property name="geometry"> <width>20</width>
<rect> <height>29</height>
<x>10</x> </size>
<y>20</y> </property>
<width>80</width> </spacer>
<height>23</height> </item>
</rect> </layout>
</property>
<property name="text">
<string>Incoming</string>
</property>
</widget>
<widget class="QLineEdit" name="txt_SoundFile4">
<property name="enabled">
<bool>false</bool>
</property>
<property name="geometry">
<rect>
<x>90</x>
<y>20</y>
<width>281</width>
<height>24</height>
</rect>
</property>
</widget>
<widget class="QPushButton" name="cmd_openFile_4">
<property name="geometry">
<rect>
<x>380</x>
<y>20</y>
<width>31</width>
<height>21</height>
</rect>
</property>
<property name="text">
<string>...</string>
</property>
</widget>
<widget class="QPushButton" name="cmd_openFile_5">
<property name="geometry">
<rect>
<x>380</x>
<y>50</y>
<width>31</width>
<height>21</height>
</rect>
</property>
<property name="text">
<string>...</string>
</property>
</widget>
<widget class="QCheckBox" name="checkBoxSound_5">
<property name="enabled">
<bool>false</bool>
</property>
<property name="geometry">
<rect>
<x>10</x>
<y>50</y>
<width>80</width>
<height>23</height>
</rect>
</property>
<property name="text">
<string>Finished</string>
</property>
</widget>
<widget class="QLineEdit" name="txt_SoundFile5">
<property name="enabled">
<bool>false</bool>
</property>
<property name="geometry">
<rect>
<x>90</x>
<y>50</y>
<width>281</width>
<height>24</height>
</rect>
</property>
</widget>
</widget>
<widget class="QGroupBox" name="groupBox_15">
<property name="geometry">
<rect>
<x>10</x>
<y>260</y>
<width>421</width>
<height>111</height>
</rect>
</property>
<property name="title">
<string>Chatmessage</string>
</property>
<widget class="QPushButton" name="cmd_openFile_6">
<property name="geometry">
<rect>
<x>380</x>
<y>20</y>
<width>31</width>
<height>21</height>
</rect>
</property>
<property name="text">
<string>...</string>
</property>
</widget>
<widget class="QCheckBox" name="checkBoxSound_6">
<property name="enabled">
<bool>false</bool>
</property>
<property name="geometry">
<rect>
<x>10</x>
<y>20</y>
<width>80</width>
<height>23</height>
</rect>
</property>
<property name="text">
<string>New</string>
</property>
</widget>
<widget class="QLineEdit" name="txt_SoundFile6">
<property name="enabled">
<bool>false</bool>
</property>
<property name="geometry">
<rect>
<x>90</x>
<y>20</y>
<width>281</width>
<height>24</height>
</rect>
</property>
</widget>
</widget>
</widget> </widget>
</item> </item>
</layout> </layout>
</widget> </widget>
<resources> <resources/>
<include location="../images.qrc"/>
</resources>
<connections/> <connections/>
</ui> </ui>

View file

@ -107,10 +107,10 @@ RSettingsWin::initStackedWidget()
stackedWidget->addWidget(new CryptoPage()); stackedWidget->addWidget(new CryptoPage());
stackedWidget->addWidget(new ChatPage()); stackedWidget->addWidget(new ChatPage());
stackedWidget->addWidget(new AppearancePage()); stackedWidget->addWidget(new AppearancePage());
#ifndef RS_RELEASE_VERSION // #ifndef RS_RELEASE_VERSION
stackedWidget->addWidget(new FileAssociationsPage() ); // stackedWidget->addWidget(new FileAssociationsPage() );
stackedWidget->addWidget(new SoundPage() ); stackedWidget->addWidget(new SoundPage() );
#endif // #endif
loadSettings(); /* load saved settings */ loadSettings(); /* load saved settings */
@ -156,16 +156,16 @@ RSettingsWin::setNewPage(int page)
text = tr("Appearance"); text = tr("Appearance");
pageicon->setPixmap(QPixmap(":/images/looknfeel.png")); pageicon->setPixmap(QPixmap(":/images/looknfeel.png"));
break; break;
#ifndef RS_RELEASE_VERSION /*// #ifndef RS_RELEASE_VERSION
case Fileassociations: case Fileassociations:
text = tr("File Associations"); text = tr("File Associations");
pageicon->setPixmap(QPixmap(":/images/filetype-association.png")); pageicon->setPixmap(QPixmap(":/images/filetype-association.png"));
break; break;*/
case Sound: case Sound:
text = tr("Sound"); text = tr("Sound");
pageicon->setPixmap(QPixmap(":/images/sound.png")); pageicon->setPixmap(QPixmap(":/images/sound.png"));
break; break;
#endif // #endif
default: default:
text = tr("UnknownPage");// impossible case text = tr("UnknownPage");// impossible case
} }

View file

@ -32,7 +32,7 @@ class RSettingsWin: public QDialog, private Ui::Settings
public: public:
enum PageType { General = 0, Server, Transfer, enum PageType { General = 0, Server, Transfer,
Directories, Notify, Security, Chat, Appearance, Fileassociations, Sound }; Directories, Notify, Security, Chat, Appearance, Sound,Fileassociations };
static void showYourself(QWidget *parent); static void showYourself(QWidget *parent);
static void postModDirectories(bool update_local); static void postModDirectories(bool update_local);

View file

@ -149,6 +149,15 @@
<normaloff>:/images/looknfeel.png</normaloff>:/images/looknfeel.png</iconset> <normaloff>:/images/looknfeel.png</normaloff>:/images/looknfeel.png</iconset>
</property> </property>
</item> </item>
<item>
<property name="text">
<string>Sound</string>
</property>
<property name="icon">
<iconset resource="../images.qrc">
<normaloff>:/images/sound.png</normaloff>:/images/sound.png</iconset>
</property>
</item>
</widget> </widget>
</item> </item>
<item row="0" column="1"> <item row="0" column="1">

View file

@ -65,3 +65,21 @@ void OnlineToaster::chatButtonSlot() {
chatButtonClicked(); chatButtonClicked();
close(); close();
} }
void OnlineToaster::play(){
_settings = new RshareSettings();
_settings->beginGroup("Sound");
_settings->beginGroup("SoundFilePath");
QString OnlineSound= _settings->value("User_go_Online","").toString();
_settings->endGroup();
_settings->beginGroup("Enable");
bool flag= _settings->value("User_go_Online",false).toBool();
_settings->endGroup();
_settings->endGroup();
if(!OnlineSound.isEmpty()&&flag)
if(QSound::isAvailable())
QSound::play(OnlineSound);
// delete _settings;
}

View file

@ -16,57 +16,61 @@
* along with this program; if not, write to the Free Software * along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/ */
#ifndef ONLINETOASTER_H #ifndef ONLINETOASTER_H
#define ONLINETOASTER_H #define ONLINETOASTER_H
#include "IQtToaster.h" #include "IQtToaster.h"
#include <gui/settings/rsharesettings.h>
#include <QtCore/QObject> #include <QtCore/QObject>
#include <QSound>
class QtToaster; class QtToaster;
class QWidget; class QWidget;
class QString; class QString;
class QPixmap; class QPixmap;
namespace Ui { class OnlineToaster; } namespace Ui { class OnlineToaster; }
/** /**
* Shows a toaster when friend is Online . * Shows a toaster when friend is Online .
* *
* *
*/ */
class OnlineToaster : public QObject, public IQtToaster { class OnlineToaster : public QObject, public IQtToaster {
Q_OBJECT Q_OBJECT
public: public:
OnlineToaster(); OnlineToaster();
~OnlineToaster(); ~OnlineToaster();
void setMessage(const QString & message); void setMessage(const QString & message);
void setPixmap(const QPixmap & pixmap); void setPixmap(const QPixmap & pixmap);
void show(); void show();
void play();
Q_SIGNALS:
Q_SIGNALS:
void chatButtonClicked();
void chatButtonClicked();
private Q_SLOTS: private Q_SLOTS:
void chatButtonSlot(); void chatButtonSlot();
void close(); void close();
private:
Ui::OnlineToaster * _ui; private:
RshareSettings* _settings;
QWidget * _onlineToasterWidget; Ui::OnlineToaster * _ui;
QtToaster * _toaster; QWidget * _onlineToasterWidget;
};
QtToaster * _toaster;
#endif //MESSAGETOASTER_H };
#endif //MESSAGETOASTER_H