summaryrefslogtreecommitdiff
path: root/src/application.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/application.cpp')
-rw-r--r--src/application.cpp66
1 files changed, 40 insertions, 26 deletions
diff --git a/src/application.cpp b/src/application.cpp
index 412999d8..9620feb8 100644
--- a/src/application.cpp
+++ b/src/application.cpp
@@ -336,7 +336,10 @@ void Application::loadUrl(const KUrl& url, const Rekonq::OpenType& type)
// rapidly show first loading url..
- w->mainView()->urlBar()->setQUrl(url);
+ int tabIndex = w->mainView()->indexOf(tab);
+ Q_ASSERT( tabIndex != -1 );
+ UrlBar *barForTab = qobject_cast<UrlBar *>(w->mainView()->widgetBar()->widget(tabIndex));
+ barForTab->setQUrl(url);
WebView *view = tab->view();
@@ -415,35 +418,46 @@ 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);
-
- // =========== Fonts ==============
- QWebSettings *defaultSettings = QWebSettings::globalSettings();
-
- int fnSize = ReKonfig::fontSize();
- int minFnSize = ReKonfig::minFontSize();
+ 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);
+ }
- QFont standardFont = ReKonfig::standardFont();
- defaultSettings->setFontFamily(QWebSettings::StandardFont, standardFont.family());
- defaultSettings->setFontSize(QWebSettings::DefaultFontSize, fnSize);
- defaultSettings->setFontSize(QWebSettings::MinimumFontSize, minFnSize);
+ QWebSettings *defaultSettings = QWebSettings::globalSettings();
+
+ // =========== Fonts ==============
+ defaultSettings->setFontFamily(QWebSettings::StandardFont, ReKonfig::standardFontFamily() );
+ defaultSettings->setFontFamily(QWebSettings::FixedFont, ReKonfig::fixedFontFamily() );
+ defaultSettings->setFontFamily(QWebSettings::SerifFont, ReKonfig::serifFontFamily() );
+ defaultSettings->setFontFamily(QWebSettings::SansSerifFont, ReKonfig::sansSerifFontFamily() );
+ defaultSettings->setFontFamily(QWebSettings::CursiveFont, ReKonfig::cursiveFontFamily());
+ defaultSettings->setFontFamily(QWebSettings::FantasyFont, ReKonfig::fantasyFontFamily());
+
+ // compute font size
+ // (I have to admit I know nothing about these DPI questions..: copied from kwebkitpart, as someone suggested)
+ // font size in pixels = font size in inches × screen dpi
+ int defaultFontSize = ReKonfig::defaultFontSize();
+ int minimumFontSize = ReKonfig::minFontSize();
+
+ int logDpiY = mainWindow()->currentTab()->view()->logicalDpiY();
+ kDebug() << "Logical Dot per Inch Y: " << logDpiY;
+
+ float toPix = (logDpiY < 96.0)
+ ? 96.0/72.0
+ : logDpiY/72.0 ;
- QFont fixedFont = ReKonfig::fixedFont();
- defaultSettings->setFontFamily(QWebSettings::FixedFont, fixedFont.family());
- defaultSettings->setFontSize(QWebSettings::DefaultFixedFontSize, fnSize);
+ defaultSettings->setFontSize(QWebSettings::DefaultFontSize, qRound(defaultFontSize * toPix) );
+ defaultSettings->setFontSize(QWebSettings::MinimumFontSize, qRound(minimumFontSize * toPix) );
+
// ================ WebKit ============================
defaultSettings->setAttribute(QWebSettings::AutoLoadImages, ReKonfig::autoLoadImages());
defaultSettings->setAttribute(QWebSettings::DnsPrefetchEnabled, ReKonfig::dnsPrefetch());