Skip to content

Commit

Permalink
Merge pull request #24 from ghostfeesh/version-bump
Browse files Browse the repository at this point in the history
Bump to 2.4.10, autoscrolling bug fixes
  • Loading branch information
oldmud0 authored Jul 28, 2018
2 parents 3129d2a + cab7304 commit 68a3f35
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 9 deletions.
2 changes: 1 addition & 1 deletion Attorney_Online_remake.pro
Original file line number Diff line number Diff line change
Expand Up @@ -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 \
Expand Down
2 changes: 1 addition & 1 deletion aoapplication.h
Original file line number Diff line number Diff line change
Expand Up @@ -225,7 +225,7 @@ class AOApplication : public QApplication
private:
const int RELEASE = 2;
const int MAJOR_VERSION = 4;
const int MINOR_VERSION = 9;
const int MINOR_VERSION = 10;

QString current_theme = "default";

Expand Down
17 changes: 10 additions & 7 deletions courtroom.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand All @@ -1174,8 +1171,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());
}
}
}

Expand Down

0 comments on commit 68a3f35

Please sign in to comment.