From 2ea22d407d6b9faabe610b58c87c3b96407f8b5d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Petr=20Mr=C3=A1zek?= Date: Wed, 14 Feb 2018 21:37:32 +0100 Subject: 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. --- application/pages/OtherLogsPage.cpp | 19 ++++++++++++++++--- 1 file changed, 16 insertions(+), 3 deletions(-) (limited to 'application/pages/OtherLogsPage.cpp') diff --git a/application/pages/OtherLogsPage.cpp b/application/pages/OtherLogsPage.cpp index 31b58a24..2141e0cc 100644 --- a/application/pages/OtherLogsPage.cpp +++ b/application/pages/OtherLogsPage.cpp @@ -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); } } -- cgit v1.2.3