mirror of
https://github.com/qbittorrent/qBittorrent.git
synced 2025-01-06 15:04:34 +08:00
- Make use of new torrent_checked_alert that was just included in libtorrent. This allowed to improve torrent that just finished checking handling and progress column sorting. Also allowed to optimize cpu/memory usage a little.
This commit is contained in:
parent
55834ba5db
commit
13f21ef6cd
6
TODO
6
TODO
@ -46,10 +46,8 @@
|
|||||||
- wait for fastresume data on exit should be in a thread?
|
- wait for fastresume data on exit should be in a thread?
|
||||||
* beta5
|
* beta5
|
||||||
- Translations update (IN PROGRESS)
|
- Translations update (IN PROGRESS)
|
||||||
- make use of finishedChecking alert if hydri applies my patch for this
|
|
||||||
- Clean up delayed progress column sorting code
|
|
||||||
- Clean up pause after checking code
|
|
||||||
- Check incremental download (looks broken)
|
- Check incremental download (looks broken)
|
||||||
|
- improve torrentFinishedList with new alert
|
||||||
- Wait for some bug fixes in libtorrent :
|
- Wait for some bug fixes in libtorrent :
|
||||||
- upload/download limit per torrent (Ticket #83)
|
- upload/download limit per torrent (Ticket #83)
|
||||||
|
|
||||||
@ -69,6 +67,8 @@ LANGUAGES UPDATED:
|
|||||||
|
|
||||||
beta4->beta5 changelog:
|
beta4->beta5 changelog:
|
||||||
- FEATURE: Supports Bittorrent FAST extension
|
- FEATURE: Supports Bittorrent FAST extension
|
||||||
|
- FEATURE: Improved code handling torrents that have just finished checking
|
||||||
|
- FEATURE: Improved progress column sorting code
|
||||||
- BUGFIX: Wait for torrent_paused_alert before saving fast resume data on exit
|
- BUGFIX: Wait for torrent_paused_alert before saving fast resume data on exit
|
||||||
- BUGFIX: Wait for torrent_paused_alert before reloading a torrent for full allocation mode
|
- BUGFIX: Wait for torrent_paused_alert before reloading a torrent for full allocation mode
|
||||||
- BUFFIG: Fixed overflow causing ratio data to be negative
|
- BUFFIG: Fixed overflow causing ratio data to be negative
|
||||||
|
@ -173,23 +173,6 @@ void FinishedTorrents::updateFinishedList(){
|
|||||||
std::cerr << "ERROR: Can't find torrent in finished list\n";
|
std::cerr << "ERROR: Can't find torrent in finished list\n";
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
if(BTSession->getTorrentsToPauseAfterChecking().indexOf(hash) != -1){
|
|
||||||
// Pause torrent if it finished checking and it is was supposed to be paused.
|
|
||||||
// This is a trick to see the progress of the pause torrents on startup
|
|
||||||
if(torrentStatus.state != torrent_status::checking_files && torrentStatus.state != torrent_status::queued_for_checking){
|
|
||||||
qDebug("Paused torrent finished checking with state: %d", torrentStatus.state);
|
|
||||||
finishedListModel->setData(finishedListModel->index(row, F_PROGRESS), QVariant((double)torrentStatus.progress));
|
|
||||||
finishedListModel->setData(finishedListModel->index(row, F_NAME), QVariant(QIcon(":/Icons/skin/paused.png")), Qt::DecorationRole);
|
|
||||||
setRowColor(row, "red");
|
|
||||||
BTSession->pauseTorrent(hash);
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if(BTSession->getUncheckedTorrentsList().indexOf(hash) != -1){
|
|
||||||
if(torrentStatus.state != torrent_status::checking_files && torrentStatus.state != torrent_status::queued_for_checking){
|
|
||||||
BTSession->setTorrentFinishedChecking(hash);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if(h.is_paused()) continue;
|
if(h.is_paused()) continue;
|
||||||
if(torrentStatus.state == torrent_status::downloading || (torrentStatus.state != torrent_status::checking_files && torrentStatus.state != torrent_status::queued_for_checking && torrentStatus.progress != 1.)) {
|
if(torrentStatus.state == torrent_status::downloading || (torrentStatus.state != torrent_status::checking_files && torrentStatus.state != torrent_status::queued_for_checking && torrentStatus.progress != 1.)) {
|
||||||
// What are you doing here? go back to download tab!
|
// What are you doing here? go back to download tab!
|
||||||
|
64
src/GUI.cpp
64
src/GUI.cpp
@ -138,7 +138,6 @@ GUI::GUI(QWidget *parent, QStringList torrentCmdLine) : QMainWindow(parent){
|
|||||||
connect(BTSession, SIGNAL(finishedTorrent(torrent_handle&)), this, SLOT(finishedTorrent(torrent_handle&)));
|
connect(BTSession, SIGNAL(finishedTorrent(torrent_handle&)), this, SLOT(finishedTorrent(torrent_handle&)));
|
||||||
connect(BTSession, SIGNAL(fullDiskError(torrent_handle&)), this, SLOT(fullDiskError(torrent_handle&)));
|
connect(BTSession, SIGNAL(fullDiskError(torrent_handle&)), this, SLOT(fullDiskError(torrent_handle&)));
|
||||||
connect(BTSession, SIGNAL(portListeningFailure()), this, SLOT(portListeningFailure()));
|
connect(BTSession, SIGNAL(portListeningFailure()), this, SLOT(portListeningFailure()));
|
||||||
connect(BTSession,SIGNAL(allTorrentsFinishedChecking()), this, SLOT(sortProgressColumnDelayed()));
|
|
||||||
connect(BTSession, SIGNAL(trackerAuthenticationRequired(torrent_handle&)), this, SLOT(trackerAuthenticationRequired(torrent_handle&)));
|
connect(BTSession, SIGNAL(trackerAuthenticationRequired(torrent_handle&)), this, SLOT(trackerAuthenticationRequired(torrent_handle&)));
|
||||||
connect(BTSession, SIGNAL(peerBlocked(QString)), this, SLOT(addLogPeerBlocked(const QString)));
|
connect(BTSession, SIGNAL(peerBlocked(QString)), this, SLOT(addLogPeerBlocked(const QString)));
|
||||||
connect(BTSession, SIGNAL(fastResumeDataRejected(QString)), this, SLOT(addFastResumeRejectedAlert(QString)));
|
connect(BTSession, SIGNAL(fastResumeDataRejected(QString)), this, SLOT(addFastResumeRejectedAlert(QString)));
|
||||||
@ -147,6 +146,7 @@ GUI::GUI(QWidget *parent, QStringList torrentCmdLine) : QMainWindow(parent){
|
|||||||
connect(BTSession, SIGNAL(downloadFromUrlFailure(QString, QString)), this, SLOT(handleDownloadFromUrlFailure(QString, QString)));
|
connect(BTSession, SIGNAL(downloadFromUrlFailure(QString, QString)), this, SLOT(handleDownloadFromUrlFailure(QString, QString)));
|
||||||
connect(BTSession, SIGNAL(aboutToDownloadFromUrl(QString)), this, SLOT(displayDownloadingUrlInfos(QString)));
|
connect(BTSession, SIGNAL(aboutToDownloadFromUrl(QString)), this, SLOT(displayDownloadingUrlInfos(QString)));
|
||||||
connect(BTSession, SIGNAL(urlSeedProblem(QString, QString)), this, SLOT(addUrlSeedError(QString, QString)));
|
connect(BTSession, SIGNAL(urlSeedProblem(QString, QString)), this, SLOT(addUrlSeedError(QString, QString)));
|
||||||
|
connect(BTSession, SIGNAL(torrentFinishedChecking(QString)), this, SLOT(torrentChecked(QString)));
|
||||||
// creating options
|
// creating options
|
||||||
options = new options_imp(this);
|
options = new options_imp(this);
|
||||||
connect(options, SIGNAL(status_changed(QString, bool)), this, SLOT(OptionsSaved(QString, bool)));
|
connect(options, SIGNAL(status_changed(QString, bool)), this, SLOT(OptionsSaved(QString, bool)));
|
||||||
@ -562,23 +562,6 @@ void GUI::updateDlList(bool force){
|
|||||||
row = getRowFromHash(fileHash);
|
row = getRowFromHash(fileHash);
|
||||||
}
|
}
|
||||||
Q_ASSERT(row != -1);
|
Q_ASSERT(row != -1);
|
||||||
if(BTSession->getTorrentsToPauseAfterChecking().indexOf(fileHash) != -1){
|
|
||||||
// Pause torrent if it finished checking and it is was supposed to be paused.
|
|
||||||
// This is a trick to see the progress of the pause torrents on startup
|
|
||||||
if(torrentStatus.state != torrent_status::checking_files && torrentStatus.state != torrent_status::queued_for_checking){
|
|
||||||
qDebug("Paused torrent finished checking with state: %d", torrentStatus.state);
|
|
||||||
DLListModel->setData(DLListModel->index(row, PROGRESS), QVariant((double)torrentStatus.progress));
|
|
||||||
DLListModel->setData(DLListModel->index(row, NAME), QVariant(QIcon(":/Icons/skin/paused.png")), Qt::DecorationRole);
|
|
||||||
setRowColor(row, "red");
|
|
||||||
BTSession->pauseTorrent(fileHash);
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if(delayedSorting && BTSession->getUncheckedTorrentsList().indexOf(fileHash) != -1){
|
|
||||||
if(torrentStatus.state != torrent_status::checking_files && torrentStatus.state != torrent_status::queued_for_checking){
|
|
||||||
BTSession->setTorrentFinishedChecking(fileHash);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
// No need to update a paused torrent
|
// No need to update a paused torrent
|
||||||
if(h.is_paused()) continue;
|
if(h.is_paused()) continue;
|
||||||
// Parse download state
|
// Parse download state
|
||||||
@ -924,7 +907,7 @@ void GUI::dropEvent(QDropEvent *event){
|
|||||||
}
|
}
|
||||||
if(useTorrentAdditionDialog){
|
if(useTorrentAdditionDialog){
|
||||||
torrentAdditionDialog *dialog = new torrentAdditionDialog(this);
|
torrentAdditionDialog *dialog = new torrentAdditionDialog(this);
|
||||||
connect(dialog, SIGNAL(torrentAddition(QString, bool, bool, QString)), BTSession, SLOT(addTorrent(QString, bool, bool, QString)));
|
connect(dialog, SIGNAL(torrentAddition(QString, bool, QString)), BTSession, SLOT(addTorrent(QString, bool, QString)));
|
||||||
connect(dialog, SIGNAL(setInfoBarGUI(QString, QString)), this, SLOT(setInfoBar(QString, QString)));
|
connect(dialog, SIGNAL(setInfoBarGUI(QString, QString)), this, SLOT(setInfoBar(QString, QString)));
|
||||||
dialog->showLoad(file);
|
dialog->showLoad(file);
|
||||||
}else{
|
}else{
|
||||||
@ -963,7 +946,7 @@ void GUI::on_actionOpen_triggered(){
|
|||||||
for(unsigned int i=0; i<listSize; ++i){
|
for(unsigned int i=0; i<listSize; ++i){
|
||||||
if(useTorrentAdditionDialog){
|
if(useTorrentAdditionDialog){
|
||||||
torrentAdditionDialog *dialog = new torrentAdditionDialog(this);
|
torrentAdditionDialog *dialog = new torrentAdditionDialog(this);
|
||||||
connect(dialog, SIGNAL(torrentAddition(QString, bool, bool, QString)), BTSession, SLOT(addTorrent(QString, bool, bool, QString)));
|
connect(dialog, SIGNAL(torrentAddition(QString, bool, QString)), BTSession, SLOT(addTorrent(QString, bool, QString)));
|
||||||
connect(dialog, SIGNAL(setInfoBarGUI(QString, QString)), this, SLOT(setInfoBar(QString, QString)));
|
connect(dialog, SIGNAL(setInfoBarGUI(QString, QString)), this, SLOT(setInfoBar(QString, QString)));
|
||||||
dialog->showLoad(pathsList.at(i));
|
dialog->showLoad(pathsList.at(i));
|
||||||
}else{
|
}else{
|
||||||
@ -1184,7 +1167,7 @@ void GUI::processParams(const QStringList& params){
|
|||||||
}else{
|
}else{
|
||||||
if(useTorrentAdditionDialog){
|
if(useTorrentAdditionDialog){
|
||||||
torrentAdditionDialog *dialog = new torrentAdditionDialog(this);
|
torrentAdditionDialog *dialog = new torrentAdditionDialog(this);
|
||||||
connect(dialog, SIGNAL(torrentAddition(QString, bool, bool, QString)), BTSession, SLOT(addTorrent(QString, bool, bool, QString)));
|
connect(dialog, SIGNAL(torrentAddition(QString, bool, QString)), BTSession, SLOT(addTorrent(QString, bool, QString)));
|
||||||
connect(dialog, SIGNAL(setInfoBarGUI(QString, QString)), this, SLOT(setInfoBar(QString, QString)));
|
connect(dialog, SIGNAL(setInfoBarGUI(QString, QString)), this, SLOT(setInfoBar(QString, QString)));
|
||||||
dialog->showLoad(param);
|
dialog->showLoad(param);
|
||||||
}else{
|
}else{
|
||||||
@ -1201,7 +1184,7 @@ void GUI::processScannedFiles(const QStringList& params){
|
|||||||
foreach(param, params){
|
foreach(param, params){
|
||||||
if(useTorrentAdditionDialog){
|
if(useTorrentAdditionDialog){
|
||||||
torrentAdditionDialog *dialog = new torrentAdditionDialog(this);
|
torrentAdditionDialog *dialog = new torrentAdditionDialog(this);
|
||||||
connect(dialog, SIGNAL(torrentAddition(QString, bool, bool, QString)), BTSession, SLOT(addTorrent(QString, bool, bool, QString)));
|
connect(dialog, SIGNAL(torrentAddition(QString, bool, QString)), BTSession, SLOT(addTorrent(QString, bool, QString)));
|
||||||
connect(dialog, SIGNAL(setInfoBarGUI(QString, QString)), this, SLOT(setInfoBar(QString, QString)));
|
connect(dialog, SIGNAL(setInfoBarGUI(QString, QString)), this, SLOT(setInfoBar(QString, QString)));
|
||||||
dialog->showLoad(param, true);
|
dialog->showLoad(param, true);
|
||||||
}else{
|
}else{
|
||||||
@ -1215,11 +1198,11 @@ void GUI::processDownloadedFiles(QString path, QString url){
|
|||||||
bool useTorrentAdditionDialog = settings.value("Options/Misc/TorrentAdditionDialog/Enabled", true).toBool();
|
bool useTorrentAdditionDialog = settings.value("Options/Misc/TorrentAdditionDialog/Enabled", true).toBool();
|
||||||
if(useTorrentAdditionDialog){
|
if(useTorrentAdditionDialog){
|
||||||
torrentAdditionDialog *dialog = new torrentAdditionDialog(this);
|
torrentAdditionDialog *dialog = new torrentAdditionDialog(this);
|
||||||
connect(dialog, SIGNAL(torrentAddition(QString, bool, bool, QString)), BTSession, SLOT(addTorrent(QString, bool, bool, QString)));
|
connect(dialog, SIGNAL(torrentAddition(QString, bool, QString)), BTSession, SLOT(addTorrent(QString, bool, QString)));
|
||||||
connect(dialog, SIGNAL(setInfoBarGUI(QString, QString)), this, SLOT(setInfoBar(QString, QString)));
|
connect(dialog, SIGNAL(setInfoBarGUI(QString, QString)), this, SLOT(setInfoBar(QString, QString)));
|
||||||
dialog->showLoad(path, false, url);
|
dialog->showLoad(path, false, url);
|
||||||
}else{
|
}else{
|
||||||
BTSession->addTorrent(path, false, false, url);
|
BTSession->addTorrent(path, false, url);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1614,6 +1597,39 @@ void GUI::finishedTorrent(torrent_handle& h){
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Called when a torrent finished checking
|
||||||
|
void GUI::torrentChecked(QString hash){
|
||||||
|
// Check if the torrent was paused after checking
|
||||||
|
if(BTSession->isPaused(hash)){
|
||||||
|
// Was paused, change its icon/color
|
||||||
|
if(finishedTorrentTab->getFinishedSHAs().indexOf(hash) != -1){
|
||||||
|
// In finished list
|
||||||
|
qDebug("Automatically paused torrent was in finished list");
|
||||||
|
int row = finishedTorrentTab->getRowFromHash(hash);
|
||||||
|
finishedTorrentTab->getFinishedListModel()->setData(finishedTorrentTab->getFinishedListModel()->index(row, F_UPSPEED), QVariant((double)0.0));
|
||||||
|
finishedTorrentTab->getFinishedListModel()->setData(finishedTorrentTab->getFinishedListModel()->index(row, F_NAME), QIcon(":/Icons/skin/paused.png"), Qt::DecorationRole);
|
||||||
|
finishedTorrentTab->setRowColor(row, "red");
|
||||||
|
}else{
|
||||||
|
// In download list
|
||||||
|
int row = getRowFromHash(hash);
|
||||||
|
DLListModel->setData(DLListModel->index(row, DLSPEED), QVariant((double)0.0));
|
||||||
|
DLListModel->setData(DLListModel->index(row, UPSPEED), QVariant((double)0.0));
|
||||||
|
DLListModel->setData(DLListModel->index(row, ETA), QVariant((qlonglong)-1));
|
||||||
|
DLListModel->setData(DLListModel->index(row, NAME), QIcon(":/Icons/skin/paused.png"), Qt::DecorationRole);
|
||||||
|
setRowColor(row, "red");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if(finishedTorrentTab->getFinishedSHAs().indexOf(hash) == -1) {
|
||||||
|
// Update progress in download list
|
||||||
|
torrent_handle h = BTSession->getTorrentHandle(hash);
|
||||||
|
torrent_status torrentStatus = h.status();
|
||||||
|
int row = getRowFromHash(hash);
|
||||||
|
DLListModel->setData(DLListModel->index(row, PROGRESS), QVariant((double)torrentStatus.progress));
|
||||||
|
// Delayed Sorting
|
||||||
|
sortProgressColumnDelayed();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// Notification when disk is full
|
// Notification when disk is full
|
||||||
void GUI::fullDiskError(torrent_handle& h){
|
void GUI::fullDiskError(torrent_handle& h){
|
||||||
QSettings settings("qBittorrent", "qBittorrent");
|
QSettings settings("qBittorrent", "qBittorrent");
|
||||||
|
@ -153,6 +153,7 @@ class GUI : public QMainWindow, private Ui::MainWindow{
|
|||||||
void processDownloadedFiles(QString path, QString url);
|
void processDownloadedFiles(QString path, QString url);
|
||||||
void downloadFromURLList(const QStringList& urls);
|
void downloadFromURLList(const QStringList& urls);
|
||||||
void displayDownloadingUrlInfos(QString url);
|
void displayDownloadingUrlInfos(QString url);
|
||||||
|
void torrentChecked(QString hash);
|
||||||
// Utils slots
|
// Utils slots
|
||||||
void setRowColor(int row, QString color);
|
void setRowColor(int row, QString color);
|
||||||
// Options slots
|
// Options slots
|
||||||
|
@ -226,7 +226,6 @@ bool bittorrent::pauseTorrent(QString hash){
|
|||||||
int index = torrentsToPauseAfterChecking.indexOf(hash);
|
int index = torrentsToPauseAfterChecking.indexOf(hash);
|
||||||
if(index != -1) {
|
if(index != -1) {
|
||||||
torrentsToPauseAfterChecking.removeAt(index);
|
torrentsToPauseAfterChecking.removeAt(index);
|
||||||
qDebug("A torrent was paused just after checking, good");
|
|
||||||
}
|
}
|
||||||
return change;
|
return change;
|
||||||
}
|
}
|
||||||
@ -273,7 +272,7 @@ void bittorrent::loadWebSeeds(QString fileHash){
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Add a torrent to the bittorrent session
|
// Add a torrent to the bittorrent session
|
||||||
void bittorrent::addTorrent(QString path, bool fromScanDir, bool onStartup, QString from_url){
|
void bittorrent::addTorrent(QString path, bool fromScanDir, QString from_url){
|
||||||
torrent_handle h;
|
torrent_handle h;
|
||||||
entry resume_data;
|
entry resume_data;
|
||||||
bool fastResume=false;
|
bool fastResume=false;
|
||||||
@ -303,10 +302,6 @@ void bittorrent::addTorrent(QString path, bool fromScanDir, bool onStartup, QStr
|
|||||||
// Getting torrent file informations
|
// Getting torrent file informations
|
||||||
torrent_info t(e);
|
torrent_info t(e);
|
||||||
QString hash = QString(misc::toString(t.info_hash()).c_str());
|
QString hash = QString(misc::toString(t.info_hash()).c_str());
|
||||||
if(onStartup){
|
|
||||||
qDebug("Added a hash to the unchecked torrents list");
|
|
||||||
torrentsUnchecked << hash;
|
|
||||||
}
|
|
||||||
if(s->find_torrent(t.info_hash()).is_valid()){
|
if(s->find_torrent(t.info_hash()).is_valid()){
|
||||||
// Update info Bar
|
// Update info Bar
|
||||||
if(!fromScanDir){
|
if(!fromScanDir){
|
||||||
@ -436,10 +431,6 @@ void bittorrent::addTorrent(QString path, bool fromScanDir, bool onStartup, QStr
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
QStringList bittorrent::getTorrentsToPauseAfterChecking() const{
|
|
||||||
return torrentsToPauseAfterChecking;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Set the maximum number of opened connections
|
// Set the maximum number of opened connections
|
||||||
void bittorrent::setMaxConnections(int maxConnec){
|
void bittorrent::setMaxConnections(int maxConnec){
|
||||||
s->set_max_connections(maxConnec);
|
s->set_max_connections(maxConnec);
|
||||||
@ -695,7 +686,7 @@ void bittorrent::saveFastResumeAndRatioData(){
|
|||||||
h.pause();
|
h.pause();
|
||||||
QString fileHash = QString(misc::toString(h.info_hash()).c_str());
|
QString fileHash = QString(misc::toString(h.info_hash()).c_str());
|
||||||
while(!receivedPausedAlert(fileHash)){
|
while(!receivedPausedAlert(fileHash)){
|
||||||
qDebug("Sleeping while waiting that %s is paused", misc::toString(h.info_hash()).c_str());
|
//qDebug("Sleeping while waiting that %s is paused", misc::toString(h.info_hash()).c_str());
|
||||||
//printPausedTorrents();
|
//printPausedTorrents();
|
||||||
SleeperThread::msleep(500);
|
SleeperThread::msleep(500);
|
||||||
readAlerts();
|
readAlerts();
|
||||||
@ -968,6 +959,17 @@ void bittorrent::readAlerts(){
|
|||||||
else if (url_seed_alert* p = dynamic_cast<url_seed_alert*>(a.get())){
|
else if (url_seed_alert* p = dynamic_cast<url_seed_alert*>(a.get())){
|
||||||
emit urlSeedProblem(QString(p->url.c_str()), QString(p->msg().c_str()));
|
emit urlSeedProblem(QString(p->url.c_str()), QString(p->msg().c_str()));
|
||||||
}
|
}
|
||||||
|
else if (torrent_checked_alert* p = dynamic_cast<torrent_checked_alert*>(a.get())){
|
||||||
|
QString hash = QString(misc::toString(p->handle.info_hash()).c_str());
|
||||||
|
qDebug("%s have just finished checking", (const char*)hash.toUtf8());
|
||||||
|
int index = torrentsToPauseAfterChecking.indexOf(hash);
|
||||||
|
if(index != -1){
|
||||||
|
// Pause torrent
|
||||||
|
pauseTorrent(hash);
|
||||||
|
qDebug("%s was paused after checking", (const char*)hash.toUtf8());
|
||||||
|
}
|
||||||
|
emit torrentFinishedChecking(hash);
|
||||||
|
}
|
||||||
a = s->pop_alert();
|
a = s->pop_alert();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -976,6 +978,10 @@ QList<QPair<QString, QString> > bittorrent::getTrackersErrors(QString hash) cons
|
|||||||
return trackersErrors.value(hash, QList<QPair<QString, QString> >());
|
return trackersErrors.value(hash, QList<QPair<QString, QString> >());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
QStringList bittorrent::getTorrentsToPauseAfterChecking() const{
|
||||||
|
return torrentsToPauseAfterChecking;
|
||||||
|
}
|
||||||
|
|
||||||
// Function to reload the torrent async after the torrent is actually
|
// Function to reload the torrent async after the torrent is actually
|
||||||
// paused so that we can get fastresume data
|
// paused so that we can get fastresume data
|
||||||
void bittorrent::pauseAndReloadTorrent(const torrent_handle &h){
|
void bittorrent::pauseAndReloadTorrent(const torrent_handle &h){
|
||||||
@ -1166,22 +1172,6 @@ std::vector<torrent_handle> bittorrent::getTorrentHandles() const{
|
|||||||
return s->get_torrents();
|
return s->get_torrents();
|
||||||
}
|
}
|
||||||
|
|
||||||
QStringList bittorrent::getUncheckedTorrentsList() const{
|
|
||||||
return torrentsUnchecked;
|
|
||||||
}
|
|
||||||
|
|
||||||
void bittorrent::setTorrentFinishedChecking(QString hash){
|
|
||||||
int index = torrentsUnchecked.indexOf(hash);
|
|
||||||
qDebug("torrent %s finished checking", (const char*)hash.toUtf8());
|
|
||||||
if(index != -1){
|
|
||||||
torrentsUnchecked.removeAt(index);
|
|
||||||
qDebug("Still %d unchecked torrents", torrentsUnchecked.size());
|
|
||||||
if(torrentsUnchecked.size() == 0){
|
|
||||||
emit allTorrentsFinishedChecking();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// Save DHT entry to hard drive
|
// Save DHT entry to hard drive
|
||||||
void bittorrent::saveDHTEntry(){
|
void bittorrent::saveDHTEntry(){
|
||||||
// Save DHT entry
|
// Save DHT entry
|
||||||
@ -1219,7 +1209,7 @@ void bittorrent::resumeUnfinishedTorrents(){
|
|||||||
}
|
}
|
||||||
// Resume downloads
|
// Resume downloads
|
||||||
foreach(fileName, filePaths){
|
foreach(fileName, filePaths){
|
||||||
addTorrent(fileName, false, true);
|
addTorrent(fileName, false);
|
||||||
}
|
}
|
||||||
qDebug("Unfinished torrents resumed");
|
qDebug("Unfinished torrents resumed");
|
||||||
}
|
}
|
||||||
|
@ -48,7 +48,6 @@ class bittorrent : public QObject{
|
|||||||
QStringList supported_preview_extensions;
|
QStringList supported_preview_extensions;
|
||||||
QString defaultSavePath;
|
QString defaultSavePath;
|
||||||
QStringList torrentsToPauseAfterChecking;
|
QStringList torrentsToPauseAfterChecking;
|
||||||
QStringList torrentsUnchecked;
|
|
||||||
QStringList reloadingTorrents;
|
QStringList reloadingTorrents;
|
||||||
QHash<QString, QList<long> > ETAstats;
|
QHash<QString, QList<long> > ETAstats;
|
||||||
QHash<QString, long> ETAs;
|
QHash<QString, long> ETAs;
|
||||||
@ -77,7 +76,6 @@ class bittorrent : public QObject{
|
|||||||
session_status getSessionStatus() const;
|
session_status getSessionStatus() const;
|
||||||
int getListenPort() const;
|
int getListenPort() const;
|
||||||
QStringList getTorrentsToPauseAfterChecking() const;
|
QStringList getTorrentsToPauseAfterChecking() const;
|
||||||
QStringList getUncheckedTorrentsList() const;
|
|
||||||
long getETA(QString hash) const;
|
long getETA(QString hash) const;
|
||||||
size_type torrentEffectiveSize(QString hash) const;
|
size_type torrentEffectiveSize(QString hash) const;
|
||||||
bool inFullAllocationMode(QString hash) const;
|
bool inFullAllocationMode(QString hash) const;
|
||||||
@ -88,7 +86,7 @@ class bittorrent : public QObject{
|
|||||||
void printPausedTorrents();
|
void printPausedTorrents();
|
||||||
|
|
||||||
public slots:
|
public slots:
|
||||||
void addTorrent(QString path, bool fromScanDir = false, bool onStartup = false, QString from_url = QString());
|
void addTorrent(QString path, bool fromScanDir = false, QString from_url = QString());
|
||||||
void downloadFromUrl(QString url);
|
void downloadFromUrl(QString url);
|
||||||
void downloadFromURLList(const QStringList& url_list);
|
void downloadFromURLList(const QStringList& url_list);
|
||||||
void deleteTorrent(QString hash, bool permanent = false);
|
void deleteTorrent(QString hash, bool permanent = false);
|
||||||
@ -104,7 +102,6 @@ class bittorrent : public QObject{
|
|||||||
void enableIPFilter(ip_filter filter);
|
void enableIPFilter(ip_filter filter);
|
||||||
void disableIPFilter();
|
void disableIPFilter();
|
||||||
void pauseAndReloadTorrent(const torrent_handle &h);
|
void pauseAndReloadTorrent(const torrent_handle &h);
|
||||||
void setTorrentFinishedChecking(QString hash);
|
|
||||||
void resumeUnfinishedTorrents();
|
void resumeUnfinishedTorrents();
|
||||||
void updateETAs();
|
void updateETAs();
|
||||||
void saveTorrentSpeedLimits(QString hash);
|
void saveTorrentSpeedLimits(QString hash);
|
||||||
@ -149,11 +146,11 @@ class bittorrent : public QObject{
|
|||||||
void newDownloadedTorrent(QString path, QString url);
|
void newDownloadedTorrent(QString path, QString url);
|
||||||
void aboutToDownloadFromUrl(QString url);
|
void aboutToDownloadFromUrl(QString url);
|
||||||
void updateFileSize(QString hash);
|
void updateFileSize(QString hash);
|
||||||
void allTorrentsFinishedChecking();
|
|
||||||
void peerBlocked(QString);
|
void peerBlocked(QString);
|
||||||
void downloadFromUrlFailure(QString url, QString reason);
|
void downloadFromUrlFailure(QString url, QString reason);
|
||||||
void fastResumeDataRejected(QString name);
|
void fastResumeDataRejected(QString name);
|
||||||
void urlSeedProblem(QString url, QString msg);
|
void urlSeedProblem(QString url, QString msg);
|
||||||
|
void torrentFinishedChecking(QString hash);
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -45,7 +45,7 @@ class torrentAdditionDialog : public QDialog, private Ui_addTorrentDialog{
|
|||||||
|
|
||||||
signals:
|
signals:
|
||||||
void setInfoBarGUI(QString info, QString color);
|
void setInfoBarGUI(QString info, QString color);
|
||||||
void torrentAddition(QString filePath, bool fromScanDir, bool onStartup, QString from_url);
|
void torrentAddition(QString filePath, bool fromScanDir, QString from_url);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
QString fileName;
|
QString fileName;
|
||||||
@ -335,8 +335,7 @@ class torrentAdditionDialog : public QDialog, private Ui_addTorrentDialog{
|
|||||||
// save filtered files
|
// save filtered files
|
||||||
savePiecesPriorities();
|
savePiecesPriorities();
|
||||||
// Add to download list
|
// Add to download list
|
||||||
// TODO : quick fix
|
emit torrentAddition(filePath, fromScanDir, from_url);
|
||||||
emit torrentAddition(filePath, fromScanDir, false, from_url);
|
|
||||||
close();
|
close();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user