diff options
author | Andrea Diamantini <adjam7@gmail.com> | 2009-03-20 00:57:19 +0100 |
---|---|---|
committer | Andrea Diamantini <adjam7@gmail.com> | 2009-03-24 11:29:22 +0100 |
commit | aab36b488647e298857b7ec24bce0f2b143e4520 (patch) | |
tree | 7f4f1ff8c3f53a2da82ad8d8ff052c8a78f976ca | |
parent | pedantic..TODO (diff) | |
download | rekonq-aab36b488647e298857b7ec24bce0f2b143e4520.tar.xz |
working on fixing font problem..
-rw-r--r-- | src/mainwindow.cpp | 34 | ||||
-rw-r--r-- | src/rekonq.kcfg | 7 | ||||
-rw-r--r-- | src/settings.cpp | 18 | ||||
-rw-r--r-- | src/settings_fonts.ui | 121 | ||||
-rw-r--r-- | src/webview.cpp | 8 |
5 files changed, 131 insertions, 57 deletions
diff --git a/src/mainwindow.cpp b/src/mainwindow.cpp index 22110c59..56eb6ecc 100644 --- a/src/mainwindow.cpp +++ b/src/mainwindow.cpp @@ -314,28 +314,30 @@ void MainWindow::slotUpdateConf() // =========== Fonts ============== QWebSettings *defaultSettings = QWebSettings::globalSettings(); + int fnSize = ReKonfig::fontSize(); + QFont standardFont = ReKonfig::standardFont(); - if( !standardFont.exactMatch() ) - { - kWarning() << "Webkit Standard Font doesn't match! Setting to KDE general font.."; - standardFont = KGlobalSettings::generalFont(); - ReKonfig::setStandardFont( standardFont ); - ReKonfig::self()->writeConfig(); - } +// if( !standardFont.exactMatch() ) +// { +// kWarning() << "Webkit Standard Font doesn't match! Setting to KDE general font.."; +// standardFont = KGlobalSettings::generalFont(); +// ReKonfig::setStandardFont( standardFont ); +// ReKonfig::self()->writeConfig(); +// } defaultSettings->setFontFamily(QWebSettings::StandardFont, standardFont.family()); - defaultSettings->setFontSize(QWebSettings::DefaultFontSize, standardFont.pointSize()); + defaultSettings->setFontSize(QWebSettings::DefaultFontSize, fnSize); QFont fixedFont = ReKonfig::fixedFont(); - if( !fixedFont.exactMatch() ) - { - kWarning() << "Webkit Fixed Font doesn't match! Setting to KDE fixed font.."; - fixedFont = KGlobalSettings::fixedFont(); - ReKonfig::setFixedFont( fixedFont ); - ReKonfig::self()->writeConfig(); - } +// if( !fixedFont.exactMatch() ) +// { +// kWarning() << "Webkit Fixed Font doesn't match! Setting to KDE fixed font.."; +// fixedFont = KGlobalSettings::fixedFont(); +// ReKonfig::setFixedFont( fixedFont ); +// ReKonfig::self()->writeConfig(); +// } defaultSettings->setFontFamily(QWebSettings::FixedFont, fixedFont.family()); - defaultSettings->setFontSize(QWebSettings::DefaultFixedFontSize, fixedFont.pointSize()); + defaultSettings->setFontSize(QWebSettings::DefaultFixedFontSize, fnSize); // =========== Privacy ============== diff --git a/src/rekonq.kcfg b/src/rekonq.kcfg index f60d6e86..e7c433fd 100644 --- a/src/rekonq.kcfg +++ b/src/rekonq.kcfg @@ -28,10 +28,13 @@ <!-- Fonts Settings --> <group name="Fonts"> <entry name="standardFont" type="Font"> - <default code="true">QFont( QWebSettings::globalSettings()->fontFamily(QWebSettings::StandardFont) )</default> + <default code="true">QFont(QWebSettings::globalSettings()->fontFamily(QWebSettings::StandardFont))</default> </entry> <entry name="fixedFont" type="Font"> - <default code="true">QFont( QWebSettings::globalSettings()->fontFamily(QWebSettings::FixedFont) )</default> + <default code="true">QFont(QWebSettings::globalSettings()->fontFamily(QWebSettings::FixedFont))</default> + </entry> + <entry name="fontSize" type="Int"> + <default>10</default> </entry> </group> diff --git a/src/settings.cpp b/src/settings.cpp index 43e3a5b0..68a051ea 100644 --- a/src/settings.cpp +++ b/src/settings.cpp @@ -133,13 +133,14 @@ void SettingsDialog::readConfig() // ======= Fonts QFont stdFont = ReKonfig::standardFont(); - d->fontsUi.standardFontChooser->setFont(stdFont, false); - d->fontsUi.standardFontChooser->setSampleText( stdFont.family() + " " + QString::number(stdFont.pointSize()) ); - connect(d->fontsUi.standardFontChooser, SIGNAL(fontSelected(QFont)),this, SLOT(saveSettings())); + d->fontsUi.standardFont->setCurrentFont(stdFont); + QFont fxFont = ReKonfig::fixedFont(); - d->fontsUi.fixedFontChooser->setFont(fxFont, true); - d->fontsUi.fixedFontChooser->setSampleText( fxFont.family() + " " + QString::number(fxFont.pointSize()) ); - connect(d->fontsUi.fixedFontChooser, SIGNAL(fontSelected(QFont)),this, SLOT(saveSettings())); + d->fontsUi.fixedFont->setOnlyFixed(true); + d->fontsUi.fixedFont->setCurrentFont(fxFont); + + int fnSize = ReKonfig::fontSize(); + d->fontsUi.fontSize->setValue( fnSize ); // ======= Proxy bool proxyEnabled = ReKonfig::isProxyEnabled(); @@ -155,8 +156,9 @@ void SettingsDialog::saveSettings() ReKonfig::setDownloadDir( d->generalUi.downloadDirUrlRequester->url().prettyUrl() ); // Fonts - ReKonfig::setStandardFont( d->fontsUi.standardFontChooser->font() ); - ReKonfig::setFixedFont( d->fontsUi.standardFontChooser->font() ); + ReKonfig::setStandardFont( d->fontsUi.standardFont->currentFont() ); + ReKonfig::setFixedFont( d->fontsUi.fixedFont->currentFont() ); + ReKonfig::setFontSize( d->fontsUi.fontSize->value() ); // Save ReKonfig::self()->writeConfig(); diff --git a/src/settings_fonts.ui b/src/settings_fonts.ui index 2d7168b0..ef97eeea 100644 --- a/src/settings_fonts.ui +++ b/src/settings_fonts.ui @@ -1,48 +1,109 @@ -<ui version="4.0" > +<?xml version="1.0" encoding="UTF-8"?> +<ui version="4.0"> <class>fonts</class> - <widget class="QWidget" name="fonts" > - <property name="geometry" > + <widget class="QWidget" name="fonts"> + <property name="geometry"> <rect> <x>0</x> <y>0</y> - <width>391</width> - <height>179</height> + <width>369</width> + <height>211</height> </rect> </property> - <property name="windowTitle" > + <property name="windowTitle"> <string>Appearance</string> </property> - <layout class="QVBoxLayout" name="verticalLayout" > + <layout class="QVBoxLayout" name="verticalLayout"> <item> - <widget class="QGroupBox" name="groupBox" > - <property name="title" > - <string>Standard Font</string> + <spacer name="verticalSpacer_4"> + <property name="orientation"> + <enum>Qt::Vertical</enum> </property> - <layout class="QHBoxLayout" name="horizontalLayout" > - <item> - <widget class="KFontRequester" name="standardFontChooser" /> - </item> - </layout> - </widget> + <property name="sizeHint" stdset="0"> + <size> + <width>20</width> + <height>40</height> + </size> + </property> + </spacer> + </item> + <item> + <layout class="QGridLayout" name="gridLayout"> + <item row="0" column="0"> + <widget class="QLabel" name="label"> + <property name="text"> + <string>Standard Font</string> + </property> + </widget> + </item> + <item row="0" column="1"> + <widget class="KFontComboBox" name="standardFont"/> + </item> + <item row="1" column="0"> + <widget class="QLabel" name="label_2"> + <property name="text"> + <string>Fixed Font</string> + </property> + </widget> + </item> + <item row="1" column="1"> + <widget class="KFontComboBox" name="fixedFont"/> + </item> + </layout> + </item> + <item> + <spacer name="verticalSpacer_2"> + <property name="orientation"> + <enum>Qt::Vertical</enum> + </property> + <property name="sizeHint" stdset="0"> + <size> + <width>20</width> + <height>40</height> + </size> + </property> + </spacer> </item> <item> - <widget class="QGroupBox" name="groupBox_2" > - <property name="title" > - <string>Fixed Font</string> + <widget class="Line" name="line"> + <property name="orientation"> + <enum>Qt::Horizontal</enum> </property> - <layout class="QHBoxLayout" name="horizontalLayout_2" > - <item> - <widget class="KFontRequester" name="fixedFontChooser" /> - </item> - </layout> </widget> </item> <item> - <spacer name="verticalSpacer" > - <property name="orientation" > + <spacer name="verticalSpacer_3"> + <property name="orientation"> + <enum>Qt::Vertical</enum> + </property> + <property name="sizeHint" stdset="0"> + <size> + <width>20</width> + <height>40</height> + </size> + </property> + </spacer> + </item> + <item> + <layout class="QHBoxLayout" name="horizontalLayout"> + <item> + <widget class="QLabel" name="label_3"> + <property name="text"> + <string>Font Size</string> + </property> + </widget> + </item> + <item> + <widget class="QSpinBox" name="fontSize"/> + </item> + </layout> + </item> + <item> + <spacer name="verticalSpacer"> + <property name="orientation"> <enum>Qt::Vertical</enum> </property> - <property name="sizeHint" stdset="0" > + <property name="sizeHint" stdset="0"> <size> <width>20</width> <height>40</height> @@ -54,9 +115,9 @@ </widget> <customwidgets> <customwidget> - <class>KFontRequester</class> - <extends>QWidget</extends> - <header>kfontrequester.h</header> + <class>KFontComboBox</class> + <extends>KComboBox</extends> + <header>kfontcombobox.h</header> </customwidget> </customwidgets> <resources/> diff --git a/src/webview.cpp b/src/webview.cpp index 0c7ad356..0b981633 100644 --- a/src/webview.cpp +++ b/src/webview.cpp @@ -107,7 +107,13 @@ bool WebPage::acceptNavigationRequest(QWebFrame *frame, const QNetworkRequest &r QWebPage *WebPage::createWindow(QWebPage::WebWindowType type) { - Q_UNUSED(type); + // added to manage web modal dialogs + if(type == QWebPage::WebModalDialog) + { + WebView *w = new WebView; + return w->page(); + } + if (m_keyboardModifiers & Qt::ControlModifier || m_pressedButtons == Qt::MidButton) { m_openInNewTab = true; |