1
0
mirror of https://github.com/qTox/qTox.git synced 2024-03-22 14:00:36 +08:00

Add greentext

This commit is contained in:
Tux3 / Mlkj / !Lev.uXFMLA 2014-07-04 21:30:59 +02:00
parent f9289438af
commit c3f985db8a
2 changed files with 8 additions and 0 deletions

View File

@ -215,6 +215,8 @@ void ChatForm::addMessage(QString author, QString message, QString date)
void ChatForm::addMessage(QLabel* author, QLabel* message, QLabel* date) void ChatForm::addMessage(QLabel* author, QLabel* message, QLabel* date)
{ {
QPalette greentext;
greentext.setColor(QPalette::WindowText, QColor(61,204,61));
QScrollBar* scroll = chatArea->verticalScrollBar(); QScrollBar* scroll = chatArea->verticalScrollBar();
lockSliderToBottom = scroll && scroll->value() == scroll->maximum(); lockSliderToBottom = scroll && scroll->value() == scroll->maximum();
author->setAlignment(Qt::AlignTop | Qt::AlignRight); author->setAlignment(Qt::AlignTop | Qt::AlignRight);
@ -242,6 +244,8 @@ void ChatForm::addMessage(QLabel* author, QLabel* message, QLabel* date)
} }
else if (curRow)// onSaveLogClicked expects 0 or 3 QLabel per line else if (curRow)// onSaveLogClicked expects 0 or 3 QLabel per line
author->setText(""); author->setText("");
if (message->text()[0] == '>')
message->setPalette(greentext);
mainChatLayout->addWidget(author, curRow, 0); mainChatLayout->addWidget(author, curRow, 0);
mainChatLayout->addWidget(message, curRow, 1); mainChatLayout->addWidget(message, curRow, 1);
mainChatLayout->addWidget(date, curRow, 3); mainChatLayout->addWidget(date, curRow, 3);

View File

@ -167,6 +167,8 @@ void GroupChatForm::addMessage(QString author, QString message, QString date)
void GroupChatForm::addMessage(QLabel* author, QLabel* message, QLabel* date) void GroupChatForm::addMessage(QLabel* author, QLabel* message, QLabel* date)
{ {
QPalette greentext;
greentext.setColor(QPalette::WindowText, QColor(61,204,61));
QScrollBar* scroll = chatArea->verticalScrollBar(); QScrollBar* scroll = chatArea->verticalScrollBar();
lockSliderToBottom = scroll && scroll->value() == scroll->maximum(); lockSliderToBottom = scroll && scroll->value() == scroll->maximum();
author->setAlignment(Qt::AlignTop | Qt::AlignLeft); author->setAlignment(Qt::AlignTop | Qt::AlignLeft);
@ -194,6 +196,8 @@ void GroupChatForm::addMessage(QLabel* author, QLabel* message, QLabel* date)
} }
else if (curRow)// onSaveLogClicked expects 0 or 3 QLabel per line else if (curRow)// onSaveLogClicked expects 0 or 3 QLabel per line
author->setText(""); author->setText("");
if (message->text()[0] == '>')
message->setPalette(greentext);
mainChatLayout->addWidget(author, curRow, 0); mainChatLayout->addWidget(author, curRow, 0);
mainChatLayout->addWidget(message, curRow, 1); mainChatLayout->addWidget(message, curRow, 1);
mainChatLayout->addWidget(date, curRow, 3); mainChatLayout->addWidget(date, curRow, 3);