From 22fd5f2804e919b7d4ff0f99ccd5656cabc9c02f Mon Sep 17 00:00:00 2001 From: ghostfeesh Date: Sat, 28 Jul 2018 09:01:25 +0800 Subject: [PATCH 1/2] Bump to 2.4.10, autoscrolling bug fixes --- Attorney_Online_remake.pro | 2 +- aoapplication.h | 2 +- courtroom.cpp | 10 ++++++++-- 3 files changed, 10 insertions(+), 4 deletions(-) diff --git a/Attorney_Online_remake.pro b/Attorney_Online_remake.pro index 202c93e..32a76e2 100644 --- a/Attorney_Online_remake.pro +++ b/Attorney_Online_remake.pro @@ -13,7 +13,7 @@ RC_ICONS = logo.ico TARGET = Attorney_Online_remake TEMPLATE = app -VERSION = 2.4.9.0 +VERSION = 2.4.10.0 SOURCES += main.cpp\ lobby.cpp \ diff --git a/aoapplication.h b/aoapplication.h index 2aa7d16..f69a0ea 100644 --- a/aoapplication.h +++ b/aoapplication.h @@ -225,7 +225,7 @@ public: private: const int RELEASE = 2; const int MAJOR_VERSION = 4; - const int MINOR_VERSION = 9; + const int MINOR_VERSION = 10; QString current_theme = "default"; diff --git a/courtroom.cpp b/courtroom.cpp index 76d6b03..eb6a786 100644 --- a/courtroom.cpp +++ b/courtroom.cpp @@ -1174,8 +1174,14 @@ void Courtroom::append_ic_text(QString p_text, QString p_name) else { // The user hasn't selected any text and the scrollbar is at the top: scroll to the top. - ui_ic_chatlog->moveCursor(move_op); - ui_ic_chatlog->verticalScrollBar()->setValue(scrollbar_limit); + if(ao_app->ic_scroll_down_enabled()) { + ui_ic_chatlog->moveCursor(QTextCursor::End); + ui_ic_chatlog->verticalScrollBar()->setValue(ui_ic_chatlog->verticalScrollBar()->maximum()); + } + else { + ui_ic_chatlog->moveCursor(QTextCursor::Start); + ui_ic_chatlog->verticalScrollBar()->setValue(ui_ic_chatlog->verticalScrollBar()->minimum()); + } } } From cab730422f59c9ea75a5e175a3cffdbca097880c Mon Sep 17 00:00:00 2001 From: ghostfeesh Date: Sat, 28 Jul 2018 09:52:20 +0800 Subject: [PATCH 2/2] Write off the rest of move_op and friends move_op and friends didn't want to cooperate with scrolling --- courtroom.cpp | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/courtroom.cpp b/courtroom.cpp index eb6a786..bc0b0ad 100644 --- a/courtroom.cpp +++ b/courtroom.cpp @@ -1146,21 +1146,18 @@ void Courtroom::append_ic_text(QString p_text, QString p_name) const QTextCursor old_cursor = ui_ic_chatlog->textCursor(); const int old_scrollbar_value = ui_ic_chatlog->verticalScrollBar()->value(); - QTextCursor::MoveOperation move_op; int scrollbar_limit; if(ao_app->ic_scroll_down_enabled()) { scrollbar_limit = ui_ic_chatlog->verticalScrollBar()->maximum(); - move_op = QTextCursor::End; + ui_ic_chatlog->moveCursor(QTextCursor::End); } else { scrollbar_limit = ui_ic_chatlog->verticalScrollBar()->minimum(); - move_op = QTextCursor::Start; + ui_ic_chatlog->moveCursor(QTextCursor::Start); } const bool is_fully_scrolled = old_scrollbar_value == scrollbar_limit; - - ui_ic_chatlog->moveCursor(move_op); ui_ic_chatlog->textCursor().insertText(p_name, bold); ui_ic_chatlog->textCursor().insertText(p_text + '\n', normal);