From 191815e97439ff3f04b600396bc9352ff4eda547 Mon Sep 17 00:00:00 2001 From: hjk Date: Thu, 29 Sep 2022 17:46:03 +0200 Subject: [PATCH] BinEditor: Clean up translation contexts Change-Id: Ibeb8c93ad1dfa816ccf1160abae8aac6781157d9 Reviewed-by: Alessandro Portale --- share/qtcreator/translations/qtcreator_da.ts | 9 +- share/qtcreator/translations/qtcreator_de.ts | 8 +- share/qtcreator/translations/qtcreator_hr.ts | 112 +------------------ share/qtcreator/translations/qtcreator_ja.ts | 112 +------------------ share/qtcreator/translations/qtcreator_pl.ts | 9 +- share/qtcreator/translations/qtcreator_ru.ts | 10 +- share/qtcreator/translations/qtcreator_uk.ts | 8 +- src/plugins/bineditor/bineditorconstants.h | 7 +- src/plugins/bineditor/bineditorplugin.cpp | 53 ++++----- src/plugins/bineditor/bineditorplugin.h | 13 +-- src/plugins/bineditor/bineditortr.h | 2 +- src/plugins/bineditor/bineditorwidget.cpp | 65 ++++++----- src/plugins/bineditor/bineditorwidget.h | 6 +- src/plugins/bineditor/markup.h | 2 +- 14 files changed, 86 insertions(+), 330 deletions(-) diff --git a/share/qtcreator/translations/qtcreator_da.ts b/share/qtcreator/translations/qtcreator_da.ts index f36c6a9a5cf..8b0b0fe307c 100644 --- a/share/qtcreator/translations/qtcreator_da.ts +++ b/share/qtcreator/translations/qtcreator_da.ts @@ -3754,7 +3754,7 @@ F.eks., vil "Revision: 15" efterlade grenen ved revision 15. - BinEditor::Internal::BinEditorDocument + BinEditor The Binary Editor cannot open empty files. Binær-redigeringen kan ikke åbne tomme filer. @@ -3771,9 +3771,6 @@ F.eks., vil "Revision: 15" efterlade grenen ved revision 15.Cannot open %1: %2 Kan ikke åbne %1: %2 - - - BinEditor::Internal::BinEditorWidget Memory at 0x%1 Hukommelse ved 0x%1 @@ -3876,7 +3873,7 @@ F.eks., vil "Revision: 15" efterlade grenen ved revision 15. - BinEditorWidget::TextEditorWidget + BinEditor Zoom: %1% Zoom: %1% @@ -42916,7 +42913,7 @@ Spordataene er tabt. - BinEditor::Internal::BinEditorPluginPrivate + BinEditor &Undo &Fortryd diff --git a/share/qtcreator/translations/qtcreator_de.ts b/share/qtcreator/translations/qtcreator_de.ts index b336df81650..6fae864d90b 100644 --- a/share/qtcreator/translations/qtcreator_de.ts +++ b/share/qtcreator/translations/qtcreator_de.ts @@ -28146,7 +28146,7 @@ Der vom Kit mindestens benötigte API-Level ist %1. - BinEditor::Internal::BinEditorDocument + BinEditor The Binary Editor cannot open empty files. Der Binäreditor kann keine leeren Dateien öffnen. @@ -37451,7 +37451,7 @@ Fehler: %5 - BinEditor::Internal::BinEditorWidget + BinEditor Memory at 0x%1 Speicher bei 0x%1 @@ -37562,7 +37562,7 @@ Fehler: %5 - BinEditorWidget::TextEditorWidget + BinEditor Zoom: %1% Vergrößerung: %1% @@ -42482,7 +42482,7 @@ Die Dateien aus dem Quellverzeichnis des Android-Pakets werden in das Verzeichni - BinEditor::Internal::BinEditorPlugin + BinEditor &Undo &Rückgängig diff --git a/share/qtcreator/translations/qtcreator_hr.ts b/share/qtcreator/translations/qtcreator_hr.ts index 24388562824..4faaab46a3b 100644 --- a/share/qtcreator/translations/qtcreator_hr.ts +++ b/share/qtcreator/translations/qtcreator_hr.ts @@ -16431,7 +16431,7 @@ Check the test environment. - BinEditor::BinEditorWidget + BinEditor Memory at 0x%1 Memorija pri 0x%1 @@ -16593,7 +16593,7 @@ Check the test environment. - BinEditor::Internal::BinEditorDocument + BinEditor The Binary Editor cannot open empty files. Binarni uređivač ne može otvoriti prazne datoteke. @@ -16610,9 +16610,6 @@ Check the test environment. Cannot open %1: %2 Nije moguće otvoriti %1: %2 - - - BinEditor::Internal::BinEditorPlugin &Undo &Poništi @@ -16621,120 +16618,17 @@ Check the test environment. &Redo Po&novi - - - BinEditor::Internal::BinEditorWidget - - Memory at 0x%1 - Memorija pri 0x%1 - - - Decimal&nbsp;unsigned&nbsp;value: - Decimalna&nbsp;nepotpisana&nbsp;vrijednost: - - - Decimal&nbsp;signed&nbsp;value: - Decimalna&nbsp;potpisana&nbsp;vrijednost: - - - Previous&nbsp;decimal&nbsp;unsigned&nbsp;value: - Prethodna&nbsp;decimalna&nbsp;nepotpisana&nbsp;vrijednost: - - - Previous&nbsp;decimal&nbsp;signed&nbsp;value: - Prethodna&nbsp;decimalna&nbsp;potpisana&nbsp;vrijednost: - - - %1-bit&nbsp;Integer&nbsp;Type - %1-bit&nbsp;cjelobrojna&nbsp;vrsta - - - Little Endian - - - - Big Endian - - - - Binary&nbsp;value: - Binarna&nbsp;vrijednost: - - - Octal&nbsp;value: - Oktalna&nbsp;vrijednost: - - - Previous&nbsp;binary&nbsp;value: - Prethodna&nbsp;binarna&nbsp;vrijednost: - - - Previous&nbsp;octal&nbsp;value: - Prethodna&nbsp;oktalna&nbsp;vrijednost: - - - <i>double</i>&nbsp;value: - <i>dupla</i>&nbsp;vrijednost: - - - Previous <i>double</i>&nbsp;value: - Prethodna <i>dupla</i>&nbsp;vrijednost: - - - <i>float</i>&nbsp;value: - <i>pomična</i>&nbsp;vrijednost: - - - Previous <i>float</i>&nbsp;value: - Prethodna <i>pomična</i>&nbsp;vrijednost: - - - Copying Failed - Neuspjelo kopiranje - - - You cannot copy more than 4 MB of binary data. - Ne možeš kopirati više od 4 MB binarnih podataka. - - - Copy Selection as ASCII Characters - Kopiraj odabir kao ASCII znakove - - - Copy Selection as Hex Values - Kopiraj odabir kao heksadecimalne znakove - - - Set Data Breakpoint on Selection - Postavi točku prekida podataka na odabiru - Copy 0x%1 Kopiraj 0x%1 - - Jump to Address in This Window - Prijeđi na adresu u ovom prozoru - - - Jump to Address in New Window - Prijeđi na adresu u novom prozoru - Copy Value Kopiraj vrijednost - - Jump to Address 0x%1 in This Window - Prijeđi na adresu 0x%1 u ovom prozoru - - - Jump to Address 0x%1 in New Window - Prijeđi na adresu 0x%1 u novom prozoru - - BinEditorWidget::TextEditorWidget + BinEditor Zoom: %1% Zumiranje: %1% diff --git a/share/qtcreator/translations/qtcreator_ja.ts b/share/qtcreator/translations/qtcreator_ja.ts index 5824aad2e46..413c4c43512 100644 --- a/share/qtcreator/translations/qtcreator_ja.ts +++ b/share/qtcreator/translations/qtcreator_ja.ts @@ -38674,7 +38674,7 @@ Only desktop kits are supported. Make sure the currently active kit is a desktop - BinEditor::BinEditorWidget + BinEditor Memory at 0x%1 0x%1 のメモリ @@ -38775,9 +38775,6 @@ Only desktop kits are supported. Make sure the currently active kit is a desktop Jump to Address 0x%1 in New Window 新規ウィンドウでアドレス 0x%1 に移動 - - - BinEditor::Internal::BinEditorDocument The Binary Editor cannot open empty files. バイナリエディタでは空のファイルを開けません。 @@ -38794,9 +38791,6 @@ Only desktop kits are supported. Make sure the currently active kit is a desktop Cannot open %1: %2 %1 を開けません: %2 - - - BinEditor::Internal::BinEditorPlugin &Undo 元に戻す(&U) @@ -48905,118 +48899,18 @@ The name of the release build configuration created by default for a qmake proje - BinEditor::Internal::BinEditorWidget - - Memory at 0x%1 - 0x%1 のメモリ - - - Decimal&nbsp;unsigned&nbsp;value: - 符号無し10進数: - - - Decimal&nbsp;signed&nbsp;value: - 符号付き10進数: - - - Previous&nbsp;decimal&nbsp;unsigned&nbsp;value: - 直前の符号無し10進数: - - - Previous&nbsp;decimal&nbsp;signed&nbsp;value: - 直前の符号付き10進数: - - - %1-bit&nbsp;Integer&nbsp;Type - %1 ビット整数型 - - - Little Endian - リトルエンディアン - - - Big Endian - ビッグエンディアン - - - Binary&nbsp;value: - 2進数: - - - Octal&nbsp;value: - 8進数: - - - Previous&nbsp;binary&nbsp;value: - 直前の2進数: - - - Previous&nbsp;octal&nbsp;value: - 直前の8進数: - - - <i>double</i>&nbsp;value: - <i>倍精度浮動小数点</i>数: - - - Previous <i>double</i>&nbsp;value: - 直前の<i>倍精度浮動小数点</i>数: - - - <i>float</i>&nbsp;value: - <i>単精度浮動小数点</i>数: - - - Previous <i>float</i>&nbsp;value: - 直前の<i>単精度浮動小数点</i>数: - - - Copying Failed - コピー失敗 - - - You cannot copy more than 4 MB of binary data. - 4MB より大きなバイナリデータはコピーできません。 - - - Copy Selection as ASCII Characters - 選択内容を ASCII 文字列としてコピーする - - - Copy Selection as Hex Values - 選択内容を16進数の値としてコピーする - - - Set Data Breakpoint on Selection - 選択した箇所にデータブレークポイントを設定 - + BinEditor Copy 0x%1 0x%1をコピー - - Jump to Address in This Window - ウィンドウ内でアドレスに移動 - - - Jump to Address in New Window - 新規ウィンドウでアドレスに移動 - Copy Value 値をコピー - - Jump to Address 0x%1 in This Window - ウィンドウ内でアドレス 0x%1 に移動 - - - Jump to Address 0x%1 in New Window - 新規ウィンドウでアドレス 0x%1 に移動 - - BinEditorWidget::TextEditorWidget + BinEditor Zoom: %1% 拡大率: %1% diff --git a/share/qtcreator/translations/qtcreator_pl.ts b/share/qtcreator/translations/qtcreator_pl.ts index dfb4ed087f4..10b0b609871 100644 --- a/share/qtcreator/translations/qtcreator_pl.ts +++ b/share/qtcreator/translations/qtcreator_pl.ts @@ -30346,7 +30346,7 @@ Zainstaluj SDK o wersji %1 lub wyższej. - BinEditor::Internal::BinEditorDocument + BinEditor The Binary Editor cannot open empty files. Edytor plików binarnych nie może otwierać pustych plików. @@ -30363,9 +30363,6 @@ Zainstaluj SDK o wersji %1 lub wyższej. Cannot open %1: %2 Nie można otworzyć %1: %2 - - - BinEditor::Internal::BinEditorPlugin &Undo &Cofnij @@ -39906,7 +39903,7 @@ Uwaga: podczas używania zwykłego formatu tekstowego może brakować niektóryc - BinEditor::Internal::BinEditorWidget + BinEditor Memory at 0x%1 Pamięć w 0x%1 @@ -41618,7 +41615,7 @@ Błąd: %2 - BinEditorWidget::TextEditorWidget + BinEditor Zoom: %1% Powiększenie:%1% diff --git a/share/qtcreator/translations/qtcreator_ru.ts b/share/qtcreator/translations/qtcreator_ru.ts index c150c2f49d4..82e85def331 100644 --- a/share/qtcreator/translations/qtcreator_ru.ts +++ b/share/qtcreator/translations/qtcreator_ru.ts @@ -5429,7 +5429,7 @@ For example, "Revision: 15" will leave the branch at revision 15. - BinEditor::Internal::BinEditorDocument + BinEditor The Binary Editor cannot open empty files. Двоичный редактор не может открывать пустые файлы. @@ -5446,9 +5446,6 @@ For example, "Revision: 15" will leave the branch at revision 15.Cannot open %1: %2 Не удалось открыть %1: %2 - - - BinEditor::Internal::BinEditorPlugin &Undo &Отменить @@ -5457,9 +5454,6 @@ For example, "Revision: 15" will leave the branch at revision 15.&Redo &Повторить - - - BinEditor::Internal::BinEditorWidget Memory at 0x%1 Память с 0x%1 @@ -5570,7 +5564,7 @@ For example, "Revision: 15" will leave the branch at revision 15. - BinEditorWidget::TextEditorWidget + BinEditor Zoom: %1% Масштаб: %1% diff --git a/share/qtcreator/translations/qtcreator_uk.ts b/share/qtcreator/translations/qtcreator_uk.ts index ce6aef153e3..4adf387c5d3 100644 --- a/share/qtcreator/translations/qtcreator_uk.ts +++ b/share/qtcreator/translations/qtcreator_uk.ts @@ -43904,7 +43904,7 @@ Deploying local Qt libraries is incompatible with Android 5. - BinEditor::BinEditorWidget + BinEditor Memory at 0x%1 Пам'ять в 0x%1 @@ -44005,9 +44005,6 @@ Deploying local Qt libraries is incompatible with Android 5. Jump to Address 0x%1 in New Window Перейти до адреси 0x%1 в новому вікні - - - BinEditor::Internal::BinEditorDocument The Binary Editor cannot open empty files. Двійковий редактор не може відкривати порожні файли. @@ -44024,9 +44021,6 @@ Deploying local Qt libraries is incompatible with Android 5. Cannot open %1: %2 Неможливо відкрити %1: %2 - - - BinEditor::Internal::BinEditorPlugin &Undo &Повернути diff --git a/src/plugins/bineditor/bineditorconstants.h b/src/plugins/bineditor/bineditorconstants.h index 53e1281e719..4c8ef9b50c6 100644 --- a/src/plugins/bineditor/bineditorconstants.h +++ b/src/plugins/bineditor/bineditorconstants.h @@ -3,13 +3,10 @@ #pragma once -namespace BinEditor { -namespace Constants { +namespace BinEditor::Constants { const char C_BINEDITOR[] = "BinEditor.BinaryEditor"; -const char C_BINEDITOR_DISPLAY_NAME[] = QT_TRANSLATE_NOOP("OpenWith::Editors", "Binary Editor"); const char C_BINEDITOR_MIMETYPE[] = "application/octet-stream"; const char C_ENCODING_SETTING[] = "BinEditor/TextEncoding"; -} // namespace Constants -} // namespace BinEditor +} // BinEditor::Constants diff --git a/src/plugins/bineditor/bineditorplugin.cpp b/src/plugins/bineditor/bineditorplugin.cpp index 13bb6d5c963..0cdb355537b 100644 --- a/src/plugins/bineditor/bineditorplugin.cpp +++ b/src/plugins/bineditor/bineditorplugin.cpp @@ -2,26 +2,24 @@ // SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0+ OR GPL-3.0 WITH Qt-GPL-exception-1.0 #include "bineditorplugin.h" -#include "bineditorwidget.h" + #include "bineditorconstants.h" #include "bineditorservice.h" +#include "bineditortr.h" +#include "bineditorwidget.h" +#include #include + #include -#include -#include -#include -#include -#include -#include - -#include #include -#include #include #include +#include +#include #include +#include #include #include @@ -30,6 +28,7 @@ #include #include #include + #include #include @@ -38,13 +37,16 @@ using namespace Utils; using namespace Core; -namespace BinEditor { -namespace Internal { +namespace BinEditor::Internal { + +class BinEditorFactory final : public IEditorFactory +{ +public: + BinEditorFactory(); +}; class BinEditorFind : public IFindSupport { - Q_OBJECT - public: BinEditorFind(BinEditorWidget *widget) { @@ -232,31 +234,31 @@ public: { const qint64 size = filePath.fileSize(); if (size < 0) { - QString msg = tr("Cannot open %1: %2").arg(filePath.toUserOutput(), tr("File Error")); + QString msg = Tr::tr("Cannot open %1: %2").arg(filePath.toUserOutput(), Tr::tr("File Error")); // FIXME: Was: file.errorString(), but we don't have a file anymore. if (errorString) *errorString = msg; else - QMessageBox::critical(ICore::dialogParent(), tr("File Error"), msg); + QMessageBox::critical(ICore::dialogParent(), Tr::tr("File Error"), msg); return OpenResult::ReadError; } if (size == 0) { - QString msg = tr("The Binary Editor cannot open empty files."); + QString msg = Tr::tr("The Binary Editor cannot open empty files."); if (errorString) *errorString = msg; else - QMessageBox::critical(ICore::dialogParent(), tr("File Error"), msg); + QMessageBox::critical(ICore::dialogParent(), Tr::tr("File Error"), msg); return OpenResult::CannotHandle; } if (size / 16 >= qint64(1) << 31) { // The limit is 2^31 lines (due to QText* interfaces) * 16 bytes per line. - QString msg = tr("The file is too big for the Binary Editor (max. 32GB)."); + QString msg = Tr::tr("The file is too big for the Binary Editor (max. 32GB)."); if (errorString) *errorString = msg; else - QMessageBox::critical(ICore::dialogParent(), tr("File Error"), msg); + QMessageBox::critical(ICore::dialogParent(), Tr::tr("File Error"), msg); return OpenResult::CannotHandle; } @@ -279,8 +281,8 @@ public: if (dataSize != blockSize) data += QByteArray(blockSize - dataSize, 0); m_widget->addData(address, data); -// QMessageBox::critical(ICore::dialogParent(), tr("File Error"), -// tr("Cannot open %1: %2").arg( +// QMessageBox::critical(ICore::dialogParent(), Tr::tr("File Error"), +// Tr::tr("Cannot open %1: %2").arg( // fn.toUserOutput(), file.errorString())); } @@ -415,7 +417,7 @@ BinEditorPluginPrivate::BinEditorPluginPrivate() ExtensionSystem::PluginManager::addObject(&m_editorFactory); m_undoAction = new QAction(BinEditorPlugin::tr("&Undo"), this); - m_redoAction = new QAction(BinEditorPlugin::tr("&Redo"), this); + m_redoAction = new QAction(Tr::tr("&Redo"), this); m_copyAction = new QAction(this); m_selectAllAction = new QAction(this); @@ -442,7 +444,7 @@ static BinEditorPluginPrivate *dd = nullptr; BinEditorFactory::BinEditorFactory() { setId(Core::Constants::K_DEFAULT_BINARY_EDITOR_ID); - setDisplayName(QCoreApplication::translate("OpenWith::Editors", Constants::C_BINEDITOR_DISPLAY_NAME)); + setDisplayName(QCoreApplication::translate("OpenWith::Editors", "Binary Editor")); addMimeType(Constants::C_BINEDITOR_MIMETYPE); setEditorCreator([] { @@ -510,7 +512,6 @@ bool BinEditorPlugin::initialize(const QStringList &arguments, QString *errorMes return true; } -} // namespace Internal -} // namespace BinEditor +} // BinEditor::Internal #include "bineditorplugin.moc" diff --git a/src/plugins/bineditor/bineditorplugin.h b/src/plugins/bineditor/bineditorplugin.h index ecba761123d..8be06a521a4 100644 --- a/src/plugins/bineditor/bineditorplugin.h +++ b/src/plugins/bineditor/bineditorplugin.h @@ -6,10 +6,8 @@ #include "bineditorservice.h" #include -#include -namespace BinEditor { -namespace Internal { +namespace BinEditor::Internal { class BinEditorPlugin : public ExtensionSystem::IPlugin { @@ -22,12 +20,6 @@ class BinEditorPlugin : public ExtensionSystem::IPlugin void extensionsInitialized() final {} }; -class BinEditorFactory final : public Core::IEditorFactory -{ -public: - BinEditorFactory(); -}; - class FactoryServiceImpl : public QObject, public FactoryService { Q_OBJECT @@ -37,5 +29,4 @@ public: EditorService *createEditorService(const QString &title0, bool wantsEditor) final; }; -} // namespace Internal -} // namespace BinEditor +} // BinEditor::Internal diff --git a/src/plugins/bineditor/bineditortr.h b/src/plugins/bineditor/bineditortr.h index fd13b1cb81f..630d4d56e18 100644 --- a/src/plugins/bineditor/bineditortr.h +++ b/src/plugins/bineditor/bineditortr.h @@ -12,4 +12,4 @@ struct Tr Q_DECLARE_TR_FUNCTIONS(BinEditor) }; -} // namespace BinEditor +} // BinEditor diff --git a/src/plugins/bineditor/bineditorwidget.cpp b/src/plugins/bineditor/bineditorwidget.cpp index a6f77425ca9..5a3e47229ce 100644 --- a/src/plugins/bineditor/bineditorwidget.cpp +++ b/src/plugins/bineditor/bineditorwidget.cpp @@ -2,8 +2,10 @@ // SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0+ OR GPL-3.0 WITH Qt-GPL-exception-1.0 #include "bineditorwidget.h" + #include "bineditorconstants.h" #include "bineditorservice.h" +#include "bineditortr.h" #include "markup.h" #include @@ -42,8 +44,7 @@ using namespace Core; using namespace Utils; -namespace BinEditor { -namespace Internal { +namespace BinEditor::Internal { const QChar MidpointChar(u'\u00B7'); @@ -1218,7 +1219,7 @@ QString BinEditorWidget::toolTip(const QHelpEvent *helpEvent) const QString msg; QTextStream str(&msg); str << "

" - << tr("Memory at 0x%1").arg(address, 0, 16) << "

"; + << Tr::tr("Memory at 0x%1").arg(address, 0, 16) << "

"; for (const Markup &m : qAsConst(m_markup)) { if (m.covers(address) && !m.toolTip.isEmpty()) { @@ -1226,16 +1227,16 @@ QString BinEditorWidget::toolTip(const QHelpEvent *helpEvent) const break; } } - const QString msgDecimalUnsigned = tr("Decimal unsigned value:"); - const QString msgDecimalSigned = tr("Decimal signed value:"); - const QString msgOldDecimalUnsigned = tr("Previous decimal unsigned value:"); - const QString msgOldDecimalSigned = tr("Previous decimal signed value:"); + const QString msgDecimalUnsigned = Tr::tr("Decimal unsigned value:"); + const QString msgDecimalSigned = Tr::tr("Decimal signed value:"); + const QString msgOldDecimalUnsigned = Tr::tr("Previous decimal unsigned value:"); + const QString msgOldDecimalSigned = Tr::tr("Previous decimal signed value:"); // Table showing little vs. big endian integers for multi-byte if (intSize > 1) { str << ""; + << Tr::tr("%1-bit Integer Type").arg(8 * intSize) << ""; str << tableRowStartC << msgDecimalUnsigned << numericTableRowSepC << littleEndianValue << numericTableRowSepC << bigEndianValue << tableRowEndC << tableRowStartC << msgDecimalSigned @@ -1261,14 +1262,14 @@ QString BinEditorWidget::toolTip(const QHelpEvent *helpEvent) const str << tableRowStartC << msgDecimalSigned << numericTableRowSepC << littleEndianSigned << tableRowEndC; } - str << tableRowStartC << tr("Binary value:") << numericTableRowSepC; + str << tableRowStartC << Tr::tr("Binary value:") << numericTableRowSepC; str.setIntegerBase(2); str.setFieldWidth(8); str.setPadChar(QLatin1Char('0')); str << littleEndianValue; str.setFieldWidth(0); str << tableRowEndC << tableRowStartC - << tr("Octal value:") << numericTableRowSepC; + << Tr::tr("Octal value:") << numericTableRowSepC; str.setIntegerBase(8); str.setFieldWidth(3); str << littleEndianValue << tableRowEndC; @@ -1281,13 +1282,13 @@ QString BinEditorWidget::toolTip(const QHelpEvent *helpEvent) const str << tableRowStartC << msgOldDecimalSigned << numericTableRowSepC << littleEndianSignedOld << tableRowEndC; } - str << tableRowStartC << tr("Previous binary value:") + str << tableRowStartC << Tr::tr("Previous binary value:") << numericTableRowSepC; str.setIntegerBase(2); str.setFieldWidth(8); str << littleEndianValueOld; str.setFieldWidth(0); - str << tableRowEndC << tableRowStartC << tr("Previous octal value:") + str << tableRowEndC << tableRowStartC << Tr::tr("Previous octal value:") << numericTableRowSepC; str.setIntegerBase(8); str.setFieldWidth(3); @@ -1303,10 +1304,10 @@ QString BinEditorWidget::toolTip(const QHelpEvent *helpEvent) const double doubleValue, doubleValueOld; asDouble(selStart, doubleValue, false); asDouble(selStart, doubleValueOld, true); - str << tableRowStartC << tr("double value:") << numericTableRowSepC + str << tableRowStartC << Tr::tr("double value:") << numericTableRowSepC << doubleValue << tableRowEndC; if (doubleValue != doubleValueOld) - str << tableRowStartC << tr("Previous double value:") << numericTableRowSepC + str << tableRowStartC << Tr::tr("Previous double value:") << numericTableRowSepC << doubleValueOld << tableRowEndC; str << "
" - << tr("%1-bit Integer Type").arg(8 * intSize) << "" - << tr("Little Endian") << "" << tr("Big Endian") << "
" + << Tr::tr("Little Endian") << "" << Tr::tr("Big Endian") << "
"; } @@ -1317,10 +1318,10 @@ QString BinEditorWidget::toolTip(const QHelpEvent *helpEvent) const float floatValue, floatValueOld; asFloat(selStart, floatValue, false); asFloat(selStart, floatValueOld, true); - str << tableRowStartC << tr("float value:") << numericTableRowSepC + str << tableRowStartC << Tr::tr("float value:") << numericTableRowSepC << floatValue << tableRowEndC; if (floatValue != floatValueOld) - str << tableRowStartC << tr("Previous float value:") << numericTableRowSepC + str << tableRowStartC << Tr::tr("Previous float value:") << numericTableRowSepC << floatValueOld << tableRowEndC; str << ""; @@ -1441,8 +1442,7 @@ void BinEditorWidget::keyPressEvent(QKeyEvent *e) static void showZoomIndicator(QWidget *editor, const int newZoom) { Utils::FadingIndicator::showText(editor, - QCoreApplication::translate("BinEditorWidget::TextEditorWidget", - "Zoom: %1%").arg(newZoom), + Tr::tr("Zoom: %1%").arg(newZoom), Utils::FadingIndicator::SmallText); } @@ -1465,8 +1465,8 @@ void BinEditorWidget::copy(bool raw) int selEnd = selectionEnd(); const int selectionLength = selEnd - selStart + 1; if (selectionLength >> 22) { - QMessageBox::warning(this, tr("Copying Failed"), - tr("You cannot copy more than 4 MB of binary data.")); + QMessageBox::warning(this, Tr::tr("Copying Failed"), + Tr::tr("You cannot copy more than 4 MB of binary data.")); return; } QByteArray data = dataMid(selStart, selectionLength); @@ -1577,15 +1577,15 @@ void BinEditorWidget::contextMenuEvent(QContextMenuEvent *event) QPointer contextMenu(new QMenu(this)); - auto copyAsciiAction = new QAction(tr("Copy Selection as ASCII Characters"), contextMenu); - auto copyHexAction = new QAction(tr("Copy Selection as Hex Values"), contextMenu); + auto copyAsciiAction = new QAction(Tr::tr("Copy Selection as ASCII Characters"), contextMenu); + auto copyHexAction = new QAction(Tr::tr("Copy Selection as Hex Values"), contextMenu); auto copyBeValue = new QAction(contextMenu); auto copyLeValue = new QAction(contextMenu); auto jumpToBeAddressHereAction = new QAction(contextMenu); auto jumpToBeAddressNewWindowAction = new QAction(contextMenu); auto jumpToLeAddressHereAction = new QAction(contextMenu); auto jumpToLeAddressNewWindowAction = new QAction(contextMenu); - auto addWatchpointAction = new QAction(tr("Set Data Breakpoint on Selection"), contextMenu); + auto addWatchpointAction = new QAction(Tr::tr("Set Data Breakpoint on Selection"), contextMenu); contextMenu->addAction(copyAsciiAction); contextMenu->addAction(copyHexAction); contextMenu->addAction(addWatchpointAction); @@ -1596,11 +1596,11 @@ void BinEditorWidget::contextMenuEvent(QContextMenuEvent *event) quint64 leAddress = 0; if (byteCount <= 8) { asIntegers(selStart, byteCount, beAddress, leAddress); - copyBeValue->setText(tr("Copy 0x%1").arg(QString::number(beAddress, 16))); + copyBeValue->setText(Tr::tr("Copy 0x%1").arg(QString::number(beAddress, 16))); contextMenu->addAction(copyBeValue); // If the menu entries would be identical, show only one of them. if (beAddress != leAddress) { - copyLeValue->setText(tr("Copy 0x%1").arg(QString::number(leAddress, 16))); + copyLeValue->setText(Tr::tr("Copy 0x%1").arg(QString::number(leAddress, 16))); contextMenu->addAction(copyLeValue); } setupJumpToMenuAction(contextMenu, jumpToBeAddressHereAction, @@ -1611,9 +1611,9 @@ void BinEditorWidget::contextMenuEvent(QContextMenuEvent *event) jumpToLeAddressNewWindowAction, leAddress); } } else { - jumpToBeAddressHereAction->setText(tr("Jump to Address in This Window")); - jumpToBeAddressNewWindowAction->setText(tr("Jump to Address in New Window")); - copyBeValue->setText(tr("Copy Value")); + jumpToBeAddressHereAction->setText(Tr::tr("Jump to Address in This Window")); + jumpToBeAddressNewWindowAction->setText(Tr::tr("Jump to Address in New Window")); + copyBeValue->setText(Tr::tr("Copy Value")); jumpToBeAddressHereAction->setEnabled(false); jumpToBeAddressNewWindowAction->setEnabled(false); copyBeValue->setEnabled(false); @@ -1650,9 +1650,9 @@ void BinEditorWidget::contextMenuEvent(QContextMenuEvent *event) void BinEditorWidget::setupJumpToMenuAction(QMenu *menu, QAction *actionHere, QAction *actionNew, quint64 addr) { - actionHere->setText(tr("Jump to Address 0x%1 in This Window") + actionHere->setText(Tr::tr("Jump to Address 0x%1 in This Window") .arg(QString::number(addr, 16))); - actionNew->setText(tr("Jump to Address 0x%1 in New Window") + actionNew->setText(Tr::tr("Jump to Address 0x%1 in New Window") .arg(QString::number(addr, 16))); menu->addAction(actionHere); menu->addAction(actionNew); @@ -1735,5 +1735,4 @@ void BinEditorWidget::setMarkup(const QList &markup) viewport()->update(); } -} // namespace Internal -} // namespace BinEditor +} // BinEditor::Internal diff --git a/src/plugins/bineditor/bineditorwidget.h b/src/plugins/bineditor/bineditorwidget.h index 596f98b3c3f..c09885575df 100644 --- a/src/plugins/bineditor/bineditorwidget.h +++ b/src/plugins/bineditor/bineditorwidget.h @@ -31,8 +31,7 @@ namespace Core { class IEditor; } namespace TextEditor { class FontSettings; } -namespace BinEditor { -namespace Internal { +namespace BinEditor::Internal { class BinEditorWidgetPrivate; @@ -228,5 +227,4 @@ private: QList m_markup; }; -} // namespace Internal -} // namespace BinEditor +} // BinEditor::Internal diff --git a/src/plugins/bineditor/markup.h b/src/plugins/bineditor/markup.h index 026fa7e1e89..cbda93b1428 100644 --- a/src/plugins/bineditor/markup.h +++ b/src/plugins/bineditor/markup.h @@ -23,6 +23,6 @@ public: QString toolTip; }; -} // namespace BinEditor +} // BinEditor Q_DECLARE_METATYPE(BinEditor::Markup)