summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKurt Hindenburg <kurt.hindenburg@gmail.com>2016-07-16 16:48:26 (GMT)
committerKurt Hindenburg <kurt.hindenburg@gmail.com>2016-07-16 16:48:26 (GMT)
commitfa5f32f13fae38e8cee15dd2d87db30fa6dc6822 (patch)
tree82227b8fa7523444b0fd0e47edee29d32a5d1d60
parent19804bc2dffe87e2eb80a40fd837152488479aaa (diff)
Allow non monospaced fonts to be selected
Due to various issues outside the scope of Konsole, some monospaced fonts are not allowed to be selected. The default is still to only allow system found monospaced fonts but users can bypass to allow any font to be picked. There is a warning about issues when doing this. CCBUG: 349350
-rw-r--r--src/EditProfileDialog.cpp22
-rw-r--r--src/EditProfileDialog.h1
-rw-r--r--src/EditProfileDialog.ui10
-rw-r--r--src/TerminalDisplay.cpp6
4 files changed, 35 insertions, 4 deletions
diff --git a/src/EditProfileDialog.cpp b/src/EditProfileDialog.cpp
index 7d1aa06..dbc54b9 100644
--- a/src/EditProfileDialog.cpp
+++ b/src/EditProfileDialog.cpp
@@ -434,6 +434,10 @@ void EditProfileDialog::setupAppearancePage(const Profile::Ptr profile)
_ui->fontPreviewLabel->setFont(profileFont);
setFontInputValue(profileFont);
+ // Always set to unchecked
+ _ui->showAllFontsButton->setChecked(false);
+ connect(_ui->showAllFontsButton, &QCheckBox::toggled, this, &Konsole::EditProfileDialog::showAllFontsButtonWarning);
+
connect(_ui->fontSizeInput, static_cast<void (QDoubleSpinBox::*)(double)>(&QDoubleSpinBox::valueChanged), this, &Konsole::EditProfileDialog::setFontSize);
connect(_ui->selectFontButton, &QPushButton::clicked, this, &Konsole::EditProfileDialog::showFontDialog);
@@ -446,6 +450,16 @@ void EditProfileDialog::setupAppearancePage(const Profile::Ptr profile)
_ui->enableMouseWheelZoomButton->setChecked(profile->mouseWheelZoomEnabled());
connect(_ui->enableMouseWheelZoomButton, &QCheckBox::toggled, this, &Konsole::EditProfileDialog::toggleMouseWheelZoom);
}
+
+void EditProfileDialog::showAllFontsButtonWarning(bool enable)
+{
+ if (enable) {
+ KMessageBox::information(this,
+ "By its very nature, a terminal program requires font characters that are equal width (monospace). Any non monospaced font may cause display issues. This should not be necessary except in rare cases.",
+ "Warning");
+ }
+}
+
void EditProfileDialog::setAntialiasText(bool enable)
{
QFont profileFont = _ui->fontPreviewLabel->font();
@@ -1200,11 +1214,17 @@ void EditProfileDialog::fontSelected(const QFont& aFont)
void EditProfileDialog::showFontDialog()
{
QFont currentFont = _ui->fontPreviewLabel->font();
+ bool showAllFonts = _ui->showAllFontsButton->isChecked();
bool result;
- currentFont = QFontDialog::getFont(&result, currentFont, this,
+ if (showAllFonts) {
+ currentFont = QFontDialog::getFont(&result, currentFont, this,
+ i18n("Select All Font"));
+ } else {
+ currentFont = QFontDialog::getFont(&result, currentFont, this,
i18n("Select Fixed Width Font"),
QFontDialog::MonospacedFonts);
+ }
if (!result) return;
fontSelected(currentFont);
diff --git a/src/EditProfileDialog.h b/src/EditProfileDialog.h
index 3cead11..64e3263 100644
--- a/src/EditProfileDialog.h
+++ b/src/EditProfileDialog.h
@@ -123,6 +123,7 @@ private slots:
// appearance page
void setFontSize(double pointSize);
void setFontInputValue(const QFont&);
+ void showAllFontsButtonWarning(bool enable);
void setAntialiasText(bool enable);
void setBoldIntense(bool enable);
void showFontDialog();
diff --git a/src/EditProfileDialog.ui b/src/EditProfileDialog.ui
index 87d2dfc..7b86c6f 100644
--- a/src/EditProfileDialog.ui
+++ b/src/EditProfileDialog.ui
@@ -575,6 +575,16 @@
</widget>
</item>
<item>
+ <widget class="QCheckBox" name="showAllFontsButton">
+ <property name="toolTip">
+ <string>Show all fonts instead of the monospaced fonts</string>
+ </property>
+ <property name="text">
+ <string>Show All Fonts</string>
+ </property>
+ </widget>
+ </item>
+ <item>
<spacer name="horizontalSpacer_4">
<property name="orientation">
<enum>Qt::Horizontal</enum>
diff --git a/src/TerminalDisplay.cpp b/src/TerminalDisplay.cpp
index b2db601..c7fb3c6 100644
--- a/src/TerminalDisplay.cpp
+++ b/src/TerminalDisplay.cpp
@@ -232,9 +232,9 @@ void TerminalDisplay::setVTFont(const QFont& f)
QFontInfo fontInfo(newFont);
- if (!fontInfo.fixedPitch()) {
- qWarning() << "Using a variable-width font - this might cause display problems";
- }
+// if (!fontInfo.fixedPitch()) {
+// qWarning() << "Using a variable-width font - this might cause display problems";
+// }
// QFontInfo::fixedPitch() appears to not match QFont::fixedPitch()
// related? https://bugreports.qt.io/browse/QTBUG-34082