diff options
author | Andrea Diamantini <adjam7@gmail.com> | 2010-06-05 00:51:41 +0200 |
---|---|---|
committer | Andrea Diamantini <adjam7@gmail.com> | 2010-06-05 00:51:41 +0200 |
commit | 3f2cfd3dab93f212504de7bdcdc6625659170ec1 (patch) | |
tree | 69414dfec1fe84470b11325324ad2be6b685dae7 | |
parent | Awesome bar speed up (diff) | |
download | rekonq-3f2cfd3dab93f212504de7bdcdc6625659170ec1.tar.xz |
This commit implements some speed optimizations on startup
as loading the dockwidgets show on first show.
It also cleans up bookmarks menu loading.
-rw-r--r-- | src/bookmarks/bookmarksmanager.cpp | 2 | ||||
-rw-r--r-- | src/bookmarks/bookmarkspanel.cpp | 19 | ||||
-rw-r--r-- | src/bookmarks/bookmarkspanel.h | 6 | ||||
-rw-r--r-- | src/history/historypanel.cpp | 20 | ||||
-rw-r--r-- | src/history/historypanel.h | 5 |
5 files changed, 43 insertions, 9 deletions
diff --git a/src/bookmarks/bookmarksmanager.cpp b/src/bookmarks/bookmarksmanager.cpp index 93bb5386..e88c5f69 100644 --- a/src/bookmarks/bookmarksmanager.cpp +++ b/src/bookmarks/bookmarksmanager.cpp @@ -144,7 +144,6 @@ BookmarkMenu::BookmarkMenu(KBookmarkManager *manager, { KAction *a = KStandardAction::addBookmark(this, SLOT(slotAddBookmark()), this); actionCollection->addAction(QL1S("rekonq_add_bookmark"), a); - refill(); } @@ -154,7 +153,6 @@ BookmarkMenu::BookmarkMenu(KBookmarkManager *manager, const QString &parentAddress) : KBookmarkMenu(manager, owner, parentMenu, parentAddress) { - refill(); } diff --git a/src/bookmarks/bookmarkspanel.cpp b/src/bookmarks/bookmarkspanel.cpp index 502af574..0dbb89c4 100644 --- a/src/bookmarks/bookmarkspanel.cpp +++ b/src/bookmarks/bookmarkspanel.cpp @@ -54,8 +54,13 @@ BookmarksPanel::BookmarksPanel(const QString &title, QWidget *parent, Qt::Window : QDockWidget(title, parent, flags) , m_treeView(new PanelTreeView(this)) , m_loadingState(false) + , _loaded(false) { - setup(); + setObjectName("bookmarksPanel"); + setAllowedAreas(Qt::LeftDockWidgetArea | Qt::RightDockWidgetArea); + + connect(this, SIGNAL(visibilityChanged(bool)), this, SLOT(showing(bool))); + setShown(ReKonfig::showBookmarksPanel()); } @@ -66,10 +71,16 @@ BookmarksPanel::~BookmarksPanel() } +void BookmarksPanel::showing(bool b) +{ + if(b && !_loaded) + setup(); +} + + void BookmarksPanel::setup() { - setObjectName("bookmarksPanel"); - setAllowedAreas(Qt::LeftDockWidgetArea | Qt::RightDockWidgetArea); + kDebug() << "Loading bookmarks panel setup..."; QWidget *ui = new QWidget(this); @@ -116,6 +127,8 @@ void BookmarksPanel::setup() connect(m_treeView, SIGNAL(expanded(const QModelIndex &)), this, SLOT(onExpand(const QModelIndex &))); connect(search, SIGNAL(textChanged(const QString &)), proxy, SLOT(setFilterFixedString(const QString &))); loadFoldedState(); + + _loaded = true; } diff --git a/src/bookmarks/bookmarkspanel.h b/src/bookmarks/bookmarkspanel.h index b2a9f264..3d2dc26b 100644 --- a/src/bookmarks/bookmarkspanel.h +++ b/src/bookmarks/bookmarkspanel.h @@ -61,6 +61,9 @@ signals: void itemHovered(const QString &); void saveOnlyRequested(); +public slots: + void showing(bool); + private slots: void contextMenu(const QPoint &pos); @@ -70,13 +73,14 @@ private slots: void loadFoldedState(const QModelIndex &root); void loadFoldedState(); - private: void setup(); KBookmark bookmarkForIndex(const QModelIndex &index); PanelTreeView *m_treeView; bool m_loadingState; + + bool _loaded; }; #endif // BOOKMARKSPANEL_H diff --git a/src/history/historypanel.cpp b/src/history/historypanel.cpp index d8309eed..a030676d 100644 --- a/src/history/historypanel.cpp +++ b/src/history/historypanel.cpp @@ -54,8 +54,13 @@ HistoryPanel::HistoryPanel(const QString &title, QWidget *parent, Qt::WindowFlags flags) : QDockWidget(title, parent, flags) , m_treeView(new PanelTreeView(this)) + , _loaded(false) { - setup(); + setObjectName("historyPanel"); + setAllowedAreas(Qt::LeftDockWidgetArea | Qt::RightDockWidgetArea); + + connect(this, SIGNAL(visibilityChanged(bool)), this, SLOT(showing(bool))); + setShown(ReKonfig::showHistoryPanel()); } @@ -67,10 +72,17 @@ HistoryPanel::~HistoryPanel() } + +void HistoryPanel::showing(bool b) +{ + if(b && !_loaded) + setup(); +} + + void HistoryPanel::setup() { - setObjectName("historyPanel"); - setAllowedAreas(Qt::LeftDockWidgetArea | Qt::RightDockWidgetArea); + kDebug() << "Loading history panel setup..."; QWidget *ui = new QWidget(this); @@ -117,6 +129,8 @@ void HistoryPanel::setup() connect(search, SIGNAL(textChanged(QString)), treeProxyModel, SLOT(setFilterFixedString(QString))); connect(m_treeView, SIGNAL(contextMenuItemRequested(const QPoint &)), this, SLOT(contextMenuItem(const QPoint &))); connect(m_treeView, SIGNAL(contextMenuGroupRequested(const QPoint &)), this, SLOT(contextMenuGroup(const QPoint &))); + + _loaded = true; } diff --git a/src/history/historypanel.h b/src/history/historypanel.h index 1c86cfee..68de2828 100644 --- a/src/history/historypanel.h +++ b/src/history/historypanel.h @@ -53,6 +53,9 @@ public: explicit HistoryPanel(const QString &title, QWidget *parent = 0, Qt::WindowFlags flags = 0); ~HistoryPanel(); +public slots: + void showing(bool); + signals: void openUrl(const KUrl &, const Rekonq::OpenType &); void itemHovered(const QString &); @@ -65,6 +68,8 @@ private slots: private: void setup(); PanelTreeView *m_treeView; + + bool _loaded; }; #endif // HISTORYPANEL_H |