mirror of
https://github.com/qbittorrent/qBittorrent.git
synced 2024-11-23 09:47:08 +03:00
- Use libtorrent queueing system (probably buggy and queueing currently does not work for seeds)
This commit is contained in:
parent
0538c9c3e8
commit
f3729fbae6
8 changed files with 182 additions and 535 deletions
63
src/GUI.cpp
63
src/GUI.cpp
|
@ -1031,6 +1031,39 @@ void GUI::configureSession(bool deleteOptions) {
|
|||
}
|
||||
sessionSettings.upnp_ignore_nonrouters = true;
|
||||
sessionSettings.use_dht_as_fallback = false;
|
||||
// Queueing System
|
||||
if(options->isQueueingSystemEnabled()) {
|
||||
if(!BTSession->isQueueingEnabled()) {
|
||||
downloadingTorrentTab->hidePriorityColumn(false);
|
||||
finishedTorrentTab->hidePriorityColumn(false);
|
||||
actionDecreasePriority->setVisible(true);
|
||||
actionIncreasePriority->setVisible(true);
|
||||
prioSeparator->setVisible(true);
|
||||
prioSeparator2->setVisible(true);
|
||||
toolBar->layout()->setSpacing(7);
|
||||
}
|
||||
int max_torrents = options->getMaxActiveTorrents();
|
||||
int max_downloads = options->getMaxActiveDownloads();
|
||||
int max_seeds = options->getMaxActiveUploads();
|
||||
sessionSettings.active_limit = max_torrents;
|
||||
sessionSettings.active_downloads = max_downloads;
|
||||
sessionSettings.active_seeds = max_seeds;
|
||||
BTSession->setQueueingEnabled(true);
|
||||
} else {
|
||||
if(BTSession->isQueueingEnabled()) {
|
||||
sessionSettings.active_limit = -1;
|
||||
sessionSettings.active_downloads = -1;
|
||||
sessionSettings.active_seeds = -1;
|
||||
BTSession->setQueueingEnabled(false);
|
||||
downloadingTorrentTab->hidePriorityColumn(true);
|
||||
finishedTorrentTab->hidePriorityColumn(true);
|
||||
actionDecreasePriority->setVisible(false);
|
||||
actionIncreasePriority->setVisible(false);
|
||||
prioSeparator->setVisible(false);
|
||||
prioSeparator2->setVisible(false);
|
||||
toolBar->layout()->setSpacing(7);
|
||||
}
|
||||
}
|
||||
BTSession->setSessionSettings(sessionSettings);
|
||||
// Bittorrent
|
||||
// * Max connections limit
|
||||
|
@ -1107,36 +1140,6 @@ void GUI::configureSession(bool deleteOptions) {
|
|||
} else {
|
||||
displayRSSTab(false);
|
||||
}
|
||||
// Queueing System
|
||||
if(options->isQueueingSystemEnabled()) {
|
||||
if(!BTSession->isQueueingEnabled()) {
|
||||
downloadingTorrentTab->hidePriorityColumn(false);
|
||||
finishedTorrentTab->hidePriorityColumn(false);
|
||||
actionDecreasePriority->setVisible(true);
|
||||
actionIncreasePriority->setVisible(true);
|
||||
prioSeparator->setVisible(true);
|
||||
prioSeparator2->setVisible(true);
|
||||
toolBar->layout()->setSpacing(7);
|
||||
}
|
||||
int max_torrents = options->getMaxActiveTorrents();
|
||||
int max_downloads = options->getMaxActiveDownloads();
|
||||
if(max_torrents < max_downloads)
|
||||
max_torrents = max_downloads;
|
||||
BTSession->setMaxActiveTorrents(max_torrents);
|
||||
BTSession->setMaxActiveDownloads(max_downloads);
|
||||
BTSession->setQueueingEnabled(true);
|
||||
} else {
|
||||
if(BTSession->isQueueingEnabled()) {
|
||||
BTSession->setQueueingEnabled(false);
|
||||
downloadingTorrentTab->hidePriorityColumn(true);
|
||||
finishedTorrentTab->hidePriorityColumn(true);
|
||||
actionDecreasePriority->setVisible(false);
|
||||
actionIncreasePriority->setVisible(false);
|
||||
prioSeparator->setVisible(false);
|
||||
prioSeparator2->setVisible(false);
|
||||
toolBar->layout()->setSpacing(7);
|
||||
}
|
||||
}
|
||||
// Clean up
|
||||
if(deleteOptions) {
|
||||
delete options;
|
||||
|
|
|
@ -70,10 +70,6 @@ bittorrent::bittorrent() : timerScan(0), DHTEnabled(false), preAllocateAll(false
|
|||
connect(downloader, SIGNAL(downloadFailure(QString, QString)), this, SLOT(handleDownloadFailure(QString, QString)));
|
||||
BigRatioTimer = 0;
|
||||
filterParser = 0;
|
||||
downloadQueue = 0;
|
||||
queuedDownloads = 0;
|
||||
uploadQueue = 0;
|
||||
queuedUploads = 0;
|
||||
qDebug("* BTSession constructed");
|
||||
}
|
||||
|
||||
|
@ -99,16 +95,6 @@ bittorrent::~bittorrent() {
|
|||
if(filterParser)
|
||||
delete filterParser;
|
||||
delete downloader;
|
||||
if(queueingEnabled) {
|
||||
Q_ASSERT(downloadQueue);
|
||||
delete downloadQueue;
|
||||
Q_ASSERT(queuedDownloads);
|
||||
delete queuedDownloads;
|
||||
Q_ASSERT(uploadQueue);
|
||||
delete uploadQueue;
|
||||
Q_ASSERT(queuedUploads);
|
||||
delete queuedUploads;
|
||||
}
|
||||
// Delete BT session
|
||||
qDebug("Deleting session");
|
||||
delete s;
|
||||
|
@ -171,161 +157,41 @@ bool bittorrent::isQueueingEnabled() const {
|
|||
return queueingEnabled;
|
||||
}
|
||||
|
||||
void bittorrent::setMaxActiveDownloads(int val) {
|
||||
if(val != maxActiveDownloads) {
|
||||
maxActiveDownloads = val;
|
||||
if(queueingEnabled) {
|
||||
updateDownloadQueue();
|
||||
updateUploadQueue();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void bittorrent::setMaxActiveTorrents(int val) {
|
||||
if(val != maxActiveTorrents) {
|
||||
maxActiveTorrents = val;
|
||||
if(queueingEnabled) {
|
||||
updateDownloadQueue();
|
||||
updateUploadQueue();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void bittorrent::increaseDlTorrentPriority(QString hash) {
|
||||
Q_ASSERT(queueingEnabled);
|
||||
int index = downloadQueue->indexOf(hash);
|
||||
Q_ASSERT(index != -1);
|
||||
if(index > 0) {
|
||||
downloadQueue->swap(index-1, index);
|
||||
saveTorrentPriority(hash, index-1);
|
||||
saveTorrentPriority(downloadQueue->at(index), index);
|
||||
updateDownloadQueue();
|
||||
}
|
||||
QTorrentHandle h = getTorrentHandle(hash);
|
||||
h.queue_position_up();
|
||||
}
|
||||
|
||||
void bittorrent::increaseUpTorrentPriority(QString hash) {
|
||||
Q_ASSERT(queueingEnabled);
|
||||
int index = uploadQueue->indexOf(hash);
|
||||
Q_ASSERT(index != -1);
|
||||
if(index > 0) {
|
||||
uploadQueue->swap(index-1, index);
|
||||
saveTorrentPriority(hash, index-1);
|
||||
saveTorrentPriority(uploadQueue->at(index), index);
|
||||
updateUploadQueue();
|
||||
}
|
||||
QTorrentHandle h = getTorrentHandle(hash);
|
||||
h.queue_position_up();
|
||||
}
|
||||
|
||||
void bittorrent::decreaseDlTorrentPriority(QString hash) {
|
||||
Q_ASSERT(queueingEnabled);
|
||||
int index = downloadQueue->indexOf(hash);
|
||||
Q_ASSERT(index != -1);
|
||||
if(index >= 0 && index < (downloadQueue->size()-1)) {
|
||||
downloadQueue->swap(index+1, index);
|
||||
saveTorrentPriority(hash, index+1);
|
||||
saveTorrentPriority(downloadQueue->at(index), index);
|
||||
updateDownloadQueue();
|
||||
}
|
||||
QTorrentHandle h = getTorrentHandle(hash);
|
||||
h.queue_position_down();
|
||||
}
|
||||
|
||||
void bittorrent::decreaseUpTorrentPriority(QString hash) {
|
||||
Q_ASSERT(queueingEnabled);
|
||||
int index = uploadQueue->indexOf(hash);
|
||||
Q_ASSERT(index != -1);
|
||||
if(index >= 0 && index < (uploadQueue->size()-1)) {
|
||||
uploadQueue->swap(index+1, index);
|
||||
saveTorrentPriority(hash, index+1);
|
||||
saveTorrentPriority(uploadQueue->at(index), index);
|
||||
updateUploadQueue();
|
||||
}
|
||||
}
|
||||
|
||||
void bittorrent::saveTorrentPriority(QString hash, int prio) {
|
||||
// Write .queued file
|
||||
QFile prio_file(misc::qBittorrentPath()+"BT_backup"+QDir::separator()+hash+".prio");
|
||||
prio_file.open(QIODevice::WriteOnly | QIODevice::Text);
|
||||
prio_file.write(QByteArray::number(prio));
|
||||
prio_file.close();
|
||||
}
|
||||
|
||||
void bittorrent::fixTorrentPriorities() {
|
||||
Q_ASSERT(queueingEnabled);
|
||||
// Load priorities
|
||||
QList<QPair<int, QString> > tmp_list;
|
||||
QStringList noprio;
|
||||
foreach(QString hash, unfinishedTorrents) {
|
||||
int prio = loadTorrentPriority(hash);
|
||||
if(prio != -1) {
|
||||
misc::insertSort2<QString>(tmp_list, QPair<int,QString>(prio,hash), Qt::AscendingOrder);
|
||||
} else {
|
||||
noprio << hash;
|
||||
}
|
||||
}
|
||||
downloadQueue->clear();
|
||||
QPair<int,QString> couple;
|
||||
foreach(couple, tmp_list) {
|
||||
downloadQueue->append(couple.second);
|
||||
}
|
||||
(*downloadQueue)<<noprio;
|
||||
// Cleanup
|
||||
tmp_list.clear();
|
||||
noprio.clear();
|
||||
// save priorities
|
||||
int i=0;
|
||||
foreach(QString hash, *downloadQueue) {
|
||||
saveTorrentPriority(hash, i);
|
||||
++i;
|
||||
}
|
||||
queuedDownloads->clear();
|
||||
updateDownloadQueue();
|
||||
foreach(QString hash, finishedTorrents) {
|
||||
int prio = loadTorrentPriority(hash);
|
||||
if(prio != -1) {
|
||||
misc::insertSort2<QString>(tmp_list, QPair<int,QString>(prio,hash), Qt::AscendingOrder);
|
||||
} else {
|
||||
noprio << hash;
|
||||
}
|
||||
}
|
||||
uploadQueue->clear();
|
||||
foreach(couple, tmp_list) {
|
||||
uploadQueue->append(couple.second);
|
||||
}
|
||||
(*uploadQueue)<<noprio;
|
||||
// save priorities
|
||||
i=0;
|
||||
foreach(QString hash, *uploadQueue) {
|
||||
saveTorrentPriority(hash, i);
|
||||
++i;
|
||||
}
|
||||
queuedUploads->clear();
|
||||
updateUploadQueue();
|
||||
}
|
||||
|
||||
int bittorrent::loadTorrentPriority(QString hash) {
|
||||
// Read .prio file
|
||||
QFile prio_file(misc::qBittorrentPath()+"BT_backup"+QDir::separator()+hash+".prio");
|
||||
if(prio_file.open(QIODevice::ReadOnly | QIODevice::Text)) {
|
||||
bool ok = false;
|
||||
int prio = prio_file.readAll().toInt(&ok);
|
||||
prio_file.close();
|
||||
if(!ok) {
|
||||
qDebug("Could not convert prio to integer !!!!!!!");
|
||||
return -1;
|
||||
}
|
||||
qDebug("Prio is %d", prio);
|
||||
return prio;
|
||||
}
|
||||
qDebug(".prio file does not exist !!!!!");
|
||||
return -1;
|
||||
QTorrentHandle h = getTorrentHandle(hash);
|
||||
h.queue_position_down();
|
||||
}
|
||||
|
||||
bool bittorrent::isDownloadQueued(QString hash) const {
|
||||
Q_ASSERT(queueingEnabled);
|
||||
return queuedDownloads->contains(hash);
|
||||
QTorrentHandle h = getTorrentHandle(hash);
|
||||
return h.queue_position() >= 0;
|
||||
}
|
||||
|
||||
bool bittorrent::isUploadQueued(QString hash) const {
|
||||
// FIXME: libtorrent does not support this.
|
||||
Q_ASSERT(queueingEnabled);
|
||||
return queuedUploads->contains(hash);
|
||||
QTorrentHandle h = getTorrentHandle(hash);
|
||||
return h.queue_position() >= 0;
|
||||
}
|
||||
|
||||
void bittorrent::setUploadLimit(QString hash, long val) {
|
||||
|
@ -336,14 +202,6 @@ void bittorrent::setUploadLimit(QString hash, long val) {
|
|||
saveTorrentSpeedLimits(hash);
|
||||
}
|
||||
|
||||
int bittorrent::getMaximumActiveDownloads() const {
|
||||
return maxActiveDownloads;
|
||||
}
|
||||
|
||||
int bittorrent::getMaximumActiveTorrents() const {
|
||||
return maxActiveTorrents;
|
||||
}
|
||||
|
||||
void bittorrent::handleDownloadFailure(QString url, QString reason) {
|
||||
emit downloadFromUrlFailure(url, reason);
|
||||
}
|
||||
|
@ -356,171 +214,19 @@ void bittorrent::setQueueingEnabled(bool enable) {
|
|||
if(queueingEnabled != enable) {
|
||||
qDebug("Queueing system is changing state...");
|
||||
queueingEnabled = enable;
|
||||
if(enable) {
|
||||
downloadQueue = new QStringList();
|
||||
uploadQueue = new QStringList();
|
||||
queuedUploads = new QStringList();
|
||||
queuedDownloads = new QStringList();
|
||||
fixTorrentPriorities();
|
||||
} else {
|
||||
// Unqueue torrents
|
||||
foreach(QString hash, *queuedDownloads) {
|
||||
QTorrentHandle h = getTorrentHandle(hash);
|
||||
h.resume();
|
||||
if(QFile::exists(misc::qBittorrentPath()+"BT_backup"+QDir::separator()+hash+".queued")) {
|
||||
QFile::remove(misc::qBittorrentPath()+"BT_backup"+QDir::separator()+hash+".queued");
|
||||
}
|
||||
if(QFile::exists(misc::qBittorrentPath()+"BT_backup"+QDir::separator()+hash+".prio")) {
|
||||
QFile::remove(misc::qBittorrentPath()+"BT_backup"+QDir::separator()+hash+".prio");
|
||||
}
|
||||
}
|
||||
foreach(QString hash, *queuedUploads) {
|
||||
QTorrentHandle h = getTorrentHandle(hash);
|
||||
h.resume();
|
||||
if(QFile::exists(misc::qBittorrentPath()+"BT_backup"+QDir::separator()+hash+".queued")) {
|
||||
QFile::remove(misc::qBittorrentPath()+"BT_backup"+QDir::separator()+hash+".queued");
|
||||
}
|
||||
if(QFile::exists(misc::qBittorrentPath()+"BT_backup"+QDir::separator()+hash+".prio")) {
|
||||
QFile::remove(misc::qBittorrentPath()+"BT_backup"+QDir::separator()+hash+".prio");
|
||||
}
|
||||
}
|
||||
delete downloadQueue;
|
||||
downloadQueue = 0;
|
||||
delete queuedDownloads;
|
||||
queuedDownloads = 0;
|
||||
delete uploadQueue;
|
||||
uploadQueue = 0;
|
||||
delete queuedUploads;
|
||||
queuedUploads = 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
int bittorrent::getDlTorrentPriority(QString hash) const {
|
||||
Q_ASSERT(downloadQueue != 0);
|
||||
return downloadQueue->indexOf(hash);
|
||||
Q_ASSERT(queueingEnabled);
|
||||
QTorrentHandle h = getTorrentHandle(hash);
|
||||
return h.queue_position();
|
||||
}
|
||||
|
||||
int bittorrent::getUpTorrentPriority(QString hash) const {
|
||||
Q_ASSERT(uploadQueue != 0);
|
||||
return uploadQueue->indexOf(hash);
|
||||
}
|
||||
|
||||
void bittorrent::updateUploadQueue() {
|
||||
Q_ASSERT(queueingEnabled);
|
||||
bool change = false;
|
||||
int maxActiveUploads = maxActiveTorrents - currentActiveDownloads;
|
||||
int currentActiveUploads = 0;
|
||||
// Check if it is necessary to queue uploads
|
||||
foreach(QString hash, *uploadQueue) {
|
||||
QTorrentHandle h = getTorrentHandle(hash);
|
||||
if(!h.is_paused()) {
|
||||
if(currentActiveUploads < maxActiveUploads) {
|
||||
++currentActiveUploads;
|
||||
} else {
|
||||
// Queue it
|
||||
h.pause();
|
||||
change = true;
|
||||
if(!queuedUploads->contains(hash)) {
|
||||
queuedUploads->append(hash);
|
||||
// Create .queued file
|
||||
if(!QFile::exists(misc::qBittorrentPath()+"BT_backup"+QDir::separator()+hash+".queued")) {
|
||||
QFile queued_file(misc::qBittorrentPath()+"BT_backup"+QDir::separator()+hash+".queued");
|
||||
queued_file.open(QIODevice::WriteOnly | QIODevice::Text);
|
||||
queued_file.close();
|
||||
}
|
||||
}
|
||||
}
|
||||
} else {
|
||||
if(currentActiveUploads < maxActiveUploads && isUploadQueued(hash)) {
|
||||
QTorrentHandle h = getTorrentHandle(hash);
|
||||
h.resume();
|
||||
change = true;
|
||||
queuedUploads->removeAll(hash);
|
||||
QFile::remove(misc::qBittorrentPath()+"BT_backup"+QDir::separator()+hash+".queued");
|
||||
++currentActiveUploads;
|
||||
}
|
||||
}
|
||||
}
|
||||
if(currentActiveUploads < maxActiveUploads) {
|
||||
// Could not fill download slots, unqueue torrents
|
||||
foreach(QString hash, *uploadQueue) {
|
||||
if(uploadQueue->size() != 0 && currentActiveUploads < maxActiveUploads) {
|
||||
if(queuedUploads->contains(hash)) {
|
||||
QTorrentHandle h = getTorrentHandle(hash);
|
||||
h.resume();
|
||||
change = true;
|
||||
queuedUploads->removeAll(hash);
|
||||
QFile::remove(misc::qBittorrentPath()+"BT_backup"+QDir::separator()+hash+".queued");
|
||||
++currentActiveUploads;
|
||||
}
|
||||
} else {
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
if(change) {
|
||||
emit updateFinishedTorrentNumber();
|
||||
emit forceFinishedListUpdate();
|
||||
}
|
||||
}
|
||||
|
||||
void bittorrent::updateDownloadQueue() {
|
||||
Q_ASSERT(queueingEnabled);
|
||||
bool change = false;
|
||||
currentActiveDownloads = 0;
|
||||
// Check if it is necessary to queue torrents
|
||||
foreach(QString hash, *downloadQueue) {
|
||||
QTorrentHandle h = getTorrentHandle(hash);
|
||||
if(!h.is_paused()) {
|
||||
if(currentActiveDownloads < maxActiveDownloads) {
|
||||
++currentActiveDownloads;
|
||||
} else {
|
||||
// Queue it
|
||||
h.pause();
|
||||
change = true;
|
||||
if(!queuedDownloads->contains(hash)) {
|
||||
queuedDownloads->append(hash);
|
||||
// Create .queued file
|
||||
if(!QFile::exists(misc::qBittorrentPath()+"BT_backup"+QDir::separator()+hash+".queued")) {
|
||||
QFile queued_file(misc::qBittorrentPath()+"BT_backup"+QDir::separator()+hash+".queued");
|
||||
queued_file.open(QIODevice::WriteOnly | QIODevice::Text);
|
||||
queued_file.close();
|
||||
}
|
||||
}
|
||||
}
|
||||
} else {
|
||||
if(currentActiveDownloads < maxActiveDownloads && isDownloadQueued(hash)) {
|
||||
QTorrentHandle h = getTorrentHandle(hash);
|
||||
h.resume();
|
||||
change = true;
|
||||
queuedDownloads->removeAll(hash);
|
||||
QFile::remove(misc::qBittorrentPath()+"BT_backup"+QDir::separator()+hash+".queued");
|
||||
++currentActiveDownloads;
|
||||
}
|
||||
}
|
||||
}
|
||||
if(currentActiveDownloads < maxActiveDownloads) {
|
||||
// Could not fill download slots, unqueue torrents
|
||||
foreach(QString hash, *downloadQueue) {
|
||||
if(downloadQueue->size() != 0 && currentActiveDownloads < maxActiveDownloads) {
|
||||
if(queuedDownloads->contains(hash)) {
|
||||
QTorrentHandle h = getTorrentHandle(hash);
|
||||
h.resume();
|
||||
change = true;
|
||||
queuedDownloads->removeAll(hash);
|
||||
QFile::remove(misc::qBittorrentPath()+"BT_backup"+QDir::separator()+hash+".queued");
|
||||
++currentActiveDownloads;
|
||||
}
|
||||
} else {
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
if(change) {
|
||||
emit updateUnfinishedTorrentNumber();
|
||||
emit forceUnfinishedListUpdate();
|
||||
}
|
||||
QTorrentHandle h = getTorrentHandle(hash);
|
||||
return h.queue_position();
|
||||
}
|
||||
|
||||
// Calculate the ETA using GASA
|
||||
|
@ -632,23 +338,6 @@ void bittorrent::deleteTorrent(QString hash, bool permanent) {
|
|||
std::cerr << "Error: Torrent " << hash.toStdString() << " is neither in finished or unfinished list\n";
|
||||
}
|
||||
}
|
||||
// Remove it from downloadQueue or UploadQueue
|
||||
if(queueingEnabled) {
|
||||
if(downloadQueue->contains(hash)) {
|
||||
downloadQueue->removeAll(hash);
|
||||
queuedDownloads->removeAll(hash);
|
||||
updateDownloadQueue();
|
||||
}
|
||||
if(uploadQueue->contains(hash)) {
|
||||
uploadQueue->removeAll(hash);
|
||||
queuedUploads->removeAll(hash);
|
||||
updateUploadQueue();
|
||||
}
|
||||
}
|
||||
if(QFile::exists(misc::qBittorrentPath()+"BT_backup"+QDir::separator()+hash+".prio"))
|
||||
QFile::remove(misc::qBittorrentPath()+"BT_backup"+QDir::separator()+hash+".prio");
|
||||
if(QFile::exists(misc::qBittorrentPath()+"BT_backup"+QDir::separator()+hash+".queued"))
|
||||
QFile::remove(misc::qBittorrentPath()+"BT_backup"+QDir::separator()+hash+".queued");
|
||||
if(permanent)
|
||||
addConsoleMessage(tr("'%1' was removed permanently.", "'xxx.avi' was removed permanently.").arg(fileName));
|
||||
else
|
||||
|
@ -686,24 +375,6 @@ void bittorrent::setUnfinishedTorrent(QString hash) {
|
|||
TorrentsStartTime[hash] = QDateTime::currentDateTime();
|
||||
}
|
||||
}
|
||||
if(queueingEnabled) {
|
||||
// Remove it from uploadQueue
|
||||
if(uploadQueue->contains(hash)) {
|
||||
uploadQueue->removeAll(hash);
|
||||
queuedUploads->removeAll(hash);
|
||||
/*if(QFile::exists(misc::qBittorrentPath()+"BT_backup"+QDir::separator()+hash+".prio"))
|
||||
QFile::remove(misc::qBittorrentPath()+"BT_backup"+QDir::separator()+hash+".prio");
|
||||
if(QFile::exists(misc::qBittorrentPath()+"BT_backup"+QDir::separator()+hash+".queued"))
|
||||
QFile::remove(misc::qBittorrentPath()+"BT_backup"+QDir::separator()+hash+".queued");*/
|
||||
updateUploadQueue();
|
||||
}
|
||||
// Add it to downloadQueue
|
||||
if(!downloadQueue->contains(hash)) {
|
||||
downloadQueue->append(hash);
|
||||
saveTorrentPriority(hash, downloadQueue->size()-1);
|
||||
updateDownloadQueue();
|
||||
}
|
||||
}
|
||||
//emit torrentSwitchedtoUnfinished(hash);
|
||||
}
|
||||
|
||||
|
@ -726,20 +397,6 @@ void bittorrent::setFinishedTorrent(QString hash) {
|
|||
TorrentsStartTime.remove(hash);
|
||||
TorrentsStartData.remove(hash);
|
||||
}
|
||||
// Remove it from
|
||||
if(queueingEnabled) {
|
||||
downloadQueue->removeAll(hash);
|
||||
queuedDownloads->removeAll(hash);
|
||||
/*if(QFile::exists(misc::qBittorrentPath()+"BT_backup"+QDir::separator()+hash+".prio"))
|
||||
QFile::remove(misc::qBittorrentPath()+"BT_backup"+QDir::separator()+hash+".prio");
|
||||
if(QFile::exists(misc::qBittorrentPath()+"BT_backup"+QDir::separator()+hash+".queued"))
|
||||
QFile::remove(misc::qBittorrentPath()+"BT_backup"+QDir::separator()+hash+".queued");*/
|
||||
updateDownloadQueue();
|
||||
if(!uploadQueue->contains(hash)) {
|
||||
uploadQueue->append(hash);
|
||||
updateUploadQueue();
|
||||
}
|
||||
}
|
||||
//emit torrentSwitchedtoFinished(hash);
|
||||
}
|
||||
|
||||
|
@ -752,30 +409,13 @@ bool bittorrent::pauseTorrent(QString hash) {
|
|||
change = true;
|
||||
// Save fast resume data
|
||||
saveFastResumeData(hash);
|
||||
if(queueingEnabled) {
|
||||
updateDownloadQueue();
|
||||
updateUploadQueue();
|
||||
}
|
||||
qDebug("Torrent paused successfully");
|
||||
emit pausedTorrent(hash);
|
||||
}else{
|
||||
if(!h.is_valid()) {
|
||||
qDebug("Could not pause torrent %s, reason: invalid", hash.toUtf8().data());
|
||||
}else{
|
||||
if(queueingEnabled && (isDownloadQueued(hash)||isUploadQueued(hash))) {
|
||||
// Remove it from queued list if present
|
||||
if(queuedDownloads->contains(hash))
|
||||
queuedDownloads->removeAll(hash);
|
||||
if(queuedUploads->contains(hash))
|
||||
queuedUploads->removeAll(hash);
|
||||
if(QFile::exists(misc::qBittorrentPath()+"BT_backup"+QDir::separator()+hash+".queued"))
|
||||
QFile::remove(misc::qBittorrentPath()+"BT_backup"+QDir::separator()+hash+".queued");
|
||||
updateDownloadQueue();
|
||||
updateUploadQueue();
|
||||
change = true;
|
||||
} else {
|
||||
qDebug("Could not pause torrent %s, reason: already paused", hash.toUtf8().data());
|
||||
}
|
||||
}
|
||||
}
|
||||
// Create .paused file if necessary
|
||||
|
@ -799,24 +439,18 @@ bool bittorrent::resumeTorrent(QString hash) {
|
|||
bool change = false;
|
||||
QTorrentHandle h = getTorrentHandle(hash);
|
||||
if(h.is_valid() && h.is_paused()) {
|
||||
if(!(queueingEnabled && (isDownloadQueued(hash)||isUploadQueued(hash)))) {
|
||||
// Save Addition DateTime
|
||||
if(calculateETA) {
|
||||
TorrentsStartData[hash] = h.total_payload_download();
|
||||
TorrentsStartTime[hash] = QDateTime::currentDateTime();
|
||||
TorrentsStartData[hash] = h.total_payload_download();
|
||||
TorrentsStartTime[hash] = QDateTime::currentDateTime();
|
||||
}
|
||||
h.resume();
|
||||
change = true;
|
||||
emit resumedTorrent(hash);
|
||||
}
|
||||
}
|
||||
// Delete .paused file
|
||||
if(QFile::exists(misc::qBittorrentPath()+"BT_backup"+QDir::separator()+hash+".paused"))
|
||||
QFile::remove(misc::qBittorrentPath()+"BT_backup"+QDir::separator()+hash+".paused");
|
||||
if(queueingEnabled) {
|
||||
updateDownloadQueue();
|
||||
updateUploadQueue();
|
||||
}
|
||||
if(change) {
|
||||
addConsoleMessage(tr("'%1' resumed.", "e.g: xxx.avi resumed.").arg(h.name()));
|
||||
}
|
||||
|
@ -1013,18 +647,8 @@ void bittorrent::addTorrent(QString path, bool fromScanDir, QString from_url, bo
|
|||
}
|
||||
if(QFile::exists(misc::qBittorrentPath()+"BT_backup"+QDir::separator()+hash+".finished")) {
|
||||
finishedTorrents << hash;
|
||||
if(!resumed && queueingEnabled) {
|
||||
uploadQueue->append(hash);
|
||||
saveTorrentPriority(hash, uploadQueue->size()-1);
|
||||
updateUploadQueue();
|
||||
}
|
||||
}else{
|
||||
unfinishedTorrents << hash;
|
||||
if(!resumed && queueingEnabled) {
|
||||
downloadQueue->append(hash);
|
||||
saveTorrentPriority(hash, downloadQueue->size()-1);
|
||||
updateDownloadQueue();
|
||||
}
|
||||
}
|
||||
// If download from url, remove temp file
|
||||
if(!from_url.isNull()) QFile::remove(file);
|
||||
|
@ -1864,8 +1488,5 @@ void bittorrent::resumeUnfinishedTorrents() {
|
|||
foreach(fileName, filePaths) {
|
||||
addTorrent(fileName, false, QString(), true);
|
||||
}
|
||||
if(queueingEnabled) {
|
||||
fixTorrentPriorities();
|
||||
}
|
||||
qDebug("Unfinished torrents resumed");
|
||||
}
|
||||
|
|
|
@ -74,13 +74,6 @@ class bittorrent : public QObject {
|
|||
QString filterPath;
|
||||
int folderScanInterval; // in seconds
|
||||
bool queueingEnabled;
|
||||
int maxActiveDownloads;
|
||||
int maxActiveTorrents;
|
||||
int currentActiveDownloads;
|
||||
QStringList *downloadQueue;
|
||||
QStringList *queuedDownloads;
|
||||
QStringList *uploadQueue;
|
||||
QStringList *queuedUploads;
|
||||
bool calculateETA;
|
||||
QStringList url_skippingDlg;
|
||||
|
||||
|
@ -145,13 +138,10 @@ class bittorrent : public QObject {
|
|||
void loadTorrentSpeedLimits(QString hash);
|
||||
void handleDownloadFailure(QString url, QString reason);
|
||||
void loadWebSeeds(QString fileHash);
|
||||
void updateDownloadQueue();
|
||||
void updateUploadQueue();
|
||||
void increaseDlTorrentPriority(QString hash);
|
||||
void decreaseDlTorrentPriority(QString hash);
|
||||
void increaseUpTorrentPriority(QString hash);
|
||||
void decreaseUpTorrentPriority(QString hash);
|
||||
void saveTorrentPriority(QString hash, int prio);
|
||||
void downloadUrlAndSkipDialog(QString);
|
||||
// Session configuration - Setters
|
||||
void setListeningPortsRange(std::pair<unsigned short, unsigned short> ports);
|
||||
|
@ -178,12 +168,9 @@ class bittorrent : public QObject {
|
|||
void enableLSD(bool b);
|
||||
bool enableDHT(bool b);
|
||||
void setTimerScanInterval(int secs);
|
||||
void setMaxActiveDownloads(int val);
|
||||
void setMaxActiveTorrents(int val);
|
||||
void setETACalculation(bool enable);
|
||||
void addConsoleMessage(QString msg, QColor color=QApplication::palette().color(QPalette::WindowText));
|
||||
void addPeerBanMessage(QString msg, bool from_ipfilter);
|
||||
void fixTorrentPriorities();
|
||||
|
||||
protected slots:
|
||||
void scanDirectory();
|
||||
|
|
188
src/options.ui
188
src/options.ui
|
@ -22,16 +22,7 @@
|
|||
<property name="spacing" >
|
||||
<number>6</number>
|
||||
</property>
|
||||
<property name="leftMargin" >
|
||||
<number>9</number>
|
||||
</property>
|
||||
<property name="topMargin" >
|
||||
<number>9</number>
|
||||
</property>
|
||||
<property name="rightMargin" >
|
||||
<number>9</number>
|
||||
</property>
|
||||
<property name="bottomMargin" >
|
||||
<property name="margin" >
|
||||
<number>9</number>
|
||||
</property>
|
||||
<item>
|
||||
|
@ -87,7 +78,8 @@
|
|||
<string>General</string>
|
||||
</attribute>
|
||||
<attribute name="icon" >
|
||||
<iconset resource="icons.qrc" >:/Icons/star.png</iconset>
|
||||
<iconset resource="icons.qrc" >
|
||||
<normaloff>:/Icons/star.png</normaloff>:/Icons/star.png</iconset>
|
||||
</attribute>
|
||||
<layout class="QVBoxLayout" >
|
||||
<item>
|
||||
|
@ -120,7 +112,7 @@
|
|||
<property name="orientation" >
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
<property name="sizeHint" >
|
||||
<property name="sizeHint" stdset="0" >
|
||||
<size>
|
||||
<width>40</width>
|
||||
<height>20</height>
|
||||
|
@ -189,7 +181,7 @@
|
|||
<property name="orientation" >
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
<property name="sizeHint" >
|
||||
<property name="sizeHint" stdset="0" >
|
||||
<size>
|
||||
<width>40</width>
|
||||
<height>20</height>
|
||||
|
@ -260,7 +252,7 @@
|
|||
<property name="orientation" >
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
<property name="sizeHint" >
|
||||
<property name="sizeHint" stdset="0" >
|
||||
<size>
|
||||
<width>40</width>
|
||||
<height>20</height>
|
||||
|
@ -328,7 +320,7 @@
|
|||
<property name="orientation" >
|
||||
<enum>Qt::Vertical</enum>
|
||||
</property>
|
||||
<property name="sizeHint" >
|
||||
<property name="sizeHint" stdset="0" >
|
||||
<size>
|
||||
<width>623</width>
|
||||
<height>20</height>
|
||||
|
@ -343,7 +335,8 @@
|
|||
<string>Downloads</string>
|
||||
</attribute>
|
||||
<attribute name="icon" >
|
||||
<iconset resource="icons.qrc" >:/Icons/download.png</iconset>
|
||||
<iconset resource="icons.qrc" >
|
||||
<normaloff>:/Icons/download.png</normaloff>:/Icons/download.png</iconset>
|
||||
</attribute>
|
||||
<layout class="QVBoxLayout" >
|
||||
<item>
|
||||
|
@ -370,16 +363,7 @@
|
|||
<property name="spacing" >
|
||||
<number>6</number>
|
||||
</property>
|
||||
<property name="leftMargin" >
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="topMargin" >
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="rightMargin" >
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="bottomMargin" >
|
||||
<property name="margin" >
|
||||
<number>0</number>
|
||||
</property>
|
||||
<item>
|
||||
|
@ -387,16 +371,7 @@
|
|||
<property name="spacing" >
|
||||
<number>6</number>
|
||||
</property>
|
||||
<property name="leftMargin" >
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="topMargin" >
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="rightMargin" >
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="bottomMargin" >
|
||||
<property name="margin" >
|
||||
<number>0</number>
|
||||
</property>
|
||||
<item>
|
||||
|
@ -456,7 +431,7 @@
|
|||
<property name="orientation" >
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
<property name="sizeHint" >
|
||||
<property name="sizeHint" stdset="0" >
|
||||
<size>
|
||||
<width>40</width>
|
||||
<height>20</height>
|
||||
|
@ -500,16 +475,7 @@
|
|||
<property name="spacing" >
|
||||
<number>6</number>
|
||||
</property>
|
||||
<property name="leftMargin" >
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="topMargin" >
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="rightMargin" >
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="bottomMargin" >
|
||||
<property name="margin" >
|
||||
<number>0</number>
|
||||
</property>
|
||||
<item>
|
||||
|
@ -619,7 +585,7 @@
|
|||
<property name="orientation" >
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
<property name="sizeHint" >
|
||||
<property name="sizeHint" stdset="0" >
|
||||
<size>
|
||||
<width>40</width>
|
||||
<height>20</height>
|
||||
|
@ -662,7 +628,7 @@
|
|||
<property name="orientation" >
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
<property name="sizeHint" >
|
||||
<property name="sizeHint" stdset="0" >
|
||||
<size>
|
||||
<width>40</width>
|
||||
<height>20</height>
|
||||
|
@ -682,7 +648,8 @@
|
|||
<string>Connection</string>
|
||||
</attribute>
|
||||
<attribute name="icon" >
|
||||
<iconset resource="icons.qrc" >:/Icons/connection.png</iconset>
|
||||
<iconset resource="icons.qrc" >
|
||||
<normaloff>:/Icons/connection.png</normaloff>:/Icons/connection.png</iconset>
|
||||
</attribute>
|
||||
<layout class="QVBoxLayout" >
|
||||
<item>
|
||||
|
@ -745,7 +712,7 @@
|
|||
<property name="orientation" >
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
<property name="sizeHint" >
|
||||
<property name="sizeHint" stdset="0" >
|
||||
<size>
|
||||
<width>20</width>
|
||||
<height>20</height>
|
||||
|
@ -904,7 +871,7 @@
|
|||
<property name="orientation" >
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
<property name="sizeHint" >
|
||||
<property name="sizeHint" stdset="0" >
|
||||
<size>
|
||||
<width>40</width>
|
||||
<height>20</height>
|
||||
|
@ -922,7 +889,7 @@
|
|||
<property name="orientation" >
|
||||
<enum>Qt::Vertical</enum>
|
||||
</property>
|
||||
<property name="sizeHint" >
|
||||
<property name="sizeHint" stdset="0" >
|
||||
<size>
|
||||
<width>623</width>
|
||||
<height>121</height>
|
||||
|
@ -937,7 +904,8 @@
|
|||
<string>Bittorrent</string>
|
||||
</attribute>
|
||||
<attribute name="icon" >
|
||||
<iconset resource="icons.qrc" >:/Icons/bt_settings.png</iconset>
|
||||
<iconset resource="icons.qrc" >
|
||||
<normaloff>:/Icons/bt_settings.png</normaloff>:/Icons/bt_settings.png</iconset>
|
||||
</attribute>
|
||||
<layout class="QVBoxLayout" >
|
||||
<item>
|
||||
|
@ -984,7 +952,7 @@
|
|||
<property name="orientation" >
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
<property name="sizeHint" >
|
||||
<property name="sizeHint" stdset="0" >
|
||||
<size>
|
||||
<width>40</width>
|
||||
<height>20</height>
|
||||
|
@ -1029,7 +997,7 @@
|
|||
<property name="orientation" >
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
<property name="sizeHint" >
|
||||
<property name="sizeHint" stdset="0" >
|
||||
<size>
|
||||
<width>40</width>
|
||||
<height>20</height>
|
||||
|
@ -1071,7 +1039,7 @@
|
|||
<property name="orientation" >
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
<property name="sizeHint" >
|
||||
<property name="sizeHint" stdset="0" >
|
||||
<size>
|
||||
<width>40</width>
|
||||
<height>20</height>
|
||||
|
@ -1160,7 +1128,7 @@
|
|||
<property name="orientation" >
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
<property name="sizeHint" >
|
||||
<property name="sizeHint" stdset="0" >
|
||||
<size>
|
||||
<width>40</width>
|
||||
<height>20</height>
|
||||
|
@ -1223,7 +1191,7 @@
|
|||
<property name="orientation" >
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
<property name="sizeHint" >
|
||||
<property name="sizeHint" stdset="0" >
|
||||
<size>
|
||||
<width>40</width>
|
||||
<height>20</height>
|
||||
|
@ -1277,7 +1245,7 @@
|
|||
<property name="orientation" >
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
<property name="sizeHint" >
|
||||
<property name="sizeHint" stdset="0" >
|
||||
<size>
|
||||
<width>40</width>
|
||||
<height>20</height>
|
||||
|
@ -1295,7 +1263,7 @@
|
|||
<property name="orientation" >
|
||||
<enum>Qt::Vertical</enum>
|
||||
</property>
|
||||
<property name="sizeHint" >
|
||||
<property name="sizeHint" stdset="0" >
|
||||
<size>
|
||||
<width>20</width>
|
||||
<height>40</height>
|
||||
|
@ -1310,7 +1278,8 @@
|
|||
<string>Proxy</string>
|
||||
</attribute>
|
||||
<attribute name="icon" >
|
||||
<iconset resource="icons.qrc" >:/Icons/proxy.png</iconset>
|
||||
<iconset resource="icons.qrc" >
|
||||
<normaloff>:/Icons/proxy.png</normaloff>:/Icons/proxy.png</iconset>
|
||||
</attribute>
|
||||
<layout class="QVBoxLayout" >
|
||||
<item>
|
||||
|
@ -1396,7 +1365,7 @@
|
|||
<property name="orientation" >
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
<property name="sizeHint" >
|
||||
<property name="sizeHint" stdset="0" >
|
||||
<size>
|
||||
<width>21</width>
|
||||
<height>29</height>
|
||||
|
@ -1485,7 +1454,7 @@
|
|||
<property name="orientation" >
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
<property name="sizeHint" >
|
||||
<property name="sizeHint" stdset="0" >
|
||||
<size>
|
||||
<width>40</width>
|
||||
<height>20</height>
|
||||
|
@ -1591,7 +1560,7 @@
|
|||
<property name="orientation" >
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
<property name="sizeHint" >
|
||||
<property name="sizeHint" stdset="0" >
|
||||
<size>
|
||||
<width>21</width>
|
||||
<height>29</height>
|
||||
|
@ -1680,7 +1649,7 @@
|
|||
<property name="orientation" >
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
<property name="sizeHint" >
|
||||
<property name="sizeHint" stdset="0" >
|
||||
<size>
|
||||
<width>40</width>
|
||||
<height>20</height>
|
||||
|
@ -1784,9 +1753,10 @@
|
|||
<string>Misc</string>
|
||||
</attribute>
|
||||
<attribute name="icon" >
|
||||
<iconset resource="icons.qrc" >:/Icons/configure.png</iconset>
|
||||
<iconset resource="icons.qrc" >
|
||||
<normaloff>:/Icons/configure.png</normaloff>:/Icons/configure.png</iconset>
|
||||
</attribute>
|
||||
<layout class="QVBoxLayout" >
|
||||
<layout class="QVBoxLayout" name="verticalLayout_2" >
|
||||
<item>
|
||||
<widget class="QGroupBox" name="filterBox" >
|
||||
<property name="enabled" >
|
||||
|
@ -1802,7 +1772,8 @@
|
|||
<string>Activate IP Filtering</string>
|
||||
</property>
|
||||
<property name="icon" >
|
||||
<iconset resource="icons.qrc" >:/Icons/filter.png</iconset>
|
||||
<iconset resource="icons.qrc" >
|
||||
<normaloff>:/Icons/filter.png</normaloff>:/Icons/filter.png</iconset>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
|
@ -1925,7 +1896,7 @@
|
|||
<property name="orientation" >
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
<property name="sizeHint" >
|
||||
<property name="sizeHint" stdset="0" >
|
||||
<size>
|
||||
<width>40</width>
|
||||
<height>20</height>
|
||||
|
@ -1959,7 +1930,7 @@
|
|||
<property name="orientation" >
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
<property name="sizeHint" >
|
||||
<property name="sizeHint" stdset="0" >
|
||||
<size>
|
||||
<width>40</width>
|
||||
<height>20</height>
|
||||
|
@ -1984,7 +1955,7 @@
|
|||
<property name="title" >
|
||||
<string>Torrent queueing</string>
|
||||
</property>
|
||||
<layout class="QVBoxLayout" >
|
||||
<layout class="QVBoxLayout" name="verticalLayout" >
|
||||
<item>
|
||||
<widget class="QCheckBox" name="checkEnableQueueing" >
|
||||
<property name="text" >
|
||||
|
@ -1995,7 +1966,7 @@
|
|||
<item>
|
||||
<layout class="QHBoxLayout" >
|
||||
<item>
|
||||
<widget class="QLabel" name="label_max_active" >
|
||||
<widget class="QLabel" name="label_max_active_dl" >
|
||||
<property name="enabled" >
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
|
@ -2025,7 +1996,50 @@
|
|||
<property name="orientation" >
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
<property name="sizeHint" >
|
||||
<property name="sizeHint" stdset="0" >
|
||||
<size>
|
||||
<width>40</width>
|
||||
<height>20</height>
|
||||
</size>
|
||||
</property>
|
||||
</spacer>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
<item>
|
||||
<layout class="QHBoxLayout" name="_2" >
|
||||
<item>
|
||||
<widget class="QLabel" name="label_max_active_up" >
|
||||
<property name="enabled" >
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
<property name="text" >
|
||||
<string>Maximum active uploads:</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QSpinBox" name="spinMaxActiveUploads" >
|
||||
<property name="enabled" >
|
||||
<bool>false</bool>
|
||||
</property>
|
||||
<property name="minimum" >
|
||||
<number>1</number>
|
||||
</property>
|
||||
<property name="maximum" >
|
||||
<number>999</number>
|
||||
</property>
|
||||
<property name="value" >
|
||||
<number>3</number>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<spacer>
|
||||
<property name="orientation" >
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
<property name="sizeHint" stdset="0" >
|
||||
<size>
|
||||
<width>40</width>
|
||||
<height>20</height>
|
||||
|
@ -2068,7 +2082,7 @@
|
|||
<property name="orientation" >
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
<property name="sizeHint" >
|
||||
<property name="sizeHint" stdset="0" >
|
||||
<size>
|
||||
<width>381</width>
|
||||
<height>20</height>
|
||||
|
@ -2086,7 +2100,7 @@
|
|||
<property name="orientation" >
|
||||
<enum>Qt::Vertical</enum>
|
||||
</property>
|
||||
<property name="sizeHint" >
|
||||
<property name="sizeHint" stdset="0" >
|
||||
<size>
|
||||
<width>623</width>
|
||||
<height>20</height>
|
||||
|
@ -2101,7 +2115,8 @@
|
|||
<string>Web UI</string>
|
||||
</attribute>
|
||||
<attribute name="icon" >
|
||||
<iconset resource="icons.qrc" >:/Icons/password.png</iconset>
|
||||
<iconset resource="icons.qrc" >
|
||||
<normaloff>:/Icons/password.png</normaloff>:/Icons/password.png</iconset>
|
||||
</attribute>
|
||||
<layout class="QVBoxLayout" >
|
||||
<item>
|
||||
|
@ -2154,7 +2169,7 @@
|
|||
<property name="orientation" >
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
<property name="sizeHint" >
|
||||
<property name="sizeHint" stdset="0" >
|
||||
<size>
|
||||
<width>21</width>
|
||||
<height>29</height>
|
||||
|
@ -2239,7 +2254,7 @@
|
|||
<property name="orientation" >
|
||||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
<property name="sizeHint" >
|
||||
<property name="sizeHint" stdset="0" >
|
||||
<size>
|
||||
<width>198</width>
|
||||
<height>57</height>
|
||||
|
@ -2255,7 +2270,7 @@
|
|||
<property name="orientation" >
|
||||
<enum>Qt::Vertical</enum>
|
||||
</property>
|
||||
<property name="sizeHint" >
|
||||
<property name="sizeHint" stdset="0" >
|
||||
<size>
|
||||
<width>623</width>
|
||||
<height>41</height>
|
||||
|
@ -2272,16 +2287,7 @@
|
|||
<property name="spacing" >
|
||||
<number>6</number>
|
||||
</property>
|
||||
<property name="leftMargin" >
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="topMargin" >
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="rightMargin" >
|
||||
<number>0</number>
|
||||
</property>
|
||||
<property name="bottomMargin" >
|
||||
<property name="margin" >
|
||||
<number>0</number>
|
||||
</property>
|
||||
<item>
|
||||
|
@ -2290,7 +2296,7 @@
|
|||
<enum>Qt::Horizontal</enum>
|
||||
</property>
|
||||
<property name="standardButtons" >
|
||||
<set>QDialogButtonBox::Apply|QDialogButtonBox::Cancel|QDialogButtonBox::NoButton|QDialogButtonBox::Ok</set>
|
||||
<set>QDialogButtonBox::Apply|QDialogButtonBox::Cancel|QDialogButtonBox::Ok</set>
|
||||
</property>
|
||||
<property name="centerButtons" >
|
||||
<bool>true</bool>
|
||||
|
|
|
@ -385,6 +385,7 @@ void options_imp::saveOptions(){
|
|||
settings.beginGroup("Queueing");
|
||||
settings.setValue(QString::fromUtf8("QueueingEnabled"), isQueueingSystemEnabled());
|
||||
settings.setValue(QString::fromUtf8("MaxActiveDownloads"), spinMaxActiveDownloads->value());
|
||||
settings.setValue(QString::fromUtf8("MaxActiveUploads"), spinMaxActiveUploads->value());
|
||||
settings.setValue(QString::fromUtf8("MaxActiveTorrents"), spinMaxActiveTorrents->value());
|
||||
// End Queueing system preferences
|
||||
settings.endGroup();
|
||||
|
@ -703,6 +704,7 @@ void options_imp::loadOptions(){
|
|||
if(isQueueingSystemEnabled()) {
|
||||
enableQueueingSystem(2); // Enable
|
||||
spinMaxActiveDownloads->setValue(settings.value(QString::fromUtf8("MaxActiveDownloads"), 3).toInt());
|
||||
spinMaxActiveUploads->setValue(settings.value(QString::fromUtf8("MaxActiveUploads"), 3).toInt());
|
||||
spinMaxActiveTorrents->setValue(settings.value(QString::fromUtf8("MaxActiveTorrents"), 5).toInt());
|
||||
} else {
|
||||
enableQueueingSystem(0); // Disable
|
||||
|
@ -734,6 +736,10 @@ int options_imp::getMaxActiveDownloads() const {
|
|||
return spinMaxActiveDownloads->value();
|
||||
}
|
||||
|
||||
int options_imp::getMaxActiveUploads() const {
|
||||
return spinMaxActiveUploads->value();
|
||||
}
|
||||
|
||||
int options_imp::getMaxActiveTorrents() const {
|
||||
return spinMaxActiveTorrents->value();
|
||||
}
|
||||
|
@ -927,13 +933,17 @@ void options_imp::enableQueueingSystem(int checkBoxValue) {
|
|||
if(checkBoxValue != 2) {
|
||||
//Disable
|
||||
spinMaxActiveDownloads->setEnabled(false);
|
||||
label_max_active->setEnabled(false);
|
||||
spinMaxActiveUploads->setEnabled(false);
|
||||
label_max_active_dl->setEnabled(false);
|
||||
label_max_active_up->setEnabled(false);
|
||||
maxActiveTorrents_lbl->setEnabled(false);
|
||||
spinMaxActiveTorrents->setEnabled(false);
|
||||
}else{
|
||||
//enable
|
||||
spinMaxActiveDownloads->setEnabled(true);
|
||||
label_max_active->setEnabled(true);
|
||||
spinMaxActiveUploads->setEnabled(true);
|
||||
label_max_active_dl->setEnabled(true);
|
||||
label_max_active_up->setEnabled(true);
|
||||
maxActiveTorrents_lbl->setEnabled(true);
|
||||
spinMaxActiveTorrents->setEnabled(true);
|
||||
}
|
||||
|
|
|
@ -119,6 +119,7 @@ class options_imp : public QDialog, private Ui::Dialog {
|
|||
// Queueing system
|
||||
bool isQueueingSystemEnabled() const;
|
||||
int getMaxActiveDownloads() const;
|
||||
int getMaxActiveUploads() const;
|
||||
int getMaxActiveTorrents() const;
|
||||
bool isWebUiEnabled() const;
|
||||
quint16 webUiPort() const;
|
||||
|
|
|
@ -266,6 +266,11 @@ QStringList QTorrentHandle::files_path() const {
|
|||
return res;
|
||||
}
|
||||
|
||||
int QTorrentHandle::queue_position() const {
|
||||
Q_ASSERT(h.is_valid());
|
||||
return h.queue_position();
|
||||
}
|
||||
|
||||
int QTorrentHandle::num_uploads() const {
|
||||
Q_ASSERT(h.is_valid());
|
||||
return h.status().num_uploads;
|
||||
|
@ -335,6 +340,17 @@ void QTorrentHandle::replace_trackers(std::vector<announce_entry> const& v) cons
|
|||
h.replace_trackers(v);
|
||||
}
|
||||
|
||||
void QTorrentHandle::queue_position_down() const {
|
||||
Q_ASSERT(h.is_valid());
|
||||
h.queue_position_down();
|
||||
}
|
||||
|
||||
void QTorrentHandle::queue_position_up() const {
|
||||
Q_ASSERT(h.is_valid());
|
||||
h.queue_position_up();
|
||||
|
||||
}
|
||||
|
||||
void QTorrentHandle::force_reannounce() {
|
||||
Q_ASSERT(h.is_valid());
|
||||
h.force_reannounce();
|
||||
|
|
|
@ -77,6 +77,7 @@ class QTorrentHandle {
|
|||
int num_files() const;
|
||||
bool has_metadata() const;
|
||||
void save_resume_data() const;
|
||||
int queue_position() const;
|
||||
QString file_at(unsigned int index) const;
|
||||
size_type filesize_at(unsigned int index) const;
|
||||
std::vector<announce_entry> const& trackers() const;
|
||||
|
@ -111,6 +112,8 @@ class QTorrentHandle {
|
|||
void force_reannounce();
|
||||
void set_sequential_download(bool);
|
||||
void set_tracker_login(QString username, QString password);
|
||||
void queue_position_down() const;
|
||||
void queue_position_up() const;
|
||||
|
||||
//
|
||||
// Operators
|
||||
|
|
Loading…
Reference in a new issue