mirror of
https://github.com/d47081/qBittorrent.git
synced 2025-01-11 07:18:08 +00:00
Add "Preview file" double-click action
This commit is contained in:
parent
d12468ffb5
commit
74009f13d9
@ -42,6 +42,7 @@ enum DoubleClickAction
|
|||||||
{
|
{
|
||||||
TOGGLE_PAUSE,
|
TOGGLE_PAUSE,
|
||||||
OPEN_DEST,
|
OPEN_DEST,
|
||||||
|
PREVIEW_FILE,
|
||||||
NO_ACTION
|
NO_ACTION
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -330,6 +330,11 @@
|
|||||||
<string>Open destination folder</string>
|
<string>Open destination folder</string>
|
||||||
</property>
|
</property>
|
||||||
</item>
|
</item>
|
||||||
|
<item>
|
||||||
|
<property name="text">
|
||||||
|
<string>Preview file, otherwise open destination folder</string>
|
||||||
|
</property>
|
||||||
|
</item>
|
||||||
<item>
|
<item>
|
||||||
<property name="text">
|
<property name="text">
|
||||||
<string>No action</string>
|
<string>No action</string>
|
||||||
|
@ -98,6 +98,18 @@ namespace
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void openDestinationFolder(const BitTorrent::TorrentHandle *const torrent)
|
||||||
|
{
|
||||||
|
#ifdef Q_OS_MACOS
|
||||||
|
MacUtils::openFiles(QSet<QString>{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<BitTorrent::TorrentHandle *> &torrents, const bool isDeleteFileSelected)
|
void removeTorrents(const QVector<BitTorrent::TorrentHandle *> &torrents, const bool isDeleteFileSelected)
|
||||||
{
|
{
|
||||||
auto *session = BitTorrent::Session::instance();
|
auto *session = BitTorrent::Session::instance();
|
||||||
@ -269,15 +281,19 @@ void TransferListWidget::torrentDoubleClicked()
|
|||||||
else
|
else
|
||||||
torrent->pause();
|
torrent->pause();
|
||||||
break;
|
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:
|
case OPEN_DEST:
|
||||||
#ifdef Q_OS_MACOS
|
openDestinationFolder(torrent);
|
||||||
MacUtils::openFiles(QSet<QString>{torrent->contentPath(true)});
|
|
||||||
#else
|
|
||||||
if (torrent->filesCount() == 1)
|
|
||||||
Utils::Gui::openFolderSelect(torrent->contentPath(true));
|
|
||||||
else
|
|
||||||
Utils::Gui::openPath(torrent->contentPath(true));
|
|
||||||
#endif
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user