diff --git a/retroshare-gui/src/gui/PeersDialog.cpp b/retroshare-gui/src/gui/PeersDialog.cpp index febd6ef5b..bf6d3b6af 100644 --- a/retroshare-gui/src/gui/PeersDialog.cpp +++ b/retroshare-gui/src/gui/PeersDialog.cpp @@ -69,6 +69,8 @@ #include #include +#include + /* 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); +} diff --git a/retroshare-gui/src/gui/PeersDialog.h b/retroshare-gui/src/gui/PeersDialog.h index 1f5c70c68..20dd5b253 100644 --- a/retroshare-gui/src/gui/PeersDialog.h +++ b/retroshare-gui/src/gui/PeersDialog.h @@ -154,6 +154,9 @@ private: class QWidget *widget; class QWidgetAction *widgetAction; class QSpacerItem *spacerItem; + + ///play the sound when recv a message + void playsound(); QString fileName; diff --git a/retroshare-gui/src/gui/notifyqt.cpp b/retroshare-gui/src/gui/notifyqt.cpp index 6845e5d88..0fa71de56 100644 --- a/retroshare-gui/src/gui/notifyqt.cpp +++ b/retroshare-gui/src/gui/notifyqt.cpp @@ -283,6 +283,7 @@ void NotifyQt::UpdateGUI() OnlineToaster * onlineToaster = new OnlineToaster(); onlineToaster->setMessage(QString::fromStdString(realmsg)); onlineToaster->show(); + onlineToaster->play(); } break; } diff --git a/retroshare-gui/src/gui/settings/SoundPage.cpp b/retroshare-gui/src/gui/settings/SoundPage.cpp index fbd658720..9811bf810 100644 --- a/retroshare-gui/src/gui/settings/SoundPage.cpp +++ b/retroshare-gui/src/gui/settings/SoundPage.cpp @@ -35,7 +35,7 @@ SoundPage::SoundPage(QWidget * parent, Qt::WFlags flags) _settings = new RshareSettings(); 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_4,SIGNAL(clicked(bool) ),this,SLOT(on_cmd_openFile4())); 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("Enable"); _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("FileRecive_Incoming",ui.checkBoxSound_4->isChecked()); _settings->setValue("FileRecive_Finished",ui.checkBoxSound_5->isChecked()); @@ -62,7 +62,7 @@ SoundPage::save(QString &errmsg) _settings->endGroup(); _settings->beginGroup("SoundFilePath"); _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("FileRecive_Incoming",ui.txt_SoundFile4->text()); _settings->setValue("FileRecive_Finished",ui.txt_SoundFile5->text()); @@ -82,14 +82,14 @@ SoundPage::load() _settings->beginGroup("Sound"); _settings->beginGroup("SoundFilePath"); 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_SoundFile4->setText(_settings->value("FileRecive_Incoming","").toString()); ui.txt_SoundFile5->setText(_settings->value("FileRecive_Finished","").toString()); ui.txt_SoundFile6->setText(_settings->value("NewChatMessage","").toString()); 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_SoundFile4->text().isEmpty())ui.checkBoxSound_4->setEnabled(true); if(!ui.txt_SoundFile5->text().isEmpty())ui.checkBoxSound_5->setEnabled(true); @@ -99,7 +99,7 @@ SoundPage::load() _settings->beginGroup("Enable"); 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_4->setChecked(_settings->value("FileRecive_Incoming",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); } -void SoundPage::on_cmd_openFile2() +/*void SoundPage::on_cmd_openFile2() { ui.txt_SoundFile2->setText(QFileDialog::getOpenFileName(this,"Open File", ".", "wav (*.wav)")); if(ui.txt_SoundFile2->text().isEmpty()){ @@ -130,7 +130,7 @@ void SoundPage::on_cmd_openFile2() else ui.checkBoxSound_2->setEnabled(true); -} +}*/ void SoundPage::on_cmd_openFile3() { ui.txt_SoundFile3->setText(QFileDialog::getOpenFileName(this,"Open File", ".", "wav (*.wav)")); diff --git a/retroshare-gui/src/gui/settings/SoundPage.h b/retroshare-gui/src/gui/settings/SoundPage.h index 74eb83d3d..9ebff7c4f 100644 --- a/retroshare-gui/src/gui/settings/SoundPage.h +++ b/retroshare-gui/src/gui/settings/SoundPage.h @@ -47,7 +47,7 @@ public: private slots: void on_cmd_openFile(); - void on_cmd_openFile2(); + //void on_cmd_openFile2(); void on_cmd_openFile3(); void on_cmd_openFile4(); void on_cmd_openFile5(); diff --git a/retroshare-gui/src/gui/settings/SoundPage.ui b/retroshare-gui/src/gui/settings/SoundPage.ui index 29e9d857a..5e1afb3a4 100644 --- a/retroshare-gui/src/gui/settings/SoundPage.ui +++ b/retroshare-gui/src/gui/settings/SoundPage.ui @@ -6,8 +6,8 @@ 0 0 - 468 - 407 + 463 + 370 @@ -499,316 +499,185 @@ Sound Events - - - - 10 - 20 - 421 - 81 - - - - User - - - - false - - - - 10 - 20 - 80 - 23 - - - - go Online - - - - - false - - - - 10 - 50 - 80 - 23 - - - - go Offline - - - - - false - - - - 90 - 20 - 281 - 24 - - - - - - false - - - - 90 - 50 - 281 - 24 - - - - - - - 380 - 20 - 31 - 21 - - - - ... - - - - - - 380 - 50 - 31 - 21 - - - - ... - - - - - - - 10 - 100 - 421 - 61 - - - - FileSend - - - - false - - - - 90 - 20 - 281 - 24 - - - - - - - 380 - 20 - 31 - 21 - - - - ... - - - - - false - - - - 10 - 20 - 80 - 23 - - - - Finished - - - - - - - 10 - 160 - 421 - 91 - - - - FileRecive - - - - false - - - - 10 - 20 - 80 - 23 - - - - Incoming - - - - - false - - - - 90 - 20 - 281 - 24 - - - - - - - 380 - 20 - 31 - 21 - - - - ... - - - - - - 380 - 50 - 31 - 21 - - - - ... - - - - - false - - - - 10 - 50 - 80 - 23 - - - - Finished - - - - - false - - - - 90 - 50 - 281 - 24 - - - - - - - - 10 - 260 - 421 - 111 - - - - Chatmessage - - - - - 380 - 20 - 31 - 21 - - - - ... - - - - - false - - - - 10 - 20 - 80 - 23 - - - - New - - - - - false - - - - 90 - 20 - 281 - 24 - - - - + + + + + User + + + + + + false + + + go Online + + + + + + + false + + + + + + + Browse + + + + + + + + + + Chatmessage + + + + + + false + + + New Msg + + + + + + + false + + + + + + + Browse + + + + + + + + + + FileSend + + + + + + false + + + Finished + + + + + + + false + + + + + + + Brose + + + + + txt_SoundFile3 + cmd_openFile_3 + checkBoxSound_3 + groupBox_15 + + + + + + FileRecive + + + + + + false + + + Incoming + + + + + + + false + + + + + + + Browse + + + + + + + false + + + Finished + + + + + + + false + + + + + + + Browse + + + + + + + + + + Qt::Vertical + + + + 20 + 29 + + + + + - - - + diff --git a/retroshare-gui/src/gui/settings/rsettingswin.cpp b/retroshare-gui/src/gui/settings/rsettingswin.cpp index 692ff6e86..489e00580 100644 --- a/retroshare-gui/src/gui/settings/rsettingswin.cpp +++ b/retroshare-gui/src/gui/settings/rsettingswin.cpp @@ -107,10 +107,10 @@ RSettingsWin::initStackedWidget() stackedWidget->addWidget(new CryptoPage()); stackedWidget->addWidget(new ChatPage()); stackedWidget->addWidget(new AppearancePage()); - #ifndef RS_RELEASE_VERSION - stackedWidget->addWidget(new FileAssociationsPage() ); + // #ifndef RS_RELEASE_VERSION + // stackedWidget->addWidget(new FileAssociationsPage() ); stackedWidget->addWidget(new SoundPage() ); - #endif + // #endif loadSettings(); /* load saved settings */ @@ -156,16 +156,16 @@ RSettingsWin::setNewPage(int page) text = tr("Appearance"); pageicon->setPixmap(QPixmap(":/images/looknfeel.png")); break; - #ifndef RS_RELEASE_VERSION + /*// #ifndef RS_RELEASE_VERSION case Fileassociations: text = tr("File Associations"); pageicon->setPixmap(QPixmap(":/images/filetype-association.png")); - break; + break;*/ case Sound: text = tr("Sound"); pageicon->setPixmap(QPixmap(":/images/sound.png")); break; - #endif + // #endif default: text = tr("UnknownPage");// impossible case } diff --git a/retroshare-gui/src/gui/settings/rsettingswin.h b/retroshare-gui/src/gui/settings/rsettingswin.h index 5c00a5957..b3e51aed3 100755 --- a/retroshare-gui/src/gui/settings/rsettingswin.h +++ b/retroshare-gui/src/gui/settings/rsettingswin.h @@ -32,7 +32,7 @@ class RSettingsWin: public QDialog, private Ui::Settings public: 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 postModDirectories(bool update_local); diff --git a/retroshare-gui/src/gui/settings/settings.ui b/retroshare-gui/src/gui/settings/settings.ui index 6d9182da1..f27365365 100755 --- a/retroshare-gui/src/gui/settings/settings.ui +++ b/retroshare-gui/src/gui/settings/settings.ui @@ -149,6 +149,15 @@ :/images/looknfeel.png:/images/looknfeel.png + + + Sound + + + + :/images/sound.png:/images/sound.png + + diff --git a/retroshare-gui/src/gui/toaster/OnlineToaster.cpp b/retroshare-gui/src/gui/toaster/OnlineToaster.cpp index e7d7a7704..522eb3954 100644 --- a/retroshare-gui/src/gui/toaster/OnlineToaster.cpp +++ b/retroshare-gui/src/gui/toaster/OnlineToaster.cpp @@ -65,3 +65,21 @@ void OnlineToaster::chatButtonSlot() { chatButtonClicked(); 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; +} diff --git a/retroshare-gui/src/gui/toaster/OnlineToaster.h b/retroshare-gui/src/gui/toaster/OnlineToaster.h index 00c3ee03d..ecd14af60 100644 --- a/retroshare-gui/src/gui/toaster/OnlineToaster.h +++ b/retroshare-gui/src/gui/toaster/OnlineToaster.h @@ -16,57 +16,61 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ - -#ifndef ONLINETOASTER_H -#define ONLINETOASTER_H + +#ifndef ONLINETOASTER_H +#define ONLINETOASTER_H #include "IQtToaster.h" +#include #include +#include class QtToaster; class QWidget; class QString; class QPixmap; -namespace Ui { class OnlineToaster; } +namespace Ui { class OnlineToaster; } /** * Shows a toaster when friend is Online . * * - */ -class OnlineToaster : public QObject, public IQtToaster { - Q_OBJECT -public: - - OnlineToaster(); + */ +class OnlineToaster : public QObject, public IQtToaster { + Q_OBJECT +public: + + OnlineToaster(); ~OnlineToaster(); - + void setMessage(const QString & message); - + void setPixmap(const QPixmap & pixmap); - void show(); - -Q_SIGNALS: - - void chatButtonClicked(); + void show(); + void play(); + +Q_SIGNALS: + + void chatButtonClicked(); private Q_SLOTS: void chatButtonSlot(); void close(); - -private: - Ui::OnlineToaster * _ui; +private: + RshareSettings* _settings; - QWidget * _onlineToasterWidget; + Ui::OnlineToaster * _ui; - QtToaster * _toaster; -}; - -#endif //MESSAGETOASTER_H + QWidget * _onlineToasterWidget; + + QtToaster * _toaster; +}; + +#endif //MESSAGETOASTER_H