Compare commits

..

36 Commits

Author SHA1 Message Date
Christophe Dumez
b6b124c7b6 Tagged todays releases 2010-10-17 15:45:55 +00:00
Christophe Dumez
df42c4d59f Bump to v2.4.6 2010-10-17 15:27:25 +00:00
Christophe Dumez
8047495b2e BUGFIX: Fix moving of a torrent to an unexisting directory 2010-10-17 15:16:25 +00:00
Christophe Dumez
de04b47c29 BUGFIX: Fix detection of files at final destination when temp dir is used 2010-10-17 14:53:03 +00:00
Christophe Dumez
b709bec24d Fix compilation error with libtorrent v0.14 2010-10-17 11:47:16 +00:00
Christophe Dumez
35f93e8e16 BUGFIX: The properties panel data would sometimes not match the selected torrent 2010-10-17 09:12:24 +00:00
Christophe Dumez
554a84f8b0 Improvement to last commit 2010-10-17 09:01:34 +00:00
Christophe Dumez
f26fcabde1 BUGFIX: Fix "torrent seeding after creation" feature 2010-10-17 08:48:32 +00:00
Christophe Dumez
75b91c204d Forgot to commit this file 2010-10-17 08:42:34 +00:00
Christophe Dumez
0837c25602 Updated Changelog 2010-10-12 16:09:03 +00:00
Christophe Dumez
34f8937b8d Code optimization 2010-10-12 16:08:09 +00:00
Christophe Dumez
4a7f3ee415 Some more code optimization 2010-10-11 21:30:11 +00:00
Christophe Dumez
b218531ff7 BUGFIX: Piece availability/downloaded widgets performance improvement 2010-10-11 21:08:49 +00:00
Christophe Dumez
e96dee2038 Fix possible variable overflow 2010-10-11 20:01:56 +00:00
Christophe Dumez
080105c088 Bump to v2.4.5 2010-10-11 19:43:50 +00:00
Christophe Dumez
5d2535c1c1 BUGFIX: Improved peer hostname resolution with caching 2010-10-10 21:06:07 +00:00
Christophe Dumez
49b21059fa BUGFIX: Fix display of URL seeds in the UI 2010-10-10 15:43:53 +00:00
Christophe Dumez
c1af948649 Fix issues introduced recently related to torrent completion 2010-10-09 15:04:15 +00:00
Christophe Dumez
36ad3df9e7 Fix feature to keep incomplete torrents in a separate folder 2010-10-09 08:57:26 +00:00
Christophe Dumez
e607d721a2 Forgot to commit gpl.html 2010-10-08 17:52:10 +00:00
Christophe Dumez
5bfbfeb665 Fix some cosmetic issues in about dlg 2010-10-08 17:50:45 +00:00
Ishan Arora
1f1eabb1e9 moved windows path configs from src/src.pro to winconf.pri 2010-10-05 01:12:29 +00:00
Christophe Dumez
762050f8fc Remember torrent seeding date correctly 2010-10-02 12:55:39 +00:00
Christophe Dumez
e3c1270205 Code cleanup 2010-10-02 12:14:29 +00:00
Christophe Dumez
414685910b Fix to last commit 2010-10-01 20:52:53 +00:00
Christophe Dumez
d61b9c5d4d Bump to v2.4.4 2010-10-01 20:22:20 +00:00
Christophe Dumez
cf86a1cecd BUGFIX: Fix possible search engine plugin update 2010-10-01 20:19:17 +00:00
Christophe Dumez
a3f3287e24 Clean program exit on system shutdown/log out 2010-10-01 20:05:54 +00:00
Christophe Dumez
6e18d780ba Updated Changelog 2010-09-28 16:57:31 +00:00
Christophe Dumez
7dde763fc6 Fix wrong mapping to source model 2010-09-28 16:56:49 +00:00
Christophe Dumez
8c85ffca5f Fix tiny memory leak 2010-09-27 20:47:26 +00:00
Christophe Dumez
321e568d86 TorrentDownloads performance improvement 2010-09-27 19:48:58 +00:00
Christophe Dumez
e0649a7e78 Bump to v2.4.3 2010-09-27 17:49:33 +00:00
Christophe Dumez
4cd3233cd0 Better fix for encoding issue 2010-09-27 17:36:42 +00:00
Christophe Dumez
c554528afe BUGFIX: Fix possible crash when changing the save path in addition dialog 2010-09-27 17:35:34 +00:00
Christophe Dumez
7ab7f4b0fc BUGFIX: Fix encoding issue in command line parameters processing 2010-09-27 17:19:27 +00:00
35 changed files with 992 additions and 551 deletions

View File

@@ -1,3 +1,25 @@
* Sun Oct 17 2010 - Christophe Dumez <chris@qbittorrent.org> - v2.4.6
- BUGFIX: Fix "torrent seeding after creation" feature
- BUGFIX: The properties panel data would sometimes not match the selected torrent
- BUGFIX: Fix detection of files at final destination when temp dir is used
- BUGFIX: Fix moving of a torrent to an unexisting directory
* Tue Oct 12 2010 - Christophe Dumez <chris@qbittorrent.org> - v2.4.5
- BUGFIX: Remember torrent completion date correctly
- BUGFIX: Fix feature to keep incomplete torrents in a separate folder
- BUGFIX: Fix display of URL seeds in the UI
- BUGFIX: Improved peer hostname resolution with caching
- BUGFIX: Piece availability/downloaded widgets performance improvement
* Fri Oct 1 2010 - Christophe Dumez <chris@qbittorrent.org> - v2.4.4
- BUGFIX: Clean program exit on system shutdown/logout
- BUGFIX: Fix possible search engine plugin update
* Tue Sep 28 2010 - Christophe Dumez <chris@qbittorrent.org> - v2.4.3
- BUGFIX: Fix encoding issue in command line parameters processing
- BUGFIX: Fix possible crash when changing the save path in addition dialog
- BUGFIX: Fix wrong mapping to source model
* Sun Sep 26 2010 - Christophe Dumez <chris@qbittorrent.org> - v2.4.2
- BUGFIX: Fix display of torrent content in addition dialog
- BUGFIX: Really fix manual editing of save path in torrent addition dialog

View File

@@ -0,0 +1,26 @@
/*
-----BEGIN QCMOD-----
name: libboost
arg: with-qtsingleapplication=[system|shipped], Use the shipped qtsingleapplication library or the system one
-----END QCMOD-----
*/
class qc_qtsingleapplication : public ConfObj
{
public:
qc_qtsingleapplication(Conf *c) : ConfObj(c) {}
QString name() const { return "qtsingleapplication library"; }
QString shortname() const { return "qtsingleapplication"; }
bool exec(){
QString s;
s = conf->getenv("QC_WITH_QTSINGLEAPPLICATION");
if(s.compare("system", Qt::CaseInsensitive) == 0) {
// System
conf->addDefine("USE_SYSTEM_QTSINGLEAPPLICATION");
printf(" [system] ");
} else {
printf(" [shipped] ");
}
return true;
}
};

View File

@@ -42,6 +42,7 @@
#include <QClipboard>
#include <QCloseEvent>
#include <QShortcut>
#include <QScrollBar>
#include "GUI.h"
#include "transferlistwidget.h"
@@ -71,6 +72,7 @@
void qt_mac_set_dock_menu(QMenu *menu);
#endif
#include "lineedit.h"
#include "sessionapplication.h"
using namespace libtorrent;
@@ -88,6 +90,8 @@ GUI::GUI(QWidget *parent, QStringList torrentCmdLine) : QMainWindow(parent), for
ui_locked = Preferences::isUILocked();
setWindowTitle(tr("qBittorrent %1", "e.g: qBittorrent v0.x").arg(QString::fromUtf8(VERSION)));
displaySpeedInTitle = Preferences::speedInTitleBar();
// Clean exit on log out
connect(static_cast<SessionApplication*>(qApp), SIGNAL(sessionIsShuttingDown()), this, SLOT(deleteBTSession()));
// Setting icons
this->setWindowIcon(QIcon(QString::fromUtf8(":/Icons/skin/qbittorrent32.png")));
actionOpen->setIcon(QIcon(QString::fromUtf8(":/Icons/skin/open.png")));
@@ -110,7 +114,7 @@ GUI::GUI(QWidget *parent, QStringList torrentCmdLine) : QMainWindow(parent), for
actionSet_global_download_limit->setIcon(QIcon(QString::fromUtf8(":/Icons/skin/download.png")));
actionDocumentation->setIcon(QIcon(QString::fromUtf8(":/Icons/skin/qb_question.png")));
actionLock_qBittorrent->setIcon(QIcon(QString::fromUtf8(":/Icons/oxygen/encrypted32.png")));
QMenu *lockMenu = new QMenu();
lockMenu = new QMenu();
QAction *defineUiLockPasswdAct = lockMenu->addAction(tr("Set the password..."));
connect(defineUiLockPasswdAct, SIGNAL(triggered()), this, SLOT(defineUILockPassword()));
actionLock_qBittorrent->setMenu(lockMenu);
@@ -248,6 +252,16 @@ GUI::GUI(QWidget *parent, QStringList torrentCmdLine) : QMainWindow(parent), for
#endif
}
void GUI::deleteBTSession() {
guiUpdater->stop();
status_bar->stopTimer();
if(BTSession) {
delete BTSession;
BTSession = 0;
}
QTimer::singleShot(0, this, SLOT(close()));
}
// Destructor
GUI::~GUI() {
qDebug("GUI destruction");
@@ -258,7 +272,9 @@ GUI::~GUI() {
#endif
// Async deletion of Bittorrent session as early as possible
// in order to speed up exit
session_proxy sp = BTSession->asyncDeletion();
session_proxy sp;
if(BTSession)
sp = BTSession->asyncDeletion();
// Some saving
properties->saveSettings();
disconnect(tabs, SIGNAL(currentChanged(int)), this, SLOT(tab_changed(int)));
@@ -269,6 +285,7 @@ GUI::~GUI() {
delete search_filter;
delete transferList;
delete guiUpdater;
delete lockMenu;
if(createTorrentDlg)
delete createTorrentDlg;
if(console)
@@ -662,7 +679,7 @@ void GUI::closeEvent(QCloseEvent *e) {
e->accept();
return;
}
if(settings.value(QString::fromUtf8("Preferences/General/ExitConfirm"), true).toBool() && BTSession->hasActiveTorrents()) {
if(settings.value(QString::fromUtf8("Preferences/General/ExitConfirm"), true).toBool() && BTSession && BTSession->hasActiveTorrents()) {
if(e->spontaneous() || force_exit) {
if(!isVisible())
show();

View File

@@ -80,6 +80,7 @@ public slots:
void downloadFromURLList(const QStringList& urls);
void updateAltSpeedsBtn(bool alternative);
void updateNbTorrents(unsigned int nb_downloading, unsigned int nb_seeding, unsigned int nb_active, unsigned int nb_inactive, unsigned int nb_paused);
void deleteBTSession();
protected slots:
// GUI related slots
@@ -170,6 +171,7 @@ private:
QAction *prioSeparator2;
QSplitter *hSplitter;
QSplitter *vSplitter;
QMenu *lockMenu;
// Search
QPointer<SearchEngine> searchEngine;
// RSS

View File

@@ -1,6 +1,6 @@
[Desktop Entry]
Categories=Qt;Network;P2P;
Comment=V2.4.2
Comment=V2.4.6
Exec=qbittorrent %f
GenericName=Bittorrent client
GenericName[ar]=العميل Bittorrent

Binary file not shown.

Before

Width:  |  Height:  |  Size: 79 KiB

After

Width:  |  Height:  |  Size: 79 KiB

View File

@@ -47,7 +47,7 @@
<key>CFBundlePackageType</key>
<string>APPL</string>
<key>CFBundleGetInfoString</key>
<string>2.4.2</string>
<string>2.4.6</string>
<key>CFBundleSignature</key>
<string>????</string>
<key>CFBundleExecutable</key>

6
src/about.qrc Normal file
View File

@@ -0,0 +1,6 @@
<!DOCTYPE RCC><RCC version="1.0">
<qresource>
<file>gpl.html</file>
</qresource>
</RCC>

View File

@@ -32,7 +32,7 @@
#define ABOUT_H
#include "ui_about.h"
#include <QScrollBar>
#include <QFile>
class about : public QDialog, private Ui::AboutDlg{
Q_OBJECT
@@ -50,401 +50,53 @@ class about : public QDialog, private Ui::AboutDlg{
//Title
lb_name->setText(QString::fromUtf8("<b><h1>")+tr("qBittorrent")+QString::fromUtf8(" "VERSION"</h1></b>"));
// Thanks
te_thanks->append(QString::fromUtf8("<a name='top'></a>"));
te_thanks->append(QString::fromUtf8("<ul><li>I would first like to thank sourceforge.net for hosting qBittorrent project and for their support.</li>"));
te_thanks->append(QString::fromUtf8("<li>I am pleased that people from all over the world are contributing to qBittorrent: Ishan Arora (India), Arnaud Demaizière (France) and Stephanos Antaris (Greece). Their help is greatly appreciated</li>"));
te_thanks->append(QString::fromUtf8("<li>I also want to thank Στέφανος Αντάρης (santaris@csd.auth.gr) and Mirco Chinelli (infinity89@fastwebmail.it) for working on Mac OS X packaging.</li>"));
te_thanks->append(QString::fromUtf8("<li>I am grateful to Peter Koeleman (peter@qbittorrent.org) and Mohammad Dib (mdib@qbittorrent.org) for working on qBittorrent port to Windows.</li>"));
te_thanks->append(QString::fromUtf8("<li>Thanks a lot to our graphist Mateusz Toboła (tobejodok@qbittorrent.org) for his great work.</li></ul><br><br>"));
te_thanks->scrollToAnchor(QString::fromUtf8("top"));
QString thanks_txt;
thanks_txt += QString::fromUtf8("<p>I would first like to thank sourceforge.net for hosting qBittorrent project and for their support.</p>");
thanks_txt += QString::fromUtf8("<p>I am pleased that people from all over the world are contributing to qBittorrent: Ishan Arora (India), Arnaud Demaizière (France) and Stephanos Antaris (Greece). Their help is greatly appreciated</p>");
thanks_txt += QString::fromUtf8("<p>I also want to thank Στέφανος Αντάρης (santaris@csd.auth.gr) and Mirco Chinelli (infinity89@fastwebmail.it) for working on Mac OS X packaging.</p>");
thanks_txt += QString::fromUtf8("<p>I am grateful to Peter Koeleman (peter@qbittorrent.org) and Mohammad Dib (mdib@qbittorrent.org) for working on qBittorrent port to Windows.</p>");
thanks_txt += QString::fromUtf8("<p>Thanks a lot to our graphist Mateusz Toboła (tobejodok@qbittorrent.org) for his great work.</p>");
te_thanks->setHtml(thanks_txt);
// Translation
te_translation->append(QString::fromUtf8("<a name='top'></a>"));
te_translation->append(tr("I would like to thank the following people who volunteered to translate qBittorrent:")+QString::fromUtf8("<br>"));
te_translation->append(QString::fromUtf8(
"<i><u>Arabic:</u> SDERAWI (abz8868@msn.com) and sn51234 (nesseyan@gmail.com)<br>\
- <u>Brazilian:</u> Nick Marinho (nickmarinho@gmail.com)<br>\
- <u>Bulgarian:</u> Tsvetan & Boyko Bankoff (emerge_life@users.sourceforge.net)<br>\
- <u>Catalan:</u> Francisco Luque Contreras (frannoe@ya.com)<br>\
- <u>Chinese (Simplified):</u> Guo Yue (yue.guo0418@gmail.com)<br>\
- <u>Chinese (Traditional):</u> Yi-Shun Wang (dnextstep@gmail.com)<br>\
- <u>Croatian:</u> Oliver Mucafir (oliver.untwist@gmail.com)<br>\
- <u>Czech:</u> Jirka Vilim (web@tets.cz)<br>\
- <u>Danish:</u> Mathias Nielsen (comoneo@gmail.com)<br>\
- <u>Dutch:</u> Joost Schipper (heavyjoost@users.sourceforge.net) and Peter Koeleman (peter@peerweb.nl)<br>\
- <u>Finnish:</u> Niklas Laxström (nikerabbit@users.sourceforge.net) and Pekka Niemi (pekka.niemi@iki.fi)<br>\
- <u>German:</u> Niels Hoffmann (zentralmaschine@users.sourceforge.net)<br>\
- <u>Greek:</u> Tsvetan Bankov (emerge_life@users.sourceforge.net)<br>\
- <u>Hungarian:</u> Majoros Péter (majoros.peterj@gmail.com)<br>\
- <u>Italian:</u> Mirko Ferrari (mirkoferrari@gmail.com) and Ferraro Luciano (luciano.ferraro@gmail.com)<br>\
- <u>Japanese:</u> Nardog (alphisation@gmail.com)<br>\
- <u>Korean:</u> Jin Woo Sin (jin828sin@users.sourceforge.net)<br>\
- <u>Norwegian:</u> Lars-Erik Labori (hamil@users.sourceforge.net)<br>\
- <u>Polish:</u> Mariusz Fik (fisiu@opensuse.org)<br>\
- <u>Portuguese:</u> Nick Marinho (nickmarinho@gmail.com)<br>\
- <u>Romanian:</u> Obada Denis (obadadenis@users.sourceforge.net)<br>\
- <u>Russian:</u> Nick Khazov (m2k3d0n@users.sourceforge.net) and Alexey Morsov (samurai@ricom.ru)<br>\
- <u>Serbian:</u> Anaximandar Milet (anaximandar@operamail.com)<br>\
- <u>Slovak:</u> helix84<br>\
- <u>Spanish:</u> Francisco Luque Contreras (frannoe@ya.com)<br>\
- <u>Swedish:</u> Daniel Nylander (po@danielnylander.se)<br>\
- <u>Turkish:</u> Hasan YILMAZ (iletisim@hedefturkce.com) and Erdem Bingöl (erdem84@gmail.com)<br>\
- <u>Ukrainian:</u> Andrey Shpachenko (masterfix@users.sourceforge.net) and Oleh Prypin (blaxpirit@gmail.com)<br><br>"));
te_translation->append(tr("Please contact me if you would like to translate qBittorrent into your own language."));
te_translation->scrollToAnchor(QString::fromUtf8("top"));
QString trans_txt = "<p>"+tr("I would like to thank the following people who volunteered to translate qBittorrent:")+"</p>";
trans_txt += QString::fromUtf8("<ul><li><u>Arabic:</u> SDERAWI (abz8868@msn.com) and sn51234 (nesseyan@gmail.com)</li>\
<li><u>Brazilian:</u> Nick Marinho (nickmarinho@gmail.com)</li>\
<li><u>Bulgarian:</u> Tsvetan & Boyko Bankoff (emerge_life@users.sourceforge.net)</li>\
<li><u>Catalan:</u> Francisco Luque Contreras (frannoe@ya.com)</li>\
<li><u>Chinese (Simplified):</u> Guo Yue (yue.guo0418@gmail.com)</li>\
<li><u>Chinese (Traditional):</u> Yi-Shun Wang (dnextstep@gmail.com)</li>\
<li><u>Croatian:</u> Oliver Mucafir (oliver.untwist@gmail.com)</li>\
<li><u>Czech:</u> Jirka Vilim (web@tets.cz)</li>\
<li><u>Danish:</u> Mathias Nielsen (comoneo@gmail.com)</li>\
<li><u>Dutch:</u> Joost Schipper (heavyjoost@users.sourceforge.net) and Peter Koeleman (peter@peerweb.nl)</li>\
<li><u>Finnish:</u> Niklas Laxström (nikerabbit@users.sourceforge.net) and Pekka Niemi (pekka.niemi@iki.fi)</li>\
<li><u>German:</u> Niels Hoffmann (zentralmaschine@users.sourceforge.net)</li>\
<li><u>Greek:</u> Tsvetan Bankov (emerge_life@users.sourceforge.net)</li>\
<li><u>Hungarian:</u> Majoros Péter (majoros.peterj@gmail.com)</li>\
<li><u>Italian:</u> Mirko Ferrari (mirkoferrari@gmail.com) and Ferraro Luciano (luciano.ferraro@gmail.com)</li>\
<li><u>Japanese:</u> Nardog (alphisation@gmail.com)</li>\
<li><u>Korean:</u> Jin Woo Sin (jin828sin@users.sourceforge.net)</li>\
<li><u>Norwegian:</u> Lars-Erik Labori (hamil@users.sourceforge.net)</li>\
<li><u>Polish:</u> Mariusz Fik (fisiu@opensuse.org)</li>\
<li><u>Portuguese:</u> Nick Marinho (nickmarinho@gmail.com)</li>\
<li><u>Romanian:</u> Obada Denis (obadadenis@users.sourceforge.net)</li>\
<li><u>Russian:</u> Nick Khazov (m2k3d0n@users.sourceforge.net) and Alexey Morsov (samurai@ricom.ru)</li>\
<li><u>Serbian:</u> Anaximandar Milet (anaximandar@operamail.com)</li>\
<li><u>Slovak:</u> helix84</li>\
<li><u>Spanish:</u> Francisco Luque Contreras (frannoe@ya.com)</li>\
<li><u>Swedish:</u> Daniel Nylander (po@danielnylander.se)</li>\
<li><u>Turkish:</u> Hasan YILMAZ (iletisim@hedefturkce.com) and Erdem Bingöl (erdem84@gmail.com)</li>\
<li><u>Ukrainian:</u> Andrey Shpachenko (masterfix@users.sourceforge.net) and Oleh Prypin (blaxpirit@gmail.com)</li></ul>");
trans_txt += "<p>"+tr("Please contact me if you would like to translate qBittorrent into your own language.")+"</p>";
te_translation->setHtml(trans_txt);
// License
te_license->append(QString::fromUtf8("<a name='top'></a>"));
#ifdef Q_WS_WIN
te_license->append(QString::fromUtf8("qBittorrent is licensed under the GNU General Public License version 2."));
#else
te_license->append(QString::fromUtf8("qBittorrent is licensed under the GNU General Public License version 2 with the\
addition of the following special exception:\
<br><br>\
<i>In addition, as a special exception, the copyright holders give permission to\
link this program with the OpenSSL project\'s \"OpenSSL\" library (or with\
modified versions of it that use the same license as the \"OpenSSL\" library),\
and distribute the linked executables. You must obey the GNU General Public\
License in all respects for all of the code used other than \"OpenSSL\". If you\
modify file(s), you may extend this exception to your version of the file(s),\
but you are not obligated to do so. If you do not wish to do so, delete this\
exception statement from your version.</i>\
<br><br>\
<center><b>GNU GENERAL PUBLIC LICENSE</b></center><br>\
<center>Version 2, June 1991</center><br>\
Copyright (C) 1989, 1991 Free Software Foundation, Inc.<br>\
51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA<br>\
Everyone is permitted to copy and distribute verbatim copies<br>\
of this license document, but changing it is not allowed.<br>\
<br>\
<center><b>Preamble</b></center><br>\
The licenses for most software are designed to take away your<br>\
freedom to share and change it. By contrast, the GNU General Public<br>\
License is intended to guarantee your freedom to share and change free<br>\
software--to make sure the software is free for all its users. This<br>\
General Public License applies to most of the Free Software<br>\
Foundation's software and to any other program whose authors commit to<br>\
using it. (Some other Free Software Foundation software is covered by<br>\
the GNU Library General Public License instead.) You can apply it to<br>\
your programs, too.<br>\
<br>\
When we speak of free software, we are referring to freedom, not<br>\
price. Our General Public Licenses are designed to make sure that you<br>\
have the freedom to distribute copies of free software (and charge for<br>\
this service if you wish), that you receive source code or can get it<br>\
if you want it, that you can change the software or use pieces of it<br>\
in new free programs; and that you know you can do these things.<br>\
<br>\
To protect your rights, we need to make restrictions that forbid<br>\
anyone to deny you these rights or to ask you to surrender the rights.<br>\
These restrictions translate to certain responsibilities for you if you<br>\
distribute copies of the software, or if you modify it.<br>\
<br>\
For example, if you distribute copies of such a program, whether<br>\
gratis or for a fee, you must give the recipients all the rights that<br>\
you have. You must make sure that they, too, receive or can get the<br>\
source code. And you must show them these terms so they know their<br>\
rights.<br>\
<br>\
We protect your rights with two steps: (1) copyright the software, and<br>\
(2) offer you this license which gives you legal permission to copy,<br>\
distribute and/or modify the software.<br>\
<br>\
Also, for each author's protection and ours, we want to make certain<br>\
that everyone understands that there is no warranty for this free<br>\
software. If the software is modified by someone else and passed on, we<br>\
want its recipients to know that what they have is not the original, so<br>\
that any problems introduced by others will not reflect on the original<br>\
authors' reputations.<br>\
<br>\
Finally, any free program is threatened constantly by software<br>\
patents. We wish to avoid the danger that redistributors of a free<br>\
program will individually obtain patent licenses, in effect making the<br>\
program proprietary. To prevent this, we have made it clear that any<br>\
patent must be licensed for everyone's free use or not licensed at all.<br>\
<br>\
The precise terms and conditions for copying, distribution and<br>\
modification follow.<br>\
<br>\
<center><b>GNU GENERAL PUBLIC LICENSE</b></center><br>\
<center><b>TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION</b></center><br>\
0. This License applies to any program or other work which contains<br>\
a notice placed by the copyright holder saying it may be distributed<br>\
under the terms of this General Public License. The 'Program', below,<br>\
refers to any such program or work, and a 'work based on the Program'<br>\
means either the Program or any derivative work under copyright law:<br>\
that is to say, a work containing the Program or a portion of it,<br>\
either verbatim or with modifications and/or translated into another<br>\
language. (Hereinafter, translation is included without limitation in<br>\
the term 'modification'.) Each licensee is addressed as 'you'.<br>\
<br>\
Activities other than copying, distribution and modification are not<br>\
covered by this License; they are outside its scope. The act of<br>\
running the Program is not restricted, and the output from the Program<br>\
is covered only if its contents constitute a work based on the<br>\
Program (independent of having been made by running the Program).<br>\
Whether that is true depends on what the Program does.<br>\
<br>\
1. You may copy and distribute verbatim copies of the Program's<br>\
source code as you receive it, in any medium, provided that you<br>\
conspicuously and appropriately publish on each copy an appropriate<br>\
copyright notice and disclaimer of warranty; keep intact all the<br>\
notices that refer to this License and to the absence of any warranty;<br>\
and give any other recipients of the Program a copy of this License<br>\
along with the Program.<br>\
<br>\
You may charge a fee for the physical act of transferring a copy, and<br>\
you may at your option offer warranty protection in exchange for a fee.<br>\
<br>\
2. You may modify your copy or copies of the Program or any portion<br>\
of it, thus forming a work based on the Program, and copy and<br>\
distribute such modifications or work under the terms of Section 1<br>\
above, provided that you also meet all of these conditions:<br>\
<br>\
a) You must cause the modified files to carry prominent notices<br>\
stating that you changed the files and the date of any change.<br>\
<br>\
b) You must cause any work that you distribute or publish, that in<br>\
whole or in part contains or is derived from the Program or any<br>\
part thereof, to be licensed as a whole at no charge to all third<br>\
parties under the terms of this License.<br>\
<br>\
c) If the modified program normally reads commands interactively<br>\
when run, you must cause it, when started running for such<br>\
interactive use in the most ordinary way, to print or display an<br>\
announcement including an appropriate copyright notice and a<br>\
notice that there is no warranty (or else, saying that you provide<br>\
a warranty) and that users may redistribute the program under<br>\
these conditions, and telling the user how to view a copy of this<br>\
License. (Exception: if the Program itself is interactive but<br>\
does not normally print such an announcement, your work based on<br>\
the Program is not required to print an announcement.)<br>\
<br>\
These requirements apply to the modified work as a whole. If<br>\
identifiable sections of that work are not derived from the Program,<br>\
and can be reasonably considered independent and separate works in<br>\
themselves, then this License, and its terms, do not apply to those<br>\
sections when you distribute them as separate works. But when you<br>\
distribute the same sections as part of a whole which is a work based<br>\
on the Program, the distribution of the whole must be on the terms of<br>\
this License, whose permissions for other licensees extend to the<br>\
entire whole, and thus to each and every part regardless of who wrote it.<br>\
<br>\
Thus, it is not the intent of this section to claim rights or contest<br>\
your rights to work written entirely by you; rather, the intent is to<br>\
exercise the right to control the distribution of derivative or<br>\
collective works based on the Program.<br>\
<br>\
In addition, mere aggregation of another work not based on the Program<br>\
with the Program (or with a work based on the Program) on a volume of<br>\
a storage or distribution medium does not bring the other work under<br>\
the scope of this License.<br>\
<br>\
3. You may copy and distribute the Program (or a work based on it,<br>\
under Section 2) in object code or executable form under the terms of<br>\
Sections 1 and 2 above provided that you also do one of the following:<br>\
<br>\
a) Accompany it with the complete corresponding machine-readable<br>\
source code, which must be distributed under the terms of Sections<br>\
1 and 2 above on a medium customarily used for software interchange; or,<br>\
<br>\
b) Accompany it with a written offer, valid for at least three<br>\
years, to give any third party, for a charge no more than your<br>\
cost of physically performing source distribution, a complete<br>\
machine-readable copy of the corresponding source code, to be<br>\
distributed under the terms of Sections 1 and 2 above on a medium<br>\
customarily used for software interchange; or,<br>\
<br>\
c) Accompany it with the information you received as to the offer<br>\
to distribute corresponding source code. (This alternative is<br>\
allowed only for noncommercial distribution and only if you<br>\
received the program in object code or executable form with such<br>\
an offer, in accord with Subsection b above.)<br>\
<br>\
The source code for a work means the preferred form of the work for<br>\
making modifications to it. For an executable work, complete source<br>\
code means all the source code for all modules it contains, plus any<br>\
associated interface definition files, plus the scripts used to<br>\
control compilation and installation of the executable. However, as a<br>\
special exception, the source code distributed need not include<br>\
anything that is normally distributed (in either source or binary<br>\
form) with the major components (compiler, kernel, and so on) of the<br>\
operating system on which the executable runs, unless that component<br>\
itself accompanies the executable.<br>\
<br>\
If distribution of executable or object code is made by offering<br>\
access to copy from a designated place, then offering equivalent<br>\
access to copy the source code from the same place counts as<br>\
distribution of the source code, even though third parties are not<br>\
compelled to copy the source along with the object code.<br>\
<br>\
4. You may not copy, modify, sublicense, or distribute the Program<br>\
except as expressly provided under this License. Any attempt<br>\
otherwise to copy, modify, sublicense or distribute the Program is<br>\
void, and will automatically terminate your rights under this License.<br>\
However, parties who have received copies, or rights, from you under<br>\
this License will not have their licenses terminated so long as such<br>\
parties remain in full compliance.<br>\
<br>\
5. You are not required to accept this License, since you have not<br>\
signed it. However, nothing else grants you permission to modify or<br>\
distribute the Program or its derivative works. These actions are<br>\
prohibited by law if you do not accept this License. Therefore, by<br>\
modifying or distributing the Program (or any work based on the<br>\
Program), you indicate your acceptance of this License to do so, and<br>\
all its terms and conditions for copying, distributing or modifying<br>\
the Program or works based on it.<br>\
<br>\
6. Each time you redistribute the Program (or any work based on the<br>\
Program), the recipient automatically receives a license from the<br>\
original licensor to copy, distribute or modify the Program subject to<br>\
these terms and conditions. You may not impose any further<br>\
restrictions on the recipients' exercise of the rights granted herein.<br>\
You are not responsible for enforcing compliance by third parties to<br>\
this License.<br>\
<br>\
7. If, as a consequence of a court judgment or allegation of patent<br>\
infringement or for any other reason (not limited to patent issues),<br>\
conditions are imposed on you (whether by court order, agreement or<br>\
otherwise) that contradict the conditions of this License, they do not<br>\
excuse you from the conditions of this License. If you cannot<br>\
distribute so as to satisfy simultaneously your obligations under this<br>\
License and any other pertinent obligations, then as a consequence you<br>\
may not distribute the Program at all. For example, if a patent<br>\
license would not permit royalty-free redistribution of the Program by<br>\
all those who receive copies directly or indirectly through you, then<br>\
the only way you could satisfy both it and this License would be to<br>\
refrain entirely from distribution of the Program.<br>\
<br>\
If any portion of this section is held invalid or unenforceable under<br>\
any particular circumstance, the balance of the section is intended to<br>\
apply and the section as a whole is intended to apply in other<br>\
circumstances.<br>\
<br>\
It is not the purpose of this section to induce you to infringe any<br>\
patents or other property right claims or to contest validity of any<br>\
such claims; this section has the sole purpose of protecting the<br>\
integrity of the free software distribution system, which is<br>\
implemented by public license practices. Many people have made<br>\
generous contributions to the wide range of software distributed<br>\
through that system in reliance on consistent application of that<br>\
system; it is up to the author/donor to decide if he or she is willing<br>\
to distribute software through any other system and a licensee cannot<br>\
impose that choice.<br>\
<br>\
This section is intended to make thoroughly clear what is believed to<br>\
be a consequence of the rest of this License.<br>\
<br>\
8. If the distribution and/or use of the Program is restricted in<br>\
certain countries either by patents or by copyrighted interfaces, the<br>\
original copyright holder who places the Program under this License<br>\
may add an explicit geographical distribution limitation excluding<br>\
those countries, so that distribution is permitted only in or among<br>\
countries not thus excluded. In such case, this License incorporates<br>\
the limitation as if written in the body of this License.<br>\
<br>\
9. The Free Software Foundation may publish revised and/or new versions<br>\
of the General Public License from time to time. Such new versions will<br>\
be similar in spirit to the present version, but may differ in detail to<br>\
address new problems or concerns.<br>\
<br>\
Each version is given a distinguishing version number. If the Program<br>\
specifies a version number of this License which applies to it and 'any<br>\
later version', you have the option of following the terms and conditions<br>\
either of that version or of any later version published by the Free<br>\
Software Foundation. If the Program does not specify a version number of<br>\
this License, you may choose any version ever published by the Free Software<br>\
Foundation.<br>\
<br>\
10. If you wish to incorporate parts of the Program into other free<br>\
programs whose distribution conditions are different, write to the author<br>\
to ask for permission. For software which is copyrighted by the Free<br>\
Software Foundation, write to the Free Software Foundation; we sometimes<br>\
make exceptions for this. Our decision will be guided by the two goals<br>\
of preserving the free status of all derivatives of our free software and<br>\
of promoting the sharing and reuse of software generally.<br>\
<br>\
<center><b>NO WARRANTY</b></center><br>\
11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY<br>\
FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN<br>\
OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES<br>\
PROVIDE THE PROGRAM \"AS IS\" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED<br>\
OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF<br>\
MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS<br>\
TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE<br>\
PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING,<br>\
REPAIR OR CORRECTION.<br>\
<br>\
12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING<br>\
WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR<br>\
REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES,<br>\
INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING<br>\
OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED<br>\
TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY<br>\
YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER<br>\
PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE<br>\
POSSIBILITY OF SUCH DAMAGES.<br>\
<br>\
<center><b>END OF TERMS AND CONDITIONS</b></center><br>\
<center>How to Apply These Terms to Your New Programs</center><br>\
If you develop a new program, and you want it to be of the greatest<br>\
possible use to the public, the best way to achieve this is to make it<br>\
free software which everyone can redistribute and change under these terms.<br>\
<br>\
To do so, attach the following notices to the program. It is safest<br>\
to attach them to the start of each source file to most effectively<br>\
convey the exclusion of warranty; and each file should have at least<br>\
the 'copyright' line and a pointer to where the full notice is found.<br>\
<br>\
<one line to give the program's name and a brief idea of what it does.><br>\
Copyright (C) <year> <name of author><br>\
<br>\
This program is free software; you can redistribute it and/or modify<br>\
it under the terms of the GNU General Public License as published by<br>\
the Free Software Foundation; either version 2 of the License, or<br>\
(at your option) any later version.<br>\
<br>\
This program is distributed in the hope that it will be useful,<br>\
but WITHOUT ANY WARRANTY; without even the implied warranty of<br>\
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the<br>\
GNU General Public License for more details.<br>\
<br>\
You should have received a copy of the GNU General Public License<br>\
along with this program; if not, write to the Free Software<br>\
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA<br>\
<br>\
<br>\
Also add information on how to contact you by electronic and paper mail.<br>\
<br>\
If the program is interactive, make it output a short notice like this<br>\
when it starts in an interactive mode:<br>\
<br>\
Gnomovision version 69, Copyright (C) year name of author<br>\
Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'.<br>\
This is free software, and you are welcome to redistribute it<br>\
under certain conditions; type `show c' for details.<br>\
<br>\
The hypothetical commands `show w' and `show c' should show the appropriate<br>\
parts of the General Public License. Of course, the commands you use may<br>\
be called something other than `show w' and `show c'; they could even be<br>\
mouse-clicks or menu items--whatever suits your program.<br>\
<br>\
You should also get your employer (if you work as a programmer) or your<br>\
school, if any, to sign a 'copyright disclaimer' for the program, if<br>\
necessary. Here is a sample; alter the names:<br>\
<br>\
Yoyodyne, Inc., hereby disclaims all copyright interest in the program<br>\
`Gnomovision' (which makes passes at compilers) written by James Hacker.<br>\
<br>\
'signature of Ty Coon', 1 April 1989<br>\
Ty Coon, President of Vice<br>\
<br>\
This General Public License does not permit incorporating your program into<br>\
proprietary programs. If your program is a subroutine library, you may<br>\
consider it more useful to permit linking proprietary applications with the<br>\
library. If this is what you want to do, use the GNU Library General<br>\
Public License instead of this License.<br>"));
#endif
te_license->scrollToAnchor(QString::fromUtf8("top"));
show();
QFile licensefile(":/gpl.html");
if(licensefile.open(QIODevice::ReadOnly|QIODevice::Text)) {
te_license->setHtml(licensefile.readAll());
licensefile.close();
}
show();
}
};

View File

@@ -165,6 +165,7 @@ Bittorrent::~Bittorrent() {
#endif
saveSessionState();
saveFastResumeData();
qDebug("Deleting the session");
// Delete session
session_proxy sp = s->abort();
delete s;
@@ -863,7 +864,7 @@ QTorrentHandle Bittorrent::addMagnetUri(QString magnet_uri, bool resumed) {
}
QString torrent_name = misc::magnetUriToName(magnet_uri);
const QString savePath(getSavePath(hash, false, QString::null, torrent_name));
if(!defaultTempPath.isEmpty() && resumed && !TorrentPersistentData::isSeed(hash)) {
if(!defaultTempPath.isEmpty() && !TorrentPersistentData::isSeed(hash) && resumed) {
qDebug("addMagnetURI: Temp folder is enabled.");
qDebug("addTorrent::Temp folder is enabled.");
QString torrent_tmp_path = defaultTempPath.replace("\\", "/");
@@ -912,10 +913,10 @@ QTorrentHandle Bittorrent::addMagnetUri(QString magnet_uri, bool resumed) {
Q_ASSERT(h.hash() == hash);
// If temp path is enabled, move torrent
/*if(!defaultTempPath.isEmpty() && !resumed) {
if(!defaultTempPath.isEmpty() && !resumed) {
qDebug("Temp folder is enabled, moving new torrent to temp folder");
h.move_storage(defaultTempPath);
}*/
}
// Connections limit per torrent
h.set_max_connections(Preferences::getMaxConnecsPerTorrent());
@@ -1095,6 +1096,7 @@ QTorrentHandle Bittorrent::addTorrent(QString path, bool fromScanDir, QString fr
}
// Actually add the torrent
QString root_folder = misc::truncateRootFolder(t);
qDebug("Truncated root folder: %s", qPrintable(root_folder));
add_torrent_params p;
//Getting fast resume data if existing
std::vector<char> buf;
@@ -1114,7 +1116,7 @@ QTorrentHandle Bittorrent::addTorrent(QString path, bool fromScanDir, QString fr
} else {
savePath = getSavePath(hash, fromScanDir, path, root_folder);
}
if(!defaultTempPath.isEmpty() && resumed && !TorrentPersistentData::isSeed(hash)) {
if(!defaultTempPath.isEmpty() && !TorrentPersistentData::isSeed(hash) && resumed) {
qDebug("addTorrent::Temp folder is enabled.");
QString torrent_tmp_path = defaultTempPath.replace("\\", "/");
if(!root_folder.isEmpty()) {
@@ -1170,7 +1172,7 @@ QTorrentHandle Bittorrent::addTorrent(QString path, bool fromScanDir, QString fr
TorrentPersistentData::setRootFolder(hash, root_folder);
// If temp path is enabled, move torrent
/*if(!defaultTempPath.isEmpty() && !resumed) {
if(!defaultTempPath.isEmpty() && !resumed) {
qDebug("Temp folder is enabled, moving new torrent to temp folder");
QString torrent_tmp_path = defaultTempPath.replace("\\", "/");
if(!root_folder.isEmpty()) {
@@ -1178,7 +1180,7 @@ QTorrentHandle Bittorrent::addTorrent(QString path, bool fromScanDir, QString fr
torrent_tmp_path += root_folder;
}
h.move_storage(torrent_tmp_path);
}*/
}
// Connections limit per torrent
h.set_max_connections(Preferences::getMaxConnecsPerTorrent());
@@ -1541,6 +1543,7 @@ void Bittorrent::saveTempFastResumeData() {
// Only save fast resume data for unfinished and unpaused torrents (Optimization)
// Called periodically and on exit
void Bittorrent::saveFastResumeData() {
qDebug("Saving fast resume data...");
// Stop listening for alerts
resumeDataTimer.stop();
timerAlerts->stop();
@@ -2014,7 +2017,6 @@ void Bittorrent::addConsoleMessage(QString msg, QString) {
if (torrent_finished_alert* p = dynamic_cast<torrent_finished_alert*>(a.get())) {
QTorrentHandle h(p->handle);
if(h.is_valid()) {
emit finishedTorrent(h);
const QString hash = h.hash();
#if LIBTORRENT_VERSION_MINOR > 14
// Remove .!qB extension if necessary
@@ -2046,27 +2048,23 @@ void Bittorrent::addConsoleMessage(QString msg, QString) {
}
}
}
}
// Move to download directory if necessary
if(!defaultTempPath.isEmpty()) {
// Check if directory is different
const QDir current_dir(h.save_path());
const QDir save_dir(getSavePath(hash));
if(current_dir != save_dir) {
h.move_storage(save_dir.absolutePath());
// Move to download directory if necessary
if(!defaultTempPath.isEmpty()) {
// Check if directory is different
const QDir current_dir(h.save_path());
const QDir save_dir(getSavePath(hash));
if(current_dir != save_dir) {
h.move_storage(save_dir.absolutePath());
}
}
}
// Recheck if the user asked to
if(Preferences::recheckTorrentsOnCompletion() && !was_already_seeded) {
// Remember finished state
TorrentPersistentData::saveSeedStatus(h);
h.force_recheck();
} else {
// Remember finished state
TorrentPersistentData::saveSeedStatus(h);
}
qDebug("Received finished alert for %s", qPrintable(h.name()));
if(!was_already_seeded) {
// Recheck if the user asked to
if(Preferences::recheckTorrentsOnCompletion()) {
h.force_recheck();
}
emit finishedTorrent(h);
qDebug("Received finished alert for %s", qPrintable(h.name()));
bool will_shutdown = Preferences::shutdownWhenDownloadsComplete() && !hasDownloadingTorrents();
// AutoRun program
if(Preferences::isAutoRunEnabled())

View File

@@ -220,16 +220,22 @@ void createtorrent::handleCreationSuccess(QString path, QString branch_path) {
// Remove busy cursor
setCursor(QCursor(Qt::ArrowCursor));
if(checkStartSeeding->isChecked()) {
QString root_folder;
// Create save path temp data
boost::intrusive_ptr<torrent_info> t;
try {
t = new torrent_info(path.toUtf8().data());
root_folder = misc::truncateRootFolder(t);
} catch(std::exception&) {
QMessageBox::critical(0, tr("Torrent creation"), tr("Created torrent file is invalid. It won't be added to download list."));
return;
}
QString hash = misc::toQString(t->info_hash());
TorrentTempData::setSavePath(hash, branch_path);
QString save_path = branch_path;
if(!root_folder.isEmpty()) {
save_path = QDir(save_path).absoluteFilePath(root_folder);
}
TorrentTempData::setSavePath(hash, save_path);
#if LIBTORRENT_VERSION_MINOR > 14
// Enable seeding mode (do not recheck the files)
TorrentTempData::setSeedingMode(hash, true);
@@ -285,8 +291,7 @@ void torrentCreatorThread::run() {
char const* creator_str = "qBittorrent "VERSION;
try {
file_storage fs;
file_pool fp;
path full_path = complete(path(input_path.toLocal8Bit().data()));
path full_path = complete(path(input_path.toUtf8().constData()));
// Adding files to the torrent
add_files(fs, full_path, file_filter);
if(abort) return;
@@ -311,7 +316,7 @@ void torrentCreatorThread::run() {
t.set_priv(is_private);
if(abort) return;
// create the torrent and print it to out
ofstream out(complete(path((const char*)save_path.toLocal8Bit())), std::ios_base::binary);
ofstream out(complete(path((const char*)save_path.toUtf8())), std::ios_base::binary);
bencode(std::ostream_iterator<char>(out), t.generate());
emit updateProgress(100);
emit creationSuccess(save_path, QString::fromUtf8(full_path.branch_path().string().c_str()));

View File

@@ -60,31 +60,34 @@ public:
pix.fill();
pixmap = pix;
} else {
const int nb_pieces = pieces.size();
const qulonglong nb_pieces = pieces.size();
// Reduce the number of pieces before creating the pixmap
// otherwise it can crash when there are too many pieces
if(nb_pieces > width()) {
const int ratio = floor(nb_pieces/(double)width());
std::vector<bool> scaled_pieces;
std::vector<bool> scaled_downloading;
for(int i=0; i<nb_pieces; i+= ratio) {
const uint w = width();
if(nb_pieces > w) {
const uint ratio = floor(nb_pieces/(double)w);
bitfield scaled_pieces(ceil(nb_pieces/(double)ratio), false);
bitfield scaled_downloading(ceil(nb_pieces/(double)ratio), false);
uint scaled_index = 0;
for(qulonglong i=0; i<nb_pieces; i+= ratio) {
bool have = true;
for(int j=i; j<qMin(i+ratio, nb_pieces); ++j) {
for(qulonglong j=i; j<qMin(i+ratio, nb_pieces); ++j) {
if(!pieces[i]) { have = false; break; }
}
scaled_pieces.push_back(have);
if(have) {
scaled_downloading.push_back(false);
scaled_pieces.set_bit(scaled_index);
} else {
bool downloading = false;
for(int j=i; j<qMin(i+ratio, nb_pieces); ++j) {
for(qulonglong j=i; j<qMin(i+ratio, nb_pieces); ++j) {
if(downloading_pieces[i]) { downloading = true; break; }
}
scaled_downloading.push_back(downloading);
if(downloading)
scaled_downloading.set_bit(scaled_index);
}
++scaled_index;
}
QPixmap pix = QPixmap(scaled_pieces.size(), 1);
pix.fill();
//pix.fill();
QPainter painter(&pix);
for(uint i=0; i<scaled_pieces.size(); ++i) {
if(scaled_pieces[i]) {
@@ -101,7 +104,7 @@ public:
pixmap = pix;
} else {
QPixmap pix = QPixmap(pieces.size(), 1);
pix.fill();
//pix.fill();
QPainter painter(&pix);
for(uint i=0; i<pieces.size(); ++i) {
if(pieces[i]) {

View File

@@ -270,6 +270,7 @@ void engineSelectDlg::installPlugin(QString path, QString plugin_name) {
// Backup in case install fails
QFile::copy(dest_path, dest_path+".bak");
misc::safeRemove(dest_path);
misc::safeRemove(dest_path+"c");
update = true;
}
// Copy the plugin

508
src/gpl.html Normal file
View File

@@ -0,0 +1,508 @@
<p>qBittorrent is licensed under the GNU General Public License version 2 with the
addition of the following special exception:</p>
<p>
In addition, as a special exception, the copyright holders give permission to
link this program with the OpenSSL project's "OpenSSL" library (or with
modified versions of it that use the same license as the "OpenSSL" library),
and distribute the linked executables. You must obey the GNU General Public
License in all respects for all of the code used other than "OpenSSL". If you
modify file(s), you may extend this exception to your version of the file(s),
but you are not obligated to do so. If you do not wish to do so, delete this
exception statement from your version.</p>
----------
<h2>GNU General Public License, version 2</h2>
<hr>
<h3>Table of Contents</h3>
<ul>
<li><a name="TOC1" href="#SEC1">GNU GENERAL PUBLIC
LICENSE<!--TRANSLATORS: Don't translate the license; copy msgid's
verbatim!--></a>
<ul>
<li><a name="TOC2" href="#SEC2">Preamble</a></li>
<li><a name="TOC3" href="#SEC3">TERMS AND CONDITIONS
FOR COPYING, DISTRIBUTION AND MODIFICATION</a></li>
<li><a name="TOC4" href="#SEC4">How to Apply These
Terms to Your New Programs</a></li>
</ul></li>
</ul>
<hr>
<h3><a name="SEC1" href="#TOC1">GNU GENERAL PUBLIC LICENSE</a></h3>
<p>
Version 2, June 1991
</p>
<pre>
Copyright (C) 1989, 1991 Free Software Foundation, Inc.
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
Everyone is permitted to copy and distribute verbatim copies
of this license document, but changing it is not allowed.
</pre>
<h3><a name="preamble"></a><a name="SEC2" href="#TOC2">Preamble</a></h3>
<p>
The licenses for most software are designed to take away your
freedom to share and change it. By contrast, the GNU General Public
License is intended to guarantee your freedom to share and change free
software--to make sure the software is free for all its users. This
General Public License applies to most of the Free Software
Foundation's software and to any other program whose authors commit to
using it. (Some other Free Software Foundation software is covered by
the GNU Lesser General Public License instead.) You can apply it to
your programs, too.
</p>
<p>
When we speak of free software, we are referring to freedom, not
price. Our General Public Licenses are designed to make sure that you
have the freedom to distribute copies of free software (and charge for
this service if you wish), that you receive source code or can get it
if you want it, that you can change the software or use pieces of it
in new free programs; and that you know you can do these things.
</p>
<p>
To protect your rights, we need to make restrictions that forbid
anyone to deny you these rights or to ask you to surrender the rights.
These restrictions translate to certain responsibilities for you if you
distribute copies of the software, or if you modify it.
</p>
<p>
For example, if you distribute copies of such a program, whether
gratis or for a fee, you must give the recipients all the rights that
you have. You must make sure that they, too, receive or can get the
source code. And you must show them these terms so they know their
rights.
</p>
<p>
We protect your rights with two steps: (1) copyright the software, and
(2) offer you this license which gives you legal permission to copy,
distribute and/or modify the software.
</p>
<p>
Also, for each author's protection and ours, we want to make certain
that everyone understands that there is no warranty for this free
software. If the software is modified by someone else and passed on, we
want its recipients to know that what they have is not the original, so
that any problems introduced by others will not reflect on the original
authors' reputations.
</p>
<p>
Finally, any free program is threatened constantly by software
patents. We wish to avoid the danger that redistributors of a free
program will individually obtain patent licenses, in effect making the
program proprietary. To prevent this, we have made it clear that any
patent must be licensed for everyone's free use or not licensed at all.
</p>
<p>
The precise terms and conditions for copying, distribution and
modification follow.
</p>
<h3><a name="terms"></a><a name="SEC3" href="#TOC3">TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION</a></h3>
<a name="section0"></a><p>
<strong>0.</strong>
This License applies to any program or other work which contains
a notice placed by the copyright holder saying it may be distributed
under the terms of this General Public License. The "Program", below,
refers to any such program or work, and a "work based on the Program"
means either the Program or any derivative work under copyright law:
that is to say, a work containing the Program or a portion of it,
either verbatim or with modifications and/or translated into another
language. (Hereinafter, translation is included without limitation in
the term "modification".) Each licensee is addressed as "you".
</p>
<p>
Activities other than copying, distribution and modification are not
covered by this License; they are outside its scope. The act of
running the Program is not restricted, and the output from the Program
is covered only if its contents constitute a work based on the
Program (independent of having been made by running the Program).
Whether that is true depends on what the Program does.
</p>
<a name="section1"></a><p>
<strong>1.</strong>
You may copy and distribute verbatim copies of the Program's
source code as you receive it, in any medium, provided that you
conspicuously and appropriately publish on each copy an appropriate
copyright notice and disclaimer of warranty; keep intact all the
notices that refer to this License and to the absence of any warranty;
and give any other recipients of the Program a copy of this License
along with the Program.
</p>
<p>
You may charge a fee for the physical act of transferring a copy, and
you may at your option offer warranty protection in exchange for a fee.
</p>
<a name="section2"></a><p>
<strong>2.</strong>
You may modify your copy or copies of the Program or any portion
of it, thus forming a work based on the Program, and copy and
distribute such modifications or work under the terms of Section 1
above, provided that you also meet all of these conditions:
</p>
<dl>
<dt></dt>
<dd>
<strong>a)</strong>
You must cause the modified files to carry prominent notices
stating that you changed the files and the date of any change.
</dd>
<dt></dt>
<dd>
<strong>b)</strong>
You must cause any work that you distribute or publish, that in
whole or in part contains or is derived from the Program or any
part thereof, to be licensed as a whole at no charge to all third
parties under the terms of this License.
</dd>
<dt></dt>
<dd>
<strong>c)</strong>
If the modified program normally reads commands interactively
when run, you must cause it, when started running for such
interactive use in the most ordinary way, to print or display an
announcement including an appropriate copyright notice and a
notice that there is no warranty (or else, saying that you provide
a warranty) and that users may redistribute the program under
these conditions, and telling the user how to view a copy of this
License. (Exception: if the Program itself is interactive but
does not normally print such an announcement, your work based on
the Program is not required to print an announcement.)
</dd>
</dl>
<p>
These requirements apply to the modified work as a whole. If
identifiable sections of that work are not derived from the Program,
and can be reasonably considered independent and separate works in
themselves, then this License, and its terms, do not apply to those
sections when you distribute them as separate works. But when you
distribute the same sections as part of a whole which is a work based
on the Program, the distribution of the whole must be on the terms of
this License, whose permissions for other licensees extend to the
entire whole, and thus to each and every part regardless of who wrote it.
</p>
<p>
Thus, it is not the intent of this section to claim rights or contest
your rights to work written entirely by you; rather, the intent is to
exercise the right to control the distribution of derivative or
collective works based on the Program.
</p>
<p>
In addition, mere aggregation of another work not based on the Program
with the Program (or with a work based on the Program) on a volume of
a storage or distribution medium does not bring the other work under
the scope of this License.
</p>
<a name="section3"></a><p>
<strong>3.</strong>
You may copy and distribute the Program (or a work based on it,
under Section 2) in object code or executable form under the terms of
Sections 1 and 2 above provided that you also do one of the following:
</p>
<!-- we use this doubled UL to get the sub-sections indented, -->
<!-- while making the bullets as unobvious as possible. -->
<dl>
<dt></dt>
<dd>
<strong>a)</strong>
Accompany it with the complete corresponding machine-readable
source code, which must be distributed under the terms of Sections
1 and 2 above on a medium customarily used for software interchange; or,
</dd>
<dt></dt>
<dd>
<strong>b)</strong>
Accompany it with a written offer, valid for at least three
years, to give any third party, for a charge no more than your
cost of physically performing source distribution, a complete
machine-readable copy of the corresponding source code, to be
distributed under the terms of Sections 1 and 2 above on a medium
customarily used for software interchange; or,
</dd>
<dt></dt>
<dd>
<strong>c)</strong>
Accompany it with the information you received as to the offer
to distribute corresponding source code. (This alternative is
allowed only for noncommercial distribution and only if you
received the program in object code or executable form with such
an offer, in accord with Subsection b above.)
</dd>
</dl>
<p>
The source code for a work means the preferred form of the work for
making modifications to it. For an executable work, complete source
code means all the source code for all modules it contains, plus any
associated interface definition files, plus the scripts used to
control compilation and installation of the executable. However, as a
special exception, the source code distributed need not include
anything that is normally distributed (in either source or binary
form) with the major components (compiler, kernel, and so on) of the
operating system on which the executable runs, unless that component
itself accompanies the executable.
</p>
<p>
If distribution of executable or object code is made by offering
access to copy from a designated place, then offering equivalent
access to copy the source code from the same place counts as
distribution of the source code, even though third parties are not
compelled to copy the source along with the object code.
</p>
<a name="section4"></a><p>
<strong>4.</strong>
You may not copy, modify, sublicense, or distribute the Program
except as expressly provided under this License. Any attempt
otherwise to copy, modify, sublicense or distribute the Program is
void, and will automatically terminate your rights under this License.
However, parties who have received copies, or rights, from you under
this License will not have their licenses terminated so long as such
parties remain in full compliance.
</p>
<a name="section5"></a><p>
<strong>5.</strong>
You are not required to accept this License, since you have not
signed it. However, nothing else grants you permission to modify or
distribute the Program or its derivative works. These actions are
prohibited by law if you do not accept this License. Therefore, by
modifying or distributing the Program (or any work based on the
Program), you indicate your acceptance of this License to do so, and
all its terms and conditions for copying, distributing or modifying
the Program or works based on it.
</p>
<a name="section6"></a><p>
<strong>6.</strong>
Each time you redistribute the Program (or any work based on the
Program), the recipient automatically receives a license from the
original licensor to copy, distribute or modify the Program subject to
these terms and conditions. You may not impose any further
restrictions on the recipients' exercise of the rights granted herein.
You are not responsible for enforcing compliance by third parties to
this License.
</p>
<a name="section7"></a><p>
<strong>7.</strong>
If, as a consequence of a court judgment or allegation of patent
infringement or for any other reason (not limited to patent issues),
conditions are imposed on you (whether by court order, agreement or
otherwise) that contradict the conditions of this License, they do not
excuse you from the conditions of this License. If you cannot
distribute so as to satisfy simultaneously your obligations under this
License and any other pertinent obligations, then as a consequence you
may not distribute the Program at all. For example, if a patent
license would not permit royalty-free redistribution of the Program by
all those who receive copies directly or indirectly through you, then
the only way you could satisfy both it and this License would be to
refrain entirely from distribution of the Program.
</p>
<p>
If any portion of this section is held invalid or unenforceable under
any particular circumstance, the balance of the section is intended to
apply and the section as a whole is intended to apply in other
circumstances.
</p>
<p>
It is not the purpose of this section to induce you to infringe any
patents or other property right claims or to contest validity of any
such claims; this section has the sole purpose of protecting the
integrity of the free software distribution system, which is
implemented by public license practices. Many people have made
generous contributions to the wide range of software distributed
through that system in reliance on consistent application of that
system; it is up to the author/donor to decide if he or she is willing
to distribute software through any other system and a licensee cannot
impose that choice.
</p>
<p>
This section is intended to make thoroughly clear what is believed to
be a consequence of the rest of this License.
</p>
<a name="section8"></a><p>
<strong>8.</strong>
If the distribution and/or use of the Program is restricted in
certain countries either by patents or by copyrighted interfaces, the
original copyright holder who places the Program under this License
may add an explicit geographical distribution limitation excluding
those countries, so that distribution is permitted only in or among
countries not thus excluded. In such case, this License incorporates
the limitation as if written in the body of this License.
</p>
<a name="section9"></a><p>
<strong>9.</strong>
The Free Software Foundation may publish revised and/or new versions
of the General Public License from time to time. Such new versions will
be similar in spirit to the present version, but may differ in detail to
address new problems or concerns.
</p>
<p>
Each version is given a distinguishing version number. If the Program
specifies a version number of this License which applies to it and "any
later version", you have the option of following the terms and conditions
either of that version or of any later version published by the Free
Software Foundation. If the Program does not specify a version number of
this License, you may choose any version ever published by the Free Software
Foundation.
</p>
<a name="section10"></a><p>
<strong>10.</strong>
If you wish to incorporate parts of the Program into other free
programs whose distribution conditions are different, write to the author
to ask for permission. For software which is copyrighted by the Free
Software Foundation, write to the Free Software Foundation; we sometimes
make exceptions for this. Our decision will be guided by the two goals
of preserving the free status of all derivatives of our free software and
of promoting the sharing and reuse of software generally.
</p>
<a name="section11"></a><p><strong>NO WARRANTY</strong></p>
<p>
<strong>11.</strong>
BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY
FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN
OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES
PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED
OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS
TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE
PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING,
REPAIR OR CORRECTION.
</p>
<a name="section12"></a><p>
<strong>12.</strong>
IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR
REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES,
INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING
OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED
TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY
YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER
PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE
POSSIBILITY OF SUCH DAMAGES.
</p>
<h3>END OF TERMS AND CONDITIONS</h3>
<h3><a name="howto"></a><a name="SEC4" href="#TOC4">How to Apply These Terms to Your New Programs</a></h3>
<p>
If you develop a new program, and you want it to be of the greatest
possible use to the public, the best way to achieve this is to make it
free software which everyone can redistribute and change under these terms.
</p>
<p>
To do so, attach the following notices to the program. It is safest
to attach them to the start of each source file to most effectively
convey the exclusion of warranty; and each file should have at least
the "copyright" line and a pointer to where the full notice is found.
</p>
<pre>
<var>one line to give the program's name and an idea of what it does.</var>
Copyright (C) <var>yyyy</var> <var>name of author</var>
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.
</pre>
<p>
Also add information on how to contact you by electronic and paper mail.
</p>
<p>
If the program is interactive, make it output a short notice like this
when it starts in an interactive mode:
</p>
<pre>
Gnomovision version 69, Copyright (C) <var>year</var> <var>name of author</var>
Gnomovision comes with ABSOLUTELY NO WARRANTY; for details
type `show w'. This is free software, and you are welcome
to redistribute it under certain conditions; type `show c'
for details.
</pre>
<p>
The hypothetical commands <samp>`show w'</samp> and <samp>`show c'</samp> should show
the appropriate parts of the General Public License. Of course, the
commands you use may be called something other than <samp>`show w'</samp> and
<samp>`show c'</samp>; they could even be mouse-clicks or menu items--whatever
suits your program.
</p>
<p>
You should also get your employer (if you work as a programmer) or your
school, if any, to sign a "copyright disclaimer" for the program, if
necessary. Here is a sample; alter the names:
</p>
<pre>
Yoyodyne, Inc., hereby disclaims all copyright
interest in the program `Gnomovision'
(which makes passes at compilers) written
by James Hacker.
<var>signature of Ty Coon</var>, 1 April 1989
Ty Coon, President of Vice
</pre>
<p>
This General Public License does not permit incorporating your program into
proprietary programs. If your program is a subroutine library, you may
consider it more useful to permit linking proprietary applications with the
library. If this is what you want to do, use the
<a href="http://www.gnu.org/licenses/lgpl.html">GNU Lesser General Public License</a>
instead of this License.
</p>

View File

@@ -38,11 +38,7 @@
#include <QStyle>
#include <QSplashScreen>
#include <QPushButton>
#ifdef Q_WS_MAC
#include "qmacapplication.h"
#else
#include "qtsingleapplication.h"
#endif
#include "sessionapplication.h"
#include "GUI.h"
#include "ico.h"
#else
@@ -160,15 +156,11 @@ void useStyle(QString style){
int main(int argc, char *argv[]){
// Create Application
QString uid = misc::getUserIDString();
#ifdef DISABLE_GUI
#ifdef DISABLE_GUI
QtSingleCoreApplication app("qBittorrent-"+uid, argc, argv);
#else
#ifndef Q_WS_MAC
QtSingleApplication app("qBittorrent-"+uid, argc, argv);
#else
QMacApplication app("qBittorrent-"+uid, argc, argv);
#endif
#endif
#else
SessionApplication app("qBittorrent-"+uid, argc, argv);
#endif
// Check if qBittorrent is already running for this user
if(app.isRunning()) {
@@ -178,7 +170,7 @@ int main(int argc, char *argv[]){
for (int a = 1; a < argc; ++a) {
QString p = QString::fromLocal8Bit(argv[a]);
if(p.startsWith("--")) continue;
message += argv[a];
message += p;
if (a < argc-1)
message += "|";
}

View File

@@ -363,6 +363,20 @@ void misc::copyDir(QString src_path, QString dst_path) {
}
}
void misc::chmod644(const QDir& folder) {
qDebug("chmod644(%s)", qPrintable(folder.absolutePath()));
if(!folder.exists()) return;
foreach(const QFileInfo &fi, folder.entryInfoList(QDir::Dirs|QDir::Files|QDir::NoSymLinks)) {
if(fi.fileName().startsWith(".")) continue;
if(fi.isDir()) {
misc::chmod644(QDir(fi.absoluteFilePath()));
} else {
QFile f(fi.absoluteFilePath());
f.setPermissions(f.permissions()|QFile::ReadUser|QFile::WriteUser|QFile::ReadGroup|QFile::ReadOther);
}
}
}
QString misc::updateLabelInSavePath(const QString& defaultSavePath, QString save_path, const QString old_label, const QString new_label) {
if(old_label == new_label) return save_path;
qDebug("UpdateLabelInSavePath(%s, %s, %s)", qPrintable(save_path), qPrintable(old_label), qPrintable(new_label));

View File

@@ -40,6 +40,7 @@
#include <boost/date_time/posix_time/conversion.hpp>
#include <QPoint>
#include <QFile>
#include <QDir>
#include <libtorrent/torrent_info.hpp>
#include <libtorrent/torrent_handle.hpp>
@@ -75,6 +76,8 @@ public:
return QString(o.str().c_str());
}
static void chmod644(const QDir& folder);
static inline QString removeLastPathPart(QString path) {
if(path.isEmpty()) return path;
path = path.replace("\\", "/");

View File

@@ -308,8 +308,14 @@ void PeerListWidget::loadPeers(const QTorrentHandle &h, bool force_hostname_reso
updatePeer(peer_ip, peer);
old_peers_set.remove(peer_ip);
if(force_hostname_resolution) {
if(resolver)
resolver->resolve(peer.ip);
if(resolver) {
QString host = resolver->getHostFromCache(peer.ip);
if(host.isNull()) {
resolver->resolve(peer.ip);
} else {
peerItems.value(peer_ip)->setData(host);
}
}
}
} else {
// Add new peer
@@ -332,10 +338,17 @@ QStandardItem* PeerListWidget::addPeer(QString ip, peer_info peer) {
int row = listModel->rowCount();
// Adding Peer to peer list
listModel->insertRow(row);
listModel->setData(listModel->index(row, IP), ip);
QString host;
if(resolver) {
host = resolver->getHostFromCache(peer.ip);
}
if(host.isNull())
listModel->setData(listModel->index(row, IP), ip);
else
listModel->setData(listModel->index(row, IP), host);
listModel->setData(listModel->index(row, IP_HIDDEN), ip);
// Resolve peer host name is asked
if(resolver)
if(resolver && host.isNull())
resolver->resolve(peer.ip);
if(display_flags) {
QString country_name;
@@ -381,6 +394,6 @@ void PeerListWidget::updatePeer(QString ip, peer_info peer) {
void PeerListWidget::handleResolved(QString ip, QString hostname) {
QStandardItem *item = peerItems.value(ip, 0);
if(item) {
listModel->setData(listModel->indexFromItem(item), hostname);
item->setData(hostname);
}
}

View File

@@ -55,17 +55,6 @@ class PropertiesWidget;
class PeerListWidget : public QTreeView {
Q_OBJECT
private:
QStandardItemModel *listModel;
PeerListDelegate *listDelegate;
QSortFilterProxyModel * proxyModel;
QHash<QString, QStandardItem*> peerItems;
QHash<QString, libtorrent::asio::ip::tcp::endpoint> peerEndpoints;
QSet<QString> missingFlags;
QPointer<ReverseResolution> resolver;
PropertiesWidget* properties;
bool display_flags;
public:
PeerListWidget(PropertiesWidget *parent);
~PeerListWidget();
@@ -86,6 +75,17 @@ protected slots:
void limitUpRateSelectedPeers(QStringList peer_ips);
void limitDlRateSelectedPeers(QStringList peer_ips);
void banSelectedPeers(QStringList peer_ips);
private:
QStandardItemModel *listModel;
PeerListDelegate *listDelegate;
QSortFilterProxyModel * proxyModel;
QHash<QString, QStandardItem*> peerItems;
QHash<QString, libtorrent::asio::ip::tcp::endpoint> peerEndpoints;
QSet<QString> missingFlags;
QPointer<ReverseResolution> resolver;
PropertiesWidget* properties;
bool display_flags;
};
#endif // PEERLISTWIDGET_H

View File

@@ -60,23 +60,27 @@ public:
pixmap = pix;
} else {
// Look for maximum value
const int nb_pieces = avail.size();
const qulonglong nb_pieces = avail.size();
average = std::accumulate(avail.begin(), avail.end(), 0)/(double)nb_pieces;
// Reduce the number of pieces before creating the pixmap
// otherwise it can crash when there are too many pieces
if(nb_pieces > width()) {
const int ratio = floor(nb_pieces/(double)width());
const uint w = width();
if(nb_pieces > w) {
const qulonglong ratio = floor(nb_pieces/(double)w);
std::vector<int> scaled_avail;
for(int i=0; i<nb_pieces; i+= ratio) {
int j = i;
int sum = avail[i];
scaled_avail.reserve(ceil(nb_pieces/(double)ratio));
for(qulonglong i=0; i<nb_pieces; i+= ratio) {
/*qulonglong j = i;
qulonglong sum = avail[i];
for(j=i+1; j<qMin(i+ratio, nb_pieces); ++j) {
sum += avail[j];
}
scaled_avail.push_back(sum/(qMin(ratio, nb_pieces-i)));
scaled_avail.push_back(sum/(qMin(ratio, nb_pieces-i)));*/
// XXX: Do not compute the average to save cpu
scaled_avail.push_back(avail[i]);
}
QPixmap pix = QPixmap(scaled_avail.size(), 1);
pix.fill();
//pix.fill();
QPainter painter(&pix);
for(qulonglong i=0; i < scaled_avail.size(); ++i) {
painter.setPen(getPieceColor(scaled_avail[i], average));
@@ -85,9 +89,9 @@ public:
pixmap = pix;
} else {
QPixmap pix = QPixmap(nb_pieces, 1);
pix.fill();
//pix.fill();
QPainter painter(&pix);
for(int i=0; i < nb_pieces; ++i) {
for(qulonglong i=0; i < nb_pieces; ++i) {
painter.setPen(getPieceColor(avail[i], average));
painter.drawPoint(i,0);
}
@@ -112,13 +116,12 @@ protected:
QColor getPieceColor(int avail, double average) {
if(!avail) return Qt::white;
//qDebug("avail: %d/%d", avail, max_avail);
const QColor color = Qt::blue; // average avail
double fraction = 100.*average/avail;
if(fraction < 100)
fraction *= 0.9;
fraction *= 0.8;
else
fraction *= 1.1;
return color.lighter(fraction);
fraction *= 1.2;
return QColor(Qt::blue).lighter(fraction);
}
};

View File

@@ -241,11 +241,11 @@ QStringList QTorrentHandle::url_seeds() const {
Q_ASSERT(h.is_valid());
QStringList res;
try {
std::vector<std::string> existing_seeds = h.get_torrent_info().url_seeds();
unsigned int nbSeeds = existing_seeds.size();
QString existing_seed;
for(unsigned int i=0; i<nbSeeds; ++i) {
res << misc::toQString(existing_seeds[i]);
const std::set<std::string> existing_seeds = h.url_seeds();
std::set<std::string>::const_iterator it;
for(it = existing_seeds.begin(); it != existing_seeds.end(); it++) {
qDebug("URL Seed: %s", it->c_str());
res << misc::toQString(*it);
}
} catch(std::exception e) {}
return res;
@@ -629,6 +629,10 @@ void QTorrentHandle::move_storage(QString new_path) const {
Q_ASSERT(h.is_valid());
if(QDir(save_path()) == QDir(new_path)) return;
TorrentPersistentData::setPreviousSavePath(hash(), save_path());
// Create destination directory if necessary
// or move_storage() will fail...
QDir().mkpath(new_path);
// Actually move the storage
h.move_storage(new_path.toLocal8Bit().constData());
}

View File

@@ -36,6 +36,7 @@
#include <QWaitCondition>
#include <QMutex>
#include <QList>
#include <QCache>
#include "misc.h"
#include <boost/version.hpp>
@@ -47,7 +48,8 @@
using namespace libtorrent;
#define MAX_THREADS 20
const int MAX_THREADS = 20;
const int CACHE_SIZE = 500;
class ReverseResolutionST: public QThread {
Q_OBJECT
@@ -58,7 +60,8 @@ private:
bool stopped;
public:
ReverseResolutionST(libtorrent::asio::io_service &ios, QObject *parent=0): QThread(parent), resolver(ios), stopped(false) {
ReverseResolutionST(libtorrent::asio::io_service &ios, QObject *parent=0):
QThread(parent), resolver(ios), stopped(false) {
}
@@ -93,18 +96,11 @@ protected:
class ReverseResolution: public QThread {
Q_OBJECT
private:
QQueue<libtorrent::asio::ip::tcp::endpoint> ips;
QMutex mut;
QWaitCondition cond;
bool stopped;
libtorrent::asio::io_service ios;
QList<ReverseResolutionST*> subThreads;
Q_DISABLE_COPY(ReverseResolution)
public:
ReverseResolution(QObject* parent): QThread(parent), stopped(false) {
explicit ReverseResolution(QObject* parent): QThread(parent), stopped(false) {
cache = new QCache<QString, QString>(CACHE_SIZE);
}
~ReverseResolution() {
@@ -113,6 +109,7 @@ public:
stopped = true;
cond.wakeOne();
}
delete cache;
wait();
qDebug("Host name resolver was deleted");
}
@@ -124,8 +121,29 @@ public:
cond.wakeOne();
}
QString getHostFromCache(libtorrent::asio::ip::tcp::endpoint ip) {
mut.lock();
QString ip_str = misc::toQString(ip.address().to_string());
QString ret;
if(cache->contains(ip_str)) {
qDebug("Got host name from cache");
ret = *cache->object(ip_str);
} else {
ret = QString::null;
}
mut.unlock();
return ret;
}
void resolve(libtorrent::asio::ip::tcp::endpoint ip) {
mut.lock();
QString ip_str = misc::toQString(ip.address().to_string());
if(cache->contains(ip_str)) {
qDebug("Resolved host name using cache");
emit ip_resolved(ip_str, *cache->object(ip_str));
mut.unlock();
return;
}
ips.enqueue(ip);
if(subThreads.size() < MAX_THREADS)
cond.wakeOne();
@@ -139,6 +157,7 @@ protected slots:
void forwardSignal(QString ip, QString hostname) {
emit ip_resolved(ip, hostname);
mut.lock();
cache->insert(ip, new QString(hostname));
subThreads.removeOne(static_cast<ReverseResolutionST*>(sender()));
if(!ips.empty())
cond.wakeOne();
@@ -168,6 +187,16 @@ protected:
qDeleteAll(subThreads);
mut.unlock();
}
private:
QQueue<libtorrent::asio::ip::tcp::endpoint> ips;
QMutex mut;
QWaitCondition cond;
bool stopped;
libtorrent::asio::io_service ios;
QCache<QString, QString> *cache;
QList<ReverseResolutionST*> subThreads;
};
#endif // REVERSERESOLUTION_H

View File

@@ -1,4 +1,4 @@
#VERSION: 1.04
#VERSION: 1.06
#AUTHORS: Christophe Dumez (chris@qbittorrent.org)
# Redistribution and use in source and binary forms, with or without
@@ -72,6 +72,8 @@ class torrentdownloads(object):
self.current_item = None
self.results = results
self.what = what.upper().split('+')
if len(self.what) == 0:
self.what = None
def start_a(self, attr):
params = dict(attr)
@@ -113,8 +115,9 @@ class torrentdownloads(object):
self.current_item['leech'] = 0
# Search should use AND operator as a default
tmp = self.current_item['name'].upper();
for w in self.what:
if tmp.find(w) < 0: return
if self.what is not None:
for w in self.what:
if tmp.find(w) < 0: return
prettyPrinter(self.current_item)
self.results.append('a')

View File

@@ -4,4 +4,4 @@ btjunkie: 2.21
mininova: 1.40
piratebay: 1.30
vertor: 1.0
torrentdownloads: 1.04
torrentdownloads: 1.06

View File

@@ -484,8 +484,10 @@ void SearchEngine::updateNova() {
// Copy search plugin files (if necessary)
QString filePath = search_dir.absoluteFilePath("nova2.py");
if(getPluginVersion(":/search_engine/nova2.py") > getPluginVersion(filePath)) {
if(QFile::exists(filePath))
if(QFile::exists(filePath)) {
misc::safeRemove(filePath);
misc::safeRemove(filePath+"c");
}
QFile::copy(":/search_engine/nova2.py", filePath);
}
@@ -493,6 +495,7 @@ void SearchEngine::updateNova() {
if(getPluginVersion(":/search_engine/nova2dl.py") > getPluginVersion(filePath)) {
if(QFile::exists(filePath)){
misc::safeRemove(filePath);
misc::safeRemove(filePath+"c");
}
QFile::copy(":/search_engine/nova2dl.py", filePath);
}
@@ -501,6 +504,7 @@ void SearchEngine::updateNova() {
if(getPluginVersion(":/search_engine/novaprinter.py") > getPluginVersion(filePath)) {
if(QFile::exists(filePath)){
misc::safeRemove(filePath);
misc::safeRemove(filePath+"c");
}
QFile::copy(":/search_engine/novaprinter.py", filePath);
}
@@ -509,6 +513,7 @@ void SearchEngine::updateNova() {
if(getPluginVersion(":/search_engine/helpers.py") > getPluginVersion(filePath)) {
if(QFile::exists(filePath)){
misc::safeRemove(filePath);
misc::safeRemove(filePath+"c");
}
QFile::copy(":/search_engine/helpers.py", filePath);
}
@@ -530,6 +535,7 @@ void SearchEngine::updateNova() {
if(QFile::exists(dest_file)) {
qDebug("Removing old %s", qPrintable(dest_file));
misc::safeRemove(dest_file);
misc::safeRemove(dest_file+"c");
}
qDebug("%s copied to %s", qPrintable(shipped_file), qPrintable(dest_file));
QFile::copy(shipped_file, dest_file);
@@ -543,6 +549,10 @@ void SearchEngine::updateNova() {
}
}
}
#ifndef Q_WS_WIN
// Fix permissions
misc::chmod644(QDir(misc::searchEngineLocation()));
#endif
}
// Slot called when search is Finished

View File

@@ -0,0 +1,44 @@
/*
* Bittorrent Client using Qt4 and libtorrent.
* Copyright (C) 2010 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.
*
* In addition, as a special exception, the copyright holders give permission to
* link this program with the OpenSSL project's "OpenSSL" library (or with
* modified versions of it that use the same license as the "OpenSSL" library),
* and distribute the linked executables. You must obey the GNU General Public
* License in all respects for all of the code used other than "OpenSSL". If you
* modify file(s), you may extend this exception to your version of the file(s),
* but you are not obligated to do so. If you do not wish to do so, delete this
* exception statement from your version.
*
* Contact : chris@qbittorrent.org
*/
#include "sessionapplication.h"
SessionApplication::SessionApplication(const QString &id, int &argc, char **argv) :
#ifdef Q_WS_MAC
QMacApplication(id, argc, argv)
#else
QtSingleApplication(id, argc, argv)
#endif
{}
void SessionApplication::commitData(QSessionManager & manager) {
Q_UNUSED(manager);
emit sessionIsShuttingDown();
}

59
src/sessionapplication.h Normal file
View File

@@ -0,0 +1,59 @@
/*
* Bittorrent Client using Qt4 and libtorrent.
* Copyright (C) 2010 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.
*
* In addition, as a special exception, the copyright holders give permission to
* link this program with the OpenSSL project's "OpenSSL" library (or with
* modified versions of it that use the same license as the "OpenSSL" library),
* and distribute the linked executables. You must obey the GNU General Public
* License in all respects for all of the code used other than "OpenSSL". If you
* modify file(s), you may extend this exception to your version of the file(s),
* but you are not obligated to do so. If you do not wish to do so, delete this
* exception statement from your version.
*
* Contact : chris@qbittorrent.org
*/
#ifndef SESSIONAPPLICATION_H
#define SESSIONAPPLICATION_H
#ifdef Q_WS_MAC
#include "qmacapplication.h"
#else
#include "qtsingleapplication.h"
#endif
#include <QSessionManager>
class SessionApplication :
#ifdef Q_WS_MAC
public QMacApplication
#else
public QtSingleApplication
#endif
{
Q_OBJECT
public:
SessionApplication(const QString &id, int &argc, char **argv);
void commitData(QSessionManager & manager);
signals:
void sessionIsShuttingDown();
};
#endif // SESSIONAPPLICATION_H

View File

@@ -12,24 +12,21 @@ CONFIG += qt \
# Update this VERSION for each release
os2 {
DEFINES += VERSION=\'\"v2.4.2\"\'
DEFINES += VERSION=\'\"v2.4.6\"\'
} else {
DEFINES += VERSION=\\\"v2.4.2\\\"
DEFINES += VERSION=\\\"v2.4.6\\\"
}
DEFINES += VERSION_MAJOR=2
DEFINES += VERSION_MINOR=4
DEFINES += VERSION_BUGFIX=2
DEFINES += VERSION_BUGFIX=6
# NORMAL,ALPHA,BETA,RELEASE_CANDIDATE,DEVEL
DEFINES += VERSION_TYPE=NORMAL
win32 {
# Adapt these paths on Windows
INCLUDEPATH += $$quote(C:/qbittorrent/boost_1_42_0)
INCLUDEPATH += $$quote(C:/qbittorrent/libtorrent-rasterbar-0.14.10/include)
INCLUDEPATH += $$quote(C:/qbittorrent/libtorrent-rasterbar-0.14.10/zlib)
LIBS += -LC:/OpenSSL/lib/VC
exists(../winconf.pri) {
include(../winconf.pri)
}
#DEFINES += _WIN32_WINNT=0x0601
#DEFINES += _WIN32_IE=0x0400
@@ -178,18 +175,17 @@ win32 {
# LIBS += "/nodefaultlib:"libcmt.lib"
#}
# Adapt these paths on Windows
contains(DEBUG_MODE, 1) {
LIBS += C:/qbittorrent/libs/libtorrentd.lib \
C:/qbittorrent/libs/libboost_system-vc90-mt-gd.lib \
C:/qbittorrent/libs/libboost_filesystem-vc90-mt-gd.lib \
C:/qbittorrent/libs/libboost_thread-vc90-mt-gd.lib
LIBS += libtorrentd.lib \
libboost_system-vc90-mt-gd.lib \
libboost_filesystem-vc90-mt-gd.lib \
libboost_thread-vc90-mt-gd.lib
}
contains(DEBUG_MODE, 0) {
LIBS += C:/qbittorrent/libs/libtorrent.lib \
C:/qbittorrent/libs/libboost_system-vc90-mt.lib \
C:/qbittorrent/libs/libboost_filesystem-vc90-mt.lib \
C:/qbittorrent/libs/libboost_thread-vc90-mt.lib
LIBS += libtorrent.lib \
libboost_system-vc90-mt.lib \
libboost_filesystem-vc90-mt.lib \
libboost_thread-vc90-mt.lib
}
LIBS += advapi32.lib shell32.lib
@@ -227,7 +223,8 @@ os2 {
RESOURCES = icons.qrc \
lang.qrc \
search.qrc \
webui.qrc
webui.qrc \
about.qrc
# Add GeoIP resource file if the GeoIP database
# should be embedded in qBittorrent executable
@@ -342,7 +339,8 @@ contains(DEFINES, DISABLE_GUI) {
advancedsettings.h \
cookiesdlg.h \
rsssettings.h \
hidabletabwidget.h
hidabletabwidget.h \
sessionapplication.h
macx {
HEADERS += qmacapplication.h
@@ -422,7 +420,8 @@ SOURCES += main.cpp \
cookiesdlg.cpp \
trackerlist.cpp \
torrentadditiondlg.cpp \
rsssettings.cpp
rsssettings.cpp \
sessionapplication.cpp
macx {
SOURCES += qmacapplication.cpp

View File

@@ -170,9 +170,13 @@ public slots:
bar->insertWidget(1, new QLabel(tr("qBittorrent needs to be restarted")));
}
void stopTimer() {
refreshTimer->stop();
}
void refreshStatusBar() {
// Update connection status
session_status sessionStatus = BTSession->getSessionStatus();
const session_status sessionStatus = BTSession->getSessionStatus();
if(!BTSession->getSession()->is_listening()) {
connecStatusLblIcon->setPixmap(QPixmap(QString::fromUtf8(":/Icons/skin/disconnected.png")));
connecStatusLblIcon->setToolTip(QString::fromUtf8("<b>")+tr("Connection Status:")+QString::fromUtf8("</b><br>")+tr("Offline. This usually means that qBittorrent failed to listen on the selected port for incoming connections."));

View File

@@ -120,9 +120,13 @@ void torrentAdditionDialog::saveSettings() {
}
void torrentAdditionDialog::renameTorrentNameInModel(QString file_path) {
file_path = file_path.trimmed();
if(file_path.isEmpty()) return;
file_path = file_path.replace("\\", "/");
// Rename in torrent files model too
PropListModel->setData(PropListModel->index(0, 0), file_path.split("/", QString::SkipEmptyParts).last());
QStringList parts = file_path.split("/", QString::SkipEmptyParts);
if(!parts.empty())
PropListModel->setData(PropListModel->index(0, 0), parts.last());
}
void torrentAdditionDialog::limitDialogWidth() {

View File

@@ -375,11 +375,16 @@ public:
QIniSettings settings(QString::fromUtf8("qBittorrent"), QString::fromUtf8("qBittorrent-resume"));
QHash<QString, QVariant> all_data = settings.value("torrents", QHash<QString, QVariant>()).toHash();
QHash<QString, QVariant> data = all_data[h.hash()].toHash();
data["seed"] = h.is_seed();
all_data[h.hash()] = data;
settings.setValue("torrents", all_data);
// Save completion date
saveSeedDate(h);
bool was_seed = data.value("seed", false).toBool();
if(was_seed != h.is_seed()) {
data["seed"] = !was_seed;
all_data[h.hash()] = data;
settings.setValue("torrents", all_data);
if(!was_seed) {
// Save completion date
saveSeedDate(h);
}
}
}
// Getters

View File

@@ -74,7 +74,7 @@ public:
}
case TR_SEEDS:
case TR_PEERS: {
qulonglong tot_val = index.data().toULongLong();
const qulonglong tot_val = index.data().toULongLong();
QString display = QString::number((qulonglong)tot_val/1000000);
if(tot_val%2 == 0) {
// Scrape was successful, we have total values
@@ -86,8 +86,8 @@ public:
break;
}
case TR_STATUS: {
int state = index.data().toInt();
QString display = "";
const int state = index.data().toInt();
QString display;
switch(state) {
case STATE_DOWNLOADING:
display = tr("Downloading");
@@ -110,6 +110,9 @@ public:
case STATE_CHECKING_DL:
case STATE_CHECKING_UP:
display = tr("Checking", "Torrent local data is being checked");
break;
default:
display = "";
}
QItemDelegate::drawBackground(painter, opt, index);
QItemDelegate::drawDisplay(painter, opt, opt.rect, display);
@@ -118,7 +121,7 @@ public:
case TR_UPSPEED:
case TR_DLSPEED:{
QItemDelegate::drawBackground(painter, opt, index);
qulonglong speed = index.data().toULongLong();
const qulonglong speed = index.data().toULongLong();
opt.displayAlignment = Qt::AlignRight;
QItemDelegate::drawDisplay(painter, opt, opt.rect, misc::friendlyUnit(speed)+tr("/s", "/second (.i.e per second)"));
break;
@@ -126,7 +129,7 @@ public:
case TR_UPLIMIT:
case TR_DLLIMIT:{
QItemDelegate::drawBackground(painter, opt, index);
qlonglong limit = index.data().toLongLong();
const qlonglong limit = index.data().toLongLong();
opt.displayAlignment = Qt::AlignRight;
if(limit > 0)
QItemDelegate::drawDisplay(painter, opt, opt.rect, QString::number(limit/1024., 'f', 1) + " " + tr("KiB/s", "KiB/second (.i.e per second)"));
@@ -142,7 +145,7 @@ public:
case TR_RATIO:{
QItemDelegate::drawBackground(painter, opt, index);
opt.displayAlignment = Qt::AlignRight;
double ratio = index.data().toDouble();
const double ratio = index.data().toDouble();
if(ratio > 100.)
QItemDelegate::drawDisplay(painter, opt, opt.rect, QString::fromUtf8(""));
else
@@ -150,7 +153,7 @@ public:
break;
}
case TR_PRIORITY: {
int priority = index.data().toInt();
const int priority = index.data().toInt();
if(priority >= 0) {
opt.displayAlignment = Qt::AlignRight;
QItemDelegate::paint(painter, opt, index);
@@ -163,7 +166,7 @@ public:
}
case TR_PROGRESS:{
QStyleOptionProgressBarV2 newopt;
double progress = index.data().toDouble()*100.;
const double progress = index.data().toDouble()*100.;
newopt.rect = opt.rect;
newopt.text = QString::number(progress, 'f', 1)+"%";
newopt.progress = (int)progress;

View File

@@ -584,10 +584,17 @@ inline QString TransferListWidget::getHashFromRow(int row) const {
}
inline QModelIndex TransferListWidget::mapToSource(const QModelIndex &index) const {
return labelFilterModel->mapToSource(statusFilterModel->mapToSource(nameFilterModel->mapToSource(index)));
Q_ASSERT(index.isValid());
if(index.model() == nameFilterModel)
return labelFilterModel->mapToSource(statusFilterModel->mapToSource(nameFilterModel->mapToSource(index)));
if(index.model() == statusFilterModel)
return labelFilterModel->mapToSource(statusFilterModel->mapToSource(index));
return labelFilterModel->mapToSource(index);
}
inline QModelIndex TransferListWidget::mapFromSource(const QModelIndex &index) const {
Q_ASSERT(index.isValid());
Q_ASSERT(index.model() == labelFilterModel);
return nameFilterModel->mapFromSource(statusFilterModel->mapFromSource(labelFilterModel->mapFromSource(index)));
}
@@ -1426,6 +1433,7 @@ void TransferListWidget::loadLastSortedColumn() {
}
void TransferListWidget::currentChanged(const QModelIndex& current, const QModelIndex&) {
qDebug("CURRENT CHANGED");
QTorrentHandle h;
if(current.isValid()) {
const int row = mapToSource(current).row();
@@ -1478,7 +1486,9 @@ void TransferListWidget::applyStatusFilter(int f) {
statusFilterModel->setFilterRegExp(QRegExp());
}
// Select first item if nothing is selected
if(selectionModel()->selectedRows(0).empty() && statusFilterModel->rowCount() > 0)
selectionModel()->setCurrentIndex(statusFilterModel->index(0, TR_NAME), QItemSelectionModel::SelectCurrent|QItemSelectionModel::Rows);
if(selectionModel()->selectedRows(0).empty() && nameFilterModel->rowCount() > 0) {
qDebug("Nothing is selected, selecting first row: %s", qPrintable(nameFilterModel->index(0, TR_NAME).data().toString()));
selectionModel()->setCurrentIndex(nameFilterModel->index(0, TR_NAME), QItemSelectionModel::SelectCurrent|QItemSelectionModel::Rows);
}
}

View File

@@ -17,12 +17,6 @@
<height>320</height>
</size>
</property>
<property name="maximumSize">
<size>
<width>504</width>
<height>320</height>
</size>
</property>
<property name="windowTitle">
<string>About qBittorrent</string>
</property>

8
winconf.pri Normal file
View File

@@ -0,0 +1,8 @@
# Adapt these paths on Windows
INCLUDEPATH += $$quote($$PWD/boost_1_42_0)
INCLUDEPATH += $$quote($$PWD/libtorrent-rasterbar-0.14.10/include)
INCLUDEPATH += $$quote($$PWD/libtorrent-rasterbar-0.14.10/zlib)
INCLUDEPATH += $$quote(C:/OpenSSL/include)
LIBS += $$quote(-LC:/OpenSSL/lib/VC)
LIBS += $$quote(-L$$PWD/libs)