Share code between "central" and other help viewers.

This removes a lot of duplication of actions and interaction.
It's also a preparation step into making the external help
window behave more like the full-fledged help mode.

Change-Id: I318d831f229b0a75bb8702a5f163c96cce6a668c
Reviewed-by: Eike Ziller <eike.ziller@digia.com>
This commit is contained in:
Eike Ziller
2014-09-25 16:29:56 +02:00
parent 85ac965116
commit a56432b3b1
11 changed files with 391 additions and 649 deletions

View File

@@ -173,7 +173,7 @@ void OpenPagesManager::setupInitialPages()
m_model->addPage(homePage);
for (int i = 0; i < m_model->rowCount(); ++i)
CentralWidget::instance()->addPage(m_model->pageAt(i));
CentralWidget::instance()->addViewer(m_model->pageAt(i));
emit pagesChanged();
setCurrentPage((initialPage >= m_model->rowCount())
@@ -202,7 +202,7 @@ HelpViewer *OpenPagesManager::createPage(const QUrl &url, bool fromSearch)
const int index = m_model->rowCount() - 1;
HelpViewer * const page = m_model->pageAt(index);
CentralWidget::instance()->addPage(page, fromSearch);
CentralWidget::instance()->addViewer(page, fromSearch);
emit pagesChanged();
setCurrentPage(index);
@@ -212,7 +212,7 @@ HelpViewer *OpenPagesManager::createPage(const QUrl &url, bool fromSearch)
void OpenPagesManager::setCurrentPage(int index)
{
CentralWidget::instance()->setCurrentPage(m_model->pageAt(index));
CentralWidget::instance()->setCurrentViewer(m_model->pageAt(index));
m_comboBox->setCurrentIndex(index);
if (m_openPagesWidget)
@@ -294,7 +294,7 @@ void OpenPagesManager::removePage(int index)
Q_ASSERT(m_model->rowCount() > 1);
m_model->removePage(index);
CentralWidget::instance()->removePage(index);
CentralWidget::instance()->removeViewerAt(index);
emit pagesChanged();
if (m_openPagesWidget)