Made shortcuts translatable.

This commit is contained in:
leo 2016-06-12 23:05:26 +00:00
parent 962f904939
commit df0e7cc221
6 changed files with 225 additions and 228 deletions

File diff suppressed because it is too large Load diff

View file

@ -243,6 +243,6 @@ enum lcTool
LC_NUM_TOOLS
};
extern QString gToolNames[LC_NUM_TOOLS];
extern const char* gToolNames[LC_NUM_TOOLS];
#endif // _LC_COMMANDS_H_

View file

@ -1598,10 +1598,7 @@ void lcMainWindow::UpdateSelectedObjects(bool SelectionChanged)
}
else if (Selection.GetSize() > 0)
{
if (Selection.GetSize() == 1)
Message = tr("1 Object selected");
else
Message = tr("%1 Objects selected").arg(QString::number(Selection.GetSize()));
Message = tr("%n Object(s) selected", "", Selection.GetSize());
if (Focus && Focus->IsPiece())
{

View file

@ -153,7 +153,7 @@ bool lcMouseShortcuts::Save(QStringList& Shortcuts)
continue;
QString Shortcut = QKeySequence(mShortcuts[ToolIdx].Modifiers | (Qt::Key_0 + ButtonIndex)).toString(QKeySequence::PortableText);
Shortcuts << gToolNames[ToolIdx] + QLatin1String("=") + Shortcut;
Shortcuts << QString::fromLatin1(gToolNames[ToolIdx]) + QLatin1String("=") + Shortcut;
}
return true;
@ -174,7 +174,7 @@ bool lcMouseShortcuts::Load(const QStringList& Shortcuts)
int ToolIdx;
for (ToolIdx = 0; ToolIdx < LC_NUM_TOOLS; ToolIdx++)
if (gToolNames[ToolIdx] == Key)
if (Key == gToolNames[ToolIdx])
break;
if (ToolIdx == LC_NUM_TOOLS)

View file

@ -46,7 +46,7 @@
<item>
<widget class="QLabel" name="label_4">
<property name="text">
<string>LeoCAD is a free application that can be used to create virtual LEGO models.</string>
<string>LeoCAD is a free application for creating virtual LEGO models.</string>
</property>
<property name="wordWrap">
<bool>true</bool>

View file

@ -440,7 +440,7 @@ void lcQPreferencesDialog::updateCommandList()
for (int actionIdx = 0; actionIdx < LC_NUM_COMMANDS; actionIdx++)
{
const QString identifier = gCommands[actionIdx].ID;
const QString identifier = tr(gCommands[actionIdx].ID);
int pos = identifier.indexOf(QLatin1Char('.'));
int subPos = identifier.indexOf(QLatin1Char('.'), pos + 1);
@ -633,7 +633,7 @@ void lcQPreferencesDialog::UpdateMouseTreeItem(int ItemIndex)
if (Item)
Item->setText(1, Shortcut);
else
new QTreeWidgetItem(ui->mouseTree, QStringList() << gToolNames[ItemIndex] << Shortcut);
new QTreeWidgetItem(ui->mouseTree, QStringList() << tr(gToolNames[ItemIndex]) << Shortcut);
}
void lcQPreferencesDialog::on_mouseAssign_clicked()
@ -677,7 +677,7 @@ void lcQPreferencesDialog::on_mouseAssign_clicked()
{
if (ToolIdx != ButtonIndex && options->MouseShortcuts.mShortcuts[ToolIdx].Button == Button && options->MouseShortcuts.mShortcuts[ToolIdx].Modifiers == Modifiers)
{
if (QMessageBox::question(this, tr("Override Shortcut"), tr("This shortcut is already assigned to '%1', do you want to replace it?").arg(gToolNames[ToolIdx]), QMessageBox::Yes | QMessageBox::No) == QMessageBox::No)
if (QMessageBox::question(this, tr("Override Shortcut"), tr("This shortcut is already assigned to '%1', do you want to replace it?").arg(tr(gToolNames[ToolIdx])), QMessageBox::Yes | QMessageBox::No) == QMessageBox::No)
return;
options->MouseShortcuts.mShortcuts[ToolIdx].Button = Qt::NoButton;