From ed1a5bac8bb6e03063df1f5c499a6fdcfc14d9a5 Mon Sep 17 00:00:00 2001 From: Andrea Diamantini Date: Mon, 23 Nov 2009 03:10:56 +0100 Subject: Saving 4 bytes per tab :) --- src/mainwindow.cpp | 11 +++-------- src/tabbar.cpp | 20 ++++++++++++-------- src/tabbar.h | 5 +---- 3 files changed, 16 insertions(+), 20 deletions(-) (limited to 'src') diff --git a/src/mainwindow.cpp b/src/mainwindow.cpp index a6857153..f2809beb 100644 --- a/src/mainwindow.cpp +++ b/src/mainwindow.cpp @@ -212,6 +212,9 @@ void MainWindow::setupToolbars() void MainWindow::postLaunch() { + // KActionCollection read settings + m_ac->readSettings(); + // notification system connect(m_view, SIGNAL(showStatusBarMessage(const QString&, Rekonq::Notify)), this, SLOT(notifyMessage(const QString&, Rekonq::Notify))); connect(m_view, SIGNAL(linkHovered(const QString&)), this, SLOT(notifyMessage(const QString&))); @@ -239,9 +242,6 @@ void MainWindow::postLaunch() // accept d'n'd setAcceptDrops(true); - - // KActionCollection read settings - m_ac->readSettings(); } @@ -502,11 +502,6 @@ void MainWindow::updateConfiguration() int fnSize = ReKonfig::fontSize(); int minFnSize = ReKonfig::minFontSize(); -// // font size / dpi WARNING: is this right? why we need this? -// float toPix = m_view->logicalDpiY()/72.0; -// if (toPix < 96.0/72.0) -// toPix = 96.0/72.0; - QFont standardFont = ReKonfig::standardFont(); defaultSettings->setFontFamily(QWebSettings::StandardFont, standardFont.family()); defaultSettings->setFontSize(QWebSettings::DefaultFontSize, fnSize); diff --git a/src/tabbar.cpp b/src/tabbar.cpp index 3eba53d7..6fdf4346 100644 --- a/src/tabbar.cpp +++ b/src/tabbar.cpp @@ -38,6 +38,7 @@ #include "urlbar.h" #include "webview.h" #include "websnap.h" +#include "mainview.h" // KDE Includes #include @@ -59,9 +60,8 @@ #define MIN_WIDTH_DIVISOR 8 -TabBar::TabBar(MainView *parent) +TabBar::TabBar(QWidget *parent) : KTabBar(parent) - , m_parent(parent) , m_currentTabPreview(-1) { setElideMode(Qt::ElideRight); @@ -84,10 +84,12 @@ TabBar::~TabBar() QSize TabBar::tabSizeHint(int index) const { - int buttonSize = m_parent->addTabButton()->size().width(); - int tabBarWidth = m_parent->size().width() - buttonSize; - int baseWidth = m_parent->sizeHint().width()/BASE_WIDTH_DIVISOR; - int minWidth = m_parent->sizeHint().width()/MIN_WIDTH_DIVISOR; + MainView *view = qobject_cast(parent()); + + int buttonSize = view->addTabButton()->size().width(); + int tabBarWidth = view->size().width() - buttonSize; + int baseWidth = view->sizeHint().width()/BASE_WIDTH_DIVISOR; + int minWidth = view->sizeHint().width()/MIN_WIDTH_DIVISOR; int w; if (baseWidth*count()webView(tab); - WebView *currentView = m_parent->webView(currentIndex()); + MainView *mv = qobject_cast(parent()); + + WebView *view = mv->webView(tab); + WebView *currentView = mv->webView(currentIndex()); // should fix bug #212219 if(!currentView) diff --git a/src/tabbar.h b/src/tabbar.h index b78e9b24..76d70197 100644 --- a/src/tabbar.h +++ b/src/tabbar.h @@ -33,7 +33,6 @@ // Local Includes #include "rekonqprivate_export.h" -#include "mainview.h" // Qt Includes #include @@ -59,7 +58,7 @@ class REKONQ_TESTS_EXPORT TabBar : public KTabBar Q_OBJECT public: - TabBar(MainView *parent); + TabBar(QWidget *parent); ~TabBar(); void showTabPreview(int tab); @@ -93,8 +92,6 @@ private slots: private: friend class MainView; - MainView *m_parent; - /** * the index in which we are seeing a Context menu */ -- cgit v1.2.1