| "
@@ -333,13 +333,13 @@ void ModelEditor::init()
syncToggleButton->setDefaultAction(d->actionHandler->synchronizeBrowserAction());
QMenu *syncMenu = new QMenu(syncToggleButton);
QActionGroup *syncGroup = new QActionGroup(syncMenu);
- d->syncBrowserWithDiagramAction = syncMenu->addAction(tr("Synchronize Structure with Diagram"));
+ d->syncBrowserWithDiagramAction = syncMenu->addAction(Tr::tr("Synchronize Structure with Diagram"));
d->syncBrowserWithDiagramAction->setCheckable(true);
d->syncBrowserWithDiagramAction->setActionGroup(syncGroup);
- d->syncDiagramWithBrowserAction = syncMenu->addAction(tr("Synchronize Diagram with Structure"));
+ d->syncDiagramWithBrowserAction = syncMenu->addAction(Tr::tr("Synchronize Diagram with Structure"));
d->syncDiagramWithBrowserAction->setCheckable(true);
d->syncDiagramWithBrowserAction->setActionGroup(syncGroup);
- d->syncEachOtherAction = syncMenu->addAction(tr("Keep Synchronized"));
+ d->syncEachOtherAction = syncMenu->addAction(Tr::tr("Keep Synchronized"));
d->syncEachOtherAction->setCheckable(true);
d->syncEachOtherAction->setActionGroup(syncGroup);
syncToggleButton->setMenu(syncMenu);
@@ -573,13 +573,13 @@ void ModelEditor::exportToImage(bool selectedElements)
if (diagram) {
if (d->lastExportDirPath.isEmpty())
d->lastExportDirPath = d->document->filePath().toFileInfo().canonicalPath();
- QString filter = tr("Images (*.png *.jpeg *.jpg *.tif *.tiff);;PDF (*.pdf)");
+ QString filter = Tr::tr("Images (*.png *.jpeg *.jpg *.tif *.tiff);;PDF (*.pdf)");
#ifndef QT_NO_SVG
- filter += tr(";;SVG (*.svg)");
+ filter += Tr::tr(";;SVG (*.svg)");
#endif // QT_NO_SVG
QString fileName = FileUtils::getSaveFilePath(
nullptr,
- selectedElements ? tr("Export Selected Elements") : tr("Export Diagram"),
+ selectedElements ? Tr::tr("Export Selected Elements") : Tr::tr("Export Diagram"),
FilePath::fromString(d->lastExportDirPath), filter).toString();
if (!fileName.isEmpty()) {
qmt::DocumentController *documentController = d->document->documentController();
@@ -602,11 +602,11 @@ void ModelEditor::exportToImage(bool selectedElements)
if (success)
d->lastExportDirPath = QFileInfo(fileName).canonicalPath();
else if (selectedElements)
- QMessageBox::critical(Core::ICore::dialogParent(), tr("Exporting Selected Elements Failed"),
- tr("Exporting the selected elements of the current diagram into file \"%1\" failed.").arg(fileName)); + QMessageBox::critical(Core::ICore::dialogParent(), Tr::tr("Exporting Selected Elements Failed"), + Tr::tr("Exporting the selected elements of the current diagram into file \"%1\" failed.").arg(fileName)); else - QMessageBox::critical(Core::ICore::dialogParent(), tr("Exporting Diagram Failed"), - tr("Exporting the diagram into file \"%1\" failed.").arg(fileName)); + QMessageBox::critical(Core::ICore::dialogParent(), Tr::tr("Exporting Diagram Failed"), + Tr::tr("Exporting the diagram into file \"%1\" failed.").arg(fileName)); } } } @@ -1096,7 +1096,7 @@ void ModelEditor::initToolbars() styleEngineElementType = qmt::StyleEngine::TypeSwimlane; } QIcon icon; - QString newElementName = tr("New %1").arg(tool.m_name); + QString newElementName = Tr::tr("New %1").arg(tool.m_name); if (!tool.m_stereotype.isEmpty() && stereotypeIconElement != qmt::StereotypeIcon::ElementAny) { const qmt::Style *style = documentController->styleController()->adaptStyle(styleEngineElementType); icon = stereotypeController->createIcon( @@ -1139,32 +1139,32 @@ void ModelEditor::initToolbars() toolBars.insert(generalId, toolBar); toolBarLayout->addWidget( new DragTool(QIcon(":/modelinglib/48x48/package.png"), - tr("Package"), tr("New Package"), QLatin1String(qmt::ELEMENT_TYPE_PACKAGE), + Tr::tr("Package"), Tr::tr("New Package"), QLatin1String(qmt::ELEMENT_TYPE_PACKAGE), QString(), toolBar)); toolBarLayout->addWidget( new DragTool(QIcon(":/modelinglib/48x48/component.png"), - tr("Component"), tr("New Component"), QLatin1String(qmt::ELEMENT_TYPE_COMPONENT), + Tr::tr("Component"), Tr::tr("New Component"), QLatin1String(qmt::ELEMENT_TYPE_COMPONENT), QString(), toolBar)); toolBarLayout->addWidget( new DragTool(QIcon(":/modelinglib/48x48/class.png"), - tr("Class"), tr("New Class"), QLatin1String(qmt::ELEMENT_TYPE_CLASS), + Tr::tr("Class"), Tr::tr("New Class"), QLatin1String(qmt::ELEMENT_TYPE_CLASS), QString(), toolBar)); toolBarLayout->addWidget( new DragTool(QIcon(":/modelinglib/48x48/item.png"), - tr("Item"), tr("New Item"), QLatin1String(qmt::ELEMENT_TYPE_ITEM), + Tr::tr("Item"), Tr::tr("New Item"), QLatin1String(qmt::ELEMENT_TYPE_ITEM), QString(), toolBar)); toolBarLayout->addWidget(Layouting::createHr(d->leftToolBox)); toolBarLayout->addWidget( new DragTool(QIcon(":/modelinglib/48x48/annotation.png"), - tr("Annotation"), QString(), QLatin1String(qmt::ELEMENT_TYPE_ANNOTATION), + Tr::tr("Annotation"), QString(), QLatin1String(qmt::ELEMENT_TYPE_ANNOTATION), QString(), toolBar)); toolBarLayout->addWidget( new DragTool(QIcon(":/modelinglib/48x48/boundary.png"), - tr("Boundary"), QString(), QLatin1String(qmt::ELEMENT_TYPE_BOUNDARY), + Tr::tr("Boundary"), QString(), QLatin1String(qmt::ELEMENT_TYPE_BOUNDARY), QString(), toolBar)); toolBarLayout->addWidget( new DragTool(QIcon(":/modelinglib/48x48/swimlane.png"), - tr("Swimlane"), QString(), QLatin1String(qmt::ELEMENT_TYPE_SWIMLANE), + Tr::tr("Swimlane"), QString(), QLatin1String(qmt::ELEMENT_TYPE_SWIMLANE), QString(), toolBar)); } diff --git a/src/plugins/modeleditor/modelsmanager.cpp b/src/plugins/modeleditor/modelsmanager.cpp index 6b3e49fcade..787c5556fda 100644 --- a/src/plugins/modeleditor/modelsmanager.cpp +++ b/src/plugins/modeleditor/modelsmanager.cpp @@ -6,8 +6,9 @@ #include "diagramsviewmanager.h" #include "extdocumentcontroller.h" #include "modeldocument.h" -#include "modeleditor_constants.h" #include "modeleditor.h" +#include "modeleditor_constants.h" +#include "modeleditortr.h" #include "modelindexer.h" #include "pxnodecontroller.h" @@ -97,7 +98,7 @@ ModelsManager::ModelsManager(QObject *parent) ProjectExplorer::Constants::M_FOLDERCONTEXT); folderContainer->insertGroup(ProjectExplorer::Constants::G_FOLDER_FILES, Constants::EXPLORER_GROUP_MODELING); - d->openDiagramContextMenuItem = new QAction(tr("Open Diagram"), this); + d->openDiagramContextMenuItem = new QAction(Tr::tr("Open Diagram"), this); Core::Command *cmd = Core::ActionManager::registerAction( d->openDiagramContextMenuItem, Constants::ACTION_EXPLORER_OPEN_DIAGRAM, projectTreeContext); diff --git a/src/plugins/modeleditor/pxnodecontroller.cpp b/src/plugins/modeleditor/pxnodecontroller.cpp index 1338a79f93b..d17e2232f83 100644 --- a/src/plugins/modeleditor/pxnodecontroller.cpp +++ b/src/plugins/modeleditor/pxnodecontroller.cpp @@ -3,11 +3,12 @@ #include "pxnodecontroller.h" -#include "pxnodeutilities.h" -#include "componentviewcontroller.h" #include "classviewcontroller.h" +#include "componentviewcontroller.h" +#include "modeleditortr.h" #include "modelutilities.h" #include "packageviewcontroller.h" +#include "pxnodeutilities.h" #include "qmt/model/mpackage.h" #include "qmt/model/mclass.h" @@ -134,7 +135,7 @@ void PxNodeController::addFileSystemEntry(const QString &filePath, int line, int QFileInfo fileInfo(filePath); if (fileInfo.exists() && fileInfo.isFile()) { auto menu = new QMenu; - menu->addAction(new MenuAction(tr("Add Component %1").arg(elementName), elementName, + menu->addAction(new MenuAction(Tr::tr("Add Component %1").arg(elementName), elementName, MenuAction::TYPE_ADD_COMPONENT, menu)); const QStringList classNames = Utils::toList( d->classViewController->findClassDeclarations( @@ -143,7 +144,7 @@ void PxNodeController::addFileSystemEntry(const QString &filePath, int line, int menu->addSeparator(); int index = 0; for (const QString &className : classNames) { - auto action = new MenuAction(tr("Add Class %1").arg(className), elementName, + auto action = new MenuAction(Tr::tr("Add Class %1").arg(className), elementName, MenuAction::TYPE_ADD_CLASS, index, menu); action->className = className; menu->addAction(action); @@ -161,15 +162,15 @@ void PxNodeController::addFileSystemEntry(const QString &filePath, int line, int // ignore line and column QString stereotype; auto menu = new QMenu; - auto action = new MenuAction(tr("Add Package %1").arg(elementName), elementName, + auto action = new MenuAction(Tr::tr("Add Package %1").arg(elementName), elementName, MenuAction::TYPE_ADD_PACKAGE, menu); action->packageStereotype = stereotype; menu->addAction(action); - action = new MenuAction(tr("Add Package and Diagram %1").arg(elementName), elementName, + action = new MenuAction(Tr::tr("Add Package and Diagram %1").arg(elementName), elementName, MenuAction::TYPE_ADD_PACKAGE_AND_DIAGRAM, menu); action->packageStereotype = stereotype; menu->addAction(action); - action = new MenuAction(tr("Add Component Model"), elementName, + action = new MenuAction(Tr::tr("Add Component Model"), elementName, MenuAction::TYPE_ADD_COMPONENT_MODEL, menu); action->packageStereotype = stereotype; menu->addAction(action); @@ -300,7 +301,7 @@ void PxNodeController::onMenuActionTriggered(PxNodeController::MenuAction *actio package->setName(action->elementName); if (!action->packageStereotype.isEmpty()) package->setStereotypes({action->packageStereotype}); - d->diagramSceneController->modelController()->undoController()->beginMergeSequence(tr("Create Component Model")); + d->diagramSceneController->modelController()->undoController()->beginMergeSequence(Tr::tr("Create Component Model")); QStringList relativeElements = qmt::NameController::buildElementsPath( d->pxnodeUtilities->calcRelativePath(filePath, d->anchorFolder), true); if (qmt::MObject *existingObject = d->pxnodeUtilities->findSameObject(relativeElements, package)) { @@ -321,7 +322,7 @@ void PxNodeController::onMenuActionTriggered(PxNodeController::MenuAction *actio } if (newObject) { - d->diagramSceneController->modelController()->undoController()->beginMergeSequence(tr("Drop Node")); + d->diagramSceneController->modelController()->undoController()->beginMergeSequence(Tr::tr("Drop Node")); qmt::MObject *parentForDiagram = nullptr; QStringList relativeElements = qmt::NameController::buildElementsPath( d->pxnodeUtilities->calcRelativePath(filePath, d->anchorFolder), |