Added for Timestamp own color

git-svn-id: http://svn.code.sf.net/p/retroshare/code/trunk@431 b45a01b8-16f6-495d-af2f-9b41ad6348cc
This commit is contained in:
defnax 2008-03-28 14:53:33 +00:00
parent 87bfe1eed9
commit e69da57ec9

View File

@ -174,10 +174,10 @@ void PopupChatDialog::addChatMsg(ChatInfo *ci)
QString timestamp = "[" + QDateTime::currentDateTime().toString("hh:mm:ss") + "]"; QString timestamp = "[" + QDateTime::currentDateTime().toString("hh:mm:ss") + "]";
//QString pre = tr("Peer:" ); //QString pre = tr("Peer:" );
QString name = QString::fromStdString(ci->name); QString name = QString::fromStdString(ci->name);
QString line = "<span style=\"color:#1D84C9\"><strong>" + timestamp + QString line = "<span style=\"color:#C00000\"><strong>" + timestamp + "</strong></span>" +
" " + name + "</strong></span>"; "<span style=\"color:#2D84C9\"><strong>" + " " + name + "</strong></span>";
extraTxt += line; extraTxt += line;
extraTxt += QString::fromStdWString(ci -> msg); extraTxt += QString::fromStdWString(ci -> msg);
@ -244,14 +244,16 @@ void PopupChatDialog::showAvatarFrame(bool show)
void PopupChatDialog::setColor() void PopupChatDialog::setColor()
{ {
QColor col = QColorDialog::getColor(Qt::black, this); QColor col = QColorDialog::getColor(Qt::black, this);
if (col.isValid()) { if (col.isValid()) {
ui.colorButton->setPalette(QPalette(col)); //ui.colorButton->setPalette(QPalette(col));
//ui.chattextEdit->setTextCursor();
ui.chattextEdit->setTextColor(QColor(col)); ui.chattextEdit->setTextColor(QColor(col));
QTextCharFormat fmt; //QTextCharFormat fmt;
fmt.setForeground(col); //fmt.setForeground(col);
mergeFormatOnWordOrSelection(fmt); //mergeFormatOnWordOrSelection(fmt);
colorChanged(col); colorChanged(col);
} }
} }
@ -265,11 +267,11 @@ void PopupChatDialog::colorChanged(const QColor &c)
void PopupChatDialog::mergeFormatOnWordOrSelection(const QTextCharFormat &format) void PopupChatDialog::mergeFormatOnWordOrSelection(const QTextCharFormat &format)
{ {
QTextCursor cursor = ui.chattextEdit->textCursor(); //QTextCursor cursor = ui.chattextEdit->textCursor();
if (!cursor.hasSelection()) /*if (!cursor.hasSelection())
cursor.select(QTextCursor::WordUnderCursor); cursor.select(QTextCursor::WordUnderCursor);
cursor.mergeCharFormat(format); cursor.mergeCharFormat(format);*/
ui.chattextEdit->mergeCurrentCharFormat(format); //ui.chattextEdit->mergeCurrentCharFormat(format);
} }
void PopupChatDialog::getFont() void PopupChatDialog::getFont()