summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKurt Hindenburg <kurt.hindenburg@gmail.com>2016-07-19 01:34:11 (GMT)
committerKurt Hindenburg <kurt.hindenburg@gmail.com>2016-07-19 01:34:11 (GMT)
commita4de3feb16df7f18559587ebf78f115d88acc022 (patch)
treed9876b8c1c3b3d34c7a5705fd491cbfd72b945c1
parent4c57169c98b8031d258286b3c6bc07388adc096a (diff)
Add option to use the selected font's line characters
Konsole has builtin code to manually write out line characters. There are certain reasons why this might not be desired. This adds a profile option to use the fonts line characters. The default is as-is today using the builtin code. BUG: 364992
-rw-r--r--src/EditProfileDialog.cpp9
-rw-r--r--src/EditProfileDialog.h1
-rw-r--r--src/EditProfileDialog.ui10
-rw-r--r--src/Profile.cpp2
-rw-r--r--src/Profile.h8
-rw-r--r--src/TerminalDisplay.cpp3
-rw-r--r--src/TerminalDisplay.h16
-rw-r--r--src/ViewManager.cpp1
8 files changed, 49 insertions, 1 deletions
diff --git a/src/EditProfileDialog.cpp b/src/EditProfileDialog.cpp
index dbc54b9..a85cd5b 100644
--- a/src/EditProfileDialog.cpp
+++ b/src/EditProfileDialog.cpp
@@ -447,6 +447,10 @@ void EditProfileDialog::setupAppearancePage(const Profile::Ptr profile)
_ui->boldIntenseButton->setChecked(profile->boldIntense());
connect(_ui->boldIntenseButton, &QCheckBox::toggled, this, &Konsole::EditProfileDialog::setBoldIntense);
+
+ _ui->useFontLineCharactersButton->setChecked(profile->useFontLineCharacters());
+ connect(_ui->useFontLineCharactersButton, &QCheckBox::toggled, this, &Konsole::EditProfileDialog::useFontLineCharacters);
+
_ui->enableMouseWheelZoomButton->setChecked(profile->mouseWheelZoomEnabled());
connect(_ui->enableMouseWheelZoomButton, &QCheckBox::toggled, this, &Konsole::EditProfileDialog::toggleMouseWheelZoom);
}
@@ -474,6 +478,11 @@ void EditProfileDialog::setBoldIntense(bool enable)
preview(Profile::BoldIntense, enable);
updateTempProfileProperty(Profile::BoldIntense, enable);
}
+void EditProfileDialog::useFontLineCharacters(bool enable)
+{
+ preview(Profile::UseFontLineCharacters, enable);
+ updateTempProfileProperty(Profile::UseFontLineCharacters, enable);
+}
void EditProfileDialog::toggleMouseWheelZoom(bool enable)
{
updateTempProfileProperty(Profile::MouseWheelZoomEnabled, enable);
diff --git a/src/EditProfileDialog.h b/src/EditProfileDialog.h
index 64e3263..1195c14 100644
--- a/src/EditProfileDialog.h
+++ b/src/EditProfileDialog.h
@@ -126,6 +126,7 @@ private slots:
void showAllFontsButtonWarning(bool enable);
void setAntialiasText(bool enable);
void setBoldIntense(bool enable);
+ void useFontLineCharacters(bool enable);
void showFontDialog();
void newColorScheme();
void editColorScheme();
diff --git a/src/EditProfileDialog.ui b/src/EditProfileDialog.ui
index 7b86c6f..1acec37 100644
--- a/src/EditProfileDialog.ui
+++ b/src/EditProfileDialog.ui
@@ -613,6 +613,16 @@
</property>
</widget>
</item>
+ <item>
+ <widget class="QCheckBox" name="useFontLineCharactersButton">
+ <property name="toolTip">
+ <string>Use the selected font for line characters instead of the builtin code</string>
+ </property>
+ <property name="text">
+ <string>Use line characters contained in font</string>
+ </property>
+ </widget>
+ </item>
</layout>
</widget>
</item>
diff --git a/src/Profile.cpp b/src/Profile.cpp
index c58eacd..06fe5b1 100644
--- a/src/Profile.cpp
+++ b/src/Profile.cpp
@@ -78,6 +78,7 @@ const Profile::PropertyInfo Profile::DefaultPropertyNames[] = {
, { ColorScheme , "colors" , 0 , QVariant::String }
, { AntiAliasFonts, "AntiAliasFonts" , APPEARANCE_GROUP , QVariant::Bool }
, { BoldIntense, "BoldIntense", APPEARANCE_GROUP, QVariant::Bool }
+ , { UseFontLineCharacters, "UseFontLineChararacters", APPEARANCE_GROUP, QVariant::Bool }
, { LineSpacing , "LineSpacing" , APPEARANCE_GROUP , QVariant::Int }
// Keyboard
@@ -199,6 +200,7 @@ FallbackProfile::FallbackProfile()
setProperty(DefaultEncoding, QString(QTextCodec::codecForLocale()->name()));
setProperty(AntiAliasFonts, true);
setProperty(BoldIntense, true);
+ setProperty(UseFontLineCharacters, false);
setProperty(WordCharacters, ":@-./_~?&=%+#");
diff --git a/src/Profile.h b/src/Profile.h
index 37a0559..de74afa 100644
--- a/src/Profile.h
+++ b/src/Profile.h
@@ -223,6 +223,9 @@ public:
/** (bool) Whether character with intense colors should be rendered
* in bold font or just in bright color. */
BoldIntense,
+ /** (bool) Whether to use font's line characters instead of the
+ * builtin code. */
+ UseFontLineCharacters,
/** (bool) Whether new sessions should be started in the same
* directory as the currently active session.
*/
@@ -479,6 +482,11 @@ public:
return property<bool>(Profile::BoldIntense);
}
+ /** Convenience method for property<bool>(Profile::UseFontLineCharacters)*/
+ bool useFontLineCharacters() const {
+ return property<bool>(Profile::UseFontLineCharacters);
+ }
+
/** Convenience method for property<bool>(Profile::StartInCurrentSessionDir) */
bool startInCurrentSessionDir() const {
return property<bool>(Profile::StartInCurrentSessionDir);
diff --git a/src/TerminalDisplay.cpp b/src/TerminalDisplay.cpp
index c7fb3c6..4f28837 100644
--- a/src/TerminalDisplay.cpp
+++ b/src/TerminalDisplay.cpp
@@ -375,6 +375,7 @@ TerminalDisplay::TerminalDisplay(QWidget* parent)
, _filterUpdateRequired(true)
, _cursorShape(Enum::BlockCursor)
, _antialiasText(true)
+ , _useFontLineCharacters(false)
, _printerFriendly(false)
, _sessionController(0)
, _trimTrailingSpaces(false)
@@ -854,7 +855,7 @@ void TerminalDisplay::drawCharacters(QPainter& painter,
}
// draw text
- if (isLineCharString(text)) {
+ if (isLineCharString(text) && !_useFontLineCharacters) {
drawLineCharString(painter, rect.x(), rect.y(), text, style);
} else {
// Force using LTR as the document layout for the terminal area, because
diff --git a/src/TerminalDisplay.h b/src/TerminalDisplay.h
index 7f09a52..93c98ab 100644
--- a/src/TerminalDisplay.h
+++ b/src/TerminalDisplay.h
@@ -415,6 +415,21 @@ public:
}
/**
+ * Specifies whether line characters will be displayed using font instead
+ * of builtin code.
+ * as bold. Defaults to false.
+ */
+ void setUseFontLineCharacters(bool value) {
+ _useFontLineCharacters = value;
+ }
+ /**
+ * Returns true if font line characters will be used.
+ */
+ bool getFontLineCharacters() const {
+ return _useFontLineCharacters;
+ }
+
+ /**
* Sets whether or not the current height and width of the
* terminal in lines and columns is displayed whilst the widget
* is being resized.
@@ -920,6 +935,7 @@ private:
InputMethodData _inputMethodData;
bool _antialiasText; // do we anti-alias or not
+ bool _useFontLineCharacters;
bool _printerFriendly; // are we currently painting to a printer in black/white mode
diff --git a/src/ViewManager.cpp b/src/ViewManager.cpp
index da2ccd9..90ef863 100644
--- a/src/ViewManager.cpp
+++ b/src/ViewManager.cpp
@@ -777,6 +777,7 @@ void ViewManager::applyProfileToView(TerminalDisplay* view , const Profile::Ptr
// load font
view->setAntialias(profile->antiAliasFonts());
view->setBoldIntense(profile->boldIntense());
+ view->setUseFontLineCharacters(profile->useFontLineCharacters());
view->setVTFont(profile->font());
// set scroll-bar position