- Improved trackers errors code a lot and moved it to Bittorrent class

- When using startAll() command and when only some torrents are paused : already started torrents are not displayed as connecting untill next refresh anymore (they keep their current state).
This commit is contained in:
Christophe Dumez 2007-07-27 13:58:12 +00:00
parent ff9b9d7148
commit f839d6fe41
8 changed files with 52 additions and 53 deletions

View file

@ -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(fullDiskError(torrent_handle&)), this, SLOT(fullDiskError(torrent_handle&)));
connect(BTSession, SIGNAL(portListeningFailure()), this, SLOT(portListeningFailure()));
connect(BTSession, SIGNAL(trackerError(QString, QString, QString)), this, SLOT(trackerError(QString, QString, QString)));
connect(BTSession,SIGNAL(allTorrentsFinishedChecking()), this, SLOT(sortProgressColumnDelayed()));
connect(BTSession, SIGNAL(trackerAuthenticationRequired(torrent_handle&)), this, SLOT(trackerAuthenticationRequired(torrent_handle&)));
connect(BTSession, SIGNAL(peerBlocked(QString)), this, SLOT(addLogPeerBlocked(const QString)));
@ -1231,8 +1230,7 @@ void GUI::showProperties(const QModelIndex &index){
int row = index.row();
QString fileHash = DLListModel->data(DLListModel->index(row, HASH)).toString();
torrent_handle h = BTSession->getTorrentHandle(fileHash);
QStringList errors = trackerErrors.value(fileHash, QStringList(tr("None", "i.e: No error message")));
properties *prop = new properties(this, BTSession, h, errors);
properties *prop = new properties(this, BTSession, h);
connect(prop, SIGNAL(mustHaveFullAllocationMode(torrent_handle)), BTSession, SLOT(reloadTorrent(torrent_handle)));
connect(prop, SIGNAL(filteredFilesChanged(QString)), this, SLOT(updateFileSize(QString)));
prop->show();
@ -1429,10 +1427,10 @@ void GUI::on_actionStart_All_triggered(){
for(unsigned int i=0; i<nbRows; ++i){
fileHash = DLListModel->data(DLListModel->index(i, HASH)).toString();
// Remove .paused file
QFile::remove(misc::qBittorrentPath()+"BT_backup"+QDir::separator()+fileHash+".paused");
// Update DL list items
DLListModel->setData(DLListModel->index(i, NAME), QVariant(QIcon(":/Icons/skin/connecting.png")), Qt::DecorationRole);
setRowColor(i, "grey");
if(QFile::remove(misc::qBittorrentPath()+"BT_backup"+QDir::separator()+fileHash+".paused")){
DLListModel->setData(DLListModel->index(i, NAME), QVariant(QIcon(":/Icons/skin/connecting.png")), Qt::DecorationRole);
setRowColor(i, "grey");
}
}
setInfoBar(tr("All downloads were resumed."));
}
@ -1530,17 +1528,6 @@ void GUI::portListeningFailure(){
setInfoBar(tr("Couldn't listen on any of the given ports."), "red");
}
// Called when we receive an error from tracker
void GUI::trackerError(QString hash, QString time, QString msg){
// Check trackerErrors list size and clear it if it is too big
if(trackerErrors.size() > 50){
trackerErrors.clear();
}
QStringList errors = trackerErrors.value(hash, QStringList());
errors.append("<font color='grey'>"+time+"</font> - <font color='red'>"+msg+"</font>");
trackerErrors.insert(hash, errors);
}
// Called when a tracker requires authentication
void GUI::trackerAuthenticationRequired(torrent_handle& h){
if(unauthenticated_trackers.indexOf(QPair<torrent_handle,std::string>(h, h.status().current_tracker)) < 0){