mirror of
https://github.com/qbittorrent/qBittorrent.git
synced 2025-12-20 23:47:23 -06:00
- 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:
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user