aboutsummaryrefslogtreecommitdiff
path: root/src/browsertab.cpp
diff options
context:
space:
mode:
authorKarol Kosek <krkk@krkk.ct8.pl>2021-04-10 22:02:03 +0200
committerFelix Queißner <felix@ib-queissner.de>2021-04-11 21:18:11 +0200
commit9b148c919ff259534fd06ffaaed8c972b5bb6de3 (patch)
treeb4604fbc5ee0a952ef3d59d9e9d4281b15ab7e2b /src/browsertab.cpp
parentd9d624d010cee368b473094e72ce3c25665ca8f5 (diff)
BrowserTab: simplify unsupported media type error
Diffstat (limited to 'src/browsertab.cpp')
-rw-r--r--src/browsertab.cpp43
1 files changed, 11 insertions, 32 deletions
diff --git a/src/browsertab.cpp b/src/browsertab.cpp
index f4fe6dd..593bdd0 100644
--- a/src/browsertab.cpp
+++ b/src/browsertab.cpp
@@ -750,13 +750,9 @@ void BrowserTab::renderPage(const QByteArray &data, const MimeType &mime)
will_cache = false;
}
- else if (plaintext_only)
+ else
{
- document = std::make_unique<QTextDocument>();
- document->setDefaultFont(doc_style.standard_font);
- document->setDefaultStyleSheet(doc_style.toStyleSheet());
-
- QString plain_data = QString(
+ QString page_data = QString(
tr("Unsupported Media Type!\n"
"\n"
"Kristall cannot display the requested document\n"
@@ -766,32 +762,15 @@ void BrowserTab::renderPage(const QByteArray &data, const MimeType &mime)
"- Size: %3\n")
).arg(mime.type, mime.subtype, IoUtil::size_human(data.size()));
- document->setPlainText(plain_data);
-
- will_cache = false;
- }
- else
- {
- QString page_data = QString(
- tr("# Unsupported Media Type!\n"
- "\n"
- "Kristall cannot display the requested document.\n"
- "\n"
- "> To view this media, use the File menu to save it to your local drive, then open the saved file in another program that can display the document for you.\n"
- "\n"
- "```\n"
- "Details:\n"
- "- MIME type: %1/%2\n"
- "- Size: %3\n"
- "```\n")
- ).arg(mime.type, mime.subtype, IoUtil::size_human(data.size()));
-
- document = GeminiRenderer::render(
- page_data.toUtf8(),
- this->current_location,
- doc_style,
- this->outline,
- this->page_title);
+ if (plaintext_only)
+ document = PlainTextRenderer::render(page_data.toUtf8(), doc_style);
+ else
+ document = GeminiRenderer::render(
+ page_data.toUtf8(),
+ this->current_location,
+ doc_style,
+ this->outline,
+ this->page_title);
will_cache = false;
}