@@ -138,7 +140,7 @@ ColorSchemeEdit::ColorSchemeEdit(QWidget *parent) :
auto unsetButton = [](const QString &toolTip) {
auto tb = new QPushButton;
tb->setToolTip(toolTip);
- tb->setText(tr("Unset"));
+ tb->setText(Tr::tr("Unset"));
return tb;
};
@@ -165,7 +167,7 @@ ColorSchemeEdit::ColorSchemeEdit(QWidget *parent) :
m_itemList->setUniformItemSizes(true);
m_builtinSchemeLabel = new QLabel(
- tr("Builtin color schemes need to be copied
"
+ Tr::tr("
Builtin color schemes need to be copied
"
" before they can be changed
"));
m_builtinSchemeLabel->setScaledContents(false);
@@ -173,33 +175,33 @@ ColorSchemeEdit::ColorSchemeEdit(QWidget *parent) :
//m_fontProperties->setContentsMargins(0, 0, 0, 0);
m_fontProperties->setMinimumWidth(212);
- m_foregroundLabel = new QLabel(tr("Foreground:"));
+ m_foregroundLabel = new QLabel(Tr::tr("Foreground:"));
m_foregroundToolButton = colorButton();
- m_eraseForegroundToolButton = unsetButton(tr("Unset foreground."));
- m_backgroundLabel = new QLabel(tr("Background:"));
+ m_eraseForegroundToolButton = unsetButton(Tr::tr("Unset foreground."));
+ m_backgroundLabel = new QLabel(Tr::tr("Background:"));
m_backgroundToolButton = colorButton();
- m_eraseBackgroundToolButton = unsetButton(tr("Unset background."));
+ m_eraseBackgroundToolButton = unsetButton(Tr::tr("Unset background."));
- m_relativeForegroundHeadline = headlineLabel(tr("Relative Foreground"));
- m_foregroundSaturationLabel = new QLabel(tr("Saturation:"));
+ m_relativeForegroundHeadline = headlineLabel(Tr::tr("Relative Foreground"));
+ m_foregroundSaturationLabel = new QLabel(Tr::tr("Saturation:"));
m_foregroundSaturationSpinBox = spinBox();
- m_foregroundLightnessLabel = new QLabel(tr("Lightness:"));
+ m_foregroundLightnessLabel = new QLabel(Tr::tr("Lightness:"));
m_foregroundLightnessSpinBox = spinBox();
- m_relativeBackgroundHeadline = headlineLabel(tr("Relative Background"));
- m_backgroundSaturationLabel = new QLabel(tr("Saturation:"));
+ m_relativeBackgroundHeadline = headlineLabel(Tr::tr("Relative Background"));
+ m_backgroundSaturationLabel = new QLabel(Tr::tr("Saturation:"));
m_backgroundSaturationSpinBox = spinBox();
- m_backgroundLightnessLabel = new QLabel(tr("Lightness:"));
+ m_backgroundLightnessLabel = new QLabel(Tr::tr("Lightness:"));
m_backgroundLightnessSpinBox = spinBox();
- m_fontHeadline = headlineLabel(tr("Font"));
- m_boldCheckBox = new QCheckBox(tr("Bold"));
- m_italicCheckBox = new QCheckBox(tr("Italic"));
+ m_fontHeadline = headlineLabel(Tr::tr("Font"));
+ m_boldCheckBox = new QCheckBox(Tr::tr("Bold"));
+ m_italicCheckBox = new QCheckBox(Tr::tr("Italic"));
- m_underlineHeadline = headlineLabel(tr("Underline"));
- m_underlineLabel = new QLabel(tr("Color:"));
+ m_underlineHeadline = headlineLabel(Tr::tr("Underline"));
+ m_underlineLabel = new QLabel(Tr::tr("Color:"));
m_underlineColorToolButton = colorButton();
- m_eraseUnderlineColorToolButton = unsetButton(tr("Unset background."));
+ m_eraseUnderlineColorToolButton = unsetButton(Tr::tr("Unset background."));
m_underlineComboBox = new QComboBox;
m_itemList->setModel(m_formatsModel);
@@ -685,19 +687,19 @@ void ColorSchemeEdit::setItemListBackground(const QColor &color)
void ColorSchemeEdit::populateUnderlineStyleComboBox()
{
- m_underlineComboBox->addItem(tr("No Underline"),
+ m_underlineComboBox->addItem(Tr::tr("No Underline"),
QVariant::fromValue(int(QTextCharFormat::NoUnderline)));
- m_underlineComboBox->addItem(tr("Single Underline"),
+ m_underlineComboBox->addItem(Tr::tr("Single Underline"),
QVariant::fromValue(int(QTextCharFormat::SingleUnderline)));
- m_underlineComboBox->addItem(tr("Wave Underline"),
+ m_underlineComboBox->addItem(Tr::tr("Wave Underline"),
QVariant::fromValue(int(QTextCharFormat::WaveUnderline)));
- m_underlineComboBox->addItem(tr("Dot Underline"),
+ m_underlineComboBox->addItem(Tr::tr("Dot Underline"),
QVariant::fromValue(int(QTextCharFormat::DotLine)));
- m_underlineComboBox->addItem(tr("Dash Underline"),
+ m_underlineComboBox->addItem(Tr::tr("Dash Underline"),
QVariant::fromValue(int(QTextCharFormat::DashUnderline)));
- m_underlineComboBox->addItem(tr("Dash-Dot Underline"),
+ m_underlineComboBox->addItem(Tr::tr("Dash-Dot Underline"),
QVariant::fromValue(int(QTextCharFormat::DashDotLine)));
- m_underlineComboBox->addItem(tr("Dash-Dot-Dot Underline"),
+ m_underlineComboBox->addItem(Tr::tr("Dash-Dot-Dot Underline"),
QVariant::fromValue(int(QTextCharFormat::DashDotDotLine)));
}
diff --git a/src/plugins/texteditor/completionsettingspage.cpp b/src/plugins/texteditor/completionsettingspage.cpp
index f3a09c57355..6187688e4e9 100644
--- a/src/plugins/texteditor/completionsettingspage.cpp
+++ b/src/plugins/texteditor/completionsettingspage.cpp
@@ -5,6 +5,7 @@
#include "texteditorsettings.h"
#include "texteditorconstants.h"
+#include "texteditortr.h"
#include
@@ -29,8 +30,6 @@ namespace Internal {
class CompletionSettingsPageWidget final : public Core::IOptionsPageWidget
{
- Q_DECLARE_TR_FUNCTIONS(TextEditor::Internal::CompletionSettingsPage)
-
public:
explicit CompletionSettingsPageWidget(CompletionSettingsPage *owner);
@@ -70,97 +69,97 @@ CompletionSettingsPageWidget::CompletionSettingsPageWidget(CompletionSettingsPag
resize(823, 756);
m_caseSensitivity = new QComboBox;
- m_caseSensitivity->addItem(tr("Full"));
- m_caseSensitivity->addItem(tr("None"));
- m_caseSensitivity->addItem(tr("First Letter"));
+ m_caseSensitivity->addItem(Tr::tr("Full"));
+ m_caseSensitivity->addItem(Tr::tr("None"));
+ m_caseSensitivity->addItem(Tr::tr("First Letter"));
- auto caseSensitivityLabel = new QLabel(tr("&Case-sensitivity:"));
+ auto caseSensitivityLabel = new QLabel(Tr::tr("&Case-sensitivity:"));
caseSensitivityLabel->setBuddy(m_caseSensitivity);
m_completionTrigger = new QComboBox;
- m_completionTrigger->addItem(tr("Manually"));
- m_completionTrigger->addItem(tr("When Triggered"));
- m_completionTrigger->addItem(tr("Always"));
+ m_completionTrigger->addItem(Tr::tr("Manually"));
+ m_completionTrigger->addItem(Tr::tr("When Triggered"));
+ m_completionTrigger->addItem(Tr::tr("Always"));
- auto completionTriggerLabel = new QLabel(tr("Activate completion:"));
+ auto completionTriggerLabel = new QLabel(Tr::tr("Activate completion:"));
- auto automaticProposalTimeoutLabel = new QLabel(tr("Timeout in ms:"));
+ auto automaticProposalTimeoutLabel = new QLabel(Tr::tr("Timeout in ms:"));
m_automaticProposalTimeoutSpinBox = new QSpinBox;
m_automaticProposalTimeoutSpinBox->setMaximum(2000);
m_automaticProposalTimeoutSpinBox->setSingleStep(50);
m_automaticProposalTimeoutSpinBox->setValue(400);
- auto thresholdLabel = new QLabel(tr("Character threshold:"));
+ auto thresholdLabel = new QLabel(Tr::tr("Character threshold:"));
m_thresholdSpinBox = new QSpinBox;
m_thresholdSpinBox->setMinimum(1);
- m_partiallyComplete = new QCheckBox(tr("Autocomplete common &prefix"));
- m_partiallyComplete->setToolTip(tr("Inserts the common prefix of available completion items."));
+ m_partiallyComplete = new QCheckBox(Tr::tr("Autocomplete common &prefix"));
+ m_partiallyComplete->setToolTip(Tr::tr("Inserts the common prefix of available completion items."));
m_partiallyComplete->setChecked(true);
- m_autoSplitStrings = new QCheckBox(tr("Automatically split strings"));
+ m_autoSplitStrings = new QCheckBox(Tr::tr("Automatically split strings"));
m_autoSplitStrings->setToolTip(
- tr("Splits a string into two lines by adding an end quote at the cursor position "
+ Tr::tr("Splits a string into two lines by adding an end quote at the cursor position "
"when you press Enter and a start quote to the next line, before the rest "
"of the string.\n\n"
"In addition, Shift+Enter inserts an escape character at the cursor position "
"and moves the rest of the string to the next line."));
- m_insertBrackets = new QCheckBox(tr("Insert opening or closing brackets"));
+ m_insertBrackets = new QCheckBox(Tr::tr("Insert opening or closing brackets"));
m_insertBrackets->setChecked(true);
- m_insertQuotes = new QCheckBox(tr("Insert closing quote"));
+ m_insertQuotes = new QCheckBox(Tr::tr("Insert closing quote"));
m_insertQuotes->setChecked(true);
- m_surroundBrackets = new QCheckBox(tr("Surround text selection with brackets"));
+ m_surroundBrackets = new QCheckBox(Tr::tr("Surround text selection with brackets"));
m_surroundBrackets->setChecked(true);
m_surroundBrackets->setToolTip(
- tr("When typing a matching bracket and there is a text selection, instead of "
+ Tr::tr("When typing a matching bracket and there is a text selection, instead of "
"removing the selection, surrounds it with the corresponding characters."));
- m_spaceAfterFunctionName = new QCheckBox(tr("Insert &space after function name"));
+ m_spaceAfterFunctionName = new QCheckBox(Tr::tr("Insert &space after function name"));
m_spaceAfterFunctionName->setEnabled(true);
- m_surroundQuotes = new QCheckBox(tr("Surround text selection with quotes"));
+ m_surroundQuotes = new QCheckBox(Tr::tr("Surround text selection with quotes"));
m_surroundQuotes->setChecked(true);
m_surroundQuotes->setToolTip(
- tr("When typing a matching quote and there is a text selection, instead of "
+ Tr::tr("When typing a matching quote and there is a text selection, instead of "
"removing the selection, surrounds it with the corresponding characters."));
- m_animateAutoComplete = new QCheckBox(tr("Animate automatically inserted text"));
+ m_animateAutoComplete = new QCheckBox(Tr::tr("Animate automatically inserted text"));
m_animateAutoComplete->setChecked(true);
- m_animateAutoComplete->setToolTip(tr("Show a visual hint when for example a brace or a quote "
+ m_animateAutoComplete->setToolTip(Tr::tr("Show a visual hint when for example a brace or a quote "
"is automatically inserted by the editor."));
- m_highlightAutoComplete = new QCheckBox(tr("Highlight automatically inserted text"));
+ m_highlightAutoComplete = new QCheckBox(Tr::tr("Highlight automatically inserted text"));
m_highlightAutoComplete->setChecked(true);
- m_skipAutoComplete = new QCheckBox(tr("Skip automatically inserted character when typing"));
- m_skipAutoComplete->setToolTip(tr("Skip automatically inserted character if re-typed manually "
+ m_skipAutoComplete = new QCheckBox(Tr::tr("Skip automatically inserted character when typing"));
+ m_skipAutoComplete->setToolTip(Tr::tr("Skip automatically inserted character if re-typed manually "
"after completion or by pressing tab."));
m_skipAutoComplete->setChecked(true);
- m_removeAutoComplete = new QCheckBox(tr("Remove automatically inserted text on backspace"));
+ m_removeAutoComplete = new QCheckBox(Tr::tr("Remove automatically inserted text on backspace"));
m_removeAutoComplete->setChecked(true);
- m_removeAutoComplete->setToolTip(tr("Remove the automatically inserted character if the trigger "
+ m_removeAutoComplete->setToolTip(Tr::tr("Remove the automatically inserted character if the trigger "
"is deleted by backspace after the completion."));
- m_overwriteClosingChars = new QCheckBox(tr("Overwrite closing punctuation"));
- m_overwriteClosingChars->setToolTip(tr("Automatically overwrite closing parentheses and quotes."));
+ m_overwriteClosingChars = new QCheckBox(Tr::tr("Overwrite closing punctuation"));
+ m_overwriteClosingChars->setToolTip(Tr::tr("Automatically overwrite closing parentheses and quotes."));
- m_enableDoxygenCheckBox = new QCheckBox(tr("Enable Doxygen blocks"));
- m_enableDoxygenCheckBox->setToolTip(tr("Automatically creates a Doxygen comment upon pressing "
+ m_enableDoxygenCheckBox = new QCheckBox(Tr::tr("Enable Doxygen blocks"));
+ m_enableDoxygenCheckBox->setToolTip(Tr::tr("Automatically creates a Doxygen comment upon pressing "
"enter after a '/**', '/*!', '//!' or '///'."));
- m_generateBriefCheckBox = new QCheckBox(tr("Generate brief description"));
- m_generateBriefCheckBox->setToolTip(tr("Generates a brief command with an initial "
+ m_generateBriefCheckBox = new QCheckBox(Tr::tr("Generate brief description"));
+ m_generateBriefCheckBox->setToolTip(Tr::tr("Generates a brief command with an initial "
"description for the corresponding declaration."));
- m_leadingAsterisksCheckBox = new QCheckBox(tr("Add leading asterisks"));
+ m_leadingAsterisksCheckBox = new QCheckBox(Tr::tr("Add leading asterisks"));
m_leadingAsterisksCheckBox->setToolTip(
- tr("Adds leading asterisks when continuing C/C++ \"/*\", Qt \"/*!\" "
+ Tr::tr("Adds leading asterisks when continuing C/C++ \"/*\", Qt \"/*!\" "
"and Java \"/**\" style comments on new lines."));
connect(m_completionTrigger, &QComboBox::currentIndexChanged,
@@ -227,7 +226,7 @@ CompletionSettingsPageWidget::CompletionSettingsPageWidget(CompletionSettingsPag
Column {
Group {
- title(tr("Behavior")),
+ title(Tr::tr("Behavior")),
Form {
caseSensitivityLabel, m_caseSensitivity, st, br,
completionTriggerLabel, m_completionTrigger, st, br,
@@ -238,7 +237,7 @@ CompletionSettingsPageWidget::CompletionSettingsPageWidget(CompletionSettingsPag
}
},
Group {
- title(tr("&Automatically insert matching characters")),
+ title(Tr::tr("&Automatically insert matching characters")),
Row {
Column {
m_insertBrackets,
@@ -258,7 +257,7 @@ CompletionSettingsPageWidget::CompletionSettingsPageWidget(CompletionSettingsPag
}
},
Group {
- title(tr("Documentation Comments")),
+ title(Tr::tr("Documentation Comments")),
Column {
m_enableDoxygenCheckBox,
indent(m_generateBriefCheckBox),
@@ -356,9 +355,9 @@ const CommentsSettings &CompletionSettingsPage::commentsSettings() const
CompletionSettingsPage::CompletionSettingsPage()
{
setId("P.Completion");
- setDisplayName(CompletionSettingsPageWidget::tr("Completion"));
+ setDisplayName(Tr::tr("Completion"));
setCategory(TextEditor::Constants::TEXT_EDITOR_SETTINGS_CATEGORY);
- setDisplayCategory(QCoreApplication::translate("::TextEditor", "Text Editor"));
+ setDisplayCategory(Tr::tr("Text Editor"));
setCategoryIconPath(TextEditor::Constants::TEXT_EDITOR_SETTINGS_CATEGORY_ICON_PATH);
setWidgetCreator([this] { return new CompletionSettingsPageWidget(this); });
diff --git a/src/plugins/texteditor/displaysettingspage.cpp b/src/plugins/texteditor/displaysettingspage.cpp
index fc48e226846..58f9e04068d 100644
--- a/src/plugins/texteditor/displaysettingspage.cpp
+++ b/src/plugins/texteditor/displaysettingspage.cpp
@@ -7,10 +7,10 @@
#include "marginsettings.h"
#include "texteditorconstants.h"
#include "texteditorsettings.h"
+#include "texteditortr.h"
#include
-
#include
#include
@@ -39,17 +39,15 @@ DisplaySettingsPagePrivate::DisplaySettingsPagePrivate()
class DisplaySettingsWidget final : public Core::IOptionsPageWidget
{
- Q_DECLARE_TR_FUNCTIONS(TextEditor::DisplaySettingsPage)
-
public:
DisplaySettingsWidget(DisplaySettingsPagePrivate *data)
: m_data(data)
{
resize(452, 458);
- enableTextWrapping = new QCheckBox(tr("Enable text &wrapping"));
+ enableTextWrapping = new QCheckBox(Tr::tr("Enable text &wrapping"));
- enableTextWrappingHintLabel = new QLabel(tr("Set font line spacing "
+ enableTextWrappingHintLabel = new QLabel(Tr::tr("Set font line spacing "
"to 100% to enable text wrapping option."));
fontSettingsPageLineSpacing = fontSettingsPageLineSpacingLink();
@@ -74,8 +72,8 @@ public:
Core::ICore::showOptionsDialog(Constants::TEXT_EDITOR_FONT_SETTINGS); } );
- showWrapColumn = new QCheckBox(tr("Display right &margin at column:"));
- tintMarginArea = new QCheckBox(tr("Tint whole margin area"));
+ showWrapColumn = new QCheckBox(Tr::tr("Display right &margin at column:"));
+ tintMarginArea = new QCheckBox(Tr::tr("Tint whole margin area"));
wrapColumn = new QSpinBox;
wrapColumn->setMaximum(999);
@@ -83,36 +81,36 @@ public:
connect(showWrapColumn, &QAbstractButton::toggled, wrapColumn, &QWidget::setEnabled);
connect(showWrapColumn, &QAbstractButton::toggled, tintMarginArea, &QWidget::setEnabled);
- useIndenter = new QCheckBox(tr("Use context-specific margin"));
- useIndenter->setToolTip(tr("If available, use a different margin. "
+ useIndenter = new QCheckBox(Tr::tr("Use context-specific margin"));
+ useIndenter->setToolTip(Tr::tr("If available, use a different margin. "
"For example, the ColumnLimit from the ClangFormat plugin."));
- animateMatchingParentheses = new QCheckBox(tr("&Animate matching parentheses"));
- scrollBarHighlights = new QCheckBox(tr("Highlight search results on the scrollbar"));
- displayLineNumbers = new QCheckBox(tr("Display line &numbers"));
- animateNavigationWithinFile = new QCheckBox(tr("Animate navigation within file"));
- highlightCurrentLine = new QCheckBox(tr("Highlight current &line"));
- highlightBlocks = new QCheckBox(tr("Highlight &blocks"));
- markTextChanges = new QCheckBox(tr("Mark &text changes"));
- autoFoldFirstComment = new QCheckBox(tr("Auto-fold first &comment"));
- displayFoldingMarkers = new QCheckBox(tr("Display &folding markers"));
- centerOnScroll = new QCheckBox(tr("Center &cursor on scroll"));
- visualizeIndent = new QCheckBox(tr("Visualize indent"));
- displayFileLineEnding = new QCheckBox(tr("Display file line ending"));
- displayFileEncoding = new QCheckBox(tr("Display file encoding"));
- openLinksInNextSplit = new QCheckBox(tr("Always open links in another split"));
- highlightMatchingParentheses = new QCheckBox(tr("&Highlight matching parentheses"));
+ animateMatchingParentheses = new QCheckBox(Tr::tr("&Animate matching parentheses"));
+ scrollBarHighlights = new QCheckBox(Tr::tr("Highlight search results on the scrollbar"));
+ displayLineNumbers = new QCheckBox(Tr::tr("Display line &numbers"));
+ animateNavigationWithinFile = new QCheckBox(Tr::tr("Animate navigation within file"));
+ highlightCurrentLine = new QCheckBox(Tr::tr("Highlight current &line"));
+ highlightBlocks = new QCheckBox(Tr::tr("Highlight &blocks"));
+ markTextChanges = new QCheckBox(Tr::tr("Mark &text changes"));
+ autoFoldFirstComment = new QCheckBox(Tr::tr("Auto-fold first &comment"));
+ displayFoldingMarkers = new QCheckBox(Tr::tr("Display &folding markers"));
+ centerOnScroll = new QCheckBox(Tr::tr("Center &cursor on scroll"));
+ visualizeIndent = new QCheckBox(Tr::tr("Visualize indent"));
+ displayFileLineEnding = new QCheckBox(Tr::tr("Display file line ending"));
+ displayFileEncoding = new QCheckBox(Tr::tr("Display file encoding"));
+ openLinksInNextSplit = new QCheckBox(Tr::tr("Always open links in another split"));
+ highlightMatchingParentheses = new QCheckBox(Tr::tr("&Highlight matching parentheses"));
- visualizeWhitespace = new QCheckBox(tr("&Visualize whitespace"));
- visualizeWhitespace->setToolTip(tr("Shows tabs and spaces."));
+ visualizeWhitespace = new QCheckBox(Tr::tr("&Visualize whitespace"));
+ visualizeWhitespace->setToolTip(Tr::tr("Shows tabs and spaces."));
- leftAligned = new QRadioButton(tr("Next to editor content"));
- atMargin = new QRadioButton(tr("Next to right margin"));
- rightAligned = new QRadioButton(tr("Aligned at right side"));
+ leftAligned = new QRadioButton(Tr::tr("Next to editor content"));
+ atMargin = new QRadioButton(Tr::tr("Next to right margin"));
+ rightAligned = new QRadioButton(Tr::tr("Aligned at right side"));
rightAligned->setChecked(true);
- betweenLines = new QRadioButton(tr("Between lines"));
+ betweenLines = new QRadioButton(Tr::tr("Between lines"));
- displayAnnotations = new QGroupBox(tr("Line annotations")),
+ displayAnnotations = new QGroupBox(Tr::tr("Line annotations")),
displayAnnotations->setCheckable(true);
using namespace Utils::Layouting;
@@ -126,21 +124,21 @@ public:
Column {
Group {
- title(tr("Margin")),
+ title(Tr::tr("Margin")),
Column {
Row { showWrapColumn, wrapColumn, st },
Row { useIndenter, tintMarginArea, st }
}
},
Group {
- title(tr("Wrapping")),
+ title(Tr::tr("Wrapping")),
Column {
enableTextWrapping,
Row { enableTextWrappingHintLabel, st}
}
},
Group {
- title(tr("Display")),
+ title(Tr::tr("Display")),
Row {
Column {
displayLineNumbers,
@@ -345,9 +343,9 @@ DisplaySettingsPage::DisplaySettingsPage()
: d(new DisplaySettingsPagePrivate)
{
setId(Constants::TEXT_EDITOR_DISPLAY_SETTINGS);
- setDisplayName(DisplaySettingsWidget::tr("Display"));
+ setDisplayName(Tr::tr("Display"));
setCategory(TextEditor::Constants::TEXT_EDITOR_SETTINGS_CATEGORY);
- setDisplayCategory(QCoreApplication::translate("::TextEditor", "Text Editor"));
+ setDisplayCategory(Tr::tr("Text Editor"));
setCategoryIconPath(TextEditor::Constants::TEXT_EDITOR_SETTINGS_CATEGORY_ICON_PATH);
setWidgetCreator([this] { return new DisplaySettingsWidget(d); });
}
diff --git a/src/plugins/texteditor/extraencodingsettings.cpp b/src/plugins/texteditor/extraencodingsettings.cpp
index 73e74350615..349d37a39ef 100644
--- a/src/plugins/texteditor/extraencodingsettings.cpp
+++ b/src/plugins/texteditor/extraencodingsettings.cpp
@@ -2,7 +2,9 @@
// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0
#include "extraencodingsettings.h"
+
#include "behaviorsettingswidget.h"
+#include "texteditortr.h"
#include
@@ -54,6 +56,5 @@ bool ExtraEncodingSettings::equals(const ExtraEncodingSettings &s) const
QStringList ExtraEncodingSettings::lineTerminationModeNames()
{
- return {BehaviorSettingsWidget::tr("Unix (LF)"),
- BehaviorSettingsWidget::tr("Windows (CRLF)")};
+ return {Tr::tr("Unix (LF)"), Tr::tr("Windows (CRLF)")};
}
diff --git a/src/plugins/texteditor/findincurrentfile.cpp b/src/plugins/texteditor/findincurrentfile.cpp
index 42c385c44c4..741225d31e7 100644
--- a/src/plugins/texteditor/findincurrentfile.cpp
+++ b/src/plugins/texteditor/findincurrentfile.cpp
@@ -2,18 +2,20 @@
// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0
#include "findincurrentfile.h"
-#include "textdocument.h"
-#include
-#include
+#include "textdocument.h"
+#include "texteditortr.h"
+
#include
#include
#include
+#include
+#include
+
#include
-using namespace TextEditor;
-using namespace TextEditor::Internal;
+namespace TextEditor::Internal {
FindInCurrentFile::FindInCurrentFile()
{
@@ -29,7 +31,7 @@ QString FindInCurrentFile::id() const
QString FindInCurrentFile::displayName() const
{
- return tr("Current File");
+ return Tr::tr("Current File");
}
Utils::FileIterator *FindInCurrentFile::files(const QStringList &nameFilters,
@@ -54,13 +56,13 @@ QVariant FindInCurrentFile::additionalParameters() const
QString FindInCurrentFile::label() const
{
- return tr("File \"%1\":").arg(m_currentDocument->filePath().fileName());
+ return Tr::tr("File \"%1\":").arg(m_currentDocument->filePath().fileName());
}
QString FindInCurrentFile::toolTip() const
{
// %2 is filled by BaseFileFind::runNewSearch
- return tr("File path: %1\n%2").arg(m_currentDocument->filePath().toUserOutput());
+ return Tr::tr("File path: %1\n%2").arg(m_currentDocument->filePath().toUserOutput());
}
bool FindInCurrentFile::isEnabled() const
@@ -96,3 +98,5 @@ void FindInCurrentFile::readSettings(QSettings *settings)
readCommonSettings(settings, "*", "");
settings->endGroup();
}
+
+} // TextEditor::Internal
diff --git a/src/plugins/texteditor/findinfiles.cpp b/src/plugins/texteditor/findinfiles.cpp
index e19c5fe8b2d..2f379014dbb 100644
--- a/src/plugins/texteditor/findinfiles.cpp
+++ b/src/plugins/texteditor/findinfiles.cpp
@@ -3,6 +3,8 @@
#include "findinfiles.h"
+#include "texteditortr.h"
+
#include
#include
#include
@@ -25,9 +27,10 @@
#include
using namespace Core;
-using namespace TextEditor;
using namespace Utils;
+namespace TextEditor {
+
static FindInFiles *m_instance = nullptr;
static const char HistoryKey[] = "FindInFiles.Directories.History";
@@ -52,7 +55,7 @@ QString FindInFiles::id() const
QString FindInFiles::displayName() const
{
- return tr("Files in File System");
+ return Tr::tr("Files in File System");
}
FileIterator *FindInFiles::files(const QStringList &nameFilters,
@@ -77,7 +80,7 @@ QString FindInFiles::label() const
const QChar slash = QLatin1Char('/');
const QStringList &nonEmptyComponents = path().toFileInfo().absoluteFilePath()
.split(slash, Qt::SkipEmptyParts);
- return tr("%1 \"%2\":")
+ return Tr::tr("%1 \"%2\":")
.arg(title)
.arg(nonEmptyComponents.isEmpty() ? QString(slash) : nonEmptyComponents.last());
}
@@ -85,7 +88,7 @@ QString FindInFiles::label() const
QString FindInFiles::toolTip() const
{
//: the last arg is filled by BaseFileFind::runNewSearch
- QString tooltip = tr("Path: %1\nFilter: %2\nExcluding: %3\n%4")
+ QString tooltip = Tr::tr("Path: %1\nFilter: %2\nExcluding: %3\n%4")
.arg(path().toUserOutput())
.arg(fileNameFilters().join(','))
.arg(fileExclusionFilters().join(','));
@@ -128,7 +131,7 @@ QWidget *FindInFiles::createConfigWidget()
m_configWidget->setLayout(gridLayout);
int row = 0;
- auto searchEngineLabel = new QLabel(tr("Search engine:"));
+ auto searchEngineLabel = new QLabel(Tr::tr("Search engine:"));
gridLayout->addWidget(searchEngineLabel, row, 0, Qt::AlignRight);
m_searchEngineCombo = new QComboBox;
connect(m_searchEngineCombo, &QComboBox::currentIndexChanged,
@@ -144,11 +147,11 @@ QWidget *FindInFiles::createConfigWidget()
}
gridLayout->addWidget(m_searchEngineWidget, row++, 2);
- QLabel *dirLabel = new QLabel(tr("Director&y:"));
+ QLabel *dirLabel = new QLabel(Tr::tr("Director&y:"));
gridLayout->addWidget(dirLabel, row, 0, Qt::AlignRight);
m_directory = new PathChooser;
m_directory->setExpectedKind(PathChooser::ExistingDirectory);
- m_directory->setPromptDialogTitle(tr("Directory to Search"));
+ m_directory->setPromptDialogTitle(Tr::tr("Directory to Search"));
connect(m_directory.data(), &PathChooser::textChanged, this,
[this] { pathChanged(m_directory->filePath()); });
m_directory->setHistoryCompleter(QLatin1String(HistoryKey),
@@ -231,3 +234,5 @@ FindInFiles *FindInFiles::instance()
{
return m_instance;
}
+
+} // TextEditor
diff --git a/src/plugins/texteditor/findinopenfiles.cpp b/src/plugins/texteditor/findinopenfiles.cpp
index 04bd2ca707e..12fb45eb3c9 100644
--- a/src/plugins/texteditor/findinopenfiles.cpp
+++ b/src/plugins/texteditor/findinopenfiles.cpp
@@ -2,17 +2,19 @@
// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0
#include "findinopenfiles.h"
-#include "textdocument.h"
-#include
+#include "textdocument.h"
+#include "texteditortr.h"
+
#include
#include
#include
+#include
+
#include
-using namespace TextEditor;
-using namespace TextEditor::Internal;
+namespace TextEditor::Internal {
FindInOpenFiles::FindInOpenFiles()
{
@@ -29,7 +31,7 @@ QString FindInOpenFiles::id() const
QString FindInOpenFiles::displayName() const
{
- return tr("Open Documents");
+ return Tr::tr("Open Documents");
}
Utils::FileIterator *FindInOpenFiles::files(const QStringList &nameFilters,
@@ -65,13 +67,13 @@ QVariant FindInOpenFiles::additionalParameters() const
QString FindInOpenFiles::label() const
{
- return tr("Open documents:");
+ return Tr::tr("Open documents:");
}
QString FindInOpenFiles::toolTip() const
{
// %1 is filled by BaseFileFind::runNewSearch
- return tr("Open Documents\n%1");
+ return Tr::tr("Open Documents\n%1");
}
bool FindInOpenFiles::isEnabled() const
@@ -97,3 +99,5 @@ void FindInOpenFiles::updateEnabledState()
{
emit enabledChanged(isEnabled());
}
+
+} // TextEditor::Internal
diff --git a/src/plugins/texteditor/fontsettings.cpp b/src/plugins/texteditor/fontsettings.cpp
index 8434ab0b896..d5f2ddc6666 100644
--- a/src/plugins/texteditor/fontsettings.cpp
+++ b/src/plugins/texteditor/fontsettings.cpp
@@ -2,7 +2,9 @@
// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0
#include "fontsettings.h"
+
#include "fontsettingspage.h"
+#include "texteditortr.h"
#include
#include
@@ -158,10 +160,8 @@ QTextCharFormat FontSettings::toTextCharFormat(TextStyle category) const
tf.setFontStyleStrategy(m_antialias ? QFont::PreferAntialias : QFont::NoAntialias);
}
- if (category == C_OCCURRENCES_UNUSED) {
- tf.setToolTip(QCoreApplication::translate("FontSettings_C_OCCURRENCES_UNUSED",
- "Unused variable"));
- }
+ if (category == C_OCCURRENCES_UNUSED)
+ tf.setToolTip(Tr::tr("Unused variable"));
if (f.foreground().isValid() && !isOverlayCategory(category))
tf.setForeground(f.foreground());
diff --git a/src/plugins/texteditor/fontsettingspage.cpp b/src/plugins/texteditor/fontsettingspage.cpp
index cad2aa6f0f3..1e9ec7fafba 100644
--- a/src/plugins/texteditor/fontsettingspage.cpp
+++ b/src/plugins/texteditor/fontsettingspage.cpp
@@ -6,6 +6,7 @@
#include "colorschemeedit.h"
#include "fontsettings.h"
#include "texteditorsettings.h"
+#include "texteditortr.h"
#include
@@ -18,28 +19,24 @@
#include
#include
+#include
+#include
#include
#include
+#include
#include
+#include
#include
+#include
#include
#include
#include
+#include
#include
+#include
+#include
#include
-#include
-#include
-#include
-#include
-#include
-#include
-#include
-#include
-#include
-#include
-#include
-
using namespace TextEditor::Internal;
using namespace Utils;
@@ -102,8 +99,6 @@ private:
class FontSettingsPageWidget : public Core::IOptionsPageWidget
{
- Q_DECLARE_TR_FUNCTIONS(TextEditor::FontSettingsPageWidget)
-
public:
FontSettingsPageWidget(FontSettingsPage *q, const FormatDescriptions &fd, FontSettings *fontSettings)
: q(q),
@@ -114,24 +109,24 @@ public:
resize(639, 306);
- m_antialias = new QCheckBox(tr("Antialias"));
+ m_antialias = new QCheckBox(Tr::tr("Antialias"));
m_antialias->setChecked(m_value.antialias());
m_zoomSpinBox = new QSpinBox;
- m_zoomSpinBox->setSuffix(tr("%"));
+ m_zoomSpinBox->setSuffix(Tr::tr("%"));
m_zoomSpinBox->setRange(10, 3000);
m_zoomSpinBox->setSingleStep(10);
m_zoomSpinBox->setValue(m_value.fontZoom());
m_lineSpacingSpinBox = new QSpinBox;
m_lineSpacingSpinBox->setObjectName(QLatin1String("FontSettingsPage.LineSpacingSpinBox"));
- m_lineSpacingSpinBox->setSuffix(tr("%"));
+ m_lineSpacingSpinBox->setSuffix(Tr::tr("%"));
m_lineSpacingSpinBox->setRange(50, 3000);
m_lineSpacingSpinBox->setValue(m_value.relativeLineSpacing());
m_lineSpacingWarningLabel = new QLabel;
m_lineSpacingWarningLabel->setPixmap(Utils::Icons::WARNING.pixmap());
- m_lineSpacingWarningLabel->setToolTip(tr("A line spacing value other than 100% disables "
+ m_lineSpacingWarningLabel->setToolTip(Tr::tr("A line spacing value other than 100% disables "
"text wrapping.\nA value less than 100% can result "
"in overlapping and misaligned graphics."));
m_lineSpacingWarningLabel->setVisible(m_value.relativeLineSpacing() != 100);
@@ -145,13 +140,13 @@ public:
sizeValidator->setBottom(0);
m_sizeComboBox->setValidator(sizeValidator);
- m_copyButton = new QPushButton(tr("Copy..."));
+ m_copyButton = new QPushButton(Tr::tr("Copy..."));
- m_deleteButton = new QPushButton(tr("Delete"));
+ m_deleteButton = new QPushButton(Tr::tr("Delete"));
m_deleteButton->setEnabled(false);
- auto importButton = new QPushButton(tr("Import"));
- auto exportButton = new QPushButton(tr("Export"));
+ auto importButton = new QPushButton(Tr::tr("Import"));
+ auto exportButton = new QPushButton(Tr::tr("Export"));
m_schemeComboBox = new QComboBox;
m_schemeComboBox->setModel(&m_schemeListModel);
@@ -166,19 +161,19 @@ public:
Column {
Group {
- title(tr("Font")),
+ title(Tr::tr("Font")),
Column {
Row {
- tr("Family:"), m_fontComboBox, Space(20),
- tr("Size:"), m_sizeComboBox, Space(20),
- tr("Zoom:"), m_zoomSpinBox, Space(20),
- tr("Line spacing:"), m_lineSpacingSpinBox, m_lineSpacingWarningLabel, st
+ Tr::tr("Family:"), m_fontComboBox, Space(20),
+ Tr::tr("Size:"), m_sizeComboBox, Space(20),
+ Tr::tr("Zoom:"), m_zoomSpinBox, Space(20),
+ Tr::tr("Line spacing:"), m_lineSpacingSpinBox, m_lineSpacingWarningLabel, st
},
m_antialias
}
},
Group {
- title(tr("Color Scheme for Theme \"%1\"")
+ title(Tr::tr("Color Scheme for Theme \"%1\"")
.arg(Utils::creatorTheme()->displayName())),
Column {
Row { m_schemeComboBox, m_copyButton, m_deleteButton, importButton, exportButton },
@@ -525,9 +520,9 @@ void FontSettingsPageWidget::openCopyColorSchemeDialog()
QInputDialog *dialog = new QInputDialog(m_copyButton->window());
dialog->setAttribute(Qt::WA_DeleteOnClose);
dialog->setInputMode(QInputDialog::TextInput);
- dialog->setWindowTitle(tr("Copy Color Scheme"));
- dialog->setLabelText(tr("Color scheme name:"));
- dialog->setTextValue(tr("%1 (copy)").arg(m_value.colorScheme().displayName()));
+ dialog->setWindowTitle(Tr::tr("Copy Color Scheme"));
+ dialog->setLabelText(Tr::tr("Color scheme name:"));
+ dialog->setTextValue(Tr::tr("%1 (copy)").arg(m_value.colorScheme().displayName()));
connect(dialog, &QInputDialog::textValueSelected, this, &FontSettingsPageWidget::copyColorScheme);
dialog->open();
@@ -572,14 +567,14 @@ void FontSettingsPageWidget::confirmDeleteColorScheme()
return;
QMessageBox *messageBox = new QMessageBox(QMessageBox::Warning,
- tr("Delete Color Scheme"),
- tr("Are you sure you want to delete this color scheme permanently?"),
+ Tr::tr("Delete Color Scheme"),
+ Tr::tr("Are you sure you want to delete this color scheme permanently?"),
QMessageBox::Discard | QMessageBox::Cancel,
m_deleteButton->window());
// Change the text and role of the discard button
auto deleteButton = static_cast(messageBox->button(QMessageBox::Discard));
- deleteButton->setText(tr("Delete"));
+ deleteButton->setText(Tr::tr("Delete"));
messageBox->addButton(deleteButton, QMessageBox::AcceptRole);
messageBox->setDefaultButton(deleteButton);
@@ -604,9 +599,9 @@ void FontSettingsPageWidget::importScheme()
{
const FilePath importedFile
= Utils::FileUtils::getOpenFilePath(this,
- tr("Import Color Scheme"),
+ Tr::tr("Import Color Scheme"),
{},
- tr("Color scheme (*.xml);;All files (*)"));
+ Tr::tr("Color scheme (*.xml);;All files (*)"));
if (importedFile.isEmpty())
return;
@@ -617,8 +612,8 @@ void FontSettingsPageWidget::importScheme()
QInputDialog *dialog = new QInputDialog(m_copyButton->window());
dialog->setAttribute(Qt::WA_DeleteOnClose);
dialog->setInputMode(QInputDialog::TextInput);
- dialog->setWindowTitle(tr("Import Color Scheme"));
- dialog->setLabelText(tr("Color scheme name:"));
+ dialog->setWindowTitle(Tr::tr("Import Color Scheme"));
+ dialog->setLabelText(Tr::tr("Color scheme name:"));
dialog->setTextValue(importedFile.baseName());
connect(dialog,
@@ -653,9 +648,9 @@ void FontSettingsPageWidget::exportScheme()
const FilePath filePath
= Utils::FileUtils::getSaveFilePath(this,
- tr("Export Color Scheme"),
+ Tr::tr("Export Color Scheme"),
entry.filePath,
- tr("Color scheme (*.xml);;All files (*)"));
+ Tr::tr("Color scheme (*.xml);;All files (*)"));
if (!filePath.isEmpty())
m_value.colorScheme().save(filePath, Core::ICore::dialogParent());
@@ -668,15 +663,15 @@ void FontSettingsPageWidget::maybeSaveColorScheme()
QMessageBox
messageBox(QMessageBox::Warning,
- tr("Color Scheme Changed"),
- tr("The color scheme \"%1\" was modified, do you want to save the changes?")
+ Tr::tr("Color Scheme Changed"),
+ Tr::tr("The color scheme \"%1\" was modified, do you want to save the changes?")
.arg(m_schemeEdit->colorScheme().displayName()),
QMessageBox::Discard | QMessageBox::Save,
m_schemeComboBox->window());
// Change the text of the discard button
auto discardButton = static_cast(messageBox.button(QMessageBox::Discard));
- discardButton->setText(tr("Discard"));
+ discardButton->setText(Tr::tr("Discard"));
messageBox.addButton(discardButton, QMessageBox::DestructiveRole);
messageBox.setDefaultButton(QMessageBox::Save);
@@ -775,9 +770,9 @@ FontSettingsPage::FontSettingsPage(FontSettings *fontSettings, const FormatDescr
fontSettings->loadColorScheme(FontSettings::defaultSchemeFileName(), fd);
setId(Constants::TEXT_EDITOR_FONT_SETTINGS);
- setDisplayName(FontSettingsPageWidget::tr("Font && Colors"));
+ setDisplayName(Tr::tr("Font && Colors"));
setCategory(TextEditor::Constants::TEXT_EDITOR_SETTINGS_CATEGORY);
- setDisplayCategory(QCoreApplication::translate("::TextEditor", "Text Editor"));
+ setDisplayCategory(Tr::tr("Text Editor"));
setCategoryIconPath(TextEditor::Constants::TEXT_EDITOR_SETTINGS_CATEGORY_ICON_PATH);
setWidgetCreator([this, fontSettings, fd] { return new FontSettingsPageWidget(this, fd, fontSettings); });
}
diff --git a/src/plugins/texteditor/highlighter.cpp b/src/plugins/texteditor/highlighter.cpp
index 898e058d421..a3765c4bf51 100644
--- a/src/plugins/texteditor/highlighter.cpp
+++ b/src/plugins/texteditor/highlighter.cpp
@@ -7,11 +7,13 @@
#include "tabsettings.h"
#include "textdocumentlayout.h"
#include "texteditor.h"
+#include "texteditortr.h"
#include "texteditorsettings.h"
#include
#include
#include
+
#include
#include
#include
@@ -229,7 +231,7 @@ void Highlighter::downloadDefinitions(std::function callback) {
auto downloader =
new KSyntaxHighlighting::DefinitionDownloader(highlightRepository());
connect(downloader, &KSyntaxHighlighting::DefinitionDownloader::done, [downloader, callback]() {
- Core::MessageManager::writeFlashing(tr("Highlighter updates: done"));
+ Core::MessageManager::writeFlashing(Tr::tr("Highlighter updates: done"));
downloader->deleteLater();
reload();
if (callback)
@@ -238,9 +240,9 @@ void Highlighter::downloadDefinitions(std::function callback) {
connect(downloader,
&KSyntaxHighlighting::DefinitionDownloader::informationMessage,
[](const QString &message) {
- Core::MessageManager::writeSilently(tr("Highlighter updates:") + ' ' + message);
+ Core::MessageManager::writeSilently(Tr::tr("Highlighter updates:") + ' ' + message);
});
- Core::MessageManager::writeDisrupting(tr("Highlighter updates: starting"));
+ Core::MessageManager::writeDisrupting(Tr::tr("Highlighter updates: starting"));
downloader->start();
}
diff --git a/src/plugins/texteditor/highlightersettingspage.cpp b/src/plugins/texteditor/highlightersettingspage.cpp
index 58a7cba73a1..ceb8f7d48f1 100644
--- a/src/plugins/texteditor/highlightersettingspage.cpp
+++ b/src/plugins/texteditor/highlightersettingspage.cpp
@@ -5,6 +5,7 @@
#include "highlightersettings.h"
#include "highlighter.h"
+#include "texteditortr.h"
#include
@@ -27,7 +28,6 @@ namespace Internal {
class HighlighterSettingsPageWidget : public QWidget
{
- Q_DECLARE_TR_FUNCTIONS(TextEditor::Internal::HighlighterSettingsPage)
public:
QLabel *definitionsInfolabel;
QPushButton *downloadDefinitions;
@@ -47,12 +47,12 @@ public:
definitionsInfolabel->setAlignment(Qt::AlignLeading|Qt::AlignLeft|Qt::AlignVCenter);
definitionsInfolabel->setWordWrap(true);
definitionsInfolabel->setOpenExternalLinks(true);
- definitionsInfolabel->setText(tr("Highlight definitions are provided by the "
- ""
- "KSyntaxHighlighting engine.
"));
+ definitionsInfolabel->setText(Tr::tr("Highlight definitions are provided by the "
+ ""
+ "KSyntaxHighlighting engine.
"));
- downloadDefinitions = new QPushButton(tr("Download Definitions"));
- downloadDefinitions->setToolTip(tr("Download missing and update existing syntax definition files."));
+ downloadDefinitions = new QPushButton(Tr::tr("Download Definitions"));
+ downloadDefinitions->setToolTip(Tr::tr("Download missing and update existing syntax definition files."));
updateStatus = new QLabel;
updateStatus->setObjectName("updateStatus");
@@ -61,12 +61,12 @@ public:
definitionFilesPath->setExpectedKind(PathChooser::ExistingDirectory);
definitionFilesPath->setHistoryCompleter("TextEditor.Highlighter.History");
- reloadDefinitions = new QPushButton(tr("Reload Definitions"));
- reloadDefinitions->setToolTip(tr("Reload externally modified definition files."));
+ reloadDefinitions = new QPushButton(Tr::tr("Reload Definitions"));
+ reloadDefinitions->setToolTip(Tr::tr("Reload externally modified definition files."));
- resetCache = new QPushButton(tr("Reset Remembered Definitions"));
- resetCache->setToolTip(tr("Reset definitions remembered for files that can be "
- "associated with more than one highlighter definition."));
+ resetCache = new QPushButton(Tr::tr("Reset Remembered Definitions"));
+ resetCache->setToolTip(Tr::tr("Reset definitions remembered for files that can be "
+ "associated with more than one highlighter definition."));
ignoreEdit = new QLineEdit;
@@ -75,15 +75,15 @@ public:
definitionsInfolabel,
Space(3),
Group {
- title(tr("Syntax Highlight Definition Files")),
+ title(Tr::tr("Syntax Highlight Definition Files")),
Column {
Row { downloadDefinitions, updateStatus, st },
- Row { tr("User Highlight Definition Files"),
+ Row { Tr::tr("User Highlight Definition Files"),
definitionFilesPath, reloadDefinitions },
Row { st, resetCache }
}
},
- Row { tr("Ignored file patterns:"), ignoreEdit },
+ Row { Tr::tr("Ignored file patterns:"), ignoreEdit },
st
}.attachTo(this);
@@ -91,7 +91,7 @@ public:
[label = QPointer(updateStatus)]() {
Highlighter::downloadDefinitions([label] {
if (label)
- label->setText(tr("Download finished"));
+ label->setText(Tr::tr("Download finished"));
});
});
@@ -110,8 +110,6 @@ using namespace Internal;
class HighlighterSettingsPagePrivate
{
- Q_DECLARE_TR_FUNCTIONS(TextEditor::Internal::HighlighterSettingsPage)
-
public:
HighlighterSettingsPagePrivate() = default;
@@ -156,9 +154,9 @@ HighlighterSettingsPage::HighlighterSettingsPage()
: d(new HighlighterSettingsPagePrivate)
{
setId(Constants::TEXT_EDITOR_HIGHLIGHTER_SETTINGS);
- setDisplayName(HighlighterSettingsPagePrivate::tr("Generic Highlighter"));
+ setDisplayName(Tr::tr("Generic Highlighter"));
setCategory(TextEditor::Constants::TEXT_EDITOR_SETTINGS_CATEGORY);
- setDisplayCategory(QCoreApplication::translate("::TextEditor", "Text Editor"));
+ setDisplayCategory(Tr::tr("Text Editor"));
setCategoryIconPath(TextEditor::Constants::TEXT_EDITOR_SETTINGS_CATEGORY_ICON_PATH);
}
diff --git a/src/plugins/texteditor/linenumberfilter.cpp b/src/plugins/texteditor/linenumberfilter.cpp
index 16b552143c2..78a65c84d2f 100644
--- a/src/plugins/texteditor/linenumberfilter.cpp
+++ b/src/plugins/texteditor/linenumberfilter.cpp
@@ -3,7 +3,7 @@
#include "linenumberfilter.h"
-#include "texteditor.h"
+#include "texteditortr.h"
#include
#include
@@ -18,16 +18,16 @@ using LineColumn = QPair;
Q_DECLARE_METATYPE(LineColumn)
using namespace Core;
-using namespace TextEditor;
-using namespace TextEditor::Internal;
+
+namespace TextEditor::Internal {
LineNumberFilter::LineNumberFilter(QObject *parent)
: ILocatorFilter(parent)
{
setId("Line in current document");
- setDisplayName(tr("Line in Current Document"));
- setDescription(tr("Jumps to the given line in the current document."));
- setDefaultSearchText(tr(":"));
+ setDisplayName(Tr::tr("Line in Current Document"));
+ setDescription(Tr::tr("Jumps to the given line in the current document."));
+ setDefaultSearchText(Tr::tr(":"));
setPriority(High);
setDefaultShortcutString("l");
setDefaultIncludedByDefault(true);
@@ -59,11 +59,11 @@ QList LineNumberFilter::matchesFor(QFutureInterface 0 && column > 0)
- text = tr("Line %1, Column %2").arg(line).arg(column);
+ text = Tr::tr("Line %1, Column %2").arg(line).arg(column);
else if (line > 0)
- text = tr("Line %1").arg(line);
+ text = Tr::tr("Line %1").arg(line);
else
- text = tr("Column %1").arg(column);
+ text = Tr::tr("Column %1").arg(column);
value.append(LocatorFilterEntry(this, text, QVariant::fromValue(data)));
}
return value;
@@ -85,3 +85,5 @@ void LineNumberFilter::accept(const LocatorFilterEntry &selection,
EditorManager::activateEditor(editor);
}
}
+
+} // TextEditor::Internal
diff --git a/src/plugins/texteditor/outlinefactory.cpp b/src/plugins/texteditor/outlinefactory.cpp
index 120adf42966..76222642c15 100644
--- a/src/plugins/texteditor/outlinefactory.cpp
+++ b/src/plugins/texteditor/outlinefactory.cpp
@@ -2,6 +2,9 @@
// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0
#include "outlinefactory.h"
+
+#include "texteditortr.h"
+
#include
#include
#include
@@ -10,11 +13,10 @@
#include
#include
-#include
+#include
#include
#include
-
-#include
+#include
namespace TextEditor {
@@ -43,7 +45,7 @@ OutlineWidgetStack::OutlineWidgetStack(OutlineFactory *factory) :
m_syncWithEditor(true),
m_sorted(false)
{
- QLabel *label = new QLabel(tr("No outline available"), this);
+ QLabel *label = new QLabel(Tr::tr("No outline available"), this);
label->setAlignment(Qt::AlignCenter);
// set background to be white
@@ -56,7 +58,7 @@ OutlineWidgetStack::OutlineWidgetStack(OutlineFactory *factory) :
m_toggleSync->setIcon(Utils::Icons::LINK_TOOLBAR.icon());
m_toggleSync->setCheckable(true);
m_toggleSync->setChecked(true);
- m_toggleSync->setToolTip(tr("Synchronize with Editor"));
+ m_toggleSync->setToolTip(Tr::tr("Synchronize with Editor"));
connect(m_toggleSync, &QAbstractButton::clicked,
this, &OutlineWidgetStack::toggleCursorSynchronization);
@@ -66,7 +68,7 @@ OutlineWidgetStack::OutlineWidgetStack(OutlineFactory *factory) :
// did not have a parent in that moment.
m_filterButton->setIcon(Utils::Icons::FILTER.icon());
- m_filterButton->setToolTip(tr("Filter tree"));
+ m_filterButton->setToolTip(Tr::tr("Filter tree"));
m_filterButton->setPopupMode(QToolButton::InstantPopup);
m_filterButton->setProperty("noArrow", true);
m_filterMenu = new QMenu(m_filterButton);
@@ -76,7 +78,7 @@ OutlineWidgetStack::OutlineWidgetStack(OutlineFactory *factory) :
m_toggleSort->setIcon(Utils::Icons::SORT_ALPHABETICALLY_TOOLBAR.icon());
m_toggleSort->setCheckable(true);
m_toggleSort->setChecked(false);
- m_toggleSort->setToolTip(tr("Sort Alphabetically"));
+ m_toggleSort->setToolTip(Tr::tr("Sort Alphabetically"));
connect(m_toggleSort, &QAbstractButton::clicked, this, &OutlineWidgetStack::toggleSort);
connect(Core::EditorManager::instance(), &Core::EditorManager::currentEditorChanged,
@@ -201,7 +203,7 @@ OutlineFactory::OutlineFactory()
{
QTC_CHECK(g_outlineFactory.isNull());
g_outlineFactory = this;
- setDisplayName(tr("Outline"));
+ setDisplayName(Tr::tr("Outline"));
setId("Outline");
setPriority(600);
}
diff --git a/src/plugins/texteditor/refactoringchanges.cpp b/src/plugins/texteditor/refactoringchanges.cpp
index a6b8e051e6b..ba55628423d 100644
--- a/src/plugins/texteditor/refactoringchanges.cpp
+++ b/src/plugins/texteditor/refactoringchanges.cpp
@@ -2,24 +2,24 @@
// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0
#include "refactoringchanges.h"
-#include "texteditor.h"
-#include "textdocument.h"
-#include
+#include "textdocument.h"
+#include "texteditor.h"
+#include "texteditortr.h"
+
#include
#include
#include
+#include
+
#include
#include
#include
-#include
-#include
#include
#include
#include
#include
-#include
using namespace Core;
using namespace Utils;
@@ -297,9 +297,7 @@ bool RefactoringFile::apply()
// test file permissions
if (!m_filePath.toFileInfo().isWritable()) {
ReadOnlyFilesDialog roDialog(m_filePath, ICore::dialogParent());
- const QString &failDetailText = QApplication::translate("RefactoringFile::apply",
- "Refactoring cannot be applied.");
- roDialog.setShowFailWarning(true, failDetailText);
+ roDialog.setShowFailWarning(true, Tr::tr("Refactoring cannot be applied."));
if (roDialog.exec() == ReadOnlyFilesDialog::RO_Cancel)
return false;
}
diff --git a/src/plugins/texteditor/snippets/snippet.cpp b/src/plugins/texteditor/snippets/snippet.cpp
index 71ec46c7c66..f41156c4cee 100644
--- a/src/plugins/texteditor/snippets/snippet.cpp
+++ b/src/plugins/texteditor/snippets/snippet.cpp
@@ -3,6 +3,8 @@
#include "snippet.h"
+#include "../texteditortr.h"
+
#include
#include
#include
@@ -10,7 +12,7 @@
#include
-using namespace TextEditor;
+namespace TextEditor {
const char UCMANGLER_ID[] = "TextEditor::UppercaseMangler";
const char LCMANGLER_ID[] = "TextEditor::LowercaseMangler";
@@ -221,7 +223,7 @@ SnippetParseResult Snippet::parse(const QString &snippet)
}
if (mangler) {
- return SnippetParseResult{SnippetParseError{tr("Expected delimiter after mangler ID."),
+ return SnippetParseResult{SnippetParseError{Tr::tr("Expected delimiter after mangler ID."),
preprocessedSnippet,
i}};
}
@@ -236,7 +238,7 @@ SnippetParseResult Snippet::parse(const QString &snippet)
mangler = &tcMangler;
} else {
return SnippetParseResult{
- SnippetParseError{tr("Expected mangler ID \"l\" (lowercase), \"u\" (uppercase), "
+ SnippetParseError{Tr::tr("Expected mangler ID \"l\" (lowercase), \"u\" (uppercase), "
"or \"c\" (titlecase) after colon."),
preprocessedSnippet,
i}};
@@ -259,7 +261,7 @@ SnippetParseResult Snippet::parse(const QString &snippet)
if (inVar) {
return SnippetParseResult{
- SnippetParseError{tr("Missing closing variable delimiter for:"), currentPart.text, 0}};
+ SnippetParseError{Tr::tr("Missing closing variable delimiter for:"), currentPart.text, 0}};
}
if (!currentPart.text.isEmpty())
@@ -268,6 +270,10 @@ SnippetParseResult Snippet::parse(const QString &snippet)
return SnippetParseResult(result);
}
+} // Texteditor
+
+using namespace TextEditor;
+
#ifdef WITH_TESTS
# include
diff --git a/src/plugins/texteditor/snippets/snippet.h b/src/plugins/texteditor/snippets/snippet.h
index 4dd5716946e..8fff9be4a18 100644
--- a/src/plugins/texteditor/snippets/snippet.h
+++ b/src/plugins/texteditor/snippets/snippet.h
@@ -16,7 +16,6 @@ namespace TextEditor {
class TEXTEDITOR_EXPORT Snippet
{
- Q_DECLARE_TR_FUNCTIONS(Snippet)
public:
explicit Snippet(const QString &groupId = QString(), const QString &id = QString());
~Snippet();
diff --git a/src/plugins/texteditor/snippets/snippetscollection.cpp b/src/plugins/texteditor/snippets/snippetscollection.cpp
index 3b6ba0bf95e..c9b148360b7 100644
--- a/src/plugins/texteditor/snippets/snippetscollection.cpp
+++ b/src/plugins/texteditor/snippets/snippetscollection.cpp
@@ -2,17 +2,19 @@
// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0
#include "snippetscollection.h"
+
#include "snippetprovider.h"
#include "reuse.h"
+#include "../texteditortr.h"
#include
+
#include
+
#include
#include
-#include
#include
-#include
#include
#include
#include
@@ -282,7 +284,7 @@ void SnippetsCollection::reload()
bool SnippetsCollection::synchronize(QString *errorString)
{
if (!m_userSnippetsFile.parentDir().ensureWritableDir()) {
- *errorString = tr("Cannot create user snippet directory %1")
+ *errorString = Tr::tr("Cannot create user snippet directory %1")
.arg(m_userSnippetsFile.parentDir().toUserOutput());
return false;
}
@@ -354,8 +356,7 @@ QList SnippetsCollection::readXML(const FilePath &fileName, const QStri
} else if (isGroupKnown(groupId) && (snippetId.isEmpty() || snippetId == id)) {
Snippet snippet(groupId, id);
snippet.setTrigger(trigger);
- snippet.setComplement(QCoreApplication::translate(
- "TextEditor::Internal::Snippets",
+ snippet.setComplement(QCoreApplication::translate("::TextEditor",
atts.value(kComplement).toString().toLatin1(),
atts.value(kId).toString().toLatin1()));
snippet.setIsRemoved(toBool(atts.value(kRemoved).toString()));
diff --git a/src/plugins/texteditor/snippets/snippetssettingspage.cpp b/src/plugins/texteditor/snippets/snippetssettingspage.cpp
index 18aac728b98..b64910a0f1d 100644
--- a/src/plugins/texteditor/snippets/snippetssettingspage.cpp
+++ b/src/plugins/texteditor/snippets/snippetssettingspage.cpp
@@ -2,18 +2,22 @@
// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0
#include "snippetssettingspage.h"
+
#include "snippeteditor.h"
#include "snippetprovider.h"
#include "snippet.h"
#include "snippetscollection.h"
#include "snippetssettings.h"
+#include "../fontsettings.h"
+#include "../textdocument.h"
+#include "../texteditorconstants.h"
+#include "../texteditorsettings.h"
+#include "../texteditortr.h"
#include
-#include
-#include
-#include
-#include
+
#include
+
#include
#include
#include
@@ -118,8 +122,8 @@ bool SnippetsTableModel::setData(const QModelIndex &modelIndex, const QVariant &
if (!Snippet::isValidTrigger(s)) {
QMessageBox::critical(
Core::ICore::dialogParent(),
- tr("Error"),
- tr("Not a valid trigger. A valid trigger can only contain letters, "
+ Tr::tr("Error"),
+ Tr::tr("Not a valid trigger. A valid trigger can only contain letters, "
"numbers, or underscores, where the first character is "
"limited to letter or underscore."));
if (snippet.trigger().isEmpty())
@@ -143,9 +147,9 @@ QVariant SnippetsTableModel::headerData(int section, Qt::Orientation orientation
return QVariant();
if (section == 0)
- return tr("Trigger");
+ return Tr::tr("Trigger");
else
- return tr("Trigger Variant");
+ return Tr::tr("Trigger Variant");
}
void SnippetsTableModel::load(const QString &groupId)
@@ -197,8 +201,8 @@ void SnippetsTableModel::revertBuitInSnippet(const QModelIndex &modelIndex)
{
const Snippet &snippet = m_collection->revertedSnippet(modelIndex.row(), m_activeGroupId);
if (snippet.id().isEmpty()) {
- QMessageBox::critical(Core::ICore::dialogParent(), tr("Error"),
- tr("Error reverting snippet."));
+ QMessageBox::critical(Core::ICore::dialogParent(), Tr::tr("Error"),
+ Tr::tr("Error reverting snippet."));
return;
}
replaceSnippet(snippet, modelIndex);
@@ -243,8 +247,6 @@ void SnippetsTableModel::replaceSnippet(const Snippet &snippet, const QModelInde
// SnippetsSettingsPagePrivate
class SnippetsSettingsPagePrivate : public QObject
{
- Q_DECLARE_TR_FUNCTIONS(TextEditor::Internal::SnippetsSettingsPage)
-
public:
SnippetsSettingsPagePrivate();
~SnippetsSettingsPagePrivate() override { delete m_model; }
@@ -321,7 +323,7 @@ void SnippetsSettingsPagePrivate::configureUi(QWidget *w)
m_snippetsTable->setRootIsDecorated(false);
m_snippetsTable->setModel(m_model);
- m_revertButton = new QPushButton(tr("Revert Built-in"));
+ m_revertButton = new QPushButton(Tr::tr("Revert Built-in"));
m_revertButton->setEnabled(false);
auto snippetSplitter = new QSplitter(Qt::Vertical);
@@ -332,18 +334,18 @@ void SnippetsSettingsPagePrivate::configureUi(QWidget *w)
using namespace Utils::Layouting;
Column {
- Row { tr("Group:"), m_groupCombo, st },
+ Row { Tr::tr("Group:"), m_groupCombo, st },
Row {
snippetSplitter,
Column {
- PushButton { text(tr("Add")),
+ PushButton { text(Tr::tr("Add")),
onClicked([this] { addSnippet(); }, this) },
- PushButton { text(tr("Remove")),
+ PushButton { text(Tr::tr("Remove")),
onClicked([this] { removeSnippet(); }, this) },
m_revertButton,
- PushButton { text(tr("Restore Removed Built-ins")),
+ PushButton { text(Tr::tr("Restore Removed Built-ins")),
onClicked([this] { restoreRemovedBuiltInSnippets(); }, this) },
- PushButton { text(tr("Reset All")),
+ PushButton { text(Tr::tr("Reset All")),
onClicked([this] { resetAllSnippets(); }, this) },
st,
}
@@ -395,7 +397,7 @@ void SnippetsSettingsPagePrivate::apply()
m_snippetsCollectionChanged = false;
} else {
QMessageBox::critical(Core::ICore::dialogParent(),
- tr("Error While Saving Snippet Collection"), errorString);
+ Tr::tr("Error While Saving Snippet Collection"), errorString);
}
}
}
@@ -467,7 +469,7 @@ void SnippetsSettingsPagePrivate::removeSnippet()
{
const QModelIndex &modelIndex = m_snippetsTable->selectionModel()->currentIndex();
if (!modelIndex.isValid()) {
- QMessageBox::critical(Core::ICore::dialogParent(), tr("Error"), tr("No snippet selected."));
+ QMessageBox::critical(Core::ICore::dialogParent(), Tr::tr("Error"), Tr::tr("No snippet selected."));
return;
}
m_model->removeSnippet(modelIndex);
@@ -546,13 +548,14 @@ void SnippetsSettingsPagePrivate::decorateEditors(const TextEditor::FontSettings
}
// SnippetsSettingsPage
+
SnippetsSettingsPage::SnippetsSettingsPage()
: d(new SnippetsSettingsPagePrivate)
{
setId(Constants::TEXT_EDITOR_SNIPPETS_SETTINGS);
- setDisplayName(SnippetsSettingsPagePrivate::tr("Snippets"));
+ setDisplayName(Tr::tr("Snippets"));
setCategory(TextEditor::Constants::TEXT_EDITOR_SETTINGS_CATEGORY);
- setDisplayCategory(QCoreApplication::translate("::TextEditor", "Text Editor"));
+ setDisplayCategory(Tr::tr("Text Editor"));
setCategoryIconPath(TextEditor::Constants::TEXT_EDITOR_SETTINGS_CATEGORY_ICON_PATH);
}
diff --git a/src/plugins/texteditor/tabsettingswidget.cpp b/src/plugins/texteditor/tabsettingswidget.cpp
index a3f99b14f94..f55d8d6f441 100644
--- a/src/plugins/texteditor/tabsettingswidget.cpp
+++ b/src/plugins/texteditor/tabsettingswidget.cpp
@@ -4,6 +4,7 @@
#include "tabsettingswidget.h"
#include "tabsettings.h"
+#include "texteditortr.h"
#include
#include
@@ -18,7 +19,7 @@ namespace TextEditor {
QString continuationTooltip()
{
// FIXME: This is unfair towards translators.
- return QCoreApplication::translate("TextEditor::TabSettingsWidget",
+ return Tr::tr(
"\n"
"Influences the indentation of continuation lines.\n"
"\n"
@@ -50,37 +51,37 @@ TabSettingsWidget::TabSettingsWidget(QWidget *parent) :
QGroupBox(parent)
{
resize(254, 189);
- setTitle(tr("Tabs And Indentation"));
+ setTitle(Tr::tr("Tabs And Indentation"));
m_codingStyleWarning = new QLabel(
- tr("Code indentation is configured in C++ "
+ Tr::tr("Code indentation is configured in C++ "
"and Qt Quick settings."));
m_codingStyleWarning->setVisible(false);
m_codingStyleWarning->setWordWrap(true);
m_codingStyleWarning->setToolTip(
- tr("The text editor indentation setting is used for non-code files only. See the C++ "
+ Tr::tr("The text editor indentation setting is used for non-code files only. See the C++ "
"and Qt Quick coding style settings to configure indentation for code files."));
m_tabPolicy = new QComboBox(this);
m_tabPolicy->setMinimumContentsLength(28);
- m_tabPolicy->addItem(tr("Spaces Only"));
- m_tabPolicy->addItem(tr("Tabs Only"));
- m_tabPolicy->addItem(tr("Mixed"));
+ m_tabPolicy->addItem(Tr::tr("Spaces Only"));
+ m_tabPolicy->addItem(Tr::tr("Tabs Only"));
+ m_tabPolicy->addItem(Tr::tr("Mixed"));
- auto tabSizeLabel = new QLabel(tr("Ta&b size:"));
+ auto tabSizeLabel = new QLabel(Tr::tr("Ta&b size:"));
m_tabSize = new QSpinBox(this);
m_tabSize->setRange(1, 20);
- auto indentSizeLabel = new QLabel(tr("&Indent size:"));
+ auto indentSizeLabel = new QLabel(Tr::tr("&Indent size:"));
m_indentSize = new QSpinBox(this);
m_indentSize->setRange(1, 20);
m_continuationAlignBehavior = new QComboBox;
- m_continuationAlignBehavior->addItem(tr("Not At All"));
- m_continuationAlignBehavior->addItem(tr("With Spaces"));
- m_continuationAlignBehavior->addItem(tr("With Regular Indent"));
+ m_continuationAlignBehavior->addItem(Tr::tr("Not At All"));
+ m_continuationAlignBehavior->addItem(Tr::tr("With Spaces"));
+ m_continuationAlignBehavior->addItem(Tr::tr("With Regular Indent"));
m_continuationAlignBehavior->setToolTip(continuationTooltip());
tabSizeLabel->setBuddy(m_tabSize);
@@ -91,10 +92,10 @@ TabSettingsWidget::TabSettingsWidget(QWidget *parent) :
Column {
m_codingStyleWarning,
- tr("Tab policy:"),
+ Tr::tr("Tab policy:"),
indent(m_tabPolicy),
Row { tabSizeLabel, m_tabSize, indentSizeLabel, m_indentSize, st },
- tr("Align continuation lines:"),
+ Tr::tr("Align continuation lines:"),
indent(m_continuationAlignBehavior)
}.attachTo(this);
diff --git a/src/plugins/texteditor/textdocument.cpp b/src/plugins/texteditor/textdocument.cpp
index e69bdd9692f..61c3b319b36 100644
--- a/src/plugins/texteditor/textdocument.cpp
+++ b/src/plugins/texteditor/textdocument.cpp
@@ -10,31 +10,31 @@
#include "tabsettings.h"
#include "textdocumentlayout.h"
#include "texteditor.h"
-#include "texteditorconstants.h"
+#include "texteditortr.h"
#include "textindenter.h"
#include "typingsettings.h"
+
+#include
#include
#include
#include
+#include
+#include
+
#include
+
#include
#include
+#include
#include
#include
#include
-#include
-#include
#include
#include
#include
#include
-#include
-#include
-#include
-#include
-
using namespace Core;
using namespace Utils;
@@ -368,7 +368,7 @@ QAction *TextDocument::createDiffAgainstCurrentFileAction(
if (diffService && !leftFilePath.isEmpty() && !rightFilePath.isEmpty())
diffService->diffFiles(leftFilePath, rightFilePath);
};
- auto diffAction = new QAction(tr("Diff Against Current File"), parent);
+ auto diffAction = new QAction(Tr::tr("Diff Against Current File"), parent);
QObject::connect(diffAction, &QAction::triggered, parent, diffAgainstCurrentFile);
return diffAction;
}
@@ -770,7 +770,7 @@ Core::IDocument::OpenResult TextDocument::openImpl(QString *errorString,
} else if (chunks > 1) {
QFutureInterface interface;
interface.setProgressRange(0, chunks);
- ProgressManager::addTask(interface.future(), tr("Opening File"),
+ ProgressManager::addTask(interface.future(), Tr::tr("Opening File"),
Constants::TASK_OPEN_FILE);
interface.reportStarted();
diff --git a/src/plugins/texteditor/texteditor.cpp b/src/plugins/texteditor/texteditor.cpp
index 74439da7546..dbe39a861d3 100644
--- a/src/plugins/texteditor/texteditor.cpp
+++ b/src/plugins/texteditor/texteditor.cpp
@@ -2,22 +2,24 @@
// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0
#include "texteditor.h"
-#include "texteditor_p.h"
-#include "displaysettings.h"
-#include "marginsettings.h"
-#include "fontsettings.h"
-#include "texteditoractionhandler.h"
#include "autocompleter.h"
#include "basehoverhandler.h"
#include "behaviorsettings.h"
#include "circularclipboard.h"
#include "circularclipboardassist.h"
+#include "codeassist/assistinterface.h"
+#include "codeassist/codeassistant.h"
+#include "codeassist/completionassistprovider.h"
+#include "codeassist/documentcontentcompletion.h"
#include "completionsettings.h"
+#include "displaysettings.h"
#include "extraencodingsettings.h"
+#include "fontsettings.h"
#include "highlighter.h"
#include "highlightersettings.h"
#include "icodestylepreferences.h"
+#include "marginsettings.h"
#include "refactoroverlay.h"
#include "snippets/snippetoverlay.h"
#include "storagesettings.h"
@@ -25,17 +27,16 @@
#include "tabsettings.h"
#include "textdocument.h"
#include "textdocumentlayout.h"
+#include "texteditor_p.h"
+#include "texteditoractionhandler.h"
#include "texteditorconstants.h"
#include "texteditoroverlay.h"
#include "texteditorsettings.h"
+#include "texteditortr.h"
#include "typingsettings.h"
-#include
-#include
-#include
-#include
-
#include
+
#include
#include
#include
@@ -45,6 +46,7 @@
#include
#include
#include
+
#include
#include
#include
@@ -153,7 +155,7 @@ public:
: FixedSizeClickLabel(parent)
, m_editor(parent)
{
- setMaxText(TextEditorWidget::tr("Line: 9999, Col: 999"));
+ setMaxText(Tr::tr("Line: 9999, Col: 999"));
connect(m_editor, &QPlainTextEdit::cursorPositionChanged, this, &LineColumnLabel::update);
connect(this, &FixedSizeClickLabel::clicked, ActionManager::instance(), [this] {
emit m_editor->activateEditor(EditorManager::IgnoreNavigationHistory);
@@ -174,9 +176,9 @@ private:
const int line = block.blockNumber() + 1;
const TabSettings &tabSettings = m_editor->textDocument()->tabSettings();
const int column = tabSettings.columnAt(block.text(), cursor.positionInBlock()) + 1;
- const QString text = TextEditorWidget::tr("Line: %1, Col: %2");
+ const QString text = Tr::tr("Line: %1, Col: %2");
setText(text.arg(line).arg(column));
- const QString toolTipText = TextEditorWidget::tr("Cursor position: %1");
+ const QString toolTipText = Tr::tr("Cursor position: %1");
setToolTip(toolTipText.arg(QString::number(cursor.position())));
QFont f = font();
f.setItalic(m_editor->multiTextCursor().hasMultipleCursors());
@@ -1056,7 +1058,7 @@ static QLayout *createSeparatorLayout()
QFrame* separator1 = createSeparator(styleSheet);
QFrame* separator2 = createSeparator(styleSheet);
- auto label = new QLabel(TextEditorWidget::tr("Other annotations"));
+ auto label = new QLabel(Tr::tr("Other annotations"));
label->setStyleSheet(styleSheet);
auto layout = new QHBoxLayout;
@@ -1333,7 +1335,7 @@ void TextEditorWidget::print(QPrinter *printer)
const bool oldFullPage = printer->fullPage();
printer->setFullPage(true);
auto dlg = new QPrintDialog(printer, this);
- dlg->setWindowTitle(tr("Print Document"));
+ dlg->setWindowTitle(Tr::tr("Print Document"));
if (dlg->exec() == QDialog::Accepted)
d->print(printer);
printer->setFullPage(oldFullPage);
@@ -1653,7 +1655,7 @@ void TextEditorWidget::selectEncoding()
case CodecSelector::Reload: {
QString errorString;
if (!doc->reload(&errorString, codecSelector.selectedCodec())) {
- QMessageBox::critical(this, tr("File Error"), errorString);
+ QMessageBox::critical(this, Tr::tr("File Error"), errorString);
break;
}
break; }
@@ -1690,7 +1692,7 @@ void TextEditorWidget::updateTextCodecLabel()
QString TextEditorWidget::msgTextTooLarge(quint64 size)
{
- return tr("The text is too large to be displayed (%1 MB).").
+ return Tr::tr("The text is too large to be displayed (%1 MB).").
arg(size >> 20);
}
@@ -1720,9 +1722,9 @@ void TextEditorWidgetPrivate::updateCannotDecodeInfo()
if (!infoBar->canInfoBeAdded(selectEncodingId))
return;
InfoBarEntry info(selectEncodingId,
- TextEditorWidget::tr("Error: Could not decode \"%1\" with \"%2\"-encoding. Editing not possible.")
+ Tr::tr("Error: Could not decode \"%1\" with \"%2\"-encoding. Editing not possible.")
.arg(m_document->displayName(), QString::fromLatin1(m_document->codec()->name())));
- info.addCustomButton(TextEditorWidget::tr("Select Encoding"), [this] { q->selectEncoding(); });
+ info.addCustomButton(Tr::tr("Select Encoding"), [this] { q->selectEncoding(); });
infoBar->addInfo(info);
} else {
infoBar->removeInfo(selectEncodingId);
@@ -2876,7 +2878,7 @@ void TextEditorWidget::insertCodeSnippet(const QTextCursor &cursor_arg,
SnippetParseResult result = parse(snippet);
if (std::holds_alternative(result)) {
const auto &error = std::get(result);
- QMessageBox::warning(this, tr("Snippet Parse Error"), error.htmlMessage());
+ QMessageBox::warning(this, Tr::tr("Snippet Parse Error"), error.htmlMessage());
return;
}
QTC_ASSERT(std::holds_alternative(result), return);
@@ -3367,10 +3369,10 @@ void TextEditorWidgetPrivate::updateSyntaxInfoBar(const Highlighter::Definitions
if (definitions.isEmpty() && infoBar->canInfoBeAdded(missing)
&& !TextEditorSettings::highlighterSettings().isIgnoredFilePattern(fileName)) {
InfoBarEntry info(missing,
- BaseTextEditor::tr("A highlight definition was not found for this file. "
- "Would you like to download additional highlight definition files?"),
+ Tr::tr("A highlight definition was not found for this file. "
+ "Would you like to download additional highlight definition files?"),
InfoBarEntry::GlobalSuppression::Enabled);
- info.addCustomButton(BaseTextEditor::tr("Download Definitions"), [missing, this]() {
+ info.addCustomButton(Tr::tr("Download Definitions"), [missing, this]() {
m_document->infoBar()->removeInfo(missing);
Highlighter::downloadDefinitions();
});
@@ -3379,14 +3381,14 @@ void TextEditorWidgetPrivate::updateSyntaxInfoBar(const Highlighter::Definitions
infoBar->addInfo(info);
} else if (definitions.size() > 1) {
InfoBarEntry info(multiple,
- BaseTextEditor::tr("More than one highlight definition was found for this file. "
- "Which one should be used to highlight this file?"));
+ Tr::tr("More than one highlight definition was found for this file. "
+ "Which one should be used to highlight this file?"));
info.setComboInfo(Utils::transform(definitions, &Highlighter::Definition::name),
[this](const InfoBarEntry::ComboInfo &info) {
this->configureGenericHighlighter(Highlighter::definitionForName(info.displayText));
});
- info.addCustomButton(BaseTextEditor::tr("Remember My Choice"), [multiple, this]() {
+ info.addCustomButton(Tr::tr("Remember My Choice"), [multiple, this]() {
m_document->infoBar()->removeInfo(multiple);
rememberCurrentSyntaxDefinition();
});
@@ -6316,8 +6318,7 @@ void TextEditorWidget::wheelEvent(QWheelEvent *e)
static void showZoomIndicator(QWidget *editor, const int newZoom)
{
Utils::FadingIndicator::showText(editor,
- QCoreApplication::translate("TextEditor::TextEditorWidget",
- "Zoom: %1%").arg(newZoom),
+ Tr::tr("Zoom: %1%").arg(newZoom),
Utils::FadingIndicator::SmallText);
}
@@ -8077,8 +8078,8 @@ void TextEditorWidget::appendStandardContextMenuActions(QMenu *menu)
TextDocument *doc = textDocument();
if (doc->codec()->name() == QByteArray("UTF-8") && doc->supportsUtf8Bom()) {
a->setVisible(true);
- a->setText(doc->format().hasUtf8Bom ? tr("Delete UTF-8 BOM on Save")
- : tr("Add UTF-8 BOM on Save"));
+ a->setText(doc->format().hasUtf8Bom ? Tr::tr("Delete UTF-8 BOM on Save")
+ : Tr::tr("Add UTF-8 BOM on Save"));
} else {
a->setVisible(false);
}
diff --git a/src/plugins/texteditor/texteditoractionhandler.cpp b/src/plugins/texteditor/texteditoractionhandler.cpp
index 77ceefa601e..25116729c99 100644
--- a/src/plugins/texteditor/texteditoractionhandler.cpp
+++ b/src/plugins/texteditor/texteditoractionhandler.cpp
@@ -7,8 +7,8 @@
#include "displaysettings.h"
#include "fontsettings.h"
#include "linenumberfilter.h"
-#include "texteditorconstants.h"
#include "texteditorplugin.h"
+#include "texteditortr.h"
#include "texteditorsettings.h"
#include
@@ -20,6 +20,7 @@
#include
#include
#include
+
#include
#include
@@ -33,8 +34,6 @@ namespace Internal {
class TextEditorActionHandlerPrivate : public QObject
{
- Q_DECLARE_TR_FUNCTIONS(TextEditor::Internal::TextEditorActionHandler)
-
public:
TextEditorActionHandlerPrivate(Utils::Id editorId, Utils::Id contextId, uint optionalActions);
@@ -147,9 +146,9 @@ void TextEditorActionHandlerPrivate::createActions()
using namespace TextEditor::Constants;
m_undoAction = registerAction(UNDO,
- [] (TextEditorWidget *w) { w->undo(); }, true, tr("&Undo"));
+ [] (TextEditorWidget *w) { w->undo(); }, true, Tr::tr("&Undo"));
m_redoAction = registerAction(REDO,
- [] (TextEditorWidget *w) { w->redo(); }, true, tr("&Redo"));
+ [] (TextEditorWidget *w) { w->redo(); }, true, Tr::tr("&Redo"));
m_copyAction = registerAction(COPY,
[] (TextEditorWidget *w) { w->copy(); }, true);
m_cutAction = registerAction(CUT,
@@ -164,110 +163,110 @@ void TextEditorActionHandlerPrivate::createActions()
m_modifyingActions << registerAction(PRINT,
[] (TextEditorWidget *widget) { widget->print(Core::ICore::printer()); });
m_modifyingActions << registerAction(DELETE_LINE,
- [] (TextEditorWidget *w) { w->deleteLine(); }, true, tr("Delete &Line"));
+ [] (TextEditorWidget *w) { w->deleteLine(); }, true, Tr::tr("Delete &Line"));
m_modifyingActions << registerAction(DELETE_END_OF_LINE,
- [] (TextEditorWidget *w) { w->deleteEndOfLine(); }, true, tr("Delete Line from Cursor On"));
+ [] (TextEditorWidget *w) { w->deleteEndOfLine(); }, true, Tr::tr("Delete Line from Cursor On"));
m_modifyingActions << registerAction(DELETE_END_OF_WORD,
- [] (TextEditorWidget *w) { w->deleteEndOfWord(); }, true, tr("Delete Word from Cursor On"));
+ [] (TextEditorWidget *w) { w->deleteEndOfWord(); }, true, Tr::tr("Delete Word from Cursor On"));
m_modifyingActions << registerAction(DELETE_END_OF_WORD_CAMEL_CASE,
- [] (TextEditorWidget *w) { w->deleteEndOfWordCamelCase(); }, true, tr("Delete Word Camel Case from Cursor On"));
+ [] (TextEditorWidget *w) { w->deleteEndOfWordCamelCase(); }, true, Tr::tr("Delete Word Camel Case from Cursor On"));
m_modifyingActions << registerAction(DELETE_START_OF_LINE,
- [] (TextEditorWidget *w) { w->deleteStartOfLine(); }, true, tr("Delete Line up to Cursor"),
- Core::useMacShortcuts ? QKeySequence(tr("Ctrl+Backspace")) : QKeySequence());
+ [] (TextEditorWidget *w) { w->deleteStartOfLine(); }, true, Tr::tr("Delete Line up to Cursor"),
+ Core::useMacShortcuts ? QKeySequence(Tr::tr("Ctrl+Backspace")) : QKeySequence());
m_modifyingActions << registerAction(DELETE_START_OF_WORD,
- [] (TextEditorWidget *w) { w->deleteStartOfWord(); }, true, tr("Delete Word up to Cursor"));
+ [] (TextEditorWidget *w) { w->deleteStartOfWord(); }, true, Tr::tr("Delete Word up to Cursor"));
m_modifyingActions << registerAction(DELETE_START_OF_WORD_CAMEL_CASE,
- [] (TextEditorWidget *w) { w->deleteStartOfWordCamelCase(); }, true, tr("Delete Word Camel Case up to Cursor"));
+ [] (TextEditorWidget *w) { w->deleteStartOfWordCamelCase(); }, true, Tr::tr("Delete Word Camel Case up to Cursor"));
registerAction(GOTO_BLOCK_START_WITH_SELECTION,
- [] (TextEditorWidget *w) { w->gotoBlockStartWithSelection(); }, true, tr("Go to Block Start with Selection"),
- QKeySequence(tr("Ctrl+{")));
+ [] (TextEditorWidget *w) { w->gotoBlockStartWithSelection(); }, true, Tr::tr("Go to Block Start with Selection"),
+ QKeySequence(Tr::tr("Ctrl+{")));
registerAction(GOTO_BLOCK_END_WITH_SELECTION,
- [] (TextEditorWidget *w) { w->gotoBlockEndWithSelection(); }, true, tr("Go to Block End with Selection"),
- QKeySequence(tr("Ctrl+}")));
+ [] (TextEditorWidget *w) { w->gotoBlockEndWithSelection(); }, true, Tr::tr("Go to Block End with Selection"),
+ QKeySequence(Tr::tr("Ctrl+}")));
m_modifyingActions << registerAction(MOVE_LINE_UP,
- [] (TextEditorWidget *w) { w->moveLineUp(); }, true, tr("Move Line Up"),
- QKeySequence(tr("Ctrl+Shift+Up")));
+ [] (TextEditorWidget *w) { w->moveLineUp(); }, true, Tr::tr("Move Line Up"),
+ QKeySequence(Tr::tr("Ctrl+Shift+Up")));
m_modifyingActions << registerAction(MOVE_LINE_DOWN,
- [] (TextEditorWidget *w) { w->moveLineDown(); }, true, tr("Move Line Down"),
- QKeySequence(tr("Ctrl+Shift+Down")));
+ [] (TextEditorWidget *w) { w->moveLineDown(); }, true, Tr::tr("Move Line Down"),
+ QKeySequence(Tr::tr("Ctrl+Shift+Down")));
m_modifyingActions << registerAction(COPY_LINE_UP,
- [] (TextEditorWidget *w) { w->copyLineUp(); }, true, tr("Copy Line Up"),
- QKeySequence(tr("Ctrl+Alt+Up")));
+ [] (TextEditorWidget *w) { w->copyLineUp(); }, true, Tr::tr("Copy Line Up"),
+ QKeySequence(Tr::tr("Ctrl+Alt+Up")));
m_modifyingActions << registerAction(COPY_LINE_DOWN,
- [] (TextEditorWidget *w) { w->copyLineDown(); }, true, tr("Copy Line Down"),
- QKeySequence(tr("Ctrl+Alt+Down")));
+ [] (TextEditorWidget *w) { w->copyLineDown(); }, true, Tr::tr("Copy Line Down"),
+ QKeySequence(Tr::tr("Ctrl+Alt+Down")));
m_modifyingActions << registerAction(JOIN_LINES,
- [] (TextEditorWidget *w) { w->joinLines(); }, true, tr("Join Lines"),
- QKeySequence(tr("Ctrl+J")));
+ [] (TextEditorWidget *w) { w->joinLines(); }, true, Tr::tr("Join Lines"),
+ QKeySequence(Tr::tr("Ctrl+J")));
m_modifyingActions << registerAction(INSERT_LINE_ABOVE,
- [] (TextEditorWidget *w) { w->insertLineAbove(); }, true, tr("Insert Line Above Current Line"),
- QKeySequence(tr("Ctrl+Shift+Return")));
+ [] (TextEditorWidget *w) { w->insertLineAbove(); }, true, Tr::tr("Insert Line Above Current Line"),
+ QKeySequence(Tr::tr("Ctrl+Shift+Return")));
m_modifyingActions << registerAction(INSERT_LINE_BELOW,
- [] (TextEditorWidget *w) { w->insertLineBelow(); }, true, tr("Insert Line Below Current Line"),
- QKeySequence(tr("Ctrl+Return")));
+ [] (TextEditorWidget *w) { w->insertLineBelow(); }, true, Tr::tr("Insert Line Below Current Line"),
+ QKeySequence(Tr::tr("Ctrl+Return")));
m_modifyingActions << registerAction(SWITCH_UTF8BOM,
- [] (TextEditorWidget *w) { w->switchUtf8bom(); }, true, tr("Toggle UTF-8 BOM"));
+ [] (TextEditorWidget *w) { w->switchUtf8bom(); }, true, Tr::tr("Toggle UTF-8 BOM"));
m_modifyingActions << registerAction(INDENT,
- [] (TextEditorWidget *w) { w->indent(); }, true, tr("Indent"));
+ [] (TextEditorWidget *w) { w->indent(); }, true, Tr::tr("Indent"));
m_modifyingActions << registerAction(UNINDENT,
- [] (TextEditorWidget *w) { w->unindent(); }, true, tr("Unindent"));
+ [] (TextEditorWidget *w) { w->unindent(); }, true, Tr::tr("Unindent"));
m_followSymbolAction = registerAction(FOLLOW_SYMBOL_UNDER_CURSOR,
- [] (TextEditorWidget *w) { w->openLinkUnderCursor(); }, true, tr("Follow Symbol Under Cursor"),
+ [] (TextEditorWidget *w) { w->openLinkUnderCursor(); }, true, Tr::tr("Follow Symbol Under Cursor"),
QKeySequence(Qt::Key_F2));
m_followSymbolInNextSplitAction = registerAction(FOLLOW_SYMBOL_UNDER_CURSOR_IN_NEXT_SPLIT,
- [] (TextEditorWidget *w) { w->openLinkUnderCursorInNextSplit(); }, true, tr("Follow Symbol Under Cursor in Next Split"),
- QKeySequence(Utils::HostOsInfo::isMacHost() ? tr("Meta+E, F2") : tr("Ctrl+E, F2")));
+ [] (TextEditorWidget *w) { w->openLinkUnderCursorInNextSplit(); }, true, Tr::tr("Follow Symbol Under Cursor in Next Split"),
+ QKeySequence(Utils::HostOsInfo::isMacHost() ? Tr::tr("Meta+E, F2") : Tr::tr("Ctrl+E, F2")));
m_findUsageAction = registerAction(FIND_USAGES,
- [] (TextEditorWidget *w) { w->findUsages(); }, true, tr("Find References to Symbol Under Cursor"),
- QKeySequence(tr("Ctrl+Shift+U")));
+ [] (TextEditorWidget *w) { w->findUsages(); }, true, Tr::tr("Find References to Symbol Under Cursor"),
+ QKeySequence(Tr::tr("Ctrl+Shift+U")));
m_renameSymbolAction = registerAction(RENAME_SYMBOL,
- [] (TextEditorWidget *w) { w->renameSymbolUnderCursor(); }, true, tr("Rename Symbol Under Cursor"),
- QKeySequence(tr("Ctrl+Shift+R")));
+ [] (TextEditorWidget *w) { w->renameSymbolUnderCursor(); }, true, Tr::tr("Rename Symbol Under Cursor"),
+ QKeySequence(Tr::tr("Ctrl+Shift+R")));
m_jumpToFileAction = registerAction(JUMP_TO_FILE_UNDER_CURSOR,
- [] (TextEditorWidget *w) { w->openLinkUnderCursor(); }, true, tr("Jump to File Under Cursor"),
+ [] (TextEditorWidget *w) { w->openLinkUnderCursor(); }, true, Tr::tr("Jump to File Under Cursor"),
QKeySequence(Qt::Key_F2));
m_jumpToFileInNextSplitAction = registerAction(JUMP_TO_FILE_UNDER_CURSOR_IN_NEXT_SPLIT,
- [] (TextEditorWidget *w) { w->openLinkUnderCursorInNextSplit(); }, true, tr("Jump to File Under Cursor in Next Split"),
- QKeySequence(Utils::HostOsInfo::isMacHost() ? tr("Meta+E, F2") : tr("Ctrl+E, F2")).toString());
+ [] (TextEditorWidget *w) { w->openLinkUnderCursorInNextSplit(); }, true, Tr::tr("Jump to File Under Cursor in Next Split"),
+ QKeySequence(Utils::HostOsInfo::isMacHost() ? Tr::tr("Meta+E, F2") : Tr::tr("Ctrl+E, F2")).toString());
registerAction(VIEW_PAGE_UP,
- [] (TextEditorWidget *w) { w->viewPageUp(); }, true, tr("Move the View a Page Up and Keep the Cursor Position"),
- QKeySequence(tr("Ctrl+PgUp")));
+ [] (TextEditorWidget *w) { w->viewPageUp(); }, true, Tr::tr("Move the View a Page Up and Keep the Cursor Position"),
+ QKeySequence(Tr::tr("Ctrl+PgUp")));
registerAction(VIEW_PAGE_DOWN,
- [] (TextEditorWidget *w) { w->viewPageDown(); }, true, tr("Move the View a Page Down and Keep the Cursor Position"),
- QKeySequence(tr("Ctrl+PgDown")));
+ [] (TextEditorWidget *w) { w->viewPageDown(); }, true, Tr::tr("Move the View a Page Down and Keep the Cursor Position"),
+ QKeySequence(Tr::tr("Ctrl+PgDown")));
registerAction(VIEW_LINE_UP,
- [] (TextEditorWidget *w) { w->viewLineUp(); }, true, tr("Move the View a Line Up and Keep the Cursor Position"),
- QKeySequence(tr("Ctrl+Up")));
+ [] (TextEditorWidget *w) { w->viewLineUp(); }, true, Tr::tr("Move the View a Line Up and Keep the Cursor Position"),
+ QKeySequence(Tr::tr("Ctrl+Up")));
registerAction(VIEW_LINE_DOWN,
- [] (TextEditorWidget *w) { w->viewLineDown(); }, true, tr("Move the View a Line Down and Keep the Cursor Position"),
- QKeySequence(tr("Ctrl+Down")));
+ [] (TextEditorWidget *w) { w->viewLineDown(); }, true, Tr::tr("Move the View a Line Down and Keep the Cursor Position"),
+ QKeySequence(Tr::tr("Ctrl+Down")));
// register "Edit" Menu Actions
Core::ActionContainer *editMenu = Core::ActionManager::actionContainer(M_EDIT);
registerAction(SELECT_ENCODING,
- [] (TextEditorWidget *w) { w->selectEncoding(); }, false, tr("Select Encoding..."),
+ [] (TextEditorWidget *w) { w->selectEncoding(); }, false, Tr::tr("Select Encoding..."),
QKeySequence(), G_EDIT_OTHER, editMenu);
m_modifyingActions << registerAction(CIRCULAR_PASTE,
- [] (TextEditorWidget *w) { w->circularPaste(); }, false, tr("Paste from Clipboard History"),
- QKeySequence(tr("Ctrl+Shift+V")), G_EDIT_COPYPASTE, editMenu);
+ [] (TextEditorWidget *w) { w->circularPaste(); }, false, Tr::tr("Paste from Clipboard History"),
+ QKeySequence(Tr::tr("Ctrl+Shift+V")), G_EDIT_COPYPASTE, editMenu);
m_modifyingActions << registerAction(NO_FORMAT_PASTE,
- [] (TextEditorWidget *w) { w->pasteWithoutFormat(); }, false, tr("Paste Without Formatting"),
- QKeySequence(Core::useMacShortcuts ? tr("Ctrl+Alt+Shift+V") : QString()), G_EDIT_COPYPASTE, editMenu);
+ [] (TextEditorWidget *w) { w->pasteWithoutFormat(); }, false, Tr::tr("Paste Without Formatting"),
+ QKeySequence(Core::useMacShortcuts ? Tr::tr("Ctrl+Alt+Shift+V") : QString()), G_EDIT_COPYPASTE, editMenu);
// register "Edit -> Advanced" Menu Actions
Core::ActionContainer *advancedEditMenu = Core::ActionManager::actionContainer(M_EDIT_ADVANCED);
m_autoIndentAction = registerAction(AUTO_INDENT_SELECTION,
- [] (TextEditorWidget *w) { w->autoIndent(); }, true, tr("Auto-&indent Selection"),
- QKeySequence(tr("Ctrl+I")),
+ [] (TextEditorWidget *w) { w->autoIndent(); }, true, Tr::tr("Auto-&indent Selection"),
+ QKeySequence(Tr::tr("Ctrl+I")),
G_EDIT_FORMAT, advancedEditMenu);
m_autoFormatAction = registerAction(AUTO_FORMAT_SELECTION,
- [] (TextEditorWidget *w) { w->autoFormat(); }, true, tr("Auto-&format Selection"),
- QKeySequence(tr("Ctrl+;")),
+ [] (TextEditorWidget *w) { w->autoFormat(); }, true, Tr::tr("Auto-&format Selection"),
+ QKeySequence(Tr::tr("Ctrl+;")),
G_EDIT_FORMAT, advancedEditMenu);
m_modifyingActions << registerAction(REWRAP_PARAGRAPH,
- [] (TextEditorWidget *w) { w->rewrapParagraph(); }, true, tr("&Rewrap Paragraph"),
- QKeySequence(Core::useMacShortcuts ? tr("Meta+E, R") : tr("Ctrl+E, R")),
+ [] (TextEditorWidget *w) { w->rewrapParagraph(); }, true, Tr::tr("&Rewrap Paragraph"),
+ QKeySequence(Core::useMacShortcuts ? Tr::tr("Meta+E, R") : Tr::tr("Ctrl+E, R")),
G_EDIT_FORMAT, advancedEditMenu);
m_visualizeWhitespaceAction = registerBoolAction(VISUALIZE_WHITESPACE,
[] (TextEditorWidget *widget, bool checked) {
@@ -277,12 +276,12 @@ void TextEditorActionHandlerPrivate::createActions()
widget->setDisplaySettings(ds);
}
},
- false, tr("&Visualize Whitespace"),
- QKeySequence(Core::useMacShortcuts ? tr("Meta+E, Meta+V") : tr("Ctrl+E, Ctrl+V")),
+ false, Tr::tr("&Visualize Whitespace"),
+ QKeySequence(Core::useMacShortcuts ? Tr::tr("Meta+E, Meta+V") : Tr::tr("Ctrl+E, Ctrl+V")),
G_EDIT_FORMAT, advancedEditMenu);
m_visualizeWhitespaceAction->setCheckable(true);
m_modifyingActions << registerAction(CLEAN_WHITESPACE,
- [] (TextEditorWidget *w) { w->cleanWhitespace(); }, true, tr("Clean Whitespace"),
+ [] (TextEditorWidget *w) { w->cleanWhitespace(); }, true, Tr::tr("Clean Whitespace"),
QKeySequence(),
G_EDIT_FORMAT, advancedEditMenu);
m_textWrappingAction = registerBoolAction(TEXT_WRAPPING,
@@ -293,145 +292,145 @@ void TextEditorActionHandlerPrivate::createActions()
widget->setDisplaySettings(ds);
}
},
- false, tr("Enable Text &Wrapping"),
- QKeySequence(Core::useMacShortcuts ? tr("Meta+E, Meta+W") : tr("Ctrl+E, Ctrl+W")),
+ false, Tr::tr("Enable Text &Wrapping"),
+ QKeySequence(Core::useMacShortcuts ? Tr::tr("Meta+E, Meta+W") : Tr::tr("Ctrl+E, Ctrl+W")),
G_EDIT_FORMAT, advancedEditMenu);
m_textWrappingAction->setCheckable(true);
m_unCommentSelectionAction = registerAction(UN_COMMENT_SELECTION,
- [] (TextEditorWidget *w) { w->unCommentSelection(); }, true, tr("Toggle Comment &Selection"),
- QKeySequence(tr("Ctrl+/")),
+ [] (TextEditorWidget *w) { w->unCommentSelection(); }, true, Tr::tr("Toggle Comment &Selection"),
+ QKeySequence(Tr::tr("Ctrl+/")),
G_EDIT_FORMAT, advancedEditMenu);
m_modifyingActions << registerAction(CUT_LINE,
- [] (TextEditorWidget *w) { w->cutLine(); }, true, tr("Cut &Line"),
- QKeySequence(tr("Shift+Del")),
+ [] (TextEditorWidget *w) { w->cutLine(); }, true, Tr::tr("Cut &Line"),
+ QKeySequence(Tr::tr("Shift+Del")),
G_EDIT_TEXT, advancedEditMenu);
registerAction(COPY_LINE,
- [] (TextEditorWidget *w) { w->copyLine(); }, false, tr("Copy &Line"),
- QKeySequence(tr("Ctrl+Ins")),
+ [] (TextEditorWidget *w) { w->copyLine(); }, false, Tr::tr("Copy &Line"),
+ QKeySequence(Tr::tr("Ctrl+Ins")),
G_EDIT_TEXT, advancedEditMenu);
m_copyHtmlAction = registerAction(COPY_WITH_HTML,
- [] (TextEditorWidget *w) { w->copyWithHtml(); }, true, tr("Copy With Highlighting"),
+ [] (TextEditorWidget *w) { w->copyWithHtml(); }, true, Tr::tr("Copy With Highlighting"),
QKeySequence(), G_EDIT_TEXT, advancedEditMenu);
registerAction(ADD_CURSORS_TO_LINE_ENDS,
- [] (TextEditorWidget *w) { w->addCursorsToLineEnds(); }, false, tr("Create Cursors at Selected Line Ends"),
- QKeySequence(tr("Alt+Shift+I")),
+ [] (TextEditorWidget *w) { w->addCursorsToLineEnds(); }, false, Tr::tr("Create Cursors at Selected Line Ends"),
+ QKeySequence(Tr::tr("Alt+Shift+I")),
G_EDIT_TEXT, advancedEditMenu);
registerAction(ADD_SELECT_NEXT_FIND_MATCH,
- [] (TextEditorWidget *w) { w->addSelectionNextFindMatch(); }, false, tr("Add Next Occurrence to Selection"),
- QKeySequence(tr("Ctrl+D")),
+ [] (TextEditorWidget *w) { w->addSelectionNextFindMatch(); }, false, Tr::tr("Add Next Occurrence to Selection"),
+ QKeySequence(Tr::tr("Ctrl+D")),
G_EDIT_TEXT, advancedEditMenu);
m_modifyingActions << registerAction(DUPLICATE_SELECTION,
- [] (TextEditorWidget *w) { w->duplicateSelection(); }, false, tr("&Duplicate Selection"),
+ [] (TextEditorWidget *w) { w->duplicateSelection(); }, false, Tr::tr("&Duplicate Selection"),
QKeySequence(),
G_EDIT_TEXT, advancedEditMenu);
m_modifyingActions << registerAction(DUPLICATE_SELECTION_AND_COMMENT,
- [] (TextEditorWidget *w) { w->duplicateSelectionAndComment(); }, false, tr("&Duplicate Selection and Comment"),
+ [] (TextEditorWidget *w) { w->duplicateSelectionAndComment(); }, false, Tr::tr("&Duplicate Selection and Comment"),
QKeySequence(),
G_EDIT_TEXT, advancedEditMenu);
m_modifyingActions << registerAction(UPPERCASE_SELECTION,
- [] (TextEditorWidget *w) { w->uppercaseSelection(); }, true, tr("Uppercase Selection"),
- QKeySequence(Core::useMacShortcuts ? tr("Meta+Shift+U") : tr("Alt+Shift+U")),
+ [] (TextEditorWidget *w) { w->uppercaseSelection(); }, true, Tr::tr("Uppercase Selection"),
+ QKeySequence(Core::useMacShortcuts ? Tr::tr("Meta+Shift+U") : Tr::tr("Alt+Shift+U")),
G_EDIT_TEXT, advancedEditMenu);
m_modifyingActions << registerAction(LOWERCASE_SELECTION,
- [] (TextEditorWidget *w) { w->lowercaseSelection(); }, true, tr("Lowercase Selection"),
- QKeySequence(Core::useMacShortcuts ? tr("Meta+U") : tr("Alt+U")),
+ [] (TextEditorWidget *w) { w->lowercaseSelection(); }, true, Tr::tr("Lowercase Selection"),
+ QKeySequence(Core::useMacShortcuts ? Tr::tr("Meta+U") : Tr::tr("Alt+U")),
G_EDIT_TEXT, advancedEditMenu);
m_modifyingActions << registerAction(SORT_SELECTED_LINES,
- [] (TextEditorWidget *w) { w->sortSelectedLines(); }, false, tr("&Sort Selected Lines"),
- QKeySequence(Core::useMacShortcuts ? tr("Meta+Shift+S") : tr("Alt+Shift+S")),
+ [] (TextEditorWidget *w) { w->sortSelectedLines(); }, false, Tr::tr("&Sort Selected Lines"),
+ QKeySequence(Core::useMacShortcuts ? Tr::tr("Meta+Shift+S") : Tr::tr("Alt+Shift+S")),
G_EDIT_TEXT, advancedEditMenu);
registerAction(FOLD,
- [] (TextEditorWidget *w) { w->fold(); }, true, tr("Fold"),
- QKeySequence(tr("Ctrl+<")),
+ [] (TextEditorWidget *w) { w->fold(); }, true, Tr::tr("Fold"),
+ QKeySequence(Tr::tr("Ctrl+<")),
G_EDIT_COLLAPSING, advancedEditMenu);
registerAction(UNFOLD,
- [] (TextEditorWidget *w) { w->unfold(); }, true, tr("Unfold"),
- QKeySequence(tr("Ctrl+>")),
+ [] (TextEditorWidget *w) { w->unfold(); }, true, Tr::tr("Unfold"),
+ QKeySequence(Tr::tr("Ctrl+>")),
G_EDIT_COLLAPSING, advancedEditMenu);
m_unfoldAllAction = registerAction(UNFOLD_ALL,
- [] (TextEditorWidget *w) { w->unfoldAll(); }, true, tr("Toggle &Fold All"),
+ [] (TextEditorWidget *w) { w->unfoldAll(); }, true, Tr::tr("Toggle &Fold All"),
QKeySequence(),
G_EDIT_COLLAPSING, advancedEditMenu);
registerAction(INCREASE_FONT_SIZE,
- [] (TextEditorWidget *w) { w->zoomF(1.f); }, false, tr("Increase Font Size"),
- QKeySequence(tr("Ctrl++")),
+ [] (TextEditorWidget *w) { w->zoomF(1.f); }, false, Tr::tr("Increase Font Size"),
+ QKeySequence(Tr::tr("Ctrl++")),
G_EDIT_FONT, advancedEditMenu);
registerAction(DECREASE_FONT_SIZE,
- [] (TextEditorWidget *w) { w->zoomF(-1.f); }, false, tr("Decrease Font Size"),
- QKeySequence(tr("Ctrl+-")),
+ [] (TextEditorWidget *w) { w->zoomF(-1.f); }, false, Tr::tr("Decrease Font Size"),
+ QKeySequence(Tr::tr("Ctrl+-")),
G_EDIT_FONT, advancedEditMenu);
registerAction(RESET_FONT_SIZE,
- [] (TextEditorWidget *w) { w->zoomReset(); }, false, tr("Reset Font Size"),
- QKeySequence(Core::useMacShortcuts ? tr("Meta+0") : tr("Ctrl+0")),
+ [] (TextEditorWidget *w) { w->zoomReset(); }, false, Tr::tr("Reset Font Size"),
+ QKeySequence(Core::useMacShortcuts ? Tr::tr("Meta+0") : Tr::tr("Ctrl+0")),
G_EDIT_FONT, advancedEditMenu);
registerAction(GOTO_BLOCK_START,
- [] (TextEditorWidget *w) { w->gotoBlockStart(); }, true, tr("Go to Block Start"),
- QKeySequence(tr("Ctrl+[")),
+ [] (TextEditorWidget *w) { w->gotoBlockStart(); }, true, Tr::tr("Go to Block Start"),
+ QKeySequence(Tr::tr("Ctrl+[")),
G_EDIT_BLOCKS, advancedEditMenu);
registerAction(GOTO_BLOCK_END,
- [] (TextEditorWidget *w) { w->gotoBlockEnd(); }, true, tr("Go to Block End"),
- QKeySequence(tr("Ctrl+]")),
+ [] (TextEditorWidget *w) { w->gotoBlockEnd(); }, true, Tr::tr("Go to Block End"),
+ QKeySequence(Tr::tr("Ctrl+]")),
G_EDIT_BLOCKS, advancedEditMenu);
registerAction(SELECT_BLOCK_UP,
- [] (TextEditorWidget *w) { w->selectBlockUp(); }, true, tr("Select Block Up"),
- QKeySequence(tr("Ctrl+U")),
+ [] (TextEditorWidget *w) { w->selectBlockUp(); }, true, Tr::tr("Select Block Up"),
+ QKeySequence(Tr::tr("Ctrl+U")),
G_EDIT_BLOCKS, advancedEditMenu);
registerAction(SELECT_BLOCK_DOWN,
- [] (TextEditorWidget *w) { w->selectBlockDown(); }, true, tr("Select Block Down"),
- QKeySequence(tr("Ctrl+Shift+Alt+U")),
+ [] (TextEditorWidget *w) { w->selectBlockDown(); }, true, Tr::tr("Select Block Down"),
+ QKeySequence(Tr::tr("Ctrl+Shift+Alt+U")),
G_EDIT_BLOCKS, advancedEditMenu);
registerAction(SELECT_WORD_UNDER_CURSOR,
[] (TextEditorWidget *w) { w->selectWordUnderCursor(); }, true,
- tr("Select Word Under Cursor"));
+ Tr::tr("Select Word Under Cursor"));
// register GOTO Actions
registerAction(GOTO_DOCUMENT_START,
- [] (TextEditorWidget *w) { w->gotoDocumentStart(); }, true, tr("Go to Document Start"));
+ [] (TextEditorWidget *w) { w->gotoDocumentStart(); }, true, Tr::tr("Go to Document Start"));
registerAction(GOTO_DOCUMENT_END,
- [] (TextEditorWidget *w) { w->gotoDocumentEnd(); }, true, tr("Go to Document End"));
+ [] (TextEditorWidget *w) { w->gotoDocumentEnd(); }, true, Tr::tr("Go to Document End"));
registerAction(GOTO_LINE_START,
- [] (TextEditorWidget *w) { w->gotoLineStart(); }, true, tr("Go to Line Start"));
+ [] (TextEditorWidget *w) { w->gotoLineStart(); }, true, Tr::tr("Go to Line Start"));
registerAction(GOTO_LINE_END,
- [] (TextEditorWidget *w) { w->gotoLineEnd(); }, true, tr("Go to Line End"));
+ [] (TextEditorWidget *w) { w->gotoLineEnd(); }, true, Tr::tr("Go to Line End"));
registerAction(GOTO_NEXT_LINE,
- [] (TextEditorWidget *w) { w->gotoNextLine(); }, true, tr("Go to Next Line"));
+ [] (TextEditorWidget *w) { w->gotoNextLine(); }, true, Tr::tr("Go to Next Line"));
registerAction(GOTO_PREVIOUS_LINE,
- [] (TextEditorWidget *w) { w->gotoPreviousLine(); }, true, tr("Go to Previous Line"));
+ [] (TextEditorWidget *w) { w->gotoPreviousLine(); }, true, Tr::tr("Go to Previous Line"));
registerAction(GOTO_PREVIOUS_CHARACTER,
- [] (TextEditorWidget *w) { w->gotoPreviousCharacter(); }, true, tr("Go to Previous Character"));
+ [] (TextEditorWidget *w) { w->gotoPreviousCharacter(); }, true, Tr::tr("Go to Previous Character"));
registerAction(GOTO_NEXT_CHARACTER,
- [] (TextEditorWidget *w) { w->gotoNextCharacter(); }, true, tr("Go to Next Character"));
+ [] (TextEditorWidget *w) { w->gotoNextCharacter(); }, true, Tr::tr("Go to Next Character"));
registerAction(GOTO_PREVIOUS_WORD,
- [] (TextEditorWidget *w) { w->gotoPreviousWord(); }, true, tr("Go to Previous Word"));
+ [] (TextEditorWidget *w) { w->gotoPreviousWord(); }, true, Tr::tr("Go to Previous Word"));
registerAction(GOTO_NEXT_WORD,
- [] (TextEditorWidget *w) { w->gotoNextWord(); }, true, tr("Go to Next Word"));
+ [] (TextEditorWidget *w) { w->gotoNextWord(); }, true, Tr::tr("Go to Next Word"));
registerAction(GOTO_PREVIOUS_WORD_CAMEL_CASE,
- [] (TextEditorWidget *w) { w->gotoPreviousWordCamelCase(); }, false, tr("Go to Previous Word Camel Case"));
+ [] (TextEditorWidget *w) { w->gotoPreviousWordCamelCase(); }, false, Tr::tr("Go to Previous Word Camel Case"));
registerAction(GOTO_NEXT_WORD_CAMEL_CASE,
- [] (TextEditorWidget *w) { w->gotoNextWordCamelCase(); }, false, tr("Go to Next Word Camel Case"));
+ [] (TextEditorWidget *w) { w->gotoNextWordCamelCase(); }, false, Tr::tr("Go to Next Word Camel Case"));
// register GOTO actions with selection
registerAction(GOTO_LINE_START_WITH_SELECTION,
- [] (TextEditorWidget *w) { w->gotoLineStartWithSelection(); }, true, tr("Go to Line Start with Selection"));
+ [] (TextEditorWidget *w) { w->gotoLineStartWithSelection(); }, true, Tr::tr("Go to Line Start with Selection"));
registerAction(GOTO_LINE_END_WITH_SELECTION,
- [] (TextEditorWidget *w) { w->gotoLineEndWithSelection(); }, true, tr("Go to Line End with Selection"));
+ [] (TextEditorWidget *w) { w->gotoLineEndWithSelection(); }, true, Tr::tr("Go to Line End with Selection"));
registerAction(GOTO_NEXT_LINE_WITH_SELECTION,
- [] (TextEditorWidget *w) { w->gotoNextLineWithSelection(); }, true, tr("Go to Next Line with Selection"));
+ [] (TextEditorWidget *w) { w->gotoNextLineWithSelection(); }, true, Tr::tr("Go to Next Line with Selection"));
registerAction(GOTO_PREVIOUS_LINE_WITH_SELECTION,
- [] (TextEditorWidget *w) { w->gotoPreviousLineWithSelection(); }, true, tr("Go to Previous Line with Selection"));
+ [] (TextEditorWidget *w) { w->gotoPreviousLineWithSelection(); }, true, Tr::tr("Go to Previous Line with Selection"));
registerAction(GOTO_PREVIOUS_CHARACTER_WITH_SELECTION,
- [] (TextEditorWidget *w) { w->gotoPreviousCharacterWithSelection(); }, true, tr("Go to Previous Character with Selection"));
+ [] (TextEditorWidget *w) { w->gotoPreviousCharacterWithSelection(); }, true, Tr::tr("Go to Previous Character with Selection"));
registerAction(GOTO_NEXT_CHARACTER_WITH_SELECTION,
- [] (TextEditorWidget *w) { w->gotoNextCharacterWithSelection(); }, true, tr("Go to Next Character with Selection"));
+ [] (TextEditorWidget *w) { w->gotoNextCharacterWithSelection(); }, true, Tr::tr("Go to Next Character with Selection"));
registerAction(GOTO_PREVIOUS_WORD_WITH_SELECTION,
- [] (TextEditorWidget *w) { w->gotoPreviousWordWithSelection(); }, true, tr("Go to Previous Word with Selection"));
+ [] (TextEditorWidget *w) { w->gotoPreviousWordWithSelection(); }, true, Tr::tr("Go to Previous Word with Selection"));
registerAction(GOTO_NEXT_WORD_WITH_SELECTION,
- [] (TextEditorWidget *w) { w->gotoNextWordWithSelection(); }, true, tr("Go to Next Word with Selection"));
+ [] (TextEditorWidget *w) { w->gotoNextWordWithSelection(); }, true, Tr::tr("Go to Next Word with Selection"));
registerAction(GOTO_PREVIOUS_WORD_CAMEL_CASE_WITH_SELECTION,
- [] (TextEditorWidget *w) { w->gotoPreviousWordCamelCaseWithSelection(); }, false, tr("Go to Previous Word Camel Case with Selection"));
+ [] (TextEditorWidget *w) { w->gotoPreviousWordCamelCaseWithSelection(); }, false, Tr::tr("Go to Previous Word Camel Case with Selection"));
registerAction(GOTO_NEXT_WORD_CAMEL_CASE_WITH_SELECTION,
- [] (TextEditorWidget *w) { w->gotoNextWordCamelCaseWithSelection(); }, false, tr("Go to Next Word Camel Case with Selection"));
+ [] (TextEditorWidget *w) { w->gotoNextWordCamelCaseWithSelection(); }, false, Tr::tr("Go to Next Word Camel Case with Selection"));
// Collect additional modifying actions so we can check for them inside a readonly file
// and disable them
diff --git a/src/plugins/texteditor/texteditorplugin.cpp b/src/plugins/texteditor/texteditorplugin.cpp
index a60ad61aadb..254389c9572 100644
--- a/src/plugins/texteditor/texteditorplugin.cpp
+++ b/src/plugins/texteditor/texteditorplugin.cpp
@@ -8,14 +8,16 @@
#include "findinopenfiles.h"
#include "fontsettings.h"
#include "highlighter.h"
+#include "icodestylepreferences.h"
#include "linenumberfilter.h"
#include "outlinefactory.h"
#include "plaintexteditorfactory.h"
#include "snippets/snippetprovider.h"
+#include "tabsettings.h"
#include "textdocument.h"
#include "texteditor.h"
-#include "texteditoractionhandler.h"
#include "texteditorsettings.h"
+#include "texteditortr.h"
#include
#include
@@ -24,31 +26,26 @@
#include
#include
#include
-#include
-#include
-#include
+#include
#include
#include
#include
-#include
-#include
-
using namespace Core;
using namespace Utils;
namespace TextEditor {
namespace Internal {
-static const char kCurrentDocumentSelection[] = "CurrentDocument:Selection";
-static const char kCurrentDocumentRow[] = "CurrentDocument:Row";
-static const char kCurrentDocumentColumn[] = "CurrentDocument:Column";
-static const char kCurrentDocumentRowCount[] = "CurrentDocument:RowCount";
-static const char kCurrentDocumentColumnCount[] = "CurrentDocument:ColumnCount";
-static const char kCurrentDocumentFontSize[] = "CurrentDocument:FontSize";
-static const char kCurrentDocumentWordUnderCursor[] = "CurrentDocument:WordUnderCursor";
+const char kCurrentDocumentSelection[] = "CurrentDocument:Selection";
+const char kCurrentDocumentRow[] = "CurrentDocument:Row";
+const char kCurrentDocumentColumn[] = "CurrentDocument:Column";
+const char kCurrentDocumentRowCount[] = "CurrentDocument:RowCount";
+const char kCurrentDocumentColumnCount[] = "CurrentDocument:ColumnCount";
+const char kCurrentDocumentFontSize[] = "CurrentDocument:FontSize";
+const char kCurrentDocumentWordUnderCursor[] = "CurrentDocument:WordUnderCursor";
class TextEditorPluginPrivate : public QObject
{
@@ -101,9 +98,9 @@ bool TextEditorPlugin::initialize(const QStringList &arguments, QString *errorMe
Context context(TextEditor::Constants::C_TEXTEDITOR);
// Add shortcut for invoking automatic completion
- QAction *completionAction = new QAction(tr("Trigger Completion"), this);
+ QAction *completionAction = new QAction(Tr::tr("Trigger Completion"), this);
Command *command = ActionManager::registerAction(completionAction, Constants::COMPLETE_THIS, context);
- command->setDefaultKeySequence(QKeySequence(useMacShortcuts ? tr("Meta+Space") : tr("Ctrl+Space")));
+ command->setDefaultKeySequence(QKeySequence(useMacShortcuts ? Tr::tr("Meta+Space") : Tr::tr("Ctrl+Space")));
connect(completionAction, &QAction::triggered, this, [] {
if (BaseTextEditor *editor = BaseTextEditor::currentTextEditor())
editor->editorWidget()->invokeAssist(Completion);
@@ -114,25 +111,25 @@ bool TextEditorPlugin::initialize(const QStringList &arguments, QString *errorMe
Utils::FancyLineEdit::setCompletionShortcut(command->keySequence());
// Add shortcut for invoking function hint completion
- QAction *functionHintAction = new QAction(tr("Display Function Hint"), this);
+ QAction *functionHintAction = new QAction(Tr::tr("Display Function Hint"), this);
command = ActionManager::registerAction(functionHintAction, Constants::FUNCTION_HINT, context);
- command->setDefaultKeySequence(QKeySequence(useMacShortcuts ? tr("Meta+Shift+D")
- : tr("Ctrl+Shift+D")));
+ command->setDefaultKeySequence(QKeySequence(useMacShortcuts ? Tr::tr("Meta+Shift+D")
+ : Tr::tr("Ctrl+Shift+D")));
connect(functionHintAction, &QAction::triggered, this, [] {
if (BaseTextEditor *editor = BaseTextEditor::currentTextEditor())
editor->editorWidget()->invokeAssist(FunctionHint);
});
// Add shortcut for invoking quick fix options
- QAction *quickFixAction = new QAction(tr("Trigger Refactoring Action"), this);
+ QAction *quickFixAction = new QAction(Tr::tr("Trigger Refactoring Action"), this);
Command *quickFixCommand = ActionManager::registerAction(quickFixAction, Constants::QUICKFIX_THIS, context);
- quickFixCommand->setDefaultKeySequence(QKeySequence(tr("Alt+Return")));
+ quickFixCommand->setDefaultKeySequence(QKeySequence(Tr::tr("Alt+Return")));
connect(quickFixAction, &QAction::triggered, this, [] {
if (BaseTextEditor *editor = BaseTextEditor::currentTextEditor())
editor->editorWidget()->invokeAssist(QuickFix);
});
- QAction *showContextMenuAction = new QAction(tr("Show Context Menu"), this);
+ QAction *showContextMenuAction = new QAction(Tr::tr("Show Context Menu"), this);
ActionManager::registerAction(showContextMenuAction,
Constants::SHOWCONTEXTMENU,
context);
@@ -143,7 +140,7 @@ bool TextEditorPlugin::initialize(const QStringList &arguments, QString *errorMe
// Add text snippet provider.
SnippetProvider::registerGroup(Constants::TEXT_SNIPPET_GROUP_ID,
- tr("Text", "SnippetProvider"));
+ Tr::tr("Text", "SnippetProvider"));
d->createStandardContextMenu();
@@ -184,7 +181,7 @@ void TextEditorPlugin::extensionsInitialized()
Utils::MacroExpander *expander = Utils::globalMacroExpander();
expander->registerVariable(kCurrentDocumentSelection,
- tr("Selected text within the current document."),
+ Tr::tr("Selected text within the current document."),
[]() -> QString {
QString value;
if (BaseTextEditor *editor = BaseTextEditor::currentTextEditor()) {
@@ -195,42 +192,42 @@ void TextEditorPlugin::extensionsInitialized()
});
expander->registerIntVariable(kCurrentDocumentRow,
- tr("Line number of the text cursor position in current document (starts with 1)."),
+ Tr::tr("Line number of the text cursor position in current document (starts with 1)."),
[]() -> int {
BaseTextEditor *editor = BaseTextEditor::currentTextEditor();
return editor ? editor->currentLine() : 0;
});
expander->registerIntVariable(kCurrentDocumentColumn,
- tr("Column number of the text cursor position in current document (starts with 0)."),
+ Tr::tr("Column number of the text cursor position in current document (starts with 0)."),
[]() -> int {
BaseTextEditor *editor = BaseTextEditor::currentTextEditor();
return editor ? editor->currentColumn() : 0;
});
expander->registerIntVariable(kCurrentDocumentRowCount,
- tr("Number of lines visible in current document."),
+ Tr::tr("Number of lines visible in current document."),
[]() -> int {
BaseTextEditor *editor = BaseTextEditor::currentTextEditor();
return editor ? editor->rowCount() : 0;
});
expander->registerIntVariable(kCurrentDocumentColumnCount,
- tr("Number of columns visible in current document."),
+ Tr::tr("Number of columns visible in current document."),
[]() -> int {
BaseTextEditor *editor = BaseTextEditor::currentTextEditor();
return editor ? editor->columnCount() : 0;
});
expander->registerIntVariable(kCurrentDocumentFontSize,
- tr("Current document's font size in points."),
+ Tr::tr("Current document's font size in points."),
[]() -> int {
BaseTextEditor *editor = BaseTextEditor::currentTextEditor();
return editor ? editor->widget()->font().pointSize() : 0;
});
expander->registerVariable(kCurrentDocumentWordUnderCursor,
- tr("Word under the current document's text cursor."), [] {
+ Tr::tr("Word under the current document's text cursor."), [] {
BaseTextEditor *editor = BaseTextEditor::currentTextEditor();
if (!editor)
return QString();
diff --git a/src/plugins/texteditor/texteditorsettings.cpp b/src/plugins/texteditor/texteditorsettings.cpp
index d01c5f22c49..8f6bab2c5f3 100644
--- a/src/plugins/texteditor/texteditorsettings.cpp
+++ b/src/plugins/texteditor/texteditorsettings.cpp
@@ -17,15 +17,15 @@
#include "icodestylepreferencesfactory.h"
#include "marginsettings.h"
#include "storagesettings.h"
-#include "tabsettings.h"
-#include "texteditor.h"
+#include "texteditortr.h"
#include "typingsettings.h"
+#include "snippets/snippetssettingspage.h"
-#include
-
-#include
#include
#include
+
+#include
+
#include
#include
@@ -39,8 +39,6 @@ namespace Internal {
class TextEditorSettingsPrivate
{
- Q_DECLARE_TR_FUNCTIONS(TextEditor::TextEditorSettings)
-
public:
FontSettings m_fontSettings;
FontSettingsPage m_fontSettingsPage{&m_fontSettings, initialFormats()};
@@ -65,343 +63,343 @@ FormatDescriptions TextEditorSettingsPrivate::initialFormats()
// Add font preference page
FormatDescriptions formatDescr;
formatDescr.reserve(C_LAST_STYLE_SENTINEL);
- formatDescr.emplace_back(C_TEXT, tr("Text"),
- tr("Generic text and punctuation tokens.\n"
- "Applied to text that matched no other rule."),
+ formatDescr.emplace_back(C_TEXT, Tr::tr("Text"),
+ Tr::tr("Generic text and punctuation tokens.\n"
+ "Applied to text that matched no other rule."),
Format{Qt::black, Qt::white});
// Special categories
const QPalette p = QApplication::palette();
- formatDescr.emplace_back(C_LINK, tr("Link"),
- tr("Links that follow symbol under cursor."), Qt::blue);
- formatDescr.emplace_back(C_SELECTION, tr("Selection"), tr("Selected text."),
+ formatDescr.emplace_back(C_LINK, Tr::tr("Link"),
+ Tr::tr("Links that follow symbol under cursor."), Qt::blue);
+ formatDescr.emplace_back(C_SELECTION, Tr::tr("Selection"), Tr::tr("Selected text."),
p.color(QPalette::HighlightedText));
- formatDescr.emplace_back(C_LINE_NUMBER, tr("Line Number"),
- tr("Line numbers located on the left side of the editor."),
+ formatDescr.emplace_back(C_LINE_NUMBER, Tr::tr("Line Number"),
+ Tr::tr("Line numbers located on the left side of the editor."),
FormatDescription::ShowAllAbsoluteControlsExceptUnderline);
- formatDescr.emplace_back(C_SEARCH_RESULT, tr("Search Result"),
- tr("Highlighted search results inside the editor."),
+ formatDescr.emplace_back(C_SEARCH_RESULT, Tr::tr("Search Result"),
+ Tr::tr("Highlighted search results inside the editor."),
FormatDescription::ShowBackgroundControl);
- formatDescr.emplace_back(C_SEARCH_RESULT_ALT1, tr("Search Result (Alternative 1)"),
- tr("Highlighted search results inside the editor.\n"
- "Used to mark read accesses to C++ symbols."),
+ formatDescr.emplace_back(C_SEARCH_RESULT_ALT1, Tr::tr("Search Result (Alternative 1)"),
+ Tr::tr("Highlighted search results inside the editor.\n"
+ "Used to mark read accesses to C++ symbols."),
FormatDescription::ShowBackgroundControl);
- formatDescr.emplace_back(C_SEARCH_RESULT_ALT2, tr("Search Result (Alternative 2)"),
- tr("Highlighted search results inside the editor.\n"
- "Used to mark write accesses to C++ symbols."),
+ formatDescr.emplace_back(C_SEARCH_RESULT_ALT2, Tr::tr("Search Result (Alternative 2)"),
+ Tr::tr("Highlighted search results inside the editor.\n"
+ "Used to mark write accesses to C++ symbols."),
FormatDescription::ShowBackgroundControl);
formatDescr.emplace_back(C_SEARCH_RESULT_CONTAINING_FUNCTION,
- tr("Search Result Containing function"),
- tr("Highlighted search results inside the editor.\n"
- "Used to mark containing function of the symbol usage."),
+ Tr::tr("Search Result Containing function"),
+ Tr::tr("Highlighted search results inside the editor.\n"
+ "Used to mark containing function of the symbol usage."),
FormatDescription::ShowForeAndBackgroundControl);
- formatDescr.emplace_back(C_SEARCH_SCOPE, tr("Search Scope"),
- tr("Section where the pattern is searched in."),
+ formatDescr.emplace_back(C_SEARCH_SCOPE, Tr::tr("Search Scope"),
+ Tr::tr("Section where the pattern is searched in."),
FormatDescription::ShowBackgroundControl);
- formatDescr.emplace_back(C_PARENTHESES, tr("Parentheses"),
- tr("Displayed when matching parentheses, square brackets "
- "or curly brackets are found."));
- formatDescr.emplace_back(C_PARENTHESES_MISMATCH, tr("Mismatched Parentheses"),
- tr("Displayed when mismatched parentheses, "
- "square brackets, or curly brackets are found."));
- formatDescr.emplace_back(C_AUTOCOMPLETE, tr("Auto Complete"),
- tr("Displayed when a character is automatically inserted "
- "like brackets or quotes."));
- formatDescr.emplace_back(C_CURRENT_LINE, tr("Current Line"),
- tr("Line where the cursor is placed in."),
+ formatDescr.emplace_back(C_PARENTHESES, Tr::tr("Parentheses"),
+ Tr::tr("Displayed when matching parentheses, square brackets "
+ "or curly brackets are found."));
+ formatDescr.emplace_back(C_PARENTHESES_MISMATCH, Tr::tr("Mismatched Parentheses"),
+ Tr::tr("Displayed when mismatched parentheses, "
+ "square brackets, or curly brackets are found."));
+ formatDescr.emplace_back(C_AUTOCOMPLETE, Tr::tr("Auto Complete"),
+ Tr::tr("Displayed when a character is automatically inserted "
+ "like brackets or quotes."));
+ formatDescr.emplace_back(C_CURRENT_LINE, Tr::tr("Current Line"),
+ Tr::tr("Line where the cursor is placed in."),
FormatDescription::ShowBackgroundControl);
FormatDescription currentLineNumber(C_CURRENT_LINE_NUMBER,
- tr("Current Line Number"),
- tr("Line number located on the left side of the "
- "editor where the cursor is placed in."),
+ Tr::tr("Current Line Number"),
+ Tr::tr("Line number located on the left side of the "
+ "editor where the cursor is placed in."),
Qt::darkGray,
FormatDescription::ShowAllAbsoluteControlsExceptUnderline);
currentLineNumber.format().setBold(true);
formatDescr.push_back(std::move(currentLineNumber));
- formatDescr.emplace_back(C_OCCURRENCES, tr("Occurrences"),
- tr("Occurrences of the symbol under the cursor.\n"
- "(Only the background will be applied.)"),
+ formatDescr.emplace_back(C_OCCURRENCES, Tr::tr("Occurrences"),
+ Tr::tr("Occurrences of the symbol under the cursor.\n"
+ "(Only the background will be applied.)"),
FormatDescription::ShowBackgroundControl);
formatDescr.emplace_back(C_OCCURRENCES_UNUSED,
- tr("Unused Occurrence"),
- tr("Occurrences of unused variables."),
+ Tr::tr("Unused Occurrence"),
+ Tr::tr("Occurrences of unused variables."),
Qt::darkYellow,
QTextCharFormat::SingleUnderline);
- formatDescr.emplace_back(C_OCCURRENCES_RENAME, tr("Renaming Occurrence"),
- tr("Occurrences of a symbol that will be renamed."),
+ formatDescr.emplace_back(C_OCCURRENCES_RENAME, Tr::tr("Renaming Occurrence"),
+ Tr::tr("Occurrences of a symbol that will be renamed."),
FormatDescription::ShowBackgroundControl);
// Standard categories
- formatDescr.emplace_back(C_NUMBER, tr("Number"), tr("Number literal."),
+ formatDescr.emplace_back(C_NUMBER, Tr::tr("Number"), Tr::tr("Number literal."),
Qt::darkBlue);
- formatDescr.emplace_back(C_STRING, tr("String"),
- tr("Character and string literals."), Qt::darkGreen);
- formatDescr.emplace_back(C_PRIMITIVE_TYPE, tr("Primitive Type"),
- tr("Name of a primitive data type."), Qt::darkYellow);
- formatDescr.emplace_back(C_TYPE, tr("Type"), tr("Name of a type."),
+ formatDescr.emplace_back(C_STRING, Tr::tr("String"),
+ Tr::tr("Character and string literals."), Qt::darkGreen);
+ formatDescr.emplace_back(C_PRIMITIVE_TYPE, Tr::tr("Primitive Type"),
+ Tr::tr("Name of a primitive data type."), Qt::darkYellow);
+ formatDescr.emplace_back(C_TYPE, Tr::tr("Type"), Tr::tr("Name of a type."),
Qt::darkMagenta);
- formatDescr.emplace_back(C_NAMESPACE, tr("Namespace"), tr("Name of a namespace."),
+ formatDescr.emplace_back(C_NAMESPACE, Tr::tr("Namespace"), Tr::tr("Name of a namespace."),
Qt::darkGreen);
- formatDescr.emplace_back(C_LOCAL, tr("Local"),
- tr("Local variables."), QColor(9, 46, 100));
- formatDescr.emplace_back(C_PARAMETER, tr("Parameter"),
- tr("Function or method parameters."), QColor(9, 46, 100));
- formatDescr.emplace_back(C_FIELD, tr("Field"),
- tr("Class' data members."), Qt::darkRed);
- formatDescr.emplace_back(C_GLOBAL, tr("Global"),
- tr("Global variables."), QColor(206, 92, 0));
- formatDescr.emplace_back(C_ENUMERATION, tr("Enumeration"),
- tr("Applied to enumeration items."), Qt::darkMagenta);
+ formatDescr.emplace_back(C_LOCAL, Tr::tr("Local"),
+ Tr::tr("Local variables."), QColor(9, 46, 100));
+ formatDescr.emplace_back(C_PARAMETER, Tr::tr("Parameter"),
+ Tr::tr("Function or method parameters."), QColor(9, 46, 100));
+ formatDescr.emplace_back(C_FIELD, Tr::tr("Field"),
+ Tr::tr("Class' data members."), Qt::darkRed);
+ formatDescr.emplace_back(C_GLOBAL, Tr::tr("Global"),
+ Tr::tr("Global variables."), QColor(206, 92, 0));
+ formatDescr.emplace_back(C_ENUMERATION, Tr::tr("Enumeration"),
+ Tr::tr("Applied to enumeration items."), Qt::darkMagenta);
Format functionFormat;
functionFormat.setForeground(QColor(0, 103, 124));
- formatDescr.emplace_back(C_FUNCTION, tr("Function"), tr("Name of a function."),
+ formatDescr.emplace_back(C_FUNCTION, Tr::tr("Function"), Tr::tr("Name of a function."),
functionFormat);
Format declarationFormat;
declarationFormat.setBold(true);
formatDescr.emplace_back(C_DECLARATION,
- tr("Declaration"),
- tr("Style adjustments to declarations."),
+ Tr::tr("Declaration"),
+ Tr::tr("Style adjustments to declarations."),
declarationFormat,
FormatDescription::ShowAllControls);
formatDescr.emplace_back(C_FUNCTION_DEFINITION,
- tr("Function Definition"),
- tr("Name of function at its definition."),
+ Tr::tr("Function Definition"),
+ Tr::tr("Name of function at its definition."),
FormatDescription::ShowAllControls);
Format virtualFunctionFormat(functionFormat);
virtualFunctionFormat.setItalic(true);
- formatDescr.emplace_back(C_VIRTUAL_METHOD, tr("Virtual Function"),
- tr("Name of function declared as virtual."),
+ formatDescr.emplace_back(C_VIRTUAL_METHOD, Tr::tr("Virtual Function"),
+ Tr::tr("Name of function declared as virtual."),
virtualFunctionFormat);
- formatDescr.emplace_back(C_BINDING, tr("QML Binding"),
- tr("QML item property, that allows a "
- "binding to another property."),
+ formatDescr.emplace_back(C_BINDING, Tr::tr("QML Binding"),
+ Tr::tr("QML item property, that allows a "
+ "binding to another property."),
Qt::darkRed);
Format qmlLocalNameFormat;
qmlLocalNameFormat.setItalic(true);
- formatDescr.emplace_back(C_QML_LOCAL_ID, tr("QML Local Id"),
- tr("QML item id within a QML file."), qmlLocalNameFormat);
+ formatDescr.emplace_back(C_QML_LOCAL_ID, Tr::tr("QML Local Id"),
+ Tr::tr("QML item id within a QML file."), qmlLocalNameFormat);
formatDescr.emplace_back(C_QML_ROOT_OBJECT_PROPERTY,
- tr("QML Root Object Property"),
- tr("QML property of a parent item."), qmlLocalNameFormat);
+ Tr::tr("QML Root Object Property"),
+ Tr::tr("QML property of a parent item."), qmlLocalNameFormat);
formatDescr.emplace_back(C_QML_SCOPE_OBJECT_PROPERTY,
- tr("QML Scope Object Property"),
- tr("Property of the same QML item."), qmlLocalNameFormat);
- formatDescr.emplace_back(C_QML_STATE_NAME, tr("QML State Name"),
- tr("Name of a QML state."), qmlLocalNameFormat);
+ Tr::tr("QML Scope Object Property"),
+ Tr::tr("Property of the same QML item."), qmlLocalNameFormat);
+ formatDescr.emplace_back(C_QML_STATE_NAME, Tr::tr("QML State Name"),
+ Tr::tr("Name of a QML state."), qmlLocalNameFormat);
- formatDescr.emplace_back(C_QML_TYPE_ID, tr("QML Type Name"),
- tr("Name of a QML type."), Qt::darkMagenta);
+ formatDescr.emplace_back(C_QML_TYPE_ID, Tr::tr("QML Type Name"),
+ Tr::tr("Name of a QML type."), Qt::darkMagenta);
Format qmlExternalNameFormat = qmlLocalNameFormat;
qmlExternalNameFormat.setForeground(Qt::darkBlue);
- formatDescr.emplace_back(C_QML_EXTERNAL_ID, tr("QML External Id"),
- tr("QML id defined in another QML file."),
+ formatDescr.emplace_back(C_QML_EXTERNAL_ID, Tr::tr("QML External Id"),
+ Tr::tr("QML id defined in another QML file."),
qmlExternalNameFormat);
formatDescr.emplace_back(C_QML_EXTERNAL_OBJECT_PROPERTY,
- tr("QML External Object Property"),
- tr("QML property defined in another QML file."),
+ Tr::tr("QML External Object Property"),
+ Tr::tr("QML property defined in another QML file."),
qmlExternalNameFormat);
Format jsLocalFormat;
jsLocalFormat.setForeground(QColor(41, 133, 199)); // very light blue
jsLocalFormat.setItalic(true);
- formatDescr.emplace_back(C_JS_SCOPE_VAR, tr("JavaScript Scope Var"),
- tr("Variables defined inside the JavaScript file."),
+ formatDescr.emplace_back(C_JS_SCOPE_VAR, Tr::tr("JavaScript Scope Var"),
+ Tr::tr("Variables defined inside the JavaScript file."),
jsLocalFormat);
Format jsGlobalFormat;
jsGlobalFormat.setForeground(QColor(0, 85, 175)); // light blue
jsGlobalFormat.setItalic(true);
- formatDescr.emplace_back(C_JS_IMPORT_VAR, tr("JavaScript Import"),
- tr("Name of a JavaScript import inside a QML file."),
+ formatDescr.emplace_back(C_JS_IMPORT_VAR, Tr::tr("JavaScript Import"),
+ Tr::tr("Name of a JavaScript import inside a QML file."),
jsGlobalFormat);
- formatDescr.emplace_back(C_JS_GLOBAL_VAR, tr("JavaScript Global Variable"),
- tr("Variables defined outside the script."),
+ formatDescr.emplace_back(C_JS_GLOBAL_VAR, Tr::tr("JavaScript Global Variable"),
+ Tr::tr("Variables defined outside the script."),
jsGlobalFormat);
- formatDescr.emplace_back(C_KEYWORD, tr("Keyword"),
- tr("Reserved keywords of the programming language except "
+ formatDescr.emplace_back(C_KEYWORD, Tr::tr("Keyword"),
+ Tr::tr("Reserved keywords of the programming language except "
"keywords denoting primitive types."), Qt::darkYellow);
- formatDescr.emplace_back(C_PUNCTUATION, tr("Punctuation"),
- tr("Punctuation excluding operators."));
- formatDescr.emplace_back(C_OPERATOR, tr("Operator"),
- tr("Non user-defined language operators.\n"
- "To style user-defined operators, use Overloaded Operator."),
+ formatDescr.emplace_back(C_PUNCTUATION, Tr::tr("Punctuation"),
+ Tr::tr("Punctuation excluding operators."));
+ formatDescr.emplace_back(C_OPERATOR, Tr::tr("Operator"),
+ Tr::tr("Non user-defined language operators.\n"
+ "To style user-defined operators, use Overloaded Operator."),
FormatDescription::ShowAllControls);
formatDescr.emplace_back(C_OVERLOADED_OPERATOR,
- tr("Overloaded Operators"),
- tr("Calls and declarations of overloaded (user-defined) operators."),
+ Tr::tr("Overloaded Operators"),
+ Tr::tr("Calls and declarations of overloaded (user-defined) operators."),
functionFormat,
FormatDescription::ShowAllControls);
- formatDescr.emplace_back(C_PREPROCESSOR, tr("Preprocessor"),
- tr("Preprocessor directives."), Qt::darkBlue);
- formatDescr.emplace_back(C_MACRO, tr("Macro"),
- tr("Macros."), functionFormat);
- formatDescr.emplace_back(C_LABEL, tr("Label"), tr("Labels for goto statements."),
+ formatDescr.emplace_back(C_PREPROCESSOR, Tr::tr("Preprocessor"),
+ Tr::tr("Preprocessor directives."), Qt::darkBlue);
+ formatDescr.emplace_back(C_MACRO, Tr::tr("Macro"),
+ Tr::tr("Macros."), functionFormat);
+ formatDescr.emplace_back(C_LABEL, Tr::tr("Label"), Tr::tr("Labels for goto statements."),
Qt::darkRed);
- formatDescr.emplace_back(C_COMMENT, tr("Comment"),
- tr("All style of comments except Doxygen comments."),
+ formatDescr.emplace_back(C_COMMENT, Tr::tr("Comment"),
+ Tr::tr("All style of comments except Doxygen comments."),
Qt::darkGreen);
- formatDescr.emplace_back(C_DOXYGEN_COMMENT, tr("Doxygen Comment"),
- tr("Doxygen comments."), Qt::darkBlue);
- formatDescr.emplace_back(C_DOXYGEN_TAG, tr("Doxygen Tag"), tr("Doxygen tags."),
+ formatDescr.emplace_back(C_DOXYGEN_COMMENT, Tr::tr("Doxygen Comment"),
+ Tr::tr("Doxygen comments."), Qt::darkBlue);
+ formatDescr.emplace_back(C_DOXYGEN_TAG, Tr::tr("Doxygen Tag"), Tr::tr("Doxygen tags."),
Qt::blue);
- formatDescr.emplace_back(C_VISUAL_WHITESPACE, tr("Visual Whitespace"),
- tr("Whitespace.\nWill not be applied to whitespace "
- "in comments and strings."), Qt::lightGray);
- formatDescr.emplace_back(C_DISABLED_CODE, tr("Disabled Code"),
- tr("Code disabled by preprocessor directives."));
+ formatDescr.emplace_back(C_VISUAL_WHITESPACE, Tr::tr("Visual Whitespace"),
+ Tr::tr("Whitespace.\nWill not be applied to whitespace "
+ "in comments and strings."), Qt::lightGray);
+ formatDescr.emplace_back(C_DISABLED_CODE, Tr::tr("Disabled Code"),
+ Tr::tr("Code disabled by preprocessor directives."));
// Diff categories
- formatDescr.emplace_back(C_ADDED_LINE, tr("Added Line"),
- tr("Applied to added lines in differences (in diff editor)."),
+ formatDescr.emplace_back(C_ADDED_LINE, Tr::tr("Added Line"),
+ Tr::tr("Applied to added lines in differences (in diff editor)."),
QColor(0, 170, 0));
- formatDescr.emplace_back(C_REMOVED_LINE, tr("Removed Line"),
- tr("Applied to removed lines in differences (in diff editor)."),
+ formatDescr.emplace_back(C_REMOVED_LINE, Tr::tr("Removed Line"),
+ Tr::tr("Applied to removed lines in differences (in diff editor)."),
Qt::red);
- formatDescr.emplace_back(C_DIFF_FILE, tr("Diff File"),
- tr("Compared files (in diff editor)."), Qt::darkBlue);
- formatDescr.emplace_back(C_DIFF_LOCATION, tr("Diff Location"),
- tr("Location in the files where the difference is "
- "(in diff editor)."), Qt::blue);
+ formatDescr.emplace_back(C_DIFF_FILE, Tr::tr("Diff File"),
+ Tr::tr("Compared files (in diff editor)."), Qt::darkBlue);
+ formatDescr.emplace_back(C_DIFF_LOCATION, Tr::tr("Diff Location"),
+ Tr::tr("Location in the files where the difference is "
+ "(in diff editor)."), Qt::blue);
// New diff categories
- formatDescr.emplace_back(C_DIFF_FILE_LINE, tr("Diff File Line"),
- tr("Applied to lines with file information "
- "in differences (in side-by-side diff editor)."),
+ formatDescr.emplace_back(C_DIFF_FILE_LINE, Tr::tr("Diff File Line"),
+ Tr::tr("Applied to lines with file information "
+ "in differences (in side-by-side diff editor)."),
Format(QColor(), QColor(255, 255, 0)));
- formatDescr.emplace_back(C_DIFF_CONTEXT_LINE, tr("Diff Context Line"),
- tr("Applied to lines describing hidden context "
- "in differences (in side-by-side diff editor)."),
+ formatDescr.emplace_back(C_DIFF_CONTEXT_LINE, Tr::tr("Diff Context Line"),
+ Tr::tr("Applied to lines describing hidden context "
+ "in differences (in side-by-side diff editor)."),
Format(QColor(), QColor(175, 215, 231)));
- formatDescr.emplace_back(C_DIFF_SOURCE_LINE, tr("Diff Source Line"),
- tr("Applied to source lines with changes "
- "in differences (in side-by-side diff editor)."),
+ formatDescr.emplace_back(C_DIFF_SOURCE_LINE, Tr::tr("Diff Source Line"),
+ Tr::tr("Applied to source lines with changes "
+ "in differences (in side-by-side diff editor)."),
Format(QColor(), QColor(255, 223, 223)));
- formatDescr.emplace_back(C_DIFF_SOURCE_CHAR, tr("Diff Source Character"),
- tr("Applied to removed characters "
- "in differences (in side-by-side diff editor)."),
+ formatDescr.emplace_back(C_DIFF_SOURCE_CHAR, Tr::tr("Diff Source Character"),
+ Tr::tr("Applied to removed characters "
+ "in differences (in side-by-side diff editor)."),
Format(QColor(), QColor(255, 175, 175)));
- formatDescr.emplace_back(C_DIFF_DEST_LINE, tr("Diff Destination Line"),
- tr("Applied to destination lines with changes "
- "in differences (in side-by-side diff editor)."),
+ formatDescr.emplace_back(C_DIFF_DEST_LINE, Tr::tr("Diff Destination Line"),
+ Tr::tr("Applied to destination lines with changes "
+ "in differences (in side-by-side diff editor)."),
Format(QColor(), QColor(223, 255, 223)));
- formatDescr.emplace_back(C_DIFF_DEST_CHAR, tr("Diff Destination Character"),
- tr("Applied to added characters "
- "in differences (in side-by-side diff editor)."),
+ formatDescr.emplace_back(C_DIFF_DEST_CHAR, Tr::tr("Diff Destination Character"),
+ Tr::tr("Applied to added characters "
+ "in differences (in side-by-side diff editor)."),
Format(QColor(), QColor(175, 255, 175)));
- formatDescr.emplace_back(C_LOG_CHANGE_LINE, tr("Log Change Line"),
- tr("Applied to lines describing changes in VCS log."),
+ formatDescr.emplace_back(C_LOG_CHANGE_LINE, Tr::tr("Log Change Line"),
+ Tr::tr("Applied to lines describing changes in VCS log."),
Format(QColor(192, 0, 0), QColor()));
- formatDescr.emplace_back(C_LOG_AUTHOR_NAME, tr("Log Author Name"),
- tr("Applied to author names in VCS log."),
+ formatDescr.emplace_back(C_LOG_AUTHOR_NAME, Tr::tr("Log Author Name"),
+ Tr::tr("Applied to author names in VCS log."),
Format(QColor(0x007af4), QColor()));
- formatDescr.emplace_back(C_LOG_COMMIT_DATE, tr("Log Commit Date"),
- tr("Applied to commit dates in VCS log."),
+ formatDescr.emplace_back(C_LOG_COMMIT_DATE, Tr::tr("Log Commit Date"),
+ Tr::tr("Applied to commit dates in VCS log."),
Format(QColor(0x006600), QColor()));
- formatDescr.emplace_back(C_LOG_COMMIT_HASH, tr("Log Commit Hash"),
- tr("Applied to commit hashes in VCS log."),
+ formatDescr.emplace_back(C_LOG_COMMIT_HASH, Tr::tr("Log Commit Hash"),
+ Tr::tr("Applied to commit hashes in VCS log."),
Format(QColor(0xff0000), QColor()));
- formatDescr.emplace_back(C_LOG_DECORATION, tr("Log Decoration"),
- tr("Applied to commit decorations in VCS log."),
+ formatDescr.emplace_back(C_LOG_DECORATION, Tr::tr("Log Decoration"),
+ Tr::tr("Applied to commit decorations in VCS log."),
Format(QColor(0xff00ff), QColor()));
- formatDescr.emplace_back(C_LOG_COMMIT_SUBJECT, tr("Log Commit Subject"),
- tr("Applied to commit subjects in VCS log."),
+ formatDescr.emplace_back(C_LOG_COMMIT_SUBJECT, Tr::tr("Log Commit Subject"),
+ Tr::tr("Applied to commit subjects in VCS log."),
Format{QColor{}, QColor{}});
// Mixin categories
formatDescr.emplace_back(C_ERROR,
- tr("Error"),
- tr("Underline color of error diagnostics."),
+ Tr::tr("Error"),
+ Tr::tr("Underline color of error diagnostics."),
QColor(255,0, 0),
QTextCharFormat::SingleUnderline,
FormatDescription::ShowAllControls);
formatDescr.emplace_back(C_ERROR_CONTEXT,
- tr("Error Context"),
- tr("Underline color of the contexts of error diagnostics."),
+ Tr::tr("Error Context"),
+ Tr::tr("Underline color of the contexts of error diagnostics."),
QColor(255,0, 0),
QTextCharFormat::DotLine,
FormatDescription::ShowAllControls);
formatDescr.emplace_back(C_WARNING,
- tr("Warning"),
- tr("Underline color of warning diagnostics."),
+ Tr::tr("Warning"),
+ Tr::tr("Underline color of warning diagnostics."),
QColor(255, 190, 0),
QTextCharFormat::SingleUnderline,
FormatDescription::ShowAllControls);
formatDescr.emplace_back(C_WARNING_CONTEXT,
- tr("Warning Context"),
- tr("Underline color of the contexts of warning diagnostics."),
+ Tr::tr("Warning Context"),
+ Tr::tr("Underline color of the contexts of warning diagnostics."),
QColor(255, 190, 0),
QTextCharFormat::DotLine,
FormatDescription::ShowAllControls);
Format outputArgumentFormat;
outputArgumentFormat.setItalic(true);
formatDescr.emplace_back(C_OUTPUT_ARGUMENT,
- tr("Output Argument"),
- tr("Writable arguments of a function call."),
+ Tr::tr("Output Argument"),
+ Tr::tr("Writable arguments of a function call."),
outputArgumentFormat,
FormatDescription::ShowAllControls);
formatDescr.emplace_back(C_STATIC_MEMBER,
- tr("Static Member"),
- tr("Names of static fields or member functions."),
+ Tr::tr("Static Member"),
+ Tr::tr("Names of static fields or member functions."),
FormatDescription::ShowAllControls);
const auto cocoControls = FormatDescription::ShowControls(
FormatDescription::ShowAllAbsoluteControls | FormatDescription::ShowRelativeControls);
formatDescr.emplace_back(C_COCO_CODE_ADDED,
- tr("Code Coverage Added Code"),
- tr("New code that was not checked for tests."),
+ Tr::tr("Code Coverage Added Code"),
+ Tr::tr("New code that was not checked for tests."),
cocoControls);
formatDescr.emplace_back(C_COCO_PARTIALLY_COVERED,
- tr("Partially Covered Code"),
- tr("Partial branch/condition coverage."),
+ Tr::tr("Partially Covered Code"),
+ Tr::tr("Partial branch/condition coverage."),
Qt::darkYellow,
cocoControls);
formatDescr.emplace_back(C_COCO_NOT_COVERED,
- tr("Uncovered Code"),
- tr("Not covered at all."),
+ Tr::tr("Uncovered Code"),
+ Tr::tr("Not covered at all."),
Qt::red,
cocoControls);
formatDescr.emplace_back(C_COCO_FULLY_COVERED,
- tr("Fully Covered Code"),
- tr("Fully covered code."),
+ Tr::tr("Fully Covered Code"),
+ Tr::tr("Fully covered code."),
Qt::green,
cocoControls);
formatDescr.emplace_back(C_COCO_MANUALLY_VALIDATED,
- tr("Manually Validated Code"),
- tr("User added validation."),
+ Tr::tr("Manually Validated Code"),
+ Tr::tr("User added validation."),
Qt::blue,
cocoControls);
formatDescr.emplace_back(C_COCO_DEAD_CODE,
- tr("Code Coverage Dead Code"),
- tr("Unreachable code."),
+ Tr::tr("Code Coverage Dead Code"),
+ Tr::tr("Unreachable code."),
Qt::magenta,
cocoControls);
formatDescr.emplace_back(C_COCO_EXECUTION_COUNT_TOO_LOW,
- tr("Code Coverage Execution Count Too Low"),
- tr("Minimum count not reached."),
+ Tr::tr("Code Coverage Execution Count Too Low"),
+ Tr::tr("Minimum count not reached."),
Qt::red,
cocoControls);
formatDescr.emplace_back(C_COCO_NOT_COVERED_INFO,
- tr("Implicitly Not Covered Code"),
- tr("PLACEHOLDER"),
+ Tr::tr("Implicitly Not Covered Code"),
+ Tr::tr("PLACEHOLDER"),
Qt::red,
cocoControls);
formatDescr.emplace_back(C_COCO_COVERED_INFO,
- tr("Implicitly Covered Code"),
- tr("PLACEHOLDER"),
+ Tr::tr("Implicitly Covered Code"),
+ Tr::tr("PLACEHOLDER"),
Qt::green,
cocoControls);
formatDescr.emplace_back(C_COCO_MANUALLY_VALIDATED_INFO,
- tr("Implicit Manual Coverage Validation"),
- tr("PLACEHOLDER"),
+ Tr::tr("Implicit Manual Coverage Validation"),
+ Tr::tr("PLACEHOLDER"),
Qt::blue,
cocoControls);
diff --git a/src/plugins/texteditor/textmark.cpp b/src/plugins/texteditor/textmark.cpp
index 5a8460f2d0c..cf391fa1060 100644
--- a/src/plugins/texteditor/textmark.cpp
+++ b/src/plugins/texteditor/textmark.cpp
@@ -299,7 +299,7 @@ void TextMark::addToToolTipLayout(QGridLayout *target) const
if (m_settingsPage.isValid()) {
auto settingsAction = new QAction;
settingsAction->setIcon(Utils::Icons::SETTINGS_TOOLBAR.icon());
- settingsAction->setToolTip(tr("Show Diagnostic Settings"));
+ settingsAction->setToolTip(Tr::tr("Show Diagnostic Settings"));
QObject::connect(settingsAction, &QAction::triggered, Core::ICore::instance(),
[id = m_settingsPage] { Core::ICore::showOptionsDialog(id); },
Qt::QueuedConnection);
diff --git a/src/plugins/texteditor/textmark.h b/src/plugins/texteditor/textmark.h
index 62bb51a1f2c..0a34139ec55 100644
--- a/src/plugins/texteditor/textmark.h
+++ b/src/plugins/texteditor/textmark.h
@@ -37,7 +37,6 @@ public:
class TEXTEDITOR_EXPORT TextMark
{
- Q_DECLARE_TR_FUNCTIONS(TextEditor::TextMark)
public:
TextMark(const Utils::FilePath &fileName,
int lineNumber,