diff options
| author | oldmud0 <oldmud0@users.noreply.github.com> | 2020-04-17 21:57:16 -0500 |
|---|---|---|
| committer | oldmud0 <oldmud0@users.noreply.github.com> | 2020-04-17 21:57:16 -0500 |
| commit | 13942345c6a3e7e1625c6c26cc2f2f368a3bff23 (patch) | |
| tree | 73ce940217b57fd47afb6a95e828e6309ed5e683 /src/aotextarea.cpp | |
| parent | faac191f0b9e99b82614ed3959ec5c67f56a1fc3 (diff) | |
Run clang-format on entire project
Indentation fixed to 2 spaces per tab. Braces set to Stroustrup style.
Lines reflow at 80 characters. One-line method bodies are on the same
line as the signature. Space always after `//`. No indentation
on preprocessor macros. Includes are sorted lexicographically.
If you don't want to see this commit on blames, use the hidden
whitespace option on GitHub, or use `-w` in git-blame.
Diffstat (limited to 'src/aotextarea.cpp')
| -rw-r--r-- | src/aotextarea.cpp | 43 |
1 files changed, 23 insertions, 20 deletions
diff --git a/src/aotextarea.cpp b/src/aotextarea.cpp index c7415699..04d44318 100644 --- a/src/aotextarea.cpp +++ b/src/aotextarea.cpp @@ -1,16 +1,14 @@ #include "aotextarea.h" -AOTextArea::AOTextArea(QWidget *p_parent) : QTextBrowser(p_parent) -{ - -} +AOTextArea::AOTextArea(QWidget *p_parent) : QTextBrowser(p_parent) {} void AOTextArea::append_chatmessage(QString p_name, QString p_message, QString p_colour, bool song) { const QTextCursor old_cursor = this->textCursor(); const int old_scrollbar_value = this->verticalScrollBar()->value(); - const bool is_scrolled_down = old_scrollbar_value == this->verticalScrollBar()->maximum(); + const bool is_scrolled_down = + old_scrollbar_value == this->verticalScrollBar()->maximum(); this->moveCursor(QTextCursor::End); @@ -22,9 +20,11 @@ void AOTextArea::append_chatmessage(QString p_name, QString p_message, this->insertHtml("<b><font color=" + p_colour + ">" + p_name.toHtmlEscaped() + "</font></b>: "); - //cheap workarounds ahoy + // cheap workarounds ahoy p_message += " "; - QString result = p_message.toHtmlEscaped().replace("\n", "<br>").replace(omnis_dank_url_regex, "<a href='\\1'>\\1</a>" ); + QString result = p_message.toHtmlEscaped() + .replace("\n", "<br>") + .replace(omnis_dank_url_regex, "<a href='\\1'>\\1</a>"); this->insertHtml(result); @@ -35,32 +35,35 @@ void AOTextArea::append_error(QString p_message) { const QTextCursor old_cursor = this->textCursor(); const int old_scrollbar_value = this->verticalScrollBar()->value(); - const bool is_scrolled_down = old_scrollbar_value == this->verticalScrollBar()->maximum(); + const bool is_scrolled_down = + old_scrollbar_value == this->verticalScrollBar()->maximum(); this->moveCursor(QTextCursor::End); this->append(""); p_message += " "; - QString result = p_message.replace("\n", "<br>").replace(omnis_dank_url_regex, "<a href='\\1'>\\1</a>" ); + QString result = p_message.replace("\n", "<br>") + .replace(omnis_dank_url_regex, "<a href='\\1'>\\1</a>"); this->insertHtml("<font color='red'>" + result + "</font>"); this->auto_scroll(old_cursor, old_scrollbar_value, is_scrolled_down); } -void AOTextArea::auto_scroll(QTextCursor old_cursor, int old_scrollbar_value, bool is_scrolled_down) +void AOTextArea::auto_scroll(QTextCursor old_cursor, int old_scrollbar_value, + bool is_scrolled_down) { - if (old_cursor.hasSelection() || !is_scrolled_down) - { - // The user has selected text or scrolled away from the bottom: maintain position. - this->setTextCursor(old_cursor); - this->verticalScrollBar()->setValue(old_scrollbar_value); + if (old_cursor.hasSelection() || !is_scrolled_down) { + // The user has selected text or scrolled away from the bottom: maintain + // position. + this->setTextCursor(old_cursor); + this->verticalScrollBar()->setValue(old_scrollbar_value); } - else - { - // The user hasn't selected any text and the scrollbar is at the bottom: scroll to the bottom. - this->moveCursor(QTextCursor::End); - this->verticalScrollBar()->setValue(this->verticalScrollBar()->maximum()); + else { + // The user hasn't selected any text and the scrollbar is at the bottom: + // scroll to the bottom. + this->moveCursor(QTextCursor::End); + this->verticalScrollBar()->setValue(this->verticalScrollBar()->maximum()); } } |
