diff --git a/src/TransferListWidget.cpp b/src/TransferListWidget.cpp
index 1edb44e0e..bb7975ff0 100644
--- a/src/TransferListWidget.cpp
+++ b/src/TransferListWidget.cpp
@@ -722,6 +722,18 @@ void TransferListWidget::toggleSelectedTorrentsSuperSeeding() {
}
#endif
+void TransferListWidget::toggleSelectedTorrentsSequentialDownload() {
+ QModelIndexList selectedIndexes = selectionModel()->selectedRows();
+ foreach(const QModelIndex &index, selectedIndexes) {
+ // Get the file hash
+ QString hash = getHashFromRow(proxyModel->mapToSource(index).row());
+ QTorrentHandle h = BTSession->getTorrentHandle(hash);
+ if(h.is_valid()) {
+ h.set_sequential_download(!h.is_sequential_download());
+ }
+ }
+}
+
void TransferListWidget::displayListMenu(const QPoint&) {
// Create actions
QAction actionStart(QIcon(QString::fromUtf8(":/Icons/skin/play.png")), tr("Start"), 0);
@@ -750,13 +762,15 @@ void TransferListWidget::displayListMenu(const QPoint&) {
connect(&actionCopy_magnet_link, SIGNAL(triggered()), this, SLOT(copySelectedMagnetURIs()));
QAction actionSuper_seeding_mode(tr("Super seeding mode"), 0);
connect(&actionSuper_seeding_mode, SIGNAL(triggered()), this, SLOT(toggleSelectedTorrentsSuperSeeding()));
+ QAction actionSequential_download(tr("Download in sequential order"), 0);
+ connect(&actionSequential_download, SIGNAL(triggered()), this, SLOT(toggleSelectedTorrentsSequentialDownload()));
// End of actions
QMenu listMenu(this);
// Enable/disable pause/start action given the DL state
QModelIndexList selectedIndexes = selectionModel()->selectedRows();
bool has_pause = false, has_start = false, has_preview = false;
- bool all_same_super_seeding = true;
- bool super_seeding_mode = false;
+ bool all_same_super_seeding = true, all_same_sequential_download_mode = true;
+ bool super_seeding_mode = false, sequential_download_mode = false;
bool one_has_metadata = false, one_not_seed = false;
bool first = true;
QTorrentHandle h;
@@ -771,6 +785,13 @@ void TransferListWidget::displayListMenu(const QPoint&) {
one_has_metadata = true;
if(!h.is_seed()) {
one_not_seed = true;
+ if(first) {
+ sequential_download_mode = h.is_sequential_download();
+ } else {
+ if(sequential_download_mode != h.is_sequential_download()) {
+ all_same_sequential_download_mode = false;
+ }
+ }
} else {
if(!one_not_seed && all_same_super_seeding) {
if(first) {
@@ -816,6 +837,16 @@ void TransferListWidget::displayListMenu(const QPoint&) {
actionSuper_seeding_mode.setIcon(ico);
listMenu.addAction(&actionSuper_seeding_mode);
}
+ if(one_not_seed && all_same_sequential_download_mode) {
+ QIcon ico;
+ if(sequential_download_mode) {
+ ico = QIcon(":/Icons/oxygen/button_ok.png");
+ } else {
+ ico = QIcon(":/Icons/oxygen/button_cancel.png");
+ }
+ actionSequential_download.setIcon(ico);
+ listMenu.addAction(&actionSequential_download);
+ }
listMenu.addSeparator();
if(one_has_metadata) {
listMenu.addAction(&actionForce_recheck);
diff --git a/src/TransferListWidget.h b/src/TransferListWidget.h
index 3516b7174..0b009782f 100644
--- a/src/TransferListWidget.h
+++ b/src/TransferListWidget.h
@@ -80,6 +80,7 @@ protected slots:
#ifdef LIBTORRENT_0_15
void toggleSelectedTorrentsSuperSeeding();
#endif
+ void toggleSelectedTorrentsSequentialDownload();
//void setRowColor(int row, QColor color);
public slots:
diff --git a/src/propertiesWidget.ui b/src/propertiesWidget.ui
index f640dbf2f..06e848b86 100644
--- a/src/propertiesWidget.ui
+++ b/src/propertiesWidget.ui
@@ -53,9 +53,9 @@
0
- -85
+ -59
518
- 374
+ 348
@@ -530,13 +530,6 @@ p, li { white-space: pre-wrap; }
- -
-
-
- Download in correct order (slower but good for previewing)
-
-
-
diff --git a/src/propertieswidget.cpp b/src/propertieswidget.cpp
index 7f4d32c50..e5e5e287b 100644
--- a/src/propertieswidget.cpp
+++ b/src/propertieswidget.cpp
@@ -93,7 +93,6 @@ PropertiesWidget::PropertiesWidget(QWidget *parent, TransferListWidget *transfer
connect(addWS_button, SIGNAL(clicked()), this, SLOT(askWebSeed()));
connect(deleteWS_button, SIGNAL(clicked()), this, SLOT(deleteSelectedUrlSeeds()));
connect(transferList, SIGNAL(currentTorrentChanged(QTorrentHandle&)), this, SLOT(loadTorrentInfos(QTorrentHandle &)));
- connect(incrementalDownload, SIGNAL(stateChanged(int)), this, SLOT(setIncrementalDownload(int)));
connect(PropDelegate, SIGNAL(filteredFilesChanged()), this, SLOT(filteredFilesChanged()));
connect(stackedProperties, SIGNAL(currentChanged(int)), this, SLOT(loadDynamicData()));
@@ -165,7 +164,6 @@ void PropertiesWidget::clear() {
lbl_creationDate->clear();
hash_lbl->clear();
comment_text->clear();
- incrementalDownload->setChecked(false);
trackerList->clear();
progressBar->setProgress(QRealArray());
wasted->clear();
@@ -211,8 +209,6 @@ void PropertiesWidget::loadTorrentInfos(QTorrentHandle &_h) {
hash_lbl->setText(h.hash());
// Comment
comment_text->setHtml(h.comment());
- // Sequential download
- incrementalDownload->setChecked(TorrentPersistentData::isSequentialDownload(h.hash()));
// URL seeds
loadUrlSeeds();
// downloaded pieces updater
@@ -344,12 +340,6 @@ void PropertiesWidget::loadDynamicData() {
} catch(invalid_handle e) {}
}
-void PropertiesWidget::setIncrementalDownload(int checkboxState) {
- if(!h.is_valid()) return;
- h.set_sequential_download(checkboxState == Qt::Checked);
- TorrentPersistentData::saveSequentialStatus(h);
-}
-
void PropertiesWidget::loadUrlSeeds(){
QStringList already_added;
listWebSeeds->clear();
diff --git a/src/propertieswidget.h b/src/propertieswidget.h
index 76d9eb7bd..781422974 100644
--- a/src/propertieswidget.h
+++ b/src/propertieswidget.h
@@ -80,7 +80,6 @@ protected:
protected slots:
void loadTorrentInfos(QTorrentHandle &h);
void loadDynamicData();
- void setIncrementalDownload(int checkboxState);
void loadUrlSeeds();
void on_main_infos_button_clicked();
void on_trackers_button_clicked();
diff --git a/src/torrentPersistentData.h b/src/torrentPersistentData.h
index 94be80442..5a30d405a 100644
--- a/src/torrentPersistentData.h
+++ b/src/torrentPersistentData.h
@@ -203,8 +203,6 @@ public:
}
data["url_seeds"] = url_seeds;
}
- // Sequential download
- data["sequential"] = h.is_sequential_download();
// Save data
all_data[h.hash()] = data;
settings.setValue("torrents", all_data);
@@ -288,15 +286,6 @@ public:
settings.setValue("torrents", all_data);
}
- static void saveSequentialStatus(QTorrentHandle h) {
- QSettings settings(QString::fromUtf8("qBittorrent"), QString::fromUtf8("qBittorrent-resume"));
- QHash all_data = settings.value("torrents", QHash()).toHash();
- QHash data = all_data[h.hash()].toHash();
- data["sequential"] = h.is_sequential_download();
- all_data[h.hash()] = data;
- settings.setValue("torrents", all_data);
- }
-
// Getters
static QHash getTrackers(QString hash) {
QSettings settings(QString::fromUtf8("qBittorrent"), QString::fromUtf8("qBittorrent-resume"));
@@ -359,12 +348,5 @@ public:
return data["magnet_uri"].toString();
}
- static bool isSequentialDownload(QString hash) {
- QSettings settings(QString::fromUtf8("qBittorrent"), QString::fromUtf8("qBittorrent-resume"));
- QHash all_data = settings.value("torrents", QHash()).toHash();
- QHash data = all_data[hash].toHash();
- return data["sequential"].toBool();
- }
-
};
#endif // TORRENTPERSISTENTDATA_H