aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorMike Skec <skec@protonmail.ch>2021-02-19 21:08:00 +1100
committerFelix Queißner <felix@ib-queissner.de>2021-02-20 12:10:48 +0100
commit995ff2c30ac9e062c698844ddfa7fc06a941197e (patch)
treec50b6fcc60f5acc7c6797f1430a42e4c3313db1f /src
parent0659d87271ea4943ed61f59beeba4ba636b6dfc1 (diff)
downloadkristall-995ff2c30ac9e062c698844ddfa7fc06a941197e.tar.gz
List item symbol prefernece
Diffstat (limited to 'src')
-rw-r--r--src/about/help.gemini2
-rw-r--r--src/dialogs/settingsdialog.cpp20
-rw-r--r--src/dialogs/settingsdialog.hpp2
-rw-r--r--src/dialogs/settingsdialog.ui14
-rw-r--r--src/documentstyle.cpp5
-rw-r--r--src/documentstyle.hpp2
-rw-r--r--src/renderers/textstyleinstance.cpp2
7 files changed, 44 insertions, 3 deletions
diff --git a/src/about/help.gemini b/src/about/help.gemini
index 95f7303..52493cb 100644
--- a/src/about/help.gemini
+++ b/src/about/help.gemini
@@ -206,6 +206,8 @@ Most items in the *Style* category have either a [Font], [Color] or both buttons
* [Quo] controls indent size of blockquotes (default: 1)
* [Lst] controls indent size of unordered lists (default: 2)
+[List item marker] simply lets you set what symbol is used in list items. By default this is set to Filled Circle.
+
[Presets] is a cool feature to save, restore and share your color themes. The dropdown contains a list of all previously created colors schemes. With the [+] button you can create a scheme with a unique name. The floppy disk button will override the currently selected preset with all the settings displayed above. The folder button will restore a previously saved preset. The last two buttons allow you to import/export presets to disk and share them with your friends! Share all your beautiful color schemes with the world!
The lone text with with the [host.name] text in it can be used to preview some auto-generated themes. It only refreshes the preview and seeds the auto generator with a new host name.
diff --git a/src/dialogs/settingsdialog.cpp b/src/dialogs/settingsdialog.cpp
index f441824..5283d47 100644
--- a/src/dialogs/settingsdialog.cpp
+++ b/src/dialogs/settingsdialog.cpp
@@ -43,6 +43,11 @@ SettingsDialog::SettingsDialog(QWidget *parent) :
this->ui->ui_density->addItem(tr("Compact"), QVariant::fromValue<int>(int(UIDensity::compact)));
this->ui->ui_density->addItem(tr("Classic"), QVariant::fromValue<int>(int(UIDensity::classic)));
+ this->ui->list_symbol->clear();
+ this->ui->list_symbol->addItem("Filled circle", QVariant::fromValue<int>(int(QTextListFormat::Style::ListDisc)));
+ this->ui->list_symbol->addItem("Circle", QVariant::fromValue<int>(int(QTextListFormat::Style::ListCircle)));
+ this->ui->list_symbol->addItem("Square", QVariant::fromValue<int>(int(QTextListFormat::Style::ListSquare)));
+
setGeminiStyle(DocumentStyle { });
this->predefined_styles.clear();
@@ -132,6 +137,14 @@ void SettingsDialog::setGeminiStyle(DocumentStyle const &style)
this->ui->indent_h->setValue(this->current_style.indent_h);
this->ui->indent_l->setValue(this->current_style.indent_l);
+ this->ui->list_symbol->setCurrentIndex(0);
+ for(int i = 0; i < this->ui->list_symbol->count(); ++i) {
+ if(this->ui->list_symbol->itemData(i).toInt() == int(this->current_style.list_symbol)) {
+ this->ui->list_symbol->setCurrentIndex(i);
+ break;
+ }
+ }
+
auto setFontAndColor = [this](QLabel * label, const QFont &font, QColor color)
{
label->setText(formatFont(font));
@@ -539,6 +552,13 @@ void SettingsDialog::on_indent_l_valueChanged(int value)
this->reloadStylePreview();
}
+void SettingsDialog::on_list_symbol_currentIndexChanged(int index)
+{
+ if(index >= 0) {
+ current_style.list_symbol = QTextListFormat::Style(this->ui->list_symbol->itemData(index).toInt());
+ reloadStylePreview();
+ }
+}
void SettingsDialog::on_presets_currentIndexChanged(int index)
{
diff --git a/src/dialogs/settingsdialog.hpp b/src/dialogs/settingsdialog.hpp
index 67612c8..8dab4ce 100644
--- a/src/dialogs/settingsdialog.hpp
+++ b/src/dialogs/settingsdialog.hpp
@@ -98,6 +98,8 @@ private slots:
void on_indent_h_valueChanged(int value);
void on_indent_l_valueChanged(int value);
+ void on_list_symbol_currentIndexChanged(int index);
+
void on_presets_currentIndexChanged(int index);
void on_preset_new_clicked();
diff --git a/src/dialogs/settingsdialog.ui b/src/dialogs/settingsdialog.ui
index ace370d..497ac01 100644
--- a/src/dialogs/settingsdialog.ui
+++ b/src/dialogs/settingsdialog.ui
@@ -1238,13 +1238,24 @@
</item>
<item row="21" column="0">
+ <widget class="QLabel" name="label_41">
+ <property name="text">
+ <string>List item marker</string>
+ </property>
+ </widget>
+ </item>
+ <item row="21" column="1">
+ <widget class="QComboBox" name="list_symbol"/>
+ </item>
+
+ <item row="22" column="0">
<widget class="QLabel" name="label_17">
<property name="text">
<string>Presets</string>
</property>
</widget>
</item>
- <item row="21" column="1">
+ <item row="22" column="1">
<layout class="QHBoxLayout" name="horizontalLayout_2">
<item>
<widget class="QComboBox" name="presets"/>
@@ -1488,6 +1499,7 @@
<tabstop>indent_h</tabstop>
<tabstop>indent_bq</tabstop>
<tabstop>indent_l</tabstop>
+ <tabstop>list_symbol</tabstop>
<tabstop>presets</tabstop>
<tabstop>preset_new</tabstop>
<tabstop>preset_save</tabstop>
diff --git a/src/documentstyle.cpp b/src/documentstyle.cpp
index a1a0f29..3316f9c 100644
--- a/src/documentstyle.cpp
+++ b/src/documentstyle.cpp
@@ -147,7 +147,8 @@ DocumentStyle::DocumentStyle(bool do_init) : theme(Fixed),
text_width_enabled(true),
line_height_p(5.0),
line_height_h(0.0),
- indent_bq(1), indent_p(1), indent_h(0), indent_l(2)
+ indent_bq(1), indent_p(1), indent_h(0), indent_l(2),
+ list_symbol(QTextListFormat::ListDisc)
{
if (do_init) this->initialiseDefaultFonts();
}
@@ -298,6 +299,7 @@ bool DocumentStyle::save(QSettings &settings) const
settings.setValue("indent_p", indent_p);
settings.setValue("indent_h", indent_h);
settings.setValue("indent_l", indent_l);
+ settings.setValue("list_symbol", (int)list_symbol);
settings.endGroup();
}
@@ -414,6 +416,7 @@ bool DocumentStyle::load(QSettings &settings)
indent_p = settings.value("indent_p", indent_p).toInt();
indent_h = settings.value("indent_h", indent_h).toInt();
indent_l = settings.value("indent_l", indent_l).toInt();
+ list_symbol = (QTextListFormat::Style)settings.value("list_symbol", list_symbol).toInt();
settings.endGroup();
}
diff --git a/src/documentstyle.hpp b/src/documentstyle.hpp
index c3ac368..1204595 100644
--- a/src/documentstyle.hpp
+++ b/src/documentstyle.hpp
@@ -5,6 +5,7 @@
#include <QFont>
#include <QColor>
#include <QSettings>
+#include <QTextListFormat>
struct DocumentStyle
{
@@ -61,6 +62,7 @@ struct DocumentStyle
double line_height_p;
double line_height_h;
int indent_bq, indent_p, indent_h, indent_l;
+ QTextListFormat::Style list_symbol;
bool save(QSettings & settings) const;
bool load(QSettings & settings);
diff --git a/src/renderers/textstyleinstance.cpp b/src/renderers/textstyleinstance.cpp
index cce6313..6190907 100644
--- a/src/renderers/textstyleinstance.cpp
+++ b/src/renderers/textstyleinstance.cpp
@@ -53,7 +53,7 @@ TextStyleInstance::TextStyleInstance(DocumentStyle const & themed_style)
blockquote_tableformat.setLeftMargin(20.0 * themed_style.indent_bq);
blockquote_tableformat.setBottomMargin(20.0);
- list_format.setStyle(QTextListFormat::ListDisc);
+ list_format.setStyle(themed_style.list_symbol);
list_format.setIndent(themed_style.indent_l);
preformatted_format.setIndent(themed_style.indent_p);