mirror of
https://github.com/qbittorrent/qBittorrent
synced 2025-08-22 06:13:36 -07:00
- BUGFIX: The torrent size displayed now takes filtered files into consideration
- BUGFIX: Fixed compiling errors with libtorrent svn (adds UPnP support)
This commit is contained in:
parent
985bb8926b
commit
06448509fb
11 changed files with 52 additions and 11 deletions
|
@ -1,5 +1,7 @@
|
||||||
* Unknown - Christophe Dumez <chris@qbittorrent.org> - v0.9.3
|
* Unknown - Christophe Dumez <chris@qbittorrent.org> - v0.9.3
|
||||||
- BUGFIX: Fixed pause toggle on double-click in download
|
- BUGFIX: Fixed pause toggle on double-click in download
|
||||||
|
- BUGFIX: The torrent size displayed now takes filtered files into consideration
|
||||||
|
- BUGFIX: Fixed compiling errors with libtorrent svn (future v0.13 with UPnP enabled)
|
||||||
|
|
||||||
* Tue Apr 10 2007 - Christophe Dumez <chris@qbittorrent.org> - v0.9.2
|
* Tue Apr 10 2007 - Christophe Dumez <chris@qbittorrent.org> - v0.9.2
|
||||||
- BUGFIX: Window can now stay maximized on exit
|
- BUGFIX: Window can now stay maximized on exit
|
||||||
|
|
3
TODO
3
TODO
|
@ -36,6 +36,3 @@
|
||||||
- Add IPv6 support (at least start working on it)
|
- Add IPv6 support (at least start working on it)
|
||||||
- UPnP support?
|
- UPnP support?
|
||||||
|
|
||||||
// In v0.9.0
|
|
||||||
- Update translations (FR, SV, NB, PL, RU, DE, SK, KO, ZH_CN, EL, BG, ES, DA, UK, PT, IT, NL done)
|
|
||||||
- Wait for libtorrent v0.12 official release
|
|
||||||
|
|
6
configure
vendored
6
configure
vendored
|
@ -308,6 +308,9 @@ public:
|
||||||
qWarning("Libtorrent >= v0.12 was not detected, PeX will be disabled.");
|
qWarning("Libtorrent >= v0.12 was not detected, PeX will be disabled.");
|
||||||
conf->addDefine("NO_PEX");
|
conf->addDefine("NO_PEX");
|
||||||
}
|
}
|
||||||
|
if(conf->checkHeader(s, "libtorrent/lsd.hpp")){
|
||||||
|
conf->addDefine("V_0_13");
|
||||||
|
}
|
||||||
}else{
|
}else{
|
||||||
QStringList sl;
|
QStringList sl;
|
||||||
sl << "/usr/include";
|
sl << "/usr/include";
|
||||||
|
@ -324,6 +327,9 @@ public:
|
||||||
qWarning("Libtorrent >= v0.12 was not detected, PeX will be disabled.");
|
qWarning("Libtorrent >= v0.12 was not detected, PeX will be disabled.");
|
||||||
conf->addDefine("NO_PEX");
|
conf->addDefine("NO_PEX");
|
||||||
}
|
}
|
||||||
|
if(conf->checkHeader(s, "libtorrent/lsd.hpp")){
|
||||||
|
conf->addDefine("V_0_13");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
conf->addIncludePath(s);
|
conf->addIncludePath(s);
|
||||||
conf->addIncludePath(s+QDir::separator()+"libtorrent");
|
conf->addIncludePath(s+QDir::separator()+"libtorrent");
|
||||||
|
|
|
@ -22,6 +22,9 @@ public:
|
||||||
qWarning("Libtorrent >= v0.12 was not detected, PeX will be disabled.");
|
qWarning("Libtorrent >= v0.12 was not detected, PeX will be disabled.");
|
||||||
conf->addDefine("NO_PEX");
|
conf->addDefine("NO_PEX");
|
||||||
}
|
}
|
||||||
|
if(conf->checkHeader(s, "libtorrent/lsd.hpp")){
|
||||||
|
conf->addDefine("V_0_13");
|
||||||
|
}
|
||||||
}else{
|
}else{
|
||||||
QStringList sl;
|
QStringList sl;
|
||||||
sl << "/usr/include";
|
sl << "/usr/include";
|
||||||
|
@ -38,6 +41,9 @@ public:
|
||||||
qWarning("Libtorrent >= v0.12 was not detected, PeX will be disabled.");
|
qWarning("Libtorrent >= v0.12 was not detected, PeX will be disabled.");
|
||||||
conf->addDefine("NO_PEX");
|
conf->addDefine("NO_PEX");
|
||||||
}
|
}
|
||||||
|
if(conf->checkHeader(s, "libtorrent/lsd.hpp")){
|
||||||
|
conf->addDefine("V_0_13");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
conf->addIncludePath(s);
|
conf->addIncludePath(s);
|
||||||
conf->addIncludePath(s+QDir::separator()+"libtorrent");
|
conf->addIncludePath(s+QDir::separator()+"libtorrent");
|
||||||
|
|
20
src/GUI.cpp
20
src/GUI.cpp
|
@ -132,6 +132,7 @@ GUI::GUI(QWidget *parent, QStringList torrentCmdLine) : QMainWindow(parent){
|
||||||
// Configure BT session according to options
|
// Configure BT session according to options
|
||||||
configureSession(true);
|
configureSession(true);
|
||||||
force_exit = false;
|
force_exit = false;
|
||||||
|
connect(&BTSession, SIGNAL(updateFileSize(QString)), this, SLOT(updateFileSize(QString)));
|
||||||
// Resume unfinished torrents
|
// Resume unfinished torrents
|
||||||
BTSession.resumeUnfinishedTorrents();
|
BTSession.resumeUnfinishedTorrents();
|
||||||
// Add torrent given on command line
|
// Add torrent given on command line
|
||||||
|
@ -1038,6 +1039,18 @@ void GUI::deleteSelection(){
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
size_type GUI::torrentEffectiveSize(QString hash) const{
|
||||||
|
torrent_handle h = BTSession.getTorrentHandle(hash);
|
||||||
|
torrent_info t = h.get_torrent_info();
|
||||||
|
unsigned short nbFiles = t.num_files();
|
||||||
|
size_type effective_size = 0;
|
||||||
|
for(unsigned int i=0; i<nbFiles; ++i){
|
||||||
|
if(h.piece_priority(i) != 0)
|
||||||
|
effective_size += t.file_at(i).size;
|
||||||
|
}
|
||||||
|
return effective_size;
|
||||||
|
}
|
||||||
|
|
||||||
// Called when a torrent is added
|
// Called when a torrent is added
|
||||||
void GUI::torrentAdded(const QString& path, torrent_handle& h, bool fastResume){
|
void GUI::torrentAdded(const QString& path, torrent_handle& h, bool fastResume){
|
||||||
int row = DLListModel->rowCount();
|
int row = DLListModel->rowCount();
|
||||||
|
@ -1045,7 +1058,7 @@ void GUI::torrentAdded(const QString& path, torrent_handle& h, bool fastResume){
|
||||||
// Adding torrent to download list
|
// Adding torrent to download list
|
||||||
DLListModel->insertRow(row);
|
DLListModel->insertRow(row);
|
||||||
DLListModel->setData(DLListModel->index(row, NAME), QVariant(h.get_torrent_info().name().c_str()));
|
DLListModel->setData(DLListModel->index(row, NAME), QVariant(h.get_torrent_info().name().c_str()));
|
||||||
DLListModel->setData(DLListModel->index(row, SIZE), QVariant((qlonglong)h.get_torrent_info().total_size()));
|
DLListModel->setData(DLListModel->index(row, SIZE), QVariant((qlonglong)torrentEffectiveSize(hash)));
|
||||||
DLListModel->setData(DLListModel->index(row, DLSPEED), QVariant((double)0.));
|
DLListModel->setData(DLListModel->index(row, DLSPEED), QVariant((double)0.));
|
||||||
DLListModel->setData(DLListModel->index(row, UPSPEED), QVariant((double)0.));
|
DLListModel->setData(DLListModel->index(row, UPSPEED), QVariant((double)0.));
|
||||||
DLListModel->setData(DLListModel->index(row, SEEDSLEECH), QVariant("0/0"));
|
DLListModel->setData(DLListModel->index(row, SEEDSLEECH), QVariant("0/0"));
|
||||||
|
@ -1145,6 +1158,11 @@ void GUI::showProperties(const QModelIndex &index){
|
||||||
prop->show();
|
prop->show();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void GUI::updateFileSize(QString hash){
|
||||||
|
int row = getRowFromHash(hash);
|
||||||
|
DLListModel->setData(DLListModel->index(row, SIZE), QVariant((qlonglong)torrentEffectiveSize(hash)));
|
||||||
|
}
|
||||||
|
|
||||||
// Set BT session configuration
|
// Set BT session configuration
|
||||||
void GUI::configureSession(bool deleteOptions){
|
void GUI::configureSession(bool deleteOptions){
|
||||||
qDebug("Configuring session");
|
qDebug("Configuring session");
|
||||||
|
|
|
@ -136,6 +136,7 @@ class GUI : public QMainWindow, private Ui::MainWindow{
|
||||||
void readSettings();
|
void readSettings();
|
||||||
void forceExit();
|
void forceExit();
|
||||||
// Torrent actions
|
// Torrent actions
|
||||||
|
size_type torrentEffectiveSize(QString hash) const;
|
||||||
void showProperties(const QModelIndex &index);
|
void showProperties(const QModelIndex &index);
|
||||||
void propertiesSelection();
|
void propertiesSelection();
|
||||||
void pauseSelection();
|
void pauseSelection();
|
||||||
|
@ -183,6 +184,7 @@ class GUI : public QMainWindow, private Ui::MainWindow{
|
||||||
void portListeningFailure();
|
void portListeningFailure();
|
||||||
void trackerError(const QString& hash, const QString& time, const QString& msg);
|
void trackerError(const QString& hash, const QString& time, const QString& msg);
|
||||||
void trackerAuthenticationRequired(torrent_handle& h);
|
void trackerAuthenticationRequired(torrent_handle& h);
|
||||||
|
void updateFileSize(QString hash);
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
void closeEvent(QCloseEvent *);
|
void closeEvent(QCloseEvent *);
|
||||||
|
@ -193,7 +195,7 @@ class GUI : public QMainWindow, private Ui::MainWindow{
|
||||||
GUI(QWidget *parent=0, QStringList torrentCmdLine=QStringList());
|
GUI(QWidget *parent=0, QStringList torrentCmdLine=QStringList());
|
||||||
~GUI();
|
~GUI();
|
||||||
// Methods
|
// Methods
|
||||||
int getRowFromHash(const QString& name) const;
|
int getRowFromHash(const QString& hash) const;
|
||||||
float getNovaVersion(const QString& novaPath) const;
|
float getNovaVersion(const QString& novaPath) const;
|
||||||
QByteArray getNovaChangelog(const QString& novaPath) const;
|
QByteArray getNovaChangelog(const QString& novaPath) const;
|
||||||
void updateNova() const;
|
void updateNova() const;
|
||||||
|
|
|
@ -656,6 +656,7 @@ void bittorrent::readAlerts(){
|
||||||
}
|
}
|
||||||
|
|
||||||
void bittorrent::reloadTorrent(const torrent_handle &h, bool compact_mode){
|
void bittorrent::reloadTorrent(const torrent_handle &h, bool compact_mode){
|
||||||
|
qDebug("** Reloading a torrent");
|
||||||
if(!h.is_valid()){
|
if(!h.is_valid()){
|
||||||
qDebug("/!\\ Error: Invalid handle");
|
qDebug("/!\\ Error: Invalid handle");
|
||||||
return;
|
return;
|
||||||
|
@ -714,6 +715,7 @@ void bittorrent::reloadTorrent(const torrent_handle &h, bool compact_mode){
|
||||||
qDebug("Incremental download enabled for %s", (const char*)fileName.toUtf8());
|
qDebug("Incremental download enabled for %s", (const char*)fileName.toUtf8());
|
||||||
new_h.set_sequenced_download_threshold(15);
|
new_h.set_sequenced_download_threshold(15);
|
||||||
}
|
}
|
||||||
|
emit updateFileSize(fileHash);
|
||||||
}
|
}
|
||||||
|
|
||||||
int bittorrent::getListenPort() const{
|
int bittorrent::getListenPort() const{
|
||||||
|
|
|
@ -144,6 +144,7 @@ class bittorrent : public QObject{
|
||||||
void scanDirFoundTorrents(const QStringList& pathList);
|
void scanDirFoundTorrents(const QStringList& pathList);
|
||||||
void newDownloadedTorrent(const QString& path, const QString& url);
|
void newDownloadedTorrent(const QString& path, const QString& url);
|
||||||
void aboutToDownloadFromUrl(const QString& url);
|
void aboutToDownloadFromUrl(const QString& url);
|
||||||
|
void updateFileSize(QString hash);
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -110,8 +110,13 @@ void createtorrent::on_createButton_clicked(){
|
||||||
t.set_piece_size(piece_size);
|
t.set_piece_size(piece_size);
|
||||||
#ifndef NO_PEX
|
#ifndef NO_PEX
|
||||||
file_pool fp;
|
file_pool fp;
|
||||||
|
#ifndef V_0_13
|
||||||
storage st(t, full_path.branch_path(), fp);
|
storage st(t, full_path.branch_path(), fp);
|
||||||
#endif
|
#endif
|
||||||
|
#ifdef V_0_13
|
||||||
|
boost::scoped_ptr<storage_interface> st(default_storage_constructor(t, full_path.branch_path(), fp));
|
||||||
|
#endif
|
||||||
|
#endif
|
||||||
#ifdef NO_PEX
|
#ifdef NO_PEX
|
||||||
storage st(t, full_path.branch_path());
|
storage st(t, full_path.branch_path());
|
||||||
#endif
|
#endif
|
||||||
|
@ -125,7 +130,12 @@ void createtorrent::on_createButton_clicked(){
|
||||||
std::vector<char> buf(piece_size);
|
std::vector<char> buf(piece_size);
|
||||||
for (int i = 0; i < num; ++i)
|
for (int i = 0; i < num; ++i)
|
||||||
{
|
{
|
||||||
|
#ifndef V_0_13
|
||||||
st.read(&buf[0], i, 0, t.piece_size(i));
|
st.read(&buf[0], i, 0, t.piece_size(i));
|
||||||
|
#endif
|
||||||
|
#ifdef V_0_13
|
||||||
|
st->read(&buf[0], i, 0, t.piece_size(i));
|
||||||
|
#endif
|
||||||
hasher h(&buf[0], t.piece_size(i));
|
hasher h(&buf[0], t.piece_size(i));
|
||||||
t.set_hash(i, h.final());
|
t.set_hash(i, h.final());
|
||||||
}
|
}
|
||||||
|
|
|
@ -290,10 +290,6 @@ void properties::saveFilteredFiles(){
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
pieces_file.close();
|
pieces_file.close();
|
||||||
if(!has_filtered_files){
|
|
||||||
// Don't need to reload torrent
|
|
||||||
// if already in full allocation mode
|
|
||||||
emit changedFilteredFiles(h, !hasFilteredFiles);
|
emit changedFilteredFiles(h, !hasFilteredFiles);
|
||||||
}
|
|
||||||
has_filtered_files = hasFilteredFiles;
|
has_filtered_files = hasFilteredFiles;
|
||||||
}
|
}
|
||||||
|
|
|
@ -56,6 +56,7 @@ class properties : public QDialog, private Ui::properties{
|
||||||
|
|
||||||
signals:
|
signals:
|
||||||
void changedFilteredFiles(torrent_handle h, bool compact_mode);
|
void changedFilteredFiles(torrent_handle h, bool compact_mode);
|
||||||
|
void fileSizeChanged(QString fileHash);
|
||||||
|
|
||||||
public:
|
public:
|
||||||
// Constructor
|
// Constructor
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue