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 <QDesktopServices>
#include <QSound>
/* Images for context menu icons */
#define IMAGE_REMOVEFRIEND ":/images/removefriend16.png"
#define IMAGE_EXPIORTFRIEND ":/images/exportpeers_16x16.png"
@ -964,6 +966,7 @@ void PeersDialog::insertChat()
{
PopupChatDialog *pcd = getPrivateChat(it->rsid, it->name, chatflags);
pcd->addChatMsg(&(*it));
playsound();
QApplication::alert(pcd);
continue;
}
@ -1832,3 +1835,19 @@ void PeersDialog::setCurrentFileName(const QString &fileName)
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);
}