Do not choke on large files when showing them in the 'other logs' page.

This commit is contained in:
Petr Mrázek 2014-09-21 00:05:01 +02:00
parent de2bb0c6f3
commit 382e167d64

View File

@ -63,7 +63,7 @@ void OtherLogsPage::populateSelectLogBox()
else else
{ {
const int index = ui->selectLogBox->findText(m_currentFile); const int index = ui->selectLogBox->findText(m_currentFile);
if(index != -1) if (index != -1)
ui->selectLogBox->setCurrentIndex(index); ui->selectLogBox->setCurrentIndex(index);
} }
} }
@ -103,7 +103,16 @@ void OtherLogsPage::on_btnReload_clicked()
} }
else 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()));
}
} }
} }