Merge pull request #1241 from ZeldaZach/fix_719
This commit is contained in:
commit
acaeadfcb3
3 changed files with 10 additions and 4 deletions
|
@ -73,10 +73,16 @@ void ChatView::appendHtml(const QString &html)
|
||||||
verticalScrollBar()->setValue(verticalScrollBar()->maximum());
|
verticalScrollBar()->setValue(verticalScrollBar()->maximum());
|
||||||
}
|
}
|
||||||
|
|
||||||
void ChatView::appendHtmlServerMessage(const QString &html)
|
void ChatView::appendHtmlServerMessage(const QString &html, bool optionalIsBold, QString optionalFontColor)
|
||||||
{
|
{
|
||||||
bool atBottom = verticalScrollBar()->value() >= verticalScrollBar()->maximum();
|
bool atBottom = verticalScrollBar()->value() >= verticalScrollBar()->maximum();
|
||||||
prepareBlock().insertHtml("<font color=" + SERVER_MESSAGE_COLOR + ">" + html + "</font>");
|
|
||||||
|
QString htmlText = "<font color=" + ((optionalFontColor.size() > 0) ? optionalFontColor : SERVER_MESSAGE_COLOR) + ">" + html + "</font>";
|
||||||
|
|
||||||
|
if (optionalIsBold)
|
||||||
|
htmlText = "<b>" + htmlText + "</b>";
|
||||||
|
|
||||||
|
prepareBlock().insertHtml(htmlText);
|
||||||
if (atBottom)
|
if (atBottom)
|
||||||
verticalScrollBar()->setValue(verticalScrollBar()->maximum());
|
verticalScrollBar()->setValue(verticalScrollBar()->maximum());
|
||||||
}
|
}
|
||||||
|
|
|
@ -51,7 +51,7 @@ public:
|
||||||
ChatView(const TabSupervisor *_tabSupervisor, TabGame *_game, bool _showTimestamps, QWidget *parent = 0);
|
ChatView(const TabSupervisor *_tabSupervisor, TabGame *_game, bool _showTimestamps, QWidget *parent = 0);
|
||||||
void retranslateUi();
|
void retranslateUi();
|
||||||
void appendHtml(const QString &html);
|
void appendHtml(const QString &html);
|
||||||
void appendHtmlServerMessage(const QString &html);
|
void appendHtmlServerMessage(const QString &html, bool optionalIsBold = false, QString optionalFontColor = QString());
|
||||||
void appendMessage(QString message, QString sender = QString(), UserLevelFlags userLevel = UserLevelFlags(), bool playerBold = false);
|
void appendMessage(QString message, QString sender = QString(), UserLevelFlags userLevel = UserLevelFlags(), bool playerBold = false);
|
||||||
void clearChat();
|
void clearChat();
|
||||||
protected:
|
protected:
|
||||||
|
|
|
@ -76,7 +76,7 @@ void MessageLogWidget::logGameClosed()
|
||||||
|
|
||||||
void MessageLogWidget::logKicked()
|
void MessageLogWidget::logKicked()
|
||||||
{
|
{
|
||||||
appendHtmlServerMessage(tr("You have been kicked out of the game."));
|
appendHtmlServerMessage(tr("You have been kicked out of the game."), true);
|
||||||
}
|
}
|
||||||
|
|
||||||
void MessageLogWidget::logJoinSpectator(QString name)
|
void MessageLogWidget::logJoinSpectator(QString name)
|
||||||
|
|
Loading…
Reference in a new issue