Browse Source

Show torrent name in "preview file" related dialogs

adaptive-webui-19844
Chocobo1 5 years ago
parent
commit
7f73a71319
No known key found for this signature in database
GPG Key ID: 210D9C873253A68C
  1. 6
      src/gui/previewselectdialog.cpp
  2. 3
      src/gui/previewselectdialog.ui
  3. 3
      src/gui/transferlistwidget.cpp

6
src/gui/previewselectdialog.cpp

@ -54,6 +54,9 @@ PreviewSelectDialog::PreviewSelectDialog(QWidget *parent, const BitTorrent::Torr @@ -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() @@ -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;

3
src/gui/previewselectdialog.ui

@ -16,9 +16,6 @@ @@ -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>

3
src/gui/transferlistwidget.cpp

@ -509,7 +509,8 @@ void TransferListWidget::previewSelectedTorrents() @@ -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()));
}
}
}

Loading…
Cancel
Save