diff options
author | Eike Ziller <eike.ziller@qt.io> | 2022-07-11 13:30:24 +0200 |
---|---|---|
committer | Eike Ziller <eike.ziller@qt.io> | 2022-07-13 12:30:46 +0000 |
commit | e2d5936a76dfe40e0e372022cc4c86c3cb2ac1aa (patch) | |
tree | a49bb5983ff52f036e5a414d276948274fd81bac /src/plugins/help | |
parent | d262e665ca5aee9b1001dae4ae0c9a9b9d0e49a3 (diff) | |
download | qt-creator-e2d5936a76dfe40e0e372022cc4c86c3cb2ac1aa.tar.gz |
Help: Convert to Tr::tr
Change-Id: I3f9ca195488f7cc90e7f58eb15263dde1bc911c4
Reviewed-by: hjk <hjk@qt.io>
Diffstat (limited to 'src/plugins/help')
-rw-r--r-- | src/plugins/help/docsettingspage.cpp | 33 | ||||
-rw-r--r-- | src/plugins/help/filtersettingspage.cpp | 3 | ||||
-rw-r--r-- | src/plugins/help/generalsettingspage.cpp | 116 | ||||
-rw-r--r-- | src/plugins/help/helpconstants.h | 14 | ||||
-rw-r--r-- | src/plugins/help/helpindexfilter.cpp | 3 | ||||
-rw-r--r-- | src/plugins/help/helpmanager.cpp | 4 | ||||
-rw-r--r-- | src/plugins/help/helpmode.cpp | 3 | ||||
-rw-r--r-- | src/plugins/help/helpplugin.cpp | 25 | ||||
-rw-r--r-- | src/plugins/help/helpviewer.cpp | 6 | ||||
-rw-r--r-- | src/plugins/help/helpwidget.cpp | 88 | ||||
-rw-r--r-- | src/plugins/help/litehtmlhelpviewer.cpp | 11 | ||||
-rw-r--r-- | src/plugins/help/localhelpmanager.cpp | 25 | ||||
-rw-r--r-- | src/plugins/help/macwebkithelpviewer.mm | 13 | ||||
-rw-r--r-- | src/plugins/help/openpagesmanager.cpp | 3 | ||||
-rw-r--r-- | src/plugins/help/openpageswidget.cpp | 7 | ||||
-rw-r--r-- | src/plugins/help/searchtaskhandler.cpp | 4 | ||||
-rw-r--r-- | src/plugins/help/searchwidget.cpp | 26 | ||||
-rw-r--r-- | src/plugins/help/textbrowserhelpviewer.cpp | 11 | ||||
-rw-r--r-- | src/plugins/help/webenginehelpviewer.cpp | 9 | ||||
-rw-r--r-- | src/plugins/help/xbelsupport.cpp | 6 |
20 files changed, 205 insertions, 205 deletions
diff --git a/src/plugins/help/docsettingspage.cpp b/src/plugins/help/docsettingspage.cpp index 269b23f068..d71ee93c33 100644 --- a/src/plugins/help/docsettingspage.cpp +++ b/src/plugins/help/docsettingspage.cpp @@ -27,6 +27,7 @@ #include "helpconstants.h" #include "helpmanager.h" +#include "helptr.h" #include <coreplugin/icore.h> #include <utils/algorithm.h> @@ -89,8 +90,6 @@ private: class DocSettingsPageWidget : public Core::IOptionsPageWidget { - Q_DECLARE_TR_FUNCTIONS(Help::DocSettingsPageWidget) - public: DocSettingsPageWidget(); @@ -119,8 +118,7 @@ private: static DocEntry createEntry(const QString &nameSpace, const QString &fileName, bool userManaged) { DocEntry result; - result.name = userManaged ? nameSpace - : DocSettingsPageWidget::tr("%1 (auto-detected)").arg(nameSpace); + result.name = userManaged ? nameSpace : Tr::tr("%1 (auto-detected)").arg(nameSpace); result.fileName = fileName; result.nameSpace = nameSpace; return result; @@ -196,13 +194,10 @@ DocSettingsPageWidget::DocSettingsPageWidget() setLayout(new QVBoxLayout); layout()->addWidget(groupBox); - setToolTip(QCoreApplication::translate("Help::Internal::DocSettingsPage", - "Add and remove compressed help files, .qch.", - nullptr)); - groupBox->setTitle( - QCoreApplication::translate("Help::Internal::DocSettingsPage", "Registered Documentation")); - addButton->setText(QCoreApplication::translate("Help::Internal::DocSettingsPage", "Add...")); - removeButton->setText(QCoreApplication::translate("Help::Internal::DocSettingsPage", "Remove")); + setToolTip(Tr::tr("Add and remove compressed help files, .qch.")); + groupBox->setTitle(Tr::tr("Registered Documentation")); + addButton->setText(Tr::tr("Add...")); + removeButton->setText(Tr::tr("Remove")); const QStringList nameSpaces = HelpManager::registeredNamespaces(); const QSet<QString> userDocumentationPaths = HelpManager::userDocumentationPaths(); @@ -238,9 +233,9 @@ DocSettingsPageWidget::DocSettingsPageWidget() void DocSettingsPageWidget::addDocumentation() { const FilePaths files = FileUtils::getOpenFilePaths(Core::ICore::dialogParent(), - tr("Add Documentation"), + Tr::tr("Add Documentation"), m_recentDialogPath, - tr("Qt Help Files (*.qch)")); + Tr::tr("Qt Help Files (*.qch)")); if (files.isEmpty()) return; @@ -284,7 +279,8 @@ void DocSettingsPageWidget::addDocumentation() QString formatedFail; if (docsUnableToRegister.contains("UnknownNamespace")) { - formatedFail += QString::fromLatin1("<ul><li><b>%1</b>").arg(tr("Invalid documentation file:")); + formatedFail += QString::fromLatin1("<ul><li><b>%1</b>") + .arg(Tr::tr("Invalid documentation file:")); foreach (const QString &value, docsUnableToRegister.values("UnknownNamespace")) formatedFail += QString::fromLatin1("<ul><li>%2</li></ul>").arg(value); formatedFail += "</li></ul>"; @@ -292,7 +288,8 @@ void DocSettingsPageWidget::addDocumentation() } if (!docsUnableToRegister.isEmpty()) { - formatedFail += QString::fromLatin1("<ul><li><b>%1</b>").arg(tr("Namespace already registered:")); + formatedFail += QString::fromLatin1("<ul><li><b>%1</b>") + .arg(Tr::tr("Namespace already registered:")); const NameSpaceToPathHash::ConstIterator cend = docsUnableToRegister.constEnd(); for (NameSpaceToPathHash::ConstIterator it = docsUnableToRegister.constBegin(); it != cend; ++it) { formatedFail += QString::fromLatin1("<ul><li>%1 - %2</li></ul>").arg(it.key(), it.value()); @@ -302,8 +299,8 @@ void DocSettingsPageWidget::addDocumentation() if (!formatedFail.isEmpty()) { QMessageBox::information(Core::ICore::dialogParent(), - tr("Registration Failed"), - tr("Unable to register documentation.") + formatedFail, + Tr::tr("Registration Failed"), + Tr::tr("Unable to register documentation.") + formatedFail, QMessageBox::Ok); } } @@ -378,7 +375,7 @@ QList<QModelIndex> DocSettingsPageWidget::currentSelection() const DocSettingsPage::DocSettingsPage() { setId("B.Documentation"); - setDisplayName(DocSettingsPageWidget::tr("Documentation")); + setDisplayName(Tr::tr("Documentation")); setCategory(Help::Constants::HELP_CATEGORY); setWidgetCreator([] { return new DocSettingsPageWidget; }); } diff --git a/src/plugins/help/filtersettingspage.cpp b/src/plugins/help/filtersettingspage.cpp index ea4cfb037d..23dd1e22ec 100644 --- a/src/plugins/help/filtersettingspage.cpp +++ b/src/plugins/help/filtersettingspage.cpp @@ -25,6 +25,7 @@ #include "filtersettingspage.h" #include "helpconstants.h" +#include "helptr.h" #include <QtCore/QVersionNumber> #include <QtHelp/QHelpFilterEngine> @@ -36,7 +37,7 @@ using namespace Help::Internal; FilterSettingsPage::FilterSettingsPage() { setId("D.Filters"); - setDisplayName(tr("Filters")); + setDisplayName(Tr::tr("Filters")); setCategory(Help::Constants::HELP_CATEGORY); } diff --git a/src/plugins/help/generalsettingspage.cpp b/src/plugins/help/generalsettingspage.cpp index 3d7068b9a4..f6d2284a5f 100644 --- a/src/plugins/help/generalsettingspage.cpp +++ b/src/plugins/help/generalsettingspage.cpp @@ -27,6 +27,7 @@ #include "helpconstants.h" #include "helpplugin.h" +#include "helptr.h" #include "helpviewer.h" #include "helpwidget.h" #include "localhelpmanager.h" @@ -88,17 +89,13 @@ public: GeneralSettingsPageWidget::GeneralSettingsPageWidget() { // font group box - auto fontGroupBox = new QGroupBox( - QCoreApplication::translate("Help::Internal::GeneralSettingsPage", "Font")); - auto familyLabel = new QLabel( - QCoreApplication::translate("Help::Internal::GeneralSettingsPage", "Family:")); + auto fontGroupBox = new QGroupBox(Tr::tr("Font")); + auto familyLabel = new QLabel(Tr::tr("Family:")); familyComboBox = new QFontComboBox; - auto styleLabel = new QLabel( - QCoreApplication::translate("Help::Internal::GeneralSettingsPage", "Style:")); + auto styleLabel = new QLabel(Tr::tr("Style:")); styleComboBox = new QComboBox; - auto sizeLabel = new QLabel( - QCoreApplication::translate("Help::Internal::GeneralSettingsPage", "Size:")); + auto sizeLabel = new QLabel(Tr::tr("Size:")); sizeComboBox = new QComboBox; auto fontLayout = new QHBoxLayout(); @@ -111,19 +108,17 @@ GeneralSettingsPageWidget::GeneralSettingsPageWidget() fontLayout->addWidget(sizeComboBox); fontLayout->addStretch(); - auto noteLabel = new QLabel(QCoreApplication::translate( - "Help::Internal::GeneralSettingsPage", + auto noteLabel = new QLabel(Tr::tr( "Note: The above setting takes effect only if the HTML file does not use a style sheet.")); noteLabel->setWordWrap(true); - auto zoomLabel = new QLabel( - QCoreApplication::translate("Help::Internal::GeneralSettingsPage", "Zoom:")); + auto zoomLabel = new QLabel(Tr::tr("Zoom:")); zoomSpinBox = new QSpinBox; zoomSpinBox->setMinimum(10); zoomSpinBox->setMaximum(3000); zoomSpinBox->setSingleStep(10); zoomSpinBox->setValue(100); - zoomSpinBox->setSuffix(QCoreApplication::translate("Help::Internal::GeneralSettingsPage", "%")); + zoomSpinBox->setSuffix(Tr::tr("%")); auto zoomLayout = new QHBoxLayout(); zoomLayout->addWidget(zoomSpinBox); @@ -138,46 +133,30 @@ GeneralSettingsPageWidget::GeneralSettingsPageWidget() fontGroupBoxLayout->addLayout(zoomLayout, 2, 1); // startup group box - auto startupGroupBox = new QGroupBox( - QCoreApplication::translate("Help::Internal::GeneralSettingsPage", "Startup")); + auto startupGroupBox = new QGroupBox(Tr::tr("Startup")); contextHelpComboBox = new QComboBox(startupGroupBox); - contextHelpComboBox->addItem(QCoreApplication::translate("Help::Internal::GeneralSettingsPage", - "Show Side-by-Side if Possible")); - contextHelpComboBox->addItem(QCoreApplication::translate("Help::Internal::GeneralSettingsPage", - "Always Show Side-by-Side")); - contextHelpComboBox->addItem(QCoreApplication::translate("Help::Internal::GeneralSettingsPage", - "Always Show in Help Mode")); - contextHelpComboBox->addItem(QCoreApplication::translate("Help::Internal::GeneralSettingsPage", - "Always Show in External Window")); + contextHelpComboBox->addItem(Tr::tr("Show Side-by-Side if Possible")); + contextHelpComboBox->addItem(Tr::tr("Always Show Side-by-Side")); + contextHelpComboBox->addItem(Tr::tr("Always Show in Help Mode")); + contextHelpComboBox->addItem(Tr::tr("Always Show in External Window")); helpStartComboBox = new QComboBox(startupGroupBox); - helpStartComboBox->addItem( - QCoreApplication::translate("Help::Internal::GeneralSettingsPage", "Show My Home Page")); - helpStartComboBox->addItem( - QCoreApplication::translate("Help::Internal::GeneralSettingsPage", "Show a Blank Page")); - helpStartComboBox->addItem(QCoreApplication::translate("Help::Internal::GeneralSettingsPage", - "Show My Tabs from Last Session")); + helpStartComboBox->addItem(Tr::tr("Show My Home Page")); + helpStartComboBox->addItem(Tr::tr("Show a Blank Page")); + helpStartComboBox->addItem(Tr::tr("Show My Tabs from Last Session")); auto startupFormLayout = new QFormLayout; startupGroupBox->setLayout(startupFormLayout); startupFormLayout->setFieldGrowthPolicy(QFormLayout::ExpandingFieldsGrow); - startupFormLayout->addRow(QCoreApplication::translate("Help::Internal::GeneralSettingsPage", - "On context help:"), - contextHelpComboBox); - startupFormLayout->addRow(QCoreApplication::translate("Help::Internal::GeneralSettingsPage", - "On help start:"), - helpStartComboBox); + startupFormLayout->addRow(Tr::tr("On context help:"), contextHelpComboBox); + startupFormLayout->addRow(Tr::tr("On help start:"), helpStartComboBox); homePageLineEdit = new QLineEdit; - currentPageButton = new QPushButton( - QCoreApplication::translate("Help::Internal::GeneralSettingsPage", "Use &Current Page")); - blankPageButton = new QPushButton( - QCoreApplication::translate("Help::Internal::GeneralSettingsPage", "Use &Blank Page")); - defaultPageButton = new QPushButton( - QCoreApplication::translate("Help::Internal::GeneralSettingsPage", "Reset")); - defaultPageButton->setToolTip( - QCoreApplication::translate("Help::Internal::GeneralSettingsPage", "Reset to default.")); + currentPageButton = new QPushButton(Tr::tr("Use &Current Page")); + blankPageButton = new QPushButton(Tr::tr("Use &Blank Page")); + defaultPageButton = new QPushButton(Tr::tr("Reset")); + defaultPageButton->setToolTip(Tr::tr("Reset to default.")); auto homePageLayout = new QHBoxLayout; homePageLayout->addWidget(homePageLineEdit); @@ -185,29 +164,19 @@ GeneralSettingsPageWidget::GeneralSettingsPageWidget() homePageLayout->addWidget(blankPageButton); homePageLayout->addWidget(defaultPageButton); - startupFormLayout->addRow(QCoreApplication::translate("Help::Internal::GeneralSettingsPage", - "Home page:"), - homePageLayout); + startupFormLayout->addRow(Tr::tr("Home page:"), homePageLayout); // behavior group box - auto behaviourGroupBox = new QGroupBox( - QCoreApplication::translate("Help::Internal::GeneralSettingsPage", "Behaviour")); - scrollWheelZooming = new QCheckBox( - QCoreApplication::translate("Help::Internal::GeneralSettingsPage", - "Enable scroll wheel zooming")); - - m_returnOnClose = new QCheckBox( - QCoreApplication::translate("Help::Internal::GeneralSettingsPage", - "Return to editor on closing the last page")); + auto behaviourGroupBox = new QGroupBox(Tr::tr("Behaviour")); + scrollWheelZooming = new QCheckBox(Tr::tr("Enable scroll wheel zooming")); + + m_returnOnClose = new QCheckBox(Tr::tr("Return to editor on closing the last page")); m_returnOnClose->setToolTip( - QCoreApplication::translate("Help::Internal::GeneralSettingsPage", - "Switches to editor context after last help page is closed.")); + Tr::tr("Switches to editor context after last help page is closed.")); - auto viewerBackendLabel = new QLabel( - QCoreApplication::translate("Help::Internal::GeneralSettingsPage", "Viewer backend:")); + auto viewerBackendLabel = new QLabel(Tr::tr("Viewer backend:")); viewerBackend = new QComboBox; - const QString description = GeneralSettingsPage::tr( - "Change takes effect after reloading help pages."); + const QString description = Tr::tr("Change takes effect after reloading help pages."); auto viewerBackendDescription = new QLabel(description); viewerBackendLabel->setToolTip(description); viewerBackend->setToolTip(description); @@ -236,10 +205,8 @@ GeneralSettingsPageWidget::GeneralSettingsPageWidget() palette.setBrush(QPalette::Disabled, QPalette::Text, brush1); errorLabel->setPalette(palette); - importButton = new QPushButton( - QCoreApplication::translate("Help::Internal::GeneralSettingsPage", "Import Bookmarks...")); - exportButton = new QPushButton( - QCoreApplication::translate("Help::Internal::GeneralSettingsPage", "Export Bookmarks...")); + importButton = new QPushButton(Tr::tr("Import Bookmarks...")); + exportButton = new QPushButton(Tr::tr("Export Bookmarks...")); auto bookmarksLayout = new QHBoxLayout(); bookmarksLayout->addStretch(); @@ -259,9 +226,9 @@ GeneralSettingsPageWidget::GeneralSettingsPageWidget() GeneralSettingsPage::GeneralSettingsPage() { setId("A.General settings"); - setDisplayName(tr("General")); + setDisplayName(Tr::tr("General")); setCategory(Help::Constants::HELP_CATEGORY); - setDisplayCategory(QCoreApplication::translate("Help", "Help")); + setDisplayCategory(Tr::tr("Help")); setCategoryIconPath(":/help/images/settingscategory_help.png"); } @@ -332,8 +299,9 @@ QWidget *GeneralSettingsPage::widget() m_scrollWheelZoomingEnabled = LocalHelpManager::isScrollWheelZoomingEnabled(); m_widget->scrollWheelZooming->setChecked(m_scrollWheelZoomingEnabled); - m_widget->viewerBackend->addItem(tr("Default (%1)", "Default viewer backend") - .arg(LocalHelpManager::defaultViewerBackend().displayName)); + m_widget->viewerBackend->addItem( + Tr::tr("Default (%1)", "Default viewer backend") + .arg(LocalHelpManager::defaultViewerBackend().displayName)); const QByteArray currentBackend = LocalHelpManager::viewerBackendId(); const QVector<HelpViewerFactory> backends = LocalHelpManager::viewerBackends(); for (const HelpViewerFactory &f : backends) { @@ -417,7 +385,9 @@ void GeneralSettingsPage::importBookmarks() m_widget->errorLabel->setVisible(false); FilePath filePath = FileUtils::getOpenFilePath(nullptr, - tr("Import Bookmarks"), FilePath::fromString(QDir::currentPath()), tr("Files (*.xbel)")); + Tr::tr("Import Bookmarks"), + FilePath::fromString(QDir::currentPath()), + Tr::tr("Files (*.xbel)")); if (filePath.isEmpty()) return; @@ -431,7 +401,7 @@ void GeneralSettingsPage::importBookmarks() } m_widget->errorLabel->setVisible(true); - m_widget->errorLabel->setText(tr("Cannot import bookmarks.")); + m_widget->errorLabel->setText(Tr::tr("Cannot import bookmarks.")); } void GeneralSettingsPage::exportBookmarks() @@ -439,7 +409,9 @@ void GeneralSettingsPage::exportBookmarks() m_widget->errorLabel->setVisible(false); FilePath filePath = FileUtils::getSaveFilePath(nullptr, - tr("Save File"), "untitled.xbel", tr("Files (*.xbel)")); + Tr::tr("Save File"), + "untitled.xbel", + Tr::tr("Files (*.xbel)")); QLatin1String suffix(".xbel"); if (!filePath.endsWith(suffix)) diff --git a/src/plugins/help/helpconstants.h b/src/plugins/help/helpconstants.h index 294424af7d..baa9027f9f 100644 --- a/src/plugins/help/helpconstants.h +++ b/src/plugins/help/helpconstants.h @@ -56,14 +56,14 @@ const char HELP_SEARCH[] = "Help.Search"; const char HELP_BOOKMARKS[] = "Help.Bookmarks"; const char HELP_OPENPAGES[] = "Help.OpenPages"; -static const char SB_INDEX[] = QT_TRANSLATE_NOOP("Help::Internal::HelpPlugin", "Index"); -static const char SB_CONTENTS[] = QT_TRANSLATE_NOOP("Help::Internal::HelpPlugin", "Contents"); -static const char SB_BOOKMARKS[] = QT_TRANSLATE_NOOP("Help::Internal::HelpPlugin", "Bookmarks"); -static const char SB_OPENPAGES[] = QT_TRANSLATE_NOOP("Help::Internal::HelpPlugin", "Open Pages"); -static const char SB_SEARCH[] = QT_TRANSLATE_NOOP("Help::Internal::HelpPlugin", "Search"); +static const char SB_INDEX[] = QT_TRANSLATE_NOOP("Help", "Index"); +static const char SB_CONTENTS[] = QT_TRANSLATE_NOOP("Help", "Contents"); +static const char SB_BOOKMARKS[] = QT_TRANSLATE_NOOP("Help", "Bookmarks"); +static const char SB_OPENPAGES[] = QT_TRANSLATE_NOOP("Help", "Open Pages"); +static const char SB_SEARCH[] = QT_TRANSLATE_NOOP("Help", "Search"); -static const char TR_OPEN_LINK_AS_NEW_PAGE[] = QT_TRANSLATE_NOOP("HelpViewer", "Open Link as New Page"); -static const char TR_OPEN_LINK_IN_WINDOW[] = QT_TRANSLATE_NOOP("HelpViewer", "Open Link in Window"); +static const char TR_OPEN_LINK_AS_NEW_PAGE[] = QT_TRANSLATE_NOOP("Help", "Open Link as New Page"); +static const char TR_OPEN_LINK_IN_WINDOW[] = QT_TRANSLATE_NOOP("Help", "Open Link in Window"); } // Constants } // Help diff --git a/src/plugins/help/helpindexfilter.cpp b/src/plugins/help/helpindexfilter.cpp index 05c55e1c79..a60a9d3a6d 100644 --- a/src/plugins/help/helpindexfilter.cpp +++ b/src/plugins/help/helpindexfilter.cpp @@ -27,6 +27,7 @@ #include "helpicons.h" #include "helpmanager.h" +#include "helptr.h" #include "topicchooser.h" #include <coreplugin/icore.h> @@ -48,7 +49,7 @@ using namespace Help::Internal; HelpIndexFilter::HelpIndexFilter() { setId("HelpIndexFilter"); - setDisplayName(tr("Help Index")); + setDisplayName(Tr::tr("Help Index")); setDefaultIncludedByDefault(false); setDefaultShortcutString("?"); diff --git a/src/plugins/help/helpmanager.cpp b/src/plugins/help/helpmanager.cpp index d6d94b7d98..9862855f2f 100644 --- a/src/plugins/help/helpmanager.cpp +++ b/src/plugins/help/helpmanager.cpp @@ -25,6 +25,8 @@ #include "helpmanager.h" +#include "helptr.h" + #include <coreplugin/icore.h> #include <coreplugin/progressmanager/progressmanager.h> #include <utils/algorithm.h> @@ -126,7 +128,7 @@ void HelpManager::registerDocumentation(const QStringList &files) emit Core::HelpManager::Signals::instance()->documentationChanged(); } }); - ProgressManager::addTask(future, tr("Update Documentation"), kUpdateDocumentationTask); + ProgressManager::addTask(future, Tr::tr("Update Documentation"), kUpdateDocumentationTask); } void HelpManager::unregisterDocumentation(const QStringList &fileNames) diff --git a/src/plugins/help/helpmode.cpp b/src/plugins/help/helpmode.cpp index 3d5e20304a..9b03789cf1 100644 --- a/src/plugins/help/helpmode.cpp +++ b/src/plugins/help/helpmode.cpp @@ -26,6 +26,7 @@ #include "helpmode.h" #include "helpconstants.h" #include "helpicons.h" +#include "helptr.h" #include <QCoreApplication> @@ -39,7 +40,7 @@ HelpMode::HelpMode(QObject *parent) setContext(Core::Context(Constants::C_MODE_HELP)); setIcon(Utils::Icon::modeIcon(Icons::MODE_HELP_CLASSIC, Icons::MODE_HELP_FLAT, Icons::MODE_HELP_FLAT_ACTIVE)); - setDisplayName(QCoreApplication::translate("Help::Internal::HelpMode", "Help")); + setDisplayName(Tr::tr("Help")); setPriority(Constants::P_MODE_HELP); setId(Constants::ID_MODE_HELP); } diff --git a/src/plugins/help/helpplugin.cpp b/src/plugins/help/helpplugin.cpp index 624ae6617d..f08e49424a 100644 --- a/src/plugins/help/helpplugin.cpp +++ b/src/plugins/help/helpplugin.cpp @@ -35,6 +35,7 @@ #include "helpindexfilter.h" #include "helpmanager.h" #include "helpmode.h" +#include "helptr.h" #include "helpviewer.h" #include "helpwidget.h" #include "localhelpmanager.h" @@ -225,18 +226,17 @@ HelpPluginPrivate::HelpPluginPrivate() QAction *action; // Add Contents, Index, and Context menu items - action = new QAction(QIcon::fromTheme("help-contents"), - HelpPlugin::tr(Constants::SB_CONTENTS), this); + action = new QAction(QIcon::fromTheme("help-contents"), Tr::tr(Constants::SB_CONTENTS), this); cmd = ActionManager::registerAction(action, "Help.ContentsMenu"); ActionManager::actionContainer(Core::Constants::M_HELP)->addAction(cmd, Core::Constants::G_HELP_HELP); connect(action, &QAction::triggered, this, &HelpPluginPrivate::activateContents); - action = new QAction(HelpPlugin::tr(Constants::SB_INDEX), this); + action = new QAction(Tr::tr(Constants::SB_INDEX), this); cmd = ActionManager::registerAction(action, "Help.IndexMenu"); ActionManager::actionContainer(Core::Constants::M_HELP)->addAction(cmd, Core::Constants::G_HELP_HELP); connect(action, &QAction::triggered, this, &HelpPluginPrivate::activateIndex); - action = new QAction(HelpPlugin::tr("Context Help"), this); + 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()); @@ -254,7 +254,7 @@ HelpPluginPrivate::HelpPluginPrivate() textEditorContextMenu->addAction(cmd, Core::Constants::G_HELP); } - action = new QAction(HelpPlugin::tr("Technical Support..."), this); + action = new QAction(Tr::tr("Technical Support..."), this); cmd = ActionManager::registerAction(action, "Help.TechSupport"); ActionManager::actionContainer(Core::Constants::M_HELP)->addAction(cmd, Core::Constants::G_HELP_SUPPORT); connect(action, &QAction::triggered, this, [this] { @@ -265,7 +265,7 @@ HelpPluginPrivate::HelpPluginPrivate() const QString qdsStandaloneEntry = "QML/Designer/StandAloneMode"; //entry from designer settings const bool isDesigner = Core::ICore::settings()->value(qdsStandaloneEntry, false).toBool(); - action = new QAction(HelpPlugin::tr("Report Bug..."), this); + action = new QAction(Tr::tr("Report Bug..."), this); cmd = ActionManager::registerAction(action, "Help.ReportBug"); ActionManager::actionContainer(Core::Constants::M_HELP)->addAction(cmd, Core::Constants::G_HELP_SUPPORT); connect(action, &QAction::triggered, this, [isDesigner] { @@ -274,7 +274,7 @@ HelpPluginPrivate::HelpPluginPrivate() QDesktopServices::openUrl(bugreportUrl); }); - action = new QAction(HelpPlugin::tr("System Information..."), this); + action = new QAction(Tr::tr("System Information..."), this); cmd = ActionManager::registerAction(action, "Help.SystemInformation"); ActionManager::actionContainer(Core::Constants::M_HELP)->addAction(cmd, Core::Constants::G_HELP_SUPPORT); connect(action, &QAction::triggered, this, &HelpPluginPrivate::slotSystemInformation); @@ -539,11 +539,11 @@ void HelpPluginPrivate::showContextHelp(const HelpItem &contextHelp) "<font color=\"%3\"><b>%4</b></font><br/>" "<font color=\"%3\">%5</font>" "</center></body></html>") - .arg(HelpPlugin::tr("No Documentation")) + .arg(Tr::tr("No Documentation")) .arg(creatorTheme()->color(Theme::BackgroundColorNormal).name()) .arg(creatorTheme()->color(Theme::TextColorNormal).name()) .arg(contextHelp.helpIds().join(", ")) - .arg(HelpPlugin::tr("No documentation available."))); + .arg(Tr::tr("No documentation available."))); } } else if (links.size() == 1 && !contextHelp.isFuzzyMatch()) { showHelpUrl(links.front().second, LocalHelpManager::contextHelpOption()); @@ -622,10 +622,11 @@ void HelpPluginPrivate::slotSystemInformation() auto dialog = new DialogClosingOnEscape(ICore::dialogParent()); dialog->setAttribute(Qt::WA_DeleteOnClose); dialog->setModal(true); - dialog->setWindowTitle(HelpPlugin::tr("System Information")); + dialog->setWindowTitle(Tr::tr("System Information")); auto layout = new QVBoxLayout; dialog->setLayout(layout); - auto intro = new QLabel(HelpPlugin::tr("Use the following to provide more detailed information about your system to bug reports:")); + auto intro = new QLabel(Tr::tr("Use the following to provide more detailed information about " + "your system to bug reports:")); intro->setWordWrap(true); layout->addWidget(intro); const QString text = "{noformat}\n" + ICore::systemInformation() + "\n{noformat}"; @@ -638,7 +639,7 @@ void HelpPluginPrivate::slotSystemInformation() layout->addWidget(info); auto buttonBox = new QDialogButtonBox; buttonBox->addButton(QDialogButtonBox::Cancel); - buttonBox->addButton(HelpPlugin::tr("Copy to Clipboard"), QDialogButtonBox::AcceptRole); + buttonBox->addButton(Tr::tr("Copy to Clipboard"), QDialogButtonBox::AcceptRole); connect(buttonBox, &QDialogButtonBox::accepted, dialog, &QDialog::accept); connect(buttonBox, &QDialogButtonBox::rejected, dialog, &QDialog::reject); layout->addWidget(buttonBox); diff --git a/src/plugins/help/helpviewer.cpp b/src/plugins/help/helpviewer.cpp index da1054bc1c..2470fd53e8 100644 --- a/src/plugins/help/helpviewer.cpp +++ b/src/plugins/help/helpviewer.cpp @@ -25,6 +25,7 @@ #include "helpviewer.h" #include "helpconstants.h" +#include "helptr.h" #include "localhelpmanager.h" #include <coreplugin/icore.h> @@ -215,8 +216,9 @@ void HelpViewer::incrementZoom(int steps) void HelpViewer::applyZoom(int percentage) { const int newZoom = LocalHelpManager::setFontZoom(percentage); - Utils::FadingIndicator::showText(this, QCoreApplication::translate("Help::HelpViewer", - "Zoom: %1%").arg(newZoom), Utils::FadingIndicator::SmallText); + Utils::FadingIndicator::showText(this, + Tr::tr("Zoom: %1%").arg(newZoom), + Utils::FadingIndicator::SmallText); } void HelpViewer::slotLoadStarted() diff --git a/src/plugins/help/helpwidget.cpp b/src/plugins/help/helpwidget.cpp index 74462c643b..bb9cce069d 100644 --- a/src/plugins/help/helpwidget.cpp +++ b/src/plugins/help/helpwidget.cpp @@ -30,6 +30,7 @@ #include "helpconstants.h" #include "helpicons.h" #include "helpplugin.h" +#include "helptr.h" #include "helpviewer.h" #include "indexwindow.h" #include "localhelpmanager.h" @@ -95,7 +96,7 @@ QVariant OpenPagesModel::data(const QModelIndex &index, int role) const return m_parent->viewerAt(index.row())->source().toString(); case Qt::DisplayRole: { const QString title = m_parent->viewerAt(index.row())->title(); - return title.isEmpty() ? HelpWidget::tr("(Untitled)") : title; + return title.isEmpty() ? Tr::tr("(Untitled)") : title; } default: break; @@ -128,13 +129,13 @@ static QString helpTargetActionText(Core::HelpManager::HelpViewerLocation option { switch (option) { case Core::HelpManager::SideBySideIfPossible: - return HelpWidget::tr("Show Context Help Side-by-Side if Possible"); + return Tr::tr("Show Context Help Side-by-Side if Possible"); case Core::HelpManager::SideBySideAlways: - return HelpWidget::tr("Always Show Context Help Side-by-Side"); + return Tr::tr("Always Show Context Help Side-by-Side"); case Core::HelpManager::HelpModeAlways: - return HelpWidget::tr("Always Show Context Help in Help Mode"); + return Tr::tr("Always Show Context Help in Help Mode"); case Core::HelpManager::ExternalHelpAlways: - return HelpWidget::tr("Always Show Context Help in External Window"); + return Tr::tr("Always Show Context Help in External Window"); } QTC_CHECK(false); return {}; @@ -279,7 +280,7 @@ HelpWidget::HelpWidget(const Core::Context &context, WidgetStyle style, QWidget } if (style != ModeWidget) { - m_switchToHelp = new QAction(tr("Open in Help Mode"), toolBar); + m_switchToHelp = new QAction(Tr::tr("Open in Help Mode"), toolBar); cmd = Core::ActionManager::registerAction(m_switchToHelp, Constants::CONTEXT_HELP, context); connect(m_switchToHelp, &QAction::triggered, this, [this] { postRequestShowHelpUrl(Core::HelpManager::HelpModeAlways); @@ -287,12 +288,12 @@ HelpWidget::HelpWidget(const Core::Context &context, WidgetStyle style, QWidget layout->addWidget(Core::Command::toolButtonWithAppendedShortcut(m_switchToHelp, cmd)); } - m_homeAction = new QAction(Utils::Icons::HOME_TOOLBAR.icon(), tr("Home"), this); + m_homeAction = new QAction(Utils::Icons::HOME_TOOLBAR.icon(), Tr::tr("Home"), this); cmd = Core::ActionManager::registerAction(m_homeAction, Constants::HELP_HOME, context); connect(m_homeAction, &QAction::triggered, this, &HelpWidget::goHome); layout->addWidget(Core::Command::toolButtonWithAppendedShortcut(m_homeAction, cmd)); - m_backAction = new QAction(Utils::Icons::PREV_TOOLBAR.icon(), tr("Back"), toolBar); + m_backAction = new QAction(Utils::Icons::PREV_TOOLBAR.icon(), Tr::tr("Back"), toolBar); connect(m_backAction, &QAction::triggered, this, &HelpWidget::backward); m_backMenu = new QMenu(toolBar); connect(m_backMenu, &QMenu::aboutToShow, this, &HelpWidget::updateBackMenu); @@ -303,7 +304,7 @@ HelpWidget::HelpWidget(const Core::Context &context, WidgetStyle style, QWidget button->setPopupMode(QToolButton::DelayedPopup); layout->addWidget(button); - m_forwardAction = new QAction(Utils::Icons::NEXT_TOOLBAR.icon(), tr("Forward"), toolBar); + m_forwardAction = new QAction(Utils::Icons::NEXT_TOOLBAR.icon(), Tr::tr("Forward"), toolBar); connect(m_forwardAction, &QAction::triggered, this, &HelpWidget::forward); m_forwardMenu = new QMenu(toolBar); connect(m_forwardMenu, &QMenu::aboutToShow, this, &HelpWidget::updateForwardMenu); @@ -314,14 +315,19 @@ HelpWidget::HelpWidget(const Core::Context &context, WidgetStyle style, QWidget button->setPopupMode(QToolButton::DelayedPopup); layout->addWidget(button); - m_addBookmarkAction = new QAction(Utils::Icons::BOOKMARK_TOOLBAR.icon(), tr("Add Bookmark"), this); + m_addBookmarkAction = new QAction(Utils::Icons::BOOKMARK_TOOLBAR.icon(), + Tr::tr("Add Bookmark"), + this); cmd = Core::ActionManager::registerAction(m_addBookmarkAction, Constants::HELP_ADDBOOKMARK, context); - cmd->setDefaultKeySequence(QKeySequence(Core::useMacShortcuts ? tr("Meta+M") : tr("Ctrl+M"))); + cmd->setDefaultKeySequence( + QKeySequence(Core::useMacShortcuts ? Tr::tr("Meta+M") : Tr::tr("Ctrl+M"))); connect(m_addBookmarkAction, &QAction::triggered, this, &HelpWidget::addBookmark); layout->addWidget(new Utils::StyledSeparator(toolBar)); layout->addWidget(Core::Command::toolButtonWithAppendedShortcut(m_addBookmarkAction, cmd)); - m_openOnlineDocumentationAction = new QAction(Utils::Icons::ONLINE_TOOLBAR.icon(), tr("Open Online Documentation..."), this); + m_openOnlineDocumentationAction = new QAction(Utils::Icons::ONLINE_TOOLBAR.icon(), + Tr::tr("Open Online Documentation..."), + this); cmd = Core::ActionManager::registerAction(m_openOnlineDocumentationAction, Constants::HELP_OPENONLINE, context); connect(m_openOnlineDocumentationAction, &QAction::triggered, this, &HelpWidget::openOnlineDocumentation); layout->addWidget( @@ -411,19 +417,19 @@ HelpWidget::HelpWidget(const Core::Context &context, WidgetStyle style, QWidget Core::ActionContainer *advancedMenu = Core::ActionManager::actionContainer(Core::Constants::M_EDIT_ADVANCED); if (QTC_GUARD(advancedMenu)) { // reuse TextEditor constants to avoid a second pair of menu actions - m_scaleUp = new QAction(tr("Increase Font Size"), this); + m_scaleUp = new QAction(Tr::tr("Increase Font Size"), this); cmd = Core::ActionManager::registerAction(m_scaleUp, TextEditor::Constants::INCREASE_FONT_SIZE, context); connect(m_scaleUp, &QAction::triggered, this, &HelpWidget::scaleUp); advancedMenu->addAction(cmd, Core::Constants::G_EDIT_FONT); - m_scaleDown = new QAction(tr("Decrease Font Size"), this); + m_scaleDown = new QAction(Tr::tr("Decrease Font Size"), this); cmd = Core::ActionManager::registerAction(m_scaleDown, TextEditor::Constants::DECREASE_FONT_SIZE, context); connect(m_scaleDown, &QAction::triggered, this, &HelpWidget::scaleDown); advancedMenu->addAction(cmd, Core::Constants::G_EDIT_FONT); - m_resetScale = new QAction(tr("Reset Font Size"), this); + m_resetScale = new QAction(Tr::tr("Reset Font Size"), this); cmd = Core::ActionManager::registerAction(m_resetScale, TextEditor::Constants::RESET_FONT_SIZE, context); connect(m_resetScale, &QAction::triggered, this, &HelpWidget::resetScale); @@ -441,20 +447,20 @@ HelpWidget::HelpWidget(const Core::Context &context, WidgetStyle style, QWidget if (m_switchToHelp) openMenu->addAction(m_switchToHelp); if (style != SideBarWidget) { - QAction *openSideBySide = openMenu->addAction(tr("Open in Edit Mode")); + QAction *openSideBySide = openMenu->addAction(Tr::tr("Open in Edit Mode")); connect(openSideBySide, &QAction::triggered, this, [this]() { postRequestShowHelpUrl(Core::HelpManager::SideBySideAlways); }); } if (supportsPages()) { - QAction *openPage = openMenu->addAction(tr("Open in New Page")); + QAction *openPage = openMenu->addAction(Tr::tr("Open in New Page")); connect(openPage, &QAction::triggered, this, [this]() { if (HelpViewer *viewer = currentViewer()) openNewPage(viewer->source()); }); } if (style != ExternalWindow) { - QAction *openExternal = openMenu->addAction(tr("Open in Window")); + QAction *openExternal = openMenu->addAction(Tr::tr("Open in Window")); connect(openExternal, &QAction::triggered, this, [this]() { postRequestShowHelpUrl(Core::HelpManager::ExternalHelpAlways); }); @@ -473,7 +479,7 @@ HelpWidget::HelpWidget(const Core::Context &context, WidgetStyle style, QWidget button->setDefaultAction(m_closeAction); layout->addWidget(button); - QAction *reload = openMenu->addAction(tr("Reload")); + QAction *reload = openMenu->addAction(Tr::tr("Reload")); connect(reload, &QAction::triggered, this, [this]() { const int index = m_viewerStack->currentIndex(); HelpViewer *previous = currentViewer(); @@ -492,7 +498,7 @@ void HelpWidget::setupFilterCombo() { const QString currentFilter = LocalHelpManager::filterEngine()->activeFilter(); m_filterComboBox->clear(); - m_filterComboBox->addItem(tr("Unfiltered")); + m_filterComboBox->addItem(Tr::tr("Unfiltered")); const QStringList allFilters = LocalHelpManager::filterEngine()->filters(); if (!allFilters.isEmpty()) m_filterComboBox->insertSeparator(1); @@ -568,58 +574,58 @@ void HelpWidget::addSideBar() auto contentWindow = new ContentWindow; auto contentItem = new Core::SideBarItem(contentWindow, Constants::HELP_CONTENTS); contentWindow->setOpenInNewPageActionVisible(supportsPages()); - contentWindow->setWindowTitle(HelpPlugin::tr(Constants::SB_CONTENTS)); + contentWindow->setWindowTitle(Tr::tr(Constants::SB_CONTENTS)); connect(contentWindow, &ContentWindow::linkActivated, this, &HelpWidget::open); - m_contentsAction = new QAction(HelpPlugin::tr(Constants::SB_CONTENTS), this); + m_contentsAction = new QAction(Tr::tr(Constants::SB_CONTENTS), this); cmd = Core::ActionManager::registerAction(m_contentsAction, Constants::HELP_CONTENTS, m_context->context()); - cmd->setDefaultKeySequence(QKeySequence(Core::useMacShortcuts ? tr("Meta+Shift+C") - : tr("Ctrl+Shift+C"))); + cmd->setDefaultKeySequence( + QKeySequence(Core::useMacShortcuts ? Tr::tr("Meta+Shift+C") : Tr::tr("Ctrl+Shift+C"))); shortcutMap.insert(Constants::HELP_CONTENTS, cmd); auto indexWindow = new IndexWindow(); auto indexItem = new Core::SideBarItem(indexWindow, Constants::HELP_INDEX); indexWindow->setOpenInNewPageActionVisible(supportsPages()); - indexWindow->setWindowTitle(HelpPlugin::tr(Constants::SB_INDEX)); + indexWindow->setWindowTitle(Tr::tr(Constants::SB_INDEX)); connect(indexWindow, &IndexWindow::linksActivated, this, &HelpWidget::showLinks); - m_indexAction = new QAction(HelpPlugin::tr(Constants::SB_INDEX), this); + m_indexAction = new QAction(Tr::tr(Constants::SB_INDEX), this); cmd = Core::ActionManager::registerAction(m_indexAction, Constants::HELP_INDEX, m_context->context()); - cmd->setDefaultKeySequence(QKeySequence(Core::useMacShortcuts ? tr("Meta+I") - : tr("Ctrl+Shift+I"))); + cmd->setDefaultKeySequence( + QKeySequence(Core::useMacShortcuts ? Tr::tr("Meta+I") : Tr::tr("Ctrl+Shift+I"))); shortcutMap.insert(Constants::HELP_INDEX, cmd); auto bookmarkWidget = new BookmarkWidget(&LocalHelpManager::bookmarkManager()); - bookmarkWidget->setWindowTitle(HelpPlugin::tr(Constants::SB_BOOKMARKS)); + bookmarkWidget->setWindowTitle(Tr::tr(Constants::SB_BOOKMARKS)); bookmarkWidget->setOpenInNewPageActionVisible(supportsPages()); auto bookmarkItem = new Core::SideBarItem(bookmarkWidget, Constants::HELP_BOOKMARKS); connect(bookmarkWidget, &BookmarkWidget::linkActivated, this, &HelpWidget::setSource); - m_bookmarkAction = new QAction(tr("Activate Help Bookmarks View"), this); + m_bookmarkAction = new QAction(Tr::tr("Activate Help Bookmarks View"), this); cmd = Core::ActionManager::registerAction(m_bookmarkAction, Constants::HELP_BOOKMARKS, m_context->context()); - cmd->setDefaultKeySequence(QKeySequence(Core::useMacShortcuts ? tr("Alt+Meta+M") - : tr("Ctrl+Shift+B"))); + cmd->setDefaultKeySequence( + QKeySequence(Core::useMacShortcuts ? Tr::tr("Alt+Meta+M") : Tr::tr("Ctrl+Shift+B"))); shortcutMap.insert(Constants::HELP_BOOKMARKS, cmd); auto searchItem = new SearchSideBarItem; connect(searchItem, &SearchSideBarItem::linkActivated, this, &HelpWidget::openFromSearch); - m_searchAction = new QAction(tr("Activate Help Search View"), this); + m_searchAction = new QAction(Tr::tr("Activate Help Search View"), this); cmd = Core::ActionManager::registerAction(m_searchAction, Constants::HELP_SEARCH, m_context->context()); - cmd->setDefaultKeySequence(QKeySequence(Core::useMacShortcuts ? tr("Meta+/") - : tr("Ctrl+Shift+/"))); + cmd->setDefaultKeySequence( + QKeySequence(Core::useMacShortcuts ? Tr::tr("Meta+/") : Tr::tr("Ctrl+Shift+/"))); shortcutMap.insert(Constants::HELP_SEARCH, cmd); Core::SideBarItem *openPagesItem = nullptr; QWidget *openPagesWidget = m_openPagesManager->openPagesWidget(); - openPagesWidget->setWindowTitle(HelpPlugin::tr(Constants::SB_OPENPAGES)); + openPagesWidget->setWindowTitle(Tr::tr(Constants::SB_OPENPAGES)); openPagesItem = new Core::SideBarItem(openPagesWidget, Constants::HELP_OPENPAGES); - m_openPagesAction = new QAction(tr("Activate Open Help Pages View"), this); + m_openPagesAction = new QAction(Tr::tr("Activate Open Help Pages View"), this); cmd = Core::ActionManager::registerAction(m_openPagesAction, Constants::HELP_OPENPAGES, m_context->context()); cmd->setDefaultKeySequence( - QKeySequence(Core::useMacShortcuts ? tr("Meta+O") : tr("Ctrl+Shift+O"))); + QKeySequence(Core::useMacShortcuts ? Tr::tr("Meta+O") : Tr::tr("Ctrl+Shift+O"))); shortcutMap.insert(Constants::HELP_OPENPAGES, cmd); QList<Core::SideBarItem *> itemList = {contentItem, indexItem, bookmarkItem, searchItem}; @@ -862,9 +868,9 @@ void HelpWidget::updateWindowTitle() QTC_ASSERT(currentViewer(), return); const QString pageTitle = currentViewer()->title(); if (pageTitle.isEmpty()) - setWindowTitle(tr("Help")); + setWindowTitle(Tr::tr("Help")); else - setWindowTitle(tr("Help - %1").arg(pageTitle)); + setWindowTitle(Tr::tr("Help - %1").arg(pageTitle)); } void HelpWidget::postRequestShowHelpUrl(Core::HelpManager::HelpViewerLocation location) @@ -989,7 +995,7 @@ void HelpWidget::print(HelpViewer *viewer) if (!m_printer) m_printer = new QPrinter(QPrinter::HighResolution); QPrintDialog dlg(m_printer, this); - dlg.setWindowTitle(tr("Print Documentation")); + dlg.setWindowTitle(Tr::tr("Print Documentation")); if (!viewer->selectedText().isEmpty()) dlg.setOption(QAbstractPrintDialog::PrintSelection, true); dlg.setOption(QAbstractPrintDialog::PrintPageRange, true); diff --git a/src/plugins/help/litehtmlhelpviewer.cpp b/src/plugins/help/litehtmlhelpviewer.cpp index 4e1c697bed..b2d064412e 100644 --- a/src/plugins/help/litehtmlhelpviewer.cpp +++ b/src/plugins/help/litehtmlhelpviewer.cpp @@ -26,6 +26,7 @@ #include "litehtmlhelpviewer.h" #include "helpconstants.h" +#include "helptr.h" #include "localhelpmanager.h" #include <utils/algorithm.h> @@ -290,22 +291,20 @@ void LiteHtmlHelpViewer::showContextMenu(const QPoint &pos, const QUrl &url) QAction *copyAnchorAction = nullptr; if (!url.isEmpty() && url.isValid()) { if (isActionVisible(HelpViewer::Action::NewPage)) { - QAction *action = menu.addAction( - QCoreApplication::translate("HelpViewer", Constants::TR_OPEN_LINK_AS_NEW_PAGE)); + QAction *action = menu.addAction(Tr::tr(Constants::TR_OPEN_LINK_AS_NEW_PAGE)); connect(action, &QAction::triggered, this, [this, url]() { emit newPageRequested(url); }); } if (isActionVisible(HelpViewer::Action::ExternalWindow)) { - QAction *action = menu.addAction( - QCoreApplication::translate("HelpViewer", Constants::TR_OPEN_LINK_IN_WINDOW)); + QAction *action = menu.addAction(Tr::tr(Constants::TR_OPEN_LINK_IN_WINDOW)); connect(action, &QAction::triggered, this, [this, url]() { emit externalPageRequested(url); }); } - copyAnchorAction = menu.addAction(tr("Copy Link")); + copyAnchorAction = menu.addAction(Tr::tr("Copy Link")); } else if (!m_viewer->selectedText().isEmpty()) { - connect(menu.addAction(tr("Copy")), &QAction::triggered, this, &HelpViewer::copy); + connect(menu.addAction(Tr::tr("Copy")), &QAction::triggered, this, &HelpViewer::copy); } if (copyAnchorAction == menu.exec(m_viewer->mapToGlobal(pos))) diff --git a/src/plugins/help/localhelpmanager.cpp b/src/plugins/help/localhelpmanager.cpp index 30eabc65e6..31575a8d98 100644 --- a/src/plugins/help/localhelpmanager.cpp +++ b/src/plugins/help/localhelpmanager.cpp @@ -28,6 +28,7 @@ #include "bookmarkmanager.h" #include "helpconstants.h" #include "helpmanager.h" +#include "helptr.h" #include "helpviewer.h" #include "textbrowserhelpviewer.h" @@ -328,7 +329,7 @@ QVector<HelpViewerFactory> LocalHelpManager::viewerBackends() { QVector<HelpViewerFactory> result; #ifdef QTC_LITEHTML_HELPVIEWER - result.append({"litehtml", tr("litehtml"), []() { return new LiteHtmlHelpViewer; }}); + result.append({"litehtml", Tr::tr("litehtml"), []() { return new LiteHtmlHelpViewer; }}); #endif #ifdef QTC_WEBENGINE_HELPVIEWER static bool schemeRegistered = false; @@ -338,11 +339,12 @@ QVector<HelpViewerFactory> LocalHelpManager::viewerBackends() scheme.setFlags(QWebEngineUrlScheme::LocalScheme | QWebEngineUrlScheme::LocalAccessAllowed); QWebEngineUrlScheme::registerScheme(scheme); } - result.append({"qtwebengine", tr("QtWebEngine"), []() { return new WebEngineHelpViewer; }}); + result.append({"qtwebengine", Tr::tr("QtWebEngine"), []() { return new WebEngineHelpViewer; }}); #endif - result.append({"textbrowser", tr("QTextBrowser"), []() { return new TextBrowserHelpViewer; }}); + result.append( + {"textbrowser", Tr::tr("QTextBrowser"), []() { return new TextBrowserHelpViewer; }}); #ifdef QTC_MAC_NATIVE_HELPVIEWER - result.append({"native", tr("WebKit"), []() { return new MacWebKitHelpViewer; }}); + result.append({"native", Tr::tr("WebKit"), []() { return new MacWebKitHelpViewer; }}); #endif #ifdef QTC_DEFAULT_HELPVIEWER_BACKEND const int index = Utils::indexOf(result, [](const HelpViewerFactory &f) { @@ -472,15 +474,15 @@ QByteArray LocalHelpManager::loadErrorMessage(const QUrl &url, const QString &er "</html>"; // some of the values we will replace %1...6 inside the former html - const QString g_percent1 = QCoreApplication::translate("Help", "Error loading page"); + const QString g_percent1 = Tr::tr("Error loading page"); // percent2 will be the error details // percent3 will be the url of the page we got the error from - const QString g_percent4 = QCoreApplication::translate("Help", "<p>Check that you have the corresponding " - "documentation set installed.</p>"); + const QString g_percent4 = Tr::tr("<p>Check that you have the corresponding " + "documentation set installed.</p>"); - return QString::fromLatin1(g_htmlPage).arg(g_percent1, errorString, - QCoreApplication::translate("Help", "Error loading: %1").arg(url.toString()), - g_percent4).toUtf8(); + return QString::fromLatin1(g_htmlPage) + .arg(g_percent1, errorString, Tr::tr("Error loading: %1").arg(url.toString()), g_percent4) + .toUtf8(); } LocalHelpManager::HelpData LocalHelpManager::helpData(const QUrl &url) @@ -495,8 +497,7 @@ LocalHelpManager::HelpData LocalHelpManager::helpData(const QUrl &url) if (data.mimeType.isEmpty()) data.mimeType = "application/octet-stream"; } else { - data.data = loadErrorMessage(url, QCoreApplication::translate( - "Help", "The page could not be found")); + data.data = loadErrorMessage(url, Tr::tr("The page could not be found")); data.mimeType = "text/html"; } return data; diff --git a/src/plugins/help/macwebkithelpviewer.mm b/src/plugins/help/macwebkithelpviewer.mm index be8a1c1c17..ed239754f4 100644 --- a/src/plugins/help/macwebkithelpviewer.mm +++ b/src/plugins/help/macwebkithelpviewer.mm @@ -26,6 +26,7 @@ #include "macwebkithelpviewer.h" #include "helpconstants.h" +#include "helptr.h" #include "localhelpmanager.h" #include "openpagesmanager.h" @@ -347,11 +348,15 @@ static NSMenuItem *menuItem(NSURL *url, id target, SEL action, const QString &ti NSURL *url = [element objectForKey:WebElementLinkURLKey]; if (QTC_GUARD(url)) { if (widget->viewer()->isActionVisible(Help::Internal::HelpViewer::Action::NewPage)) - [ret addObject:menuItem(url, self, @selector(openAsNewPage:), - QCoreApplication::translate("HelpViewer", Help::Constants::TR_OPEN_LINK_AS_NEW_PAGE))]; + [ret addObject:menuItem(url, + self, + @selector(openAsNewPage:), + Tr::tr(Help::Constants::TR_OPEN_LINK_AS_NEW_PAGE))]; if (widget->viewer()->isActionVisible(Help::Internal::HelpViewer::Action::ExternalWindow)) - [ret addObject:menuItem(url, self, @selector(openInWindow:), - QCoreApplication::translate("HelpViewer", Help::Constants::TR_OPEN_LINK_IN_WINDOW))]; + [ret addObject:menuItem(url, + self, + @selector(openInWindow:), + Tr::tr(Help::Constants::TR_OPEN_LINK_IN_WINDOW))]; } break; } diff --git a/src/plugins/help/openpagesmanager.cpp b/src/plugins/help/openpagesmanager.cpp index 4fa96c341b..62683ef897 100644 --- a/src/plugins/help/openpagesmanager.cpp +++ b/src/plugins/help/openpagesmanager.cpp @@ -26,6 +26,7 @@ #include "openpagesmanager.h" #include "helpconstants.h" +#include "helptr.h" #include "helpviewer.h" #include "helpwidget.h" #include "localhelpmanager.h" @@ -249,7 +250,7 @@ void OpenPagesManager::openPagesContextMenu(const QPoint &point) return; QMenu menu; - menu.addAction(tr("Copy Full Path to Clipboard")); + menu.addAction(Tr::tr("Copy Full Path to Clipboard")); if (menu.exec(m_comboBox->mapToGlobal(point))) QApplication::clipboard()->setText(fileName); } diff --git a/src/plugins/help/openpageswidget.cpp b/src/plugins/help/openpageswidget.cpp index 0704627a97..c356748bd7 100644 --- a/src/plugins/help/openpageswidget.cpp +++ b/src/plugins/help/openpageswidget.cpp @@ -25,6 +25,8 @@ #include "openpageswidget.h" +#include "helptr.h" + #include <coreplugin/coreconstants.h> #include <utils/stringutils.h> @@ -85,8 +87,9 @@ void OpenPagesWidget::contextMenuRequested(QPoint pos) index = index.sibling(index.row(), 0); QMenu contextMenu; const QString displayString = Utils::quoteAmpersands(index.data().toString()); - QAction *closeEditor = contextMenu.addAction(tr("Close %1").arg(displayString)); - QAction *closeOtherEditors = contextMenu.addAction(tr("Close All Except %1").arg(displayString)); + QAction *closeEditor = contextMenu.addAction(Tr::tr("Close %1").arg(displayString)); + QAction *closeOtherEditors = contextMenu.addAction( + Tr::tr("Close All Except %1").arg(displayString)); if (model()->rowCount() == 1) { closeEditor->setEnabled(false); diff --git a/src/plugins/help/searchtaskhandler.cpp b/src/plugins/help/searchtaskhandler.cpp index 8df2a71565..36f6e24929 100644 --- a/src/plugins/help/searchtaskhandler.cpp +++ b/src/plugins/help/searchtaskhandler.cpp @@ -25,6 +25,8 @@ #include "searchtaskhandler.h" +#include "helptr.h" + #include <projectexplorer/task.h> #include <QAction> @@ -46,5 +48,5 @@ void SearchTaskHandler::handle(const ProjectExplorer::Task &task) QAction *SearchTaskHandler::createAction(QObject *parent) const { - return new QAction(tr("Get Help Online"), parent); + return new QAction(Tr::tr("Get Help Online"), parent); } diff --git a/src/plugins/help/searchwidget.cpp b/src/plugins/help/searchwidget.cpp index 99793d4111..70a8d0c843 100644 --- a/src/plugins/help/searchwidget.cpp +++ b/src/plugins/help/searchwidget.cpp @@ -26,6 +26,7 @@ #include "searchwidget.h" #include "helpconstants.h" #include "helpplugin.h" +#include "helptr.h" #include "localhelpmanager.h" #include "openpagesmanager.h" @@ -113,7 +114,7 @@ void SearchWidget::showEvent(QShowEvent *event) tbLayout->setSpacing(6); tbLayout->setContentsMargins(4, 4, 4, 4); tbLayout->addWidget(m_queryWidget); - m_indexingDocumentationLabel = new QLabel(tr("Indexing Documentation"), toolbar); + m_indexingDocumentationLabel = new QLabel(Tr::tr("Indexing Documentation"), toolbar); m_indexingDocumentationLabel->hide(); tbLayout->addWidget(m_indexingDocumentationLabel); toolbar->setLayout(tbLayout); @@ -180,9 +181,11 @@ void SearchWidget::indexingStarted() { Q_ASSERT(!m_progress); m_progress = new QFutureInterface<void>(); - Core::ProgressManager::addTask(m_progress->future(), tr("Indexing Documentation"), "Help.Indexer"); + Core::ProgressManager::addTask(m_progress->future(), + Tr::tr("Indexing Documentation"), + "Help.Indexer"); m_progress->setProgressRange(0, 2); - m_progress->setProgressValueAndText(1, tr("Indexing Documentation")); + m_progress->setProgressValueAndText(1, Tr::tr("Indexing Documentation")); m_progress->reportStarted(); connect(&m_watcher, &QFutureWatcherBase::canceled, @@ -243,13 +246,16 @@ void SearchWidget::contextMenuEvent(QContextMenuEvent *contextMenuEvent) if (!link.isEmpty() && link.isValid()) { if (link.isRelative()) link = browser->source().resolved(link); - openLink = menu.addAction(tr("Open Link")); - openLinkInNewTab = menu.addAction(tr("Open Link as New Page")); - copyAnchorAction = menu.addAction(tr("Copy Link")); + openLink = menu.addAction(Tr::tr("Open Link")); + openLinkInNewTab = menu.addAction(Tr::tr("Open Link as New Page")); + copyAnchorAction = menu.addAction(Tr::tr("Copy Link")); } else if (browser->textCursor().hasSelection()) { - connect(menu.addAction(tr("Copy")), &QAction::triggered, browser, &QTextEdit::copy); + connect(menu.addAction(Tr::tr("Copy")), &QAction::triggered, browser, &QTextEdit::copy); } else { - connect(menu.addAction(tr("Reload")), &QAction::triggered, browser, &QTextBrowser::reload); + connect(menu.addAction(Tr::tr("Reload")), + &QAction::triggered, + browser, + &QTextBrowser::reload); } QAction *usedAction = menu.exec(mapToGlobal(contextMenuEvent->pos())); @@ -271,7 +277,7 @@ QStringList SearchWidget::currentSearchTerms() const SearchSideBarItem::SearchSideBarItem() : SideBarItem(new SearchWidget, Constants::HELP_SEARCH) { - widget()->setWindowTitle(HelpPlugin::tr(Constants::SB_SEARCH)); + widget()->setWindowTitle(Tr::tr(Constants::SB_SEARCH)); connect(static_cast<SearchWidget *>(widget()), &SearchWidget::linkActivated, this, &SearchSideBarItem::linkActivated); } @@ -280,7 +286,7 @@ QList<QToolButton *> SearchSideBarItem::createToolBarWidgets() { auto reindexButton = new QToolButton; reindexButton->setIcon(Utils::Icons::RELOAD_TOOLBAR.icon()); - reindexButton->setToolTip(tr("Regenerate Index")); + reindexButton->setToolTip(Tr::tr("Regenerate Index")); connect(reindexButton, &QAbstractButton::clicked, static_cast<SearchWidget *>(widget()), &SearchWidget::reindexDocumentation); return {reindexButton}; diff --git a/src/plugins/help/textbrowserhelpviewer.cpp b/src/plugins/help/textbrowserhelpviewer.cpp index 6447190ca9..a4c72ac6f2 100644 --- a/src/plugins/help/textbrowserhelpviewer.cpp +++ b/src/plugins/help/textbrowserhelpviewer.cpp @@ -26,6 +26,7 @@ #include "textbrowserhelpviewer.h" #include "helpconstants.h" +#include "helptr.h" #include "localhelpmanager.h" #include <coreplugin/find/findplugin.h> @@ -319,25 +320,25 @@ void TextBrowserHelpWidget::contextMenuEvent(QContextMenuEvent *event) QAction *copyAnchorAction = nullptr; const QUrl link(linkAt(event->pos())); if (!link.isEmpty() && link.isValid()) { - QAction *action = menu.addAction(tr("Open Link")); + QAction *action = menu.addAction(Tr::tr("Open Link")); connect(action, &QAction::triggered, this, [this, link]() { setSource(link); }); if (m_parent->isActionVisible(HelpViewer::Action::NewPage)) { - action = menu.addAction(QCoreApplication::translate("HelpViewer", Constants::TR_OPEN_LINK_AS_NEW_PAGE)); + action = menu.addAction(Tr::tr(Constants::TR_OPEN_LINK_AS_NEW_PAGE)); connect(action, &QAction::triggered, this, [this, link]() { emit m_parent->newPageRequested(link); }); } if (m_parent->isActionVisible(HelpViewer::Action::ExternalWindow)) { - action = menu.addAction(QCoreApplication::translate("HelpViewer", Constants::TR_OPEN_LINK_IN_WINDOW)); + action = menu.addAction(Tr::tr(Constants::TR_OPEN_LINK_IN_WINDOW)); connect(action, &QAction::triggered, this, [this, link]() { emit m_parent->externalPageRequested(link); }); } - copyAnchorAction = menu.addAction(tr("Copy Link")); + copyAnchorAction = menu.addAction(Tr::tr("Copy Link")); } else if (!textCursor().selectedText().isEmpty()) { - connect(menu.addAction(tr("Copy")), &QAction::triggered, this, &QTextEdit::copy); + connect(menu.addAction(Tr::tr("Copy")), &QAction::triggered, this, &QTextEdit::copy); } if (copyAnchorAction == menu.exec(event->globalPos())) diff --git a/src/plugins/help/webenginehelpviewer.cpp b/src/plugins/help/webenginehelpviewer.cpp index 7ece25833f..8c03df0faa 100644 --- a/src/plugins/help/webenginehelpviewer.cpp +++ b/src/plugins/help/webenginehelpviewer.cpp @@ -147,8 +147,7 @@ WebEngineHelpViewer::WebEngineHelpViewer(QWidget *parent) : }); QAction* action = m_widget->pageAction(QWebEnginePage::OpenLinkInNewTab); - action->setText(QCoreApplication::translate("HelpViewer", - Constants::TR_OPEN_LINK_AS_NEW_PAGE)); + action->setText(Tr::tr(Constants::TR_OPEN_LINK_AS_NEW_PAGE)); QWebEnginePage *viewPage = m_widget->page(); QTC_ASSERT(viewPage, return); @@ -358,16 +357,14 @@ void WebView::contextMenuEvent(QContextMenuEvent *event) QUrl url = page()->contextMenuData().linkUrl(); #endif if (m_viewer->isActionVisible(HelpViewer::Action::NewPage)) { - auto openLink = new QAction(QCoreApplication::translate("HelpViewer", - Constants::TR_OPEN_LINK_AS_NEW_PAGE), menu); + auto openLink = new QAction(Tr::tr(Constants::TR_OPEN_LINK_AS_NEW_PAGE), menu); connect(openLink, &QAction::triggered, m_viewer, [this, url] { m_viewer->newPageRequested(url); }); menu->insertAction(before, openLink); } if (m_viewer->isActionVisible(HelpViewer::Action::ExternalWindow)) { - auto openLink = new QAction(QCoreApplication::translate("HelpViewer", - Constants::TR_OPEN_LINK_IN_WINDOW), menu); + auto openLink = new QAction(Tr::tr(Constants::TR_OPEN_LINK_IN_WINDOW), menu); connect(openLink, &QAction::triggered, m_viewer, [this, url] { m_viewer->externalPageRequested(url); }); diff --git a/src/plugins/help/xbelsupport.cpp b/src/plugins/help/xbelsupport.cpp index f711fbde8f..f9a4812b08 100644 --- a/src/plugins/help/xbelsupport.cpp +++ b/src/plugins/help/xbelsupport.cpp @@ -25,6 +25,8 @@ #include "xbelsupport.h" +#include "helptr.h" + #include <bookmarkmanager.h> #include <utils/utilsicons.h> @@ -114,7 +116,7 @@ bool XbelReader::readFromFile(QIODevice *device) && attributes().value("version") == QLatin1String("1.0")) { readXBEL(); } else { - raiseError(QCoreApplication::translate("Help::Internal::XbelReader", "The file is not an XBEL version 1.0 file.")); + raiseError(Tr::tr("The file is not an XBEL version 1.0 file.")); } } } @@ -186,7 +188,7 @@ void XbelReader::readBookmark(QStandardItem *item) { QStandardItem *bookmark = createChildItem(item); bookmark->setIcon(bookmarkIcon); - bookmark->setText(QCoreApplication::translate("Help::Internal::XbelReader", "Unknown title")); + bookmark->setText(Tr::tr("Unknown title")); bookmark->setData(attributes().value("href").toString(), Qt::UserRole + 10); |