Show torrent name in "preview file" related dialogs

This commit is contained in:
Chocobo1 2019-10-02 21:02:05 +08:00
parent 6a462edb72
commit 7f73a71319
No known key found for this signature in database
GPG key ID: 210D9C873253A68C
3 changed files with 7 additions and 5 deletions

View file

@ -54,6 +54,9 @@ PreviewSelectDialog::PreviewSelectDialog(QWidget *parent, const BitTorrent::Torr
{
m_ui->setupUi(this);
m_ui->label->setText(tr("The following files from torrent \"%1\" support previewing, please select one of them:")
.arg(m_torrent->name()));
m_ui->buttonBox->button(QDialogButtonBox::Ok)->setText(tr("Preview"));
connect(m_ui->buttonBox, &QDialogButtonBox::accepted, this, &PreviewSelectDialog::previewButtonClicked);
connect(m_ui->buttonBox, &QDialogButtonBox::rejected, this, &QDialog::reject);
@ -125,7 +128,8 @@ void PreviewSelectDialog::previewButtonClicked()
if (!QFile::exists(path)) {
const bool isSingleFile = (m_previewListModel->rowCount() == 1);
QWidget *parent = isSingleFile ? this->parentWidget() : this;
QMessageBox::critical(parent, tr("Preview impossible"), tr("Sorry, we can't preview this file"));
QMessageBox::critical(parent, tr("Preview impossible")
, tr("Sorry, we can't preview this file: \"%1\".").arg(Utils::Fs::toNativePath(path)));
if (isSingleFile)
reject();
return;

View file

@ -16,9 +16,6 @@
<layout class="QVBoxLayout">
<item>
<widget class="QLabel" name="label">
<property name="text">
<string>The following files support previewing, please select one of them:</string>
</property>
<property name="wordWrap">
<bool>true</bool>
</property>

View file

@ -509,7 +509,8 @@ void TransferListWidget::previewSelectedTorrents()
dialog->show();
}
else {
QMessageBox::critical(this, tr("Unable to preview"), tr("The selected torrent does not contain previewable files"));
QMessageBox::critical(this, tr("Unable to preview"), tr("The selected torrent \"%1\" does not contain previewable files")
.arg(torrent->name()));
}
}
}