From 78325dc56078f7991068eb7b2dbe0e25ab7dc924 Mon Sep 17 00:00:00 2001
From: Andrea Diamantini <adjam7@gmail.com>
Date: Fri, 21 May 2010 12:05:48 +0200
Subject: inlined some of the most used get functions to speed up a bit

---
 src/findbar.cpp    |  6 ------
 src/findbar.h      |  2 +-
 src/mainview.cpp   | 19 -------------------
 src/mainview.h     |  7 ++++---
 src/mainwindow.cpp | 27 ---------------------------
 src/mainwindow.h   |  7 ++++---
 src/webtab.cpp     | 19 -------------------
 src/webtab.h       | 16 ++++++++--------
 src/webview.cpp    |  6 ------
 src/webview.h      |  3 ++-
 10 files changed, 19 insertions(+), 93 deletions(-)

(limited to 'src')

diff --git a/src/findbar.cpp b/src/findbar.cpp
index f89cde60..10b63186 100644
--- a/src/findbar.cpp
+++ b/src/findbar.cpp
@@ -126,12 +126,6 @@ FindBar::~FindBar()
 }
 
 
-KLineEdit *FindBar::lineEdit() const
-{
-    return m_lineEdit;
-}
-
-
 bool FindBar::matchCase() const
 {
     return m_matchCase->isChecked();
diff --git a/src/findbar.h b/src/findbar.h
index 39bb28c9..83334b4f 100644
--- a/src/findbar.h
+++ b/src/findbar.h
@@ -50,7 +50,7 @@ class REKONQ_TESTS_EXPORT FindBar : public QWidget
 public:
     FindBar(QWidget *parent);
     ~FindBar();
-    KLineEdit *lineEdit() const;
+
     bool matchCase() const;
     void notifyMatch(bool match);
     bool highlightAllState() const;
diff --git a/src/mainview.cpp b/src/mainview.cpp
index 58247d53..1c36adcf 100644
--- a/src/mainview.cpp
+++ b/src/mainview.cpp
@@ -35,7 +35,6 @@
 #include "rekonq.h"
 
 // Local Includes
-#include "webtab.h"
 #include "tabbar.h"
 #include "urlbar.h"
 #include "sessionmanager.h"
@@ -166,12 +165,6 @@ void MainView::updateTabButtonPosition()
 }
 
 
-QToolButton *MainView::addTabButton() const
-{
-    return m_addTabButton;
-}
-
-
 TabBar *MainView::tabBar() const
 {
     TabBar *tabBar = qobject_cast<TabBar *>(KTabWidget::tabBar());
@@ -185,12 +178,6 @@ UrlBar *MainView::urlBar() const
 }
 
 
-StackedUrlBar *MainView::widgetBar() const
-{
-    return _widgetBar;
-}
-
-
 WebTab *MainView::currentWebTab() const
 {
     return webTab(currentIndex());
@@ -693,12 +680,6 @@ QLabel *MainView::animatedLoading(int index, bool addMovie)
 }
 
 
-QList<HistoryItem> MainView::recentlyClosedTabs()
-{
-    return m_recentlyClosedTabs;
-}
-
-
 void MainView::resizeEvent(QResizeEvent *event)
 {
     updateTabBar();
diff --git a/src/mainview.h b/src/mainview.h
index 6eacc104..0cff4c81 100644
--- a/src/mainview.h
+++ b/src/mainview.h
@@ -37,6 +37,7 @@
 // Local Includes
 #include "webview.h"
 #include "webpage.h"
+#include "webtab.h"
 #include "application.h"
 #include "historymanager.h"
 #include "mainwindow.h"
@@ -72,7 +73,7 @@ public:
     MainView(MainWindow *parent);
     ~MainView();
 
-    StackedUrlBar *widgetBar() const;
+    inline StackedUrlBar *widgetBar() const { return _widgetBar; }
     UrlBar *urlBar() const;
     WebTab *webTab(int index) const;
 
@@ -88,7 +89,7 @@ public:
 
     void setTabBarHidden(bool hide);
 
-    QToolButton *addTabButton() const;
+    inline QToolButton *addTabButton() const { return m_addTabButton; }
 
     /**
      * This function creates a new empty tab
@@ -100,7 +101,7 @@ public:
      */
     WebTab *newWebTab(bool focused = true, bool nearParent = false);
 
-    QList<HistoryItem> recentlyClosedTabs();
+    inline QList<HistoryItem> recentlyClosedTabs() { return m_recentlyClosedTabs; }
 
 signals:
     // tab widget signals
diff --git a/src/mainwindow.cpp b/src/mainwindow.cpp
index c56dcf76..2287370c 100644
--- a/src/mainwindow.cpp
+++ b/src/mainwindow.cpp
@@ -265,12 +265,6 @@ QSize MainWindow::sizeHint() const
 }
 
 
-KActionCollection *MainWindow::actionCollection() const
-{
-    return m_ac;
-}
-
-
 void MainWindow::setupActions()
 {
     // this let shortcuts work..
@@ -984,13 +978,6 @@ void MainWindow::homePage(Qt::MouseButtons mouseButtons, Qt::KeyboardModifiers k
 }
 
 
-MainView *MainWindow::mainView() const
-{
-    return m_view;
-}
-
-
-
 WebTab *MainWindow::currentTab() const
 {
     return m_view->currentWebTab();
@@ -1124,20 +1111,6 @@ void MainWindow::keyPressEvent(QKeyEvent *event)
 }
 
 
-QAction *MainWindow::actionByName(const QString &name)
-{
-    QAction *ret = actionCollection()->action(name);
-
-    if (ret)
-        return ret;
-
-    /* else */
-    kDebug() << "Action named: " << name << " not found, returning empty action.";
-
-    return new QAction(this);  // return empty object instead of NULL pointer
-}
-
-
 void MainWindow::notifyMessage(const QString &msg, Rekonq::Notify status)
 {
     if (this != QApplication::activeWindow())
diff --git a/src/mainwindow.h b/src/mainwindow.h
index 1f6c6931..ffc91086 100644
--- a/src/mainwindow.h
+++ b/src/mainwindow.h
@@ -70,11 +70,12 @@ public:
     MainWindow();
     ~MainWindow();
 
-    MainView *mainView() const;
+    inline MainView *mainView() const { return m_view; }
+    inline KActionCollection *actionCollection() const { return m_ac; }
+    inline QAction *actionByName(const QString &name) { return actionCollection()->action(name); }
+    
     WebTab *currentTab() const;
-    QAction *actionByName(const QString &name);
     virtual QSize sizeHint() const;
-    virtual KActionCollection *actionCollection() const;
     void setWidgetsVisible(bool makeFullScreen);
 
     void setZoomSliderFactor(qreal factor);
diff --git a/src/webtab.cpp b/src/webtab.cpp
index d8fff875..a6bedc97 100644
--- a/src/webtab.cpp
+++ b/src/webtab.cpp
@@ -36,7 +36,6 @@
 #include "application.h"
 #include "mainwindow.h"
 #include "mainview.h"
-#include "webpage.h"
 #include "bookmarksmanager.h"
 #include "walletbar.h"
 #include "previewselectorbar.h"
@@ -96,18 +95,6 @@ WebTab::~WebTab()
 }
 
 
-WebView *WebTab::view()
-{
-    return _view;
-}
-
-
-WebPage *WebTab::page()
-{
-    return view()->page();
-}
-
-
 // TODO:
 // Import the "about" check and the one in protocolhandler
 // in some (static?) methods in NewTabPage
@@ -134,12 +121,6 @@ KUrl WebTab::url()
 }
 
 
-int WebTab::progress()
-{
-    return m_progress;
-}
-
-
 void WebTab::updateProgress(int p)
 {
     m_progress = p;
diff --git a/src/webtab.h b/src/webtab.h
index 309ecd9a..bc07a3e9 100644
--- a/src/webtab.h
+++ b/src/webtab.h
@@ -32,16 +32,16 @@
 // Rekonq Includes
 #include "rekonq_defines.h"
 
+// Local Includes
+#include "webpage.h"
+#include "webview.h"
+
 // KDE Includes
 #include <KUrl>
 
 // Qt Includes
 #include <QWidget>
 
-// Forward Declarations
-class WebPage;
-class WebView;
-
 
 class REKONQ_TESTS_EXPORT WebTab : public QWidget
 {
@@ -51,11 +51,11 @@ public:
     explicit WebTab(QWidget *parent = 0);
     ~WebTab();
 
-    WebView *view();
-    WebPage *page();
+    inline WebView *view() { return _view; }
+    inline WebPage *page() { return view()->page(); }
+    inline int progress() { return m_progress; }
+    
     KUrl url();
-
-    int progress();
     void createPreviewSelectorBar(int index);
 
     bool hasRSSInfo();
diff --git a/src/webview.cpp b/src/webview.cpp
index 1996d6af..86b60fac 100644
--- a/src/webview.cpp
+++ b/src/webview.cpp
@@ -374,12 +374,6 @@ void WebView::mouseMoveEvent(QMouseEvent *event)
 }
 
 
-QPoint WebView::mousePos()
-{
-    return _mousePos;
-}
-
-
 void WebView::search()
 {
     KAction *a = qobject_cast<KAction*>(sender());
diff --git a/src/webview.h b/src/webview.h
index 71e3047f..bac12e99 100644
--- a/src/webview.h
+++ b/src/webview.h
@@ -48,7 +48,8 @@ public:
     ~WebView();
 
     WebPage *page();
-    QPoint mousePos();
+    
+    inline QPoint mousePos() { return _mousePos; }
 
 protected:
     void contextMenuEvent(QContextMenuEvent *event);
-- 
cgit v1.2.1