QTfrontend/ui/widget/chatwidget.cpp
changeset 6181 c739b503ae31
parent 6180 0992fc5a4ad9
child 6182 d56d18802481
equal deleted inserted replaced
6180:0992fc5a4ad9 6181:c739b503ae31
   171     return style;
   171     return style;
   172 }
   172 }
   173 
   173 
   174 void HWChatWidget::displayError(const QString & message)
   174 void HWChatWidget::displayError(const QString & message)
   175 {
   175 {
   176     addLine("msg_Error", message);
   176     addLine("msg_Error", " !!! " + message);
   177     // scroll to the end
   177     // scroll to the end
   178     chatText->moveCursor(QTextCursor::End);
   178     chatText->moveCursor(QTextCursor::End);
   179 }
   179 }
   180 
   180 
   181 
   181 
   182 void HWChatWidget::displayNotice(const QString & message)
   182 void HWChatWidget::displayNotice(const QString & message)
   183 {
   183 {
   184     addLine("msg_Notice", message);
   184     addLine("msg_Notice", " *** " + message);
   185 }
   185 }
   186 
   186 
   187 
   187 
   188 void HWChatWidget::displayWarning(const QString & message)
   188 void HWChatWidget::displayWarning(const QString & message)
   189 {
   189 {
   190     addLine("msg_Warning", message);
   190     addLine("msg_Warning", " *!* " + message);
   191 }
   191 }
   192 
   192 
   193 
   193 
   194 HWChatWidget::HWChatWidget(QWidget* parent, QSettings * gameSettings, bool notify) :
   194 HWChatWidget::HWChatWidget(QWidget* parent, QSettings * gameSettings, bool notify) :
   195   QWidget(parent),
   195   QWidget(parent),
   557 
   557 
   558     if(ignoreList.contains(curritem->text(), Qt::CaseInsensitive)) // already on list - remove him
   558     if(ignoreList.contains(curritem->text(), Qt::CaseInsensitive)) // already on list - remove him
   559     {
   559     {
   560         ignoreList.removeAll(curritem->text().toLower());
   560         ignoreList.removeAll(curritem->text().toLower());
   561         chatEditLine->addNickname(curritem->text());
   561         chatEditLine->addNickname(curritem->text());
   562         onChatString(HWChatWidget::tr("%1 *** %2 has been removed from your ignore list").arg('\x03').arg(curritem->text()));
   562         displayNotice(tr("%1 has been removed from your ignore list").arg(curritem->text()));
   563     }
   563     }
   564     else // not on list - add
   564     else // not on list - add
   565     {
   565     {
   566         // don't consider ignored people friends
   566         // don't consider ignored people friends
   567         if(friendsList.contains(curritem->text(), Qt::CaseInsensitive))
   567         if(friendsList.contains(curritem->text(), Qt::CaseInsensitive))
   571         if (ignoreList.isEmpty())
   571         if (ignoreList.isEmpty())
   572             chatNicks->scrollToBottom();
   572             chatNicks->scrollToBottom();
   573 
   573 
   574         ignoreList << curritem->text().toLower();
   574         ignoreList << curritem->text().toLower();
   575         chatEditLine->removeNickname(curritem->text());
   575         chatEditLine->removeNickname(curritem->text());
   576         onChatString(HWChatWidget::tr("%1 *** %2 has been added to your ignore list").arg('\x03').arg(curritem->text()));
   576         displayNotice(tr("%1 has been added to your ignore list").arg(curritem->text()));
   577     }
   577     }
   578     updateNickItem(curritem); // update icon/sort order/etc
   578     updateNickItem(curritem); // update icon/sort order/etc
   579     chatNicks->sortItems();
   579     chatNicks->sortItems();
   580     chatNickSelected(0); // update context menu
   580     chatNickSelected(0); // update context menu
   581 }
   581 }
   587         return;
   587         return;
   588 
   588 
   589     if(friendsList.contains(curritem->text(), Qt::CaseInsensitive)) // already on list - remove him
   589     if(friendsList.contains(curritem->text(), Qt::CaseInsensitive)) // already on list - remove him
   590     {
   590     {
   591         friendsList.removeAll(curritem->text().toLower());
   591         friendsList.removeAll(curritem->text().toLower());
   592         onChatString(HWChatWidget::tr("%1 *** %2 has been removed from your friends list").arg('\x03').arg(curritem->text()));
   592         displayNotice(tr("%1 has been removed from your friends list").arg(curritem->text()));
   593     }
   593     }
   594     else // not on list - add
   594     else // not on list - add
   595     {
   595     {
   596         // don't ignore the new friend
   596         // don't ignore the new friend
   597         if(ignoreList.contains(curritem->text(), Qt::CaseInsensitive))
   597         if(ignoreList.contains(curritem->text(), Qt::CaseInsensitive))
   600         // scroll up on first friend added so that people see where that nick went to
   600         // scroll up on first friend added so that people see where that nick went to
   601         if (friendsList.isEmpty())
   601         if (friendsList.isEmpty())
   602             chatNicks->scrollToTop();
   602             chatNicks->scrollToTop();
   603 
   603 
   604         friendsList << curritem->text().toLower();
   604         friendsList << curritem->text().toLower();
   605         onChatString(HWChatWidget::tr("%1 *** %2 has been added to your friends list").arg('\x03').arg(curritem->text()));
   605         displayNotice(tr("%1 has been added to your friends list").arg(curritem->text()));
   606     }
   606     }
   607     updateNickItem(curritem); // update icon/sort order/etc
   607     updateNickItem(curritem); // update icon/sort order/etc
   608     chatNicks->sortItems();
   608     chatNicks->sortItems();
   609     chatNickSelected(0); // update context menu
   609     chatNickSelected(0); // update context menu
   610 }
   610 }