ScxmlEditor: Convert to using Tr::tr

Change-Id: Ia8ab06d4b8a16bb144d6887624c478fb911f29ea
Reviewed-by: hjk <hjk@qt.io>
This commit is contained in:
Alessandro Portale
2022-08-23 13:05:04 +02:00
parent 94d7e2efac
commit dc3eae230f
41 changed files with 226 additions and 1445 deletions

View File

@@ -2,8 +2,8 @@
// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0+ OR GPL-3.0 WITH Qt-GPL-exception-1.0
#include "actionhandler.h"
#include "mytypes.h"
#include "scxmleditortr.h"
#include <utils/utilsicons.h>
@@ -21,32 +21,32 @@ ActionHandler::ActionHandler(QObject *parent)
const char *keyseq;
bool checkable;
} actionInfos[] = {
{Utils::Icons::ZOOMIN_TOOLBAR, tr("Zoom In"), tr("Zoom In (Ctrl + + / Ctrl + Wheel)"), "Ctrl++", false},
{Utils::Icons::ZOOMOUT_TOOLBAR, tr("Zoom Out"), tr("Zoom Out (Ctrl + - / Ctrl + Wheel)"), "Ctrl+-", false},
{Utils::Icons::FITTOVIEW_TOOLBAR, tr("Fit to View"), tr("Fit to View (F11)"), "F11", false},
{Utils::Icons::PAN_TOOLBAR, tr("Panning"), tr("Panning (Shift)"), "Shift", true},
{Utils::Icons::ZOOMIN_TOOLBAR, Tr::tr("Zoom In"), Tr::tr("Zoom In (Ctrl + + / Ctrl + Wheel)"), "Ctrl++", false},
{Utils::Icons::ZOOMOUT_TOOLBAR, Tr::tr("Zoom Out"), Tr::tr("Zoom Out (Ctrl + - / Ctrl + Wheel)"), "Ctrl+-", false},
{Utils::Icons::FITTOVIEW_TOOLBAR, Tr::tr("Fit to View"), Tr::tr("Fit to View (F11)"), "F11", false},
{Utils::Icons::PAN_TOOLBAR, Tr::tr("Panning"), Tr::tr("Panning (Shift)"), "Shift", true},
{Utils::Icons::ZOOM_TOOLBAR, tr("Magnifier"), tr("Magnifier Tool"), "", true},
{Utils::Icon(":/scxmleditor/images/navigator.png"), tr("Navigator"), tr("Navigator (Ctrl+E)"), "Ctrl+E", true},
{Utils::Icons::ZOOM_TOOLBAR, Tr::tr("Magnifier"), Tr::tr("Magnifier Tool"), "", true},
{Utils::Icon(":/scxmleditor/images/navigator.png"), Tr::tr("Navigator"), Tr::tr("Navigator (Ctrl+E)"), "Ctrl+E", true},
{Utils::Icons::COPY_TOOLBAR, tr("Copy"), tr("Copy (Ctrl + C)"), "Ctrl+C", false},
{Utils::Icons::CUT_TOOLBAR, tr("Cut"), tr("Cut (Ctrl + X)"), "Ctrl+X", false},
{Utils::Icons::PASTE_TOOLBAR, tr("Paste"), tr("Paste (Ctrl + V)"), "Ctrl+V", false},
{Utils::Icons::SNAPSHOT_TOOLBAR, tr("Screenshot"), tr("Screenshot (Ctrl + Shift + C)"), "Ctrl+Shift+C", false},
{Utils::Icon({{":/scxmleditor/images/icon-export-canvas.png", Utils::Theme::IconsBaseColor}}), tr("Export to Image"), tr("Export to Image"), "Ctrl+Shift+E", false},
{Utils::Icon({{":/utils/images/namespace.png", Utils::Theme::IconsBaseColor}}), tr("Toggle Full Namespace"), tr("Toggle Full Namespace"), "Ctrl+Shift+N", true},
{Utils::Icons::COPY_TOOLBAR, Tr::tr("Copy"), Tr::tr("Copy (Ctrl + C)"), "Ctrl+C", false},
{Utils::Icons::CUT_TOOLBAR, Tr::tr("Cut"), Tr::tr("Cut (Ctrl + X)"), "Ctrl+X", false},
{Utils::Icons::PASTE_TOOLBAR, Tr::tr("Paste"), Tr::tr("Paste (Ctrl + V)"), "Ctrl+V", false},
{Utils::Icons::SNAPSHOT_TOOLBAR, Tr::tr("Screenshot"), Tr::tr("Screenshot (Ctrl + Shift + C)"), "Ctrl+Shift+C", false},
{Utils::Icon({{":/scxmleditor/images/icon-export-canvas.png", Utils::Theme::IconsBaseColor}}), Tr::tr("Export to Image"), Tr::tr("Export to Image"), "Ctrl+Shift+E", false},
{Utils::Icon({{":/utils/images/namespace.png", Utils::Theme::IconsBaseColor}}), Tr::tr("Toggle Full Namespace"), Tr::tr("Toggle Full Namespace"), "Ctrl+Shift+N", true},
{Utils::Icon({{":/scxmleditor/images/align_left.png", Utils::Theme::PanelTextColorMid}}, Utils::Icon::Tint), tr("Align Left"), tr("Align Left (Ctrl+L,1)"), "Ctrl+L,1", false},
{Utils::Icon({{":/scxmleditor/images/align_right.png", Utils::Theme::PanelTextColorMid}}, Utils::Icon::Tint), tr("Align Right"), tr("Align Right (Ctrl+L,2)"), "Ctrl+L,2", false},
{Utils::Icon({{":/scxmleditor/images/align_top.png", Utils::Theme::PanelTextColorMid}}, Utils::Icon::Tint), tr("Align Top"), tr("Align Top (Ctrl+L,3)"), "Ctrl+L,3", false},
{Utils::Icon({{":/scxmleditor/images/align_bottom.png", Utils::Theme::PanelTextColorMid}}, Utils::Icon::Tint), tr("Align Bottom"), tr("Align Bottom (Ctrl+L,4)"), "Ctrl+L,4", false},
{Utils::Icon({{":/scxmleditor/images/align_horizontal.png", Utils::Theme::PanelTextColorMid}}, Utils::Icon::Tint), tr("Align Horizontal"), tr("Align Horizontal (Ctrl+L,5)"), "Ctrl+L,5", false},
{Utils::Icon({{":/scxmleditor/images/align_vertical.png", Utils::Theme::PanelTextColorMid}}, Utils::Icon::Tint), tr("Align Vertical"), tr("Align Vertical (Ctrl+L,6)"), "Ctrl+L,6", false},
{Utils::Icon({{":/scxmleditor/images/adjust_width.png", Utils::Theme::PanelTextColorMid}}, Utils::Icon::Tint), tr("Adjust Width"), tr("Adjust Width (Ctrl+L,7)"), "Ctrl+L,7", false},
{Utils::Icon({{":/scxmleditor/images/adjust_height.png", Utils::Theme::PanelTextColorMid}}, Utils::Icon::Tint), tr("Adjust Height"), tr("Adjust Height (Ctrl+L,8)"), "Ctrl+L,8", false},
{Utils::Icon({{":/scxmleditor/images/adjust_size.png", Utils::Theme::PanelTextColorMid}}, Utils::Icon::Tint), tr("Adjust Size"), tr("Adjust Size (Ctrl+L,9)"), "Ctrl+L,9", false},
{Utils::Icon({{":/scxmleditor/images/align_left.png", Utils::Theme::PanelTextColorMid}}, Utils::Icon::Tint), Tr::tr("Align Left"), Tr::tr("Align Left (Ctrl+L,1)"), "Ctrl+L,1", false},
{Utils::Icon({{":/scxmleditor/images/align_right.png", Utils::Theme::PanelTextColorMid}}, Utils::Icon::Tint), Tr::tr("Align Right"), Tr::tr("Align Right (Ctrl+L,2)"), "Ctrl+L,2", false},
{Utils::Icon({{":/scxmleditor/images/align_top.png", Utils::Theme::PanelTextColorMid}}, Utils::Icon::Tint), Tr::tr("Align Top"), Tr::tr("Align Top (Ctrl+L,3)"), "Ctrl+L,3", false},
{Utils::Icon({{":/scxmleditor/images/align_bottom.png", Utils::Theme::PanelTextColorMid}}, Utils::Icon::Tint), Tr::tr("Align Bottom"), Tr::tr("Align Bottom (Ctrl+L,4)"), "Ctrl+L,4", false},
{Utils::Icon({{":/scxmleditor/images/align_horizontal.png", Utils::Theme::PanelTextColorMid}}, Utils::Icon::Tint), Tr::tr("Align Horizontal"), Tr::tr("Align Horizontal (Ctrl+L,5)"), "Ctrl+L,5", false},
{Utils::Icon({{":/scxmleditor/images/align_vertical.png", Utils::Theme::PanelTextColorMid}}, Utils::Icon::Tint), Tr::tr("Align Vertical"), Tr::tr("Align Vertical (Ctrl+L,6)"), "Ctrl+L,6", false},
{Utils::Icon({{":/scxmleditor/images/adjust_width.png", Utils::Theme::PanelTextColorMid}}, Utils::Icon::Tint), Tr::tr("Adjust Width"), Tr::tr("Adjust Width (Ctrl+L,7)"), "Ctrl+L,7", false},
{Utils::Icon({{":/scxmleditor/images/adjust_height.png", Utils::Theme::PanelTextColorMid}}, Utils::Icon::Tint), Tr::tr("Adjust Height"), Tr::tr("Adjust Height (Ctrl+L,8)"), "Ctrl+L,8", false},
{Utils::Icon({{":/scxmleditor/images/adjust_size.png", Utils::Theme::PanelTextColorMid}}, Utils::Icon::Tint), Tr::tr("Adjust Size"), Tr::tr("Adjust Size (Ctrl+L,9)"), "Ctrl+L,9", false},
{Utils::Icon(":/scxmleditor/images/statistics.png"), tr("Show Statistics..."), tr("Show Statistics"), "", false}
{Utils::Icon(":/scxmleditor/images/statistics.png"), Tr::tr("Show Statistics..."), Tr::tr("Show Statistics"), "", false}
};
// Init actions

View File

@@ -1,13 +1,14 @@
// Copyright (C) 2016 The Qt Company Ltd.
// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0+ OR GPL-3.0 WITH Qt-GPL-exception-1.0
#include "baseitem.h"
#include "actionhandler.h"
#include "actionprovider.h"
#include "baseitem.h"
#include "graphicsscene.h"
#include "sceneutils.h"
#include "scxmldocument.h"
#include "scxmleditorconstants.h"
#include "scxmleditortr.h"
#include "scxmltagutils.h"
#include "scxmluifactory.h"
#include "stateitem.h"
@@ -185,7 +186,7 @@ void BaseItem::selectedMenuAction(const QAction *action)
case TagUtils::AddChild: {
const ScxmlDocument *document = tag->document();
if (m_scene && document) {
document->undoStack()->beginMacro(tr("Add child"));
document->undoStack()->beginMacro(Tr::tr("Add child"));
SceneUtils::addChild(tag, data, m_scene);
document->undoStack()->endMacro();
}

View File

@@ -8,6 +8,7 @@
#include "quicktransitionitem.h"
#include "sceneutils.h"
#include "scxmleditorconstants.h"
#include "scxmleditortr.h"
#include "serializer.h"
#include "stateitem.h"
@@ -198,7 +199,7 @@ bool ConnectableItem::sceneEventFilter(QGraphicsItem *watched, QEvent *event)
if (event->type() == QEvent::GraphicsSceneMousePress) {
m_newTransitionStartedPoint = mouseEvent->pos();
tag()->document()->undoStack()->beginMacro(tr("Add new state"));
tag()->document()->undoStack()->beginMacro(Tr::tr("Add new state"));
m_newTransition = new TransitionItem;
scene()->addItem(m_newTransition);
@@ -370,7 +371,7 @@ void ConnectableItem::mouseMoveEvent(QGraphicsSceneMouseEvent *event)
if (!m_moveMacroStarted) {
m_moveMacroStarted = true;
tag()->document()->undoStack()->beginMacro(tr("Move State"));
tag()->document()->undoStack()->beginMacro(Tr::tr("Move State"));
}
//Restore old behavior if ctrl & alt modifiers are present

View File

@@ -1,14 +1,15 @@
// Copyright (C) 2016 The Qt Company Ltd.
// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0+ OR GPL-3.0 WITH Qt-GPL-exception-1.0
#include "graphicsscene.h"
#include "actionhandler.h"
#include "actionprovider.h"
#include "finalstateitem.h"
#include "graphicsscene.h"
#include "initialstateitem.h"
#include "parallelitem.h"
#include "sceneutils.h"
#include "scxmleditorconstants.h"
#include "scxmleditortr.h"
#include "scxmltagutils.h"
#include "scxmluifactory.h"
#include "snapline.h"
@@ -96,7 +97,7 @@ qreal GraphicsScene::selectedMaxHeight() const
void GraphicsScene::alignStates(int alignType)
{
if (alignType >= ActionAlignLeft && alignType <= ActionAlignVertical) {
m_document->undoStack()->beginMacro(tr("Align states"));
m_document->undoStack()->beginMacro(Tr::tr("Align states"));
QRectF r = selectedBoundingRect();
if (r.isValid()) {
@@ -149,7 +150,7 @@ void GraphicsScene::alignStates(int alignType)
void GraphicsScene::adjustStates(int adjustType)
{
if (adjustType >= ActionAdjustWidth && adjustType <= ActionAdjustSize) {
m_document->undoStack()->beginMacro(tr("Adjust states"));
m_document->undoStack()->beginMacro(Tr::tr("Adjust states"));
qreal maxw = selectedMaxWidth();
qreal maxh = selectedMaxHeight();
@@ -170,7 +171,7 @@ void GraphicsScene::adjustStates(int adjustType)
}
void GraphicsScene::cut()
{
m_document->undoStack()->beginMacro(tr("Cut"));
m_document->undoStack()->beginMacro(Tr::tr("Cut"));
copy();
removeSelectedItems();
m_document->undoStack()->endMacro();
@@ -180,7 +181,7 @@ void GraphicsScene::removeSelectedItems()
{
QVector<ScxmlTag*> tags = SceneUtils::findRemovedTags(m_baseItems);
if (!tags.isEmpty()) {
m_document->undoStack()->beginMacro(tr("Remove items"));
m_document->undoStack()->beginMacro(Tr::tr("Remove items"));
// Then remove found tags
for (int i = tags.count(); i--;) {
@@ -346,7 +347,7 @@ void GraphicsScene::init()
void GraphicsScene::runLayoutToSelectedStates()
{
m_document->undoStack()->beginMacro(tr("Re-layout"));
m_document->undoStack()->beginMacro(Tr::tr("Re-layout"));
QVector<BaseItem*> selectedItems;
for (BaseItem *node : qAsConst(m_baseItems)) {
@@ -625,7 +626,7 @@ ScxmlUiFactory *GraphicsScene::uiFactory() const
void GraphicsScene::addConnectableItem(ItemType type, const QPointF &pos, BaseItem *parentItem)
{
m_document->undoStack()->beginMacro(tr("Add new state"));
m_document->undoStack()->beginMacro(Tr::tr("Add new state"));
ConnectableItem *newItem = SceneUtils::createItem(type, pos);
if (newItem) {

View File

@@ -2,6 +2,8 @@
// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0+ OR GPL-3.0 WITH Qt-GPL-exception-1.0
#include "idwarningitem.h"
#include "scxmleditortr.h"
#include <QGraphicsScene>
using namespace ScxmlEditor::PluginInterface;
@@ -10,9 +12,9 @@ IdWarningItem::IdWarningItem(QGraphicsItem *parent)
: WarningItem(parent)
{
setSeverity(OutputPane::Warning::ErrorType);
setTypeName(tr("State"));
setDescription(tr("Each state must have a unique ID."));
setReason(tr("Missing ID."));
setTypeName(Tr::tr("State"));
setDescription(Tr::tr("Each state must have a unique ID."));
setReason(Tr::tr("Missing ID."));
setX(-boundingRect().width());
}
@@ -32,7 +34,7 @@ void IdWarningItem::setId(const QString &text)
// Check new id
if (m_id.isEmpty()) {
setReason(tr("Missing ID."));
setReason(Tr::tr("Missing ID."));
setWarningActive(true);
} else
checkDuplicates(m_id);
@@ -56,7 +58,7 @@ void IdWarningItem::checkDuplicates(const QString &id)
foundItems[0]->setWarningActive(false);
} else {
for (int i = 0; i < foundItems.count(); ++i) {
foundItems[i]->setReason(tr("Duplicate ID (%1).").arg(id));
foundItems[i]->setReason(Tr::tr("Duplicate ID (%1).").arg(id));
foundItems[i]->setWarningActive(true);
}
}

View File

@@ -1,9 +1,10 @@
// Copyright (C) 2016 The Qt Company Ltd.
// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0+ OR GPL-3.0 WITH Qt-GPL-exception-1.0
#include "initialwarningitem.h"
#include "initialstateitem.h"
#include "initialwarningitem.h"
#include "sceneutils.h"
#include "scxmleditortr.h"
using namespace ScxmlEditor::PluginInterface;
@@ -12,9 +13,9 @@ InitialWarningItem::InitialWarningItem(InitialStateItem *parent)
, m_parentItem(parent)
{
setSeverity(OutputPane::Warning::ErrorType);
setTypeName(tr("Initial"));
setDescription(tr("One level can contain only one initial state."));
setReason(tr("Too many initial states at the same level."));
setTypeName(Tr::tr("Initial"));
setDescription(Tr::tr("One level can contain only one initial state."));
setReason(Tr::tr("Too many initial states at the same level."));
}
void InitialWarningItem::updatePos()

View File

@@ -2,6 +2,8 @@
// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0+ OR GPL-3.0 WITH Qt-GPL-exception-1.0
#include "quicktransitionitem.h"
#include "scxmleditortr.h"
#include <QGraphicsSceneMouseEvent>
#include <QPainter>
@@ -100,7 +102,7 @@ void QuickTransitionItem::paint(QPainter *painter, const QStyleOptionGraphicsIte
painter->setPen(m_pen);
painter->setBrush(Qt::white);
painter->drawEllipse(m_stateRect.center(), 7, 7);
painter->drawText(m_stateRect, Qt::AlignCenter, tr("H"));
painter->drawText(m_stateRect, Qt::AlignCenter, Tr::tr("H"));
break;
default:
break;

View File

@@ -1,8 +1,9 @@
// Copyright (C) 2016 The Qt Company Ltd.
// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0+ OR GPL-3.0 WITH Qt-GPL-exception-1.0
#include "scattributeitemmodel.h"
#include "mytypes.h"
#include "scattributeitemmodel.h"
#include "scxmleditortr.h"
#include <QBrush>
@@ -16,7 +17,7 @@ SCAttributeItemModel::SCAttributeItemModel(QObject *parent)
QVariant SCAttributeItemModel::headerData(int section, Qt::Orientation orientation, int role) const
{
if (orientation == Qt::Horizontal && role == Qt::DisplayRole)
return section == 0 ? tr("Name") : tr("Value");
return section == 0 ? Tr::tr("Name") : Tr::tr("Value");
return QVariant();
}
@@ -68,7 +69,7 @@ QVariant SCAttributeItemModel::data(const QModelIndex &index, int role) const
switch (role) {
case Qt::DisplayRole:
if (bExtraRow)
return index.column() == 0 ? tr("- name -") : tr(" - value -");
return index.column() == 0 ? Tr::tr("- name -") : Tr::tr(" - value -");
Q_FALLTHROUGH();
case Qt::EditRole: {
if (index.column() == 0) {

View File

@@ -2,6 +2,7 @@
// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0+ OR GPL-3.0 WITH Qt-GPL-exception-1.0
#include "scshapeprovider.h"
#include "scxmleditortr.h"
#include "scxmltag.h"
#include <QDebug>
@@ -32,24 +33,24 @@ void SCShapeProvider::initGroups()
void SCShapeProvider::init()
{
ShapeGroup *group = addGroup(tr("Common States"));
group->addShape(createShape(tr("Initial"), QIcon(":/scxmleditor/images/initial.png"), QStringList() << "scxml"
ShapeGroup *group = addGroup(Tr::tr("Common States"));
group->addShape(createShape(Tr::tr("Initial"), QIcon(":/scxmleditor/images/initial.png"), QStringList() << "scxml"
<< "state"
<< "parallel",
"<initial/>"));
group->addShape(createShape(tr("Final"), QIcon(":/scxmleditor/images/final.png"), QStringList() << "scxml"
group->addShape(createShape(Tr::tr("Final"), QIcon(":/scxmleditor/images/final.png"), QStringList() << "scxml"
<< "state"
<< "parallel",
"<final/>"));
group->addShape(createShape(tr("State"), QIcon(":/scxmleditor/images/state.png"), QStringList() << "scxml"
group->addShape(createShape(Tr::tr("State"), QIcon(":/scxmleditor/images/state.png"), QStringList() << "scxml"
<< "state"
<< "parallel",
"<state/>"));
group->addShape(createShape(tr("Parallel"), QIcon(":/scxmleditor/images/parallel.png"), QStringList() << "scxml"
group->addShape(createShape(Tr::tr("Parallel"), QIcon(":/scxmleditor/images/parallel.png"), QStringList() << "scxml"
<< "state"
<< "parallel",
"<parallel/>"));
group->addShape(createShape(tr("History"), QIcon(":/scxmleditor/images/history.png"), QStringList() << "state"
group->addShape(createShape(Tr::tr("History"), QIcon(":/scxmleditor/images/history.png"), QStringList() << "state"
<< "parallel",
"<history/>"));
}

View File

@@ -2,6 +2,7 @@
// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0+ OR GPL-3.0 WITH Qt-GPL-exception-1.0
#include "scxmldocument.h"
#include "scxmleditortr.h"
#include "scxmlnamespace.h"
#include "scxmltagutils.h"
#include "undocommands.h"
@@ -236,16 +237,16 @@ void ScxmlDocument::initErrorMessage(const QXmlStreamReader &xml, QIODevice *io)
QString errorString;
switch (xml.error()) {
case QXmlStreamReader::Error::UnexpectedElementError:
errorString = tr("Unexpected element.");
errorString = Tr::tr("Unexpected element.");
break;
case QXmlStreamReader::Error::NotWellFormedError:
errorString = tr("Not well formed.");
errorString = Tr::tr("Not well formed.");
break;
case QXmlStreamReader::Error::PrematureEndOfDocumentError:
errorString = tr("Premature end of document.");
errorString = Tr::tr("Premature end of document.");
break;
case QXmlStreamReader::Error::CustomError:
errorString = tr("Custom error.");
errorString = Tr::tr("Custom error.");
break;
default:
break;
@@ -257,7 +258,7 @@ void ScxmlDocument::initErrorMessage(const QXmlStreamReader &xml, QIODevice *io)
io->readLine();
lineString = QLatin1String(io->readLine());
m_lastError = tr("Error in reading XML.\nType: %1 (%2)\nDescription: %3\n\nRow: %4, Column: %5\n%6")
m_lastError = Tr::tr("Error in reading XML.\nType: %1 (%2)\nDescription: %3\n\nRow: %4, Column: %5\n%6")
.arg(xml.error())
.arg(errorString)
.arg(xml.errorString())
@@ -273,18 +274,18 @@ bool ScxmlDocument::pasteData(const QByteArray &data, const QPointF &minPos, con
if (!m_currentTag) {
m_hasError = true;
m_lastError = tr("Current tag is not selected.");
m_lastError = Tr::tr("Current tag is not selected.");
return false;
}
if (data.trimmed().isEmpty()) {
m_hasError = true;
m_lastError = tr("Pasted data is empty.");
m_lastError = Tr::tr("Pasted data is empty.");
return false;
}
bool ok = true;
m_undoStack->beginMacro(tr("Paste items"));
m_undoStack->beginMacro(Tr::tr("Paste items"));
QByteArray d(data);
QBuffer buffer(&d);
@@ -432,10 +433,10 @@ bool ScxmlDocument::save(const QString &fileName)
}
file.close();
if (!ok)
m_lastError = tr("Cannot save XML to the file %1.").arg(fileName);
m_lastError = Tr::tr("Cannot save XML to the file %1.").arg(fileName);
} else {
ok = false;
m_lastError = tr("Cannot open file %1.").arg(fileName);
m_lastError = Tr::tr("Cannot open file %1.").arg(fileName);
}
return ok;
@@ -518,7 +519,7 @@ void ScxmlDocument::addTag(ScxmlTag *parent, ScxmlTag *child)
parent = rootTag();
if (parent && child) {
m_undoStack->beginMacro(tr("Add Tag"));
m_undoStack->beginMacro(Tr::tr("Add Tag"));
addTagRecursive(parent, child);
m_undoStack->endMacro();
}
@@ -528,7 +529,7 @@ void ScxmlDocument::removeTag(ScxmlTag *tag)
{
if (tag && !m_undoRedoRunning) {
// Create undo/redo -macro, because state can includes lot of child-states
m_undoStack->beginMacro(tr("Remove Tag"));
m_undoStack->beginMacro(Tr::tr("Remove Tag"));
removeTagRecursive(tag);
m_undoStack->endMacro();
}

View File

@@ -1,9 +1,10 @@
// Copyright (C) 2016 The Qt Company Ltd.
// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0+ OR GPL-3.0 WITH Qt-GPL-exception-1.0
#include "scxmltag.h"
#include "scxmldocument.h"
#include "scxmleditorconstants.h"
#include "scxmleditortr.h"
#include "scxmltag.h"
#include "scxmltagutils.h"
#include <QCoreApplication>
@@ -348,8 +349,7 @@ void ScxmlTag::setAttributeName(int ind, const QString &name)
m_attributeNames[ind] = name;
} else {
m_attributeNames << name;
m_attributeValues << QCoreApplication::translate(
"SXCMLTag::UnknownAttributeValue", "Unknown");
m_attributeValues << Tr::tr("Unknown");
}
}
@@ -358,8 +358,7 @@ void ScxmlTag::setAttribute(int ind, const QString &value)
if (ind >= 0 && ind < m_attributeNames.count())
setAttribute(m_attributeNames[ind], value);
else {
m_attributeNames << QCoreApplication::translate(
"SXCMLTag::UnknownAttributeName", "Unknown");
m_attributeNames << Tr::tr("Unknown");
m_attributeValues << value;
}
}
@@ -641,7 +640,7 @@ void ScxmlTag::readXml(QXmlStreamReader &xml, bool checkCopyId)
childTag->readXml(xml, checkCopyId);
}
} else if (token == QXmlStreamReader::Invalid) {
qDebug() << ScxmlTag::tr("Error in reading XML ") << xml.error() << ":"
qDebug() << Tr::tr("Error in reading XML ") << xml.error() << ":"
<< xml.errorString();
break;
}

View File

@@ -1,9 +1,10 @@
// Copyright (C) 2016 The Qt Company Ltd.
// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0+ OR GPL-3.0 WITH Qt-GPL-exception-1.0
#include "scxmltagutils.h"
#include "scxmldocument.h"
#include "scxmleditorconstants.h"
#include "scxmleditortr.h"
#include "scxmltagutils.h"
#include "serializer.h"
#include <utils/qtcassert.h>
@@ -55,20 +56,20 @@ void createChildMenu(const ScxmlTag *tag, QMenu *menu, bool addRemove)
if (tag->tagType() == UnknownTag) {
data[Constants::C_SCXMLTAG_TAGTYPE] = UnknownTag;
menu->addAction(ScxmlTag::tr("New Tag"))->setData(data);
menu->addAction(Tr::tr("New Tag"))->setData(data);
} else if (tag->tagType() == Metadata) {
data[Constants::C_SCXMLTAG_TAGTYPE] = MetadataItem;
menu->addAction(ScxmlTag::tr("Item"))->setData(data);
menu->addAction(Tr::tr("Item"))->setData(data);
} else {
data[Constants::C_SCXMLTAG_PARENTTAG] = Metadata;
data[Constants::C_SCXMLTAG_TAGTYPE] = MetadataItem;
menu->addAction(ScxmlTag::tr("Metadata"))->setData(data);
menu->addAction(Tr::tr("Metadata"))->setData(data);
}
if (addRemove) {
menu->addSeparator();
data[Constants::C_SCXMLTAG_ACTIONTYPE] = Remove;
QAction *act = menu->addAction(ScxmlTag::tr("Remove"));
QAction *act = menu->addAction(Tr::tr("Remove"));
act->setData(data);
act->setEnabled(!tag->isRootTag());
}

View File

@@ -1,9 +1,10 @@
// Copyright (C) 2016 The Qt Company Ltd.
// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0+ OR GPL-3.0 WITH Qt-GPL-exception-1.0
#include "scxmluifactory.h"
#include "genericscxmlplugin.h"
#include "isceditor.h"
#include "scxmleditortr.h"
#include "scxmluifactory.h"
#include <QCoreApplication>
#include <QDebug>
@@ -90,10 +91,10 @@ void ScxmlUiFactory::initPlugins()
if (instance) {
auto scEditorInstance = qobject_cast<ISCEditor*>(instance);
if (scEditorInstance) {
qDebug() << tr("Created editor-instance.");
qDebug() << Tr::tr("Created editor-instance.");
m_plugins << scEditorInstance;
} else {
qWarning() << tr("Editor-instance is not of the type ISCEditor.");
qWarning() << Tr::tr("Editor-instance is not of the type ISCEditor.");
loader.unload();
}
}

View File

@@ -1,7 +1,6 @@
// Copyright (C) 2016 The Qt Company Ltd.
// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0+ OR GPL-3.0 WITH Qt-GPL-exception-1.0
#include "stateitem.h"
#include "finalstateitem.h"
#include "graphicsitemprovider.h"
#include "graphicsscene.h"
@@ -11,8 +10,10 @@
#include "parallelitem.h"
#include "sceneutils.h"
#include "scxmleditorconstants.h"
#include "scxmleditortr.h"
#include "scxmltagutils.h"
#include "scxmluifactory.h"
#include "stateitem.h"
#include "statewarningitem.h"
#include "textitem.h"
#include "transitionitem.h"
@@ -279,15 +280,15 @@ void StateItem::createContextMenu(QMenu *menu)
QVariantMap data;
if (!m_parallelState) {
data[Constants::C_SCXMLTAG_ACTIONTYPE] = TagUtils::SetAsInitial;
menu->addAction(tr("Set as Initial"))->setData(data);
menu->addAction(Tr::tr("Set as Initial"))->setData(data);
}
data[Constants::C_SCXMLTAG_ACTIONTYPE] = TagUtils::ZoomToState;
menu->addAction(tr("Zoom to State"))->setData(data);
menu->addAction(Tr::tr("Zoom to State"))->setData(data);
if (type() == ParallelType) {
data[Constants::C_SCXMLTAG_ACTIONTYPE] = TagUtils::Relayout;
menu->addAction(tr("Re-Layout"))->setData(data);
menu->addAction(Tr::tr("Re-Layout"))->setData(data);
}
menu->addSeparator();
@@ -310,7 +311,7 @@ void StateItem::selectedMenuAction(const QAction *action)
case TagUtils::SetAsInitial: {
ScxmlTag *parentTag = tag->parentTag();
if (parentTag) {
document->undoStack()->beginMacro(tr("Change initial state"));
document->undoStack()->beginMacro(Tr::tr("Change initial state"));
ScxmlTag *initialTag = parentTag->child("initial");
if (initialTag) {
@@ -331,7 +332,7 @@ void StateItem::selectedMenuAction(const QAction *action)
break;
}
case TagUtils::Relayout: {
document->undoStack()->beginMacro(tr("Re-Layout"));
document->undoStack()->beginMacro(Tr::tr("Re-Layout"));
doLayout(depth());
document->undoStack()->endMacro();
break;

View File

@@ -1,8 +1,9 @@
// Copyright (C) 2016 The Qt Company Ltd.
// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0+ OR GPL-3.0 WITH Qt-GPL-exception-1.0
#include "statewarningitem.h"
#include "idwarningitem.h"
#include "scxmleditortr.h"
#include "statewarningitem.h"
#include <utils/utilsicons.h>
@@ -12,11 +13,11 @@ StateWarningItem::StateWarningItem(StateItem *parent)
: WarningItem(parent)
{
setSeverity(OutputPane::Warning::InfoType);
setTypeName(tr("State"));
setDescription(tr("Draw some transitions to state."));
setTypeName(Tr::tr("State"));
setDescription(Tr::tr("Draw some transitions to state."));
setPixmap(Utils::Icons::WARNING.pixmap());
setReason(tr("No input connection."));
setReason(Tr::tr("No input connection."));
}
void StateWarningItem::setIdWarning(IdWarningItem *idwarning)
@@ -34,16 +35,16 @@ void StateWarningItem::check()
bool inputProblem = !m_parentItem->isInitial() && !m_parentItem->hasInputTransitions(m_parentItem, true);
if (outputProblem && inputProblem) {
setReason(tr("No input or output connections (%1).").arg(m_parentItem->itemId()));
setDescription(tr("Draw some transitions to or from state."));
setReason(Tr::tr("No input or output connections (%1).").arg(m_parentItem->itemId()));
setDescription(Tr::tr("Draw some transitions to or from state."));
setWarningActive(true);
} else if (outputProblem) {
setReason(tr("No output connections (%1).").arg(m_parentItem->itemId()));
setDescription(tr("Draw some transitions from state."));
setReason(Tr::tr("No output connections (%1).").arg(m_parentItem->itemId()));
setDescription(Tr::tr("Draw some transitions from state."));
setWarningActive(true);
} else if (inputProblem) {
setReason(tr("No input connections (%1).").arg(m_parentItem->itemId()));
setDescription(tr("Draw some transitions to state."));
setReason(Tr::tr("No input connections (%1).").arg(m_parentItem->itemId()));
setDescription(Tr::tr("Draw some transitions to state."));
setWarningActive(true);
} else
setWarningActive(false);

View File

@@ -1,7 +1,6 @@
// Copyright (C) 2016 The Qt Company Ltd.
// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0+ OR GPL-3.0 WITH Qt-GPL-exception-1.0
#include "transitionitem.h"
#include "connectableitem.h"
#include "cornergrabberitem.h"
#include "finalstateitem.h"
@@ -11,11 +10,13 @@
#include "sceneutils.h"
#include "scxmldocument.h"
#include "scxmleditorconstants.h"
#include "scxmleditortr.h"
#include "scxmltagutils.h"
#include "scxmluifactory.h"
#include "serializer.h"
#include "stateitem.h"
#include "tagtextitem.h"
#include "transitionitem.h"
#include <QBrush>
#include <QDebug>
@@ -395,7 +396,7 @@ void TransitionItem::createContextMenu(QMenu *menu)
if (m_selectedGrabberIndex > 0) {
data[Constants::C_SCXMLTAG_ACTIONTYPE] = TagUtils::RemovePoint;
data["cornerIndex"] = m_selectedGrabberIndex;
menu->addAction(tr("Remove Point"))->setData(data);
menu->addAction(Tr::tr("Remove Point"))->setData(data);
}
menu->addSeparator();

View File

@@ -1,8 +1,9 @@
// Copyright (C) 2016 The Qt Company Ltd.
// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0+ OR GPL-3.0 WITH Qt-GPL-exception-1.0
#include "transitionwarningitem.h"
#include "scxmleditortr.h"
#include "transitionitem.h"
#include "transitionwarningitem.h"
#include <utils/utilsicons.h>
@@ -13,8 +14,8 @@ TransitionWarningItem::TransitionWarningItem(TransitionItem *parent)
, m_parentItem(parent)
{
setSeverity(OutputPane::Warning::WarningType);
setTypeName(tr("Transition"));
setDescription(tr("Transitions should be connected."));
setTypeName(Tr::tr("Transition"));
setDescription(Tr::tr("Transitions should be connected."));
setPixmap(Utils::Icons::WARNING.pixmap());
}
@@ -23,7 +24,7 @@ void TransitionWarningItem::check()
{
if (m_parentItem) {
if (m_parentItem->targetType() == TransitionItem::ExternalNoTarget) {
setReason(tr("Not connected (%1).").arg(m_parentItem->tagValue("event")));
setReason(Tr::tr("Not connected (%1).").arg(m_parentItem->tagValue("event")));
setWarningActive(true);
} else
setWarningActive(false);