forked from qt-creator/qt-creator
Debugger: Convert to Tr::tr
Change-Id: I5d2475c790851c68f9997ac6af72b5eaca58482d Reviewed-by: Eike Ziller <eike.ziller@qt.io>
This commit is contained in:
@@ -29,6 +29,7 @@
|
||||
#include "debuggerconstants.h"
|
||||
#include "debuggercore.h"
|
||||
#include "debuggerengine.h"
|
||||
#include "debuggertr.h"
|
||||
|
||||
#include <utils/basetreeview.h>
|
||||
#include <utils/hostosinfo.h>
|
||||
@@ -45,13 +46,10 @@
|
||||
|
||||
using namespace Utils;
|
||||
|
||||
namespace Debugger {
|
||||
namespace Internal {
|
||||
namespace Debugger::Internal {
|
||||
|
||||
class ModuleItem : public TreeItem
|
||||
{
|
||||
Q_DECLARE_TR_FUNCTIONS(Debuggger::Internal::ModulesHandler)
|
||||
|
||||
public:
|
||||
QVariant data(int column, int role) const override;
|
||||
|
||||
@@ -85,39 +83,39 @@ QVariant ModuleItem::data(int column, int role) const
|
||||
case 2:
|
||||
if (role == Qt::DisplayRole)
|
||||
switch (module.symbolsRead) {
|
||||
case Module::UnknownReadState: return tr("Unknown");
|
||||
case Module::ReadFailed: return tr("No");
|
||||
case Module::ReadOk: return tr("Yes");
|
||||
case Module::UnknownReadState: return Tr::tr("Unknown");
|
||||
case Module::ReadFailed: return Tr::tr("No");
|
||||
case Module::ReadOk: return Tr::tr("Yes");
|
||||
}
|
||||
break;
|
||||
case 3:
|
||||
if (role == Qt::DisplayRole)
|
||||
switch (module.elfData.symbolsType) {
|
||||
case UnknownSymbols: return tr("Unknown");
|
||||
case NoSymbols: return tr("None");
|
||||
case PlainSymbols: return tr("Plain");
|
||||
case FastSymbols: return tr("Fast");
|
||||
case LinkedSymbols: return tr("debuglnk");
|
||||
case BuildIdSymbols: return tr("buildid");
|
||||
case UnknownSymbols: return Tr::tr("Unknown");
|
||||
case NoSymbols: return Tr::tr("None");
|
||||
case PlainSymbols: return Tr::tr("Plain");
|
||||
case FastSymbols: return Tr::tr("Fast");
|
||||
case LinkedSymbols: return Tr::tr("debuglnk");
|
||||
case BuildIdSymbols: return Tr::tr("buildid");
|
||||
}
|
||||
else if (role == Qt::ToolTipRole)
|
||||
switch (module.elfData.symbolsType) {
|
||||
case UnknownSymbols:
|
||||
return tr("It is unknown whether this module contains debug "
|
||||
return Tr::tr("It is unknown whether this module contains debug "
|
||||
"information.\nUse \"Examine Symbols\" from the "
|
||||
"context menu to initiate a check.");
|
||||
case NoSymbols:
|
||||
return tr("This module neither contains nor references debug "
|
||||
return Tr::tr("This module neither contains nor references debug "
|
||||
"information.\nStepping into the module or setting "
|
||||
"breakpoints by file and line will not work.");
|
||||
case PlainSymbols:
|
||||
case FastSymbols:
|
||||
return tr("This module contains debug information.\nStepping "
|
||||
return Tr::tr("This module contains debug information.\nStepping "
|
||||
"into the module or setting breakpoints by file and "
|
||||
"line is expected to work.");
|
||||
case LinkedSymbols:
|
||||
case BuildIdSymbols:
|
||||
return tr("This module does not contain debug information "
|
||||
return Tr::tr("This module does not contain debug information "
|
||||
"itself, but contains a reference to external "
|
||||
"debug information.");
|
||||
}
|
||||
@@ -132,7 +130,7 @@ QVariant ModuleItem::data(int column, int role) const
|
||||
if (module.endAddress)
|
||||
return QString("0x" + QString::number(module.endAddress, 16));
|
||||
//: End address of loaded module
|
||||
return tr("<unknown>", "address");
|
||||
return Tr::tr("<unknown>", "address");
|
||||
}
|
||||
break;
|
||||
}
|
||||
@@ -147,8 +145,6 @@ QVariant ModuleItem::data(int column, int role) const
|
||||
|
||||
class ModulesModel : public TreeModel<TypedTreeItem<ModuleItem>, ModuleItem>
|
||||
{
|
||||
Q_DECLARE_TR_FUNCTIONS(Debuggger::Internal::ModulesHandler)
|
||||
|
||||
public:
|
||||
bool setData(const QModelIndex &idx, const QVariant &data, int role) override
|
||||
{
|
||||
@@ -180,46 +176,46 @@ bool ModulesModel::contextMenuEvent(const ItemViewEvent &ev)
|
||||
|
||||
auto menu = new QMenu;
|
||||
|
||||
addAction(this, menu, tr("Update Module List"),
|
||||
addAction(this, menu, Tr::tr("Update Module List"),
|
||||
enabled && canReload,
|
||||
[this] { engine->reloadModules(); });
|
||||
|
||||
addAction(this, menu, tr("Show Source Files for Module \"%1\"").arg(moduleName),
|
||||
tr("Show Source Files for Module"),
|
||||
addAction(this, menu, Tr::tr("Show Source Files for Module \"%1\"").arg(moduleName),
|
||||
Tr::tr("Show Source Files for Module"),
|
||||
moduleNameValid && enabled && canReload,
|
||||
[this, modulePath] { engine->loadSymbols(modulePath); });
|
||||
|
||||
// FIXME: Dependencies only available on Windows, when "depends" is installed.
|
||||
addAction(this, menu, tr("Show Dependencies of \"%1\"").arg(moduleName),
|
||||
tr("Show Dependencies"),
|
||||
addAction(this, menu, Tr::tr("Show Dependencies of \"%1\"").arg(moduleName),
|
||||
Tr::tr("Show Dependencies"),
|
||||
moduleNameValid && !moduleName.isEmpty() && HostOsInfo::isWindowsHost(),
|
||||
[modulePath] { QtcProcess::startDetached({{"depends"}, {modulePath}}); });
|
||||
|
||||
addAction(this, menu, tr("Load Symbols for All Modules"),
|
||||
addAction(this, menu, Tr::tr("Load Symbols for All Modules"),
|
||||
enabled && canLoadSymbols,
|
||||
[this] { engine->loadAllSymbols(); });
|
||||
|
||||
addAction(this, menu, tr("Examine All Modules"),
|
||||
addAction(this, menu, Tr::tr("Examine All Modules"),
|
||||
enabled && canLoadSymbols,
|
||||
[this] { engine->examineModules(); });
|
||||
|
||||
addAction(this, menu, tr("Load Symbols for Module \"%1\"").arg(moduleName),
|
||||
tr("Load Symbols for Module"),
|
||||
addAction(this, menu, Tr::tr("Load Symbols for Module \"%1\"").arg(moduleName),
|
||||
Tr::tr("Load Symbols for Module"),
|
||||
moduleNameValid && canLoadSymbols,
|
||||
[this, modulePath] { engine->loadSymbols(modulePath); });
|
||||
|
||||
addAction(this, menu, tr("Edit File \"%1\"").arg(moduleName),
|
||||
tr("Edit File"),
|
||||
addAction(this, menu, Tr::tr("Edit File \"%1\"").arg(moduleName),
|
||||
Tr::tr("Edit File"),
|
||||
moduleNameValid,
|
||||
[this, modulePath] { engine->gotoLocation(FilePath::fromString(modulePath)); });
|
||||
|
||||
addAction(this, menu, tr("Show Symbols in File \"%1\"").arg(moduleName),
|
||||
tr("Show Symbols"),
|
||||
addAction(this, menu, Tr::tr("Show Symbols in File \"%1\"").arg(moduleName),
|
||||
Tr::tr("Show Symbols"),
|
||||
canShowSymbols && moduleNameValid,
|
||||
[this, modulePath] { engine->requestModuleSymbols(modulePath); });
|
||||
|
||||
addAction(this, menu, tr("Show Sections in File \"%1\"").arg(moduleName),
|
||||
tr("Show Sections"),
|
||||
addAction(this, menu, Tr::tr("Show Sections in File \"%1\"").arg(moduleName),
|
||||
Tr::tr("Show Sections"),
|
||||
canShowSymbols && moduleNameValid,
|
||||
[this, modulePath] { engine->requestModuleSections(modulePath); });
|
||||
|
||||
@@ -243,12 +239,12 @@ ModulesHandler::ModulesHandler(DebuggerEngine *engine)
|
||||
m_model->engine = engine;
|
||||
m_model->setObjectName("ModulesModel");
|
||||
m_model->setHeader(QStringList({
|
||||
tr("Module Name") + pad,
|
||||
tr("Module Path") + pad,
|
||||
tr("Symbols Read") + pad,
|
||||
tr("Symbols Type") + pad,
|
||||
tr("Start Address") + pad,
|
||||
tr("End Address") + pad}));
|
||||
Tr::tr("Module Name") + pad,
|
||||
Tr::tr("Module Path") + pad,
|
||||
Tr::tr("Symbols Read") + pad,
|
||||
Tr::tr("Symbols Type") + pad,
|
||||
Tr::tr("Start Address") + pad,
|
||||
Tr::tr("End Address") + pad}));
|
||||
|
||||
m_proxyModel = new QSortFilterProxyModel(this);
|
||||
m_proxyModel->setObjectName("ModulesProxyModel");
|
||||
@@ -333,5 +329,4 @@ void ModulesHandler::endUpdateAll()
|
||||
m_model->destroyItem(item);
|
||||
}
|
||||
|
||||
} // namespace Internal
|
||||
} // namespace Debugger
|
||||
} // namespace Debugger::Internal
|
||||
|
||||
Reference in New Issue
Block a user