QTfrontend/chatwidget.cpp
changeset 2774 a4fd9eacd286
parent 2773 e94f240a8a41
child 2775 3445ce5e9c79
equal deleted inserted replaced
2773:e94f240a8a41 2774:a4fd9eacd286
   117 	chatText->moveCursor(QTextCursor::End);
   117 	chatText->moveCursor(QTextCursor::End);
   118 }
   118 }
   119 
   119 
   120 void HWChatWidget::nickAdded(const QString& nick)
   120 void HWChatWidget::nickAdded(const QString& nick)
   121 {
   121 {
   122     Mix_Music *sound;
   122     Mix_Chunk *sound;
   123     QDir tmpdir;
   123     QDir tmpdir;
   124 
   124 
   125 	QListWidgetItem * item = new QListWidgetItem(nick);
   125 	QListWidgetItem * item = new QListWidgetItem(nick);
   126 	item->setIcon(QIcon(":/res/hh_small.png"));
   126 	item->setIcon(QIcon(":/res/hh_small.png"));
   127 	chatNicks->addItem(item);
   127 	chatNicks->addItem(item);
   128 
   128 
   129     if(gameSettings->value("audio/sound", true).toBool()) {
   129     if(gameSettings->value("audio/sound", true).toBool()) {
   130        sdli->SDLMusicInit();
   130        sdli->SDLMusicInit();
   131        tmpdir.cd(datadir->absolutePath());
   131        tmpdir.cd(datadir->absolutePath());
   132        tmpdir.cd("Sounds/");
   132        tmpdir.cd("Sounds/");
   133        sound = Mix_LoadMUS(QString(tmpdir.absolutePath() + "/switchhog.ogg").toLocal8Bit().constData());
   133        sound = Mix_LoadWAV(QString(tmpdir.absolutePath() + "/switchhog.ogg").toLocal8Bit().constData());
   134        Mix_PlayMusic(sound, 0);
   134        Mix_PlayChannel(-1, sound, 0);
   135     }
   135     }
   136 }
   136 }
   137 
   137 
   138 void HWChatWidget::nickRemoved(const QString& nick)
   138 void HWChatWidget::nickRemoved(const QString& nick)
   139 {
   139 {