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);
} }
} }
@ -102,9 +102,18 @@ void OtherLogsPage::on_btnReload_clicked()
.arg(m_currentFile, file.errorString())); .arg(m_currentFile, file.errorString()));
} }
else else
{
if (file.size() < 10000000ll)
{ {
ui->text->setPlainText(QString::fromUtf8(file.readAll())); 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()));
}
}
} }
void OtherLogsPage::on_btnPaste_clicked() void OtherLogsPage::on_btnPaste_clicked()