diff options
author | Andrea Diamantini <adjam7@gmail.com> | 2010-05-24 10:47:44 +0200 |
---|---|---|
committer | Andrea Diamantini <adjam7@gmail.com> | 2010-05-24 10:47:44 +0200 |
commit | c03cf973fd44223335615b6dd576785746e2b409 (patch) | |
tree | bb38f45ad79a78654b77f51b1d37fe333a06441f | |
parent | New Settings classes, one for each widget. (diff) | |
download | rekonq-c03cf973fd44223335615b6dd576785746e2b409.tar.xz |
Improving fonts situation
-rw-r--r-- | src/application.cpp | 51 | ||||
-rw-r--r-- | src/rekonq.kcfg | 13 | ||||
-rw-r--r-- | src/settings/appearancewidget.cpp | 2 | ||||
-rw-r--r-- | src/settings/settings_appearance.ui | 118 |
4 files changed, 97 insertions, 87 deletions
diff --git a/src/application.cpp b/src/application.cpp index 412999d8..556c3cf8 100644 --- a/src/application.cpp +++ b/src/application.cpp @@ -415,34 +415,45 @@ void Application::newWindow() void Application::updateConfiguration() { - // FIXME: - // all things related to mainview can be - // improved/moved/replicated in all the mainwindows - MainView *view = mainWindow()->mainView(); - - // ============== General ================== - view->updateTabBar(); - // ============== Tabs ================== - if (ReKonfig::closeTabSelectPrevious()) - view->tabBar()->setSelectionBehaviorOnRemove(QTabBar::SelectPreviousTab); - else - view->tabBar()->setSelectionBehaviorOnRemove(QTabBar::SelectRightTab); + bool b = ReKonfig::closeTabSelectPrevious(); + Q_FOREACH(const QWeakPointer<MainWindow> &w, m_mainWindows) + { + MainView *mv = w.data()->mainView(); + mv->updateTabBar(); + + if (b) + mv->tabBar()->setSelectionBehaviorOnRemove(QTabBar::SelectPreviousTab); + else + mv->tabBar()->setSelectionBehaviorOnRemove(QTabBar::SelectRightTab); + } + QWebSettings *defaultSettings = QWebSettings::globalSettings(); + // =========== Fonts ============== - QWebSettings *defaultSettings = QWebSettings::globalSettings(); - - int fnSize = ReKonfig::fontSize(); - int minFnSize = ReKonfig::minFontSize(); - QFont standardFont = ReKonfig::standardFont(); + kDebug() << "STANDARD FONT" << standardFont.pixelSize(); defaultSettings->setFontFamily(QWebSettings::StandardFont, standardFont.family()); - defaultSettings->setFontSize(QWebSettings::DefaultFontSize, fnSize); - defaultSettings->setFontSize(QWebSettings::MinimumFontSize, minFnSize); + defaultSettings->setFontSize(QWebSettings::DefaultFontSize, standardFont.pointSize()); QFont fixedFont = ReKonfig::fixedFont(); defaultSettings->setFontFamily(QWebSettings::FixedFont, fixedFont.family()); - defaultSettings->setFontSize(QWebSettings::DefaultFixedFontSize, fnSize); + defaultSettings->setFontSize(QWebSettings::DefaultFixedFontSize, fixedFont.pointSize()); + + QFont serifFont = ReKonfig::serifFont(); + defaultSettings->setFontFamily(QWebSettings::SerifFont, serifFont.family()); + + QFont sansSerifFont = ReKonfig::sansSerifFont(); + defaultSettings->setFontFamily(QWebSettings::SansSerifFont, sansSerifFont.family()); + + QFont cursiveFont = ReKonfig::cursiveFont(); + defaultSettings->setFontFamily(QWebSettings::FixedFont, cursiveFont.family()); + + QFont fantasyFont = ReKonfig::fantasyFont(); + defaultSettings->setFontFamily(QWebSettings::FantasyFont, fantasyFont.family()); + + int minimumFontSize = ReKonfig::minFontSize(); + defaultSettings->setFontSize(QWebSettings::MinimumFontSize, minimumFontSize); // ================ WebKit ============================ defaultSettings->setAttribute(QWebSettings::AutoLoadImages, ReKonfig::autoLoadImages()); diff --git a/src/rekonq.kcfg b/src/rekonq.kcfg index 6769b4f5..07c079a5 100644 --- a/src/rekonq.kcfg +++ b/src/rekonq.kcfg @@ -106,8 +106,17 @@ <entry name="fixedFont" type="Font"> <default code="true">QFont(QWebSettings::globalSettings()->fontFamily(QWebSettings::FixedFont))</default> </entry> - <entry name="fontSize" type="Int"> - <default>16</default> + <entry name="serifFont" type="Font"> + <default code="true">QFont(QWebSettings::globalSettings()->fontFamily(QWebSettings::SerifFont))</default> + </entry> + <entry name="sansSerifFont" type="Font"> + <default code="true">QFont(QWebSettings::globalSettings()->fontFamily(QWebSettings::SansSerifFont))</default> + </entry> + <entry name="cursiveFont" type="Font"> + <default code="true">QFont(QWebSettings::globalSettings()->fontFamily(QWebSettings::CursiveFont))</default> + </entry> + <entry name="fantasyFont" type="Font"> + <default code="true">QFont(QWebSettings::globalSettings()->fontFamily(QWebSettings::FantasyFont))</default> </entry> <entry name="minFontSize" type="Int"> <default>8</default> diff --git a/src/settings/appearancewidget.cpp b/src/settings/appearancewidget.cpp index be3c2980..875b67d2 100644 --- a/src/settings/appearancewidget.cpp +++ b/src/settings/appearancewidget.cpp @@ -35,7 +35,7 @@ AppearanceWidget::AppearanceWidget(QWidget *parent) { setupUi(this); - kcfg_fixedFont->setOnlyFixed(true); +// kcfg_fixedFont->setOnlyFixed(true); } diff --git a/src/settings/settings_appearance.ui b/src/settings/settings_appearance.ui index aff6bfbe..b564033c 100644 --- a/src/settings/settings_appearance.ui +++ b/src/settings/settings_appearance.ui @@ -6,8 +6,8 @@ <rect> <x>0</x> <y>0</y> - <width>569</width> - <height>484</height> + <width>454</width> + <height>371</height> </rect> </property> <property name="windowTitle"> @@ -19,7 +19,7 @@ <property name="title"> <string>Fonts</string> </property> - <layout class="QFormLayout" name="formLayout"> + <layout class="QGridLayout" name="gridLayout"> <item row="0" column="0"> <widget class="QLabel" name="label"> <property name="sizePolicy"> @@ -43,14 +43,7 @@ </widget> </item> <item row="0" column="1"> - <widget class="KFontComboBox" name="kcfg_standardFont"> - <property name="sizePolicy"> - <sizepolicy hsizetype="Expanding" vsizetype="Fixed"> - <horstretch>0</horstretch> - <verstretch>0</verstretch> - </sizepolicy> - </property> - </widget> + <widget class="KFontRequester" name="kcfg_standardFont"/> </item> <item row="1" column="0"> <widget class="QLabel" name="label_2"> @@ -75,26 +68,10 @@ </widget> </item> <item row="1" column="1"> - <widget class="KFontComboBox" name="kcfg_fixedFont"> - <property name="sizePolicy"> - <sizepolicy hsizetype="Expanding" vsizetype="Fixed"> - <horstretch>0</horstretch> - <verstretch>0</verstretch> - </sizepolicy> - </property> - </widget> + <widget class="KFontRequester" name="kcfg_fixedFont"/> </item> - </layout> - </widget> - </item> - <item> - <widget class="QGroupBox" name="groupBox_2"> - <property name="title"> - <string>Dimension</string> - </property> - <layout class="QFormLayout" name="formLayout_2"> - <item row="0" column="0"> - <widget class="QLabel" name="label_3"> + <item row="6" column="0"> + <widget class="QLabel" name="label_4"> <property name="sizePolicy"> <sizepolicy hsizetype="Preferred" vsizetype="Preferred"> <horstretch>0</horstretch> @@ -108,52 +85,65 @@ </size> </property> <property name="text"> - <string>Font size:</string> + <string>Minimal 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="QSpinBox" name="kcfg_fontSize"> - <property name="sizePolicy"> - <sizepolicy hsizetype="Expanding" vsizetype="Fixed"> - <horstretch>0</horstretch> - <verstretch>0</verstretch> - </sizepolicy> + <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="1" column="0"> - <widget class="QLabel" name="label_4"> - <property name="sizePolicy"> - <sizepolicy hsizetype="Preferred" vsizetype="Preferred"> - <horstretch>0</horstretch> - <verstretch>0</verstretch> - </sizepolicy> + <item row="3" column="0"> + <widget class="QLabel" name="label_6"> + <property name="text"> + <string>Sans Serif font:</string> </property> - <property name="minimumSize"> - <size> - <width>150</width> - <height>0</height> - </size> + <property name="alignment"> + <set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set> </property> + </widget> + </item> + <item row="4" column="0"> + <widget class="QLabel" name="label_7"> <property name="text"> - <string>Minimal font size:</string> + <string>Cursive font:</string> </property> <property name="alignment"> <set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set> </property> </widget> </item> - <item row="1" column="1"> - <widget class="QSpinBox" name="kcfg_minFontSize"> - <property name="sizePolicy"> - <sizepolicy hsizetype="Expanding" vsizetype="Fixed"> - <horstretch>0</horstretch> - <verstretch>0</verstretch> - </sizepolicy> + <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> @@ -233,14 +223,14 @@ <header>kurlrequester.h</header> </customwidget> <customwidget> - <class>KFontComboBox</class> - <extends>KComboBox</extends> - <header>kfontcombobox.h</header> + <class>KFontRequester</class> + <extends>QWidget</extends> + <header>kfontrequester.h</header> </customwidget> <customwidget> - <class>KComboBox</class> - <extends>QComboBox</extends> - <header>kcombobox.h</header> + <class>KIntNumInput</class> + <extends>QWidget</extends> + <header>knuminput.h</header> </customwidget> </customwidgets> <resources/> |