mirror of
https://github.com/RetroShare/RetroShare.git
synced 2024-10-01 02:35:48 -04:00
fix the chat scrollbar
git-svn-id: http://svn.code.sf.net/p/retroshare/code/trunk@1819 b45a01b8-16f6-495d-af2f-9b41ad6348cc
This commit is contained in:
parent
f56e9cfcd9
commit
8128f0b2ea
@ -803,7 +803,6 @@ void PeersDialog::insertChat()
|
||||
}
|
||||
|
||||
std::ostringstream out;
|
||||
QString currenttxt = msgWidget->toHtml();
|
||||
QString extraTxt;
|
||||
|
||||
QString timestamp = QDateTime::currentDateTime().toString("hh:mm:ss");
|
||||
@ -832,32 +831,15 @@ void PeersDialog::insertChat()
|
||||
emit notifyGroupChat(QString("New group chat"), notifyMsg);
|
||||
}
|
||||
|
||||
|
||||
/* add it everytime */
|
||||
currenttxt += extraTxt;
|
||||
|
||||
QHashIterator<QString, QString> i(smileys);
|
||||
while(i.hasNext())
|
||||
{
|
||||
i.next();
|
||||
foreach(QString code, i.key().split("|"))
|
||||
currenttxt.replace(code, "<img src=\"" + i.value() + "\" />");
|
||||
extraTxt.replace(code, "<img src=\"" + i.value() + "\" />");
|
||||
}
|
||||
|
||||
|
||||
QScrollBar *qsb = msgWidget->verticalScrollBar();
|
||||
int oldQsbValue = qsb->value();
|
||||
//check if the scroll bar is at the bottom. If t is, we will putt it at the bottom after the new message
|
||||
bool maxQsbValue = ((qsb->maximum() - 30) < qsb->value());
|
||||
|
||||
msgWidget->setHtml(currenttxt);
|
||||
msgWidget->update();
|
||||
|
||||
if (maxQsbValue ) {
|
||||
qsb -> setValue(qsb->maximum());
|
||||
} else {
|
||||
qsb -> setValue(oldQsbValue);
|
||||
}
|
||||
msgWidget->append(extraTxt);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -219,12 +219,6 @@ void PopupChatDialog::updateChat()
|
||||
|
||||
void PopupChatDialog::addChatMsg(ChatInfo *ci)
|
||||
{
|
||||
//store the state of the vertical scrollbar to set it at the end of the function
|
||||
QScrollBar *qsb = ui.textBrowser->verticalScrollBar();
|
||||
int oldQsbValue = qsb->value();
|
||||
//check if the scroll bar is at the bottom. If t is, we will putt it at the bottom after the new message
|
||||
bool maxQsbValue = ((qsb->maximum() - 30) < qsb->value());
|
||||
|
||||
bool offline = true;
|
||||
|
||||
{
|
||||
@ -295,20 +289,7 @@ std::cout << "PopupChatDialog:addChatMsg message : " << message.toStdString() <<
|
||||
.replace("%name%", name)
|
||||
.replace("%message%", message);
|
||||
|
||||
ui.textBrowser->setHtml(ui.textBrowser->toHtml() + formatMsg + "\n");
|
||||
|
||||
|
||||
if (maxQsbValue ) {
|
||||
qsb -> setValue(qsb->maximum());
|
||||
} else {
|
||||
qsb -> setValue(oldQsbValue);
|
||||
}
|
||||
|
||||
/*else
|
||||
{
|
||||
ui.avatarlabel->setPixmap(QPixmap(":/images/user/personal128.png"));
|
||||
}*/
|
||||
|
||||
ui.textBrowser->append(formatMsg + "\n");
|
||||
resetStatusBar() ;
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user