From 6ac6be5db223d6c6b302c34a7e65b129605fb343 Mon Sep 17 00:00:00 2001 From: kh1 Date: Tue, 23 Mar 2010 18:11:43 +0100 Subject: Rewrite of the whole help modul initialization. We now do as much as possible lazy initialisation, e.g only start the full text search indexer if we really access the search widget. Also moved the QFutur progress into the search widget. Changed all ctors to be called without an argument, since we share the help engines from help manager all over the place. Make use of the fact that we only need to call setupData on the gui engine if we access the help mode, otherwise all data is fetched thru the core engine whichs setupData is really fast. --- src/plugins/help/generalsettingspage.cpp | 20 +++++--------------- 1 file changed, 5 insertions(+), 15 deletions(-) (limited to 'src/plugins/help/generalsettingspage.cpp') diff --git a/src/plugins/help/generalsettingspage.cpp b/src/plugins/help/generalsettingspage.cpp index 658d2a085a..bb62461df0 100644 --- a/src/plugins/help/generalsettingspage.cpp +++ b/src/plugins/help/generalsettingspage.cpp @@ -52,8 +52,7 @@ using namespace Help::Internal; -GeneralSettingsPage::GeneralSettingsPage(BookmarkManager *bookmarkManager) - : m_bookmarkManager(bookmarkManager) +GeneralSettingsPage::GeneralSettingsPage() { #if !defined(QT_NO_WEBKIT) QWebSettings* webSettings = QWebSettings::globalSettings(); @@ -134,11 +133,6 @@ QWidget *GeneralSettingsPage::createPage(QWidget *parent) } void GeneralSettingsPage::apply() -{ - emit dialogAccepted(); -} - -bool GeneralSettingsPage::applyChanges() { QFont newFont; const QString &family = m_ui.familyComboBox->currentFont().family(); @@ -168,7 +162,6 @@ bool GeneralSettingsPage::applyChanges() QHelpEngineCore *engine = &HelpManager::helpEngineCore(); engine->setCustomValue(QLatin1String("font"), newFont); - bool needsUpdate = newFont != m_font; #if !defined(QT_NO_WEBKIT) QWebSettings* webSettings = QWebSettings::globalSettings(); @@ -182,17 +175,14 @@ bool GeneralSettingsPage::applyChanges() if (homePage.isEmpty()) homePage = QLatin1String("about:blank"); engine->setCustomValue(QLatin1String("HomePage"), homePage); - needsUpdate |= homePage != m_homePage; const int startOption = m_ui.helpStartComboBox->currentIndex(); engine->setCustomValue(QLatin1String("StartOption"), startOption); - needsUpdate |= startOption != m_startOption; const int helpOption = m_ui.contextHelpComboBox->currentIndex(); engine->setCustomValue(QLatin1String("ContextHelpOption"), helpOption); - needsUpdate |= helpOption != m_helpOption; - return needsUpdate; + // no need to call setup on the gui engine since we use only core engine } void GeneralSettingsPage::setCurrentPage() @@ -226,8 +216,8 @@ void GeneralSettingsPage::importBookmarks() QFile file(fileName); if (file.open(QIODevice::ReadOnly)) { - XbelReader reader(m_bookmarkManager->treeBookmarkModel(), - m_bookmarkManager->listBookmarkModel()); + const BookmarkManager &manager = HelpManager::bookmarkManager(); + XbelReader reader(manager.treeBookmarkModel(), manager.listBookmarkModel()); if (reader.readFromFile(&file)) return; } @@ -249,7 +239,7 @@ void GeneralSettingsPage::exportBookmarks() QFile file(fileName); if (file.open(QIODevice::WriteOnly)) { - XbelWriter writer(m_bookmarkManager->treeBookmarkModel()); + XbelWriter writer(HelpManager::bookmarkManager().treeBookmarkModel()); writer.writeToFile(&file); } } -- cgit v1.2.1