aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--Attorney_Online_remake.pro2
-rw-r--r--aoapplication.h2
-rw-r--r--courtroom.cpp53
3 files changed, 38 insertions, 19 deletions
diff --git a/Attorney_Online_remake.pro b/Attorney_Online_remake.pro
index 32a76e2c..46d65ff7 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.10.0
+VERSION = 2.5.1.0
SOURCES += main.cpp\
lobby.cpp \
diff --git a/aoapplication.h b/aoapplication.h
index b432a735..53968747 100644
--- a/aoapplication.h
+++ b/aoapplication.h
@@ -226,7 +226,7 @@ public:
private:
const int RELEASE = 2;
const int MAJOR_VERSION = 5;
- const int MINOR_VERSION = 0;
+ const int MINOR_VERSION = 1;
QString current_theme = "default";
diff --git a/courtroom.cpp b/courtroom.cpp
index b3c3ba29..352a3da5 100644
--- a/courtroom.cpp
+++ b/courtroom.cpp
@@ -1139,29 +1139,48 @@ void Courtroom::handle_chatmessage_3()
void Courtroom::append_ic_text(QString p_text, QString p_name)
{
+ // a bit of a silly hack, should use QListWidget for IC in the first place though
+ static bool isEmpty = true;
+
QTextCharFormat bold;
QTextCharFormat normal;
bold.setFontWeight(QFont::Bold);
normal.setFontWeight(QFont::Normal);
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()) {
+
+ if (ao_app->ic_scroll_down_enabled()) {
scrollbar_limit = ui_ic_chatlog->verticalScrollBar()->maximum();
- ui_ic_chatlog->moveCursor(QTextCursor::End);
+ move_op = QTextCursor::End;
}
else {
scrollbar_limit = ui_ic_chatlog->verticalScrollBar()->minimum();
- ui_ic_chatlog->moveCursor(QTextCursor::Start);
+ move_op = QTextCursor::Start;
}
-
+
const bool is_fully_scrolled = old_scrollbar_value == scrollbar_limit;
- ui_ic_chatlog->textCursor().insertText(p_name, bold);
- ui_ic_chatlog->textCursor().insertText(p_text + '\n', normal);
-
+ ui_ic_chatlog->moveCursor(move_op);
+
+ if (ao_app->ic_scroll_down_enabled()) {
+ if (!isEmpty)
+ ui_ic_chatlog->textCursor().insertText("\n", normal);
+ else
+ isEmpty = false;
+ ui_ic_chatlog->textCursor().insertText(p_name, bold);
+ ui_ic_chatlog->textCursor().insertText(p_text, normal);
+ } else {
+ ui_ic_chatlog->textCursor().insertText(p_name, bold);
+ ui_ic_chatlog->textCursor().insertText(p_text, normal);
+ if (!isEmpty)
+ ui_ic_chatlog->textCursor().insertText("\n", normal);
+ else
+ isEmpty = false;
+ }
+
if (old_cursor.hasSelection() || !is_fully_scrolled)
{
// The user has selected text or scrolled away from the top: maintain position.
@@ -1171,14 +1190,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.
- 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());
- }
+ ui_ic_chatlog->moveCursor(move_op);
+
+ // update the value to the new maximum/minimum
+ if (ao_app->ic_scroll_down_enabled())
+ scrollbar_limit = ui_ic_chatlog->verticalScrollBar()->maximum();
+ else
+ scrollbar_limit = ui_ic_chatlog->verticalScrollBar()->minimum();
+ ui_ic_chatlog->verticalScrollBar()->setValue(scrollbar_limit);
}
}