Commit 559e7b70 authored by Matan Ziv-Av's avatar Matan Ziv-Av
Browse files

Add four profile checkboxes to control rendering options

- Word mode to render (some) words with one drawText() call, instead of
  one per character.
- Ascii - to render words of ASCII characters
- Brahmic - to render words of Brahmic scripts characters.
- Option to consider attribute (color, bold, etc.) as word boundary.
parent 35edb2ee
......@@ -95,6 +95,10 @@ const std::vector<Profile::PropertyInfo> Profile::DefaultProperties = {
{DimWhenInactive, "DimWhenInactive", GENERAL_GROUP, false},
{InvertSelectionColors, "InvertSelectionColors", GENERAL_GROUP, false},
{EmojiFont, "EmojiFont", APPEARANCE_GROUP, QFont()},
{WordMode, "WordMode", APPEARANCE_GROUP, false},
{WordModeAttr, "WordModeAttr", APPEARANCE_GROUP, true},
{WordModeAscii, "WordModeAscii", APPEARANCE_GROUP, true},
{WordModeBrahmic, "WordModeBrahmic", APPEARANCE_GROUP, true},
// Keyboard
#ifdef Q_OS_MACOS
......
......@@ -390,6 +390,20 @@ public:
/** When to show alternating background
*/
AlternatingBackground,
/** Render some sequences of characters with a single drawText() call
*/
WordMode,
/** Attribute changes breaks words
*/
WordModeAttr,
/** Use word mode for ASCII characters
* Used for performance and ligatures
*/
WordModeAscii,
/** Use word mode for Brahmic scripts
* Improves display when the font is not strictly monospace
*/
WordModeBrahmic,
};
Q_ENUM(Property)
......
......@@ -779,7 +779,71 @@
<property name="spacing">
<number>6</number>
</property>
<item row="1" column="0">
<item row="31" column="1">
<widget class="QCheckBox" name="wordMode">
<property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="toolTip">
<string>Enable word mode text rendering</string>
</property>
<property name="text">
<string>Word mode</string>
</property>
</widget>
</item>
<item row="32" column="1">
<widget class="QCheckBox" name="wordModeAttr">
<property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="toolTip">
<string>Ignore attribute changes mid-word (otherwise, attribute changes break word when rendering)</string>
</property>
<property name="text">
<string>Use the same attributes for whole word</string>
</property>
</widget>
</item>
<item row="33" column="1">
<widget class="QCheckBox" name="wordModeAscii">
<property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="toolTip">
<string>Render words of ASCII characters together</string>
</property>
<property name="text">
<string>ASCII characters </string>
</property>
</widget>
</item>
<item row="34" column="1">
<widget class="QCheckBox" name="wordModeBrahmic">
<property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="toolTip">
<string>Render words of Brahmic scripts characters together</string>
</property>
<property name="text">
<string>Brahmic scripts characters</string>
</property>
</widget>
</item>
<item row="61" column="0">
<widget class="QLabel" name="label_17">
<property name="sizePolicy">
<sizepolicy hsizetype="Fixed" vsizetype="Preferred">
......@@ -795,7 +859,7 @@
</property>
</widget>
</item>
<item row="1" column="1">
<item row="61" column="1">
<widget class="QPushButton" name="emojiFontPreview">
<property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="Fixed">
......@@ -805,7 +869,7 @@
</property>
</widget>
</item>
<item row="2" column="1">
<item row="102" column="1">
<widget class="QCheckBox" name="enableBidiRenderingButton">
<property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="Fixed">
......@@ -821,7 +885,7 @@
</property>
</widget>
</item>
<item row="3" column="1">
<item row="103" column="1">
<widget class="QCheckBox" name="bidiLineLTR">
<property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="Fixed">
......@@ -837,7 +901,7 @@
</property>
</widget>
</item>
<item row="4" column="1">
<item row="104" column="1">
<widget class="QCheckBox" name="enableBidiTableDirOverrideButton">
<property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="Fixed">
......@@ -853,7 +917,7 @@
</property>
</widget>
</item>
<item row="10" column="0" colspan="2">
<item row="1000" column="0" colspan="2">
<spacer>
<property name="orientation">
<enum>Qt::Vertical</enum>
......
......@@ -856,6 +856,21 @@ void EditProfileDialog::setupAppearancePage(const Profile::Ptr &profile)
_appearanceUi->bidiLineLTR->setChecked(profile->property<bool>(Profile::BidiLineLTR));
connect(_appearanceUi->bidiLineLTR, &QPushButton::toggled, this, &EditProfileDialog::togglebidiLineLTR);
_appearanceUi->bidiLineLTR->setEnabled(profile->bidiRenderingEnabled());
_appearanceUi->wordMode->setChecked(profile->property<bool>(Profile::WordMode));
connect(_appearanceUi->wordMode, &QPushButton::toggled, this, &EditProfileDialog::toggleWordMode);
_appearanceUi->wordModeAttr->setEnabled(profile->property<bool>(Profile::WordMode));
_appearanceUi->wordModeAscii->setEnabled(profile->property<bool>(Profile::WordMode));
_appearanceUi->wordModeBrahmic->setEnabled(profile->property<bool>(Profile::WordMode));
_appearanceUi->wordModeAttr->setChecked(profile->property<bool>(Profile::WordModeAttr));
connect(_appearanceUi->wordModeAttr, &QPushButton::toggled, this, &EditProfileDialog::toggleWordModeAttr);
_appearanceUi->wordModeAscii->setChecked(profile->property<bool>(Profile::WordModeAscii));
connect(_appearanceUi->wordModeAscii, &QPushButton::toggled, this, &EditProfileDialog::toggleWordModeAscii);
_appearanceUi->wordModeBrahmic->setChecked(profile->property<bool>(Profile::WordModeBrahmic));
connect(_appearanceUi->wordModeBrahmic, &QPushButton::toggled, this, &EditProfileDialog::toggleWordModeBrahmic);
}
void EditProfileDialog::setAntialiasText(bool enable)
......@@ -2036,3 +2051,26 @@ void EditProfileDialog::peekPrimaryKeySequenceChanged()
{
updateTempProfileProperty(Profile::PeekPrimaryKeySequence, _advancedUi->peekPrimaryWidget->keySequence().toString());
}
void EditProfileDialog::toggleWordMode(bool mode)
{
updateTempProfileProperty(Profile::WordMode, mode);
_appearanceUi->wordModeAttr->setEnabled(mode);
_appearanceUi->wordModeAscii->setEnabled(mode);
_appearanceUi->wordModeBrahmic->setEnabled(mode);
}
void EditProfileDialog::toggleWordModeAttr(bool mode)
{
updateTempProfileProperty(Profile::WordModeAttr, mode);
}
void EditProfileDialog::toggleWordModeAscii(bool mode)
{
updateTempProfileProperty(Profile::WordModeAscii, mode);
}
void EditProfileDialog::toggleWordModeBrahmic(bool mode)
{
updateTempProfileProperty(Profile::WordModeBrahmic, mode);
}
......@@ -226,6 +226,11 @@ private Q_SLOTS:
void peekPrimaryKeySequenceChanged();
void toggleWordMode(bool mode);
void toggleWordModeAttr(bool mode);
void toggleWordModeAscii(bool mode);
void toggleWordModeBrahmic(bool mode);
private:
Q_DISABLE_COPY(EditProfileDialog)
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment