From 331bca5f7361ba239531faca070872ee8d44addb Mon Sep 17 00:00:00 2001 From: Cerapter Date: Thu, 16 Aug 2018 18:48:11 +0200 Subject: [PATCH] Fixed a bug regarding the log limit being zero. - This also returned the previous behaviour when the log limit is zero, that is, no log limit is applied then. --- courtroom.cpp | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/courtroom.cpp b/courtroom.cpp index 9b579d5..4ed4ffb 100644 --- a/courtroom.cpp +++ b/courtroom.cpp @@ -1422,7 +1422,7 @@ void Courtroom::append_ic_text(QString p_text, QString p_name) ui_ic_chatlog->textCursor().insertText(p_text, normal); // If we got too many blocks in the current log, delete some from the top. - while (ui_ic_chatlog->document()->blockCount() > log_maximum_blocks) + while (ui_ic_chatlog->document()->blockCount() > log_maximum_blocks && log_maximum_blocks > 0) { ui_ic_chatlog->moveCursor(QTextCursor::Start); ui_ic_chatlog->textCursor().select(QTextCursor::BlockUnderCursor); @@ -1454,7 +1454,7 @@ void Courtroom::append_ic_text(QString p_text, QString p_name) ui_ic_chatlog->textCursor().insertText(p_text + '\n', normal); // If we got too many blocks in the current log, delete some from the bottom. - while (ui_ic_chatlog->document()->blockCount() > log_maximum_blocks) + while (ui_ic_chatlog->document()->blockCount() > log_maximum_blocks && log_maximum_blocks > 0) { ui_ic_chatlog->moveCursor(QTextCursor::End); ui_ic_chatlog->textCursor().select(QTextCursor::BlockUnderCursor); @@ -1510,7 +1510,7 @@ void Courtroom::append_ic_songchange(QString p_songname, QString p_name) ui_ic_chatlog->textCursor().insertText(p_songname + ".", italics); // If we got too many blocks in the current log, delete some from the top. - while (ui_ic_chatlog->document()->blockCount() > log_maximum_blocks) + while (ui_ic_chatlog->document()->blockCount() > log_maximum_blocks && log_maximum_blocks > 0) { ui_ic_chatlog->moveCursor(QTextCursor::Start); ui_ic_chatlog->textCursor().select(QTextCursor::BlockUnderCursor); @@ -1538,13 +1538,13 @@ void Courtroom::append_ic_songchange(QString p_songname, QString p_name) ui_ic_chatlog->moveCursor(QTextCursor::Start); - ui_ic_chatlog->textCursor().insertText('\n' + p_name, bold); + ui_ic_chatlog->textCursor().insertText(p_name, bold); ui_ic_chatlog->textCursor().insertText(" has played a song: ", normal); - ui_ic_chatlog->textCursor().insertText(p_songname + ".", italics); + ui_ic_chatlog->textCursor().insertText(p_songname + "." + '\n', italics); // If we got too many blocks in the current log, delete some from the bottom. - while (ui_ic_chatlog->document()->blockCount() > log_maximum_blocks) + while (ui_ic_chatlog->document()->blockCount() > log_maximum_blocks && log_maximum_blocks > 0) { ui_ic_chatlog->moveCursor(QTextCursor::End); ui_ic_chatlog->textCursor().select(QTextCursor::BlockUnderCursor);