From 69989714d56878ffd9a1272f6310b9794c99cd51 Mon Sep 17 00:00:00 2001 From: Kurt Hindenburg Date: Sun, 1 Feb 2015 07:57:59 -1000 Subject: [PATCH] Port KFontDialog to QFontDialog Notes: 1. Sample text is no longer changed 2. Fonts are no long previewed in the terminal 3. It would be nice to disable/hide the "Effects" portion --- src/EditProfileDialog.cpp | 30 ++++++++---------------------- 1 file changed, 8 insertions(+), 22 deletions(-) diff --git a/src/EditProfileDialog.cpp b/src/EditProfileDialog.cpp index 57ce450d..70765b60 100644 --- a/src/EditProfileDialog.cpp +++ b/src/EditProfileDialog.cpp @@ -35,11 +35,12 @@ #include #include #include +#include #include // KDE #include -#include +#include #include #include #include @@ -1210,30 +1211,15 @@ void EditProfileDialog::fontSelected(const QFont& aFont) } void EditProfileDialog::showFontDialog() { - QString sampleText = QString("ell 'lL', one '1', little eye 'i', big eye"); - sampleText += QString("'I', lL1iI, Zero '0', little oh 'o', big oh 'O', 0oO"); - sampleText += QString("`~!@#$%^&*()_+-=[]\\{}|:\";'<>?,./"); - sampleText += QString("0123456789"); - sampleText += QString("\nThe Quick Brown Fox Jumps Over The Lazy Dog\n"); - sampleText += i18n("--- Type anything in this box ---"); QFont currentFont = _ui->fontPreviewLabel->font(); - QWeakPointer dialog = new KFontDialog(this, KFontChooser::FixedFontsOnly); - dialog.data()->setWindowTitle(i18n("Select Fixed Width Font")); - dialog.data()->setFont(currentFont, true); + bool result; + currentFont = QFontDialog::getFont(&result, currentFont, this, + i18n("Select Fixed Width Font"), + QFontDialog::MonospacedFonts); + if (!result) return; - // TODO (hindenburg): When https://git.reviewboard.kde.org/r/103357 is - // committed, change the below. - // Use text more fitting to show font differences in a terminal - QList chooserList = dialog.data()->findChildren(); - if (!chooserList.isEmpty()) - chooserList.at(0)->setSampleText(sampleText); - - connect(dialog.data(), &KFontDialog::fontSelected, this, &Konsole::EditProfileDialog::fontSelected); - - if (dialog.data()->exec() == QDialog::Rejected) - fontSelected(currentFont); - delete dialog.data(); + fontSelected(currentFont); } void EditProfileDialog::setFontSize(double pointSize) {