diff options
author | Alessandro Portale <alessandro.portale@qt.io> | 2023-01-19 14:43:28 +0100 |
---|---|---|
committer | Alessandro Portale <alessandro.portale@qt.io> | 2023-01-19 15:32:29 +0000 |
commit | 16ec7205371577c5f3667d87530ca7d236b430b9 (patch) | |
tree | 1b71cdd7e2ffd032c0ad8bc13465963dc953f187 /src/plugins/diffeditor | |
parent | eeea7e8b6c46944583d3a5dde41faf25d6c6769c (diff) | |
download | qt-creator-16ec7205371577c5f3667d87530ca7d236b430b9.tar.gz |
DiffEditor: Tr::tr
Change-Id: I71b9908ea332256044120b42ff6af2fc57a89a5e
Reviewed-by: hjk <hjk@qt.io>
Diffstat (limited to 'src/plugins/diffeditor')
-rw-r--r-- | src/plugins/diffeditor/diffeditor.cpp | 21 | ||||
-rw-r--r-- | src/plugins/diffeditor/diffeditordocument.cpp | 5 | ||||
-rw-r--r-- | src/plugins/diffeditor/diffeditorplugin.cpp | 43 | ||||
-rw-r--r-- | src/plugins/diffeditor/diffeditorwidgetcontroller.cpp | 11 | ||||
-rw-r--r-- | src/plugins/diffeditor/diffview.cpp | 24 | ||||
-rw-r--r-- | src/plugins/diffeditor/sidebysidediffeditorwidget.cpp | 17 | ||||
-rw-r--r-- | src/plugins/diffeditor/unifieddiffeditorwidget.cpp | 11 |
7 files changed, 68 insertions, 64 deletions
diff --git a/src/plugins/diffeditor/diffeditor.cpp b/src/plugins/diffeditor/diffeditor.cpp index 9819bf6d69..5274214f92 100644 --- a/src/plugins/diffeditor/diffeditor.cpp +++ b/src/plugins/diffeditor/diffeditor.cpp @@ -5,6 +5,7 @@ #include "diffeditorconstants.h" #include "diffeditordocument.h" #include "diffeditoricons.h" +#include "diffeditortr.h" #include "diffview.h" #include <coreplugin/coreconstants.h> @@ -188,7 +189,7 @@ DiffEditor::DiffEditor() m_toolBar->addWidget(m_entriesComboBox); QLabel *contextLabel = new QLabel(m_toolBar); - contextLabel->setText(tr("Context lines:")); + contextLabel->setText(Tr::tr("Context lines:")); contextLabel->setContentsMargins(6, 0, 6, 0); m_contextLabelAction = m_toolBar->addWidget(contextLabel); @@ -198,14 +199,14 @@ DiffEditor::DiffEditor() m_contextSpinBox->setSizePolicy(QSizePolicy::Minimum, QSizePolicy::Expanding); // Mac Qt5 m_contextSpinBoxAction = m_toolBar->addWidget(m_contextSpinBox); - m_whitespaceButtonAction = m_toolBar->addAction(tr("Ignore Whitespace")); + m_whitespaceButtonAction = m_toolBar->addAction(Tr::tr("Ignore Whitespace")); m_whitespaceButtonAction->setCheckable(true); m_toggleDescriptionAction = m_toolBar->addAction(Icons::TOP_BAR.icon(), {}); m_toggleDescriptionAction->setCheckable(true); - m_reloadAction = m_toolBar->addAction(Utils::Icons::RELOAD_TOOLBAR.icon(), tr("Reload Diff")); - m_reloadAction->setToolTip(tr("Reload Diff")); + m_reloadAction = m_toolBar->addAction(Utils::Icons::RELOAD_TOOLBAR.icon(), Tr::tr("Reload Diff")); + m_reloadAction->setToolTip(Tr::tr("Reload Diff")); m_toggleSyncAction = m_toolBar->addAction(Utils::Icons::LINK_TOOLBAR.icon(), {}); m_toggleSyncAction->setCheckable(true); @@ -331,7 +332,7 @@ void DiffEditor::documentHasChanged() if (leftEntry.typeInfo.isEmpty() && rightEntry.typeInfo.isEmpty()) { itemToolTip = leftEntry.fileName; } else { - itemToolTip = tr("[%1] vs. [%2] %3") + itemToolTip = Tr::tr("[%1] vs. [%2] %3") .arg(leftEntry.typeInfo, rightEntry.typeInfo, leftEntry.fileName); @@ -340,17 +341,17 @@ void DiffEditor::documentHasChanged() if (leftShortFileName == rightShortFileName) { itemText = leftShortFileName; } else { - itemText = tr("%1 vs. %2") + itemText = Tr::tr("%1 vs. %2") .arg(leftShortFileName, rightShortFileName); } if (leftEntry.typeInfo.isEmpty() && rightEntry.typeInfo.isEmpty()) { - itemToolTip = tr("%1 vs. %2") + itemToolTip = Tr::tr("%1 vs. %2") .arg(leftEntry.fileName, rightEntry.fileName); } else { - itemToolTip = tr("[%1] %2 vs. [%3] %4") + itemToolTip = Tr::tr("[%1] %2 vs. [%3] %4") .arg(leftEntry.typeInfo, leftEntry.fileName, rightEntry.typeInfo, @@ -385,8 +386,8 @@ void DiffEditor::updateDescription() m_descriptionWidget->setPlainText(description); m_descriptionWidget->setVisible(m_showDescription && !description.isEmpty()); - const QString actionText = m_showDescription ? tr("Hide Change Description") - : tr("Show Change Description"); + const QString actionText = m_showDescription ? Tr::tr("Hide Change Description") + : Tr::tr("Show Change Description"); GuardLocker guard(m_ignoreChanges); m_toggleDescriptionAction->setChecked(m_showDescription); m_toggleDescriptionAction->setToolTip(actionText); diff --git a/src/plugins/diffeditor/diffeditordocument.cpp b/src/plugins/diffeditor/diffeditordocument.cpp index 505501af17..66c5aa2450 100644 --- a/src/plugins/diffeditor/diffeditordocument.cpp +++ b/src/plugins/diffeditor/diffeditordocument.cpp @@ -4,6 +4,7 @@ #include "diffeditordocument.h" #include "diffeditorconstants.h" #include "diffeditorcontroller.h" +#include "diffeditortr.h" #include <utils/fileutils.h> #include <utils/qtcassert.h> @@ -292,8 +293,8 @@ Core::IDocument::OpenResult DiffEditorDocument::open(QString *errorString, const bool ok = false; QList<FileData> fileDataList = DiffUtils::readPatch(patch, &ok); if (!ok) { - *errorString = tr("Could not parse patch file \"%1\". " - "The content is not of unified diff format.") + *errorString = Tr::tr("Could not parse patch file \"%1\". " + "The content is not of unified diff format.") .arg(filePath.toUserOutput()); } else { setTemporary(false); diff --git a/src/plugins/diffeditor/diffeditorplugin.cpp b/src/plugins/diffeditor/diffeditorplugin.cpp index 830db67151..44c824c3de 100644 --- a/src/plugins/diffeditor/diffeditorplugin.cpp +++ b/src/plugins/diffeditor/diffeditorplugin.cpp @@ -6,6 +6,7 @@ #include "diffeditorcontroller.h" #include "diffeditordocument.h" #include "diffeditorfactory.h" +#include "diffeditortr.h" #include <coreplugin/actionmanager/actioncontainer.h> #include <coreplugin/actionmanager/actionmanager.h> @@ -105,7 +106,7 @@ protected: DiffFilesController::DiffFilesController(IDocument *document) : DiffEditorController(document) { - setDisplayName(tr("Diff")); + setDisplayName(Tr::tr("Diff")); using namespace Tasking; const TreeStorage<QList<FileData>> storage; @@ -182,8 +183,8 @@ QList<ReloadInput> DiffCurrentFileController::reloadInputList() const ReloadInput reloadInput; reloadInput.text = {leftText, rightText}; - reloadInput.fileInfo = {DiffFileInfo(m_fileName, tr("Saved")), - DiffFileInfo(m_fileName, tr("Modified"))}; + reloadInput.fileInfo = {DiffFileInfo(m_fileName, Tr::tr("Saved")), + DiffFileInfo(m_fileName, Tr::tr("Modified"))}; reloadInput.fileInfo[RightSide].patchBehaviour = DiffFileInfo::PatchEditor; reloadInput.binaryFiles = (leftResult == TextFileFormat::ReadEncodingError); @@ -231,8 +232,8 @@ QList<ReloadInput> DiffOpenFilesController::reloadInputList() const ReloadInput reloadInput; reloadInput.text = {leftText, rightText}; - reloadInput.fileInfo = {DiffFileInfo(fileName, tr("Saved")), - DiffFileInfo(fileName, tr("Modified"))}; + reloadInput.fileInfo = {DiffFileInfo(fileName, Tr::tr("Saved")), + DiffFileInfo(fileName, Tr::tr("Modified"))}; reloadInput.fileInfo[RightSide].patchBehaviour = DiffFileInfo::PatchEditor; reloadInput.binaryFiles = (leftResult == TextFileFormat::ReadEncodingError); @@ -284,8 +285,8 @@ QList<ReloadInput> DiffModifiedFilesController::reloadInputList() const ReloadInput reloadInput; reloadInput.text = {leftText, rightText}; - reloadInput.fileInfo = {DiffFileInfo(fileName, tr("Saved")), - DiffFileInfo(fileName, tr("Modified"))}; + reloadInput.fileInfo = {DiffFileInfo(fileName, Tr::tr("Saved")), + DiffFileInfo(fileName, Tr::tr("Modified"))}; reloadInput.fileInfo[RightSide].patchBehaviour = DiffFileInfo::PatchEditor; reloadInput.binaryFiles = (leftResult == TextFileFormat::ReadEncodingError); @@ -381,21 +382,19 @@ void DiffEditorServiceImpl::diffFiles(const QString &leftFileName, const QString { const QString documentId = Constants::DIFF_EDITOR_PLUGIN + QLatin1String(".DiffFiles.") + leftFileName + QLatin1Char('.') + rightFileName; - const QString title = tr("Diff Files"); + const QString title = Tr::tr("Diff Files"); reload<DiffExternalFilesController>(documentId, title, leftFileName, rightFileName); } void DiffEditorServiceImpl::diffModifiedFiles(const QStringList &fileNames) { const QString documentId = Constants::DIFF_EDITOR_PLUGIN + QLatin1String(".DiffModifiedFiles"); - const QString title = tr("Diff Modified Files"); + const QString title = Tr::tr("Diff Modified Files"); reload<DiffModifiedFilesController>(documentId, title, fileNames); } class DiffEditorPluginPrivate : public QObject { - Q_DECLARE_TR_FUNCTIONS(DiffEditor::Internal::DiffEditorPlugin) - public: DiffEditorPluginPrivate(); @@ -420,22 +419,22 @@ DiffEditorPluginPrivate::DiffEditorPluginPrivate() ActionContainer *toolsContainer = ActionManager::actionContainer(Core::Constants::M_TOOLS); toolsContainer->insertGroup(Core::Constants::G_TOOLS_DEBUG, Constants::G_TOOLS_DIFF); ActionContainer *diffContainer = ActionManager::createMenu("Diff"); - diffContainer->menu()->setTitle(tr("&Diff")); + diffContainer->menu()->setTitle(Tr::tr("&Diff")); toolsContainer->addMenu(diffContainer, Constants::G_TOOLS_DIFF); - m_diffCurrentFileAction = new QAction(tr("Diff Current File"), this); + m_diffCurrentFileAction = new QAction(Tr::tr("Diff Current File"), this); Command *diffCurrentFileCommand = ActionManager::registerAction(m_diffCurrentFileAction, "DiffEditor.DiffCurrentFile"); - diffCurrentFileCommand->setDefaultKeySequence(QKeySequence(useMacShortcuts ? tr("Meta+H") : tr("Ctrl+H"))); + diffCurrentFileCommand->setDefaultKeySequence(QKeySequence(useMacShortcuts ? Tr::tr("Meta+H") : Tr::tr("Ctrl+H"))); connect(m_diffCurrentFileAction, &QAction::triggered, this, &DiffEditorPluginPrivate::diffCurrentFile); diffContainer->addAction(diffCurrentFileCommand); - m_diffOpenFilesAction = new QAction(tr("Diff Open Files"), this); + m_diffOpenFilesAction = new QAction(Tr::tr("Diff Open Files"), this); Command *diffOpenFilesCommand = ActionManager::registerAction(m_diffOpenFilesAction, "DiffEditor.DiffOpenFiles"); - diffOpenFilesCommand->setDefaultKeySequence(QKeySequence(useMacShortcuts ? tr("Meta+Shift+H") : tr("Ctrl+Shift+H"))); + diffOpenFilesCommand->setDefaultKeySequence(QKeySequence(useMacShortcuts ? Tr::tr("Meta+Shift+H") : Tr::tr("Ctrl+Shift+H"))); connect(m_diffOpenFilesAction, &QAction::triggered, this, &DiffEditorPluginPrivate::diffOpenFiles); diffContainer->addAction(diffOpenFilesCommand); - QAction *diffExternalFilesAction = new QAction(tr("Diff External Files..."), this); + QAction *diffExternalFilesAction = new QAction(Tr::tr("Diff External Files..."), this); Command *diffExternalFilesCommand = ActionManager::registerAction(diffExternalFilesAction, "DiffEditor.DiffExternalFiles"); connect(diffExternalFilesAction, &QAction::triggered, this, &DiffEditorPluginPrivate::diffExternalFiles); diffContainer->addAction(diffExternalFilesCommand); @@ -482,25 +481,25 @@ void DiffEditorPluginPrivate::diffCurrentFile() return; const QString documentId = Constants::DIFF_EDITOR_PLUGIN + QLatin1String(".Diff.") + fileName; - const QString title = tr("Diff \"%1\"").arg(fileName); + const QString title = Tr::tr("Diff \"%1\"").arg(fileName); reload<DiffCurrentFileController>(documentId, title, fileName); } void DiffEditorPluginPrivate::diffOpenFiles() { const QString documentId = Constants::DIFF_EDITOR_PLUGIN + QLatin1String(".DiffOpenFiles"); - const QString title = tr("Diff Open Files"); + const QString title = Tr::tr("Diff Open Files"); reload<DiffOpenFilesController>(documentId, title); } void DiffEditorPluginPrivate::diffExternalFiles() { - const FilePath filePath1 = FileUtils::getOpenFilePath(nullptr, tr("Select First File for Diff")); + const FilePath filePath1 = FileUtils::getOpenFilePath(nullptr, Tr::tr("Select First File for Diff")); if (filePath1.isEmpty()) return; if (EditorManager::skipOpeningBigTextFile(filePath1)) return; - const FilePath filePath2 = FileUtils::getOpenFilePath(nullptr, tr("Select Second File for Diff")); + const FilePath filePath2 = FileUtils::getOpenFilePath(nullptr, Tr::tr("Select Second File for Diff")); if (filePath2.isEmpty()) return; if (EditorManager::skipOpeningBigTextFile(filePath2)) @@ -508,7 +507,7 @@ void DiffEditorPluginPrivate::diffExternalFiles() const QString documentId = QLatin1String(Constants::DIFF_EDITOR_PLUGIN) + ".DiffExternalFiles." + filePath1.toString() + '.' + filePath2.toString(); - const QString title = tr("Diff \"%1\", \"%2\"").arg(filePath1.toString(), filePath2.toString()); + const QString title = Tr::tr("Diff \"%1\", \"%2\"").arg(filePath1.toString(), filePath2.toString()); reload<DiffExternalFilesController>(documentId, title, filePath1.toString(), filePath2.toString()); } diff --git a/src/plugins/diffeditor/diffeditorwidgetcontroller.cpp b/src/plugins/diffeditor/diffeditorwidgetcontroller.cpp index 50b6eb8419..e3f321c7c4 100644 --- a/src/plugins/diffeditor/diffeditorwidgetcontroller.cpp +++ b/src/plugins/diffeditor/diffeditorwidgetcontroller.cpp @@ -5,6 +5,7 @@ #include "diffeditorconstants.h" #include "diffeditorcontroller.h" #include "diffeditordocument.h" +#include "diffeditortr.h" #include <coreplugin/documentmanager.h> #include <coreplugin/editormanager/editormanager.h> @@ -225,7 +226,7 @@ void DiffEditorWidgetController::addCodePasterAction(QMenu *menu, int fileIndex, { if (ExtensionSystem::PluginManager::getObject<CodePaster::Service>()) { // optional code pasting service - QAction *sendChunkToCodePasterAction = menu->addAction(tr("Send Chunk to CodePaster...")); + QAction *sendChunkToCodePasterAction = menu->addAction(Tr::tr("Send Chunk to CodePaster...")); connect(sendChunkToCodePasterAction, &QAction::triggered, this, [this, fileIndex, chunkIndex] { sendChunkToCodePaster(fileIndex, chunkIndex); }); @@ -264,8 +265,8 @@ bool DiffEditorWidgetController::fileNamesAreDifferent(int fileIndex) const void DiffEditorWidgetController::addPatchAction(QMenu *menu, int fileIndex, int chunkIndex, PatchAction patchAction) { - const QString actionName = patchAction == PatchAction::Apply ? tr("Apply Chunk...") - : tr("Revert Chunk..."); + const QString actionName = patchAction == PatchAction::Apply ? Tr::tr("Apply Chunk...") + : Tr::tr("Revert Chunk..."); QAction *action = menu->addAction(actionName); connect(action, &QAction::triggered, this, [this, fileIndex, chunkIndex, patchAction] { patch(patchAction, fileIndex, chunkIndex); @@ -293,10 +294,10 @@ void DiffEditorWidgetController::updateCannotDecodeInfo() if (!infoBar->canInfoBeAdded(selectEncodingId)) return; InfoBarEntry info(selectEncodingId, - tr("<b>Error:</b> Could not decode \"%1\" with \"%2\"-encoding.") + Tr::tr("<b>Error:</b> Could not decode \"%1\" with \"%2\"-encoding.") .arg(m_document->displayName(), QString::fromLatin1(m_document->codec()->name()))); - info.addCustomButton(tr("Select Encoding"), [this] { m_document->selectEncoding(); }); + info.addCustomButton(Tr::tr("Select Encoding"), [this] { m_document->selectEncoding(); }); infoBar->addInfo(info); } else { infoBar->removeInfo(selectEncodingId); diff --git a/src/plugins/diffeditor/diffview.cpp b/src/plugins/diffeditor/diffview.cpp index 42f7ad034e..8ff444066a 100644 --- a/src/plugins/diffeditor/diffview.cpp +++ b/src/plugins/diffeditor/diffview.cpp @@ -6,6 +6,7 @@ #include "diffeditorconstants.h" #include "diffeditordocument.h" #include "diffeditoricons.h" +#include "diffeditortr.h" #include "unifieddiffeditorwidget.h" #include "sidebysidediffeditorwidget.h" @@ -73,7 +74,7 @@ UnifiedView::UnifiedView() { setId(Constants::UNIFIED_VIEW_ID); setIcon(Icons::UNIFIED_DIFF.icon()); - setToolTip(QCoreApplication::translate("DiffEditor::UnifiedView", "Switch to Unified Diff Editor")); + setToolTip(Tr::tr("Switch to Unified Diff Editor")); } QWidget *UnifiedView::widget() @@ -100,10 +101,10 @@ void UnifiedView::setDocument(DiffEditorDocument *document) switch (document->state()) { case DiffEditorDocument::Reloading: - m_widget->clear(tr("Waiting for data...")); + m_widget->clear(Tr::tr("Waiting for data...")); break; case DiffEditorDocument::LoadFailed: - m_widget->clear(tr("Retrieving data failed.")); + m_widget->clear(Tr::tr("Retrieving data failed.")); break; default: break; @@ -116,7 +117,7 @@ void UnifiedView::beginOperation() DiffEditorDocument *document = m_widget->diffDocument(); if (document && document->state() == DiffEditorDocument::LoadOK) m_widget->saveState(); - m_widget->clear(tr("Waiting for data...")); + m_widget->clear(Tr::tr("Waiting for data...")); } void UnifiedView::setDiff(const QList<FileData> &diffFileList) @@ -131,7 +132,7 @@ void UnifiedView::endOperation(bool success) if (success) m_widget->restoreState(); else - m_widget->clear(tr("Retrieving data failed.")); + m_widget->clear(Tr::tr("Retrieving data failed.")); } void UnifiedView::setCurrentDiffFileIndex(int index) @@ -150,10 +151,9 @@ SideBySideView::SideBySideView() { setId(Constants::SIDE_BY_SIDE_VIEW_ID); setIcon(Icons::SIDEBYSIDE_DIFF.icon()); - setToolTip(QCoreApplication::translate("DiffEditor::SideBySideView", - "Switch to Side By Side Diff Editor")); + setToolTip(Tr::tr("Switch to Side By Side Diff Editor")); setSupportsSync(true); - setSyncToolTip(tr("Synchronize Horizontal Scroll Bars")); + setSyncToolTip(Tr::tr("Synchronize Horizontal Scroll Bars")); } QWidget *SideBySideView::widget() @@ -181,10 +181,10 @@ void SideBySideView::setDocument(DiffEditorDocument *document) switch (document->state()) { case DiffEditorDocument::Reloading: - m_widget->clear(tr("Waiting for data...")); + m_widget->clear(Tr::tr("Waiting for data...")); break; case DiffEditorDocument::LoadFailed: - m_widget->clear(tr("Retrieving data failed.")); + m_widget->clear(Tr::tr("Retrieving data failed.")); break; default: break; @@ -197,7 +197,7 @@ void SideBySideView::beginOperation() DiffEditorDocument *document = m_widget->diffDocument(); if (document && document->state() == DiffEditorDocument::LoadOK) m_widget->saveState(); - m_widget->clear(tr("Waiting for data...")); + m_widget->clear(Tr::tr("Waiting for data...")); } void SideBySideView::setCurrentDiffFileIndex(int index) @@ -218,7 +218,7 @@ void SideBySideView::endOperation(bool success) if (success) m_widget->restoreState(); else - m_widget->clear(tr("Retrieving data failed.")); + m_widget->clear(Tr::tr("Retrieving data failed.")); } void SideBySideView::setSync(bool sync) diff --git a/src/plugins/diffeditor/sidebysidediffeditorwidget.cpp b/src/plugins/diffeditor/sidebysidediffeditorwidget.cpp index b9372459bf..5bc887b90a 100644 --- a/src/plugins/diffeditor/sidebysidediffeditorwidget.cpp +++ b/src/plugins/diffeditor/sidebysidediffeditorwidget.cpp @@ -6,6 +6,7 @@ #include "diffeditorconstants.h" #include "diffeditordocument.h" #include "diffeditorplugin.h" +#include "diffeditortr.h" #include <QMenu> #include <QPainter> @@ -550,10 +551,10 @@ void SideDiffEditorWidget::jumpToOriginalFile(const QTextCursor &cursor) static QString skippedText(int skippedNumber) { if (skippedNumber > 0) - return SideBySideDiffEditorWidget::tr("Skipped %n lines...", nullptr, skippedNumber); + return Tr::tr("Skipped %n lines...", nullptr, skippedNumber); if (skippedNumber == -2) - return SideBySideDiffEditorWidget::tr("Binary files differ"); - return SideBySideDiffEditorWidget::tr("Skipped unknown number of lines..."); + return Tr::tr("Binary files differ"); + return Tr::tr("Skipped unknown number of lines..."); } void SideDiffEditorWidget::paintEvent(QPaintEvent *e) @@ -588,7 +589,7 @@ void SideDiffEditorWidget::paintEvent(QPaintEvent *e) if (!fileInfo.fileName.isEmpty()) { const QString fileNameText = fileInfo.typeInfo.isEmpty() ? fileInfo.fileName - : tr("[%1] %2").arg(fileInfo.typeInfo, fileInfo.fileName); + : Tr::tr("[%1] %2").arg(fileInfo.typeInfo, fileInfo.fileName); paintSeparator(painter, m_fileLineForeground, fileNameText, currentBlock, top); } @@ -817,11 +818,11 @@ void SideBySideDiffEditorWidget::setDiff(const QList<FileData> &diffFileList) { const GuardLocker locker(m_controller.m_ignoreChanges); for (SideDiffEditorWidget *editor : m_editor) - editor->clearAll(tr("Waiting for data...")); + editor->clearAll(Tr::tr("Waiting for data...")); m_controller.m_contextFileData = diffFileList; if (m_controller.m_contextFileData.isEmpty()) { - const QString msg = tr("No difference."); + const QString msg = Tr::tr("No difference."); for (SideDiffEditorWidget *editor : m_editor) editor->setPlainText(msg); } else { @@ -875,7 +876,7 @@ void SideBySideDiffEditorWidget::showDiff() connect(m_asyncTask.get(), &AsyncTaskBase::done, this, [this] { if (m_asyncTask->isCanceled()) { for (SideDiffEditorWidget *editor : m_editor) - editor->clearAll(tr("Retrieving data failed.")); + editor->clearAll(Tr::tr("Retrieving data failed.")); } else { const ShowResults results = m_asyncTask->result(); m_editor[LeftSide]->setDiffData(results[LeftSide].diffData); @@ -978,7 +979,7 @@ void SideBySideDiffEditorWidget::showDiff() m_asyncTask->setAsyncCallData(getDocument); m_asyncTask->start(); - ProgressManager::addTask(m_asyncTask->future(), tr("Rendering diff"), "DiffEditor"); + ProgressManager::addTask(m_asyncTask->future(), Tr::tr("Rendering diff"), "DiffEditor"); } void SideBySideDiffEditorWidget::setFontSettings(const FontSettings &fontSettings) diff --git a/src/plugins/diffeditor/unifieddiffeditorwidget.cpp b/src/plugins/diffeditor/unifieddiffeditorwidget.cpp index 2bfa2d8cde..8c8bee05c2 100644 --- a/src/plugins/diffeditor/unifieddiffeditorwidget.cpp +++ b/src/plugins/diffeditor/unifieddiffeditorwidget.cpp @@ -6,6 +6,7 @@ #include "diffeditorconstants.h" #include "diffeditordocument.h" #include "diffeditorplugin.h" +#include "diffeditortr.h" #include <QMenu> #include <QPainter> @@ -42,7 +43,7 @@ UnifiedDiffEditorWidget::UnifiedDiffEditorWidget(QWidget *parent) this, &UnifiedDiffEditorWidget::setFontSettings); setFontSettings(TextEditorSettings::fontSettings()); - clear(tr("No document")); + clear(Tr::tr("No document")); connect(this, &QPlainTextEdit::cursorPositionChanged, this, &UnifiedDiffEditorWidget::slotCursorPositionChangedInEditor); @@ -262,7 +263,7 @@ void UnifiedDiffData::setLineNumber(DiffSide side, int blockNumber, int lineNumb void UnifiedDiffEditorWidget::setDiff(const QList<FileData> &diffFileList) { const GuardLocker locker(m_controller.m_ignoreChanges); - clear(tr("Waiting for data...")); + clear(Tr::tr("Waiting for data...")); m_controller.m_contextFileData = diffFileList; showDiff(); } @@ -449,7 +450,7 @@ UnifiedDiffOutput UnifiedDiffData::diffOutput(QFutureInterface<void> &fi, int pr void UnifiedDiffEditorWidget::showDiff() { if (m_controller.m_contextFileData.isEmpty()) { - setPlainText(tr("No difference.")); + setPlainText(Tr::tr("No difference.")); return; } @@ -458,7 +459,7 @@ void UnifiedDiffEditorWidget::showDiff() m_controller.setBusyShowing(true); connect(m_asyncTask.get(), &AsyncTaskBase::done, this, [this] { if (m_asyncTask->isCanceled()) { - setPlainText(tr("Retrieving data failed.")); + setPlainText(Tr::tr("Retrieving data failed.")); } else { const ShowResult result = m_asyncTask->result(); m_data = result.diffData; @@ -529,7 +530,7 @@ void UnifiedDiffEditorWidget::showDiff() m_asyncTask->setAsyncCallData(getDocument); m_asyncTask->start(); - ProgressManager::addTask(m_asyncTask->future(), tr("Rendering diff"), "DiffEditor"); + ProgressManager::addTask(m_asyncTask->future(), Tr::tr("Rendering diff"), "DiffEditor"); } void UnifiedDiffEditorWidget::jumpToOriginalFile(const QTextCursor &cursor) |