mirror of
https://github.com/RetroShare/RetroShare.git
synced 2025-05-03 14:45:12 -04:00
fixed some not need things for Chatting which does destroy the Chat format when Chatting, removed lastname and not needed lines which makes chatting bad
git-svn-id: http://svn.code.sf.net/p/retroshare/code/trunk@395 b45a01b8-16f6-495d-af2f-9b41ad6348cc
This commit is contained in:
parent
7044822e1f
commit
08bdd8f567
2 changed files with 22 additions and 118 deletions
|
@ -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 += "<br>\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 = "<span style=\"color:#1D84C9\"><strong>" + timestamp +
|
||||
" " + name + "</strong></span> \n<br>";
|
||||
" " + name + "</strong></span> \n<br>";
|
||||
|
||||
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);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue