From f27a6c39ea796f946893ced1d9f80441ad9aa18c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Petr=20Mr=C3=A1zek?= Date: Sun, 1 Dec 2013 02:00:42 +0100 Subject: Fix login and startup logging issues Auth uses the refresh endpoint instead of validate. This means less password entering. Console will now only autoscroll when already scrolled all the way down. Better conformance with the Yggdrasil auth protocol (not complete yet, but Mojang launcher isn't complete either). Fix bug that prevented saving the account data (uninitialized variable). Accounts can now trigger account list saving, this is used for the refresh endpoint. --- gui/ConsoleWindow.cpp | 21 ++++++++++++++++++--- 1 file changed, 18 insertions(+), 3 deletions(-) (limited to 'gui/ConsoleWindow.cpp') diff --git a/gui/ConsoleWindow.cpp b/gui/ConsoleWindow.cpp index d8a1b69d..d0210df6 100644 --- a/gui/ConsoleWindow.cpp +++ b/gui/ConsoleWindow.cpp @@ -58,13 +58,23 @@ void ConsoleWindow::writeColor(QString text, const char *color) ui->text->appendHtml(QString("%2").arg(color).arg(text)); else ui->text->appendPlainText(text); - // scroll down - QScrollBar *bar = ui->text->verticalScrollBar(); - bar->setValue(bar->maximum()); } void ConsoleWindow::write(QString data, MessageLevel::Enum mode) { + QScrollBar *bar = ui->text->verticalScrollBar(); + int max_bar = bar->maximum(); + int val_bar = bar->value(); + if(m_scroll_active) + { + if(m_last_scroll_value > val_bar) + m_scroll_active = false; + } + else + { + m_scroll_active = val_bar == max_bar; + } + if (data.endsWith('\n')) data = data.left(data.length() - 1); QStringList paragraphs = data.split('\n'); @@ -93,6 +103,11 @@ void ConsoleWindow::write(QString data, MessageLevel::Enum mode) else while (iter.hasNext()) writeColor(iter.next()); + if(m_scroll_active) + { + bar->setValue(bar->maximum()); + } + m_last_scroll_value = bar->value(); } void ConsoleWindow::clear() -- cgit v1.2.3