diff --git a/src/gui/optionsdialog.h b/src/gui/optionsdialog.h
index 2f0362fb9..14fc61c07 100644
--- a/src/gui/optionsdialog.h
+++ b/src/gui/optionsdialog.h
@@ -42,6 +42,7 @@ enum DoubleClickAction
{
TOGGLE_PAUSE,
OPEN_DEST,
+ PREVIEW_FILE,
NO_ACTION
};
diff --git a/src/gui/optionsdialog.ui b/src/gui/optionsdialog.ui
index 1527434cc..3ede266bf 100644
--- a/src/gui/optionsdialog.ui
+++ b/src/gui/optionsdialog.ui
@@ -330,6 +330,11 @@
Open destination folder
+ -
+
+ Preview file, otherwise open destination folder
+
+
-
No action
diff --git a/src/gui/transferlistwidget.cpp b/src/gui/transferlistwidget.cpp
index eb306a9f3..18fe680ed 100644
--- a/src/gui/transferlistwidget.cpp
+++ b/src/gui/transferlistwidget.cpp
@@ -98,6 +98,18 @@ namespace
return false;
}
+ void openDestinationFolder(const BitTorrent::TorrentHandle *const torrent)
+ {
+#ifdef Q_OS_MACOS
+ MacUtils::openFiles(QSet{torrent->contentPath(true)});
+#else
+ if (torrent->filesCount() == 1)
+ Utils::Gui::openFolderSelect(torrent->contentPath(true));
+ else
+ Utils::Gui::openPath(torrent->contentPath(true));
+#endif
+ }
+
void removeTorrents(const QVector &torrents, const bool isDeleteFileSelected)
{
auto *session = BitTorrent::Session::instance();
@@ -269,15 +281,19 @@ void TransferListWidget::torrentDoubleClicked()
else
torrent->pause();
break;
+ case PREVIEW_FILE:
+ if (torrentContainsPreviewableFiles(torrent)) {
+ auto *dialog = new PreviewSelectDialog(this, torrent);
+ dialog->setAttribute(Qt::WA_DeleteOnClose);
+ connect(dialog, &PreviewSelectDialog::readyToPreviewFile, this, &TransferListWidget::previewFile);
+ dialog->show();
+ }
+ else {
+ openDestinationFolder(torrent);
+ }
+ break;
case OPEN_DEST:
-#ifdef Q_OS_MACOS
- MacUtils::openFiles(QSet{torrent->contentPath(true)});
-#else
- if (torrent->filesCount() == 1)
- Utils::Gui::openFolderSelect(torrent->contentPath(true));
- else
- Utils::Gui::openPath(torrent->contentPath(true));
-#endif
+ openDestinationFolder(torrent);
break;
}
}