CSceneViewport: Mark strings as translatable where applicable

This commit is contained in:
Lioncash 2020-06-28 05:47:46 -04:00
parent 38cdcbdbd3
commit 576447aa39
1 changed files with 23 additions and 21 deletions

View File

@ -164,40 +164,40 @@ void CSceneViewport::CreateContextMenu()
mpContextMenu = new QMenu(this); mpContextMenu = new QMenu(this);
// Main context menu // Main context menu
mpToggleSelectAction = new QAction("ToggleSelect", this); mpToggleSelectAction = new QAction(tr("ToggleSelect"), this);
connect(mpToggleSelectAction, SIGNAL(triggered()), this, SLOT(OnToggleSelect())); connect(mpToggleSelectAction, SIGNAL(triggered()), this, SLOT(OnToggleSelect()));
mpHideSelectionSeparator = new QAction(this); mpHideSelectionSeparator = new QAction(this);
mpHideSelectionSeparator->setSeparator(true); mpHideSelectionSeparator->setSeparator(true);
mpHideSelectionAction = new QAction("Hide selection", this); mpHideSelectionAction = new QAction(tr("Hide selection"), this);
connect(mpHideSelectionAction, SIGNAL(triggered()), this, SLOT(OnHideSelection())); connect(mpHideSelectionAction, SIGNAL(triggered()), this, SLOT(OnHideSelection()));
mpHideUnselectedAction = new QAction("Hide unselected", this); mpHideUnselectedAction = new QAction(tr("Hide unselected"), this);
connect(mpHideUnselectedAction, SIGNAL(triggered()), this, SLOT(OnHideUnselected())); connect(mpHideUnselectedAction, SIGNAL(triggered()), this, SLOT(OnHideUnselected()));
mpHideHoverSeparator = new QAction(this); mpHideHoverSeparator = new QAction(this);
mpHideHoverSeparator->setSeparator(true); mpHideHoverSeparator->setSeparator(true);
mpHideHoverNodeAction = new QAction("HideNode", this); mpHideHoverNodeAction = new QAction(tr("HideNode"), this);
connect(mpHideHoverNodeAction, SIGNAL(triggered()), this, SLOT(OnHideNode())); connect(mpHideHoverNodeAction, SIGNAL(triggered()), this, SLOT(OnHideNode()));
mpHideHoverTypeAction = new QAction("HideType", this); mpHideHoverTypeAction = new QAction(tr("HideType"), this);
connect(mpHideHoverTypeAction, SIGNAL(triggered()), this, SLOT(OnHideType())); connect(mpHideHoverTypeAction, SIGNAL(triggered()), this, SLOT(OnHideType()));
mpHideHoverLayerAction = new QAction("HideLayer", this); mpHideHoverLayerAction = new QAction(tr("HideLayer"), this);
connect(mpHideHoverLayerAction, SIGNAL(triggered()), this, SLOT(OnHideLayer())); connect(mpHideHoverLayerAction, SIGNAL(triggered()), this, SLOT(OnHideLayer()));
mpUnhideSeparator = new QAction(this); mpUnhideSeparator = new QAction(this);
mpUnhideSeparator->setSeparator(true); mpUnhideSeparator->setSeparator(true);
mpUnhideAllAction = new QAction("Unhide all", this); mpUnhideAllAction = new QAction(tr("Unhide all"), this);
connect(mpUnhideAllAction, SIGNAL(triggered()), this, SLOT(OnUnhideAll())); connect(mpUnhideAllAction, SIGNAL(triggered()), this, SLOT(OnUnhideAll()));
mpPlayFromHereSeparator = new QAction(this); mpPlayFromHereSeparator = new QAction(this);
mpPlayFromHereSeparator->setSeparator(true); mpPlayFromHereSeparator->setSeparator(true);
mpPlayFromHereAction = new QAction("Play from here", this); mpPlayFromHereAction = new QAction(tr("Play from here"), this);
connect(mpPlayFromHereAction, SIGNAL(triggered()), this, SLOT(OnPlayFromHere())); connect(mpPlayFromHereAction, SIGNAL(triggered()), this, SLOT(OnPlayFromHere()));
QList<QAction*> Actions; QList<QAction*> Actions;
@ -209,15 +209,15 @@ void CSceneViewport::CreateContextMenu()
mpContextMenu->addActions(Actions); mpContextMenu->addActions(Actions);
// Select Connected menu // Select Connected menu
mpSelectConnectedMenu = new QMenu("Select connected...", this); mpSelectConnectedMenu = new QMenu(tr("Select connected..."), this);
mpSelectConnectedOutgoingAction = new QAction("...via outgoing links", this); mpSelectConnectedOutgoingAction = new QAction(tr("...via outgoing links"), this);
connect(mpSelectConnectedOutgoingAction, SIGNAL(triggered()), this, SLOT(OnSelectConnected())); connect(mpSelectConnectedOutgoingAction, SIGNAL(triggered()), this, SLOT(OnSelectConnected()));
mpSelectConnectedIncomingAction = new QAction("...via incoming links", this); mpSelectConnectedIncomingAction = new QAction(tr("...via incoming links"), this);
connect(mpSelectConnectedIncomingAction, SIGNAL(triggered()), this, SLOT(OnSelectConnected())); connect(mpSelectConnectedIncomingAction, SIGNAL(triggered()), this, SLOT(OnSelectConnected()));
mpSelectConnectedAllAction = new QAction("...via all links", this); mpSelectConnectedAllAction = new QAction(tr("...via all links"), this);
connect(mpSelectConnectedAllAction, SIGNAL(triggered()), this, SLOT(OnSelectConnected())); connect(mpSelectConnectedAllAction, SIGNAL(triggered()), this, SLOT(OnSelectConnected()));
QList<QAction*> SelectConnectedActions; QList<QAction*> SelectConnectedActions;
@ -359,23 +359,23 @@ void CSceneViewport::ContextMenu(QContextMenuEvent *pEvent)
TString Name = IsScriptNode ? static_cast<CScriptNode*>(mpHoverNode)->Instance()->InstanceName() : mpHoverNode->Name(); TString Name = IsScriptNode ? static_cast<CScriptNode*>(mpHoverNode)->Instance()->InstanceName() : mpHoverNode->Name();
if (mpHoverNode->IsSelected()) if (mpHoverNode->IsSelected())
mpToggleSelectAction->setText(QString("Deselect %1").arg(TO_QSTRING(Name))); mpToggleSelectAction->setText(tr("Deselect %1").arg(TO_QSTRING(Name)));
else else
mpToggleSelectAction->setText(QString("Select %1").arg(TO_QSTRING(Name))); mpToggleSelectAction->setText(tr("Select %1").arg(TO_QSTRING(Name)));
} }
if (IsScriptNode) if (IsScriptNode)
{ {
CScriptNode *pScript = static_cast<CScriptNode*>(mpHoverNode); CScriptNode *pScript = static_cast<CScriptNode*>(mpHoverNode);
NodeName = pScript->Instance()->InstanceName(); NodeName = pScript->Instance()->InstanceName();
mpHideHoverTypeAction->setText( QString("Hide all %1 objects").arg(TO_QSTRING(pScript->Template()->Name())) ); mpHideHoverTypeAction->setText(tr("Hide all %1 objects").arg(TO_QSTRING(pScript->Template()->Name())));
mpHideHoverLayerAction->setText( QString("Hide layer %1").arg(TO_QSTRING(pScript->Instance()->Layer()->Name())) ); mpHideHoverLayerAction->setText(tr("Hide layer %1").arg(TO_QSTRING(pScript->Instance()->Layer()->Name())));
} }
else if (HasHoverNode) else if (HasHoverNode)
NodeName = mpHoverNode->Name(); NodeName = mpHoverNode->Name();
mpHideHoverNodeAction->setText(QString("Hide %1").arg(TO_QSTRING(NodeName))); mpHideHoverNodeAction->setText(tr("Hide %1").arg(TO_QSTRING(NodeName)));
// Show menu // Show menu
mpMenuNode = mpHoverNode; mpMenuNode = mpHoverNode;
@ -441,8 +441,8 @@ void CSceneViewport::OnSelectConnected()
foreach (uint32 ID, InstanceIDs) foreach (uint32 ID, InstanceIDs)
Nodes << mpScene->NodeForInstanceID(ID); Nodes << mpScene->NodeForInstanceID(ID);
bool ShouldClear = ((qApp->keyboardModifiers() & Qt::ControlModifier) == 0); const bool ShouldClear = ((qApp->keyboardModifiers() & Qt::ControlModifier) == 0);
mpEditor->BatchSelectNodes(Nodes, ShouldClear, "Select Connected"); mpEditor->BatchSelectNodes(Nodes, ShouldClear, tr("Select Connected"));
} }
void CSceneViewport::OnHideSelection() void CSceneViewport::OnHideSelection()
@ -482,15 +482,17 @@ void CSceneViewport::OnUnhideAll()
if (!it->IsVisible()) if (!it->IsVisible())
{ {
if (it->NodeType() == ENodeType::Light) if (it->NodeType() == ENodeType::Light)
{
it->SetVisible(true); it->SetVisible(true);
}
else else
{ {
CScriptNode *pScript = static_cast<CScriptNode*>(*it); CScriptNode *pScript = static_cast<CScriptNode*>(*it);
if (!pScript->MarkedVisible()) if (!pScript->MarkedVisible())
{
pScript->SetVisible(true); pScript->SetVisible(true);
}
else else
{ {
pScript->Template()->SetVisible(true); pScript->Template()->SetVisible(true);