equal
deleted
inserted
replaced
30 #include "hwconsts.h" |
30 #include "hwconsts.h" |
31 #include "SDLs.h" |
31 #include "SDLs.h" |
32 #include "gameuiconfig.h" |
32 #include "gameuiconfig.h" |
33 #include "chatwidget.h" |
33 #include "chatwidget.h" |
34 |
34 |
|
35 ListWidgetNickItem::ListWidgetNickItem(const QString& nick) : QListWidgetItem(nick) {} |
|
36 |
|
37 bool ListWidgetNickItem::operator< (const QListWidgetItem & other) const |
|
38 { |
|
39 // case in-sensitive comparison of the associated strings |
|
40 return (text().compare(other.text(), Qt::CaseInsensitive) < 0); |
|
41 } |
|
42 |
35 HWChatWidget::HWChatWidget(QWidget* parent, QSettings * gameSettings, SDLInteraction * sdli, bool notify) : |
43 HWChatWidget::HWChatWidget(QWidget* parent, QSettings * gameSettings, SDLInteraction * sdli, bool notify) : |
36 QWidget(parent), |
44 QWidget(parent), |
37 mainLayout(this) |
45 mainLayout(this) |
38 { |
46 { |
39 this->gameSettings = gameSettings; |
47 this->gameSettings = gameSettings; |
239 chatText->moveCursor(QTextCursor::End); |
247 chatText->moveCursor(QTextCursor::End); |
240 } |
248 } |
241 |
249 |
242 void HWChatWidget::nickAdded(const QString& nick, bool notifyNick) |
250 void HWChatWidget::nickAdded(const QString& nick, bool notifyNick) |
243 { |
251 { |
244 QListWidgetItem * item = new QListWidgetItem(nick); |
252 QListWidgetItem * item = new ListWidgetNickItem(nick); |
245 updateIcon(item); |
253 updateIcon(item); |
246 chatNicks->addItem(item); |
254 chatNicks->addItem(item); |
247 |
255 |
248 if(notifyNick && notify && gameSettings->value("frontend/sound", true).toBool()) { |
256 if(notifyNick && notify && gameSettings->value("frontend/sound", true).toBool()) { |
249 Mix_PlayChannel(-1, sound[rand()%4], 0); |
257 Mix_PlayChannel(-1, sound[rand()%4], 0); |