WebUI: Provide 'Merge trackers to existing torrent' option
[qBittorrent.git] / src / webui / api / serialize / serialize_torrent.h
blob883efa6dd5cd20298ad21d6bfa647bcc5947675b
1 /*
2 * Bittorrent Client using Qt and libtorrent.
3 * Copyright (C) 2018-2023 Vladimir Golovnev <glassez@yandex.ru>
5 * This program is free software; you can redistribute it and/or
6 * modify it under the terms of the GNU General Public License
7 * as published by the Free Software Foundation; either version 2
8 * of the License, or (at your option) any later version.
10 * This program is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 * GNU General Public License for more details.
15 * You should have received a copy of the GNU General Public License
16 * along with this program; if not, write to the Free Software
17 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
19 * In addition, as a special exception, the copyright holders give permission to
20 * link this program with the OpenSSL project's "OpenSSL" library (or with
21 * modified versions of it that use the same license as the "OpenSSL" library),
22 * and distribute the linked executables. You must obey the GNU General Public
23 * License in all respects for all of the code used other than "OpenSSL". If you
24 * modify file(s), you may extend this exception to your version of the file(s),
25 * but you are not obligated to do so. If you do not wish to do so, delete this
26 * exception statement from your version.
29 #pragma once
31 #include <QVariant>
33 #include "base/global.h"
35 namespace BitTorrent
37 class Torrent;
40 // Torrent keys
41 // TODO: Rename it to `id`.
42 inline const QString KEY_TORRENT_ID = u"hash"_s;
43 inline const QString KEY_TORRENT_INFOHASHV1 = u"infohash_v1"_s;
44 inline const QString KEY_TORRENT_INFOHASHV2 = u"infohash_v2"_s;
45 inline const QString KEY_TORRENT_NAME = u"name"_s;
46 inline const QString KEY_TORRENT_MAGNET_URI = u"magnet_uri"_s;
47 inline const QString KEY_TORRENT_SIZE = u"size"_s;
48 inline const QString KEY_TORRENT_PROGRESS = u"progress"_s;
49 inline const QString KEY_TORRENT_DLSPEED = u"dlspeed"_s;
50 inline const QString KEY_TORRENT_UPSPEED = u"upspeed"_s;
51 inline const QString KEY_TORRENT_QUEUE_POSITION = u"priority"_s;
52 inline const QString KEY_TORRENT_SEEDS = u"num_seeds"_s;
53 inline const QString KEY_TORRENT_NUM_COMPLETE = u"num_complete"_s;
54 inline const QString KEY_TORRENT_LEECHS = u"num_leechs"_s;
55 inline const QString KEY_TORRENT_NUM_INCOMPLETE = u"num_incomplete"_s;
56 inline const QString KEY_TORRENT_RATIO = u"ratio"_s;
57 inline const QString KEY_TORRENT_POPULARITY = u"popularity"_s;
58 inline const QString KEY_TORRENT_ETA = u"eta"_s;
59 inline const QString KEY_TORRENT_STATE = u"state"_s;
60 inline const QString KEY_TORRENT_SEQUENTIAL_DOWNLOAD = u"seq_dl"_s;
61 inline const QString KEY_TORRENT_FIRST_LAST_PIECE_PRIO = u"f_l_piece_prio"_s;
62 inline const QString KEY_TORRENT_CATEGORY = u"category"_s;
63 inline const QString KEY_TORRENT_TAGS = u"tags"_s;
64 inline const QString KEY_TORRENT_SUPER_SEEDING = u"super_seeding"_s;
65 inline const QString KEY_TORRENT_FORCE_START = u"force_start"_s;
66 inline const QString KEY_TORRENT_SAVE_PATH = u"save_path"_s;
67 inline const QString KEY_TORRENT_DOWNLOAD_PATH = u"download_path"_s;
68 inline const QString KEY_TORRENT_CONTENT_PATH = u"content_path"_s;
69 inline const QString KEY_TORRENT_ROOT_PATH = u"root_path"_s;
70 inline const QString KEY_TORRENT_ADDED_ON = u"added_on"_s;
71 inline const QString KEY_TORRENT_COMPLETION_ON = u"completion_on"_s;
72 inline const QString KEY_TORRENT_TRACKER = u"tracker"_s;
73 inline const QString KEY_TORRENT_TRACKERS_COUNT = u"trackers_count"_s;
74 inline const QString KEY_TORRENT_DL_LIMIT = u"dl_limit"_s;
75 inline const QString KEY_TORRENT_UP_LIMIT = u"up_limit"_s;
76 inline const QString KEY_TORRENT_AMOUNT_DOWNLOADED = u"downloaded"_s;
77 inline const QString KEY_TORRENT_AMOUNT_UPLOADED = u"uploaded"_s;
78 inline const QString KEY_TORRENT_AMOUNT_DOWNLOADED_SESSION = u"downloaded_session"_s;
79 inline const QString KEY_TORRENT_AMOUNT_UPLOADED_SESSION = u"uploaded_session"_s;
80 inline const QString KEY_TORRENT_AMOUNT_LEFT = u"amount_left"_s;
81 inline const QString KEY_TORRENT_AMOUNT_COMPLETED = u"completed"_s;
82 inline const QString KEY_TORRENT_MAX_RATIO = u"max_ratio"_s;
83 inline const QString KEY_TORRENT_MAX_SEEDING_TIME = u"max_seeding_time"_s;
84 inline const QString KEY_TORRENT_MAX_INACTIVE_SEEDING_TIME = u"max_inactive_seeding_time"_s;
85 inline const QString KEY_TORRENT_RATIO_LIMIT = u"ratio_limit"_s;
86 inline const QString KEY_TORRENT_SEEDING_TIME_LIMIT = u"seeding_time_limit"_s;
87 inline const QString KEY_TORRENT_INACTIVE_SEEDING_TIME_LIMIT = u"inactive_seeding_time_limit"_s;
88 inline const QString KEY_TORRENT_LAST_SEEN_COMPLETE_TIME = u"seen_complete"_s;
89 inline const QString KEY_TORRENT_LAST_ACTIVITY_TIME = u"last_activity"_s;
90 inline const QString KEY_TORRENT_TOTAL_SIZE = u"total_size"_s;
91 inline const QString KEY_TORRENT_AUTO_TORRENT_MANAGEMENT = u"auto_tmm"_s;
92 inline const QString KEY_TORRENT_TIME_ACTIVE = u"time_active"_s;
93 inline const QString KEY_TORRENT_SEEDING_TIME = u"seeding_time"_s;
94 inline const QString KEY_TORRENT_AVAILABILITY = u"availability"_s;
95 inline const QString KEY_TORRENT_REANNOUNCE = u"reannounce"_s;
96 inline const QString KEY_TORRENT_COMMENT = u"comment"_s;
97 inline const QString KEY_TORRENT_PRIVATE = u"private"_s;
98 inline const QString KEY_TORRENT_HAS_METADATA = u"has_metadata"_s;
100 QVariantMap serialize(const BitTorrent::Torrent &torrent);