diff options
| author | Cerapter <cerap@protonmail.com> | 2018-08-16 18:48:11 +0200 |
|---|---|---|
| committer | Cerapter <cerap@protonmail.com> | 2018-08-16 18:48:11 +0200 |
| commit | 331bca5f7361ba239531faca070872ee8d44addb (patch) | |
| tree | 6dae9fac72ea609b59dcb3a182ff5504282f872e | |
| parent | d6b6a03802e56e4e4ea06402846eb460d0cf5d00 (diff) | |
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.
| -rw-r--r-- | courtroom.cpp | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/courtroom.cpp b/courtroom.cpp index 9b579d55..4ed4ffbb 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); |
