forked from qt-creator/qt-creator
Help: Use ActionBuilder for part of the Help menu
Change-Id: I10ab89afc5005433395e5bf74a49979d90eb9e6c Reviewed-by: <github-actions-qt-creator@cristianadam.eu> Reviewed-by: Eike Ziller <eike.ziller@qt.io>
This commit is contained in:
@@ -212,42 +212,40 @@ HelpPluginPrivate::HelpPluginPrivate()
|
|||||||
ICore::removeAdditionalContext(Context(kToolTipHelpContext));
|
ICore::removeAdditionalContext(Context(kToolTipHelpContext));
|
||||||
});
|
});
|
||||||
|
|
||||||
Command *cmd;
|
|
||||||
QAction *action;
|
|
||||||
|
|
||||||
// Add Contents, Index, and Context menu items
|
// Add Contents, Index, and Context menu items
|
||||||
action = new QAction(QIcon::fromTheme("help-contents"), Tr::tr(Constants::SB_CONTENTS), this);
|
ActionBuilder helpContents(this, "Help.ContentsMenu");
|
||||||
cmd = ActionManager::registerAction(action, "Help.ContentsMenu");
|
helpContents.setText(Tr::tr(Constants::SB_CONTENTS));
|
||||||
ActionManager::actionContainer(Core::Constants::M_HELP)->addAction(cmd, Core::Constants::G_HELP_HELP);
|
helpContents.setIcon(QIcon::fromTheme("help-contents"));
|
||||||
connect(action, &QAction::triggered, this, &HelpPluginPrivate::activateContents);
|
helpContents.setContainer(Core::Constants::M_HELP, Core::Constants::G_HELP_HELP);
|
||||||
|
helpContents.setOnTriggered(this, &HelpPluginPrivate::activateContents);
|
||||||
|
|
||||||
action = new QAction(Tr::tr(Constants::SB_INDEX), this);
|
ActionBuilder helpIndex(this, "Help.IndexMenu");
|
||||||
cmd = ActionManager::registerAction(action, "Help.IndexMenu");
|
helpIndex.setText(Tr::tr(Constants::SB_INDEX));
|
||||||
ActionManager::actionContainer(Core::Constants::M_HELP)->addAction(cmd, Core::Constants::G_HELP_HELP);
|
helpIndex.setContainer(Core::Constants::M_HELP, Core::Constants::G_HELP_HELP);
|
||||||
connect(action, &QAction::triggered, this, &HelpPluginPrivate::activateIndex);
|
helpIndex.setOnTriggered(this, &HelpPluginPrivate::activateIndex);
|
||||||
|
|
||||||
|
ActionBuilder helpContext(this, Help::Constants::CONTEXT_HELP);
|
||||||
|
helpContext.setText(Tr::tr("Context Help"));
|
||||||
|
helpContext.setContext(Context(kToolTipHelpContext, Core::Constants::C_GLOBAL));
|
||||||
|
helpContext.setTouchBarIcon(Icons::MACOS_TOUCHBAR_HELP.icon());
|
||||||
|
helpContext.setContainer(Core::Constants::M_HELP, Core::Constants::G_HELP_HELP);
|
||||||
|
helpContext.setContainer(Core::Constants::TOUCH_BAR, Core::Constants::G_TOUCHBAR_HELP);
|
||||||
|
helpContext.setDefaultKeySequence(Qt::Key_F1);
|
||||||
|
helpContext.setOnTriggered(this, &HelpPluginPrivate::requestContextHelp);
|
||||||
|
|
||||||
action = new QAction(Tr::tr("Context Help"), this);
|
|
||||||
cmd = ActionManager::registerAction(action, Help::Constants::CONTEXT_HELP,
|
|
||||||
Context(kToolTipHelpContext, Core::Constants::C_GLOBAL));
|
|
||||||
cmd->setTouchBarIcon(Icons::MACOS_TOUCHBAR_HELP.icon());
|
|
||||||
ActionManager::actionContainer(Core::Constants::M_HELP)->addAction(cmd, Core::Constants::G_HELP_HELP);
|
|
||||||
ActionManager::actionContainer(Core::Constants::TOUCH_BAR)
|
|
||||||
->addAction(cmd, Core::Constants::G_TOUCHBAR_HELP);
|
|
||||||
cmd->setDefaultKeySequence(QKeySequence(Qt::Key_F1));
|
|
||||||
connect(action, &QAction::triggered, this, &HelpPluginPrivate::requestContextHelp);
|
|
||||||
ActionContainer *textEditorContextMenu = ActionManager::actionContainer(
|
ActionContainer *textEditorContextMenu = ActionManager::actionContainer(
|
||||||
TextEditor::Constants::M_STANDARDCONTEXTMENU);
|
TextEditor::Constants::M_STANDARDCONTEXTMENU);
|
||||||
if (textEditorContextMenu) {
|
if (textEditorContextMenu) {
|
||||||
textEditorContextMenu->insertGroup(TextEditor::Constants::G_BOM,
|
textEditorContextMenu->insertGroup(TextEditor::Constants::G_BOM,
|
||||||
Core::Constants::G_HELP);
|
Core::Constants::G_HELP);
|
||||||
textEditorContextMenu->addSeparator(Core::Constants::G_HELP);
|
textEditorContextMenu->addSeparator(Core::Constants::G_HELP);
|
||||||
textEditorContextMenu->addAction(cmd, Core::Constants::G_HELP);
|
helpContext.setContainer(TextEditor::Constants::M_STANDARDCONTEXTMENU, Core::Constants::G_HELP);
|
||||||
}
|
}
|
||||||
|
|
||||||
action = new QAction(Tr::tr("Technical Support..."), this);
|
ActionBuilder techSupport(this, "Help.TechSupport");
|
||||||
cmd = ActionManager::registerAction(action, "Help.TechSupport");
|
techSupport.setText(Tr::tr("Technical Support..."));
|
||||||
ActionManager::actionContainer(Core::Constants::M_HELP)->addAction(cmd, Core::Constants::G_HELP_SUPPORT);
|
techSupport.setContainer(Core::Constants::M_HELP, Core::Constants::G_HELP_SUPPORT);
|
||||||
connect(action, &QAction::triggered, this, [this] {
|
techSupport.setOnTriggered(this, [this] {
|
||||||
showHelpUrl(QUrl("qthelp://org.qt-project.qtcreator/doc/technical-support.html"),
|
showHelpUrl(QUrl("qthelp://org.qt-project.qtcreator/doc/technical-support.html"),
|
||||||
Core::HelpManager::HelpModeAlways);
|
Core::HelpManager::HelpModeAlways);
|
||||||
});
|
});
|
||||||
@@ -255,19 +253,19 @@ HelpPluginPrivate::HelpPluginPrivate()
|
|||||||
const Key qdsStandaloneEntry = "QML/Designer/StandAloneMode"; //entry from designer settings
|
const Key qdsStandaloneEntry = "QML/Designer/StandAloneMode"; //entry from designer settings
|
||||||
const bool isDesigner = Core::ICore::settings()->value(qdsStandaloneEntry, false).toBool();
|
const bool isDesigner = Core::ICore::settings()->value(qdsStandaloneEntry, false).toBool();
|
||||||
|
|
||||||
action = new QAction(Tr::tr("Report Bug..."), this);
|
ActionBuilder reportBug(this, "Help.ReportBug");
|
||||||
cmd = ActionManager::registerAction(action, "Help.ReportBug");
|
reportBug.setText(Tr::tr("Report Bug..."));
|
||||||
ActionManager::actionContainer(Core::Constants::M_HELP)->addAction(cmd, Core::Constants::G_HELP_SUPPORT);
|
reportBug.setContainer(Core::Constants::M_HELP, Core::Constants::G_HELP_SUPPORT);
|
||||||
connect(action, &QAction::triggered, this, [isDesigner] {
|
reportBug.setOnTriggered(this, [isDesigner] {
|
||||||
const QUrl bugreportUrl = isDesigner ? QString("https://bugreports.qt.io/secure/CreateIssue.jspa?pid=11740") //QDS
|
const QUrl bugreportUrl = isDesigner ? QString("https://bugreports.qt.io/secure/CreateIssue.jspa?pid=11740") //QDS
|
||||||
: QString("https://bugreports.qt.io/secure/CreateIssue.jspa?pid=10512"); //QtC
|
: QString("https://bugreports.qt.io/secure/CreateIssue.jspa?pid=10512"); //QtC
|
||||||
QDesktopServices::openUrl(bugreportUrl);
|
QDesktopServices::openUrl(bugreportUrl);
|
||||||
});
|
});
|
||||||
|
|
||||||
action = new QAction(Tr::tr("System Information..."), this);
|
ActionBuilder systemInformation(this, "Help.SystemInformation");
|
||||||
cmd = ActionManager::registerAction(action, "Help.SystemInformation");
|
systemInformation.setText(Tr::tr("System Information..."));
|
||||||
ActionManager::actionContainer(Core::Constants::M_HELP)->addAction(cmd, Core::Constants::G_HELP_SUPPORT);
|
systemInformation.setContainer(Core::Constants::M_HELP, Core::Constants::G_HELP_SUPPORT);
|
||||||
connect(action, &QAction::triggered, this, &HelpPluginPrivate::slotSystemInformation);
|
systemInformation.setOnTriggered(this, &HelpPluginPrivate::slotSystemInformation);
|
||||||
|
|
||||||
connect(ModeManager::instance(), &ModeManager::currentModeChanged,
|
connect(ModeManager::instance(), &ModeManager::currentModeChanged,
|
||||||
this, &HelpPluginPrivate::modeChanged);
|
this, &HelpPluginPrivate::modeChanged);
|
||||||
|
Reference in New Issue
Block a user