From 382e167d646db75860ac21fabae5d3c1a7d4ddb6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Petr=20Mr=C3=A1zek?= Date: Sun, 21 Sep 2014 00:05:01 +0200 Subject: [PATCH] Do not choke on large files when showing them in the 'other logs' page. --- gui/pages/OtherLogsPage.cpp | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/gui/pages/OtherLogsPage.cpp b/gui/pages/OtherLogsPage.cpp index 55c632fdb9..92028f3b56 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())); + } } }