mirror of
https://github.com/d47081/qBittorrent.git
synced 2025-03-10 04:11:16 +00:00
- Moved "download in sequential order" from Torrent properties to right click menu in transfer list (it makes more sense this way)
- Do not save sequential mode status to hard disk because libtorrent is already taking care of this
This commit is contained in:
parent
81412584e1
commit
e8fba3e630
@ -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);
|
||||
|
@ -80,6 +80,7 @@ protected slots:
|
||||
#ifdef LIBTORRENT_0_15
|
||||
void toggleSelectedTorrentsSuperSeeding();
|
||||
#endif
|
||||
void toggleSelectedTorrentsSequentialDownload();
|
||||
//void setRowColor(int row, QColor color);
|
||||
|
||||
public slots:
|
||||
|
@ -53,9 +53,9 @@
|
||||
<property name="geometry">
|
||||
<rect>
|
||||
<x>0</x>
|
||||
<y>-85</y>
|
||||
<y>-59</y>
|
||||
<width>518</width>
|
||||
<height>374</height>
|
||||
<height>348</height>
|
||||
</rect>
|
||||
</property>
|
||||
<layout class="QVBoxLayout" name="verticalLayout_8">
|
||||
@ -530,13 +530,6 @@ p, li { white-space: pre-wrap; }
|
||||
</layout>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QCheckBox" name="incrementalDownload">
|
||||
<property name="text">
|
||||
<string>Download in correct order (slower but good for previewing)</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
</widget>
|
||||
|
@ -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();
|
||||
|
@ -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();
|
||||
|
@ -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<QString, QVariant> all_data = settings.value("torrents", QHash<QString, QVariant>()).toHash();
|
||||
QHash<QString, QVariant> 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<QString, QVariant> 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<QString, QVariant> all_data = settings.value("torrents", QHash<QString, QVariant>()).toHash();
|
||||
QHash<QString, QVariant> data = all_data[hash].toHash();
|
||||
return data["sequential"].toBool();
|
||||
}
|
||||
|
||||
};
|
||||
#endif // TORRENTPERSISTENTDATA_H
|
||||
|
Loading…
x
Reference in New Issue
Block a user