1
mirror of https://github.com/qbittorrent/qBittorrent synced 2025-10-12 03:12:18 +02:00

Compare commits

...

96 Commits

Author SHA1 Message Date
Christophe Dumez
c7cfc28aa9 - Tagging v1.2.1 release 2008-11-20 09:36:42 +00:00
Christophe Dumez
d11e132f56 - Bump to v1.2.1 2008-11-09 09:41:51 +00:00
Christophe Dumez
5e2af99c73 - Fix to speed up startup when having a lot of torrents 2008-11-02 18:53:17 +00:00
Christophe Dumez
23e03a5700 Queued_for_checking torrents were not displayed as checking in seeding list 2008-11-02 13:50:42 +00:00
Christophe Dumez
949e1d75cd - Disabled debug since this is stable branch now 2008-11-01 12:50:39 +00:00
Christophe Dumez
c944d88c3e branched v1.2.0 2008-11-01 12:48:10 +00:00
Christophe Dumez
2d24b468b6 Fixed possible crash when deleting a torrent permanently 2008-11-01 12:33:52 +00:00
Christophe Dumez
2dc75cb98d - Updated release date 2008-10-29 20:02:02 +00:00
Christophe Dumez
5e3be25916 - Single instance code is now more reliable on Qt >= 4.4 (closes #286968) 2008-10-29 19:58:44 +00:00
Christophe Dumez
49e8bad7cc - Removed rc from version 2008-10-28 21:39:12 +00:00
Christophe Dumez
796aea19e6 - Webui: refresh download list every 2 seconds to save cpu 2008-10-28 21:37:19 +00:00
Christophe Dumez
dd35f1723b - Updated mootools to v1.2.1 2008-10-28 21:20:08 +00:00
Christophe Dumez
0177e1fee4 - Attempt to fix icon flickering in webui 2008-10-28 21:17:17 +00:00
Christophe Dumez
949eb2b5f5 - WebUI: Uploads should always use seeding icon (not connecting for example) 2008-10-27 20:15:17 +00:00
Christophe Dumez
2d59fe37bf fixed translations 2008-10-17 05:57:03 +00:00
Christophe Dumez
b6f81c199e - fixed italian translation 2008-10-17 05:48:18 +00:00
Christophe Dumez
c2964dc340 - Updated AUTHORS file (from Cristian Greco@Debian) 2008-10-13 07:04:20 +00:00
Christophe Dumez
8aebb93424 - Updated bulgarian and greek translations 2008-10-07 18:32:27 +00:00
Christophe Dumez
96c38f7be4 - Updated Russian translation
- Progress column is now correctly sorted on startup (closes #133925 again)
2008-10-06 18:34:47 +00:00
Christophe Dumez
cf2abe45de - AddinPause feature no longer applies to resumed torrents on startup
(closes #278827)
2008-10-06 12:21:34 +00:00
Christophe Dumez
88ac8adb30 - Bump to rc4
- Disabled debug output
- Updated Chinese traditional translation
2008-10-05 11:34:52 +00:00
Christophe Dumez
b331478179 - Fix "go back to download list dialog" when seeding torrent has filtered files (closes #278508) 2008-10-05 11:10:57 +00:00
Christophe Dumez
bfaa82ccba - Not deleting files on hard drive when user is answering no the the 'move to download list' dialog 2008-10-05 11:05:27 +00:00
Christophe Dumez
77f407724d - German was not updated yet 2008-10-05 09:29:27 +00:00
Christophe Dumez
2f5c2e6404 - Updated Korean, Swedish, Romanian 2008-10-05 09:28:43 +00:00
Christophe Dumez
fbb2cdd1a9 - Updated dutch translation 2008-10-04 21:16:34 +00:00
Christophe Dumez
63a4e06556 - Attempt to fix single instance code on Qt 4.4 2008-10-04 19:36:27 +00:00
Christophe Dumez
3d934b4a9c - bump to rc3 2008-10-04 15:23:31 +00:00
Christophe Dumez
697c275d83 - Fixed torrent queueing system (finally) 2008-10-04 15:21:52 +00:00
Christophe Dumez
25b9601613 - Should fix save path problems 2008-10-04 14:14:07 +00:00
Christophe Dumez
276dfd9df6 BUGFIX: Torrents are no longer starting from scratch when changing default save path (when torrent addition dialog is disabled) 2008-10-04 14:01:55 +00:00
Christophe Dumez
19f05f0a97 - Updated italian translation 2008-10-03 18:37:11 +00:00
Christophe Dumez
293aaefefe - updated hungarian translation 2008-10-02 14:15:40 +00:00
Christophe Dumez
57cdf4ebd1 - Updated german translation 2008-10-01 20:32:04 +00:00
Christophe Dumez
c4a0c8f100 - Should fix bug #276196 2008-10-01 19:17:07 +00:00
Christophe Dumez
306991e776 - More debug 2008-10-01 19:05:17 +00:00
Christophe Dumez
de2384e4a7 - Added some debug 2008-10-01 19:00:59 +00:00
Christophe Dumez
236dbcfb4a - attempt to fix #276196 2008-10-01 07:02:49 +00:00
Christophe Dumez
a1b133d883 - Fixed progress for unchecked paused torrents 2008-09-30 18:37:05 +00:00
Christophe Dumez
4f8825e371 - Fixed priority column sorting (closes #276190) 2008-09-30 06:14:37 +00:00
Christophe Dumez
1aa0936c91 - Updated slovak translation
- french translation fix
2008-09-30 06:09:50 +00:00
Christophe Dumez
d5e22c523e - Fixed typographic error 2008-09-29 20:28:55 +00:00
Christophe Dumez
6618e61a42 - Added Expand/Collapse all buttons to properties dialog 2008-09-29 18:42:45 +00:00
Christophe Dumez
26283ec228 - Updated swedish translation 2008-09-28 18:53:33 +00:00
Christophe Dumez
ed12f5c77e - bump to rc2 2008-09-28 18:02:31 +00:00
Christophe Dumez
8e074a571a - Fixed queueing priorities loading on startup 2008-09-28 17:58:12 +00:00
Christophe Dumez
e2c7c973fd - Improved multiple selection style by blocking browser event 2008-09-28 16:39:39 +00:00
Christophe Dumez
eec04761ef - Block browser event for CTRL+A so that it does not select text (unwanted) : Web Ui 2008-09-28 16:25:51 +00:00
Christophe Dumez
f73256e0ea - Fixed shift selection from bottom to top (Web UI)
- Fixed bug where current selection was not cleared correctly (Web Ui)
- Allow to select all torrents using CRTL+A (Web Ui)
2008-09-28 16:23:08 +00:00
Christophe Dumez
fec1de6383 - Updated finish translation 2008-09-28 16:00:51 +00:00
Christophe Dumez
db35a7efb8 - Updated chinese translations 2008-09-28 15:43:14 +00:00
Christophe Dumez
36eae88a5a - bump to rc1 2008-09-28 11:58:09 +00:00
Christophe Dumez
c01fd75c92 - Updated french translation
- Updated copyright
2008-09-28 11:57:09 +00:00
Christophe Dumez
103f2d0720 - Updated translation files 2008-09-28 11:42:32 +00:00
Christophe Dumez
037c46b587 - bump to beta8 2008-09-28 11:33:21 +00:00
Christophe Dumez
0879f2c0ca - Totally rewritten Web UI list refresh system (fixed memory leak) 2008-09-28 11:30:24 +00:00
Christophe Dumez
a65cd5c39c - some more Web Ui fixes 2008-09-28 10:07:00 +00:00
Christophe Dumez
d219e7afeb - Added some licensing 2008-09-27 21:01:24 +00:00
Christophe Dumez
892bb4c432 - Improved tab look 2008-09-27 20:56:41 +00:00
Christophe Dumez
45b9c6335c - removed useless debug 2008-09-27 20:32:59 +00:00
Christophe Dumez
78e643039c - Fixed torrent exchange from one list to another in Web Ui 2008-09-27 20:31:50 +00:00
Christophe Dumez
04e993c674 - Fixed pause/resume/delete actions on seeding list (Web UI) 2008-09-27 20:10:10 +00:00
Christophe Dumez
c3132fc1b0 - Updated changelog 2008-09-27 19:56:57 +00:00
Christophe Dumez
b1c73cb401 - Split download and upload lists in Web UI 2008-09-27 19:55:56 +00:00
Christophe Dumez
ac6eb8c6bc - fixed pause/resume (broken by multiple selection commit) 2008-09-27 19:28:09 +00:00
Christophe Dumez
8a64412cb5 - Allow the user to use SHIFT key to extend selection in Web UI transfer list 2008-09-27 10:18:27 +00:00
Christophe Dumez
56885cc914 - Allow the user to use CTRL key to select multiple item in Web UI transfer list 2008-09-27 10:08:07 +00:00
Christophe Dumez
cdd1f9b86c - Fixed assert HIT in eventmanager due to queueing system 2008-09-27 09:58:28 +00:00
Christophe Dumez
139360cf76 - Can have different proxy settings for bittorrent and search engine (closes #274791) 2008-09-27 09:12:41 +00:00
Christophe Dumez
2931d51add - Fixed RSS list saving (closes #272651) 2008-09-21 08:35:38 +00:00
Christophe Dumez
aa0bec41b4 - bug fix for preferences saving (introduced recently) 2008-09-21 08:17:29 +00:00
Christophe Dumez
b32b42b53e - Added Collapse/Expand all buttons to torrent addition dialog (closes #272654) 2008-09-21 08:13:23 +00:00
Christophe Dumez
06c4c717bd - bump to beta7 2008-09-17 19:17:55 +00:00
Christophe Dumez
a3ed44baec - Fixed bad check for finished torrents (introduced in beta6) 2008-09-17 19:15:21 +00:00
Christophe Dumez
0cbb4a7074 - Updated polish translation 2008-09-15 17:53:17 +00:00
Ishan Arora
af2e487ef5 Added few debug statements to EventManager timer loop 2008-09-15 05:27:56 +00:00
Christophe Dumez
28fdfdfef1 - bump to beta6 2008-09-14 10:24:52 +00:00
Christophe Dumez
c95cca6436 - Updated changelogs 2008-09-14 10:23:59 +00:00
Christophe Dumez
86024c6c74 - merge from stable branches (WebUI fixes) 2008-09-14 10:14:54 +00:00
Christophe Dumez
75290cf715 - Cleaning memory for Web UI to avoid problems when running for a long time 2008-09-13 20:33:07 +00:00
Christophe Dumez
321b76a72a - fixed sorting in finished list 2008-09-13 19:57:54 +00:00
Christophe Dumez
95ecaec11e - Sync with stable branch (lot of bug fixing) 2008-09-13 18:53:58 +00:00
Christophe Dumez
0e7c16901c fixed a bug in last commit 2008-09-13 13:41:11 +00:00
Christophe Dumez
43dcbf776b Use QPointer when interesting 2008-09-13 07:33:41 +00:00
Christophe Dumez
e21c28e9d2 Fixed memory leak in HTTP server 2008-09-12 19:58:57 +00:00
Christophe Dumez
918c1507d3 - Web UI optimization 2008-09-12 19:56:32 +00:00
Christophe Dumez
a189e4403d - Fixed a string 2008-09-07 12:18:52 +00:00
Christophe Dumez
563291a2e8 - Updated language files 2008-09-07 12:12:16 +00:00
Christophe Dumez
9156c9ac8f - Logs are now in a separate dialog 2008-09-07 12:09:41 +00:00
Christophe Dumez
f0049f1dae - Removed logging panel for now. It will be replaced by a seperate dialog in order to simplify the default UI. 2008-09-07 11:31:29 +00:00
Christophe Dumez
a622152747 - Make use of h.is_seed() instead of h.progress() == 1. 2008-09-03 18:19:17 +00:00
Christophe Dumez
8440e9982f - Display top toolBar as a default 2008-09-03 17:52:40 +00:00
Christophe Dumez
602d73fa82 fix typo in german translation 2008-09-02 19:03:31 +00:00
Christophe Dumez
c32ebb8d9f - Another fix for boost v1.36 2008-08-31 12:35:25 +00:00
Christophe Dumez
deeead4008 - Compilation fix for boost v1.36
- Fixed 'start seeding after torrent creation' feature
2008-08-31 12:21:41 +00:00
Christophe Dumez
937a491409 Updated copyright info 2008-08-27 00:59:58 +00:00
112 changed files with 18805 additions and 13726 deletions

13
AUTHORS
View File

@@ -17,13 +17,14 @@ Images Authors:
license: Creative Commons Public Domain Dedication
url: http://www.openclipart.org
* files: src/Icons/skins/*.png
* files: src/Icons/skin/*.png
files: src/menuicons/YYxYY/*.png
copyright: Mateusz Tobola <tobejodok@qbittorrent.org>
license: GPLv2
* files: src/menuicons/YYxYY/*.png
copyright: Mateusz Tobola <tobejodok@qbittorrent.org>
license: GPLv2
* file: src/Icons/skin/tabs.gif
copyright: Greg Houston <gregory.houston@gmail.com>
license: MIT
* file: src/search_engine/engines/btjunkie.png
copyright: Downloaded from btjunkie.org
@@ -46,7 +47,9 @@ Translations authors:
- Brazilian: Nick Marinho (nickmarinho@gmail.com)
- Bulgarian: Tsvetan & Boiko Bankov (emerge_life@users.sourceforge.net)
- Catalan: Gekko Dam Beer (gekko04@users.sourceforge.net)
- Chinese (Simplified): Guo Yue (guoyue0418@hotmail.com)
- Chinese (Simplified): Guo Yue (yue.guo0418@gmail.com)
- Chinese (Traditional): Yi-Shun Wang (dnextstep@gmail.com)
- Czech: Jirka Vilim (web@tets.cz)
- Danish: Mathias Nielsen (comoneo@gmail.com)
- Dutch: Joost Schipper (heavyjoost@users.sourceforge.net)
- English: Christophe Dumez (chris@qbittorrent.org)

View File

@@ -1,14 +1,37 @@
* Unknown - Christophe Dumez <chris@qbittorrent.org> - v1.2.0
* Sun Nov 9 2008 - Christophe Dumez <chris@qbittorrent.org> - v1.2.1
- BUGFIX: Fixed possible crash when deleting a torrent permanently
- BUGFIX: Queued_for_checking torrents were not displayed as checking in seeding list
- BUGFIX: Speed up startup time when having a lot of torrents
* Wed Oct 29 2008 - Christophe Dumez <chris@qbittorrent.org> - v1.2.0
- FEATURE: Torrent queueing system (with priorities)
- FEATURE: DHT is always ON (no longer used as fallback)
- FEATURE: The number of DHT nodes is displayed
- FEATURE: RSS can now be disabled from program preferences
- FEATURE: Added collapse/expand all buttons in addition and properties dialogs
- FEATURE: Can have different proxies for Bittorrent and search engine
- FEATURE: Allow multiple item selection in Web UI transfer list
- FEATURE: Moved uploads to a separate list in Web UI
- BUGFIX: Totally rewritten Web UI list refresh system (fixed memory leak)
- BUGFIX: Disable ETA calculation when ETA column is hidden
- BUGFIX: Removed "disconnected" connection state, detection was far from perfect
- BUGFIX: Torrents are no longer starting from scratch when changing default save path (when torrent addition dialog is disabled)
- BUGFIX: Single instance code is now more reliable on Qt >= 4.4
- COSMETIC: Transfer speed, ratio, connection status and DHT nodes are displayed in status bar
- COSMETIC: RSS Tab is now hidden as a default
- COSMETIC: Allow to hide or display top toolbar
- COSMETIC: Top toolbar is now hidden as a default
- COSMETIC: Log is now in a separate dialog
* Sun Sept 14 2008 - Christophe Dumez <chris@qbittorrent.org> - v1.1.4
- FEATURE: DHT is no longer used as fallback only
- FEATURE: Ported WebUI to Mootools v1.2
- BUGFIX: Fixed 'start seeding after torrent creation' feature
- BUGFIX: Fixed compilation with boost v1.36
- BUGFIX: Some code optimization
- BUGFIX: Fixed memory leak in Web UI
- BUGFIX: Fixed problems with column sorting
- BUGFIX: Improved code for pausing torrents on startup
- BUGFIX: Torrent addition dialog is now disabled for downloads from WebUI
- BUGFIX: Give focus to input field in WebUI download dialog
* Tue Aug 26 2008 - Christophe Dumez <chris@qbittorrent.org> - v1.1.3
- BUGFIX: Fixed ratio saving for seeding torrents

18
TODO
View File

@@ -1,4 +1,18 @@
See https://blueprints.launchpad.net/qbittorrent/
// in v1.2.0
- Split download and uploads in Web UI (Ishan Ahora)
// translations done
- french
- chinese traditional
- chinese simplified
- finish
- swedish
- slovak
- German
- Hungarian
- Italian
- Dutch
- Romanian
- Korean
- Russian
- Bulgarian
- Greek

View File

@@ -37,7 +37,7 @@ FinishedTorrents::FinishedTorrents(QObject *parent, bittorrent *BTSession) : par
setupUi(this);
actionStart->setIcon(QIcon(QString::fromUtf8(":/Icons/skin/play.png")));
actionPause->setIcon(QIcon(QString::fromUtf8(":/Icons/skin/pause.png")));
connect(BTSession, SIGNAL(addedTorrent(QString, QTorrentHandle&, bool)), this, SLOT(torrentAdded(QString, QTorrentHandle&, bool)));
connect(BTSession, SIGNAL(addedTorrent(QTorrentHandle&)), this, SLOT(torrentAdded(QTorrentHandle&)));
finishedListModel = new QStandardItemModel(0,7);
finishedListModel->setHeaderData(F_NAME, Qt::Horizontal, tr("Name", "i.e: file name"));
finishedListModel->setHeaderData(F_SIZE, Qt::Horizontal, tr("Size", "i.e: file size"));
@@ -58,7 +58,7 @@ FinishedTorrents::FinishedTorrents(QObject *parent, bittorrent *BTSession) : par
// Make download list header clickable for sorting
finishedList->header()->setClickable(true);
finishedList->header()->setSortIndicatorShown(true);
connect(finishedList->header(), SIGNAL(sectionPressed(int)), this, SLOT(sortFinishedList(int)));
connect(finishedList->header(), SIGNAL(sectionPressed(int)), this, SLOT(toggleFinishedListSortOrder(int)));
finishedListDelegate = new FinishedListDelegate(finishedList);
finishedList->setItemDelegate(finishedListDelegate);
connect(finishedList, SIGNAL(customContextMenuRequested(const QPoint&)), this, SLOT(displayFinishedListMenu(const QPoint&)));
@@ -141,7 +141,7 @@ void FinishedTorrents::addTorrent(QString hash){
emit finishedTorrentsNumberChanged(nbFinished);
}
void FinishedTorrents::torrentAdded(QString, QTorrentHandle& h, bool) {
void FinishedTorrents::torrentAdded(QTorrentHandle& h) {
QString hash = h.hash();
if(BTSession->isFinished(hash)) {
addTorrent(hash);
@@ -190,10 +190,27 @@ bool FinishedTorrents::loadColWidthFinishedList(){
for(unsigned int i=0; i<listSize; ++i){
finishedList->header()->resizeSection(i, width_list.at(i).toInt());
}
loadLastSortedColumn();
qDebug("Finished list columns width loaded");
return true;
}
void FinishedTorrents::loadLastSortedColumn() {
// Loading last sorted column
QSettings settings(QString::fromUtf8("qBittorrent"), QString::fromUtf8("qBittorrent"));
QString sortedCol = settings.value(QString::fromUtf8("FinishedListSortedCol"), QString()).toString();
if(!sortedCol.isEmpty()) {
Qt::SortOrder sortOrder;
if(sortedCol.endsWith(QString::fromUtf8("d")))
sortOrder = Qt::DescendingOrder;
else
sortOrder = Qt::AscendingOrder;
sortedCol = sortedCol.left(sortedCol.size()-1);
int index = sortedCol.toInt();
sortFinishedList(index, sortOrder);
}
}
// Save columns width in a file to remember them
// (finished list)
void FinishedTorrents::saveColWidthFinishedList() const{
@@ -262,9 +279,6 @@ void FinishedTorrents::updateFinishedList(){
}
}
if(h.is_paused()) continue;
if(BTSession->getTorrentsToPauseAfterChecking().indexOf(hash) != -1) {
continue;
}
if(h.state() == torrent_status::downloading || (h.state() != torrent_status::checking_files && h.state() != torrent_status::queued_for_checking && h.progress() < 1.)) {
// What are you doing here? go back to download tab!
int reponse = QMessageBox::question(this, tr("Incomplete torrent in seeding list"), tr("It appears that the state of '%1' torrent changed from 'seeding' to 'downloading'. Would you like to move it back to download list? (otherwise the torrent will simply be deleted)").arg(h.name()), QMessageBox::Yes | QMessageBox::No);
@@ -276,11 +290,11 @@ void FinishedTorrents::updateFinishedList(){
}
else if (reponse == QMessageBox::No) {
qDebug("Deleted from the finished");
BTSession->deleteTorrent(hash, true);
BTSession->deleteTorrent(hash, false);
}
continue;
}
if(h.state() == torrent_status::checking_files){
if(h.state() == torrent_status::checking_files || h.state() == torrent_status::queued_for_checking){
finishedListModel->setData(finishedListModel->index(row, F_NAME), QVariant(QIcon(QString::fromUtf8(":/Icons/time.png"))), Qt::DecorationRole);
setRowColor(row, QString::fromUtf8("grey"));
continue;
@@ -577,17 +591,37 @@ QAction* FinishedTorrents::getActionHoSCol(int index) {
* Sorting functions
*/
void FinishedTorrents::sortFinishedList(int index){
static Qt::SortOrder sortOrder = Qt::AscendingOrder;
void FinishedTorrents::toggleFinishedListSortOrder(int index) {
Qt::SortOrder sortOrder = Qt::AscendingOrder;
if(finishedList->header()->sortIndicatorSection() == index){
if(sortOrder == Qt::AscendingOrder){
sortOrder = Qt::DescendingOrder;
}else{
sortOrder = Qt::AscendingOrder;
}
sortOrder = (Qt::SortOrder)!(bool)finishedList->header()->sortIndicatorOrder();
}
finishedList->header()->setSortIndicator(index, sortOrder);
switch(index){
switch(index) {
case F_SIZE:
case F_UPSPEED:
case F_PRIORITY:
sortFinishedListFloat(index, sortOrder);
break;
default:
sortFinishedListString(index, sortOrder);
}
QSettings settings(QString::fromUtf8("qBittorrent"), QString::fromUtf8("qBittorrent"));
QString sortOrderLetter;
if(sortOrder == Qt::AscendingOrder)
sortOrderLetter = QString::fromUtf8("a");
else
sortOrderLetter = QString::fromUtf8("d");
settings.setValue(QString::fromUtf8("FinishedListSortedCol"), misc::toQString(index)+sortOrderLetter);
}
void FinishedTorrents::sortFinishedList(int index, Qt::SortOrder sortOrder){
if(index == -1) {
index = finishedList->header()->sortIndicatorSection();
sortOrder = finishedList->header()->sortIndicatorOrder();
} else {
finishedList->header()->setSortIndicator(index, sortOrder);
}
switch(index) {
case F_SIZE:
case F_UPSPEED:
case F_PRIORITY:

View File

@@ -60,11 +60,12 @@ class FinishedTorrents : public QWidget, public Ui::seeding {
void displayFinishedHoSMenu(const QPoint&);
void setRowColor(int row, QString color);
void saveColWidthFinishedList() const;
void sortFinishedList(int index);
void toggleFinishedListSortOrder(int index);
void sortFinishedList(int index=-1, Qt::SortOrder sortOrder=Qt::AscendingOrder);
void sortFinishedListFloat(int index, Qt::SortOrder sortOrder);
void sortFinishedListString(int index, Qt::SortOrder sortOrder);
void updateFileSize(QString hash);
void torrentAdded(QString path, QTorrentHandle& h, bool fastResume);
void torrentAdded(QTorrentHandle& h);
void on_actionSet_upload_limit_triggered();
void notifyTorrentDoubleClicked(const QModelIndex& index);
void hideOrShowColumnName();
@@ -83,6 +84,7 @@ class FinishedTorrents : public QWidget, public Ui::seeding {
void deleteTorrent(QString hash);
void showPropertiesFromHash(QString hash);
void hidePriorityColumn(bool hide);
void loadLastSortedColumn();
signals:
void torrentMovedFromFinishedList(QString);

File diff suppressed because it is too large Load Diff

View File

@@ -24,7 +24,7 @@
#include <QProcess>
#include <QSystemTrayIcon>
#include <QPointer>
#include "ui_MainWindow.h"
#include "qtorrenthandle.h"
@@ -66,7 +66,7 @@ class GUI : public QMainWindow, private Ui::MainWindow{
QTabWidget *tabs;
options_imp *options;
QSystemTrayIcon *myTrayIcon;
QTimer *systrayCreator;
QPointer<QTimer> systrayCreator;
QMenu *myTrayIconMenu;
DownloadingTorrents *downloadingTorrentTab;
FinishedTorrents *finishedTorrentTab;
@@ -97,7 +97,7 @@ class GUI : public QMainWindow, private Ui::MainWindow{
// RSS
RSSImp *rssWidget;
// Web UI
HttpServer *httpServer;
QPointer<HttpServer> httpServer;
// Misc
#ifdef QT_4_4
QLocalServer *localServer;
@@ -116,6 +116,7 @@ class GUI : public QMainWindow, private Ui::MainWindow{
void on_actionCreate_torrent_triggered();
void on_actionWebsite_triggered() const;
void on_actionBugReport_triggered() const;
void on_actionShow_console_triggered();
void readParamsOnSocket();
void acceptConnection();
void togglePausedState(QString hash);
@@ -161,9 +162,7 @@ class GUI : public QMainWindow, private Ui::MainWindow{
void processDownloadedFiles(QString path, QString url);
void downloadFromURLList(const QStringList& urls);
void deleteTorrent(QString hash);
void deleteRatioTorrent(QString fileName);
void finishedTorrent(QTorrentHandle& h) const;
void torrentChecked(QString hash) const;
void updateLists();
bool initWebUi(QString username, QString password, int port);
void pauseTorrent(QString hash);
@@ -171,7 +170,7 @@ class GUI : public QMainWindow, private Ui::MainWindow{
void on_actionDecreasePriority_triggered();
// Options slots
void on_actionOptions_triggered();
void OptionsSaved(QString info, bool deleteOptions);
void OptionsSaved(bool deleteOptions);
// HTTP slots
void on_actionDownload_from_URL_triggered();

View File

@@ -1,6 +1,6 @@
[Desktop Entry]
Categories=Qt;Network;P2P
Comment=V1.2.0
Comment=V1.2.1
Exec=qbittorrent %f
GenericName=Bittorrent client
GenericName[bg]=Торент клиент

BIN
src/Icons/skin/tabs.gif Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.0 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 76 KiB

After

Width:  |  Height:  |  Size: 75 KiB

View File

@@ -58,6 +58,7 @@
<string>Options</string>
</property>
<addaction name="actionOptions" />
<addaction name="actionShow_console" />
</widget>
<widget class="QMenu" name="menu_File" >
<property name="title" >
@@ -255,6 +256,14 @@
<bool>false</bool>
</property>
</action>
<action name="actionShow_console" >
<property name="icon" >
<iconset resource="icons.qrc" >:/Icons/log.png</iconset>
</property>
<property name="text" >
<string>Console</string>
</property>
</action>
</widget>
<resources>
<include location="icons.qrc" />

View File

@@ -13,21 +13,6 @@
<string>Torrent addition dialog</string>
</property>
<layout class="QVBoxLayout" >
<property name="spacing" >
<number>6</number>
</property>
<property name="leftMargin" >
<number>9</number>
</property>
<property name="topMargin" >
<number>9</number>
</property>
<property name="rightMargin" >
<number>9</number>
</property>
<property name="bottomMargin" >
<number>9</number>
</property>
<item>
<widget class="QLabel" name="fileNameLbl" >
<property name="text" >
@@ -110,6 +95,50 @@
</property>
</widget>
</item>
<item>
<layout class="QHBoxLayout" >
<item>
<spacer>
<property name="orientation" >
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeHint" >
<size>
<width>40</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
<item>
<widget class="QPushButton" name="collapseAllButton" >
<property name="text" >
<string>Collapse all</string>
</property>
</widget>
</item>
<item>
<widget class="QPushButton" name="expandAllButton" >
<property name="text" >
<string>Expand all</string>
</property>
</widget>
</item>
<item>
<spacer>
<property name="orientation" >
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeHint" >
<size>
<width>40</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
</layout>
</item>
<item>
<widget class="QCheckBox" name="checkIncrementalDL" >
<property name="text" >

File diff suppressed because it is too large Load Diff

View File

@@ -26,6 +26,9 @@
#include <QPair>
#include <QStringList>
#include <QDateTime>
#include <QApplication>
#include <QPalette>
#include <QPointer>
#include <libtorrent/session.hpp>
#include <libtorrent/ip_filter.hpp>
@@ -38,24 +41,25 @@ class deleteThread;
class QTimer;
class FilterParserThread;
class bittorrent : public QObject{
class bittorrent : public QObject {
Q_OBJECT
private:
session *s;
QString scan_dir;
QTimer *timerScan;
QPointer<QTimer> timerScan;
QTimer *timerAlerts;
QTimer *fastResumeSaver;
QTimer *BigRatioTimer;
QPointer<QTimer> BigRatioTimer;
bool DHTEnabled;
downloadThread *downloader;
QString defaultSavePath;
QStringList torrentsToPauseAfterChecking;
QHash<QString, QDateTime> TorrentsStartTime;
QHash<QString, size_type> TorrentsStartData;
QHash<QString, QPair<size_type,size_type> > ratioData;
QHash<QString, QHash<QString, QString> > trackersErrors;
QStringList consoleMessages;
QStringList peerBanMessages;
deleteThread *deleter;
QStringList finishedTorrents;
QStringList unfinishedTorrents;
@@ -67,7 +71,7 @@ class bittorrent : public QObject{
bool UPnPEnabled;
bool NATPMPEnabled;
bool LSDEnabled;
FilterParserThread *filterParser;
QPointer<FilterParserThread> filterParser;
QString filterPath;
int folderScanInterval; // in seconds
bool queueingEnabled;
@@ -79,6 +83,7 @@ class bittorrent : public QObject{
QStringList *uploadQueue;
QStringList *queuedUploads;
bool calculateETA;
QStringList url_skippingDlg;
protected:
QString getSavePath(QString hash);
@@ -95,7 +100,6 @@ class bittorrent : public QObject{
float getPayloadUploadRate() const;
session_status getSessionStatus() const;
int getListenPort() const;
QStringList getTorrentsToPauseAfterChecking() const;
qlonglong getETA(QString hash) const;
float getRealRatio(QString hash) const;
session* getSession() const;
@@ -114,6 +118,9 @@ class bittorrent : public QObject{
bool isDownloadQueued(QString hash) const;
bool isUploadQueued(QString hash) const;
int loadTorrentPriority(QString hash);
QStringList getConsoleMessages() const;
QStringList getPeerBanMessages() const;
float getUncheckedTorrentProgress(QString hash) const;
public slots:
void addTorrent(QString path, bool fromScanDir = false, QString from_url = QString(), bool resumed = false);
@@ -148,6 +155,7 @@ class bittorrent : public QObject{
void increaseUpTorrentPriority(QString hash);
void decreaseUpTorrentPriority(QString hash);
void saveTorrentPriority(QString hash, int prio);
void downloadUrlAndSkipDialog(QString);
// Session configuration - Setters
void setListeningPortsRange(std::pair<unsigned short, unsigned short> ports);
void setMaxConnections(int maxConnec);
@@ -177,6 +185,9 @@ class bittorrent : public QObject{
void setMaxActiveDownloads(int val);
void setMaxActiveTorrents(int val);
void setETACalculation(bool enable);
void addConsoleMessage(QString msg, QColor color=QApplication::palette().color(QPalette::WindowText));
void addPeerBanMessage(QString msg, bool from_ipfilter);
void fixTorrentPriorities();
protected slots:
void scanDirectory();
@@ -187,33 +198,35 @@ class bittorrent : public QObject{
void deleteBigRatios();
signals:
void invalidTorrent(QString path);
void duplicateTorrent(QString path);
void addedTorrent(QString path, QTorrentHandle& h, bool fastResume);
//void invalidTorrent(QString path);
//void duplicateTorrent(QString path);
void addedTorrent(QTorrentHandle& h);
void deletedTorrent(QString hash);
void pausedTorrent(QString hash);
void resumedTorrent(QString hash);
void finishedTorrent(QTorrentHandle& h);
void fullDiskError(QTorrentHandle& h);
void trackerError(QString hash, QString time, QString msg);
void portListeningFailure();
//void portListeningFailure();
void trackerAuthenticationRequired(QTorrentHandle& h);
void scanDirFoundTorrents(const QStringList& pathList);
void newDownloadedTorrent(QString path, QString url);
void aboutToDownloadFromUrl(QString url);
//void aboutToDownloadFromUrl(QString url);
void updateFileSize(QString hash);
void peerBlocked(QString);
//void peerBlocked(QString);
void downloadFromUrlFailure(QString url, QString reason);
void fastResumeDataRejected(QString name);
void urlSeedProblem(QString url, QString msg);
//void fastResumeDataRejected(QString name);
//void urlSeedProblem(QString url, QString msg);
void torrentFinishedChecking(QString hash);
void torrent_ratio_deleted(QString fileName);
void UPnPError(QString msg);
void UPnPSuccess(QString msg);
//void torrent_ratio_deleted(QString fileName);
//void UPnPError(QString msg);
//void UPnPSuccess(QString msg);
void updateFinishedTorrentNumber();
void updateUnfinishedTorrentNumber();
void forceUnfinishedListUpdate();
void forceFinishedListUpdate();
/*void torrentSwitchedtoFinished(QString hash);
void torrentSwitchedtoUnfinished(QString hash);*/
};
#endif

58
src/console.ui Normal file
View File

@@ -0,0 +1,58 @@
<ui version="4.0" >
<class>ConsoleDlg</class>
<widget class="QDialog" name="ConsoleDlg" >
<property name="geometry" >
<rect>
<x>0</x>
<y>0</y>
<width>512</width>
<height>497</height>
</rect>
</property>
<property name="windowTitle" >
<string>qBittorrent console</string>
</property>
<property name="windowIcon" >
<iconset resource="icons.qrc" >:/Icons/log.png</iconset>
</property>
<layout class="QVBoxLayout" >
<item>
<widget class="QTabWidget" name="tabConsole" >
<property name="currentIndex" >
<number>0</number>
</property>
<widget class="QWidget" name="tab" >
<attribute name="title" >
<string>General</string>
</attribute>
<attribute name="icon" >
<iconset resource="icons.qrc" >:/Icons/log.png</iconset>
</attribute>
<layout class="QVBoxLayout" >
<item>
<widget class="QTextBrowser" name="textConsole" />
</item>
</layout>
</widget>
<widget class="QWidget" name="tab_2" >
<attribute name="title" >
<string>Blocked IPs</string>
</attribute>
<attribute name="icon" >
<iconset resource="icons.qrc" >:/Icons/filter.png</iconset>
</attribute>
<layout class="QVBoxLayout" >
<item>
<widget class="QTextBrowser" name="textBannedPeers" />
</item>
</layout>
</widget>
</widget>
</item>
</layout>
</widget>
<resources>
<include location="icons.qrc" />
</resources>
<connections/>
</ui>

50
src/console_imp.h Normal file
View File

@@ -0,0 +1,50 @@
/*
* Bittorrent Client using Qt4 and libtorrent.
* Copyright (C) 2006 Christophe Dumez
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*
* Contact : chris@qbittorrent.org
*/
#ifndef CONSOLE_H
#define CONSOLE_H
#include "bittorrent.h"
#include "ui_console.h"
using namespace libtorrent;
class consoleDlg : public QDialog, private Ui_ConsoleDlg{
Q_OBJECT
private:
bittorrent *BTSession;
public:
consoleDlg(QWidget *parent, bittorrent* _BTSession) : QDialog(parent) {
setupUi(this);
setAttribute(Qt::WA_DeleteOnClose);
BTSession = _BTSession;
textConsole->setHtml(BTSession->getConsoleMessages().join("<br>"));
textBannedPeers->setHtml(BTSession->getPeerBanMessages().join("<br>"));
show();
}
~consoleDlg() {}
};
#endif

View File

@@ -45,7 +45,7 @@ createtorrent::createtorrent(QWidget *parent): QDialog(parent){
setupUi(this);
setAttribute(Qt::WA_DeleteOnClose);
creatorThread = new torrentCreatorThread();
connect(creatorThread, SIGNAL(creationSuccess(QString)), this, SLOT(handleCreationSucess(QString)));
connect(creatorThread, SIGNAL(creationSuccess(QString, const char*, QString)), this, SLOT(handleCreationSuccess(QString, const char*, QString)));
connect(creatorThread, SIGNAL(creationFailure(QString)), this, SLOT(handleCreationFailure(QString)));
connect(creatorThread, SIGNAL(updateProgress(int)), this, SLOT(updateProgressBar(int)));
show();
@@ -129,12 +129,23 @@ void createtorrent::on_addURLSeed_button_clicked(){
// Subfunction to add files to a torrent_info structure
// Written by Arvid Norberg (libtorrent Author)
void add_files(torrent_info& t, path const& p, path const& l){
qDebug("p: %s, l: %s, l.leaf(): %s", p.string().c_str(), l.string().c_str(), l.leaf().c_str());
using boost::filesystem::path;
using boost::filesystem::directory_iterator;
#if BOOST_VERSION < 103600
std::string const& leaf = l.leaf();
#else
std::string const& leaf = l.filename();
#endif
if (leaf == ".." || leaf == ".") return;
path f(p / l);
if (is_directory(f)){
if (is_directory(f)) {
for (directory_iterator i(f), end; i != end; ++i)
#if BOOST_VERSION < 103600
add_files(t, p, l / i->leaf());
}else{
#else
add_files(t, p, l / i->filename());
#endif
} else {
qDebug("Adding %s", l.string().c_str());
t.add_file(l, file_size(f));
}
@@ -221,7 +232,11 @@ void torrentCreatorThread::run() {
ofstream out(complete(path((const char*)save_path.toUtf8())), std::ios_base::binary);
// Adding files to the torrent
path full_path = complete(path(input_path.toUtf8().data()));
#if BOOST_VERSION < 103600
add_files(*t, full_path.branch_path(), full_path.leaf());
#else
add_files(*t, full_path.branch_path(), full_path.filename());
#endif
if(abort) return;
// Set piece size
t->set_piece_size(piece_size);

View File

@@ -35,28 +35,31 @@ class subDeleteThread : public QThread {
private:
QString save_path;
arborescence *arb;
bool abort;
public:
subDeleteThread(QObject *parent, QString saveDir, arborescence *arb) : QThread(parent), save_path(saveDir), arb(arb), abort(false){}
subDeleteThread(QObject *parent, QString saveDir, arborescence *_arb) : QThread(parent), save_path(saveDir) {
arb = _arb;
}
~subDeleteThread(){
abort = true;
wait();
qDebug("subDeleteThread successfuly deleted");
}
signals:
// For subthreads
void deletionSuccessST(subDeleteThread* st);
void deletionFailureST(subDeleteThread* st);
//void deletionFailureST(subDeleteThread* st);
protected:
void run(){
if(arb->removeFromFS(save_path))
/*if(arb->removeFromFS(save_path))
emit deletionSuccessST(this);
else
emit deletionFailureST(this);
emit deletionFailureST(this);*/
arb->removeFromFS(save_path);
delete arb;
emit deletionSuccessST(this);
}
};
@@ -99,13 +102,13 @@ class deleteThread : public QThread {
if(abort)
return;
mutex.lock();
if(torrents_list.size() != 0){
if(!torrents_list.empty()){
QPair<QString, arborescence *> torrent = torrents_list.takeFirst();
mutex.unlock();
subDeleteThread *st = new subDeleteThread(0, torrent.first, torrent.second);
subThreads << st;
connect(st, SIGNAL(deletionSuccessST(subDeleteThread*)), this, SLOT(deleteSubThread(subDeleteThread*)));
connect(st, SIGNAL(deletionFailureST(subDeleteThread*)), this, SLOT(deleteSubThread(subDeleteThread*)));
//connect(st, SIGNAL(deletionFailureST(subDeleteThread*)), this, SLOT(deleteSubThread(subDeleteThread*)));
st->start();
}else{
condition.wait(&mutex);

View File

@@ -57,95 +57,6 @@
</item>
</layout>
</item>
<item>
<widget class="QTabWidget" name="tabBottom" >
<property name="maximumSize" >
<size>
<width>16777215</width>
<height>142</height>
</size>
</property>
<property name="tabPosition" >
<enum>QTabWidget::West</enum>
</property>
<property name="currentIndex" >
<number>0</number>
</property>
<widget class="QWidget" name="log_tab" >
<attribute name="title" >
<string>Log</string>
</attribute>
<layout class="QVBoxLayout" >
<property name="spacing" >
<number>6</number>
</property>
<property name="leftMargin" >
<number>9</number>
</property>
<property name="topMargin" >
<number>9</number>
</property>
<property name="rightMargin" >
<number>9</number>
</property>
<property name="bottomMargin" >
<number>9</number>
</property>
<item>
<widget class="QTextBrowser" name="infoBar" >
<property name="sizePolicy" >
<sizepolicy vsizetype="Expanding" hsizetype="Expanding" >
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
</property>
<property name="maximumSize" >
<size>
<width>16777215</width>
<height>120</height>
</size>
</property>
<property name="contextMenuPolicy" >
<enum>Qt::CustomContextMenu</enum>
</property>
</widget>
</item>
</layout>
</widget>
<widget class="QWidget" name="filter_tab" >
<attribute name="title" >
<string>IP filter</string>
</attribute>
<layout class="QVBoxLayout" >
<property name="spacing" >
<number>6</number>
</property>
<property name="leftMargin" >
<number>9</number>
</property>
<property name="topMargin" >
<number>9</number>
</property>
<property name="rightMargin" >
<number>9</number>
</property>
<property name="bottomMargin" >
<number>9</number>
</property>
<item>
<widget class="QTextBrowser" name="textBlockedUsers" >
<property name="maximumSize" >
<size>
<width>16777215</width>
<height>123</height>
</size>
</property>
</widget>
</item>
</layout>
</widget>
</widget>
</item>
</layout>
<action name="actionStart" >
<property name="text" >
@@ -162,11 +73,6 @@
<string>Delete</string>
</property>
</action>
<action name="actionClearLog" >
<property name="text" >
<string>Clear</string>
</property>
</action>
<action name="actionPreview_file" >
<property name="text" >
<string>Preview file</string>

View File

@@ -91,11 +91,11 @@ void subDownloadThread::run(){
curl_easy_setopt(curl, CURLOPT_SSL_VERIFYHOST, 0);
// PROXY SUPPORT
QSettings settings("qBittorrent", "qBittorrent");
int intValue = settings.value(QString::fromUtf8("Preferences/Connection/ProxyType"), 0).toInt();
int intValue = settings.value(QString::fromUtf8("Preferences/Connection/HTTPProxyType"), 0).toInt();
if(intValue > 0) {
// Proxy enabled
QString IP = settings.value(QString::fromUtf8("Preferences/Connection/Proxy/IP"), "0.0.0.0").toString();
QString port = settings.value(QString::fromUtf8("Preferences/Connection/Proxy/Port"), 8080).toString();
QString IP = settings.value(QString::fromUtf8("Preferences/Connection/HTTPProxy/IP"), "0.0.0.0").toString();
QString port = settings.value(QString::fromUtf8("Preferences/Connection/HTTPProxy/Port"), 8080).toString();
qDebug("Using proxy: %s", (IP+QString(":")+port).toUtf8().data());
curl_easy_setopt(curl, CURLOPT_PROXYPORT, (IP+QString(":")+port).toUtf8().data());
// Default proxy type is HTTP, we must change if it is SOCKS5
@@ -106,8 +106,8 @@ void subDownloadThread::run(){
// Authentication?
if(intValue > 2) {
qDebug("Proxy requires authentication, authenticating");
QString username = settings.value(QString::fromUtf8("Preferences/Connection/Proxy/Username"), QString()).toString();
QString password = settings.value(QString::fromUtf8("Preferences/Connection/Proxy/Password"), QString()).toString();
QString username = settings.value(QString::fromUtf8("Preferences/Connection/HTTPProxy/Username"), QString()).toString();
QString password = settings.value(QString::fromUtf8("Preferences/Connection/HTTPProxy/Password"), QString()).toString();
curl_easy_setopt(curl, CURLOPT_PROXYUSERPWD, (username+QString(":")+password).toUtf8().data());
}
}

File diff suppressed because it is too large Load Diff

View File

@@ -38,9 +38,7 @@ class DownloadingTorrents : public QWidget, public Ui::downloading{
bittorrent *BTSession;
DLListDelegate *DLDelegate;
QStandardItemModel *DLListModel;
bool delayedSorting;
unsigned int nbTorrents;
Qt::SortOrder delayedSortingOrder;
void hideOrShowColumn(int index);
bool loadHiddenColumns();
void saveHiddenColumns();
@@ -63,27 +61,19 @@ class DownloadingTorrents : public QWidget, public Ui::downloading{
void torrentFinished(QString hash);
protected slots:
void addLogPeerBlocked(QString);
void addFastResumeRejectedAlert(QString);
void addUrlSeedError(QString url, QString msg);
void on_actionSet_download_limit_triggered();
void notifyTorrentDoubleClicked(const QModelIndex& index);
void on_actionSet_upload_limit_triggered();
void displayDLListMenu(const QPoint& pos);
void displayDLHoSMenu(const QPoint&);
void on_actionClearLog_triggered();
void displayInfoBarMenu(const QPoint& pos);
void addTorrent(QString hash);
void sortDownloadList(int index, Qt::SortOrder startSortOrder=Qt::AscendingOrder, bool fromLoadColWidth=false);
void sortDownloadList(int index=-1, Qt::SortOrder startSortOrder=Qt::AscendingOrder);
void toggleDownloadListSortOrder(int index);
void sortDownloadListFloat(int index, Qt::SortOrder sortOrder);
void sortDownloadListString(int index, Qt::SortOrder sortOrder);
void saveColWidthDLList() const;
void torrentAdded(QString path, QTorrentHandle& h, bool fastResume);
void torrentDuplicate(QString path);
void torrentCorrupted(QString path);
void portListeningFailure();
void torrentAdded(QTorrentHandle& h);
void setRowColor(int row, QColor color);
void displayDownloadingUrlInfos(QString url);
void showProperties(const QModelIndex &index);
void hideOrShowColumnName();
void hideOrShowColumnSize();
@@ -94,21 +84,18 @@ class DownloadingTorrents : public QWidget, public Ui::downloading{
void hideOrShowColumnRatio();
void hideOrShowColumnEta();
void hideOrShowColumnPriority();
void displayUPnPError(QString msg);
void displayUPnPSuccess(QString msg);
public slots:
void updateDlList();
void setInfoBar(QString info, QColor color=QApplication::palette().color(QPalette::WindowText));
void pauseTorrent(QString hash);
void resumeTorrent(QString hash);
void deleteTorrent(QString hash);
void setBottomTabEnabled(unsigned int index, bool b);
void propertiesSelection();
void sortProgressColumnDelayed();
void updateFileSizeAndProgress(QString hash);
void showPropertiesFromHash(QString hash);
void hidePriorityColumn(bool hide);
void sortProgressColumn(QString hash);
void loadLastSortedColumn();
};

View File

@@ -1,6 +1,6 @@
/*
* Copyright (C) 2007 by Ishan Arora
* ishanarora@gmail.com
* Copyright (C) 2007 by Ishan Arora & Christophe Dumez
* <ishan@qbittorrent.org>, <chris@qbittorrent.org>
*
* 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
@@ -27,163 +27,118 @@
EventManager::EventManager(QObject *parent, bittorrent *BTSession)
: QObject(parent), BTSession(BTSession)
{
revision = 0;
}
void EventManager::update(QVariantMap event)
{
revision++;
events << QPair<ulong, QVariantMap>(revision, event);
emit updated();
qDebug("Added the following event");
qDebug() << event;
/* QLinkedList<QPair<ulong, QVariantMap> >::iterator i;
for (i = events.begin(); i != events.end(); i++)
qDebug() << *i;*/
}
QVariant EventManager::querySince(ulong r) const
{
QVariant EventManager::getEventList() const {
QVariantList list;
QLinkedListIterator<QPair<ulong, QVariantMap> > i(events);
i.toBack();
while (i.hasPrevious())
{
QPair<ulong, QVariantMap> pair = i.previous();
if (pair.first <= r)
break;
list.prepend(QVariant(pair.second));
foreach(QVariantMap event, event_list.values()) {
list << QVariant(event);
}
QVariantMap map;
map["events"] = QVariant(list);
map["revision"] = QVariant((qulonglong) revision);
return QVariant(map);
return QVariant(list);
}
bool EventManager::isUpdated(ulong r) const
{
return (r < revision);
}
void EventManager::addedTorrent(QString, QTorrentHandle& h)
void EventManager::addedTorrent(QTorrentHandle& h)
{
QVariantMap event;
event["type"] = QVariant("add");
event["hash"] = QVariant(h.hash());
QString hash = h.hash();
event["hash"] = QVariant(hash);
event["name"] = QVariant(h.name());
update(event);
event["seed"] = QVariant(h.is_seed());
event["size"] = QVariant((qlonglong)h.actual_size());
if(!h.is_seed()) {
event["progress"] = QVariant(h.progress());
event["dlspeed"] = QVariant(h.download_payload_rate());
}
event["upspeed"] = QVariant(h.upload_payload_rate());
if(h.is_paused()) {
if(BTSession->isQueueingEnabled() && (BTSession->isDownloadQueued(hash) || BTSession->isUploadQueued(hash)))
event["state"] = QVariant("queued");
else
event["state"] = QVariant("paused");
} else {
switch(h.state())
{
case torrent_status::finished:
case torrent_status::seeding:
event["state"] = QVariant("seeding");
break;
case torrent_status::checking_files:
case torrent_status::queued_for_checking:
event["state"] = QVariant("checking");
break;
case torrent_status::connecting_to_tracker:
if(h.download_payload_rate() > 0)
event["state"] = QVariant("downloading");
else
event["state"] = QVariant("connecting");
break;
case torrent_status::downloading:
case torrent_status::downloading_metadata:
if(h.download_payload_rate() > 0)
event["state"] = QVariant("downloading");
else
event["state"] = QVariant("stalled");
break;
default:
qDebug("No status, should not happen!!! status is %d", h.state());
event["state"] = QVariant();
}
}
event_list[hash] = event;
}
void EventManager::deletedTorrent(QString hash)
{
QVariantMap event;
event["type"] = QVariant("delete");
event["hash"] = QVariant(hash);
QLinkedList<QPair<ulong, QVariantMap> >::iterator i = events.end();
bool loop = true;
while (loop && i != events.begin()) {
--i;
QVariantMap oldevent = i->second;
if(oldevent["hash"] == QVariant(hash))
{
if(oldevent["type"] == QVariant("add"))
loop = false;
i = events.erase(i);
}
}
update(event);
event_list.remove(hash);
}
void EventManager::modifiedTorrent(QTorrentHandle h)
{
QString hash = h.hash();
QVariantMap event;
QVariant v;
if(h.is_paused()) {
if(BTSession->isDownloadQueued(hash) || BTSession->isUploadQueued(hash))
v = QVariant("queued");
if(BTSession->isQueueingEnabled() && (BTSession->isDownloadQueued(hash) || BTSession->isUploadQueued(hash)))
event["state"] = QVariant("queued");
else
v = QVariant("paused");
event["state"] = QVariant("paused");
} else {
switch(h.state())
{
case torrent_status::finished:
case torrent_status::seeding:
v = QVariant("seeding");
event["state"] = QVariant("seeding");
break;
case torrent_status::checking_files:
case torrent_status::queued_for_checking:
v = QVariant("checking");
event["state"] = QVariant("checking");
break;
case torrent_status::connecting_to_tracker:
if(h.download_payload_rate() > 0)
v = QVariant("downloading");
event["state"] = QVariant("downloading");
else
v = QVariant("connecting");
event["state"] = QVariant("connecting");
break;
case torrent_status::downloading:
case torrent_status::downloading_metadata:
if(h.download_payload_rate() > 0)
v = QVariant("downloading");
event["state"] = QVariant("downloading");
else
v = QVariant("stalled");
event["state"] = QVariant("stalled");
break;
default:
v = QVariant();
qDebug("No status, should not happen!!! status is %d", h.state());
event["state"] = QVariant();
}
}
if(modify(hash, "state", v))
event["state"] = v;
v = QVariant((qlonglong)h.actual_size());
if(modify(hash, "size", v))
event["size"] = v;
v = QVariant(h.progress());
if(modify(hash, "progress", v))
event["progress"] = v;
v = QVariant(h.download_payload_rate());
if(modify(hash, "dlspeed", v))
event["dlspeed"] = v;
v = QVariant(h.upload_payload_rate());
if(modify(hash, "upspeed", v))
event["upspeed"] = v;
if(event.size() > 0)
{
event["type"] = QVariant("modify");
event["hash"] = QVariant(hash);
update(event);
event["name"] = QVariant(h.name());
event["size"] = QVariant((qlonglong)h.actual_size());
if(!h.is_seed()) {
event["progress"] = QVariant(h.progress());
event["dlspeed"] = QVariant(h.download_payload_rate());
}
}
bool EventManager::modify(QString hash, QString key, QVariant value)
{
QLinkedList<QPair<ulong, QVariantMap> >::iterator i = events.end();
while (i != events.begin()) {
--i;
QVariantMap event = i->second;
if(event["hash"] == QVariant(hash))
{
if(event["type"] == QVariant("add"))
return true;
if(event.contains(key))
{
if(event[key] == value)
return false;
else
{
if(event.size() <= 3)
i = events.erase(i);
else
i->second.remove(key);
return true;
}
}
}
}
return true;
event["upspeed"] = QVariant(h.upload_payload_rate());
event["seed"] = QVariant(h.is_seed());
event["hash"] = QVariant(hash);
event_list[hash] = event;
}

View File

@@ -1,6 +1,6 @@
/*
* Copyright (C) 2007 by Ishan Arora
* ishanarora@gmail.com
* Copyright (C) 2007 by Ishan Arora & Christophe Dumez
* <ishan@qbittorrent.org>, <chris@qbittorrent.org>
*
* 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
@@ -23,8 +23,7 @@
#define EVENTMANAGER_H
#include "qtorrenthandle.h"
#include <QLinkedList>
#include <QPair>
#include <QHash>
#include <QVariant>
struct bittorrent;
@@ -33,9 +32,7 @@ class EventManager : public QObject
{
Q_OBJECT
private:
ulong revision;
QLinkedList<QPair <ulong, QVariantMap> > events;
bool modify(QString hash, QString key, QVariant value);
QHash<QString, QVariantMap> event_list;
bittorrent* BTSession;
protected:
@@ -43,14 +40,10 @@ class EventManager : public QObject
public:
EventManager(QObject *parent, bittorrent* BTSession);
QVariant querySince(ulong r) const;
bool isUpdated(ulong r) const;
signals:
void updated();
QVariant getEventList() const;
public slots:
void addedTorrent(QString path, QTorrentHandle& h);
void addedTorrent(QTorrentHandle& h);
void deletedTorrent(QString hash);
void modifiedTorrent(QTorrentHandle h);
};

View File

@@ -42,14 +42,24 @@ HttpConnection::HttpConnection(QTcpSocket *socket, HttpServer *parent)
HttpConnection::~HttpConnection()
{
delete socket;
}
void HttpConnection::processDownloadedFile(QString url, QString file_path) {
qDebug("URL %s successfully downloaded !", (const char*)url.toUtf8());
emit torrentReadyToBeDownloaded(file_path, false, url, false);
}
void HttpConnection::handleDownloadFailure(QString url, QString reason) {
std::cerr << "Could not download " << (const char*)url.toUtf8() << ", reason: " << (const char*)reason.toUtf8() << "\n";
}
void HttpConnection::read()
{
QByteArray input = socket->readAll();
qDebug(" -------");
/*qDebug(" -------");
qDebug("|REQUEST|");
qDebug(" -------");
qDebug(" -------"); */
//qDebug("%s", input.toAscii().constData());
if(input.size() > 100000) {
qDebug("Request too big");
@@ -81,7 +91,7 @@ void HttpConnection::write()
void HttpConnection::respond()
{
qDebug("Respond called");
//qDebug("Respond called");
QStringList auth = parser.value("Authorization").split(" ", QString::SkipEmptyParts);
if (auth.size() != 2 || QString::compare(auth[0], "Basic", Qt::CaseInsensitive) != 0 || !parent->isAuthorized(auth[1].toUtf8()))
{
@@ -105,12 +115,7 @@ void HttpConnection::respond()
{
if (list[1] == "events")
{
EventManager* manager = parent->eventManager();
uint r = parser.get("r").toUInt();
if(manager->isUpdated(r))
respondJson();
else
connect(manager, SIGNAL(updated()), this, SLOT(respondJson()));
respondJson();
return;
}
}
@@ -156,9 +161,7 @@ void HttpConnection::respondNotFound()
void HttpConnection::respondJson()
{
EventManager* manager = parent->eventManager();
QString temp = parser.get("r");
uint r = parser.get("r").toUInt();
QVariant data = manager->querySince(r);
QVariant data = manager->getEventList();
QString string = toJson(data);
generator.setStatusLine(200, "OK");
generator.setContentTypeByExt("js");
@@ -172,16 +175,13 @@ void HttpConnection::respondCommand(QString command)
{
QString urls = parser.post("urls");
QStringList list = urls.split('\n');
QStringList url_list_cleaned;
foreach(QString url, list){
url = url.trimmed();
if(!url.isEmpty()){
if(url_list_cleaned.indexOf(QRegExp(url, Qt::CaseInsensitive, QRegExp::FixedString)) < 0){
url_list_cleaned << url;
}
qDebug("Downloading url: %s", (const char*)url.toUtf8());
emit UrlReadyToBeDownloaded(url);
}
}
emit urlsReadyToBeDownloaded(url_list_cleaned);
return;
}
if(command == "upload")

View File

@@ -27,7 +27,6 @@
#include <QObject>
class QTcpSocket;
class HttpServer;
class HttpConnection : public QObject
@@ -47,6 +46,8 @@ class HttpConnection : public QObject
void respondJson();
void respondCommand(QString command);
void respondNotFound();
void processDownloadedFile(QString, QString);
void handleDownloadFailure(QString, QString);
public:
HttpConnection(QTcpSocket *socket, HttpServer *parent);
@@ -56,7 +57,7 @@ class HttpConnection : public QObject
void read();
signals:
void urlsReadyToBeDownloaded(const QStringList&);
void UrlReadyToBeDownloaded(QString url);
void torrentReadyToBeDownloaded(QString, bool, QString, bool);
void deleteTorrent(QString hash);
void resumeTorrent(QString hash);

View File

@@ -20,7 +20,6 @@
#include "httpresponsegenerator.h"
#include <QDebug>
void HttpResponseGenerator::setMessage(const QByteArray message)
{

View File

@@ -32,25 +32,28 @@ HttpServer::HttpServer(bittorrent *BTSession, int msec, QObject* parent) : QTcpS
HttpServer::BTSession = BTSession;
manager = new EventManager(this, BTSession);
//add torrents
QStringList list = BTSession->getUnfinishedTorrents() + BTSession->getFinishedTorrents();
QString hash;
foreach(hash, list)
{
QStringList list = BTSession->getUnfinishedTorrents();
foreach(QString hash, list) {
QTorrentHandle h = BTSession->getTorrentHandle(hash);
if(h.is_valid())
manager->addedTorrent(QString(), h);
if(h.is_valid()) manager->addedTorrent(h);
}
list = BTSession->getFinishedTorrents();
foreach(QString hash, list) {
QTorrentHandle h = BTSession->getTorrentHandle(hash);
if(h.is_valid()) manager->addedTorrent(h);
}
//connect BTSession to manager
connect(BTSession, SIGNAL(addedTorrent(QString, QTorrentHandle&, bool)), manager, SLOT(addedTorrent(QString, QTorrentHandle&)));
connect(BTSession, SIGNAL(addedTorrent(QTorrentHandle&)), manager, SLOT(addedTorrent(QTorrentHandle&)));
connect(BTSession, SIGNAL(deletedTorrent(QString)), manager, SLOT(deletedTorrent(QString)));
//set timer
QTimer *timer = new QTimer(this);
timer = new QTimer(this);
connect(timer, SIGNAL(timeout()), this, SLOT(onTimer()));
timer->start(msec);
}
HttpServer::~HttpServer()
{
delete timer;
delete manager;
}
@@ -61,7 +64,7 @@ void HttpServer::newHttpConnection()
{
HttpConnection *connection = new HttpConnection(socket, this);
//connect connection to BTSession
connect(connection, SIGNAL(urlsReadyToBeDownloaded(const QStringList&)), BTSession, SLOT(downloadFromURLList(const QStringList&)));
connect(connection, SIGNAL(UrlReadyToBeDownloaded(QString)), BTSession, SLOT(downloadUrlAndSkipDialog(QString)));
connect(connection, SIGNAL(torrentReadyToBeDownloaded(QString, bool, QString, bool)), BTSession, SLOT(addTorrent(QString, bool, QString, bool)));
connect(connection, SIGNAL(deleteTorrent(QString)), BTSession, SLOT(deleteTorrent(QString)));
connect(connection, SIGNAL(pauseTorrent(QString)), BTSession, SLOT(pauseTorrent(QString)));
@@ -73,13 +76,18 @@ void HttpServer::newHttpConnection()
void HttpServer::onTimer()
{
QStringList list = BTSession->getUnfinishedTorrents() + BTSession->getFinishedTorrents();
foreach(QString hash, list)
{
qDebug("EventManager Timer Start");
QStringList list = BTSession->getUnfinishedTorrents();
foreach(QString hash, list) {
QTorrentHandle h = BTSession->getTorrentHandle(hash);
if(h.is_valid())
manager->modifiedTorrent(h);
if(h.is_valid()) manager->modifiedTorrent(h);
}
list = BTSession->getFinishedTorrents();
foreach(QString hash, list) {
QTorrentHandle h = BTSession->getTorrentHandle(hash);
if(h.is_valid()) manager->modifiedTorrent(h);
}
qDebug("EventManager Timer Stop");
}
void HttpServer::setAuthorization(QString username, QString password)

View File

@@ -26,7 +26,7 @@
#include <QByteArray>
class bittorrent;
class QTimer;
class EventManager;
class HttpServer : public QTcpServer
@@ -37,6 +37,7 @@ class HttpServer : public QTcpServer
QByteArray base64;
bittorrent *BTSession;
EventManager *manager;
QTimer *timer;
public:
HttpServer(bittorrent *BTSession, int msec, QObject* parent = 0);

View File

@@ -102,6 +102,7 @@
<file>Icons/skin/seeding.png</file>
<file>Icons/skin/settings.png</file>
<file>Icons/skin/stalled.png</file>
<file>Icons/skin/tabs.gif</file>
<file>Icons/skin/url.png</file>
</qresource>
</RCC>

Binary file not shown.

File diff suppressed because it is too large Load Diff

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