1
mirror of https://github.com/qbittorrent/qBittorrent synced 2025-10-09 18:32:15 +02:00

Compare commits

..

1 Commits

Author SHA1 Message Date
Christophe Dumez
a175812555 - Tagged v1.1.4 and v1.2.0beta6 releases 2008-09-14 10:30:27 +00:00
84 changed files with 5381 additions and 7210 deletions

View File

@@ -2,11 +2,6 @@
- FEATURE: Torrent queueing system (with priorities)
- 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 dialog
- 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
- COSMETIC: Transfer speed, ratio, connection status and DHT nodes are displayed in status bar

View File

@@ -280,7 +280,7 @@ void FinishedTorrents::updateFinishedList(){
}
}
if(h.is_paused()) continue;
if(h.state() == torrent_status::downloading || (h.state() != torrent_status::checking_files && h.state() != torrent_status::queued_for_checking && !h.is_seed())) {
if(h.state() == torrent_status::downloading || (h.state() != torrent_status::checking_files && h.state() != torrent_status::queued_for_checking && h.is_seed())) {
// 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);
if (reponse == QMessageBox::Yes) {

View File

@@ -974,12 +974,15 @@ void GUI::configureSession(bool deleteOptions) {
proxySettings.username = options->getProxyUsername().toStdString();
proxySettings.password = options->getProxyPassword().toStdString();
}
QString proxy_str;
switch(options->getProxyType()) {
case HTTP:
proxySettings.type = proxy_settings::http;
proxy_str = misc::toQString("http://")+options->getProxyIp()+":"+misc::toQString(proxySettings.port);
break;
case HTTP_PW:
proxySettings.type = proxy_settings::http_pw;
proxy_str = misc::toQString("http://")+options->getProxyUsername()+":"+options->getProxyPassword()+"@"+options->getProxyIp()+":"+misc::toQString(proxySettings.port);
break;
case SOCKS5:
proxySettings.type = proxy_settings::socks5;
@@ -988,14 +991,6 @@ void GUI::configureSession(bool deleteOptions) {
proxySettings.type = proxy_settings::socks5_pw;
break;
}
QString proxy_str;
switch(options->getHTTPProxyType()) {
case HTTP_PW:
proxy_str = misc::toQString("http://")+options->getProxyUsername()+":"+options->getProxyPassword()+"@"+options->getProxyIp()+":"+misc::toQString(proxySettings.port);
break;
default:
proxy_str = misc::toQString("http://")+options->getProxyIp()+":"+misc::toQString(proxySettings.port);
}
if(!proxy_str.isEmpty()) {
// We need this for urllib in search engine plugins
#ifdef Q_WS_WIN
@@ -1514,7 +1509,7 @@ void GUI::createTrayIcon() {
// Display Program Options
void GUI::on_actionOptions_triggered() {
options = new options_imp(this);
connect(options, SIGNAL(status_changed(bool)), this, SLOT(OptionsSaved(bool)));
connect(options, SIGNAL(status_changed(QString, bool)), this, SLOT(OptionsSaved(QString, bool)));
options->show();
}

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.0 KiB

View File

@@ -13,6 +13,21 @@
<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" >
@@ -95,50 +110,6 @@
</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" >

View File

@@ -721,7 +721,6 @@ void bittorrent::setUnfinishedTorrent(QString hash) {
updateDownloadQueue();
}
}
//emit torrentSwitchedtoUnfinished(hash);
}
// Add the given hash to the list of finished torrents
@@ -759,7 +758,6 @@ void bittorrent::setFinishedTorrent(QString hash) {
}
// Save fast resume data
saveFastResumeAndRatioData(hash);
//emit torrentSwitchedtoFinished(hash);
}
// Pause a running torrent

View File

@@ -224,8 +224,6 @@ class bittorrent : public QObject {
void updateUnfinishedTorrentNumber();
void forceUnfinishedListUpdate();
void forceFinishedListUpdate();
/*void torrentSwitchedtoFinished(QString hash);
void torrentSwitchedtoUnfinished(QString hash);*/
};
#endif

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/HTTPProxyType"), 0).toInt();
int intValue = settings.value(QString::fromUtf8("Preferences/Connection/ProxyType"), 0).toInt();
if(intValue > 0) {
// Proxy enabled
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();
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();
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/HTTPProxy/Username"), QString()).toString();
QString password = settings.value(QString::fromUtf8("Preferences/Connection/HTTPProxy/Password"), QString()).toString();
QString username = settings.value(QString::fromUtf8("Preferences/Connection/Proxy/Username"), QString()).toString();
QString password = settings.value(QString::fromUtf8("Preferences/Connection/Proxy/Password"), QString()).toString();
curl_easy_setopt(curl, CURLOPT_PROXYUSERPWD, (username+QString(":")+password).toUtf8().data());
}
}

View File

@@ -1,6 +1,6 @@
/*
* Copyright (C) 2007 by Ishan Arora & Christophe Dumez
* <ishan@qbittorrent.org>, <chris@qbittorrent.org>
* Copyright (C) 2007 by Ishan Arora
* ishanarora@gmail.com
*
* 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,118 +27,163 @@
EventManager::EventManager(QObject *parent, bittorrent *BTSession)
: QObject(parent), BTSession(BTSession)
{
revision = 0;
}
QVariant EventManager::getEventList() const {
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
{
QVariantList list;
foreach(QVariantMap event, event_list.values()) {
list << QVariant(event);
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));
}
return QVariant(list);
QVariantMap map;
map["events"] = QVariant(list);
map["revision"] = QVariant((qulonglong) revision);
return QVariant(map);
}
bool EventManager::isUpdated(ulong r) const
{
return (r < revision);
}
void EventManager::addedTorrent(QTorrentHandle& h)
{
QVariantMap event;
QString hash = h.hash();
event["hash"] = QVariant(hash);
event["type"] = QVariant("add");
event["hash"] = QVariant(h.hash());
event["name"] = QVariant(h.name());
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;
update(event);
}
void EventManager::deletedTorrent(QString hash)
{
event_list.remove(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);
}
void EventManager::modifiedTorrent(QTorrentHandle h)
{
QString hash = h.hash();
QVariantMap event;
QVariant v;
if(h.is_paused()) {
if(BTSession->isQueueingEnabled() && (BTSession->isDownloadQueued(hash) || BTSession->isUploadQueued(hash)))
event["state"] = QVariant("queued");
if(BTSession->isDownloadQueued(hash) || BTSession->isUploadQueued(hash))
v = QVariant("queued");
else
event["state"] = QVariant("paused");
v = QVariant("paused");
} else {
switch(h.state())
{
case torrent_status::finished:
case torrent_status::seeding:
event["state"] = QVariant("seeding");
v = QVariant("seeding");
break;
case torrent_status::checking_files:
case torrent_status::queued_for_checking:
event["state"] = QVariant("checking");
v = QVariant("checking");
break;
case torrent_status::connecting_to_tracker:
if(h.download_payload_rate() > 0)
event["state"] = QVariant("downloading");
v = QVariant("downloading");
else
event["state"] = QVariant("connecting");
v = QVariant("connecting");
break;
case torrent_status::downloading:
case torrent_status::downloading_metadata:
if(h.download_payload_rate() > 0)
event["state"] = QVariant("downloading");
v = QVariant("downloading");
else
event["state"] = QVariant("stalled");
v = QVariant("stalled");
break;
default:
qDebug("No status, should not happen!!! status is %d", h.state());
event["state"] = QVariant();
v = QVariant();
}
}
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());
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["upspeed"] = QVariant(h.upload_payload_rate());
event["seed"] = QVariant(h.is_seed());
event["hash"] = QVariant(hash);
event_list[hash] = event;
}
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;
}

View File

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

View File

@@ -115,7 +115,12 @@ void HttpConnection::respond()
{
if (list[1] == "events")
{
respondJson();
EventManager* manager = parent->eventManager();
uint r = parser.get("r").toUInt();
if(manager->isUpdated(r))
respondJson();
else
connect(manager, SIGNAL(updated()), this, SLOT(respondJson()));
return;
}
}
@@ -161,7 +166,9 @@ void HttpConnection::respondNotFound()
void HttpConnection::respondJson()
{
EventManager* manager = parent->eventManager();
QVariant data = manager->getEventList();
QString temp = parser.get("r");
uint r = parser.get("r").toUInt();
QVariant data = manager->querySince(r);
QString string = toJson(data);
generator.setStatusLine(200, "OK");
generator.setContentTypeByExt("js");

View File

@@ -37,11 +37,11 @@ HttpServer::HttpServer(bittorrent *BTSession, int msec, QObject* parent) : QTcpS
QTorrentHandle h = BTSession->getTorrentHandle(hash);
if(h.is_valid()) manager->addedTorrent(h);
}
list = BTSession->getFinishedTorrents();
list = BTSession->getFinishedTorrents();
foreach(QString hash, list) {
QTorrentHandle h = BTSession->getTorrentHandle(hash);
if(h.is_valid()) manager->addedTorrent(h);
}
QTorrentHandle h = BTSession->getTorrentHandle(hash);
if(h.is_valid()) manager->addedTorrent(h);
}
//connect BTSession to manager
connect(BTSession, SIGNAL(addedTorrent(QTorrentHandle&)), manager, SLOT(addedTorrent(QTorrentHandle&)));
connect(BTSession, SIGNAL(deletedTorrent(QString)), manager, SLOT(deletedTorrent(QString)));
@@ -76,18 +76,16 @@ void HttpServer::newHttpConnection()
void HttpServer::onTimer()
{
qDebug("EventManager Timer Start");
QStringList list = BTSession->getUnfinishedTorrents();
foreach(QString hash, list) {
QTorrentHandle h = BTSession->getTorrentHandle(hash);
if(h.is_valid()) manager->modifiedTorrent(h);
}
list = BTSession->getFinishedTorrents();
list = BTSession->getFinishedTorrents();
foreach(QString hash, list) {
QTorrentHandle h = BTSession->getTorrentHandle(hash);
if(h.is_valid()) manager->modifiedTorrent(h);
}
qDebug("EventManager Timer Stop");
QTorrentHandle h = BTSession->getTorrentHandle(hash);
if(h.is_valid()) manager->modifiedTorrent(h);
}
}
void HttpServer::setAuthorization(QString username, QString password)

View File

@@ -102,7 +102,6 @@
<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

Binary file not shown.

File diff suppressed because it is too large Load Diff

Binary file not shown.

File diff suppressed because it is too large Load Diff

Binary file not shown.

File diff suppressed because it is too large Load Diff

Binary file not shown.

File diff suppressed because it is too large Load Diff

Binary file not shown.

File diff suppressed because it is too large Load Diff

Binary file not shown.

File diff suppressed because it is too large Load Diff

Binary file not shown.

File diff suppressed because it is too large Load Diff

Binary file not shown.

File diff suppressed because it is too large Load Diff

Binary file not shown.

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