diff options
| author | Mike Skec <skec@protonmail.ch> | 2021-02-10 19:07:42 +1100 |
|---|---|---|
| committer | Felix Queißner <felix@ib-queissner.de> | 2021-02-10 10:06:15 +0100 |
| commit | 3b064297512692ecb96975c5a068ec87d653e7e0 (patch) | |
| tree | f8239a97d57f0d48ff9c6ee6d3a6f694b3980e8c /src/renderers | |
| parent | b1e25a64dee20f7eb5b7fc15414fb69a7b0ace1d (diff) | |
| download | kristall-3b064297512692ecb96975c5a068ec87d653e7e0.tar.gz | |
Add preferences for new gemini formatting options
Diffstat (limited to 'src/renderers')
| -rw-r--r-- | src/renderers/geminirenderer.cpp | 3 | ||||
| -rw-r--r-- | src/renderers/textstyleinstance.cpp | 30 | ||||
| -rw-r--r-- | src/renderers/textstyleinstance.hpp | 2 |
3 files changed, 20 insertions, 15 deletions
diff --git a/src/renderers/geminirenderer.cpp b/src/renderers/geminirenderer.cpp index 1887dab..7de7027 100644 --- a/src/renderers/geminirenderer.cpp +++ b/src/renderers/geminirenderer.cpp @@ -77,9 +77,8 @@ std::unique_ptr<GeminiDocument> GeminiRenderer::render( { if (current_list == nullptr) { - cursor.setBlockFormat(text_style.list_format); cursor.deletePreviousChar(); - current_list = cursor.insertList(QTextListFormat::ListDisc); + current_list = cursor.insertList(text_style.list_format); } else { diff --git a/src/renderers/textstyleinstance.cpp b/src/renderers/textstyleinstance.cpp index 0a99625..aaf7ee6 100644 --- a/src/renderers/textstyleinstance.cpp +++ b/src/renderers/textstyleinstance.cpp @@ -28,24 +28,30 @@ TextStyleInstance::TextStyleInstance(DocumentStyle const & themed_style) preformatted_format.setNonBreakableLines(true); - block_quote_format.setIndent(2); + block_quote_format.setIndent(themed_style.indent_bq); block_quote_format.setBackground(themed_style.blockquote_color); // Other alignments - standard_format.setAlignment(Qt::AlignJustify); - standard_format.setLineHeight(5, QTextBlockFormat::LineDistanceHeight); - standard_format.setIndent(1); + auto align = themed_style.justify_text ? Qt::AlignJustify : Qt::AlignLeft; - link_format.setLineHeight(5, QTextBlockFormat::LineDistanceHeight); + standard_format.setAlignment(align); + standard_format.setLineHeight(themed_style.line_height_p, + QTextBlockFormat::LineDistanceHeight); + standard_format.setIndent(themed_style.indent_p); - block_quote_format.setAlignment(Qt::AlignJustify); - block_quote_format.setLineHeight(5, QTextBlockFormat::LineDistanceHeight); + link_format.setLineHeight(themed_style.line_height_p, + QTextBlockFormat::LineDistanceHeight); - list_format.setAlignment(Qt::AlignJustify); - list_format.setLineHeight(5, QTextBlockFormat::LineDistanceHeight); - list_format.setIndent(2); + block_quote_format.setAlignment(align); + block_quote_format.setLineHeight(themed_style.line_height_p, + QTextBlockFormat::LineDistanceHeight); - preformatted_format.setIndent(1); + list_format.setStyle(QTextListFormat::ListDisc); + list_format.setIndent(themed_style.indent_l); - heading_format.setLineHeight(0, QTextBlockFormat::LineDistanceHeight); + preformatted_format.setIndent(themed_style.indent_p); + + heading_format.setLineHeight(themed_style.line_height_h, + QTextBlockFormat::LineDistanceHeight); + heading_format.setIndent(themed_style.indent_h); } diff --git a/src/renderers/textstyleinstance.hpp b/src/renderers/textstyleinstance.hpp index 043ddcb..cab2d25 100644 --- a/src/renderers/textstyleinstance.hpp +++ b/src/renderers/textstyleinstance.hpp @@ -22,7 +22,7 @@ struct TextStyleInstance QTextBlockFormat block_quote_format; QTextBlockFormat heading_format; QTextBlockFormat link_format; - QTextBlockFormat list_format; + QTextListFormat list_format; explicit TextStyleInstance(DocumentStyle const & style); }; |
