From 425f9d41cd337133d5677744eef937a8a2a61212 Mon Sep 17 00:00:00 2001 From: "Felix (xq) Queißner" Date: Sun, 7 Jun 2020 10:46:23 +0200 Subject: Adds support for light/dark widget theme, adds experiemental support for http style sheets. --- src/geminirenderer.hpp | 20 ++++++++++++++------ 1 file changed, 14 insertions(+), 6 deletions(-) (limited to 'src/geminirenderer.hpp') diff --git a/src/geminirenderer.hpp b/src/geminirenderer.hpp index 2ec1651..c93fd4e 100644 --- a/src/geminirenderer.hpp +++ b/src/geminirenderer.hpp @@ -47,6 +47,10 @@ struct GeminiStyle //! Create a new style with auto-generated colors for the given //! url. The colors are based on the host name GeminiStyle derive(QUrl const & url) const; + + //! Converts this style into a CSS document for + //! non-gemini rendered files. + QString toStyleSheet() const; }; class GeminiDocument : @@ -60,15 +64,19 @@ public: QColor background_color; }; -class GeminiRenderer +struct GeminiRenderer { - GeminiStyle style; -public: - GeminiRenderer(GeminiStyle const & style = GeminiStyle{}); - - std::unique_ptr render( + GeminiRenderer() = delete; + + //! Renders the given byte sequence into a GeminiDocument. + //! @param input The utf8 encoded input string + //! @param root_url The url that is used to resolve relative links + //! @param style The style which is used to render the document + //! @param outline The extracted outline from the document + static std::unique_ptr render( QByteArray const & input, QUrl const & root_url, + GeminiStyle const & style, DocumentOutlineModel & outline ); }; -- cgit v1.2.3