- Transfer lists refreshers were moved to separate threads to improve GUI responsiveness. Please report any problem (like mutex deadlocks in console output) or crashes.

This commit is contained in:
Christophe Dumez
2007-07-25 09:03:22 +00:00
parent d43d68122b
commit 2ab7f6f923
7 changed files with 97 additions and 14 deletions

View File

@@ -25,9 +25,13 @@
#include "ui_seeding.h"
#include <libtorrent/torrent_handle.hpp>
#include <QThread>
#include <QMutex>
class QStandardItemModel;
class bittorrent;
class FinishedListDelegate;
class FinishedListRefresher;
using namespace libtorrent;
@@ -40,6 +44,8 @@ class FinishedTorrents : public QWidget, public Ui::seeding{
QStringList finishedSHAs;
QStandardItemModel *finishedListModel;
unsigned int nbFinished;
FinishedListRefresher *refresher;
QMutex finishedListAccess;
public:
FinishedTorrents(QObject *parent, bittorrent *BTSession);
@@ -73,4 +79,27 @@ class FinishedTorrents : public QWidget, public Ui::seeding{
};
class FinishedListRefresher : public QThread {
private:
FinishedTorrents* parent;
bool abort;
public:
FinishedListRefresher(FinishedTorrents* parent){
this->parent = parent;
abort = false;
}
~FinishedListRefresher(){
abort = true;
wait();
}
protected:
void run(){
forever{
if(abort) return;
parent->updateFinishedList();
msleep(2000);
}
}
};
#endif