CCharacterEditor: Make strings localizable

This commit is contained in:
Lioncash 2020-06-28 02:30:08 -04:00
parent 4a9695a698
commit 1266b9f041
1 changed files with 11 additions and 8 deletions

View File

@ -278,10 +278,10 @@ void CCharacterEditor::RefreshViewport()
void CCharacterEditor::OnViewportHoverBoneChanged(uint32 BoneID) void CCharacterEditor::OnViewportHoverBoneChanged(uint32 BoneID)
{ {
if (BoneID == 0xFFFFFFFF) if (BoneID == UINT32_MAX)
ui->StatusBar->clearMessage(); ui->StatusBar->clearMessage();
else else
ui->StatusBar->showMessage(QString("Bone %1: %2").arg(BoneID).arg( TO_QSTRING(mpSet->Character(mCurrentChar)->pSkeleton->BoneByID(BoneID)->Name()) )); ui->StatusBar->showMessage(tr("Bone %1: %2").arg(BoneID).arg(TO_QSTRING(mpSet->Character(mCurrentChar)->pSkeleton->BoneByID(BoneID)->Name())));
} }
void CCharacterEditor::OnViewportClick() void CCharacterEditor::OnViewportClick()
@ -298,7 +298,9 @@ void CCharacterEditor::OnViewportClick()
ui->SkeletonHierarchyTreeView->selectionModel()->setCurrentIndex(NewBoneIndex, QItemSelectionModel::ClearAndSelect); ui->SkeletonHierarchyTreeView->selectionModel()->setCurrentIndex(NewBoneIndex, QItemSelectionModel::ClearAndSelect);
} }
else else
{
ui->SkeletonHierarchyTreeView->selectionModel()->clear(); ui->SkeletonHierarchyTreeView->selectionModel()->clear();
}
SetSelectedBone(pBone); SetSelectedBone(pBone);
} }
@ -373,19 +375,20 @@ void CCharacterEditor::SetAnimTime(float Time)
CurKey = Math::Min<uint32>((uint32) (Time / pAnim->TickInterval()) + 1, NumKeys - 1); CurKey = Math::Min<uint32>((uint32) (Time / pAnim->TickInterval()) + 1, NumKeys - 1);
} }
ui->FrameLabel->setText(QString("Frame %1 / %2 (%3s/%4s)").arg(CurKey).arg(NumKeys - 1).arg(mAnimTime, 0, 'f', 3).arg(pAnim ? pAnim->Duration() : 0.f, 0, 'f', 3)); ui->FrameLabel->setText(tr("Frame %1 / %2 (%3s/%4s)").arg(CurKey).arg(NumKeys - 1).arg(mAnimTime, 0, 'f', 3).arg(pAnim ? pAnim->Duration() : 0.f, 0, 'f', 3));
} }
void CCharacterEditor::TogglePlay() void CCharacterEditor::TogglePlay()
{ {
if (mBindPose) ToggleBindPose(false); if (mBindPose)
ToggleBindPose(false);
mPlayAnim = !mPlayAnim; mPlayAnim = !mPlayAnim;
QString NewText = (mPlayAnim ? "Pause" : "Play"); const QString NewText = (mPlayAnim ? tr("Pause") : tr("Play"));
ui->PlayPauseButton->setToolTip(NewText); ui->PlayPauseButton->setToolTip(NewText);
ui->ActionPlay->setText(NewText); ui->ActionPlay->setText(NewText);
QIcon PlayPauseIcon = QIcon(mPlayAnim ? ":/icons/Pause_24px.svg" : ":/icons/Play_24px.svg"); const QIcon PlayPauseIcon = QIcon(mPlayAnim ? QStringLiteral(":/icons/Pause_24px.svg") : QStringLiteral(":/icons/Play_24px.svg"));
ui->PlayPauseButton->setIcon(PlayPauseIcon); ui->PlayPauseButton->setIcon(PlayPauseIcon);
if (ui->ActionPlay != sender()) if (ui->ActionPlay != sender())
@ -410,11 +413,11 @@ void CCharacterEditor::ToggleLoop(bool Loop)
{ {
mLoopAnim = Loop; mLoopAnim = Loop;
QString NewText = (Loop ? "Disable Loop" : "Loop"); const QString NewText = (Loop ? tr("Disable Loop") : tr("Loop"));
ui->LoopButton->setToolTip(NewText); ui->LoopButton->setToolTip(NewText);
ui->ActionLoop->setText(NewText); ui->ActionLoop->setText(NewText);
QIcon ActionIcon = QIcon(Loop ? ":/icons/DontLoop_24px" : ":/icons/Loop_24px.svg"); const QIcon ActionIcon = QIcon(Loop ? QStringLiteral(":/icons/DontLoop_24px") : QStringLiteral(":/icons/Loop_24px.svg"));
ui->ActionLoop->setIcon(ActionIcon); ui->ActionLoop->setIcon(ActionIcon);
if (sender() != ui->LoopButton) if (sender() != ui->LoopButton)