00001 #include "GUIChatView.h" 00002 00003 GUIChatView::GUIChatView(QWidget *parent, QString sm , QString um , QString bc):QTextBrowser(parent) 00004 { 00005 this->sm = sm; 00006 this->um = um; 00007 QColor tmp = QColor(bc).dark(105); 00008 this->bc = tmp.name(); 00009 } 00010 00011 void GUIChatView::printSysMsg(QString text) 00012 { 00013 QString msg; 00014 msg = "<font color="+ sm +">*" + text + "</font>"; 00015 this->append(msg); 00016 } 00017 00018 00019 void GUIChatView::printUserMsg(QString text) 00020 { 00021 QString msg; 00022 00023 msg = "<font color=" + um +">*" + text + "</font>"; 00024 this->append(msg); 00025 } 00026 00027 void GUIChatView::printChatText(QString text) 00028 { 00029 QString msg; 00030 00031 msg.append("<table border cellspacing=0 cellpadding=1 border=0 width=100% bgcolor="); 00032 msg.append(bc); 00033 msg.append("><tr><td > "); 00034 msg.append(text); 00035 msg.append("<br></td></tr></table>"); 00036 this->append(msg); 00037 } 00038 00039 00040 00041