forked from qt-creator/qt-creator
Help: Remove unused "external" tool bar
Change-Id: Ib6c75c718c1217d8f7e645462e3acf161630bbab Reviewed-by: Eike Ziller <eike.ziller@digia.com>
This commit is contained in:
@@ -107,11 +107,15 @@ static const char kExternalWindowStateKey[] = "Help/ExternalWindowState";
|
|||||||
|
|
||||||
using namespace Core;
|
using namespace Core;
|
||||||
|
|
||||||
static QToolButton *toolButton(QAction *action)
|
static QToolButton *toolButton(Core::Command *cmd, QAction *action)
|
||||||
{
|
{
|
||||||
QToolButton *button = new QToolButton;
|
QToolButton *button = new QToolButton;
|
||||||
button->setDefaultAction(action);
|
button->setDefaultAction(action);
|
||||||
button->setPopupMode(QToolButton::DelayedPopup);
|
button->setPopupMode(QToolButton::DelayedPopup);
|
||||||
|
action->setToolTip(cmd->stringWithAppendedShortcut(action->text()));
|
||||||
|
QObject::connect(cmd, &Core::Command::keySequenceChanged, action, [cmd, action]() {
|
||||||
|
action->setToolTip(cmd->stringWithAppendedShortcut(action->text()));
|
||||||
|
});
|
||||||
return button;
|
return button;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -189,38 +193,52 @@ bool HelpPlugin::initialize(const QStringList &arguments, QString *error)
|
|||||||
connect(HelpManager::instance(), SIGNAL(setupFinished()), this,
|
connect(HelpManager::instance(), SIGNAL(setupFinished()), this,
|
||||||
SLOT(unregisterOldQtCreatorDocumentation()));
|
SLOT(unregisterOldQtCreatorDocumentation()));
|
||||||
|
|
||||||
|
auto helpButtonBar = new Utils::StyledBar;
|
||||||
|
auto helpButtonLayout = new QHBoxLayout(helpButtonBar);
|
||||||
|
helpButtonLayout->setMargin(0);
|
||||||
|
helpButtonLayout->setSpacing(0);
|
||||||
|
|
||||||
m_splitter = new MiniSplitter;
|
m_splitter = new MiniSplitter;
|
||||||
|
Command *cmd;
|
||||||
m_centralWidget = new Help::Internal::CentralWidget();
|
m_centralWidget = new Help::Internal::CentralWidget();
|
||||||
connect(m_centralWidget, SIGNAL(sourceChanged(QUrl)), this,
|
connect(m_centralWidget, SIGNAL(sourceChanged(QUrl)), this,
|
||||||
SLOT(updateSideBarSource(QUrl)));
|
SLOT(updateSideBarSource(QUrl)));
|
||||||
// Add Home, Previous and Next actions (used in the toolbar)
|
// Add Home, Previous and Next actions (used in the toolbar)
|
||||||
QAction *action = new QAction(QIcon(QLatin1String(IMAGEPATH "home.png")),
|
QAction *action = new QAction(QIcon(QLatin1String(IMAGEPATH "home.png")),
|
||||||
tr("Home"), this);
|
tr("Home"), this);
|
||||||
ActionManager::registerAction(action, "Help.Home", globalcontext);
|
cmd = ActionManager::registerAction(action, "Help.Home", globalcontext);
|
||||||
connect(action, SIGNAL(triggered()), m_centralWidget, SLOT(home()));
|
connect(action, SIGNAL(triggered()), m_centralWidget, SLOT(home()));
|
||||||
|
helpButtonLayout->addWidget(toolButton(cmd, action));
|
||||||
|
|
||||||
action = new QAction(QIcon(QLatin1String(IMAGEPATH "previous.png")),
|
QAction *back = new QAction(QIcon(QLatin1String(IMAGEPATH "previous.png")),
|
||||||
tr("Previous Page"), this);
|
tr("Previous Page"), this);
|
||||||
Command *cmd = ActionManager::registerAction(action, "Help.Previous", modecontext);
|
cmd = ActionManager::registerAction(back, "Help.Previous", modecontext);
|
||||||
cmd->setDefaultKeySequence(QKeySequence::Back);
|
cmd->setDefaultKeySequence(QKeySequence::Back);
|
||||||
action->setEnabled(m_centralWidget->isBackwardAvailable());
|
back->setEnabled(m_centralWidget->isBackwardAvailable());
|
||||||
connect(action, SIGNAL(triggered()), m_centralWidget, SLOT(backward()));
|
connect(back, SIGNAL(triggered()), m_centralWidget, SLOT(backward()));
|
||||||
connect(m_centralWidget, SIGNAL(backwardAvailable(bool)), action,
|
connect(m_centralWidget, SIGNAL(backwardAvailable(bool)), back,
|
||||||
SLOT(setEnabled(bool)));
|
SLOT(setEnabled(bool)));
|
||||||
|
helpButtonLayout->addWidget(toolButton(cmd, back));
|
||||||
|
|
||||||
action = new QAction(QIcon(QLatin1String(IMAGEPATH "next.png")), tr("Next Page"), this);
|
QAction *next = new QAction(QIcon(QLatin1String(IMAGEPATH "next.png")), tr("Next Page"), this);
|
||||||
cmd = ActionManager::registerAction(action, "Help.Next", modecontext);
|
cmd = ActionManager::registerAction(next, "Help.Next", modecontext);
|
||||||
cmd->setDefaultKeySequence(QKeySequence::Forward);
|
cmd->setDefaultKeySequence(QKeySequence::Forward);
|
||||||
action->setEnabled(m_centralWidget->isForwardAvailable());
|
next->setEnabled(m_centralWidget->isForwardAvailable());
|
||||||
connect(action, SIGNAL(triggered()), m_centralWidget, SLOT(forward()));
|
connect(next, SIGNAL(triggered()), m_centralWidget, SLOT(forward()));
|
||||||
connect(m_centralWidget, SIGNAL(forwardAvailable(bool)), action,
|
connect(m_centralWidget, SIGNAL(forwardAvailable(bool)), next,
|
||||||
SLOT(setEnabled(bool)));
|
SLOT(setEnabled(bool)));
|
||||||
|
helpButtonLayout->addWidget(toolButton(cmd, next));
|
||||||
|
helpButtonLayout->addWidget(new Utils::StyledSeparator(helpButtonBar));
|
||||||
|
|
||||||
|
setupNavigationMenus(back, next, helpButtonBar);
|
||||||
|
|
||||||
action = new QAction(QIcon(QLatin1String(IMAGEPATH "bookmark.png")),
|
action = new QAction(QIcon(QLatin1String(IMAGEPATH "bookmark.png")),
|
||||||
tr("Add Bookmark"), this);
|
tr("Add Bookmark"), this);
|
||||||
cmd = ActionManager::registerAction(action, "Help.AddBookmark", modecontext);
|
cmd = ActionManager::registerAction(action, "Help.AddBookmark", modecontext);
|
||||||
cmd->setDefaultKeySequence(QKeySequence(UseMacShortcuts ? tr("Meta+M") : tr("Ctrl+M")));
|
cmd->setDefaultKeySequence(QKeySequence(UseMacShortcuts ? tr("Meta+M") : tr("Ctrl+M")));
|
||||||
connect(action, SIGNAL(triggered()), this, SLOT(addBookmark()));
|
connect(action, SIGNAL(triggered()), this, SLOT(addBookmark()));
|
||||||
|
helpButtonLayout->addWidget(toolButton(cmd, action));
|
||||||
|
helpButtonLayout->addWidget(new Utils::StyledSeparator(helpButtonBar));
|
||||||
|
|
||||||
// Add Contents, Index, and Context menu items
|
// Add Contents, Index, and Context menu items
|
||||||
action = new QAction(QIcon::fromTheme(QLatin1String("help-contents")),
|
action = new QAction(QIcon::fromTheme(QLatin1String("help-contents")),
|
||||||
@@ -301,8 +319,7 @@ bool HelpPlugin::initialize(const QStringList &arguments, QString *error)
|
|||||||
QHBoxLayout *toolBarLayout = new QHBoxLayout(toolBarWidget);
|
QHBoxLayout *toolBarLayout = new QHBoxLayout(toolBarWidget);
|
||||||
toolBarLayout->setMargin(0);
|
toolBarLayout->setMargin(0);
|
||||||
toolBarLayout->setSpacing(0);
|
toolBarLayout->setSpacing(0);
|
||||||
toolBarLayout->addWidget(m_externalHelpBar = createIconToolBar(true));
|
toolBarLayout->addWidget(helpButtonBar);
|
||||||
toolBarLayout->addWidget(m_internalHelpBar = createIconToolBar(false));
|
|
||||||
toolBarLayout->addWidget(createWidgetToolBar());
|
toolBarLayout->addWidget(createWidgetToolBar());
|
||||||
|
|
||||||
QWidget *mainWidget = new QWidget;
|
QWidget *mainWidget = new QWidget;
|
||||||
@@ -336,7 +353,6 @@ bool HelpPlugin::initialize(const QStringList &arguments, QString *error)
|
|||||||
|
|
||||||
m_mode = new HelpMode;
|
m_mode = new HelpMode;
|
||||||
m_mode->setWidget(m_splitter);
|
m_mode->setWidget(m_splitter);
|
||||||
m_internalHelpBar->setVisible(true);
|
|
||||||
addAutoReleasedObject(m_mode);
|
addAutoReleasedObject(m_mode);
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
@@ -866,56 +882,6 @@ Utils::StyledBar *HelpPlugin::createWidgetToolBar()
|
|||||||
return toolBar;
|
return toolBar;
|
||||||
}
|
}
|
||||||
|
|
||||||
Utils::StyledBar *HelpPlugin::createIconToolBar(bool external)
|
|
||||||
{
|
|
||||||
Utils::StyledBar *toolBar = new Utils::StyledBar;
|
|
||||||
toolBar->setVisible(false);
|
|
||||||
|
|
||||||
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 {
|
|
||||||
home = Core::ActionManager::command("Help.Home")->action();
|
|
||||||
back = Core::ActionManager::command("Help.Previous")->action();
|
|
||||||
next = Core::ActionManager::command("Help.Next")->action();
|
|
||||||
bookmark = Core::ActionManager::command("Help.AddBookmark")->action();
|
|
||||||
}
|
|
||||||
|
|
||||||
setupNavigationMenus(back, next, toolBar);
|
|
||||||
|
|
||||||
QHBoxLayout *layout = new QHBoxLayout(toolBar);
|
|
||||||
layout->setMargin(0);
|
|
||||||
layout->setSpacing(0);
|
|
||||||
layout->addWidget(toolButton(home));
|
|
||||||
layout->addWidget(toolButton(back));
|
|
||||||
layout->addWidget(toolButton(next));
|
|
||||||
layout->addWidget(new Utils::StyledSeparator(toolBar));
|
|
||||||
layout->addWidget(toolButton(bookmark));
|
|
||||||
layout->addWidget(new Utils::StyledSeparator(toolBar));
|
|
||||||
|
|
||||||
return toolBar;
|
|
||||||
}
|
|
||||||
|
|
||||||
void HelpPlugin::updateFilterComboBox()
|
void HelpPlugin::updateFilterComboBox()
|
||||||
{
|
{
|
||||||
const QHelpEngine &engine = LocalHelpManager::helpEngine();
|
const QHelpEngine &engine = LocalHelpManager::helpEngine();
|
||||||
|
|||||||
@@ -128,7 +128,6 @@ private:
|
|||||||
void resetFilter();
|
void resetFilter();
|
||||||
void activateHelpMode();
|
void activateHelpMode();
|
||||||
Utils::StyledBar *createWidgetToolBar();
|
Utils::StyledBar *createWidgetToolBar();
|
||||||
Utils::StyledBar *createIconToolBar(bool external);
|
|
||||||
bool canShowHelpSideBySide() const;
|
bool canShowHelpSideBySide() const;
|
||||||
HelpViewer *viewerForHelpViewerLocation(Core::HelpManager::HelpViewerLocation location);
|
HelpViewer *viewerForHelpViewerLocation(Core::HelpManager::HelpViewerLocation location);
|
||||||
HelpViewer *viewerForContextHelp();
|
HelpViewer *viewerForContextHelp();
|
||||||
@@ -173,8 +172,6 @@ private:
|
|||||||
|
|
||||||
QMenu *m_backMenu;
|
QMenu *m_backMenu;
|
||||||
QMenu *m_nextMenu;
|
QMenu *m_nextMenu;
|
||||||
Utils::StyledBar *m_internalHelpBar;
|
|
||||||
Utils::StyledBar *m_externalHelpBar;
|
|
||||||
|
|
||||||
bool m_isSidebarVisible;
|
bool m_isSidebarVisible;
|
||||||
QAction *m_toggleSideBarAction;
|
QAction *m_toggleSideBarAction;
|
||||||
|
|||||||
Reference in New Issue
Block a user