forked from qt-creator/qt-creator
Make next/ previous button work for external help.
Task-number: QTCREATORBUG-2074
This commit is contained in:
@@ -83,14 +83,16 @@ ExternalHelpWindow::ExternalHelpWindow(QWidget *parent)
|
|||||||
connect(action, SIGNAL(triggered()), this, SIGNAL(activateOpenPages()));
|
connect(action, SIGNAL(triggered()), this, SIGNAL(activateOpenPages()));
|
||||||
addAction(action);
|
addAction(action);
|
||||||
|
|
||||||
|
CentralWidget *centralWidget = CentralWidget::instance();
|
||||||
|
|
||||||
action = new QAction(this);
|
action = new QAction(this);
|
||||||
action->setShortcut(QKeySequence(Qt::CTRL + Qt::Key_Plus));
|
action->setShortcut(QKeySequence(Qt::CTRL + Qt::Key_Plus));
|
||||||
connect(action, SIGNAL(triggered()), CentralWidget::instance(), SLOT(zoomIn()));
|
connect(action, SIGNAL(triggered()), centralWidget, SLOT(zoomIn()));
|
||||||
addAction(action);
|
addAction(action);
|
||||||
|
|
||||||
action = new QAction(this);
|
action = new QAction(this);
|
||||||
action->setShortcut(QKeySequence(Qt::CTRL + Qt::Key_Minus));
|
action->setShortcut(QKeySequence(Qt::CTRL + Qt::Key_Minus));
|
||||||
connect(action, SIGNAL(triggered()), CentralWidget::instance(), SLOT(zoomOut()));
|
connect(action, SIGNAL(triggered()), centralWidget, SLOT(zoomOut()));
|
||||||
addAction(action);
|
addAction(action);
|
||||||
|
|
||||||
action = new QAction(this);
|
action = new QAction(this);
|
||||||
@@ -100,16 +102,30 @@ ExternalHelpWindow::ExternalHelpWindow(QWidget *parent)
|
|||||||
|
|
||||||
action = new QAction(this);
|
action = new QAction(this);
|
||||||
action->setShortcut(QKeySequence(Qt::CTRL + Qt::Key_C));
|
action->setShortcut(QKeySequence(Qt::CTRL + Qt::Key_C));
|
||||||
connect(action, SIGNAL(triggered()), CentralWidget::instance(), SLOT(copy()));
|
connect(action, SIGNAL(triggered()), centralWidget, SLOT(copy()));
|
||||||
addAction(action);
|
addAction(action);
|
||||||
|
|
||||||
action = new QAction(this);
|
action = new QAction(this);
|
||||||
action->setShortcut(QKeySequence(Qt::CTRL + Qt::Key_P));
|
action->setShortcut(QKeySequence(Qt::CTRL + Qt::Key_P));
|
||||||
connect(action, SIGNAL(triggered()), CentralWidget::instance(), SLOT(print()));
|
connect(action, SIGNAL(triggered()), centralWidget, SLOT(print()));
|
||||||
addAction(action);
|
addAction(action);
|
||||||
|
|
||||||
|
action = new QAction(this);
|
||||||
|
action->setShortcut(QKeySequence::Back);
|
||||||
|
action->setEnabled(centralWidget->isBackwardAvailable());
|
||||||
|
connect(action, SIGNAL(triggered()), centralWidget, SLOT(backward()));
|
||||||
|
connect(centralWidget, SIGNAL(backwardAvailable(bool)), action,
|
||||||
|
SLOT(setEnabled(bool)));
|
||||||
|
|
||||||
|
action = new QAction(this);
|
||||||
|
action->setShortcut(QKeySequence::Forward);
|
||||||
|
action->setEnabled(centralWidget->isForwardAvailable());
|
||||||
|
connect(action, SIGNAL(triggered()), centralWidget, SLOT(forward()));
|
||||||
|
connect(centralWidget, SIGNAL(forwardAvailable(bool)), action,
|
||||||
|
SLOT(setEnabled(bool)));
|
||||||
|
|
||||||
QAction *reset = new QAction(this);
|
QAction *reset = new QAction(this);
|
||||||
connect(reset, SIGNAL(triggered()), CentralWidget::instance(), SLOT(resetZoom()));
|
connect(reset, SIGNAL(triggered()), centralWidget, SLOT(resetZoom()));
|
||||||
addAction(reset);
|
addAction(reset);
|
||||||
|
|
||||||
QAction *ctrlTab = new QAction(this);
|
QAction *ctrlTab = new QAction(this);
|
||||||
|
|||||||
@@ -303,12 +303,22 @@ bool HelpPlugin::initialize(const QStringList &arguments, QString *error)
|
|||||||
Aggregation::Aggregate *agg = new Aggregation::Aggregate;
|
Aggregation::Aggregate *agg = new Aggregation::Aggregate;
|
||||||
agg->add(m_centralWidget);
|
agg->add(m_centralWidget);
|
||||||
agg->add(new HelpFindSupport(m_centralWidget));
|
agg->add(new HelpFindSupport(m_centralWidget));
|
||||||
|
|
||||||
|
QWidget *toolBarWidget = new QWidget;
|
||||||
|
QHBoxLayout *toolBarLayout = new QHBoxLayout(toolBarWidget);
|
||||||
|
toolBarLayout->setMargin(0);
|
||||||
|
toolBarLayout->setSpacing(0);
|
||||||
|
toolBarLayout->addWidget(m_externalHelpBar = createIconToolBar(true));
|
||||||
|
toolBarLayout->addWidget(m_internalHelpBar = createIconToolBar(false));
|
||||||
|
m_externalHelpBar->setVisible(false);
|
||||||
|
toolBarLayout->addWidget(createWidgetToolBar());
|
||||||
|
|
||||||
QWidget *mainWidget = new QWidget;
|
QWidget *mainWidget = new QWidget;
|
||||||
m_splitter->addWidget(mainWidget);
|
m_splitter->addWidget(mainWidget);
|
||||||
QVBoxLayout *mainWidgetLayout = new QVBoxLayout(mainWidget);
|
QVBoxLayout *mainWidgetLayout = new QVBoxLayout(mainWidget);
|
||||||
mainWidgetLayout->setMargin(0);
|
mainWidgetLayout->setMargin(0);
|
||||||
mainWidgetLayout->setSpacing(0);
|
mainWidgetLayout->setSpacing(0);
|
||||||
mainWidgetLayout->addWidget(createToolBar());
|
mainWidgetLayout->addWidget(toolBarWidget);
|
||||||
mainWidgetLayout->addWidget(m_centralWidget);
|
mainWidgetLayout->addWidget(m_centralWidget);
|
||||||
|
|
||||||
if (QLayout *layout = m_centralWidget->layout()) {
|
if (QLayout *layout = m_centralWidget->layout()) {
|
||||||
@@ -623,6 +633,8 @@ void HelpPlugin::showExternalWindow()
|
|||||||
{
|
{
|
||||||
bool firstTime = m_firstModeChange;
|
bool firstTime = m_firstModeChange;
|
||||||
setup();
|
setup();
|
||||||
|
m_externalHelpBar->setVisible(true);
|
||||||
|
m_internalHelpBar->setVisible(false);
|
||||||
m_externalWindow->show();
|
m_externalWindow->show();
|
||||||
connectExternalHelpWindow();
|
connectExternalHelpWindow();
|
||||||
m_externalWindow->activateWindow();
|
m_externalWindow->activateWindow();
|
||||||
@@ -705,6 +717,8 @@ void HelpPlugin::contextHelpOptionChanged()
|
|||||||
|
|
||||||
slotHideRightPane();
|
slotHideRightPane();
|
||||||
m_mode->setEnabled(false);
|
m_mode->setEnabled(false);
|
||||||
|
m_externalHelpBar->setVisible(true);
|
||||||
|
m_internalHelpBar->setVisible(false);
|
||||||
m_externalWindow->show();
|
m_externalWindow->show();
|
||||||
connectExternalHelpWindow();
|
connectExternalHelpWindow();
|
||||||
|
|
||||||
@@ -729,6 +743,8 @@ void HelpPlugin::contextHelpOptionChanged()
|
|||||||
m_mode->setEnabled(true);
|
m_mode->setEnabled(true);
|
||||||
m_externalWindow->close();
|
m_externalWindow->close();
|
||||||
m_sideBar->setVisible(true);
|
m_sideBar->setVisible(true);
|
||||||
|
m_internalHelpBar->setVisible(true);
|
||||||
|
m_externalHelpBar->setVisible(false);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -865,41 +881,25 @@ void HelpPlugin::activateBookmarks()
|
|||||||
m_sideBar->activateItem(m_bookmarkItem);
|
m_sideBar->activateItem(m_bookmarkItem);
|
||||||
}
|
}
|
||||||
|
|
||||||
QToolBar *HelpPlugin::createToolBar()
|
QToolBar *HelpPlugin::createWidgetToolBar()
|
||||||
{
|
{
|
||||||
QToolBar *toolBar = new QToolBar;
|
QToolBar *toolBar = new QToolBar;
|
||||||
Core::ActionManager *am = m_core->actionManager();
|
toolBar->addWidget(OpenPagesManager::instance().openPagesComboBox());
|
||||||
toolBar->addAction(am->command(QLatin1String("Help.Home"))->action());
|
|
||||||
|
|
||||||
QAction *back = am->command(QLatin1String("Help.Previous"))->action();
|
toolBar->addWidget(new QLabel(tr("Filtered by:")));
|
||||||
QAction *next = am->command(QLatin1String("Help.Next"))->action();
|
|
||||||
setupNavigationMenus(back, next, toolBar);
|
|
||||||
toolBar->addAction(back);
|
|
||||||
toolBar->addAction(next);
|
|
||||||
|
|
||||||
toolBar->addSeparator();
|
|
||||||
toolBar->addAction(am->command(QLatin1String("Help.AddBookmark"))->action());
|
|
||||||
toolBar->setMovable(false);
|
|
||||||
|
|
||||||
toolBar->addSeparator();
|
|
||||||
|
|
||||||
QWidget *w = new QWidget;
|
|
||||||
toolBar->addWidget(w);
|
|
||||||
|
|
||||||
QHBoxLayout *layout = new QHBoxLayout(w);
|
|
||||||
layout->setMargin(0);
|
|
||||||
layout->addSpacing(10);
|
|
||||||
layout->addWidget(OpenPagesManager::instance().openPagesComboBox());
|
|
||||||
|
|
||||||
layout->addWidget(new QLabel(tr("Filtered by:")));
|
|
||||||
m_filterComboBox = new QComboBox;
|
m_filterComboBox = new QComboBox;
|
||||||
m_filterComboBox->setMinimumContentsLength(20);
|
m_filterComboBox->setMinimumContentsLength(20);
|
||||||
layout->addWidget(m_filterComboBox);
|
toolBar->addWidget(m_filterComboBox);
|
||||||
connect(m_filterComboBox, SIGNAL(activated(QString)), this,
|
connect(m_filterComboBox, SIGNAL(activated(QString)), this,
|
||||||
SLOT(filterDocumentation(QString)));
|
SLOT(filterDocumentation(QString)));
|
||||||
connect(m_filterComboBox, SIGNAL(currentIndexChanged(int)), this,
|
connect(m_filterComboBox, SIGNAL(currentIndexChanged(int)), this,
|
||||||
SLOT(updateSideBarSource()));
|
SLOT(updateSideBarSource()));
|
||||||
|
|
||||||
|
QWidget *dummy = new QWidget;
|
||||||
|
QHBoxLayout *layout = new QHBoxLayout(dummy);
|
||||||
|
layout->addStretch();
|
||||||
|
toolBar->addWidget(dummy);
|
||||||
|
|
||||||
m_closeButton = new QToolButton();
|
m_closeButton = new QToolButton();
|
||||||
m_closeButton->setIcon(QIcon(QLatin1String(Core::Constants::ICON_CLOSE)));
|
m_closeButton->setIcon(QIcon(QLatin1String(Core::Constants::ICON_CLOSE)));
|
||||||
m_closeButton->setToolTip(tr("Close current Page"));
|
m_closeButton->setToolTip(tr("Close current Page"));
|
||||||
@@ -907,8 +907,55 @@ QToolBar *HelpPlugin::createToolBar()
|
|||||||
SLOT(closeCurrentPage()));
|
SLOT(closeCurrentPage()));
|
||||||
connect(&OpenPagesManager::instance(), SIGNAL(pagesChanged()), this,
|
connect(&OpenPagesManager::instance(), SIGNAL(pagesChanged()), this,
|
||||||
SLOT(updateCloseButton()));
|
SLOT(updateCloseButton()));
|
||||||
layout->addStretch();
|
toolBar->addWidget(m_closeButton);
|
||||||
layout->addWidget(m_closeButton);
|
|
||||||
|
return toolBar;
|
||||||
|
}
|
||||||
|
|
||||||
|
QToolBar *HelpPlugin::createIconToolBar(bool external)
|
||||||
|
{
|
||||||
|
QToolBar *toolBar = new QToolBar;
|
||||||
|
|
||||||
|
QAction *home, *back, *next, *bookmark;
|
||||||
|
if (external) {
|
||||||
|
home = new QAction(QIcon(QLatin1String(IMAGEPATH "home.png")),
|
||||||
|
tr("Home"), toolBar);
|
||||||
|
connect(home, SIGNAL(triggered()), m_centralWidget, SLOT(home()));
|
||||||
|
|
||||||
|
back = new QAction(QIcon(QLatin1String(IMAGEPATH "previous.png")),
|
||||||
|
tr("Previous Page"), toolBar);
|
||||||
|
back->setEnabled(m_centralWidget->isBackwardAvailable());
|
||||||
|
connect(back, SIGNAL(triggered()), m_centralWidget, SLOT(backward()));
|
||||||
|
connect(m_centralWidget, SIGNAL(backwardAvailable(bool)), back,
|
||||||
|
SLOT(setEnabled(bool)));
|
||||||
|
|
||||||
|
next = new QAction(QIcon(QLatin1String(IMAGEPATH "next.png")),
|
||||||
|
tr("Next Page"), toolBar);
|
||||||
|
next->setEnabled(m_centralWidget->isForwardAvailable());
|
||||||
|
connect(next, SIGNAL(triggered()), m_centralWidget, SLOT(forward()));
|
||||||
|
connect(m_centralWidget, SIGNAL(forwardAvailable(bool)), next,
|
||||||
|
SLOT(setEnabled(bool)));
|
||||||
|
|
||||||
|
bookmark = new QAction(QIcon(QLatin1String(IMAGEPATH "bookmark.png")),
|
||||||
|
tr("Add Bookmark"), toolBar);
|
||||||
|
connect(bookmark, SIGNAL(triggered()), this, SLOT(addBookmark()));
|
||||||
|
} else {
|
||||||
|
Core::ActionManager *am = m_core->actionManager();
|
||||||
|
home = am->command(QLatin1String("Help.Home"))->action();
|
||||||
|
back = am->command(QLatin1String("Help.Previous"))->action();
|
||||||
|
next = am->command(QLatin1String("Help.Next"))->action();
|
||||||
|
bookmark = am->command(QLatin1String("Help.AddBookmark"))->action();
|
||||||
|
}
|
||||||
|
|
||||||
|
setupNavigationMenus(back, next, toolBar);
|
||||||
|
|
||||||
|
toolBar->addAction(home);
|
||||||
|
toolBar->addAction(back);
|
||||||
|
toolBar->addAction(next);
|
||||||
|
toolBar->addSeparator();
|
||||||
|
toolBar->addAction(bookmark);
|
||||||
|
toolBar->setMovable(false);
|
||||||
|
toolBar->addSeparator();
|
||||||
|
|
||||||
return toolBar;
|
return toolBar;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -114,7 +114,8 @@ private:
|
|||||||
void setupUi();
|
void setupUi();
|
||||||
void resetFilter();
|
void resetFilter();
|
||||||
void activateHelpMode();
|
void activateHelpMode();
|
||||||
QToolBar *createToolBar();
|
QToolBar *createWidgetToolBar();
|
||||||
|
QToolBar *createIconToolBar(bool external);
|
||||||
HelpViewer* viewerForContextMode();
|
HelpViewer* viewerForContextMode();
|
||||||
void createRightPaneContextViewer();
|
void createRightPaneContextViewer();
|
||||||
|
|
||||||
@@ -159,6 +160,8 @@ private:
|
|||||||
|
|
||||||
QMenu *m_backMenu;
|
QMenu *m_backMenu;
|
||||||
QMenu *m_nextMenu;
|
QMenu *m_nextMenu;
|
||||||
|
QToolBar *m_internalHelpBar;
|
||||||
|
QToolBar *m_externalHelpBar;
|
||||||
};
|
};
|
||||||
|
|
||||||
} // namespace Internal
|
} // namespace Internal
|
||||||
|
|||||||
Reference in New Issue
Block a user