Browse Source

FEATURE: Several torrents can be moved at once

adaptive-webui-19844
Christophe Dumez 15 years ago
parent
commit
c09294df2f
  1. 1
      Changelog
  2. 38
      src/transferlistwidget.cpp
  3. 1
      src/transferlistwidget.h

1
Changelog

@ -6,6 +6,7 @@ @@ -6,6 +6,7 @@
- FEATURE: Added cookie support for RSS feeds
- FEATURE: User can force tracker reannounce
- FEATURE: Added "No action" setting for double-click action
- FEATURE: Several torrents can be moved at once
- COSMETIC: Display peers country name in tooltip
* Sun Mar 14 2010 - Christophe Dumez <chris@qbittorrent.org> - v2.2.0

38
src/transferlistwidget.cpp

@ -49,6 +49,7 @@ @@ -49,6 +49,7 @@
#include <QUrl>
#include <QMenu>
#include <QRegExp>
#include <QFileDialog>
#include <vector>
TransferListWidget::TransferListWidget(QWidget *parent, GUI *main_window, Bittorrent *_BTSession):
@ -602,6 +603,34 @@ QStringList TransferListWidget::getSelectedTorrentsHashes() const { @@ -602,6 +603,34 @@ QStringList TransferListWidget::getSelectedTorrentsHashes() const {
return hashes;
}
void TransferListWidget::setSelectedTorrentsLocation() {
const QStringList &hashes = getSelectedTorrentsHashes();
if(hashes.isEmpty()) return;
QString dir;
const QDir saveDir(BTSession->getTorrentHandle(hashes.first()).save_path());
if(saveDir.exists()){
dir = QFileDialog::getExistingDirectory(this, tr("Choose save path"), saveDir.path());
}else{
dir = QFileDialog::getExistingDirectory(this, tr("Choose save path"), QDir::homePath());
}
if(!dir.isNull()){
// Check if savePath exists
QDir savePath(misc::expandPath(dir));
if(!savePath.exists()){
if(!savePath.mkpath(savePath.absolutePath())){
QMessageBox::critical(0, tr("Save path creation error"), tr("Could not create the save path"));
return;
}
}
foreach(const QString & hash, hashes) {
// Actually move storage
QTorrentHandle h = BTSession->getTorrentHandle(hash);
if(!BTSession->useTemporaryFolder() || h.is_seed())
h.move_storage(savePath.absolutePath());
}
}
}
void TransferListWidget::startSelectedTorrents() {
const QStringList &hashes = getSelectedTorrentsHashes();
foreach(const QString &hash, hashes) {
@ -992,8 +1021,10 @@ void TransferListWidget::displayListMenu(const QPoint&) { @@ -992,8 +1021,10 @@ void TransferListWidget::displayListMenu(const QPoint&) {
connect(&actionSet_download_limit, SIGNAL(triggered()), this, SLOT(setDlLimitSelectedTorrents()));
QAction actionOpen_destination_folder(QIcon(QString::fromUtf8(":/Icons/oxygen/folder.png")), tr("Open destination folder"), 0);
connect(&actionOpen_destination_folder, SIGNAL(triggered()), this, SLOT(openSelectedTorrentsFolder()));
QAction actionBuy_it(QIcon(QString::fromUtf8(":/Icons/oxygen/wallet.png")), tr("Buy it"), 0);
connect(&actionBuy_it, SIGNAL(triggered()), this, SLOT(buySelectedTorrents()));
//QAction actionBuy_it(QIcon(QString::fromUtf8(":/Icons/oxygen/wallet.png")), tr("Buy it"), 0);
//connect(&actionBuy_it, SIGNAL(triggered()), this, SLOT(buySelectedTorrents()));
QAction actionSetTorrentPath(QIcon(QString::fromUtf8(":/Icons/skin/folder.png")), tr("Set location..."), 0);
connect(&actionSetTorrentPath, SIGNAL(triggered()), this, SLOT(setSelectedTorrentsLocation()));
QAction actionIncreasePriority(QIcon(QString::fromUtf8(":/Icons/skin/increase.png")), tr("Increase priority"), 0);
connect(&actionIncreasePriority, SIGNAL(triggered()), this, SLOT(increasePrioSelectedTorrents()));
QAction actionDecreasePriority(QIcon(QString::fromUtf8(":/Icons/skin/decrease.png")), tr("Decrease priority"), 0);
@ -1084,6 +1115,7 @@ void TransferListWidget::displayListMenu(const QPoint&) { @@ -1084,6 +1115,7 @@ void TransferListWidget::displayListMenu(const QPoint&) {
listMenu.addSeparator();
listMenu.addAction(&actionDelete);
listMenu.addSeparator();
listMenu.addAction(&actionSetTorrentPath);
if(selectedIndexes.size() == 1)
listMenu.addAction(&actionRename);
// Label Menu
@ -1158,7 +1190,7 @@ void TransferListWidget::displayListMenu(const QPoint&) { @@ -1158,7 +1190,7 @@ void TransferListWidget::displayListMenu(const QPoint&) {
listMenu.addSeparator();
if(one_has_metadata)
listMenu.addAction(&actionCopy_magnet_link);
listMenu.addAction(&actionBuy_it);
//listMenu.addAction(&actionBuy_it);
// Call menu
QAction *act = 0;
act = listMenu.exec(QCursor::pos());

1
src/transferlistwidget.h

@ -59,6 +59,7 @@ public slots: @@ -59,6 +59,7 @@ public slots:
void setFinished(QTorrentHandle &h);
void setSelectionLabel(QString label);
void setRefreshInterval(int t);
void setSelectedTorrentsLocation();
void startSelectedTorrents();
void startAllTorrents();
void pauseSelectedTorrents();

Loading…
Cancel
Save