summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPetr Mrázek <peterix@gmail.com>2014-09-21 00:05:01 +0200
committerPetr Mrázek <peterix@gmail.com>2014-09-21 00:05:48 +0200
commit382e167d646db75860ac21fabae5d3c1a7d4ddb6 (patch)
treee1105ee037720fa5da447efefc0c14b04051bc55
parentde2bb0c6f3a184ffb1d2f6a9ebf1b8651958a62c (diff)
downloadMultiMC-382e167d646db75860ac21fabae5d3c1a7d4ddb6.tar
MultiMC-382e167d646db75860ac21fabae5d3c1a7d4ddb6.tar.gz
MultiMC-382e167d646db75860ac21fabae5d3c1a7d4ddb6.tar.lz
MultiMC-382e167d646db75860ac21fabae5d3c1a7d4ddb6.tar.xz
MultiMC-382e167d646db75860ac21fabae5d3c1a7d4ddb6.zip
Do not choke on large files when showing them in the 'other logs' page.
-rw-r--r--gui/pages/OtherLogsPage.cpp13
1 files changed, 11 insertions, 2 deletions
diff --git a/gui/pages/OtherLogsPage.cpp b/gui/pages/OtherLogsPage.cpp
index 55c632fd..92028f3b 100644
--- a/gui/pages/OtherLogsPage.cpp
+++ b/gui/pages/OtherLogsPage.cpp
@@ -63,7 +63,7 @@ void OtherLogsPage::populateSelectLogBox()
else
{
const int index = ui->selectLogBox->findText(m_currentFile);
- if(index != -1)
+ if (index != -1)
ui->selectLogBox->setCurrentIndex(index);
}
}
@@ -103,7 +103,16 @@ void OtherLogsPage::on_btnReload_clicked()
}
else
{
- ui->text->setPlainText(QString::fromUtf8(file.readAll()));
+ if (file.size() < 10000000ll)
+ {
+ ui->text->setPlainText(QString::fromUtf8(file.readAll()));
+ }
+ else
+ {
+ ui->text->setPlainText(
+ tr("The file (%1) is too big. You may want to open it in a viewer optimized "
+ "for large files.").arg(file.fileName()));
+ }
}
}