GH-604 use the same font for 'Other Logs' as for the main log

This doesn't mean coloring, just the same font and font size.
This commit is contained in:
Petr Mrázek 2018-02-14 21:37:32 +01:00
parent 22b32fce12
commit 2ea22d407d
2 changed files with 17 additions and 3 deletions

View File

@ -18,6 +18,7 @@ NotificationDialog::NotificationDialog(const NotificationChecker::NotificationEn
case NotificationChecker::NotificationEntry::Warning:
icon = QStyle::SP_MessageBoxWarning;
break;
default:
case NotificationChecker::NotificationEntry::Information:
icon = QStyle::SP_MessageBoxInformation;
break;

View File

@ -127,9 +127,22 @@ void OtherLogsPage::on_btnReload_clicked()
}
else
{
auto setPlainText = [&](const QString & text)
{
QString fontFamily = MMC->settings()->get("ConsoleFont").toString();
bool conversionOk = false;
int fontSize = MMC->settings()->get("ConsoleFontSize").toInt(&conversionOk);
if(!conversionOk)
{
fontSize = 11;
}
QTextDocument *doc = ui->text->document();
doc->setDefaultFont(QFont(fontFamily, fontSize));
ui->text->setPlainText(text);
};
auto showTooBig = [&]()
{
ui->text->setPlainText(
setPlainText(
tr("The file (%1) is too big. You may want to open it in a viewer optimized "
"for large files.").arg(file.fileName()));
};
@ -144,7 +157,7 @@ void OtherLogsPage::on_btnReload_clicked()
QByteArray temp;
if(!GZip::unzip(file.readAll(), temp))
{
ui->text->setPlainText(
setPlainText(
tr("The file (%1) is not readable.").arg(file.fileName()));
return;
}
@ -159,7 +172,7 @@ void OtherLogsPage::on_btnReload_clicked()
showTooBig();
return;
}
ui->text->setPlainText(content);
setPlainText(content);
}
}