summaryrefslogtreecommitdiffstats
path: root/gui/ConsoleWindow.cpp
diff options
context:
space:
mode:
authorPetr Mrázek <peterix@gmail.com>2013-12-01 02:00:42 +0100
committerPetr Mrázek <peterix@gmail.com>2013-12-01 02:00:42 +0100
commitf27a6c39ea796f946893ced1d9f80441ad9aa18c (patch)
treefed31b28bc7752f4fea85aefddfeff62701e13b7 /gui/ConsoleWindow.cpp
parent2eaf33816b0c4f6fd61ea2b086fa1c4f9fcba4c5 (diff)
downloadMultiMC-f27a6c39ea796f946893ced1d9f80441ad9aa18c.tar
MultiMC-f27a6c39ea796f946893ced1d9f80441ad9aa18c.tar.gz
MultiMC-f27a6c39ea796f946893ced1d9f80441ad9aa18c.tar.lz
MultiMC-f27a6c39ea796f946893ced1d9f80441ad9aa18c.tar.xz
MultiMC-f27a6c39ea796f946893ced1d9f80441ad9aa18c.zip
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.
Diffstat (limited to 'gui/ConsoleWindow.cpp')
-rw-r--r--gui/ConsoleWindow.cpp21
1 files changed, 18 insertions, 3 deletions
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("<font color=\"%1\">%2</font>").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()