diff --git a/retroshare-gui/src/gui/ChatDialog.cpp b/retroshare-gui/src/gui/ChatDialog.cpp index 7c7ebb245..00741731f 100644 --- a/retroshare-gui/src/gui/ChatDialog.cpp +++ b/retroshare-gui/src/gui/ChatDialog.cpp @@ -118,37 +118,15 @@ void ChatDialog::insertChat() return; } - QTextEdit *msgWidget = ui.msgText; + QTextEdit *msgWidget = ui.msgText; std::list::iterator it; - - static std::string lastChatName(""); - static int lastChatTime = 0; - + //QString color = ci.messageColor.name(); //QString nickColor; //QString font = ci.messageFont.family(); //QString fontSize = QString::number(ci.messageFont.pointSize()); - - /* determine how many spaces to add */ - //int n = msgWidget->width(); - /* now spaces = (width - txt width) / (pixel / space) - */ - - //std::cerr << "Width is : " << n << std::endl; - /*n -= 256; 220 pixels for name */ - /*if (n > 0) - { - n = 2 + n / 10; - } - else - { - n = 1; - } - n = 1 + n / 2;*/ /* shrink it! */ - /* add in lines at the bottom */ - int ts = time(NULL); for(it = newchat.begin(); it != newchat.end(); it++) { /* are they private? */ @@ -163,46 +141,20 @@ void ChatDialog::insertChat() QString currenttxt = msgWidget->toHtml(); QString extraTxt; - if ((it->name == lastChatName) && (ts - lastChatTime < 60)) - { - /* no name */ - } - else - { -#if defined(Q_OS_WIN) - /* nothing */ -#else - extraTxt += "
\n"; -#endif - /*for(int i = 0; i < n; i++) - { - extraTxt += " "; - }*/ - QString timestamp = "[" + QDateTime::currentDateTime().toString("hh:mm:ss") + "]"; - QString name = QString::fromStdString(it->name); - QString line = "" + timestamp + "" + + QString timestamp = "[" + QDateTime::currentDateTime().toString("hh:mm:ss") + "]"; + QString name = QString::fromStdString(it->name); + QString line = "" + timestamp + "" + "" + " " + name + "
"; + + extraTxt += line; - extraTxt += line; - - } - - extraTxt += QString::fromStdWString(it->msg); - - /* This might be WIN32 only - or maybe Qt4.2.2 only - but need it for windows at the mom */ -#if defined(Q_OS_WIN) - extraTxt += "\n"; -#else - extraTxt += "\n"; -#endif - - lastChatName = it -> name; - lastChatTime = ts; - - /* add it everytime */ + extraTxt += QString::fromStdWString(it->msg); + + /* add it everytime */ currenttxt += extraTxt; - - msgWidget->setHtml(currenttxt); + + msgWidget->setHtml(currenttxt); + QScrollBar *qsb = msgWidget->verticalScrollBar(); qsb -> setValue(qsb->maximum()); @@ -216,10 +168,10 @@ void ChatDialog::sendMsg() { QLineEdit *lineWidget = ui.lineEdit; - //QFont font = QFont("Comic Sans MS", 10); - //font.setBold(ui.textboldChatButton->isChecked()); - //font.setUnderline(ui.textunderlineChatButton->isChecked()); - //font.setItalic(ui.textitalicChatButton->isChecked()); + QFont font = QFont("Comic Sans MS", 10); + font.setBold(ui.textboldChatButton->isChecked()); + font.setUnderline(ui.textunderlineChatButton->isChecked()); + font.setItalic(ui.textitalicChatButton->isChecked()); ChatInfo ci; ci.msg = lineWidget->text().toStdWString(); diff --git a/retroshare-gui/src/gui/chat/PopupChatDialog.cpp b/retroshare-gui/src/gui/chat/PopupChatDialog.cpp index 43772a598..e5dd78685 100644 --- a/retroshare-gui/src/gui/chat/PopupChatDialog.cpp +++ b/retroshare-gui/src/gui/chat/PopupChatDialog.cpp @@ -174,34 +174,13 @@ void PopupChatDialog::updateChat() void PopupChatDialog::addChatMsg(ChatInfo *ci) { - QTextBrowser *msgWidget = ui.textBrowser; + QTextBrowser *msgWidget = ui.textBrowser; QString currenttxt = msgWidget->toHtml(); - /* determine how many spaces to add */ - int n = msgWidget->width(); - /* now spaces = (width - txt width) / (pixel / space) - */ - - //std::cerr << "Width is : " << n << std::endl; - n -= 256; /* 220 pixels for name */ - if (n > 0) - { - n = 2 + n / 10; - } - else - { - n = 1; - } - - //std::cerr << "Space count : " << n << std::endl; - - std::string spaces(" "); - /* add in lines at the bottom */ - QString extraTxt; - int ts = time(NULL); + QString extraTxt; bool offline = true; @@ -224,46 +203,19 @@ void PopupChatDialog::addChatMsg(ChatInfo *ci) extraTxt += line; } - - if ((ci->name == lastChatName) && (ts - lastChatTime < 60)) - { - /* no name */ - } - else - { - -#if defined(Q_OS_WIN) - // Nothing. -#else - extraTxt += "
\n"; -#endif - for(int i = 0; i < n; i++) - { - extraTxt += " "; - } - QString timestamp = "(" + QDateTime::currentDateTime().toString("hh:mm:ss") + ") "; + QString timestamp = "[" + QDateTime::currentDateTime().toString("hh:mm:ss") + "]"; //QString pre = tr("Peer:" ); QString name = QString::fromStdString(ci->name); QString line = "" + timestamp + - " " + name + " \n
"; + " " + name + " \n
"; extraTxt += line; - } + extraTxt += QString::fromStdWString(ci -> msg); - /* This might be WIN32 only - or maybe Qt4.2.2 only - but need it for windows at the mom */ -#if defined(Q_OS_WIN) - extraTxt += "\n"; -#else - extraTxt += "\n"; -#endif - - lastChatTime = ts; - lastChatName = ci->name; - currenttxt += extraTxt; msgWidget->setHtml(currenttxt);