Whitespace cleanup, normalize connect.

Reviewed-by: dt
This commit is contained in:
kh
2009-06-02 18:41:12 +02:00
parent b50eaa6542
commit 7b24a59382
7 changed files with 142 additions and 101 deletions

View File

@@ -113,8 +113,8 @@ CentralWidget::CentralWidget(QHelpEngine *engine, QWidget *parent)
if (tabBar) { if (tabBar) {
tabBar->installEventFilter(this); tabBar->installEventFilter(this);
tabBar->setContextMenuPolicy(Qt::CustomContextMenu); tabBar->setContextMenuPolicy(Qt::CustomContextMenu);
connect(tabBar, SIGNAL(customContextMenuRequested(const QPoint&)), connect(tabBar, SIGNAL(customContextMenuRequested(QPoint)), this,
this, SLOT(showTabBarContextMenu(const QPoint&))); SLOT(showTabBarContextMenu(QPoint)));
} }
staticCentralWidget = this; staticCentralWidget = this;
@@ -314,7 +314,8 @@ void CentralWidget::printPreview()
#ifndef QT_NO_PRINTER #ifndef QT_NO_PRINTER
initPrinter(); initPrinter();
QPrintPreviewDialog preview(printer, this); QPrintPreviewDialog preview(printer, this);
connect(&preview, SIGNAL(paintRequested(QPrinter *)), SLOT(printPreview(QPrinter *))); connect(&preview, SIGNAL(paintRequested(QPrinter*)),
SLOT(printPreview(QPrinter*)));
preview.exec(); preview.exec();
#endif #endif
} }
@@ -422,13 +423,18 @@ void CentralWidget::connectSignals()
{ {
const HelpViewer* viewer = currentHelpViewer(); const HelpViewer* viewer = currentHelpViewer();
if (viewer) { if (viewer) {
connect(viewer, SIGNAL(copyAvailable(bool)), this, SIGNAL(copyAvailable(bool))); connect(viewer, SIGNAL(copyAvailable(bool)), this,
connect(viewer, SIGNAL(forwardAvailable(bool)), this, SIGNAL(forwardAvailable(bool))); SIGNAL(copyAvailable(bool)));
connect(viewer, SIGNAL(backwardAvailable(bool)), this, SIGNAL(backwardAvailable(bool))); connect(viewer, SIGNAL(forwardAvailable(bool)), this,
connect(viewer, SIGNAL(sourceChanged(const QUrl&)), this, SIGNAL(sourceChanged(const QUrl&))); SIGNAL(forwardAvailable(bool)));
connect(viewer, SIGNAL(highlighted(const QString&)), this, SIGNAL(highlighted(const QString&))); connect(viewer, SIGNAL(backwardAvailable(bool)), this,
SIGNAL(backwardAvailable(bool)));
connect(viewer, SIGNAL(sourceChanged(const QUrl&)), this, SLOT(setTabTitle(const QUrl&))); connect(viewer, SIGNAL(sourceChanged(QUrl)), this,
SIGNAL(sourceChanged(QUrl)));
connect(viewer, SIGNAL(highlighted(QString)), this,
SIGNAL(highlighted(QString)));
connect(viewer, SIGNAL(sourceChanged(QUrl)), this,
SLOT(setTabTitle(QUrl)));
} }
} }

View File

@@ -71,12 +71,11 @@ QWidget *FilterSettingsPage::createPage(QWidget *parent)
connect(m_ui.attributeWidget, SIGNAL(itemChanged(QTreeWidgetItem*, int)), connect(m_ui.attributeWidget, SIGNAL(itemChanged(QTreeWidgetItem*, int)),
this, SLOT(updateFilterMap())); this, SLOT(updateFilterMap()));
connect(m_ui.filterWidget, connect(m_ui.filterWidget,
SIGNAL(currentItemChanged(QListWidgetItem*, QListWidgetItem*)), SIGNAL(currentItemChanged(QListWidgetItem*, QListWidgetItem*)), this,
this, SLOT(updateAttributes(QListWidgetItem*))); SLOT(updateAttributes(QListWidgetItem*)));
connect(m_ui.filterAddButton, SIGNAL(clicked()), connect(m_ui.filterAddButton, SIGNAL(clicked()), this, SLOT(addFilter()));
this, SLOT(addFilter())); connect(m_ui.filterRemoveButton, SIGNAL(clicked()), this,
connect(m_ui.filterRemoveButton, SIGNAL(clicked()), SLOT(removeFilter()));
this, SLOT(removeFilter()));
updateFilterPage(); updateFilterPage();
return m_currentPage; return m_currentPage;

View File

@@ -90,10 +90,11 @@ void HelpManager::registerDocumentation(const QStringList &fileNames)
if (!hc.setupData()) if (!hc.setupData())
qWarning() << "Could not initialize help engine:" << hc.error(); qWarning() << "Could not initialize help engine:" << hc.error();
foreach (const QString &fileName, fileNames) { foreach (const QString &fileName, fileNames) {
if (!QFile::exists(fileName)) if (!QFileInfo(fileName).exists())
continue; continue;
QString fileNamespace = QHelpEngineCore::namespaceName(fileName); const QString &nameSpace = QHelpEngineCore::namespaceName(fileName);
if (!fileNamespace.isEmpty() && !hc.registeredDocumentations().contains(fileNamespace)) { if (!nameSpace.isEmpty()
&& !hc.registeredDocumentations().contains(nameSpace)) {
if (hc.registerDocumentation(fileName)) if (hc.registerDocumentation(fileName))
needsSetup = true; needsSetup = true;
else else
@@ -141,7 +142,7 @@ bool HelpPlugin::initialize(const QStringList &arguments, QString *error)
if (!locale.isEmpty()) { if (!locale.isEmpty()) {
QTranslator *qtr = new QTranslator(this); QTranslator *qtr = new QTranslator(this);
qtr->load(QLatin1String("assistant_") + locale, qtr->load(QLatin1String("assistant_") + locale,
QLibraryInfo::location(QLibraryInfo::TranslationsPath)); QLibraryInfo::location(QLibraryInfo::TranslationsPath));
qApp->installTranslator(qtr); qApp->installTranslator(qtr);
} }
@@ -157,10 +158,10 @@ bool HelpPlugin::initialize(const QStringList &arguments, QString *error)
QDir directory(fi.absolutePath()+"/qtcreator"); QDir directory(fi.absolutePath()+"/qtcreator");
if (!directory.exists()) if (!directory.exists())
directory.mkpath(directory.absolutePath()); directory.mkpath(directory.absolutePath());
m_helpEngine = new QHelpEngine(directory.absolutePath() m_helpEngine = new QHelpEngine(directory.absolutePath() +
+ QLatin1String("/helpcollection.qhc"), this); QLatin1String("/helpcollection.qhc"), this);
connect(m_helpEngine, SIGNAL(setupFinished()), connect(m_helpEngine, SIGNAL(setupFinished()), this,
this, SLOT(updateFilterComboBox())); SLOT(updateFilterComboBox()));
addAutoReleasedObject(new HelpManager(m_helpEngine)); addAutoReleasedObject(new HelpManager(m_helpEngine));
@@ -171,8 +172,8 @@ bool HelpPlugin::initialize(const QStringList &arguments, QString *error)
addAutoReleasedObject(m_filterSettingsPage); addAutoReleasedObject(m_filterSettingsPage);
connect(m_docSettingsPage, SIGNAL(documentationAdded()), connect(m_docSettingsPage, SIGNAL(documentationAdded()),
m_filterSettingsPage, SLOT(updateFilterPage())); m_filterSettingsPage, SLOT(updateFilterPage()));
connect(m_docSettingsPage, SIGNAL(dialogAccepted()), connect(m_docSettingsPage, SIGNAL(dialogAccepted()), this,
this, SLOT(checkForHelpChanges())); SLOT(checkForHelpChanges()));
m_contentWidget = new ContentWindow(m_helpEngine); m_contentWidget = new ContentWindow(m_helpEngine);
m_contentWidget->setWindowTitle(tr("Contents")); m_contentWidget->setWindowTitle(tr("Contents"));
@@ -183,53 +184,69 @@ bool HelpPlugin::initialize(const QStringList &arguments, QString *error)
m_bookmarkManager = new BookmarkManager(m_helpEngine); m_bookmarkManager = new BookmarkManager(m_helpEngine);
m_bookmarkWidget = new BookmarkWidget(m_bookmarkManager, 0, false); m_bookmarkWidget = new BookmarkWidget(m_bookmarkManager, 0, false);
m_bookmarkWidget->setWindowTitle(tr("Bookmarks")); m_bookmarkWidget->setWindowTitle(tr("Bookmarks"));
connect(m_bookmarkWidget, SIGNAL(addBookmark()), connect(m_bookmarkWidget, SIGNAL(addBookmark()), this, SLOT(addBookmark()));
this, SLOT(addBookmark()));
Core::ActionManager *am = m_core->actionManager(); Core::ActionManager *am = m_core->actionManager();
Core::Command *cmd; Core::Command *cmd;
// Add Home, Previous and Next actions (used in the toolbar) // Add Home, Previous and Next actions (used in the toolbar)
QAction *homeAction = new QAction(QIcon(QLatin1String(":/help/images/home.png")), tr("Home"), this); QAction *homeAction =
new QAction(QIcon(QLatin1String(":/help/images/home.png")), tr("Home"),
this);
cmd = am->registerAction(homeAction, QLatin1String("Help.Home"), globalcontext); cmd = am->registerAction(homeAction, QLatin1String("Help.Home"), globalcontext);
QAction *previousAction = new QAction(QIcon(QLatin1String(":/help/images/previous.png")), QAction *previousAction =
new QAction(QIcon(QLatin1String(":/help/images/previous.png")),
tr("Previous"), this); tr("Previous"), this);
cmd = am->registerAction(previousAction, QLatin1String("Help.Previous"), modecontext); cmd = am->registerAction(previousAction, QLatin1String("Help.Previous"),
modecontext);
cmd->setDefaultKeySequence(QKeySequence::Back); cmd->setDefaultKeySequence(QKeySequence::Back);
QAction *nextAction = new QAction(QIcon(QLatin1String(":/help/images/next.png")), tr("Next"), this); QAction *nextAction =
new QAction(QIcon(QLatin1String(":/help/images/next.png")), tr("Next"),
this);
cmd = am->registerAction(nextAction, QLatin1String("Help.Next"), modecontext); cmd = am->registerAction(nextAction, QLatin1String("Help.Next"), modecontext);
cmd->setDefaultKeySequence(QKeySequence::Forward); cmd->setDefaultKeySequence(QKeySequence::Forward);
QAction *addBookmarkAction = new QAction(QIcon(QLatin1String(":/help/images/bookmark.png")), QAction *addBookmarkAction =
new QAction(QIcon(QLatin1String(":/help/images/bookmark.png")),
tr("Add Bookmark"), this); tr("Add Bookmark"), this);
cmd = am->registerAction(addBookmarkAction, QLatin1String("Help.AddBookmark"), modecontext); cmd = am->registerAction(addBookmarkAction, QLatin1String("Help.AddBookmark"),
modecontext);
cmd->setDefaultKeySequence(QKeySequence(Qt::CTRL + Qt::Key_M)); cmd->setDefaultKeySequence(QKeySequence(Qt::CTRL + Qt::Key_M));
// Add Index, Contents, and Context menu items and a separator to the Help menu // Add Index, Contents, and Context menu items and a separator to the Help menu
QAction *indexAction = new QAction(tr("Index"), this); QAction *indexAction = new QAction(tr("Index"), this);
cmd = am->registerAction(indexAction, QLatin1String("Help.Index"), globalcontext); cmd = am->registerAction(indexAction, QLatin1String("Help.Index"),
am->actionContainer(Core::Constants::M_HELP)->addAction(cmd, Core::Constants::G_HELP_HELP); globalcontext);
am->actionContainer(Core::Constants::M_HELP)->addAction(cmd,
Core::Constants::G_HELP_HELP);
QAction *contentsAction = new QAction(tr("Contents"), this); QAction *contentsAction = new QAction(tr("Contents"), this);
cmd = am->registerAction(contentsAction, QLatin1String("Help.Contents"), globalcontext); cmd = am->registerAction(contentsAction, QLatin1String("Help.Contents"),
am->actionContainer(Core::Constants::M_HELP)->addAction(cmd, Core::Constants::G_HELP_HELP); globalcontext);
am->actionContainer(Core::Constants::M_HELP)->addAction(cmd,
Core::Constants::G_HELP_HELP);
QAction *searchAction = new QAction(tr("Search"), this); QAction *searchAction = new QAction(tr("Search"), this);
cmd = am->registerAction(searchAction, QLatin1String("Help.Search"), globalcontext); cmd = am->registerAction(searchAction, QLatin1String("Help.Search"),
am->actionContainer(Core::Constants::M_HELP)->addAction(cmd, Core::Constants::G_HELP_HELP); globalcontext);
am->actionContainer(Core::Constants::M_HELP)->addAction(cmd,
Core::Constants::G_HELP_HELP);
QAction *contextAction = new QAction(tr("Context Help"), this); QAction *contextAction = new QAction(tr("Context Help"), this);
cmd = am->registerAction(contextAction, QLatin1String("Help.Context"), globalcontext); cmd = am->registerAction(contextAction, QLatin1String("Help.Context"),
globalcontext);
cmd->setDefaultKeySequence(QKeySequence(Qt::Key_F1)); cmd->setDefaultKeySequence(QKeySequence(Qt::Key_F1));
am->actionContainer(Core::Constants::M_HELP)->addAction(cmd, Core::Constants::G_HELP_HELP); am->actionContainer(Core::Constants::M_HELP)->addAction(cmd,
Core::Constants::G_HELP_HELP);
#ifndef Q_OS_MAC #ifndef Q_OS_MAC
QAction *sep = new QAction(this); QAction *sep = new QAction(this);
sep->setSeparator(true); sep->setSeparator(true);
cmd = am->registerAction(sep, QLatin1String("Help.Separator"), globalcontext); cmd = am->registerAction(sep, QLatin1String("Help.Separator"), globalcontext);
am->actionContainer(Core::Constants::M_HELP)->addAction(cmd, Core::Constants::G_HELP_HELP); am->actionContainer(Core::Constants::M_HELP)->addAction(cmd,
Core::Constants::G_HELP_HELP);
#endif #endif
m_centralWidget = new Help::Internal::CentralWidget(m_helpEngine); m_centralWidget = new Help::Internal::CentralWidget(m_helpEngine);
@@ -276,21 +293,24 @@ bool HelpPlugin::initialize(const QStringList &arguments, QString *error)
QMap<QString, Core::Command*> shortcutMap; QMap<QString, Core::Command*> shortcutMap;
QShortcut *shortcut = new QShortcut(splitter); QShortcut *shortcut = new QShortcut(splitter);
shortcut->setWhatsThis(tr("Activate Index in Help mode")); shortcut->setWhatsThis(tr("Activate Index in Help mode"));
cmd = am->registerShortcut(shortcut, QLatin1String("Help.IndexShortcut"), modecontext); cmd = am->registerShortcut(shortcut, QLatin1String("Help.IndexShortcut"),
modecontext);
cmd->setDefaultKeySequence(QKeySequence(Qt::CTRL + Qt::Key_I)); cmd->setDefaultKeySequence(QKeySequence(Qt::CTRL + Qt::Key_I));
connect(shortcut, SIGNAL(activated()), this, SLOT(activateIndex())); connect(shortcut, SIGNAL(activated()), this, SLOT(activateIndex()));
shortcutMap.insert(m_indexWidget->windowTitle(), cmd); shortcutMap.insert(m_indexWidget->windowTitle(), cmd);
shortcut = new QShortcut(splitter); shortcut = new QShortcut(splitter);
shortcut->setWhatsThis(tr("Activate Contents in Help mode")); shortcut->setWhatsThis(tr("Activate Contents in Help mode"));
cmd = am->registerShortcut(shortcut, QLatin1String("Help.ContentsShortcut"), modecontext); cmd = am->registerShortcut(shortcut, QLatin1String("Help.ContentsShortcut"),
modecontext);
cmd->setDefaultKeySequence(QKeySequence(Qt::CTRL + Qt::Key_T)); cmd->setDefaultKeySequence(QKeySequence(Qt::CTRL + Qt::Key_T));
connect(shortcut, SIGNAL(activated()), this, SLOT(activateContents())); connect(shortcut, SIGNAL(activated()), this, SLOT(activateContents()));
shortcutMap.insert(m_contentWidget->windowTitle(), cmd); shortcutMap.insert(m_contentWidget->windowTitle(), cmd);
shortcut = new QShortcut(splitter); shortcut = new QShortcut(splitter);
shortcut->setWhatsThis(tr("Activate Search in Help mode")); shortcut->setWhatsThis(tr("Activate Search in Help mode"));
cmd = am->registerShortcut(shortcut, QLatin1String("Help.SearchShortcut"), modecontext); cmd = am->registerShortcut(shortcut, QLatin1String("Help.SearchShortcut"),
modecontext);
cmd->setDefaultKeySequence(QKeySequence(Qt::CTRL + Qt::Key_S)); cmd->setDefaultKeySequence(QKeySequence(Qt::CTRL + Qt::Key_S));
connect(shortcut, SIGNAL(activated()), this, SLOT(activateSearch())); connect(shortcut, SIGNAL(activated()), this, SLOT(activateSearch()));
shortcutMap.insert(m_searchWidget->windowTitle(), cmd); shortcutMap.insert(m_searchWidget->windowTitle(), cmd);
@@ -302,23 +322,23 @@ bool HelpPlugin::initialize(const QStringList &arguments, QString *error)
connect(previousAction, SIGNAL(triggered()), m_centralWidget, SLOT(backward())); connect(previousAction, SIGNAL(triggered()), m_centralWidget, SLOT(backward()));
connect(nextAction, SIGNAL(triggered()), m_centralWidget, SLOT(forward())); connect(nextAction, SIGNAL(triggered()), m_centralWidget, SLOT(forward()));
connect(addBookmarkAction, SIGNAL(triggered()), this, SLOT(addBookmark())); connect(addBookmarkAction, SIGNAL(triggered()), this, SLOT(addBookmark()));
connect(m_contentWidget, SIGNAL(linkActivated(const QUrl&)), connect(m_contentWidget, SIGNAL(linkActivated(QUrl)), m_centralWidget,
m_centralWidget, SLOT(setSource(const QUrl&))); SLOT(setSource(QUrl)));
connect(m_indexWidget, SIGNAL(linkActivated(const QUrl&)), connect(m_indexWidget, SIGNAL(linkActivated(QUrl)), m_centralWidget,
m_centralWidget, SLOT(setSource(const QUrl&))); SLOT(setSource(QUrl)));
connect(m_searchWidget, SIGNAL(requestShowLink(const QUrl&)), connect(m_searchWidget, SIGNAL(requestShowLink(QUrl)), m_centralWidget,
m_centralWidget, SLOT(setSource(const QUrl&))); SLOT(setSource(QUrl)));
connect(m_searchWidget, SIGNAL(requestShowLinkInNewTab(const QUrl&)), connect(m_searchWidget, SIGNAL(requestShowLinkInNewTab(QUrl)),
m_centralWidget, SLOT(setSourceInNewTab(const QUrl&))); m_centralWidget, SLOT(setSourceInNewTab(QUrl)));
connect(m_bookmarkWidget, SIGNAL(requestShowLink(const QUrl&)), connect(m_bookmarkWidget, SIGNAL(requestShowLink(QUrl)), m_centralWidget,
m_centralWidget, SLOT(setSource(const QUrl&))); SLOT(setSource(const QUrl&)));
connect(m_centralWidget, SIGNAL(backwardAvailable(bool)), connect(m_centralWidget, SIGNAL(backwardAvailable(bool)),
previousAction, SLOT(setEnabled(bool))); previousAction, SLOT(setEnabled(bool)));
connect(m_centralWidget, SIGNAL(forwardAvailable(bool)), connect(m_centralWidget, SIGNAL(forwardAvailable(bool)),
nextAction, SLOT(setEnabled(bool))); nextAction, SLOT(setEnabled(bool)));
connect(m_centralWidget, SIGNAL(addNewBookmark(const QString&, const QString&)), connect(m_centralWidget, SIGNAL(addNewBookmark(QString, QString)), this,
this, SLOT(addNewBookmark(const QString&, const QString&))); SLOT(addNewBookmark(QString, QString)));
QList<QAction*> actionList; QList<QAction*> actionList;
actionList << previousAction actionList << previousAction
@@ -338,19 +358,19 @@ bool HelpPlugin::initialize(const QStringList &arguments, QString *error)
connect(m_core->modeManager(), SIGNAL(currentModeChanged(Core::IMode*)), connect(m_core->modeManager(), SIGNAL(currentModeChanged(Core::IMode*)),
this, SLOT(modeChanged(Core::IMode*))); this, SLOT(modeChanged(Core::IMode*)));
connect(m_contentWidget, SIGNAL(linkActivated(const QUrl&)), connect(m_contentWidget, SIGNAL(linkActivated(QUrl)), m_centralWidget,
m_centralWidget, SLOT(setSource(const QUrl&))); SLOT(setSource(QUrl)));
connect(m_indexWidget, SIGNAL(linkActivated(const QUrl&)), connect(m_indexWidget, SIGNAL(linkActivated(QUrl)), m_centralWidget,
m_centralWidget, SLOT(setSource(const QUrl&))); SLOT(setSource(QUrl)));
connect(m_indexWidget, SIGNAL(linksActivated(const QMap<QString, QUrl>&, const QString&)), connect(m_indexWidget, SIGNAL(linksActivated(QMap<QString, QUrl>, QString)),
m_centralWidget, SLOT(showTopicChooser(const QMap<QString, QUrl>&, const QString&))); m_centralWidget, SLOT(showTopicChooser(QMap<QString, QUrl>, QString)));
HelpIndexFilter *helpIndexFilter = new HelpIndexFilter(this, m_helpEngine); HelpIndexFilter *helpIndexFilter = new HelpIndexFilter(this, m_helpEngine);
addAutoReleasedObject(helpIndexFilter); addAutoReleasedObject(helpIndexFilter);
connect(helpIndexFilter, SIGNAL(linkActivated(QUrl)), connect(helpIndexFilter, SIGNAL(linkActivated(QUrl)), this,
this, SLOT(switchToHelpMode(QUrl))); SLOT(switchToHelpMode(QUrl)));
connect(helpIndexFilter, SIGNAL(linksActivated(const QMap<QString, QUrl>&, const QString&)), connect(helpIndexFilter, SIGNAL(linksActivated(QMap<QString, QUrl>, QString)),
this, SLOT(switchToHelpMode(const QMap<QString, QUrl>&, const QString&))); this, SLOT(switchToHelpMode(QMap<QString, QUrl>, QString)));
previousAction->setEnabled(m_centralWidget->isBackwardAvailable()); previousAction->setEnabled(m_centralWidget->isBackwardAvailable());
nextAction->setEnabled(m_centralWidget->isForwardAvailable()); nextAction->setEnabled(m_centralWidget->isForwardAvailable());
@@ -365,8 +385,12 @@ bool HelpPlugin::initialize(const QStringList &arguments, QString *error)
void HelpPlugin::createRightPaneSideBar() void HelpPlugin::createRightPaneSideBar()
{ {
QAction *switchToHelpMode = new QAction("Go to Help Mode", this); QAction *switchToHelpMode = new QAction("Go to Help Mode", this);
m_rightPaneBackwardAction = new QAction(QIcon(QLatin1String(":/help/images/previous.png")), tr("Previous"), this); m_rightPaneBackwardAction =
m_rightPaneForwardAction = new QAction(QIcon(QLatin1String(":/help/images/next.png")), tr("Next"), this); new QAction(QIcon(QLatin1String(":/help/images/previous.png")),
tr("Previous"), this);
m_rightPaneForwardAction =
new QAction(QIcon(QLatin1String(":/help/images/next.png")), tr("Next"),
this);
QToolBar *rightPaneToolBar = new QToolBar(); QToolBar *rightPaneToolBar = new QToolBar();
rightPaneToolBar->addAction(switchToHelpMode); rightPaneToolBar->addAction(switchToHelpMode);
@@ -374,8 +398,10 @@ void HelpPlugin::createRightPaneSideBar()
rightPaneToolBar->addAction(m_rightPaneForwardAction); rightPaneToolBar->addAction(m_rightPaneForwardAction);
connect(switchToHelpMode, SIGNAL(triggered()), this, SLOT(switchToHelpMode())); connect(switchToHelpMode, SIGNAL(triggered()), this, SLOT(switchToHelpMode()));
connect(m_rightPaneBackwardAction, SIGNAL(triggered()), this, SLOT(rightPaneBackward())); connect(m_rightPaneBackwardAction, SIGNAL(triggered()), this,
connect(m_rightPaneForwardAction, SIGNAL(triggered()), this, SLOT(rightPaneForward())); SLOT(rightPaneBackward()));
connect(m_rightPaneForwardAction, SIGNAL(triggered()), this,
SLOT(rightPaneForward()));
QToolButton *closeButton = new QToolButton(); QToolButton *closeButton = new QToolButton();
closeButton->setProperty("type", QLatin1String("dockbutton")); closeButton->setProperty("type", QLatin1String("dockbutton"));
@@ -457,7 +483,8 @@ void HelpPlugin::switchToHelpMode(const QUrl &source)
m_centralWidget->setFocus(); m_centralWidget->setFocus();
} }
void HelpPlugin::switchToHelpMode(const QMap<QString, QUrl> &urls, const QString &keyword) void HelpPlugin::switchToHelpMode(const QMap<QString, QUrl> &urls,
const QString &keyword)
{ {
activateHelpMode(); activateHelpMode();
m_centralWidget->showTopicChooser(urls, keyword); m_centralWidget->showTopicChooser(urls, keyword);
@@ -479,9 +506,11 @@ void HelpPlugin::extensionsInitialized()
bool needsSetup = false; bool needsSetup = false;
bool assistantInternalDocRegistered = false; bool assistantInternalDocRegistered = false;
foreach (QString ns, m_helpEngine->registeredDocumentations()) { const QString &docInternal = QString("com.nokia.qtcreator.%1%2")
if (ns == QString("com.nokia.qtcreator.%1%2") .arg(IDE_VERSION_MAJOR).arg(IDE_VERSION_MINOR);
.arg(IDE_VERSION_MAJOR).arg(IDE_VERSION_MINOR)) { const QStringList &docs = m_helpEngine->registeredDocumentations();
foreach (const QString &ns, docs) {
if (ns == docInternal) {
assistantInternalDocRegistered = true; assistantInternalDocRegistered = true;
break; break;
} }
@@ -500,21 +529,22 @@ void HelpPlugin::extensionsInitialized()
QHelpEngineCore hc(fi.absoluteFilePath()); QHelpEngineCore hc(fi.absoluteFilePath());
hc.setupData(); hc.setupData();
QString fileNamespace = QHelpEngineCore::namespaceName(qchFileName); QString fileNamespace = QHelpEngineCore::namespaceName(qchFileName);
if (!fileNamespace.isEmpty() && !hc.registeredDocumentations().contains(fileNamespace)) { if (!fileNamespace.isEmpty()
if (!hc.registerDocumentation(qchFileName)) && !hc.registeredDocumentations().contains(fileNamespace)) {
qDebug() << hc.error(); if (!hc.registerDocumentation(qchFileName))
needsSetup = true; qDebug() << hc.error();
needsSetup = true;
} }
} }
int i = m_helpEngine->customValue( QLatin1String key("UnfilteredFilterInserted");
QLatin1String("UnfilteredFilterInserted")).toInt(); int i = m_helpEngine->customValue(key).toInt();
if (i != 1) { if (i != 1) {
{ {
QHelpEngineCore hc(m_helpEngine->collectionFile()); QHelpEngineCore hc(m_helpEngine->collectionFile());
hc.setupData(); hc.setupData();
hc.addCustomFilter(tr("Unfiltered"), QStringList()); hc.addCustomFilter(tr("Unfiltered"), QStringList());
hc.setCustomValue(QLatin1String("UnfilteredFilterInserted"), 1); hc.setCustomValue(key, 1);
} }
m_helpEngine->blockSignals(true); m_helpEngine->blockSignals(true);
m_helpEngine->setCurrentFilter(tr("Unfiltered")); m_helpEngine->setCurrentFilter(tr("Unfiltered"));
@@ -528,9 +558,15 @@ void HelpPlugin::extensionsInitialized()
updateFilterComboBox(); updateFilterComboBox();
m_bookmarkManager->setupBookmarkModels(); m_bookmarkManager->setupBookmarkModels();
if (Core::Internal::WelcomeMode *welcomeMode = qobject_cast<Core::Internal::WelcomeMode*>(m_core->modeManager()->mode(Core::Constants::MODE_WELCOME))) { using namespace Core::Internal;
connect(welcomeMode, SIGNAL(openHelpPage(const QString&)), this, SLOT(openHelpPage(const QString&))); using namespace Core::Constants;
connect(welcomeMode, SIGNAL(openContextHelpPage(const QString&)), this, SLOT(openContextHelpPage(QString))); WelcomeMode *welcomeMode =
qobject_cast<WelcomeMode*>(m_core->modeManager()->mode(MODE_WELCOME));
if (welcomeMode) {
connect(welcomeMode, SIGNAL(openHelpPage(QString)), this,
SLOT(openHelpPage(QString)));
connect(welcomeMode, SIGNAL(openContextHelpPage(QString)), this,
SLOT(openContextHelpPage(QString)));
} }
} }
@@ -671,8 +707,8 @@ QToolBar *HelpPlugin::createToolBar()
layout->addWidget(new QLabel(tr("Filtered by:"))); layout->addWidget(new QLabel(tr("Filtered by:")));
m_filterComboBox = new QComboBox; m_filterComboBox = new QComboBox;
m_filterComboBox->setMinimumContentsLength(20); m_filterComboBox->setMinimumContentsLength(20);
connect(m_filterComboBox, SIGNAL(activated(const QString&)), connect(m_filterComboBox, SIGNAL(activated(QString)), this,
this, SLOT(filterDocumentation(const QString&))); SLOT(filterDocumentation(QString)));
layout->addWidget(m_filterComboBox); layout->addWidget(m_filterComboBox);
toolWidget->addWidget(w); toolWidget->addWidget(w);