mirror of
https://github.com/d47081/qBittorrent.git
synced 2025-01-12 07:48:04 +00:00
WebUI: Improve btjson.* indentation.
This commit is contained in:
parent
96ec6777e6
commit
c24610ec80
@ -160,9 +160,11 @@ static QVariantMap toMap(const QTorrentHandle& h)
|
||||
state = "error";
|
||||
else
|
||||
state = h.is_seed(status) ? "pausedUP" : "pausedDL";
|
||||
} else {
|
||||
if (QBtSession::instance()->isQueueingEnabled() && h.is_queued(status))
|
||||
}
|
||||
else {
|
||||
if (QBtSession::instance()->isQueueingEnabled() && h.is_queued(status)) {
|
||||
state = h.is_seed(status) ? "queuedUP" : "queuedDL";
|
||||
}
|
||||
else {
|
||||
switch (status.state) {
|
||||
case torrent_status::finished:
|
||||
@ -213,13 +215,16 @@ static QVariantMap toMap(const QTorrentHandle& h)
|
||||
*/
|
||||
QByteArray btjson::getTorrents()
|
||||
{
|
||||
CACHED_VARIABLE(QVariantList, torrent_list, CACHE_DURATION_MS);
|
||||
QVariantList torrent_list;
|
||||
|
||||
std::vector<torrent_handle> torrents = QBtSession::instance()->getTorrents();
|
||||
std::vector<torrent_handle>::const_iterator it = torrents.begin();
|
||||
std::vector<torrent_handle>::const_iterator end = torrents.end();
|
||||
|
||||
for( ; it != end; ++it) {
|
||||
torrent_list.append(toMap(QTorrentHandle(*it)));
|
||||
}
|
||||
|
||||
return json::toJson(torrent_list);
|
||||
}
|
||||
|
||||
@ -262,7 +267,8 @@ QByteArray btjson::getTrackersForTorrent(const QString& hash)
|
||||
|
||||
tracker_list.append(tracker_dict);
|
||||
}
|
||||
} catch(const std::exception& e) {
|
||||
}
|
||||
catch(const std::exception& e) {
|
||||
qWarning() << Q_FUNC_INFO << "Invalid torrent: " << misc::toQStringU(e.what());
|
||||
return QByteArray();
|
||||
}
|
||||
@ -323,7 +329,8 @@ QByteArray btjson::getPropertiesForTorrent(const QString& hash)
|
||||
data[KEY_PROP_CONNECT_COUNT_LIMIT] = status.connections_limit;
|
||||
const qreal ratio = QBtSession::instance()->getRealRatio(status);
|
||||
data[KEY_PROP_RATIO] = ratio > 100. ? -1 : ratio;
|
||||
} catch(const std::exception& e) {
|
||||
}
|
||||
catch(const std::exception& e) {
|
||||
qWarning() << Q_FUNC_INFO << "Invalid torrent: " << misc::toQStringU(e.what());
|
||||
return QByteArray();
|
||||
}
|
||||
@ -368,7 +375,8 @@ QByteArray btjson::getFilesForTorrent(const QString& hash)
|
||||
|
||||
file_list.append(file_dict);
|
||||
}
|
||||
} catch (const std::exception& e) {
|
||||
}
|
||||
catch (const std::exception& e) {
|
||||
qWarning() << Q_FUNC_INFO << "Invalid torrent: " << misc::toQStringU(e.what());
|
||||
return QByteArray();
|
||||
}
|
||||
|
@ -34,7 +34,8 @@
|
||||
#include <QCoreApplication>
|
||||
#include <QString>
|
||||
|
||||
class btjson {
|
||||
class btjson
|
||||
{
|
||||
Q_DECLARE_TR_FUNCTIONS(misc)
|
||||
|
||||
private:
|
||||
|
Loading…
Reference in New Issue
Block a user