diff options
| author | Andrea Diamantini <adjam7@gmail.com> | 2010-05-30 12:07:59 +0200 | 
|---|---|---|
| committer | Andrea Diamantini <adjam7@gmail.com> | 2010-05-30 12:07:59 +0200 | 
| commit | ea7e2abd8b650feb3f0f0057d618dd3d4a14fcd7 (patch) | |
| tree | 0510f859cc26fc1e1bfedcc1134c44f7573006b3 /src/settings | |
| parent | Merge commit 'refs/merge-requests/125' of git://gitorious.org/rekonq/mainline... (diff) | |
| download | rekonq-ea7e2abd8b650feb3f0f0057d618dd3d4a14fcd7.tar.xz | |
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.. :)
Diffstat (limited to 'src/settings')
| -rw-r--r-- | src/settings/appearancewidget.cpp | 74 | ||||
| -rw-r--r-- | src/settings/appearancewidget.h | 12 | ||||
| -rw-r--r-- | src/settings/settings_appearance.ui | 300 | 
3 files changed, 252 insertions, 134 deletions
| 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 <KFontRequester> +// 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 @@     <rect>      <x>0</x>      <y>0</y> -    <width>529</width> -    <height>429</height> +    <width>351</width> +    <height>455</height>     </rect>    </property>    <property name="windowTitle">     <string>Appearance</string>    </property> -  <layout class="QVBoxLayout" name="verticalLayout_2"> +  <layout class="QVBoxLayout" name="verticalLayout_3">     <item>      <widget class="QGroupBox" name="groupBox">       <property name="title">        <string>Fonts</string>       </property> -     <layout class="QGridLayout" name="gridLayout"> -      <item row="0" column="0"> -       <widget class="QLabel" name="label"> -        <property name="sizePolicy"> -         <sizepolicy hsizetype="Maximum" vsizetype="Preferred"> -          <horstretch>0</horstretch> -          <verstretch>0</verstretch> -         </sizepolicy> -        </property> -        <property name="minimumSize"> -         <size> -          <width>150</width> -          <height>0</height> -         </size> -        </property> -        <property name="text"> -         <string>Standard font:</string> -        </property> -        <property name="alignment"> -         <set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set> -        </property> -       </widget> -      </item> -      <item row="0" column="1"> -       <widget class="KFontRequester" name="kcfg_standardFont"/> -      </item> -      <item row="1" column="0"> -       <widget class="QLabel" name="label_2"> -        <property name="sizePolicy"> -         <sizepolicy hsizetype="Maximum" vsizetype="Preferred"> -          <horstretch>0</horstretch> -          <verstretch>0</verstretch> -         </sizepolicy> -        </property> -        <property name="minimumSize"> -         <size> -          <width>150</width> -          <height>0</height> -         </size> -        </property> -        <property name="text"> -         <string>Fixed font:</string> -        </property> -        <property name="alignment"> -         <set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set> -        </property> -       </widget> -      </item> -      <item row="6" column="0"> -       <widget class="QLabel" name="label_4"> -        <property name="sizePolicy"> -         <sizepolicy hsizetype="Preferred" vsizetype="Preferred"> -          <horstretch>0</horstretch> -          <verstretch>0</verstretch> -         </sizepolicy> -        </property> -        <property name="minimumSize"> -         <size> -          <width>150</width> -          <height>0</height> -         </size> -        </property> -        <property name="text"> -         <string>Minimal font size:</string> -        </property> -        <property name="alignment"> -         <set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set> -        </property> -       </widget> -      </item> -      <item row="6" column="1"> -       <widget class="KIntNumInput" name="kcfg_minFontSize"/> -      </item> -      <item row="2" column="1"> -       <widget class="KFontRequester" name="kcfg_serifFont"/> -      </item> -      <item row="3" column="1"> -       <widget class="KFontRequester" name="kcfg_sansSerifFont"/> -      </item> -      <item row="4" column="1"> -       <widget class="KFontRequester" name="kcfg_cursiveFont"/> -      </item> -      <item row="5" column="1"> -       <widget class="KFontRequester" name="kcfg_fantasyFont"/> -      </item> -      <item row="2" column="0"> -       <widget class="QLabel" name="label_3"> -        <property name="text"> -         <string>Serif font:</string> -        </property> -        <property name="alignment"> -         <set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set> -        </property> -       </widget> -      </item> -      <item row="3" column="0"> -       <widget class="QLabel" name="label_6"> -        <property name="text"> -         <string>Sans Serif font:</string> -        </property> -        <property name="alignment"> -         <set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set> -        </property> -       </widget> +     <layout class="QVBoxLayout" name="verticalLayout_2"> +      <item> +       <layout class="QGridLayout" name="gridLayout"> +        <item row="0" column="0"> +         <widget class="QLabel" name="label"> +          <property name="sizePolicy"> +           <sizepolicy hsizetype="Maximum" vsizetype="Preferred"> +            <horstretch>0</horstretch> +            <verstretch>0</verstretch> +           </sizepolicy> +          </property> +          <property name="minimumSize"> +           <size> +            <width>150</width> +            <height>0</height> +           </size> +          </property> +          <property name="text"> +           <string>Standard font:</string> +          </property> +          <property name="alignment"> +           <set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set> +          </property> +         </widget> +        </item> +        <item row="0" column="1"> +         <widget class="KFontComboBox" name="standardFontChooser"/> +        </item> +        <item row="1" column="0"> +         <widget class="QLabel" name="label_2"> +          <property name="sizePolicy"> +           <sizepolicy hsizetype="Maximum" vsizetype="Preferred"> +            <horstretch>0</horstretch> +            <verstretch>0</verstretch> +           </sizepolicy> +          </property> +          <property name="minimumSize"> +           <size> +            <width>150</width> +            <height>0</height> +           </size> +          </property> +          <property name="text"> +           <string>Fixed font:</string> +          </property> +          <property name="alignment"> +           <set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set> +          </property> +         </widget> +        </item> +        <item row="1" column="1"> +         <widget class="KFontComboBox" name="fixedFontChooser"/> +        </item> +        <item row="2" column="0"> +         <widget class="QLabel" name="label_3"> +          <property name="text"> +           <string>Serif font:</string> +          </property> +          <property name="alignment"> +           <set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set> +          </property> +         </widget> +        </item> +        <item row="2" column="1"> +         <widget class="KFontComboBox" name="serifFontChooser"/> +        </item> +        <item row="3" column="0"> +         <widget class="QLabel" name="label_6"> +          <property name="text"> +           <string>Sans Serif font:</string> +          </property> +          <property name="alignment"> +           <set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set> +          </property> +         </widget> +        </item> +        <item row="3" column="1"> +         <widget class="KFontComboBox" name="sansSerifFontChooser"/> +        </item> +        <item row="4" column="0"> +         <widget class="QLabel" name="label_7"> +          <property name="text"> +           <string>Cursive font:</string> +          </property> +          <property name="alignment"> +           <set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set> +          </property> +         </widget> +        </item> +        <item row="4" column="1"> +         <widget class="KFontComboBox" name="cursiveFontChooser"/> +        </item> +        <item row="5" column="0"> +         <widget class="QLabel" name="label_8"> +          <property name="text"> +           <string>Fantasy font:</string> +          </property> +          <property name="alignment"> +           <set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set> +          </property> +         </widget> +        </item> +        <item row="5" column="1"> +         <widget class="KFontComboBox" name="fantasyFontChooser"/> +        </item> +       </layout>        </item> -      <item row="4" column="0"> -       <widget class="QLabel" name="label_7"> -        <property name="text"> -         <string>Cursive font:</string> -        </property> -        <property name="alignment"> -         <set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set> +      <item> +       <widget class="Line" name="line"> +        <property name="orientation"> +         <enum>Qt::Horizontal</enum>          </property>         </widget>        </item> -      <item row="5" column="0"> -       <widget class="QLabel" name="label_8"> -        <property name="text"> -         <string>Fantasy font:</string> -        </property> -        <property name="alignment"> -         <set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set> -        </property> -       </widget> +      <item> +       <layout class="QGridLayout" name="gridLayout_2"> +        <item row="0" column="0"> +         <widget class="QLabel" name="label_9"> +          <property name="sizePolicy"> +           <sizepolicy hsizetype="Preferred" vsizetype="Preferred"> +            <horstretch>0</horstretch> +            <verstretch>0</verstretch> +           </sizepolicy> +          </property> +          <property name="minimumSize"> +           <size> +            <width>150</width> +            <height>0</height> +           </size> +          </property> +          <property name="text"> +           <string>Default font size:</string> +          </property> +          <property name="alignment"> +           <set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set> +          </property> +         </widget> +        </item> +        <item row="0" column="1"> +         <widget class="KIntNumInput" name="kcfg_defaultFontSize"/> +        </item> +        <item row="1" column="0"> +         <widget class="QLabel" name="label_4"> +          <property name="sizePolicy"> +           <sizepolicy hsizetype="Preferred" vsizetype="Preferred"> +            <horstretch>0</horstretch> +            <verstretch>0</verstretch> +           </sizepolicy> +          </property> +          <property name="minimumSize"> +           <size> +            <width>150</width> +            <height>0</height> +           </size> +          </property> +          <property name="text"> +           <string>Minimal font size:</string> +          </property> +          <property name="alignment"> +           <set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set> +          </property> +         </widget> +        </item> +        <item row="1" column="1"> +         <widget class="KIntNumInput" name="kcfg_minFontSize"/> +        </item> +       </layout>        </item>       </layout>      </widget> @@ -223,9 +266,14 @@     <header>kurlrequester.h</header>    </customwidget>    <customwidget> -   <class>KFontRequester</class> -   <extends>QWidget</extends> -   <header>kfontrequester.h</header> +   <class>KFontComboBox</class> +   <extends>KComboBox</extends> +   <header>kfontcombobox.h</header> +  </customwidget> +  <customwidget> +   <class>KComboBox</class> +   <extends>QComboBox</extends> +   <header>kcombobox.h</header>    </customwidget>    <customwidget>     <class>KIntNumInput</class> | 
