1
mirror of https://github.com/qbittorrent/qBittorrent synced 2025-10-28 14:50:53 +01:00

Compare commits

..

1 Commits

Author SHA1 Message Date
Christophe Dumez
fc61693463 - Tagged rc6 release 2007-10-19 21:30:59 +00:00
151 changed files with 12585 additions and 24629 deletions

View File

@@ -3,4 +3,3 @@ Author:
Contributors:
* Arnaud Demaizière <arnaud@qbittorrent.org>
* Ishan Arora <ishanarora@gmail.com>

View File

@@ -1,29 +1,4 @@
* Unknown - Christophe Dumez <chris@qbittorrent.org> - v1.1.0
- FEATURE: Web interface to control qbittorrent (Ishan Arora)
- FEATURE: Can spoof Azureus peer id to avoid ban
- FEATURE: Allow to hide/show some columns in download and seeding lists
- FEATURE: Option to start qBittorrent minimized in systray
- FEATURE: Allow to define double-click actions in torrents lists
- FEATURE: Allow to open torrent destination folder
- FEATURE: Real progress bar in torrent properties that displays downloaded pieces
- FEATURE: Allow to buy downloads using ShareMonkey
- FEATURE: Display if UPnP/NAT-PMP was successful or not
- FEATURE: Threadified torrent creation
- FEATURE: Improved eMule DAT ip filter parser
- FEATURE: Added support for PeerGuardian p2p filters (text)
- FEATURE: Added support for PeerGuardian p2b filters (binary)
- FEATURE: Allow to customize folder scan interval
- FEATURE: Allow to add several trackers at once
- BUGFIX: Do not display seeds number in seeding list (always 0)
- BUGFIX: Threadified IP filter file parser to avoid GUI freeze
- COSMETIC: Do not display progress bar in seeding list (always 100%)
- COSMETIC: Added a progress bar for torrent creation
- COSMETIC: Display tracker errors in a cleaner way
- COSMETIC: Display "unpaused/total_torrent" in download/upload tabs
- COSMETIC: Allow to resize RSS column
- COSMETIC: Global UP/DL speeds and ratio are displayed above tabs
* Fri Apr 11 2008 - Christophe Dumez <chris@qbittorrent.org> - v1.0.0
* Unknown - Christophe Dumez <chris@qbittorrent.org> - v1.0.0
- FEATURE: Based on new libtorrent v0.13
- FEATURE: Added UPnP / NAT-PMP port forwarding support
- FEATURE: Added encryption support (compatible with Azureus)
@@ -89,8 +64,6 @@
- BUGFIX: Prevent downloadFromUrl flooding
- BUGFIX: ETA was wrong for torrents with filtered files
- BUGFIX: Fixed drag'n drop on non-KDE systems
- BUGFIX: Removed build dependency on Python
- BUGFIX: Catching DHT exception in case there is a problem
- COSMETIC: Redesigned torrent properties a little
- COSMETIC: Totally redesigned program preferences
- COSMETIC: Display more logs messages concerning features

View File

@@ -25,7 +25,7 @@ Dependencies:
- libboost: libboost-filesystem, libboost-date-time, libboost-thread, libboost-serialization
- libcurl
- libcommoncpp2
- python >= 2.3 (needed by search engine)

43
TODO
View File

@@ -8,9 +8,11 @@
- Skins support? (contact Mateusz)
// Harder
- Display a progress bar that really represents the pieces we have (like in eMule)
- Torrent scheduler ala µtorrent/Bitcomet
// Waiting for libtorrent
- File selection in a torrent in compact mode
- Allow to prioritize torrents (may code this in qBittorrent?)
// Unsure
@@ -23,15 +25,44 @@
(http://techbase.kde.org/Development/Tutorials/D-Bus/Accessing_Interfaces)
- When favicon can't be downloaded, try to parse the webpage for:
<link rel="icon" href="http://example.com/favicon.ico" type="image/vnd.microsoft.icon">
* Be careful, the link can be relative
- Improve search plugin install (choose in a list taken from plugins.qbittorrent.org)
- support zipped torrents? (useful?)
- Allow to limit the number of downloading torrents simultaneously (other are paused until a download finishes)
* Be carefull, the link can be relative
// in v1.2.0
- Allow user to organize the downloads into categories/folders?
// in v1.1.0
- Stop calculating ETAs when ETA column is hidden
-> See https://blueprints.launchpad.net/qbittorrent
- Tabs support in search
- Allow to hide columns?
- Allow to scan multiple directories? (useful?)
- Web interface (turbogears? php? python?)
* Webserver? Try to write a webserver as a plugin for qBittorrent in Python
* http://fragments.turtlemeat.com/pythonwebserver.php
- improve and test tracker authentication code (remember login/pass) (need a tracker to test this)
- support zipped torrents? (useful?)
- Allow to limit the number of downloading torrents simultaneously (other are paused until a download finishes)
- Improve search plugin install (choose in a list taken from plugins.qbittorrent.org)
- Display the number of DHT node if possible
- When adding a duplicate torrent, check if the trackers are different from the existing one and ask the user if he wants to add them
- Display in torrent addition dialog:
* free disk space on selected drive
* free disk space after torrent download (and/or torrent size)
- Start minimized option in program preferences
- Allow to change action on double-click
-> in download list
-> in seeding list
// in v1.0.0 - FEATURE FREEZE
- Fix all (or almost all) opened bugs in bug tracker
- Recheck doc
- Translations update (IN PROGRESS)
rc5->rc6 changelog:
- FEATURE: Added a button to clear search pattern
- BUGFIX: configure looks for libraries in lib64 folders too
- BUGFIX: configure doesn't require paths with a terminal "/" anymore
- BUGFIX: Fixed minimize to tray feature
- BUGFIX: Fixed folders progress calculation in torrent properties
- BUGFIX: Fixed deletion of subfolders when deleting torrents from hard drive
- BUGFIX: Remember scan directory in program preferences now
- BUGFIX: Fixed ETA display (sometimes displayed < 1min for no reason)
- I18N: Fixed swedish, French, Spanish translations

111
configure vendored
View File

@@ -22,8 +22,8 @@ Dependency options:
--with-libtorrent-lib=[path] Path to libtorrent library files
--with-libtorrent-static-lib=[path] Path to libtorrent .a file
--with-libboost-inc=[path] Path to libboost include files
--with-libcurl-inc=[path] Path to libcurl include files
--with-libcurl-lib=[path] Path to libcurl library files
--with-libcommoncpp2-inc=[path] Path to libcommoncpp2 include files
--with-libcommoncpp2-lib=[path] Path to libcommoncpp2 library files
--disable-libmagick Disable use of libmagick
--with-libmagick-inc=[path] Path to libmagick++ include files
--with-libmagick-lib=[path] Path to libmagick++ library files
@@ -166,13 +166,13 @@ while [ $# -gt 0 ]; do
shift
;;
--with-libcurl-inc=*)
QC_WITH_LIBCURL_INC=$optarg
--with-libcommoncpp2-inc=*)
QC_WITH_LIBCOMMONCPP2_INC=$optarg
shift
;;
--with-libcurl-lib=*)
QC_WITH_LIBCURL_LIB=$optarg
--with-libcommoncpp2-lib=*)
QC_WITH_LIBCOMMONCPP2_LIB=$optarg
shift
;;
@@ -231,8 +231,8 @@ echo QC_WITH_LIBTORRENT_INC=$QC_WITH_LIBTORRENT_INC
echo QC_WITH_LIBTORRENT_LIB=$QC_WITH_LIBTORRENT_LIB
echo QC_WITH_LIBTORRENT_STATIC_LIB=$QC_WITH_LIBTORRENT_STATIC_LIB
echo QC_WITH_LIBBOOST_INC=$QC_WITH_LIBBOOST_INC
echo QC_WITH_LIBCURL_INC=$QC_WITH_LIBCURL_INC
echo QC_WITH_LIBCURL_LIB=$QC_WITH_LIBCURL_LIB
echo QC_WITH_LIBCOMMONCPP2_INC=$QC_WITH_LIBCOMMONCPP2_INC
echo QC_WITH_LIBCOMMONCPP2_LIB=$QC_WITH_LIBCOMMONCPP2_LIB
echo QC_DISABLE_libmagick=$QC_DISABLE_libmagick
echo QC_WITH_LIBMAGICK_INC=$QC_WITH_LIBMAGICK_INC
echo QC_WITH_LIBMAGICK_LIB=$QC_WITH_LIBMAGICK_LIB
@@ -425,6 +425,16 @@ public:
if(!found) return false;
conf->addLib(QString("-L") + s);
}
// BUGFIX for Fedora (doesn't support pkg-config?)
QFile issue_file("/etc/issue");
if(issue_file.open(QIODevice::ReadOnly | QIODevice::Text)){
QString content = issue_file.readAll();
issue_file.close();
if(content.indexOf("Fedora") != -1){
qWarning("Fedora detected. WORKAROUND for Fedora pkg-config problem enabled");
conf->addLib("-lssl -lcrypto -lboost_date_time -lboost_filesystem -lboost_thread -lz -ltorrent");
}
}
return true;
}
};
@@ -485,25 +495,25 @@ public:
return true;
}
};
#line 1 "libcurl.qcm"
#line 1 "libcommoncpp2.qcm"
/*
-----BEGIN QCMOD-----
name: libcommoncpp2
arg: with-libcurl-inc=[path], Path to libcurl include files
arg: with-libcurl-lib=[path], Path to libcurl library files
arg: with-libcommoncpp2-inc=[path], Path to libcommoncpp2 include files
arg: with-libcommoncpp2-lib=[path], Path to libcommoncpp2 library files
-----END QCMOD-----
*/
class qc_libcurl : public ConfObj
class qc_libcommoncpp2 : public ConfObj
{
public:
qc_libcurl(Conf *c) : ConfObj(c) {}
QString name() const { return "libcurl"; }
QString shortname() const { return "libcurl"; }
qc_libcommoncpp2(Conf *c) : ConfObj(c) {}
QString name() const { return "GNU Common C++ library (libcommoncpp2)"; }
QString shortname() const { return "libcommoncpp2"; }
bool exec(){
QString s;
s = conf->getenv("QC_WITH_LIBCURL_INC");
s = conf->getenv("QC_WITH_LIBCOMMONCPP2_INC");
if(!s.isEmpty()) {
if(!conf->checkHeader(s, "curl/curl.h")) {
if(!conf->checkHeader(s, "cc++/url.h")) {
return false;
}
}else{
@@ -512,7 +522,7 @@ public:
sl << "/usr/local/include";
bool found = false;
foreach(s, sl){
if(conf->checkHeader(s, "curl/curl.h")){
if(conf->checkHeader(s, "cc++/url.h")){
found = true;
break;
}
@@ -523,10 +533,12 @@ public:
}
conf->addIncludePath(s);
s = conf->getenv("QC_WITH_LIBCURL_LIB");
s = conf->getenv("QC_WITH_LIBCOMMONCPP2_LIB");
if(!s.isEmpty()) {
if(!QFile::exists(s+QString("/libcurl.so")))
return false;
if(!QFile::exists(s+QString("/libccext2.so")))
return false;
if(!QFile::exists(s+QString("/libccgnu2.so")))
return false;
conf->addLib(QString("-L") + s);
}else{
QStringList sl;
@@ -536,14 +548,26 @@ public:
sl << "/usr/local/lib64/";
bool found = false;
foreach(s, sl){
if(QFile::exists(s+QString("libcurl.so"))){
found = true;
break;
if(QFile::exists(s+QString("libccext2.so"))){
if(QFile::exists(s+QString("libccgnu2.so"))){
found = true;
break;
}
}
}
if(!found) return false;
conf->addLib(QString("-L") + s);
}
// BUGFIX for Fedora (doesn't support pkg-config?)
QFile issue_file("/etc/issue");
if(issue_file.open(QIODevice::ReadOnly | QIODevice::Text)){
QString content = issue_file.readAll();
issue_file.close();
if(content.indexOf("Fedora") != -1){
qWarning("Fedora detected. WORKAROUND for Fedora pkg-config problem enabled");
conf->addLib("-pthread -lccext2 -lz -lccgnu2 -ldl -lrt");
}
}
return true;
}
};
@@ -594,9 +618,9 @@ public:
s = conf->getenv("QC_WITH_LIBMAGICK_LIB");
if(!s.isEmpty()) {
if(!conf->checkLibrary(s, "Magick++")) {
return false;
}
if(!QFile::exists(s+QString("/libMagick++.so"))){
return false;
}
}else{
QStringList sl;
sl << "/usr/lib/";
@@ -605,9 +629,9 @@ public:
sl << "/usr/local/lib64/";
bool found = false;
foreach(s, sl){
if(conf->checkLibrary(s, "Magick++")) {
if(QFile::exists(s+QString("libMagick++.so"))){
found = true;
break;
break;
}
}
if(!found)
@@ -699,6 +723,26 @@ public:
return true;
}
};
#line 1 "python.qcm"
/*
-----BEGIN QCMOD-----
name: python
-----END QCMOD-----
*/
class qc_python : public ConfObj
{
public:
qc_python(Conf *c) : ConfObj(c) {}
QString name() const { return "python >= 2.3"; }
QString shortname() const { return "python"; }
bool exec(){
int r = conf->doCommand("python testpython.py");
if(r == 0)
return true;
else
return false;
}
};
EOT
cat >$1/modules_new.cpp <<EOT
@@ -711,7 +755,7 @@ cat >$1/modules_new.cpp <<EOT
o = new qc_libboost(conf);
o->required = true;
o->disabled = false;
o = new qc_libcurl(conf);
o = new qc_libcommoncpp2(conf);
o->required = true;
o->disabled = false;
o = new qc_libmagick(conf);
@@ -720,6 +764,9 @@ cat >$1/modules_new.cpp <<EOT
o = new qc_libzzip(conf);
o->required = false;
o->disabled = false;
o = new qc_python(conf);
o->required = true;
o->disabled = false;
EOT
cat >$1/conf4.h <<EOT
@@ -1669,8 +1716,8 @@ export QC_WITH_LIBTORRENT_INC
export QC_WITH_LIBTORRENT_LIB
export QC_WITH_LIBTORRENT_STATIC_LIB
export QC_WITH_LIBBOOST_INC
export QC_WITH_LIBCURL_INC
export QC_WITH_LIBCURL_LIB
export QC_WITH_LIBCOMMONCPP2_INC
export QC_WITH_LIBCOMMONCPP2_LIB
export QC_DISABLE_libmagick
export QC_WITH_LIBMAGICK_INC
export QC_WITH_LIBMAGICK_LIB

View File

@@ -1,28 +0,0 @@
.\" This manpage has been automatically generated by docbook2man
.\" from a DocBook document. This tool can be found at:
.\" <http://shell.ipoline.com/~elmert/comp/docbook2X/>.
.TH "QBITTORRENT" "1" "September 1st 2007" "Bittorrent client written in C++ / Qt4" ""
.SH NAME
qBittorrent \- a Bittorrent client written in C++ / Qt4
.SH SYNOPSIS
\fBqbittorrent\fR [FILE | URL] [FILE | URL...]
\fBqbittorrent\fR \-\-help
\fBqbittorrent\fR \-\-version
.PP
.SH "DESCRIPTION"
\fBqBittorrent\fR is an advanced Bittorrent client written in C++ / Qt4,
using the \fBrblibtorrent\fR library by Arvid Norberg. qBittorrent aims
to be a good alternative to all other bittorrent clients out there. qBittorrent
is fast, stable, light, it supports unicode and it provides a good integrated search engine.
It also comes with UPnP port forwarding / NAT-PMP, encryption (Azureus compatible), FAST extension (mainline) and PeX support (utorrent compatible).
Please report any problem to http://bugs.qbittorrent.org
.PP
.SH "AUTHOR"
Christophe Dumez <chris@qbittorrent.org>

BIN
doc/qbittorrent.1.gz Normal file

Binary file not shown.

View File

@@ -94,12 +94,13 @@
<includestyle>4</includestyle>
<designerintegration>ExternalDesigner</designerintegration>
<root>/usr/lib/qt4</root>
<qmake>/usr/bin/qmake</qmake>
<designer>/usr/bin/designer</designer>
<qmake>/usr/bin/qmake-qt4</qmake>
<designer>/usr/bin/designer-qt4</designer>
<designerpluginpaths/>
</qt>
<references>
<pcs>automatic_%2Fhome%2Fishanarora%2Fprojects%2Fqbittorrent</pcs>
<pcs>automatic_%2Fhome%2Fchris%2Fqbittorrent_svn%2Ftrunk</pcs>
<pcs>Qt4</pcs>
</references>
<codecompletion>
<automaticCodeCompletion>true</automaticCodeCompletion>
@@ -148,14 +149,14 @@
</kdevfilecreate>
<kdevtrollproject>
<general>
<activedir>src</activedir>
<activedir></activedir>
</general>
<run>
<directoryradio>executable</directoryradio>
<mainprogram>/home/ishanarora/projects/qbittorrent/src/qbittorrent</mainprogram>
<mainprogram>/home/chris/qbittorrent_svn/trunk/src/qbittorrent</mainprogram>
<programargs/>
<globaldebugarguments/>
<globalcwd>/home/ishanarora/projects/qbittorrent</globalcwd>
<globalcwd>/home/chris/qbittorrent_svn/trunk</globalcwd>
<useglobalprogram>true</useglobalprogram>
<terminal>false</terminal>
<autocompile>true</autocompile>
@@ -186,7 +187,7 @@
</cppsupportpart>
<ctagspart>
<customArguments/>
<customTagfilePath>/home/ishanarora/projects/qbittorrent/tags</customTagfilePath>
<customTagfilePath>/home/chris/qbittorrent_svn/trunk/tags</customTagfilePath>
<activeTagsFiles/>
</ctagspart>
<kdevdocumentation>

View File

@@ -12,9 +12,12 @@
<dep type='libboost'>
<required/>
</dep>
<dep type='libcurl'>
<dep type='libcommoncpp2'>
<required/>
</dep>
<dep type='libmagick'/>
<dep type='libzzip'/>
<dep type='python'>
<required/>
</dep>
</qconf>

View File

@@ -60,6 +60,16 @@ public:
if(!found) return false;
conf->addLib(QString("-L") + s);
}
// BUGFIX for Fedora (doesn't support pkg-config?)
QFile issue_file("/etc/issue");
if(issue_file.open(QIODevice::ReadOnly | QIODevice::Text)){
QString content = issue_file.readAll();
issue_file.close();
if(content.indexOf("Fedora") != -1){
qWarning("Fedora detected. WORKAROUND for Fedora pkg-config problem enabled");
conf->addLib("-pthread -lccext2 -lz -lccgnu2 -ldl -lrt");
}
}
return true;
}
};

View File

@@ -1,61 +0,0 @@
/*
-----BEGIN QCMOD-----
name: libcommoncpp2
arg: with-libcurl-inc=[path], Path to libcurl include files
arg: with-libcurl-lib=[path], Path to libcurl library files
-----END QCMOD-----
*/
class qc_libcurl : public ConfObj
{
public:
qc_libcurl(Conf *c) : ConfObj(c) {}
QString name() const { return "libcurl"; }
QString shortname() const { return "libcurl"; }
bool exec(){
QString s;
s = conf->getenv("QC_WITH_LIBCURL_INC");
if(!s.isEmpty()) {
if(!conf->checkHeader(s, "curl/curl.h")) {
return false;
}
}else{
QStringList sl;
sl << "/usr/include";
sl << "/usr/local/include";
bool found = false;
foreach(s, sl){
if(conf->checkHeader(s, "curl/curl.h")){
found = true;
break;
}
}
if(!found) {
return false;
}
}
conf->addIncludePath(s);
s = conf->getenv("QC_WITH_LIBCURL_LIB");
if(!s.isEmpty()) {
if(!QFile::exists(s+QString("/libcurl.so")))
return false;
conf->addLib(QString("-L") + s);
}else{
QStringList sl;
sl << "/usr/lib/";
sl << "/usr/lib64/";
sl << "/usr/local/lib/";
sl << "/usr/local/lib64/";
bool found = false;
foreach(s, sl){
if(QFile::exists(s+QString("libcurl.so"))){
found = true;
break;
}
}
if(!found) return false;
conf->addLib(QString("-L") + s);
}
return true;
}
};

View File

@@ -44,9 +44,9 @@ public:
s = conf->getenv("QC_WITH_LIBMAGICK_LIB");
if(!s.isEmpty()) {
if(!conf->checkLibrary(s, "Magick++")) {
return false;
}
if(!QFile::exists(s+QString("/libMagick++.so"))){
return false;
}
}else{
QStringList sl;
sl << "/usr/lib/";
@@ -55,9 +55,9 @@ public:
sl << "/usr/local/lib64/";
bool found = false;
foreach(s, sl){
if(conf->checkLibrary(s, "Magick++")) {
if(QFile::exists(s+QString("libMagick++.so"))){
found = true;
break;
break;
}
}
if(!found)

View File

@@ -65,6 +65,16 @@ public:
if(!found) return false;
conf->addLib(QString("-L") + s);
}
// BUGFIX for Fedora (doesn't support pkg-config?)
QFile issue_file("/etc/issue");
if(issue_file.open(QIODevice::ReadOnly | QIODevice::Text)){
QString content = issue_file.readAll();
issue_file.close();
if(content.indexOf("Fedora") != -1){
qWarning("Fedora detected. WORKAROUND for Fedora pkg-config problem enabled");
conf->addLib("-lssl -lcrypto -lboost_date_time -lboost_filesystem -lboost_thread -lz -ltorrent");
}
}
return true;
}
};

19
qcm/python.qcm Normal file
View File

@@ -0,0 +1,19 @@
/*
-----BEGIN QCMOD-----
name: python
-----END QCMOD-----
*/
class qc_python : public ConfObj
{
public:
qc_python(Conf *c) : ConfObj(c) {}
QString name() const { return "python >= 2.3"; }
QString shortname() const { return "python"; }
bool exec(){
int r = conf->doCommand("python testpython.py");
if(r == 0)
return true;
else
return false;
}
};

View File

@@ -34,10 +34,11 @@
// Defines for download list list columns
#define F_NAME 0
#define F_SIZE 1
#define F_UPSPEED 2
#define F_LEECH 3
#define F_RATIO 4
#define F_HASH 5
#define F_PROGRESS 2
#define F_UPSPEED 3
#define F_SEEDSLEECH 4
#define F_RATIO 5
#define F_HASH 6
class FinishedListDelegate: public QItemDelegate {
Q_OBJECT
@@ -66,6 +67,20 @@ class FinishedListDelegate: public QItemDelegate {
QItemDelegate::drawDisplay(painter, opt, opt.rect, QString(QByteArray::number(ratio, 'f', 1)));
break;
}
case F_PROGRESS:{
QStyleOptionProgressBarV2 newopt;
double progress = index.data().toDouble()*100.;
newopt.rect = opt.rect;
newopt.text = QString(QByteArray::number(progress, 'f', 1))+QString::fromUtf8("%");
newopt.progress = (int)progress;
newopt.maximum = 100;
newopt.minimum = 0;
newopt.state |= QStyle::State_Enabled;
newopt.textVisible = true;
QApplication::style()->drawControl(QStyle::CE_ProgressBar, &newopt,
painter);
break;
}
default:
QItemDelegate::paint(painter, option, index);
}

File diff suppressed because it is too large Load Diff

View File

@@ -39,10 +39,6 @@ class FinishedTorrents : public QWidget, public Ui::seeding {
FinishedListDelegate *finishedListDelegate;
QStandardItemModel *finishedListModel;
unsigned int nbFinished;
void hideOrShowColumn(int index);
bool loadHiddenColumns();
void saveHiddenColumns();
QAction* getActionHoSCol(int index);
public:
FinishedTorrents(QObject *parent, bittorrent *BTSession);
@@ -57,7 +53,6 @@ class FinishedTorrents : public QWidget, public Ui::seeding {
protected slots:
void showProperties(const QModelIndex &index);
void displayFinishedListMenu(const QPoint&);
void displayFinishedHoSMenu(const QPoint&);
void setRowColor(int row, QString color);
void saveColWidthFinishedList() const;
void sortFinishedList(int index);
@@ -67,11 +62,6 @@ class FinishedTorrents : public QWidget, public Ui::seeding {
void torrentAdded(QString path, QTorrentHandle& h, bool fastResume);
void on_actionSet_upload_limit_triggered();
void notifyTorrentDoubleClicked(const QModelIndex& index);
void hideOrShowColumnName();
void hideOrShowColumnSize();
void hideOrShowColumnUpSpeed();
void hideOrShowColumnLeechers();
void hideOrShowColumnRatio();
public slots:
void addTorrent(QString hash);
@@ -80,11 +70,10 @@ class FinishedTorrents : public QWidget, public Ui::seeding {
void resumeTorrent(QString hash);
void propertiesSelection();
void deleteTorrent(QString hash);
void showPropertiesFromHash(QString hash);
signals:
void torrentMovedFromFinishedList(QString);
void torrentDoubleClicked(QString hash, bool finished);
void torrentDoubleClicked(QString hash);
void finishedTorrentsNumberChanged(unsigned int);
};

File diff suppressed because it is too large Load Diff

View File

@@ -46,7 +46,6 @@ class options_imp;
class QTabWidget;
class QLabel;
class QModelIndex;
class HttpServer;
class GUI : public QMainWindow, private Ui::MainWindow{
Q_OBJECT
@@ -60,7 +59,6 @@ class GUI : public QMainWindow, private Ui::MainWindow{
QTabWidget *tabs;
options_imp *options;
QSystemTrayIcon *myTrayIcon;
QTimer *systrayCreator;
QMenu *myTrayIconMenu;
DownloadingTorrents *downloadingTorrentTab;
FinishedTorrents *finishedTorrentTab;
@@ -76,12 +74,12 @@ class GUI : public QMainWindow, private Ui::MainWindow{
QShortcut *switchDownShortcut;
QShortcut *switchUpShortcut;
QShortcut *switchRSSShortcut;
// Preview
QProcess *previewProcess;
// Search
SearchEngine *searchEngine;
// RSS
RSSImp *rssWidget;
// Web UI
HttpServer *httpServer;
// Misc
QTcpServer *tcpServer;
QTcpSocket *clientConnection;
@@ -98,9 +96,9 @@ class GUI : public QMainWindow, private Ui::MainWindow{
void readParamsOnSocket();
void acceptConnection();
void togglePausedState(QString hash);
void torrentDoubleClicked(QString hash, bool finished);
void on_actionPreview_file_triggered();
void previewFile(QString filePath);
void cleanTempPreviewFile(int, QProcess::ExitStatus) const;
void balloonClicked();
void writeSettings();
void readSettings();
@@ -110,7 +108,6 @@ class GUI : public QMainWindow, private Ui::MainWindow{
void updateFinishedTorrentNumber(unsigned int nb);
void fullDiskError(QTorrentHandle& h) const;
void handleDownloadFromUrlFailure(QString, QString) const;
void createSystrayDelayed();
// Keyboard shortcuts
void createKeyboardShortcuts();
void displayDownTab() const;
@@ -137,13 +134,10 @@ class GUI : public QMainWindow, private Ui::MainWindow{
void processScannedFiles(const QStringList& params);
void processDownloadedFiles(QString path, QString url);
void downloadFromURLList(const QStringList& urls);
void deleteTorrent(QString hash);
void deleteRatioTorrent(QString fileName);
void deleteTorrent(QString hash, QString fileName, bool finished);
void finishedTorrent(QTorrentHandle& h) const;
void torrentChecked(QString hash) const;
void updateLists();
bool initWebUi(QString username, QString password, int port);
void pauseTorrent(QString hash);
// Options slots
void on_actionOptions_triggered();
void OptionsSaved(QString info, bool deleteOptions);
@@ -154,9 +148,6 @@ class GUI : public QMainWindow, private Ui::MainWindow{
public slots:
void trackerAuthenticationRequired(QTorrentHandle& h);
void setTabText(int index, QString text) const;
void openDestinationFolder() const;
void goBuyPage() const;
void updateRatio();
protected:
void closeEvent(QCloseEvent *);
@@ -167,7 +158,7 @@ class GUI : public QMainWindow, private Ui::MainWindow{
GUI(QWidget *parent=0, QStringList torrentCmdLine=QStringList());
~GUI();
// Methods
int getCurrentTabIndex() const;
unsigned int getCurrentTabIndex() const;
QPoint screenCenter() const;
};

Binary file not shown.

Before

Width:  |  Height:  |  Size: 813 B

View File

@@ -1,6 +1,7 @@
[Desktop Entry]
Categories=Qt;Application;Network;P2P
Comment=V1.1.0
Comment=V1.0.0
Encoding=UTF-8
Exec=qbittorrent
GenericName=Bittorrent client
GenericName[bg]=Торент клиент
@@ -8,7 +9,6 @@ GenericName[de]=Bittorren Client
GenericName[el]=Τορεντ πελάτης
GenericName[es]=Cliente Bittorrent
GenericName[fr]=Client Bittorrent
GenericName[it]=Client Bittorrent
GenericName[ja]=Bittorrent クライアント
GenericName[ko]=비토렌트 클라이언트
GenericName[nl]=Bittorrent client

Binary file not shown.

Before

Width:  |  Height:  |  Size: 75 KiB

After

Width:  |  Height:  |  Size: 68 KiB

View File

@@ -16,194 +16,13 @@
<string/>
</property>
<widget class="QWidget" name="centralwidget" >
<property name="geometry" >
<rect>
<x>0</x>
<y>58</y>
<width>849</width>
<height>505</height>
</rect>
</property>
<layout class="QVBoxLayout" name="verticalLayout" >
<item>
<layout class="QHBoxLayout" name="_3" >
<property name="spacing" >
<number>6</number>
</property>
<property name="margin" >
<number>0</number>
</property>
<item>
<spacer>
<property name="orientation" >
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeHint" stdset="0" >
<size>
<width>40</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
<item>
<widget class="QLabel" name="lbl_DLSpeed_2" >
<property name="text" >
<string>Total DL Speed:</string>
</property>
<property name="alignment" >
<set>Qt::AlignBottom|Qt::AlignLeading|Qt::AlignLeft</set>
</property>
</widget>
</item>
<item>
<widget class="QLCDNumber" name="LCD_DownSpeed" >
<property name="autoFillBackground" >
<bool>true</bool>
</property>
<property name="frameShadow" >
<enum>QFrame::Raised</enum>
</property>
<property name="smallDecimalPoint" >
<bool>false</bool>
</property>
<property name="numDigits" >
<number>6</number>
</property>
<property name="segmentStyle" >
<enum>QLCDNumber::Flat</enum>
</property>
<property name="value" stdset="0" >
<double>0.000000000000000</double>
</property>
<property name="intValue" stdset="0" >
<number>0</number>
</property>
</widget>
</item>
<item>
<widget class="QLabel" name="unitDL_2" >
<property name="text" >
<string>KiB/s</string>
</property>
<property name="alignment" >
<set>Qt::AlignBottom|Qt::AlignLeading|Qt::AlignLeft</set>
</property>
</widget>
</item>
<item>
<spacer>
<property name="orientation" >
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeHint" stdset="0" >
<size>
<width>40</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
<item>
<widget class="QLabel" name="label_2" >
<property name="text" >
<string>Session ratio: </string>
</property>
<property name="alignment" >
<set>Qt::AlignBottom|Qt::AlignLeading|Qt::AlignLeft</set>
</property>
</widget>
</item>
<item>
<widget class="QLCDNumber" name="LCD_Ratio" >
<property name="autoFillBackground" >
<bool>true</bool>
</property>
<property name="numDigits" >
<number>4</number>
</property>
<property name="segmentStyle" >
<enum>QLCDNumber::Flat</enum>
</property>
<property name="value" stdset="0" >
<double>1.000000000000000</double>
</property>
</widget>
</item>
<item>
<widget class="QLabel" name="lbl_ratio_icon" >
<property name="text" >
<string/>
</property>
</widget>
</item>
<item>
<spacer>
<property name="orientation" >
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeHint" stdset="0" >
<size>
<width>40</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
<item>
<widget class="QLabel" name="lbl_UPSpeed_2" >
<property name="text" >
<string>Total UP Speed:</string>
</property>
<property name="alignment" >
<set>Qt::AlignBottom|Qt::AlignLeading|Qt::AlignLeft</set>
</property>
</widget>
</item>
<item>
<widget class="QLCDNumber" name="LCD_UpSpeed" >
<property name="autoFillBackground" >
<bool>true</bool>
</property>
<property name="smallDecimalPoint" >
<bool>false</bool>
</property>
<property name="numDigits" >
<number>6</number>
</property>
<property name="segmentStyle" >
<enum>QLCDNumber::Flat</enum>
</property>
<property name="value" stdset="0" >
<double>0.000000000000000</double>
</property>
</widget>
</item>
<item>
<widget class="QLabel" name="unitUP_2" >
<property name="text" >
<string>KiB/s</string>
</property>
<property name="alignment" >
<set>Qt::AlignBottom|Qt::AlignLeading|Qt::AlignLeft</set>
</property>
</widget>
</item>
<item>
<spacer>
<property name="orientation" >
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeHint" stdset="0" >
<size>
<width>40</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
</layout>
</item>
<layout class="QVBoxLayout" >
<property name="spacing" >
<number>6</number>
</property>
<property name="margin" >
<number>9</number>
</property>
</layout>
</widget>
<widget class="QMenuBar" name="menubar" >
@@ -212,7 +31,7 @@
<x>0</x>
<y>0</y>
<width>849</width>
<height>26</height>
<height>29</height>
</rect>
</property>
<widget class="QMenu" name="menu_Edit" >
@@ -263,14 +82,6 @@
<property name="enabled" >
<bool>true</bool>
</property>
<property name="geometry" >
<rect>
<x>0</x>
<y>26</y>
<width>849</width>
<height>32</height>
</rect>
</property>
<property name="contextMenuPolicy" >
<enum>Qt::NoContextMenu</enum>
</property>
@@ -287,7 +98,7 @@
</size>
</property>
<attribute name="toolBarArea" >
<enum>TopToolBarArea</enum>
<number>4</number>
</attribute>
<attribute name="toolBarBreak" >
<bool>false</bool>

View File

@@ -174,16 +174,14 @@ class PropListDelegate: public QItemDelegate {
}
break;
case 1:
// if(old_val != NORMAL){
// model->setData(index, QVariant(NORMAL));
// if(filteredFilesChanged != 0)
// *filteredFilesChanged = true;
// } else {
model->setData(index, QVariant(HIGH));
if(old_val != NORMAL){
model->setData(index, QVariant(NORMAL));
if(filteredFilesChanged != 0)
*filteredFilesChanged = true;
// }
} else {
model->setData(index, QVariant(HIGH));
model->setData(index, QVariant(NORMAL));
}
break;
case 2:
if(old_val != HIGH){

View File

@@ -1,53 +0,0 @@
/*
* Bittorrent Client using Qt4 and libtorrent.
* Copyright (C) 2006 Christophe Dumez
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*
* Contact : chris@qbittorrent.org
*/
#ifndef TRACKERSADDITION_H
#define TRACKERSADDITION_H
#include <QDialog>
#include <QStringList>
#include "ui_trackersAdd.h"
class TrackersAddDlg : public QDialog, private Ui::TrackersAdditionDlg{
Q_OBJECT
public:
TrackersAddDlg(QWidget *parent): QDialog(parent){
setupUi(this);
setAttribute(Qt::WA_DeleteOnClose);
show();
}
~TrackersAddDlg(){}
signals:
void TrackersToAdd(QStringList trackers);
public slots:
void on_buttonBox_accepted() {
QStringList trackers = trackers_list->toPlainText().trimmed().split("\n");
if(trackers.size()) {
emit TrackersToAdd(trackers);
}
}
};
#endif

View File

@@ -27,19 +27,19 @@
#include <QDir>
#include "misc.h"
class torrent_file {
class file {
private:
torrent_file *parent;
file *parent;
bool is_dir;
QString rel_path;
QList<torrent_file*> children;
QList<file*> children;
size_type size;
float progress;
int priority;
int index; // Index in torrent_info
public:
torrent_file(torrent_file *parent, QString path, bool dir, size_type size=0, int index=-1, float progress=0., int priority=1): parent(parent), is_dir(dir), size(size), progress(progress), priority(priority), index(index){
file(file *parent, QString path, bool dir, size_type size=0, int index=-1, float progress=0., int priority=1): parent(parent), is_dir(dir), size(size), progress(progress), priority(priority), index(index){
qDebug("created a file with index %d", index);
rel_path = QDir::cleanPath(path);
if(parent) {
@@ -48,7 +48,7 @@ class torrent_file {
}
}
~torrent_file() {
~file() {
qDeleteAll(children);
}
@@ -68,7 +68,7 @@ class torrent_file {
}
float wanted = 0.;
float done = 0.;
torrent_file *child;
file *child;
foreach(child, children) {
wanted += child->getSize();
done += child->getSize()*child->getProgress();
@@ -80,7 +80,7 @@ class torrent_file {
void updatePriority(int prio) {
Q_ASSERT(is_dir);
torrent_file *child;
file *child;
foreach(child, children) {
if(child->getPriority() != prio) return;
}
@@ -111,13 +111,13 @@ class torrent_file {
return (!children.isEmpty());
}
QList<torrent_file*> getChildren() const {
QList<file*> getChildren() const {
return children;
}
torrent_file* getChild(QString fileName) const {
file* getChild(QString fileName) const {
Q_ASSERT(is_dir);
torrent_file* f;
file* f;
foreach(f, children) {
if(f->name() == fileName) return f;
}
@@ -130,10 +130,10 @@ class torrent_file {
parent->addBytes(b);
}
torrent_file* addChild(QString fileName, bool dir, size_type size=0, int index = -1, float progress=0., int priority=1) {
file* addChild(QString fileName, bool dir, size_type size=0, int index = -1, float progress=0., int priority=1) {
Q_ASSERT(is_dir);
qDebug("Adding a new child of size: %ld", (long)size);
torrent_file *f = new torrent_file(this, QDir::cleanPath(rel_path+QDir::separator()+fileName), dir, size, index, progress, priority);
file *f = new file(this, QDir::cleanPath(rel_path+QDir::separator()+fileName), dir, size, index, progress, priority);
children << f;
if(size) {
addBytes(size);
@@ -148,7 +148,7 @@ class torrent_file {
return true;
}
bool success = true;
torrent_file *f;
file *f;
qDebug("We have %d children", children.size());
foreach(f, children) {
bool s = f->removeFromFS(saveDir);
@@ -169,16 +169,16 @@ class torrent_file {
class arborescence {
private:
torrent_file *root;
file *root;
public:
arborescence(torrent_info t) {
torrent_info::file_iterator fi = t.begin_files();
if(t.num_files() > 1) {
root = new torrent_file(0, misc::toQString(t.name()), true);
root = new file(0, misc::toQString(t.name()), true);
} else {
// XXX: Will crash if there is no file in torrent
root = new torrent_file(0, misc::toQString(t.name()), false, fi->size, 0);
root = new file(0, misc::toQString(t.name()), false, fi->size, 0);
return;
}
int i = 0;
@@ -196,11 +196,11 @@ class arborescence {
torrent_info::file_iterator fi = t.begin_files();
if(t.num_files() > 1) {
qDebug("More than one file in the torrent, setting a folder as root");
root = new torrent_file(0, misc::toQString(t.name()), true);
root = new file(0, misc::toQString(t.name()), true);
} else {
// XXX: Will crash if there is no file in torrent
qDebug("one file in the torrent, setting it as root with index 0");
root = new torrent_file(0, misc::toQString(t.name()), false, fi->size, 0, fp[0], prioritiesTab[0]);
root = new file(0, misc::toQString(t.name()), false, fi->size, 0, fp[0], prioritiesTab[0]);
return;
}
int i = 0;
@@ -218,7 +218,7 @@ class arborescence {
delete root;
}
torrent_file* getRoot() const {
file* getRoot() const {
return root;
}
@@ -240,13 +240,13 @@ class arborescence {
relative_path.remove(0, 1);
QStringList fileNames = relative_path.split(QDir::separator());
QString fileName;
torrent_file *dad = root;
file *dad = root;
unsigned int nb_i = 0;
unsigned int size = fileNames.size();
foreach(fileName, fileNames) {
++nb_i;
if(fileName == ".") continue;
torrent_file* child = dad->getChild(fileName);
file* child = dad->getChild(fileName);
if(!child) {
if(nb_i != size) {
// Folder

File diff suppressed because it is too large Load Diff

View File

@@ -25,7 +25,6 @@
#include <QList>
#include <QPair>
#include <QStringList>
#include <QDateTime>
#include <libtorrent/session.hpp>
#include <libtorrent/ip_filter.hpp>
@@ -36,7 +35,6 @@ using namespace libtorrent;
class downloadThread;
class deleteThread;
class QTimer;
class FilterParserThread;
class bittorrent : public QObject{
Q_OBJECT
@@ -46,17 +44,18 @@ class bittorrent : public QObject{
QString scan_dir;
QTimer *timerScan;
QTimer *timerAlerts;
QTimer *fastResumeSaver;
QTimer *BigRatioTimer;
bool DHTEnabled;
downloadThread *downloader;
QString defaultSavePath;
QStringList torrentsToPauseAfterChecking;
QHash<QString, QDateTime> TorrentsStartTime;
QHash<QString, size_type> TorrentsStartData;
QHash<QString, bool> reloadingTorrents;
QHash<QString, QList<qlonglong> > ETAstats;
QHash<QString, qlonglong> ETAs;
QHash<QString, QPair<size_type,size_type> > ratioData;
QHash<QString, QHash<QString, QString> > trackersErrors;
QTimer *ETARefresher;
QHash<QString, QList<QPair<QString, QString> > > trackersErrors;
deleteThread *deleter;
QStringList waitingForPause;
QStringList finishedTorrents;
QStringList unfinishedTorrents;
bool preAllocateAll;
@@ -64,12 +63,6 @@ class bittorrent : public QObject{
int maxConnecsPerTorrent;
int maxUploadsPerTorrent;
float max_ratio;
bool UPnPEnabled;
bool NATPMPEnabled;
bool LSDEnabled;
FilterParserThread *filterParser;
QString filterPath;
int folderScanInterval; // in seconds
protected:
QString getSavePath(QString hash);
@@ -87,16 +80,14 @@ class bittorrent : public QObject{
session_status getSessionStatus() const;
int getListenPort() const;
QStringList getTorrentsToPauseAfterChecking() const;
qlonglong getETA(QString hash) const;
long getETA(QString hash) const;
float getRealRatio(QString hash) const;
session* getSession() const;
QHash<QString, QString> getTrackersErrors(QString hash) const;
QList<QPair<QString, QString> > getTrackersErrors(QString hash) const;
QStringList getFinishedTorrents() const;
QStringList getUnfinishedTorrents() const;
bool isFinished(QString hash) const;
bool has_filtered_files(QString hash) const;
unsigned int getFinishedPausedTorrentsNb() const;
unsigned int getUnfinishedPausedTorrentsNb() const;
public slots:
void addTorrent(QString path, bool fromScanDir = false, QString from_url = QString(), bool resumed = false);
@@ -105,18 +96,16 @@ class bittorrent : public QObject{
void deleteTorrent(QString hash, bool permanent = false);
bool pauseTorrent(QString hash);
bool resumeTorrent(QString hash);
void pauseAllTorrents();
void resumeAllTorrents();
void saveDHTEntry();
void preAllocateAllFiles(bool b);
void saveFastResumeAndRatioData();
void saveFastResumeAndRatioData(QString hash);
void enableDirectoryScanning(QString scan_dir);
void disableDirectoryScanning();
void enablePeerExchange();
void enableIPFilter(QString filter);
void enableIPFilter(ip_filter filter);
void disableIPFilter();
void resumeUnfinishedTorrents();
void updateETAs();
void saveTorrentSpeedLimits(QString hash);
void loadTorrentSpeedLimits(QString hash);
void saveDownloadUploadForTorrent(QString hash);
@@ -146,9 +135,7 @@ class bittorrent : public QObject{
void enableUPnP(bool b);
void enableNATPMP(bool b);
void enableLSD(bool b);
bool enableDHT(bool b);
void reloadTorrent(const QTorrentHandle &h, bool full_alloc);
void setTimerScanInterval(int secs);
void enableDHT(bool b);
protected slots:
void scanDirectory();
@@ -156,15 +143,14 @@ class bittorrent : public QObject{
void processDownloadedFile(QString, QString);
bool loadTrackerFile(QString hash);
void saveTrackerFile(QString hash);
void pauseAndReloadTorrent(QTorrentHandle h, bool full_alloc);
void reloadTorrent(const QTorrentHandle &h, bool full_alloc); // This is protected now, call pauseAndReloadTorrent() instead
void deleteBigRatios();
signals:
void invalidTorrent(QString path);
void duplicateTorrent(QString path);
void addedTorrent(QString path, QTorrentHandle& h, bool fastResume);
void deletedTorrent(QString hash);
void pausedTorrent(QString hash);
void resumedTorrent(QString hash);
void finishedTorrent(QTorrentHandle& h);
void fullDiskError(QTorrentHandle& h);
void trackerError(QString hash, QString time, QString msg);
@@ -179,9 +165,7 @@ class bittorrent : public QObject{
void fastResumeDataRejected(QString name);
void urlSeedProblem(QString url, QString msg);
void torrentFinishedChecking(QString hash);
void torrent_ratio_deleted(QString fileName);
void UPnPError(QString msg);
void UPnPSuccess(QString msg);
void torrent_deleted(QString hash, QString fileName, bool finished);
};
#endif

View File

@@ -6,7 +6,7 @@
<x>0</x>
<y>0</y>
<width>592</width>
<height>655</height>
<height>590</height>
</rect>
</property>
<property name="windowTitle" >
@@ -477,20 +477,6 @@
</property>
</widget>
</item>
<item>
<widget class="QLabel" name="progressLbl" >
<property name="text" >
<string>Progress:</string>
</property>
</widget>
</item>
<item>
<widget class="QProgressBar" name="progressBar" >
<property name="value" >
<number>0</number>
</property>
</widget>
</item>
<item>
<layout class="QHBoxLayout" >
<property name="spacing" >

View File

@@ -36,7 +36,6 @@
#include <libtorrent/file_pool.hpp>
#include "createtorrent_imp.h"
#include "misc.h"
using namespace libtorrent;
using namespace boost::filesystem;
@@ -44,17 +43,9 @@ using namespace boost::filesystem;
createtorrent::createtorrent(QWidget *parent): QDialog(parent){
setupUi(this);
setAttribute(Qt::WA_DeleteOnClose);
creatorThread = new torrentCreatorThread();
connect(creatorThread, SIGNAL(creationSuccess(QString)), this, SLOT(handleCreationSucess(QString)));
connect(creatorThread, SIGNAL(creationFailure(QString)), this, SLOT(handleCreationFailure(QString)));
connect(creatorThread, SIGNAL(updateProgress(int)), this, SLOT(updateProgressBar(int)));
show();
}
createtorrent::~createtorrent() {
delete creatorThread;
}
void createtorrent::on_addFolder_button_clicked(){
QString dir = QFileDialog::getExistingDirectory(this, tr("Select a folder to add to the torrent"), QDir::homePath(), QFileDialog::ShowDirsOnly);
if(!dir.isEmpty())
@@ -129,13 +120,11 @@ void createtorrent::on_addURLSeed_button_clicked(){
// Subfunction to add files to a torrent_info structure
// Written by Arvid Norberg (libtorrent Author)
void add_files(torrent_info& t, path const& p, path const& l){
qDebug("p: %s, l: %s, l.leaf(): %s", p.string().c_str(), l.string().c_str(), l.leaf().c_str());
path f(p / l);
if (is_directory(f)){
for (directory_iterator i(f), end; i != end; ++i)
add_files(t, p, l / i->leaf());
}else{
qDebug("Adding %s", l.string().c_str());
t.add_file(l, file_size(f));
}
}
@@ -152,8 +141,6 @@ QStringList createtorrent::allItems(QListWidget *list){
// Main function that create a .torrent file
void createtorrent::on_createButton_clicked(){
QString input = textInputPath->text().trimmed();
if (input.endsWith(QDir::separator()))
input.chop(1);
if(input.isEmpty()){
QMessageBox::critical(0, tr("No input path set"), tr("Please type an input path first"));
return;
@@ -170,70 +157,27 @@ void createtorrent::on_createButton_clicked(){
} else {
return;
}
QStringList url_seeds = allItems(URLSeeds_list);
QString comment = txt_comment->toPlainText();
creatorThread->create(input, destination, trackers, url_seeds, comment, check_private->isChecked(), getPieceSize());
}
void createtorrent::handleCreationFailure(QString msg) {
QMessageBox::information(0, tr("Torrent creation"), tr("Torrent creation was unsuccessful, reason: %1").arg(msg));
hide();
}
void createtorrent::handleCreationSuccess(QString path, const char* branch_path, QString hash) {
if(checkStartSeeding->isChecked()) {
// Create save path file
QFile savepath_file(misc::qBittorrentPath()+QString::fromUtf8("BT_backup")+QDir::separator()+hash+QString::fromUtf8(".savepath"));
savepath_file.open(QIODevice::WriteOnly | QIODevice::Text);
savepath_file.write(branch_path);
savepath_file.close();
emit torrent_to_seed(path);
}
QMessageBox::information(0, tr("Torrent creation"), tr("Torrent was created successfully:")+" "+path);
hide();
}
void createtorrent::updateProgressBar(int progress) {
progressBar->setValue(progress);
}
//
// Torrent Creator Thread
//
void torrentCreatorThread::create(QString _input_path, QString _save_path, QStringList _trackers, QStringList _url_seeds, QString _comment, bool _is_private, int _piece_size) {
input_path = _input_path;
save_path = _save_path;
trackers = _trackers;
url_seeds = _url_seeds;
comment = _comment;
is_private = _is_private;
piece_size = _piece_size;
abort = false;
start();
}
void torrentCreatorThread::run() {
emit updateProgress(0);
char const* creator_str = "qBittorrent "VERSION;
try {
boost::intrusive_ptr<torrent_info> t(new torrent_info);
ofstream out(complete(path((const char*)save_path.toUtf8())), std::ios_base::binary);
ofstream out(complete(path((const char*)destination.toUtf8())), std::ios_base::binary);
path full_path;
// Adding files to the torrent
path full_path = complete(path(input_path.toUtf8().data()));
full_path = complete(path(input.toUtf8().data()));
add_files(*t, full_path.branch_path(), full_path.leaf());
if(abort) return;
// Set piece size
int piece_size = getPieceSize();
t->set_piece_size(piece_size);
// Add url seeds
QStringList urlSeeds = allItems(URLSeeds_list);
QString seed;
foreach(seed, url_seeds){
foreach(seed, urlSeeds){
t->add_url_seed(seed.toUtf8().data());
}
for(int i=0; i<trackers.size(); ++i){
t->add_tracker(trackers.at(i).toUtf8().data());
}
if(abort) return;
// calculate the hash for all pieces
file_pool fp;
boost::scoped_ptr<storage_interface> st(default_storage_constructor(t, full_path.branch_path(), fp));
@@ -243,26 +187,28 @@ void torrentCreatorThread::run() {
st->read(&buf[0], i, 0, t->piece_size(i));
hasher h(&buf[0], t->piece_size(i));
t->set_hash(i, h.final());
emit updateProgress((int)(i*100./(float)num));
if(abort) return;
}
// Set qBittorrent as creator and add user comment to
// torrent_info structure
t->set_creator(creator_str);
t->set_comment((const char*)comment.toUtf8());
t->set_comment((const char*)txt_comment->toPlainText().toUtf8());
// Is private ?
if(is_private){
if(check_private->isChecked()){
t->set_priv(true);
}
if(abort) return;
// create the torrent and print it to out
entry e = t->create_torrent();
libtorrent::bencode(std::ostream_iterator<char>(out), e);
out.flush();
emit updateProgress(100);
emit creationSuccess(save_path, full_path.branch_path().string().c_str(), misc::toQString(t->info_hash()));
if(checkStartSeeding->isChecked())
emit torrent_to_seed(destination);
}
catch (std::exception& e){
emit creationFailure(QString::fromUtf8(e.what()));
std::cerr << e.what() << "\n";
QMessageBox::information(0, tr("Torrent creation"), tr("Torrent creation was unsuccessful, reason: %1").arg(QString::fromUtf8(e.what())));
hide();
return;
}
hide();
QMessageBox::information(0, tr("Torrent creation"), tr("Torrent was created successfully:")+" "+destination);
}

View File

@@ -22,48 +22,13 @@
#ifndef CREATE_TORRENT_IMP_H
#define CREATE_TORRENT_IMP_H
#include <QThread>
#include "ui_createtorrent.h"
class torrentCreatorThread : public QThread {
Q_OBJECT
QString input_path;
QString save_path;
QStringList trackers;
QStringList url_seeds;
QString comment;
bool is_private;
int piece_size;
bool abort;
public:
torrentCreatorThread() {}
~torrentCreatorThread() {
abort = true;
wait();
}
void create(QString _input_path, QString _save_path, QStringList _trackers, QStringList _url_seeds, QString _comment, bool _is_private, int _piece_size);
protected:
void run();
signals:
void creationFailure(QString msg);
void creationSuccess(QString path, const char* branch_path, QString hash);
void updateProgress(int progress);
};
class createtorrent : public QDialog, private Ui::createTorrentDialog{
Q_OBJECT
private:
torrentCreatorThread *creatorThread;
public:
createtorrent(QWidget *parent = 0);
~createtorrent();
QStringList allItems(QListWidget *list);
int getPieceSize() const;
@@ -78,9 +43,6 @@ class createtorrent : public QDialog, private Ui::createTorrentDialog{
void on_removeTracker_button_clicked();
void on_addURLSeed_button_clicked();
void on_removeURLSeed_button_clicked();
void handleCreationFailure(QString msg);
void handleCreationSuccess(QString path, const char* branch_path, QString hash);
void updateProgressBar(int progress);
};
#endif

File diff suppressed because it is too large Load Diff

Some files were not shown because too many files have changed in this diff Show More