qBittorrent
torrentscontroller.cpp File Reference
#include "torrentscontroller.h"
#include <functional>
#include <QBitArray>
#include <QDir>
#include <QJsonArray>
#include <QJsonObject>
#include <QList>
#include <QNetworkCookie>
#include <QRegularExpression>
#include <QUrl>
#include "base/bittorrent/categoryoptions.h"
#include "base/bittorrent/downloadpriority.h"
#include "base/bittorrent/infohash.h"
#include "base/bittorrent/peeraddress.h"
#include "base/bittorrent/peerinfo.h"
#include "base/bittorrent/session.h"
#include "base/bittorrent/torrent.h"
#include "base/bittorrent/torrentinfo.h"
#include "base/bittorrent/trackerentry.h"
#include "base/global.h"
#include "base/logger.h"
#include "base/net/downloadmanager.h"
#include "base/torrentfilter.h"
#include "base/utils/fs.h"
#include "base/utils/string.h"
#include "apierror.h"
#include "serialize/serialize_torrent.h"
Include dependency graph for torrentscontroller.cpp:

Go to the source code of this file.

Namespaces

 anonymous_namespace{torrentscontroller.cpp}
 

Functions

void anonymous_namespace{torrentscontroller.cpp}::applyToTorrents (const QStringList &idList, const std::function< void(BitTorrent::Torrent *torrent)> &func)
 
QJsonArray anonymous_namespace{torrentscontroller.cpp}::getStickyTrackers (const BitTorrent::Torrent *const torrent)
 
QVector< BitTorrent::TorrentIDanonymous_namespace{torrentscontroller.cpp}::toTorrentIDs (const QStringList &idStrings)
 

Variables

const char KEY_TRACKER_URL [] = "url"
 
const char KEY_TRACKER_STATUS [] = "status"
 
const char KEY_TRACKER_TIER [] = "tier"
 
const char KEY_TRACKER_MSG [] = "msg"
 
const char KEY_TRACKER_PEERS_COUNT [] = "num_peers"
 
const char KEY_TRACKER_SEEDS_COUNT [] = "num_seeds"
 
const char KEY_TRACKER_LEECHES_COUNT [] = "num_leeches"
 
const char KEY_TRACKER_DOWNLOADED_COUNT [] = "num_downloaded"
 
const char KEY_WEBSEED_URL [] = "url"
 
const char KEY_PROP_TIME_ELAPSED [] = "time_elapsed"
 
const char KEY_PROP_SEEDING_TIME [] = "seeding_time"
 
const char KEY_PROP_ETA [] = "eta"
 
const char KEY_PROP_CONNECT_COUNT [] = "nb_connections"
 
const char KEY_PROP_CONNECT_COUNT_LIMIT [] = "nb_connections_limit"
 
const char KEY_PROP_DOWNLOADED [] = "total_downloaded"
 
const char KEY_PROP_DOWNLOADED_SESSION [] = "total_downloaded_session"
 
const char KEY_PROP_UPLOADED [] = "total_uploaded"
 
const char KEY_PROP_UPLOADED_SESSION [] = "total_uploaded_session"
 
const char KEY_PROP_DL_SPEED [] = "dl_speed"
 
const char KEY_PROP_DL_SPEED_AVG [] = "dl_speed_avg"
 
const char KEY_PROP_UP_SPEED [] = "up_speed"
 
const char KEY_PROP_UP_SPEED_AVG [] = "up_speed_avg"
 
const char KEY_PROP_DL_LIMIT [] = "dl_limit"
 
const char KEY_PROP_UP_LIMIT [] = "up_limit"
 
const char KEY_PROP_WASTED [] = "total_wasted"
 
const char KEY_PROP_SEEDS [] = "seeds"
 
const char KEY_PROP_SEEDS_TOTAL [] = "seeds_total"
 
const char KEY_PROP_PEERS [] = "peers"
 
const char KEY_PROP_PEERS_TOTAL [] = "peers_total"
 
const char KEY_PROP_RATIO [] = "share_ratio"
 
const char KEY_PROP_REANNOUNCE [] = "reannounce"
 
const char KEY_PROP_TOTAL_SIZE [] = "total_size"
 
const char KEY_PROP_PIECES_NUM [] = "pieces_num"
 
const char KEY_PROP_PIECE_SIZE [] = "piece_size"
 
const char KEY_PROP_PIECES_HAVE [] = "pieces_have"
 
const char KEY_PROP_CREATED_BY [] = "created_by"
 
const char KEY_PROP_LAST_SEEN [] = "last_seen"
 
const char KEY_PROP_ADDITION_DATE [] = "addition_date"
 
const char KEY_PROP_COMPLETION_DATE [] = "completion_date"
 
const char KEY_PROP_CREATION_DATE [] = "creation_date"
 
const char KEY_PROP_SAVE_PATH [] = "save_path"
 
const char KEY_PROP_DOWNLOAD_PATH [] = "download_path"
 
const char KEY_PROP_COMMENT [] = "comment"
 
const char KEY_FILE_INDEX [] = "index"
 
const char KEY_FILE_NAME [] = "name"
 
const char KEY_FILE_SIZE [] = "size"
 
const char KEY_FILE_PROGRESS [] = "progress"
 
const char KEY_FILE_PRIORITY [] = "priority"
 
const char KEY_FILE_IS_SEED [] = "is_seed"
 
const char KEY_FILE_PIECE_RANGE [] = "piece_range"
 
const char KEY_FILE_AVAILABILITY [] = "availability"
 

Variable Documentation

◆ KEY_FILE_AVAILABILITY

const char KEY_FILE_AVAILABILITY[] = "availability"

Definition at line 117 of file torrentscontroller.cpp.

Referenced by TorrentsController::filesAction().

◆ KEY_FILE_INDEX

const char KEY_FILE_INDEX[] = "index"

Definition at line 110 of file torrentscontroller.cpp.

Referenced by TorrentsController::filesAction().

◆ KEY_FILE_IS_SEED

const char KEY_FILE_IS_SEED[] = "is_seed"

Definition at line 115 of file torrentscontroller.cpp.

Referenced by TorrentsController::filesAction().

◆ KEY_FILE_NAME

const char KEY_FILE_NAME[] = "name"

Definition at line 111 of file torrentscontroller.cpp.

Referenced by TorrentsController::filesAction().

◆ KEY_FILE_PIECE_RANGE

const char KEY_FILE_PIECE_RANGE[] = "piece_range"

Definition at line 116 of file torrentscontroller.cpp.

Referenced by TorrentsController::filesAction().

◆ KEY_FILE_PRIORITY

const char KEY_FILE_PRIORITY[] = "priority"

Definition at line 114 of file torrentscontroller.cpp.

Referenced by TorrentsController::filesAction().

◆ KEY_FILE_PROGRESS

const char KEY_FILE_PROGRESS[] = "progress"

Definition at line 113 of file torrentscontroller.cpp.

Referenced by TorrentsController::filesAction().

◆ KEY_FILE_SIZE

const char KEY_FILE_SIZE[] = "size"

Definition at line 112 of file torrentscontroller.cpp.

Referenced by TorrentsController::filesAction().

◆ KEY_PROP_ADDITION_DATE

const char KEY_PROP_ADDITION_DATE[] = "addition_date"

Definition at line 102 of file torrentscontroller.cpp.

Referenced by TorrentsController::propertiesAction().

◆ KEY_PROP_COMMENT

const char KEY_PROP_COMMENT[] = "comment"

Definition at line 107 of file torrentscontroller.cpp.

Referenced by TorrentsController::propertiesAction().

◆ KEY_PROP_COMPLETION_DATE

const char KEY_PROP_COMPLETION_DATE[] = "completion_date"

Definition at line 103 of file torrentscontroller.cpp.

Referenced by TorrentsController::propertiesAction().

◆ KEY_PROP_CONNECT_COUNT

const char KEY_PROP_CONNECT_COUNT[] = "nb_connections"

Definition at line 77 of file torrentscontroller.cpp.

Referenced by TorrentsController::propertiesAction().

◆ KEY_PROP_CONNECT_COUNT_LIMIT

const char KEY_PROP_CONNECT_COUNT_LIMIT[] = "nb_connections_limit"

Definition at line 78 of file torrentscontroller.cpp.

Referenced by TorrentsController::propertiesAction().

◆ KEY_PROP_CREATED_BY

const char KEY_PROP_CREATED_BY[] = "created_by"

Definition at line 100 of file torrentscontroller.cpp.

Referenced by TorrentsController::propertiesAction().

◆ KEY_PROP_CREATION_DATE

const char KEY_PROP_CREATION_DATE[] = "creation_date"

Definition at line 104 of file torrentscontroller.cpp.

Referenced by TorrentsController::propertiesAction().

◆ KEY_PROP_DL_LIMIT

const char KEY_PROP_DL_LIMIT[] = "dl_limit"

Definition at line 87 of file torrentscontroller.cpp.

Referenced by TorrentsController::propertiesAction().

◆ KEY_PROP_DL_SPEED

const char KEY_PROP_DL_SPEED[] = "dl_speed"

Definition at line 83 of file torrentscontroller.cpp.

Referenced by TorrentsController::propertiesAction().

◆ KEY_PROP_DL_SPEED_AVG

const char KEY_PROP_DL_SPEED_AVG[] = "dl_speed_avg"

Definition at line 84 of file torrentscontroller.cpp.

Referenced by TorrentsController::propertiesAction().

◆ KEY_PROP_DOWNLOAD_PATH

const char KEY_PROP_DOWNLOAD_PATH[] = "download_path"

Definition at line 106 of file torrentscontroller.cpp.

Referenced by TorrentsController::propertiesAction().

◆ KEY_PROP_DOWNLOADED

const char KEY_PROP_DOWNLOADED[] = "total_downloaded"

Definition at line 79 of file torrentscontroller.cpp.

Referenced by TorrentsController::propertiesAction().

◆ KEY_PROP_DOWNLOADED_SESSION

const char KEY_PROP_DOWNLOADED_SESSION[] = "total_downloaded_session"

Definition at line 80 of file torrentscontroller.cpp.

Referenced by TorrentsController::propertiesAction().

◆ KEY_PROP_ETA

const char KEY_PROP_ETA[] = "eta"

Definition at line 76 of file torrentscontroller.cpp.

Referenced by TorrentsController::propertiesAction().

◆ KEY_PROP_LAST_SEEN

const char KEY_PROP_LAST_SEEN[] = "last_seen"

Definition at line 101 of file torrentscontroller.cpp.

Referenced by TorrentsController::propertiesAction().

◆ KEY_PROP_PEERS

const char KEY_PROP_PEERS[] = "peers"

Definition at line 92 of file torrentscontroller.cpp.

Referenced by TorrentsController::propertiesAction().

◆ KEY_PROP_PEERS_TOTAL

const char KEY_PROP_PEERS_TOTAL[] = "peers_total"

Definition at line 93 of file torrentscontroller.cpp.

Referenced by TorrentsController::propertiesAction().

◆ KEY_PROP_PIECE_SIZE

const char KEY_PROP_PIECE_SIZE[] = "piece_size"

Definition at line 98 of file torrentscontroller.cpp.

Referenced by TorrentsController::propertiesAction().

◆ KEY_PROP_PIECES_HAVE

const char KEY_PROP_PIECES_HAVE[] = "pieces_have"

Definition at line 99 of file torrentscontroller.cpp.

Referenced by TorrentsController::propertiesAction().

◆ KEY_PROP_PIECES_NUM

const char KEY_PROP_PIECES_NUM[] = "pieces_num"

Definition at line 97 of file torrentscontroller.cpp.

Referenced by TorrentsController::propertiesAction().

◆ KEY_PROP_RATIO

const char KEY_PROP_RATIO[] = "share_ratio"

Definition at line 94 of file torrentscontroller.cpp.

Referenced by TorrentsController::propertiesAction().

◆ KEY_PROP_REANNOUNCE

const char KEY_PROP_REANNOUNCE[] = "reannounce"

Definition at line 95 of file torrentscontroller.cpp.

Referenced by TorrentsController::propertiesAction().

◆ KEY_PROP_SAVE_PATH

const char KEY_PROP_SAVE_PATH[] = "save_path"

Definition at line 105 of file torrentscontroller.cpp.

Referenced by TorrentsController::propertiesAction().

◆ KEY_PROP_SEEDING_TIME

const char KEY_PROP_SEEDING_TIME[] = "seeding_time"

Definition at line 75 of file torrentscontroller.cpp.

Referenced by TorrentsController::propertiesAction().

◆ KEY_PROP_SEEDS

const char KEY_PROP_SEEDS[] = "seeds"

Definition at line 90 of file torrentscontroller.cpp.

Referenced by TorrentsController::propertiesAction().

◆ KEY_PROP_SEEDS_TOTAL

const char KEY_PROP_SEEDS_TOTAL[] = "seeds_total"

Definition at line 91 of file torrentscontroller.cpp.

Referenced by TorrentsController::propertiesAction().

◆ KEY_PROP_TIME_ELAPSED

const char KEY_PROP_TIME_ELAPSED[] = "time_elapsed"

Definition at line 74 of file torrentscontroller.cpp.

Referenced by TorrentsController::propertiesAction().

◆ KEY_PROP_TOTAL_SIZE

const char KEY_PROP_TOTAL_SIZE[] = "total_size"

Definition at line 96 of file torrentscontroller.cpp.

Referenced by TorrentsController::propertiesAction().

◆ KEY_PROP_UP_LIMIT

const char KEY_PROP_UP_LIMIT[] = "up_limit"

Definition at line 88 of file torrentscontroller.cpp.

Referenced by TorrentsController::propertiesAction().

◆ KEY_PROP_UP_SPEED

const char KEY_PROP_UP_SPEED[] = "up_speed"

Definition at line 85 of file torrentscontroller.cpp.

Referenced by TorrentsController::propertiesAction().

◆ KEY_PROP_UP_SPEED_AVG

const char KEY_PROP_UP_SPEED_AVG[] = "up_speed_avg"

Definition at line 86 of file torrentscontroller.cpp.

Referenced by TorrentsController::propertiesAction().

◆ KEY_PROP_UPLOADED

const char KEY_PROP_UPLOADED[] = "total_uploaded"

Definition at line 81 of file torrentscontroller.cpp.

Referenced by TorrentsController::propertiesAction().

◆ KEY_PROP_UPLOADED_SESSION

const char KEY_PROP_UPLOADED_SESSION[] = "total_uploaded_session"

Definition at line 82 of file torrentscontroller.cpp.

Referenced by TorrentsController::propertiesAction().

◆ KEY_PROP_WASTED

const char KEY_PROP_WASTED[] = "total_wasted"

Definition at line 89 of file torrentscontroller.cpp.

Referenced by TorrentsController::propertiesAction().

◆ KEY_TRACKER_DOWNLOADED_COUNT

const char KEY_TRACKER_DOWNLOADED_COUNT[] = "num_downloaded"

◆ KEY_TRACKER_LEECHES_COUNT

const char KEY_TRACKER_LEECHES_COUNT[] = "num_leeches"

◆ KEY_TRACKER_MSG

const char KEY_TRACKER_MSG[] = "msg"

◆ KEY_TRACKER_PEERS_COUNT

const char KEY_TRACKER_PEERS_COUNT[] = "num_peers"

◆ KEY_TRACKER_SEEDS_COUNT

const char KEY_TRACKER_SEEDS_COUNT[] = "num_seeds"

◆ KEY_TRACKER_STATUS

const char KEY_TRACKER_STATUS[] = "status"

◆ KEY_TRACKER_TIER

const char KEY_TRACKER_TIER[] = "tier"

◆ KEY_TRACKER_URL

const char KEY_TRACKER_URL[] = "url"

◆ KEY_WEBSEED_URL

const char KEY_WEBSEED_URL[] = "url"

Definition at line 71 of file torrentscontroller.cpp.

Referenced by TorrentsController::webseedsAction().