Qt: add translation to save manager messageboxes

This commit is contained in:
Megamouse 2018-02-10 15:00:06 +01:00 committed by Ivan
parent bda466c3bd
commit b60f29282a

View File

@ -249,7 +249,7 @@ void save_manager_dialog::OnEntryRemove()
if (idx != -1)
{
int idx_real = m_list->item(idx, 0)->data(Qt::UserRole).toInt();
if (QMessageBox::question(this, "Delete Confirmation", "Are you sure you want to delete:\n" + qstr(m_save_entries[idx_real].title) + "?", QMessageBox::Yes, QMessageBox::No) == QMessageBox::Yes)
if (QMessageBox::question(this, tr("Delete Confirmation"), tr("Are you sure you want to delete:\n%1?").arg(qstr(m_save_entries[idx_real].title)), QMessageBox::Yes, QMessageBox::No) == QMessageBox::Yes)
{
fs::remove_all(m_dir + m_save_entries[idx_real].dirName + "/");
m_list->removeRow(idx);
@ -271,8 +271,7 @@ void save_manager_dialog::OnEntriesRemove()
return;
}
if (QMessageBox::question(this, "Delete Confirmation", QString("Are you sure you want to delete these %1 items?").arg(selection.size())
, QMessageBox::Yes, QMessageBox::No) == QMessageBox::Yes)
if (QMessageBox::question(this, tr("Delete Confirmation"), tr("Are you sure you want to delete these %1 items?").arg(selection.size()), QMessageBox::Yes, QMessageBox::No) == QMessageBox::Yes)
{
qSort(selection.begin(), selection.end(), qGreater<QModelIndex>());
for (QModelIndex index : selection)
@ -325,7 +324,8 @@ void save_manager_dialog::ShowContextMenu(const QPoint &pos)
// Events
connect(removeAct, &QAction::triggered, this, &save_manager_dialog::OnEntriesRemove); // entriesremove handles case of one as well
connect(infoAct, &QAction::triggered, this, &save_manager_dialog::OnEntryInfo);
connect(showDirAct, &QAction::triggered, [=]() {
connect(showDirAct, &QAction::triggered, [=]()
{
int idx_real = m_list->item(idx, 0)->data(Qt::UserRole).toInt();
QString path = qstr(m_dir + m_save_entries[idx_real].dirName + "/");
QDesktopServices::openUrl(QUrl("file:///" + path));