aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorFelix (xq) Queißner <git@mq32.de>2020-06-06 18:28:10 +0200
committerFelix (xq) Queißner <git@mq32.de>2020-06-06 18:28:10 +0200
commitcb69dca1dbf19ae854276803442e724045c4be81 (patch)
tree8c3dd168d5ab337161a44246133bef98fb5be31c
parent7772993ed5d65f10588f3d70961c429991fd7849 (diff)
downloadkristall-cb69dca1dbf19ae854276803442e724045c4be81.tar.gz
Adds color theming, adds automatic color theming with dark/light themes
-rw-r--r--README.md3
-rw-r--r--browsertab.cpp13
-rw-r--r--browsertab.hpp3
-rw-r--r--geminirenderer.cpp131
-rw-r--r--geminirenderer.hpp28
-rw-r--r--settingsdialog.cpp144
-rw-r--r--settingsdialog.hpp34
-rw-r--r--settingsdialog.ui514
8 files changed, 674 insertions, 196 deletions
diff --git a/README.md b/README.md
index e2f7fd2..6d5ae72 100644
--- a/README.md
+++ b/README.md
@@ -15,6 +15,9 @@ A high-quality visual cross-platform gemini browser.
- Tabbed interface
- Survives [ConMans torture suite](gemini://gemini.conman.org/test/torture/)
- [Special link highlighting for different targets](https://mq32.de/public/92f3ec7a64833d01f1ed001d15c8db4158e5d3c2.png)
+- Color Themes
+ - Custom color theme
+ - Automatic light/dark theme based on the host name
- Crossplatform supports
- Linux
- Windows
diff --git a/browsertab.cpp b/browsertab.cpp
index 19a1993..e18350c 100644
--- a/browsertab.cpp
+++ b/browsertab.cpp
@@ -98,7 +98,11 @@ void BrowserTab::on_menu_button_clicked()
connect(menu.addAction("Settings..."), &QAction::triggered, [this]() {
SettingsDialog dialog;
- dialog.exec();
+ dialog.setGeminiStyle(current_style);
+
+ if(dialog.exec() == QDialog::Accepted) {
+ this->current_style = dialog.geminiStyle();
+ }
});
@@ -128,13 +132,18 @@ void BrowserTab::on_gemini_complete(const QByteArray &data, const QString &mime)
this->ui->text_browser->setVisible(mime.startsWith("text/"));
this->ui->graphics_browser->setVisible(mime.startsWith("image/"));
+ ui->text_browser->setStyleSheet("");
+
std::unique_ptr<QTextDocument> document;
this->outline.clear();
if(mime.startsWith("text/gemini")) {
- document = GeminiRenderer{}.render(data, this->current_location, this->outline);
+ auto doc= GeminiRenderer{ current_style }.render(data, this->current_location, this->outline);
+ this->ui->text_browser->setStyleSheet(QString("QTextBrowser { background-color: %1; }").arg(doc->background_color.name()));
+
+ document = std::move(doc);
}
else if(mime.startsWith("text/html")) {
document = std::make_unique<QTextDocument>();
diff --git a/browsertab.hpp b/browsertab.hpp
index 2b9be8c..29bed14 100644
--- a/browsertab.hpp
+++ b/browsertab.hpp
@@ -9,6 +9,7 @@
#include "geminiclient.hpp"
#include "documentoutlinemodel.hpp"
#include "tabbrowsinghistory.hpp"
+#include "geminirenderer.hpp"
namespace Ui {
class BrowserTab;
@@ -100,6 +101,8 @@ public:
TabBrowsingHistory history;
std::unique_ptr<QTextDocument> current_document;
+
+ GeminiStyle current_style;
};
#endif // BROWSERTAB_HPP
diff --git a/geminirenderer.cpp b/geminirenderer.cpp
index 37fe4b4..42dcd04 100644
--- a/geminirenderer.cpp
+++ b/geminirenderer.cpp
@@ -1,7 +1,10 @@
#include "geminirenderer.hpp"
#include <QTextList>
+#include <QCryptographicHash>
#include <QTextBlock>
+#include <QDebug>
+#include <cmath>
static QByteArray trim_whitespace(QByteArray items)
{
@@ -17,6 +20,7 @@ static QByteArray trim_whitespace(QByteArray items)
}
GeminiStyle::GeminiStyle() :
+ theme(Fixed),
standard_font(),
h1_font(),
h2_font(),
@@ -24,6 +28,7 @@ GeminiStyle::GeminiStyle() :
preformatted_font(),
background_color(0xFF, 0xFF, 0xFF),
standard_color(0x00, 0x00, 0x00),
+ preformatted_color(0x00, 0x00, 0x00),
h1_color(0xFF, 0x00, 0x00),
h2_color(0x00, 0x80, 0x00),
h3_color(0x80, 0xFF, 0x00),
@@ -31,7 +36,8 @@ GeminiStyle::GeminiStyle() :
external_link_color(0x00, 0x00, 0xFF),
cross_scheme_link_color(0x80, 0x00, 0xFF),
internal_link_prefix("→ "),
- external_link_prefix("⇒ ")
+ external_link_prefix("⇒ "),
+ margin(55.0)
{
preformatted_font.setFamily("monospace");
preformatted_font.setPointSizeF(10.0);
@@ -52,47 +58,109 @@ GeminiStyle::GeminiStyle() :
h3_font.setPointSizeF(12.0);
}
+GeminiStyle GeminiStyle::derive(const QUrl &url) const
+{
+ if(this->theme == Fixed)
+ return *this;
+
+ QByteArray hash = QCryptographicHash::hash(url.host().toUtf8(), QCryptographicHash::Md5);
+
+ std::array<uint8_t, 16> items;
+ assert(items.size() == hash.size());
+ memcpy(items.data(), hash.data(), items.size());
+
+ float hue = (items[0] + items[1]) / 510.0;
+ float saturation = items[2] / 255.0;
+
+ double tmp;
+ GeminiStyle themed = *this;
+ switch(this->theme)
+ {
+ case AutoDarkTheme: {
+ themed.background_color = QColor::fromHslF(hue, saturation, 0.25f);
+ themed.standard_color = QColor { 0xFF, 0xFF, 0xFF };
+
+ themed.h1_color = QColor::fromHslF(std::modf(hue + 0.5, &tmp), 1.0 - saturation, 0.75);
+ themed.h2_color = QColor::fromHslF(std::modf(hue + 0.5, &tmp), 1.0 - saturation, 0.75);
+ themed.h3_color = QColor::fromHslF(std::modf(hue + 0.5, &tmp), 1.0 - saturation, 0.75);
+
+ themed.external_link_color = QColor::fromHslF(std::modf(hue + 0.25, &tmp), 1.0, 0.75);
+ themed.internal_link_color = themed.external_link_color.lighter(110);
+ themed.cross_scheme_link_color = themed.external_link_color.darker(110);
+
+ break;
+ }
+
+ case AutoLightTheme: {
+ themed.background_color = QColor::fromHslF(hue, items[2] / 255.0, 0.85);
+ themed.standard_color = QColor { 0x00, 0x00, 0x00 };
+
+ themed.h1_color = QColor::fromHslF(std::modf(hue + 0.5, &tmp), 1.0 - saturation, 0.25);
+ themed.h2_color = QColor::fromHslF(std::modf(hue + 0.5, &tmp), 1.0 - saturation, 0.25);
+ themed.h3_color = QColor::fromHslF(std::modf(hue + 0.5, &tmp), 1.0 - saturation, 0.25);
+
+ themed.external_link_color = QColor::fromHslF(std::modf(hue + 0.25, &tmp), 1.0, 0.25);
+ themed.internal_link_color = themed.external_link_color.darker(110);
+ themed.cross_scheme_link_color = themed.external_link_color.lighter(110);
+
+ break;
+ }
+
+ case Fixed:
+ assert(false);
+ }
+
+ // Same for all themes
+ themed.preformatted_color = themed.standard_color;
+
+ return themed;
+}
+
GeminiRenderer::GeminiRenderer(GeminiStyle const & _style) :
style(_style)
{
}
-std::unique_ptr<QTextDocument> GeminiRenderer::render(const QByteArray &input, QUrl const & root_url, DocumentOutlineModel &outline)
+std::unique_ptr<GeminiDocument> GeminiRenderer::render(const QByteArray &input, QUrl const & root_url, DocumentOutlineModel &outline)
{
+ auto themed_style = style.derive(root_url);
QTextCharFormat preformatted;
- preformatted.setFont(style.preformatted_font);
+ preformatted.setFont(themed_style.preformatted_font);
+ preformatted.setForeground(themed_style.preformatted_color);
QTextCharFormat standard;
- standard.setFont(style.standard_font);
+ standard.setFont(themed_style.standard_font);
+ standard.setForeground(themed_style.standard_color);
QTextCharFormat standard_link;
- standard_link.setFont(style.standard_font);
- standard_link.setForeground(QBrush(style.internal_link_color));
+ standard_link.setFont(themed_style.standard_font);
+ standard_link.setForeground(QBrush(themed_style.internal_link_color));
QTextCharFormat external_link;
- external_link.setFont(style.standard_font);
- external_link.setForeground(QBrush(style.external_link_color));
+ external_link.setFont(themed_style.standard_font);
+ external_link.setForeground(QBrush(themed_style.external_link_color));
QTextCharFormat cross_protocol_link;
- cross_protocol_link.setFont(style.standard_font);
- cross_protocol_link.setForeground(QBrush(style.cross_scheme_link_color));
+ cross_protocol_link.setFont(themed_style.standard_font);
+ cross_protocol_link.setForeground(QBrush(themed_style.cross_scheme_link_color));
QTextCharFormat standard_h1;
- standard_h1.setFont(style.h1_font);
- standard_h1.setForeground(QBrush(style.h1_color));
+ standard_h1.setFont(themed_style.h1_font);
+ standard_h1.setForeground(QBrush(themed_style.h1_color));
QTextCharFormat standard_h2;
- standard_h2.setFont(style.h2_font);
- standard_h2.setForeground(QBrush(style.h2_color));
+ standard_h2.setFont(themed_style.h2_font);
+ standard_h2.setForeground(QBrush(themed_style.h2_color));
QTextCharFormat standard_h3;
- standard_h3.setFont(style.h3_font);
- standard_h3.setForeground(QBrush(style.h3_color));
+ standard_h3.setFont(themed_style.h3_font);
+ standard_h3.setForeground(QBrush(themed_style.h3_color));
- std::unique_ptr<QTextDocument> result = std::make_unique<QTextDocument>();
- result->setDocumentMargin(55.0);
+ std::unique_ptr<GeminiDocument> result = std::make_unique<GeminiDocument>();
+ result->setDocumentMargin(themed_style.margin);
+ result->background_color = themed_style.background_color;
QTextCursor cursor { result.get() };
@@ -181,7 +249,13 @@ std::unique_ptr<QTextDocument> GeminiRenderer::render(const QByteArray &input, Q
// qDebug() << link << title;
auto fmt = standard_link;
- if(not local_url.isRelative()) {
+
+ QString prefix;
+ if(absolute_url.host() == root_url.host()) {
+ prefix = themed_style.internal_link_prefix;
+ fmt = standard_link;
+ } else {
+ prefix = themed_style.external_link_prefix;
fmt = external_link;
}
@@ -191,13 +265,6 @@ std::unique_ptr<QTextDocument> GeminiRenderer::render(const QByteArray &input, Q
fmt = cross_protocol_link;
}
- QString prefix = "";
- if(local_url.isRelative() or absolute_url.host() == root_url.host()) {
- prefix = style.internal_link_prefix;
- } else {
- prefix = style.external_link_prefix;
- }
-
fmt.setAnchor(true);
fmt.setAnchorHref(absolute_url.toString());
cursor.insertText(prefix + title + suffix + "\n", fmt);
@@ -214,3 +281,15 @@ std::unique_ptr<QTextDocument> GeminiRenderer::render(const QByteArray &input, Q
outline.endBuild();
return result;
}
+
+GeminiDocument::GeminiDocument(QObject * parent) :
+ QTextDocument(parent),
+ background_color(0x00, 0x00, 0x00)
+{
+
+}
+
+GeminiDocument::~GeminiDocument()
+{
+
+}
diff --git a/geminirenderer.hpp b/geminirenderer.hpp
index 1571710..b9dd57c 100644
--- a/geminirenderer.hpp
+++ b/geminirenderer.hpp
@@ -8,8 +8,16 @@
struct GeminiStyle
{
+ enum Theme {
+ Fixed = 0,
+ AutoDarkTheme = 1,
+ AutoLightTheme = 2
+ };
+
GeminiStyle();
+ Theme theme;
+
QFont standard_font;
QFont h1_font;
QFont h2_font;
@@ -18,6 +26,7 @@ struct GeminiStyle
QColor background_color;
QColor standard_color;
+ QColor preformatted_color;
QColor h1_color;
QColor h2_color;
QColor h3_color;
@@ -28,6 +37,23 @@ struct GeminiStyle
QString internal_link_prefix;
QString external_link_prefix;
+
+ double margin;
+
+ //! 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;
+};
+
+class GeminiDocument :
+ public QTextDocument
+{
+ Q_OBJECT
+public:
+ explicit GeminiDocument(QObject * parent = nullptr);
+ ~GeminiDocument() override;
+
+ QColor background_color;
};
class GeminiRenderer
@@ -36,7 +62,7 @@ class GeminiRenderer
public:
GeminiRenderer(GeminiStyle const & style = GeminiStyle{});
- std::unique_ptr<QTextDocument> render(
+ std::unique_ptr<GeminiDocument> render(
QByteArray const & input,
QUrl const & root_url,
DocumentOutlineModel & outline
diff --git a/settingsdialog.cpp b/settingsdialog.cpp
index 32c37eb..e100c91 100644
--- a/settingsdialog.cpp
+++ b/settingsdialog.cpp
@@ -2,6 +2,7 @@
#include "ui_settingsdialog.h"
#include <QFontDialog>
#include <QColorDialog>
+#include <QStyle>
SettingsDialog::SettingsDialog(QWidget *parent) :
QDialog(parent),
@@ -10,7 +11,16 @@ SettingsDialog::SettingsDialog(QWidget *parent) :
{
ui->setupUi(this);
- setStyle(GeminiStyle { });
+ static_assert(GeminiStyle::Fixed == 0);
+ static_assert(GeminiStyle::AutoDarkTheme == 1);
+ static_assert(GeminiStyle::AutoLightTheme == 2);
+
+ this->ui->auto_theme->clear();
+ this->ui->auto_theme->addItem("Disabled", QVariant::fromValue<int>(GeminiStyle::Fixed));
+ this->ui->auto_theme->addItem("Dark Theme", QVariant::fromValue<int>(GeminiStyle::AutoDarkTheme));
+ this->ui->auto_theme->addItem("Light Theme", QVariant::fromValue<int>(GeminiStyle::AutoLightTheme));
+
+ setGeminiStyle(GeminiStyle { });
}
SettingsDialog::~SettingsDialog()
@@ -36,15 +46,43 @@ static QString formatFont(QFont const & font)
.arg(style);
}
-void SettingsDialog::setStyle(const GeminiStyle &style)
+void SettingsDialog::setGeminiStyle(const GeminiStyle &style)
{
+ static const QString COLOR_STYLE("border: 1px solid black; padding: 4px; background-color : %1; color : %2;");
+
this->current_style = style;
- this->ui->std_preview->setText(formatFont(this->current_style.standard_font));
- this->ui->pre_preview->setText(formatFont(this->current_style.preformatted_font));
- this->ui->h1_preview->setText(formatFont(this->current_style.h1_font));
- this->ui->h2_preview->setText(formatFont(this->current_style.h2_font));
- this->ui->h3_preview->setText(formatFont(this->current_style.h3_font));
+ this->ui->auto_theme->setCurrentIndex(this->current_style.theme);
+
+ auto setFontAndColor = [this](QLabel * label, QFont font, QColor color)
+ {
+ label->setText(formatFont(font));
+ label->setStyleSheet(COLOR_STYLE
+ .arg(this->current_style.background_color.name())
+ .arg(color.name()));
+ };
+
+ ui->bg_preview->setStyleSheet(COLOR_STYLE
+ .arg(this->current_style.background_color.name())
+ .arg("#FF00FF"));
+
+ ui->link_local_preview->setStyleSheet(COLOR_STYLE
+ .arg(this->current_style.background_color.name())
+ .arg(this->current_style.internal_link_color.name()));
+
+ ui->link_foreign_preview->setStyleSheet(COLOR_STYLE
+ .arg(this->current_style.background_color.name())
+ .arg(this->current_style.external_link_color.name()));
+
+ ui->link_cross_preview->setStyleSheet(COLOR_STYLE
+ .arg(this->current_style.background_color.name())
+ .arg(this->current_style.cross_scheme_link_color.name()));
+
+ setFontAndColor(this->ui->std_preview, this->current_style.standard_font, this->current_style.standard_color);
+ setFontAndColor(this->ui->pre_preview, this->current_style.preformatted_font, this->current_style.preformatted_color);
+ setFontAndColor(this->ui->h1_preview, this->current_style.h1_font, this->current_style.h1_color);
+ setFontAndColor(this->ui->h2_preview, this->current_style.h2_font, this->current_style.h2_color);
+ setFontAndColor(this->ui->h3_preview, this->current_style.h3_font, this->current_style.h3_color);
this->reloadStylePreview();
}
@@ -72,14 +110,19 @@ Plain text document here.
░ ░ ░
)gemini";
+ QString host = this->ui->preview_url->text();
+ if(host.length() == 0)
+ host = "preview";
DocumentOutlineModel outline;
auto doc = GeminiRenderer { current_style }.render(
document,
- QUrl("about://preview"),
+ QUrl(QString("about://%1/foobar").arg(host)),
outline
);
+ ui->style_preview->setStyleSheet(QString("QTextBrowser { background-color: %1; }")
+ .arg(doc->background_color.name()));
ui->style_preview->setDocument(doc.get());
preview_document = std::move(doc);
}
@@ -92,11 +135,10 @@ void SettingsDialog::updateFont(QFont & input)
if(dialog.exec() == QDialog::Accepted) {
input = dialog.currentFont();
- setStyle(current_style);
+ setGeminiStyle(current_style);
}
}
-
void SettingsDialog::on_std_change_font_clicked()
{
updateFont(current_style.standard_font);
@@ -121,3 +163,85 @@ void SettingsDialog::on_h3_change_font_clicked()
{
updateFont(current_style.h3_font);
}
+
+void SettingsDialog::updateColor(QColor &input)
+{
+ QColorDialog dialog { this };
+
+ dialog.setCurrentColor(input);
+
+ if(dialog.exec() == QDialog::Accepted) {
+ input = dialog.currentColor();
+ setGeminiStyle(current_style);
+ }
+}
+
+void SettingsDialog::on_std_change_color_clicked()
+{
+ updateColor(current_style.standard_color);
+}
+
+void SettingsDialog::on_pre_change_color_clicked()
+{
+ updateColor(current_style.preformatted_color);
+}
+
+void SettingsDialog::on_h1_change_color_clicked()
+{
+ updateColor(current_style.h1_color);
+}
+
+void SettingsDialog::on_h2_change_color_clicked()
+{
+ updateColor(current_style.h2_color);
+}
+
+void SettingsDialog::on_h3_change_color_clicked()
+{
+ updateColor(current_style.h3_color);
+}
+
+void SettingsDialog::on_bg_change_color_clicked()
+{
+ updateColor(current_style.background_color);
+}
+
+void SettingsDialog::on_link_local_change_color_clicked()
+{
+ updateColor(current_style.internal_link_color);
+}
+
+void SettingsDialog::on_link_foreign_change_color_clicked()
+{
+ updateColor(current_style.external_link_color);
+}
+
+void SettingsDialog::on_link_cross_change_color_clicked()
+{
+ updateColor(current_style.cross_scheme_link_color);
+}
+
+void SettingsDialog::on_link_local_prefix_textChanged(const QString &text)
+{
+ current_style.internal_link_prefix = text;
+ reloadStylePreview();
+}
+
+void SettingsDialog::on_link_foreign_prefix_textChanged(const QString &text)
+{
+ current_style.external_link_prefix = text;
+ reloadStylePreview();
+}
+
+void SettingsDialog::on_auto_theme_currentIndexChanged(int index)
+{
+ if(index >= 0) {
+ current_style.theme = GeminiStyle::Theme(index);
+ reloadStylePreview();
+ }
+}
+
+void SettingsDialog::on_preview_url_textChanged(const QString &arg1)
+{
+ this->reloadStylePreview();
+}
diff --git a/settingsdialog.hpp b/settingsdialog.hpp
index 046e3e7..c86b737 100644
--- a/settingsdialog.hpp
+++ b/settingsdialog.hpp
@@ -17,7 +17,11 @@ public:
explicit SettingsDialog(QWidget *parent = nullptr);
~SettingsDialog();
- void setStyle(GeminiStyle const & style);
+ void setGeminiStyle(GeminiStyle const & style);
+
+ GeminiStyle geminiStyle() const {
+ return current_style;
+ }
private slots:
void on_std_change_font_clicked();
@@ -30,11 +34,39 @@ private slots:
void on_h3_change_font_clicked();
+ void on_std_change_color_clicked();
+
+ void on_pre_change_color_clicked();
+
+ void on_h1_change_color_clicked();
+
+ void on_h2_change_color_clicked();
+
+ void on_h3_change_color_clicked();
+
+ void on_bg_change_color_clicked();
+
+ void on_link_local_change_color_clicked();
+
+ void on_link_foreign_change_color_clicked();
+
+ void on_link_cross_change_color_clicked();
+
+ void on_link_local_prefix_textChanged(const QString &arg1);
+
+ void on_link_foreign_prefix_textChanged(const QString &arg1);
+
+ void on_auto_theme_currentIndexChanged(int index);
+
+ void on_preview_url_textChanged(const QString &arg1);
+
private:
void reloadStylePreview();
void updateFont(QFont & input);
+ void updateColor(QColor & input);
+
private:
Ui::SettingsDialog *ui;
diff --git a/settingsdialog.ui b/settingsdialog.ui
index 935636a..1249b06 100644
--- a/settingsdialog.ui
+++ b/settingsdialog.ui
@@ -6,7 +6,7 @@
<rect>
<x>0</x>
<y>0</y>
- <width>640</width>
+ <width>800</width>
<height>480</height>
</rect>
</property>
@@ -23,217 +23,419 @@
<attribute name="title">
<string>Style</string>
</attribute>
- <layout class="QFormLayout" name="formLayout">
- <item row="0" column="0">
- <widget class="QLabel" name="label">
- <property name="text">
- <string>Standard Font</string>
+ <layout class="QHBoxLayout" name="horizontalLayout_23">
+ <item>
+ <layout class="QFormLayout" name="formLayout_3">
+ <property name="leftMargin">
+ <number>5</number>
</property>
- </widget>
- </item>
- <item row="0" column="1">
- <layout class="QHBoxLayout" name="horizontalLayout">
- <item>
- <widget class="QLabel" name="std_preview">
+ <item row="0" column="1">
+ <layout class="QHBoxLayout" name="horizontalLayout_13">
+ <item>
+ <widget class="QLabel" name="bg_preview">
+ <property name="text">
+ <string>&amp;nbsp;</string>
+ </property>
+ <property name="textFormat">
+ <enum>Qt::MarkdownText</enum>
+ </property>
+ </widget>
+ </item>
+ <item>
+ <widget class="QToolButton" name="bg_change_color">
+ <property name="text">
+ <string/>
+ </property>
+ <property name="icon">
+ <iconset resource="icons.qrc">
+ <normaloff>:/icons/palette.svg</normaloff>:/icons/palette.svg</iconset>
+ </property>
+ </widget>
+ </item>
+ </layout>
+ </item>
+ <item row="0" column="0">
+ <widget class="QLabel" name="label_2">
<property name="text">
- <string>This text will be displayed for normal text.</string>
+ <string>Background Color</string>
</property>
</widget>
</item>
- <item>
- <widget class="QToolButton" name="std_change_font">
+ <item row="1" column="0">
+ <widget class="QLabel" name="label">
<property name="text">
- <string/>
- </property>
- <property name="icon">
- <iconset resource="icons.qrc">
- <normaloff>:/icons/format-font.svg</normaloff>:/icons/format-font.svg</iconset>
+ <string>Standard Font</string>
</property>
</widget>
</item>
- <item>
- <widget class="QToolButton" name="std_change_color">
+ <item row="1" column="1">
+ <layout class="QHBoxLayout" name="horizontalLayout_14">
+ <item>
+ <widget class="QLabel" name="std_preview">
+ <property name="frameShape">
+ <enum>QFrame::NoFrame</enum>
+ </property>
+ <property name="text">
+ <string>This text will be displayed for normal text.</string>
+ </property>
+ </widget>
+ </item>
+ <item>
+ <widget class="QToolButton" name="std_change_font">
+ <property name="text">
+ <string/>
+ </property>
+ <property name="icon">
+ <iconset resource="icons.qrc">
+ <normaloff>:/icons/format-font.svg</normaloff>:/icons/format-font.svg</iconset>
+ </property>
+ </widget>
+ </item>
+ <item>
+ <widget class="QToolButton" name="std_change_color">
+ <property name="text">
+ <string/>
+ </property>
+ <property name="icon">
+ <iconset resource="icons.qrc">
+ <normaloff>:/icons/palette.svg</normaloff>:/icons/palette.svg</iconset>
+ </property>
+ </widget>
+ </item>
+ </layout>
+ </item>
+ <item row="2" column="0">
+ <widget class="QLabel" name="label_3">
<property name="text">
- <string/>
- </property>
- <property name="icon">
- <iconset resource="icons.qrc">
- <normaloff>:/icons/palette.svg</normaloff>:/icons/palette.svg</iconset>
+ <string>Preformatted Font</string>
</property>
</widget>
</item>
- </layout>
- </item>
- <item row="1" column="0">
- <widget class="QLabel" name="label">
- <property name="text">
- <string>Preformatted Font</string>
- </property>
- </widget>
- </item>
- <item row="1" column="1">
- <layout class="QHBoxLayout" name="horizontalLayout">
- <item>
- <widget class="QLabel" name="pre_preview">
+ <item row="2" column="1">
+ <layout class="QHBoxLayout" name="horizontalLayout_15">
+ <item>
+ <widget class="QLabel" name="pre_preview">
+ <property name="frameShape">
+ <enum>QFrame::NoFrame</enum>
+ </property>
+ <property name="text">
+ <string>This text will be displayed for preformatted text.</string>
+ </property>
+ </widget>
+ </item>
+ <item>
+ <widget class="QToolButton" name="pre_change_font">
+ <property name="text">
+ <string/>
+ </property>
+ <property name="icon">
+ <iconset resource="icons.qrc">
+ <normaloff>:/icons/format-font.svg</normaloff>:/icons/format-font.svg</iconset>
+ </property>
+ </widget>
+ </item>
+ <item>
+ <widget class="QToolButton" name="pre_change_color">
+ <property name="text">
+ <string/>
+ </property>
+ <property name="icon">
+ <iconset resource="icons.qrc">
+ <normaloff>:/icons/palette.svg</normaloff>:/icons/palette.svg</iconset>
+ </property>
+ </widget>
+ </item>
+ </layout>
+ </item>
+ <item row="3" column="0">
+ <widget class="QLabel" name="label_4">
<property name="text">
- <string>This text will be displayed for normal text.</string>
+ <string>H1 Font</string>
</property>
</widget>
</item>
- <item>
- <widget class="QToolButton" name="pre_change_font">
+ <item row="3" column="1">
+ <layout class="QHBoxLayout" name="horizontalLayout_16">
+ <item>
+ <widget class="QLabel" name="h1_preview">
+ <property name="frameShape">
+ <enum>QFrame::NoFrame</enum>
+ </property>
+ <property name="text">
+ <string>This text will be displayed for a level 1 heading.</string>
+ </property>
+ </widget>
+ </item>
+ <item>
+ <widget class="QToolButton" name="h1_change_font">
+ <property name="text">
+ <string/>
+ </property>
+ <property name="icon">
+ <iconset resource="icons.qrc">
+ <normaloff>:/icons/format-font.svg</normaloff>:/icons/format-font.svg</iconset>
+ </property>
+ </widget>
+ </item>
+ <item>
+ <widget class="QToolButton" name="h1_change_color">
+ <property name="text">
+ <string/>
+ </property>
+ <property name="icon">
+ <iconset resource="icons.qrc">
+ <normaloff>:/icons/palette.svg</normaloff>:/icons/palette.svg</iconset>
+ </property>
+ </widget>
+ </item>
+ </layout>
+ </item>
+ <item row="4" column="0">
+ <widget class="QLabel" name="label_5">
<property name="text">
- <string/>
- </property>
- <property name="icon">
- <iconset resource="icons.qrc">
- <normaloff>:/icons/format-font.svg</normaloff>:/icons/format-font.svg</iconset>
+ <string>H2 Font</string>
</property>
</widget>
</item>
- <item>
- <widget class="QToolButton" name="pre_change_color">
+ <item row="4" column="1">
+ <layout class="QHBoxLayout" name="horizontalLayout_18">
+ <item>
+ <widget class="QLabel" name="h2_preview">
+ <property name="frameShape">
+ <enum>QFrame::NoFrame</enum>
+ </property>
+ <property name="text">
+ <string>This text will be displayed for a level 2 heading.</string>
+ </property>
+ </widget>
+ </item>
+ <item>
+ <widget class="QToolButton" name="h2_change_font">
+ <property name="text">
+ <string/>
+ </property>
+ <property name="icon">
+ <iconset resource="icons.qrc">
+ <normaloff>:/icons/format-font.svg</normaloff>:/icons/format-font.svg</iconset>
+ </property>
+ </widget>
+ </item>
+ <item>
+ <widget class="QToolButton" name="h2_change_color">
+ <property name="text">
+ <string/>
+ </property>
+ <property name="icon">
+ <iconset resource="icons.qrc">
+ <normaloff>:/icons/palette.svg</normaloff>:/icons/palette.svg</iconset>
+ </property>
+ </widget>
+ </item>
+ </layout>
+ </item>
+ <item row="5" column="0">
+ <widget class="QLabel" name="label_6">
<property name="text">
- <string/>
- </property>
- <property name="icon">
- <iconset resource="icons.qrc">
- <normaloff>:/icons/palette.svg</normaloff>:/icons/palette.svg</iconset>
+ <string>H3 Font</string>
</property>
</widget>
</item>
- </layout>
- </item>
- <item row="2" column="0">
- <widget class="QLabel" name="label">
- <property name="text">
- <string>H1 Font</string>
- </property>
- </widget>
- </item>
- <item row="2" column="1">
- <layout class="QHBoxLayout" name="horizontalLayout">
- <item>
- <widget class="QLabel" name="h1_preview">
+ <item row="5" column="1">
+ <layout class="QHBoxLayout" name="horizontalLayout_19">
+ <item>
+ <widget class="QLabel" name="h3_preview">
+ <property name="styleSheet">
+ <string notr="true">border: 1px solid black;</string>
+ </property>
+ <property name="frameShape">
+ <enum>QFrame::NoFrame</enum>
+ </property>
+ <property name="text">
+ <string>This text will be displayed for a level 3 heading.</string>
+ </property>
+ <property name="textFormat">
+ <enum>Qt::PlainText</enum>
+ </property>
+ </widget>
+ </item>
+ <item>
+ <widget class="QToolButton" name="h3_change_font">
+ <property name="text">
+ <string/>
+ </property>
+ <property name="icon">
+ <iconset resource="icons.qrc">
+ <normaloff>:/icons/format-font.svg</normaloff>:/icons/format-font.svg</iconset>
+ </property>
+ </widget>
+ </item>
+ <item>
+ <widget class="QToolButton" name="h3_change_color">
+ <property name="text">
+ <string/>
+ </property>
+ <property name="icon">
+ <iconset resource="icons.qrc">
+ <normaloff>:/icons/palette.svg</normaloff>:/icons/palette.svg</iconset>
+ </property>
+ </widget>
+ </item>
+ </layout>
+ </item>
+ <item row="6" column="0">
+ <widget class="QLabel" name="label_7">
<property name="text">
- <string>This text will be displayed for a level 1 heading.</string>
+ <string>Local Link Color</string>
</property>
</widget>
</item>
- <item>
- <widget class="QToolButton" name="h1_change_font">
+ <item row="7" column="0">
+ <widget class="QLabel" name="label_8">
<property name="text">
- <string/>
- </property>
- <property name="icon">
- <iconset resource="icons.qrc">
- <normaloff>:/icons/format-font.svg</normaloff>:/icons/format-font.svg</iconset>
+ <string>Foreign Link Color</string>
</property>
</widget>
</item>
- <item>
- <widget class="QToolButton" name="h1_change_color">
+ <item row="8" column="0">
+ <widget class="QLabel" name="label_9">
<property name="text">
- <string/>
- </property>
- <property name="icon">
- <iconset resource="icons.qrc">
- <normaloff>:/icons/palette.svg</normaloff>:/icons/palette.svg</iconset>
+ <string>Cross-Scheme-Color</string>
</property>
</widget>
</item>
- </layout>
- </item>
- <item row="3" column="0">
- <widget class="QLabel" name="label">
- <property name="text">
- <string>H2 Font</string>
- </property>
- </widget>
- </item>
- <item row="3" column="1">
- <layout class="QHBoxLayout" name="horizontalLayout">
- <item>
- <widget class="QLabel" name="h2_preview">
+ <item row="9" column="0">
+ <widget class="QLabel" name="label_10">
<property name="text">
- <string>This text will be displayed for a level 2 heading.</string>
+ <string>Local Link Prefix</string>
</property>
</widget>
</item>
- <item>
- <widget class="QToolButton" name="h2_change_font">
+ <item row="10" column="0">
+ <widget class="QLabel" name="label_11">
<property name="text">
- <string/>
- </property>
- <property name="icon">
- <iconset resource="icons.qrc">
- <normaloff>:/icons/format-font.svg</normaloff>:/icons/format-font.svg</iconset>
+ <string>Extern Link Prefix</string>
</property>
</widget>
</item>
- <item>
- <widget class="QToolButton" name="h2_change_color">
+ <item row="10" column="1">
+ <widget class="QLineEdit" name="link_foreign_prefix">
<property name="text">
- <string/>
- </property>
- <property name="icon">
- <iconset resource="icons.qrc">
- <normaloff>:/icons/palette.svg</normaloff>:/icons/palette.svg</iconset>
+ <string>⇒ </string>
</property>
</widget>
</item>
- </layout>
- </item>
- <item row="4" column="0">
- <widget class="QLabel" name="label">
- <property name="text">
- <string>H3 Font</string>
- </property>
- </widget>
- </item>
- <item row="4" column="1">
- <layout class="QHBoxLayout" name="horizontalLayout">
- <item>
- <widget class="QLabel" name="h3_preview">
+ <item row="9" column="1">
+ <widget class="QLineEdit" name="link_local_prefix">
<property name="text">
- <string>This text will be displayed for a level 3 heading.</string>
- </property>
- <property name="textFormat">
- <enum>Qt::PlainText</enum>
+ <string>→ </string>
</property>
</widget>
</item>
- <item>
- <widget class="QToolButton" name="h3_change_font">
+ <item row="6" column="1">
+ <layout class="QHBoxLayout" name="horizontalLayout_20">
+ <item>
+ <widget class="QLabel" name="link_local_preview">
+ <property name="text">
+ <string>This is a local reference</string>
+ </property>
+ <property name="textFormat">
+ <enum>Qt::MarkdownText</enum>
+ </property>
+ </widget>
+ </item>
+ <item>
+ <widget class="QToolButton" name="link_local_change_color">
+ <property name="text">
+ <string/>
+ </property>
+ <property name="icon">
+ <iconset resource="icons.qrc">
+ <normaloff>:/icons/palette.svg</normaloff>:/icons/palette.svg</iconset>
+ </property>
+ </widget>
+ </item>
+ </layout>
+ </item>
+ <item row="7" column="1">
+ <layout class="QHBoxLayout" name="horizontalLayout_21">
+ <item>
+ <widget class="QLabel" name="link_foreign_preview">
+ <property name="text">
+ <string>This is a foreign reference</string>
+ </property>
+ <property name="textFormat">
+ <enum>Qt::MarkdownText</enum>
+ </property>
+ </widget>
+ </item>
+ <item>
+ <widget class="QToolButton" name="link_foreign_change_color">
+ <property name="text">
+ <string/>
+ </property>
+ <property name="icon">
+ <iconset resource="icons.qrc">
+ <normaloff>:/icons/palette.svg</normaloff>:/icons/palette.svg</iconset>
+ </property>
+ </widget>
+ </item>
+ </layout>
+ </item>
+ <item row="8" column="1">
+ <layout class="QHBoxLayout" name="horizontalLayout_22">
+ <item>
+ <widget class="QLabel" name="link_cross_preview">
+ <property name="text">
+ <string>This reference is cross-scheme</string>
+ </property>
+ <property name="textFormat">
+ <enum>Qt::MarkdownText</enum>
+ </property>
+ </widget>
+ </item>
+ <item>
+ <widget class="QToolButton" name="link_cross_change_color">
+ <property name="text">
+ <string/>
+ </property>
+ <property name="icon">
+ <iconset resource="icons.qrc">
+ <normaloff>:/icons/palette.svg</normaloff>:/icons/palette.svg</iconset>
+ </property>
+ </widget>
+ </item>
+ </layout>
+ </item>
+ <item row="11" column="0">
+ <widget class="QLabel" name="label_12">
<property name="text">
- <string/>
- </property>
- <property name="icon">
- <iconset resource="icons.qrc">
- <normaloff>:/icons/format-font.svg</normaloff>:/icons/format-font.svg</iconset>
+ <string>Auto-Theme Generation</string>
</property>
</widget>
</item>
+ <item row="11" column="1">
+ <widget class="QComboBox" name="auto_theme"/>
+ </item>
+ </layout>
+ </item>
+ <item>
+ <layout class="QVBoxLayout" name="verticalLayout_2">
<item>
- <widget class="QToolButton" name="h3_change_color">
- <property name="text">
- <string/>
+ <widget class="QTextBrowser" name="style_preview">
+ <property name="openLinks">
+ <bool>false</bool>
</property>
- <property name="icon">
- <iconset resource="icons.qrc">
- <normaloff>:/icons/palette.svg</normaloff>:/icons/palette.svg</iconset>
+ </widget>
+ </item>
+ <item>
+ <widget class="QLineEdit" name="preview_url">
+ <property name="placeholderText">
+ <string>host.name</string>
</property>
</widget>
</item>
</layout>
</item>
- <item row="5" column="1">
- <widget class="QTextBrowser" name="style_preview">
- <property name="openLinks">
- <bool>false</bool>
- </property>
- </widget>
- </item>
</layout>
</widget>
<widget class="QWidget" name="generic">
@@ -261,32 +463,32 @@
<connections>
<connection>
<sender>buttonBox</sender>
- <signal>accepted()</signal>
+ <signal>rejected()</signal>
<receiver>SettingsDialog</receiver>
- <slot>accept()</slot>
+ <slot>reject()</slot>
<hints>
<hint type="sourcelabel">
- <x>257</x>
+ <x>325</x>
<y>470</y>
</hint>
<hint type="destinationlabel">
- <x>157</x>
+ <x>286</x>
<y>274</y>
</hint>
</hints>
</connection>
<connection>
<sender>buttonBox</sender>
- <signal>rejected()</signal>
+ <signal>accepted()</signal>
<receiver>SettingsDialog</receiver>
- <slot>reject()</slot>
+ <slot>accept()</slot>
<hints>
<hint type="sourcelabel">
- <x>325</x>
+ <x>257</x>
<y>470</y>
</hint>
<hint type="destinationlabel">
- <x>286</x>
+ <x>157</x>
<y>274</y>
</hint>
</hints>