From ea7e2abd8b650feb3f0f0057d618dd3d4a14fcd7 Mon Sep 17 00:00:00 2001 From: Andrea Diamantini Date: Sun, 30 May 2010 12:07:59 +0200 Subject: Fixing fonts.. This commit changes *A LOT* rekonq behavior on fonts. To fix all, I had to (re)introduce some (old)new strings. Sorry! - Adopted default KDE fonts for default & fixed settings - calculating LogicalDpiY from font dimension (points to pixels) (This has been copied from KWebKitPart, as suggested) - reenabled 16px as default font size WARNING: As we are now calculating well the font size, you'll see BIG chars on clean pages.. :) --- src/settings/appearancewidget.cpp | 74 ++++++++- src/settings/appearancewidget.h | 12 +- src/settings/settings_appearance.ui | 300 +++++++++++++++++++++--------------- 3 files changed, 252 insertions(+), 134 deletions(-) (limited to 'src/settings') diff --git a/src/settings/appearancewidget.cpp b/src/settings/appearancewidget.cpp index 40f53a85..20793d0a 100644 --- a/src/settings/appearancewidget.cpp +++ b/src/settings/appearancewidget.cpp @@ -28,8 +28,8 @@ #include "appearancewidget.h" #include "appearancewidget.moc" -// KDE Includes -#include +// Auto Includes +#include "rekonq.h" AppearanceWidget::AppearanceWidget(QWidget *parent) @@ -37,16 +37,33 @@ AppearanceWidget::AppearanceWidget(QWidget *parent) , _changed(false) { setupUi(this); - - KFontRequester *fixedFontRequester = new KFontRequester(this, true); - fixedFontRequester->setObjectName( QL1S("kcfg_fixedFont") ); - - gridLayout->addWidget(fixedFontRequester, 1, 1, 1, 1); + + fixedFontChooser->setOnlyFixed(true); + + standardFontChooser->setCurrentFont( QFont( ReKonfig::standardFontFamily() ) ); + fixedFontChooser->setCurrentFont( QFont( ReKonfig::fixedFontFamily() ) ); + serifFontChooser->setCurrentFont( QFont( ReKonfig::serifFontFamily() ) ); + sansSerifFontChooser->setCurrentFont( QFont( ReKonfig::sansSerifFontFamily() ) ); + cursiveFontChooser->setCurrentFont( QFont( ReKonfig::cursiveFontFamily() ) ); + fantasyFontChooser->setCurrentFont( QFont( ReKonfig::fantasyFontFamily() ) ); + + connect(standardFontChooser, SIGNAL(currentFontChanged(const QFont &)), this, SLOT(slotStandardFont(const QFont &))); + connect(fixedFontChooser, SIGNAL(currentFontChanged(const QFont &)), this, SLOT(slotFixedFont(const QFont &))); + connect(serifFontChooser, SIGNAL(currentFontChanged(const QFont &)), this, SLOT(slotSerifFont(const QFont &))); + connect(sansSerifFontChooser, SIGNAL(currentFontChanged(const QFont &)), this, SLOT(slotSansSerifFont(const QFont &))); + connect(cursiveFontChooser, SIGNAL(currentFontChanged(const QFont &)), this, SLOT(slotCursiveFont(const QFont &))); + connect(fantasyFontChooser, SIGNAL(currentFontChanged(const QFont &)), this, SLOT(slotFantasyFont(const QFont &))); } void AppearanceWidget::save() { + ReKonfig::setStandardFontFamily(reFont[0]); + ReKonfig::setFixedFontFamily(reFont[1]); + ReKonfig::setSerifFontFamily(reFont[2]); + ReKonfig::setSansSerifFontFamily(reFont[3]); + ReKonfig::setCursiveFontFamily(reFont[4]); + ReKonfig::setFantasyFontFamily(reFont[5]); } @@ -58,4 +75,47 @@ bool AppearanceWidget::changed() void AppearanceWidget::hasChanged() { + _changed = true; +} + + +void AppearanceWidget::slotStandardFont(const QFont &f) +{ + reFont[0] = f.family(); + hasChanged(); +} + + +void AppearanceWidget::slotFixedFont(const QFont &f) +{ + reFont[1] = f.family(); + hasChanged(); +} + + +void AppearanceWidget::slotSerifFont(const QFont &f) +{ + reFont[2] = f.family(); + hasChanged(); +} + + +void AppearanceWidget::slotSansSerifFont(const QFont &f) +{ + reFont[3] = f.family(); + hasChanged(); +} + + +void AppearanceWidget::slotCursiveFont(const QFont &f) +{ + reFont[4] = f.family(); + hasChanged(); +} + + +void AppearanceWidget::slotFantasyFont(const QFont &f) +{ + reFont[5] = f.family(); + hasChanged(); } diff --git a/src/settings/appearancewidget.h b/src/settings/appearancewidget.h index 5c7ddc6d..ea3de6a1 100644 --- a/src/settings/appearancewidget.h +++ b/src/settings/appearancewidget.h @@ -53,9 +53,19 @@ signals: private slots: void hasChanged(); - + + void slotStandardFont(const QFont &); + void slotFixedFont(const QFont &); + void slotSerifFont(const QFont &); + void slotSansSerifFont(const QFont &); + void slotCursiveFont(const QFont &); + void slotFantasyFont(const QFont &); + private: bool _changed; + + QString reFont[6]; + }; #endif // APPEARANCE_WIDGET_H diff --git a/src/settings/settings_appearance.ui b/src/settings/settings_appearance.ui index e0da6970..7ec23484 100644 --- a/src/settings/settings_appearance.ui +++ b/src/settings/settings_appearance.ui @@ -6,143 +6,186 @@ 0 0 - 529 - 429 + 351 + 455 Appearance - + Fonts - - - - - - 0 - 0 - - - - - 150 - 0 - - - - Standard font: - - - Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter - - - - - - - - - - - 0 - 0 - - - - - 150 - 0 - - - - Fixed font: - - - Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter - - - - - - - - 0 - 0 - - - - - 150 - 0 - - - - Minimal font size: - - - Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter - - - - - - - - - - - - - - - - - - - - - - Serif font: - - - Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter - - - - - - - Sans Serif font: - - - Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter - - + + + + + + + + 0 + 0 + + + + + 150 + 0 + + + + Standard font: + + + Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter + + + + + + + + + + + 0 + 0 + + + + + 150 + 0 + + + + Fixed font: + + + Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter + + + + + + + + + + Serif font: + + + Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter + + + + + + + + + + Sans Serif font: + + + Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter + + + + + + + + + + Cursive font: + + + Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter + + + + + + + + + + Fantasy font: + + + Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter + + + + + + + - - - - Cursive font: - - - Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter + + + + Qt::Horizontal - - - - Fantasy font: - - - Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter - - + + + + + + + 0 + 0 + + + + + 150 + 0 + + + + Default font size: + + + Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter + + + + + + + + + + + 0 + 0 + + + + + 150 + 0 + + + + Minimal font size: + + + Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter + + + + + + + @@ -223,9 +266,14 @@
kurlrequester.h
- KFontRequester - QWidget -
kfontrequester.h
+ KFontComboBox + KComboBox +
kfontcombobox.h
+
+ + KComboBox + QComboBox +
kcombobox.h
KIntNumInput -- cgit v1.2.1