mirror of
https://github.com/qbittorrent/qBittorrent.git
synced 2026-01-01 21:28:07 -06:00
Big code clean up
This commit is contained in:
@@ -40,7 +40,7 @@
|
||||
#include <QDebug>
|
||||
#include <QTranslator>
|
||||
|
||||
EventManager::EventManager(QObject *parent, Bittorrent *BTSession)
|
||||
EventManager::EventManager(QObject *parent, QBtSession *BTSession)
|
||||
: QObject(parent), BTSession(BTSession)
|
||||
{
|
||||
}
|
||||
|
||||
@@ -36,20 +36,20 @@
|
||||
#include <QHash>
|
||||
#include <QVariant>
|
||||
|
||||
class Bittorrent;
|
||||
class QBtSession;
|
||||
|
||||
class EventManager : public QObject
|
||||
{
|
||||
Q_OBJECT
|
||||
private:
|
||||
QHash<QString, QVariantMap> event_list;
|
||||
Bittorrent* BTSession;
|
||||
QBtSession* BTSession;
|
||||
|
||||
protected:
|
||||
void update(QVariantMap event);
|
||||
|
||||
public:
|
||||
EventManager(QObject *parent, Bittorrent* BTSession);
|
||||
EventManager(QObject *parent, QBtSession* BTSession);
|
||||
QList<QVariantMap> getEventList() const;
|
||||
QVariantMap getPropGeneralInfo(QString hash) const;
|
||||
QList<QVariantMap> getPropTrackersInfo(QString hash) const;
|
||||
|
||||
@@ -46,7 +46,7 @@
|
||||
#include <QRegExp>
|
||||
#include <QTemporaryFile>
|
||||
|
||||
HttpConnection::HttpConnection(QTcpSocket *socket, Bittorrent *BTSession, HttpServer *parent)
|
||||
HttpConnection::HttpConnection(QTcpSocket *socket, QBtSession *BTSession, HttpServer *parent)
|
||||
: QObject(parent), socket(socket), parent(parent), BTSession(BTSession)
|
||||
{
|
||||
socket->setParent(this);
|
||||
|
||||
@@ -38,7 +38,7 @@
|
||||
|
||||
class QTcpSocket;
|
||||
class HttpServer;
|
||||
class Bittorrent;
|
||||
class QBtSession;
|
||||
|
||||
class HttpConnection : public QObject
|
||||
{
|
||||
@@ -46,7 +46,7 @@ class HttpConnection : public QObject
|
||||
private:
|
||||
QTcpSocket *socket;
|
||||
HttpServer *parent;
|
||||
Bittorrent *BTSession;
|
||||
QBtSession *BTSession;
|
||||
|
||||
protected:
|
||||
HttpRequestParser parser;
|
||||
@@ -69,7 +69,7 @@ class HttpConnection : public QObject
|
||||
void recheckAllTorrents();
|
||||
|
||||
public:
|
||||
HttpConnection(QTcpSocket *socket, Bittorrent* BTSession, HttpServer *parent);
|
||||
HttpConnection(QTcpSocket *socket, QBtSession* BTSession, HttpServer *parent);
|
||||
~HttpConnection();
|
||||
QString translateDocument(QString data);
|
||||
|
||||
|
||||
@@ -80,7 +80,7 @@ void HttpServer::resetNbFailedAttemptsForIp(QString ip) {
|
||||
client_failed_attempts.remove(ip);
|
||||
}
|
||||
|
||||
HttpServer::HttpServer(Bittorrent *_BTSession, int msec, QObject* parent) : QTcpServer(parent) {
|
||||
HttpServer::HttpServer(QBtSession *_BTSession, int msec, QObject* parent) : QTcpServer(parent) {
|
||||
username = Preferences::getWebUiUsername().toLocal8Bit();
|
||||
password_ha1 = Preferences::getWebUiPassword().toLocal8Bit();
|
||||
connect(this, SIGNAL(newConnection()), this, SLOT(newHttpConnection()));
|
||||
|
||||
@@ -38,7 +38,7 @@
|
||||
#include <QHash>
|
||||
#include "preferences.h"
|
||||
|
||||
class Bittorrent;
|
||||
class QBtSession;
|
||||
class QTimer;
|
||||
class EventManager;
|
||||
|
||||
@@ -48,7 +48,7 @@ class HttpServer : public QTcpServer {
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
HttpServer(Bittorrent *BTSession, int msec, QObject* parent = 0);
|
||||
HttpServer(QBtSession *BTSession, int msec, QObject* parent = 0);
|
||||
~HttpServer();
|
||||
void setAuthorization(QString username, QString password_ha1);
|
||||
bool isAuthorized(QByteArray auth, QString method) const;
|
||||
@@ -66,7 +66,7 @@ private slots:
|
||||
private:
|
||||
QByteArray username;
|
||||
QByteArray password_ha1;
|
||||
Bittorrent *BTSession;
|
||||
QBtSession *BTSession;
|
||||
EventManager *manager;
|
||||
QTimer *timer;
|
||||
QHash<QString, int> client_failed_attempts;
|
||||
|
||||
Reference in New Issue
Block a user