2022-01-20 18:27:56 +00:00
|
|
|
// This file Copyright © 2009-2022 Mnemosyne LLC.
|
2022-02-07 16:25:02 +00:00
|
|
|
// It may be used under GPLv2 (SPDX: GPL-2.0-only), GPLv3 (SPDX: GPL-3.0-only),
|
2022-01-20 18:27:56 +00:00
|
|
|
// or any future license endorsed by Mnemosyne LLC.
|
|
|
|
// License text can be found in the licenses/ folder.
|
2009-04-09 18:55:47 +00:00
|
|
|
|
2020-06-24 18:28:54 +00:00
|
|
|
#include <algorithm>
|
2009-04-09 18:55:47 +00:00
|
|
|
#include <cassert>
|
2020-06-24 18:28:54 +00:00
|
|
|
#include <iterator>
|
2020-09-08 03:52:29 +00:00
|
|
|
#include <set>
|
2009-04-09 18:55:47 +00:00
|
|
|
|
|
|
|
#include <QApplication>
|
|
|
|
#include <QString>
|
2010-07-25 17:16:03 +00:00
|
|
|
#include <QUrl>
|
2009-04-09 18:55:47 +00:00
|
|
|
|
|
|
|
#include <libtransmission/transmission.h>
|
|
|
|
#include <libtransmission/utils.h> /* tr_new0, tr_strdup */
|
2012-12-14 04:34:42 +00:00
|
|
|
#include <libtransmission/variant.h>
|
2009-04-09 18:55:47 +00:00
|
|
|
|
2015-06-10 21:27:11 +00:00
|
|
|
#include "Application.h"
|
2020-08-15 15:42:51 +00:00
|
|
|
#include "IconCache.h"
|
2015-06-10 21:27:11 +00:00
|
|
|
#include "Prefs.h"
|
|
|
|
#include "Torrent.h"
|
|
|
|
#include "Utils.h"
|
2020-07-27 04:30:58 +00:00
|
|
|
#include "VariantHelpers.h"
|
|
|
|
|
|
|
|
using ::trqt::variant_helpers::change;
|
2009-04-09 18:55:47 +00:00
|
|
|
|
2021-08-15 09:41:48 +00:00
|
|
|
Torrent::Torrent(Prefs const& prefs, int id)
|
|
|
|
: id_(id)
|
|
|
|
, prefs_(prefs)
|
2020-01-14 21:28:34 +00:00
|
|
|
{
|
|
|
|
}
|
|
|
|
|
|
|
|
/***
|
|
|
|
****
|
|
|
|
***/
|
|
|
|
|
2022-02-08 03:56:04 +00:00
|
|
|
std::optional<double> Torrent::getSeedRatioLimit() const
|
2009-04-09 18:55:47 +00:00
|
|
|
{
|
2022-02-08 03:56:04 +00:00
|
|
|
auto const mode = seedRatioMode();
|
2009-04-09 18:55:47 +00:00
|
|
|
|
2022-02-08 03:56:04 +00:00
|
|
|
if (mode == TR_RATIOLIMIT_SINGLE)
|
2009-04-09 18:55:47 +00:00
|
|
|
{
|
2022-02-08 03:56:04 +00:00
|
|
|
return seedRatioLimit();
|
2009-04-09 18:55:47 +00:00
|
|
|
}
|
|
|
|
|
2022-02-08 03:56:04 +00:00
|
|
|
if (mode == TR_RATIOLIMIT_GLOBAL && prefs_.getBool(Prefs::RATIO_ENABLED))
|
|
|
|
{
|
|
|
|
return prefs_.getDouble(Prefs::RATIO);
|
|
|
|
}
|
|
|
|
|
|
|
|
return {};
|
2009-04-09 18:55:47 +00:00
|
|
|
}
|
|
|
|
|
2022-02-12 17:30:27 +00:00
|
|
|
bool Torrent::includesTracker(QString const& sitename) const
|
2009-04-09 18:55:47 +00:00
|
|
|
{
|
2022-02-12 17:30:27 +00:00
|
|
|
return std::binary_search(std::begin(sitenames_), std::end(sitenames_), sitename);
|
2009-04-09 18:55:47 +00:00
|
|
|
}
|
|
|
|
|
2017-04-20 16:02:19 +00:00
|
|
|
int Torrent::compareSeedRatio(Torrent const& that) const
|
2010-12-01 05:41:58 +00:00
|
|
|
{
|
2022-02-08 03:56:04 +00:00
|
|
|
auto const a = getSeedRatioLimit();
|
|
|
|
auto const b = that.getSeedRatioLimit();
|
2017-04-19 12:04:45 +00:00
|
|
|
|
2022-02-08 03:56:04 +00:00
|
|
|
if (!a && !b)
|
2017-04-19 12:04:45 +00:00
|
|
|
{
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
2022-02-08 03:56:04 +00:00
|
|
|
if (!a || !b)
|
2017-04-19 12:04:45 +00:00
|
|
|
{
|
2022-02-08 03:56:04 +00:00
|
|
|
return a ? -1 : 1;
|
2017-04-19 12:04:45 +00:00
|
|
|
}
|
|
|
|
|
2022-02-08 03:56:04 +00:00
|
|
|
if (*a < *b)
|
2017-04-19 12:04:45 +00:00
|
|
|
{
|
|
|
|
return -1;
|
|
|
|
}
|
|
|
|
|
2022-02-08 03:56:04 +00:00
|
|
|
if (*a > *b)
|
2017-04-19 12:04:45 +00:00
|
|
|
{
|
|
|
|
return 1;
|
|
|
|
}
|
|
|
|
|
|
|
|
return 0;
|
2010-12-01 05:41:58 +00:00
|
|
|
}
|
|
|
|
|
2017-04-20 16:02:19 +00:00
|
|
|
int Torrent::compareRatio(Torrent const& that) const
|
2009-04-09 18:55:47 +00:00
|
|
|
{
|
2017-04-20 16:02:19 +00:00
|
|
|
double const a = ratio();
|
|
|
|
double const b = that.ratio();
|
2017-04-19 12:04:45 +00:00
|
|
|
|
|
|
|
if (static_cast<int>(a) == TR_RATIO_INF && static_cast<int>(b) == TR_RATIO_INF)
|
|
|
|
{
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (static_cast<int>(a) == TR_RATIO_INF)
|
|
|
|
{
|
|
|
|
return 1;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (static_cast<int>(b) == TR_RATIO_INF)
|
|
|
|
{
|
|
|
|
return -1;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (a < b)
|
|
|
|
{
|
|
|
|
return -1;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (a > b)
|
|
|
|
{
|
|
|
|
return 1;
|
|
|
|
}
|
|
|
|
|
|
|
|
return 0;
|
2009-04-09 18:55:47 +00:00
|
|
|
}
|
|
|
|
|
2017-04-20 16:02:19 +00:00
|
|
|
int Torrent::compareETA(Torrent const& that) const
|
2009-04-09 18:55:47 +00:00
|
|
|
{
|
2020-05-27 21:53:12 +00:00
|
|
|
bool const have_a(hasETA());
|
|
|
|
bool const have_b(that.hasETA());
|
2017-04-19 12:04:45 +00:00
|
|
|
|
2020-05-27 21:53:12 +00:00
|
|
|
if (have_a && have_b)
|
2017-04-19 12:04:45 +00:00
|
|
|
{
|
|
|
|
return getETA() - that.getETA();
|
|
|
|
}
|
|
|
|
|
2020-05-27 21:53:12 +00:00
|
|
|
if (have_a)
|
2017-04-19 12:04:45 +00:00
|
|
|
{
|
|
|
|
return 1;
|
|
|
|
}
|
|
|
|
|
2020-05-27 21:53:12 +00:00
|
|
|
if (have_b)
|
2017-04-19 12:04:45 +00:00
|
|
|
{
|
|
|
|
return -1;
|
|
|
|
}
|
|
|
|
|
|
|
|
return 0;
|
2009-04-09 18:55:47 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
/***
|
|
|
|
****
|
|
|
|
***/
|
|
|
|
|
2020-09-08 16:51:33 +00:00
|
|
|
QIcon Torrent::getMimeTypeIcon() const
|
2009-04-09 18:55:47 +00:00
|
|
|
{
|
2020-09-08 16:51:33 +00:00
|
|
|
if (icon_.isNull())
|
2017-04-19 12:04:45 +00:00
|
|
|
{
|
2020-10-13 15:33:56 +00:00
|
|
|
icon_ = IconCache::get().getMimeTypeIcon(primary_mime_type_, file_count_ > 1);
|
2017-04-19 12:04:45 +00:00
|
|
|
}
|
2009-04-09 18:55:47 +00:00
|
|
|
|
2020-09-08 16:51:33 +00:00
|
|
|
return icon_;
|
2009-04-09 18:55:47 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
/***
|
|
|
|
****
|
|
|
|
***/
|
|
|
|
|
2020-06-23 21:11:16 +00:00
|
|
|
Torrent::fields_t Torrent::update(tr_quark const* keys, tr_variant const* const* values, size_t n)
|
2009-04-09 18:55:47 +00:00
|
|
|
{
|
2020-06-23 21:11:16 +00:00
|
|
|
auto changed = fields_t{};
|
2012-12-22 20:35:19 +00:00
|
|
|
|
2019-11-09 23:02:23 +00:00
|
|
|
for (size_t pos = 0; pos < n; ++pos)
|
2009-04-09 18:55:47 +00:00
|
|
|
{
|
2019-11-09 23:02:23 +00:00
|
|
|
tr_quark key = keys[pos];
|
2020-05-19 23:42:17 +00:00
|
|
|
tr_variant const* child = values[pos];
|
|
|
|
bool field_changed = false;
|
2017-04-19 12:04:45 +00:00
|
|
|
|
2020-05-19 23:42:17 +00:00
|
|
|
switch (key)
|
2017-04-19 12:04:45 +00:00
|
|
|
{
|
2021-08-15 09:41:48 +00:00
|
|
|
#define HANDLE_KEY(key, field, bit) \
|
|
|
|
case TR_KEY_##key: \
|
|
|
|
field_changed = change(field##_, child); \
|
|
|
|
changed.set(bit, field_changed); \
|
|
|
|
break;
|
2020-06-23 21:11:16 +00:00
|
|
|
|
|
|
|
HANDLE_KEY(activityDate, activity_date, ACTIVITY_DATE)
|
|
|
|
HANDLE_KEY(addedDate, added_date, ADDED_DATE)
|
|
|
|
HANDLE_KEY(bandwidthPriority, bandwidth_priority, BANDWIDTH_PRIORITY)
|
|
|
|
HANDLE_KEY(corruptEver, failed_ever, FAILED_EVER)
|
|
|
|
HANDLE_KEY(dateCreated, date_created, DATE_CREATED)
|
|
|
|
HANDLE_KEY(desiredAvailable, desired_available, DESIRED_AVAILABLE)
|
|
|
|
HANDLE_KEY(downloadLimit, download_limit, DOWNLOAD_LIMIT) // KB/s
|
|
|
|
HANDLE_KEY(downloadLimited, download_limited, DOWNLOAD_LIMITED)
|
|
|
|
HANDLE_KEY(downloadedEver, downloaded_ever, DOWNLOADED_EVER)
|
|
|
|
HANDLE_KEY(editDate, edit_date, EDIT_DATE)
|
|
|
|
HANDLE_KEY(error, error, ERROR)
|
|
|
|
HANDLE_KEY(eta, eta, ETA)
|
|
|
|
HANDLE_KEY(fileStats, files, FILES)
|
|
|
|
HANDLE_KEY(files, files, FILES)
|
2020-10-13 15:33:56 +00:00
|
|
|
HANDLE_KEY(file_count, file_count, FILE_COUNT)
|
2020-09-07 21:19:10 +00:00
|
|
|
HANDLE_KEY(hashString, hash, HASH)
|
2020-06-23 21:11:16 +00:00
|
|
|
HANDLE_KEY(haveUnchecked, have_unchecked, HAVE_UNCHECKED)
|
|
|
|
HANDLE_KEY(haveValid, have_verified, HAVE_VERIFIED)
|
|
|
|
HANDLE_KEY(honorsSessionLimits, honors_session_limits, HONORS_SESSION_LIMITS)
|
|
|
|
HANDLE_KEY(isFinished, is_finished, IS_FINISHED)
|
|
|
|
HANDLE_KEY(isPrivate, is_private, IS_PRIVATE)
|
|
|
|
HANDLE_KEY(isStalled, is_stalled, IS_STALLED)
|
|
|
|
HANDLE_KEY(leftUntilDone, left_until_done, LEFT_UNTIL_DONE)
|
|
|
|
HANDLE_KEY(manualAnnounceTime, manual_announce_time, MANUAL_ANNOUNCE_TIME)
|
|
|
|
HANDLE_KEY(metadataPercentComplete, metadata_percent_complete, METADATA_PERCENT_COMPLETE)
|
|
|
|
HANDLE_KEY(name, name, NAME)
|
|
|
|
HANDLE_KEY(peer_limit, peer_limit, PEER_LIMIT)
|
|
|
|
HANDLE_KEY(peers, peers, PEERS)
|
|
|
|
HANDLE_KEY(peersConnected, peers_connected, PEERS_CONNECTED)
|
|
|
|
HANDLE_KEY(peersGettingFromUs, peers_getting_from_us, PEERS_GETTING_FROM_US)
|
|
|
|
HANDLE_KEY(peersSendingToUs, peers_sending_to_us, PEERS_SENDING_TO_US)
|
|
|
|
HANDLE_KEY(percentDone, percent_done, PERCENT_DONE)
|
|
|
|
HANDLE_KEY(pieceCount, piece_count, PIECE_COUNT)
|
|
|
|
HANDLE_KEY(pieceSize, piece_size, PIECE_SIZE)
|
2020-10-13 15:33:56 +00:00
|
|
|
HANDLE_KEY(primary_mime_type, primary_mime_type, PRIMARY_MIME_TYPE)
|
2020-06-23 21:11:16 +00:00
|
|
|
HANDLE_KEY(queuePosition, queue_position, QUEUE_POSITION)
|
|
|
|
HANDLE_KEY(rateDownload, download_speed, DOWNLOAD_SPEED)
|
|
|
|
HANDLE_KEY(rateUpload, upload_speed, UPLOAD_SPEED)
|
|
|
|
HANDLE_KEY(recheckProgress, recheck_progress, RECHECK_PROGRESS)
|
|
|
|
HANDLE_KEY(seedIdleLimit, seed_idle_limit, SEED_IDLE_LIMIT)
|
|
|
|
HANDLE_KEY(seedIdleMode, seed_idle_mode, SEED_IDLE_MODE)
|
|
|
|
HANDLE_KEY(seedRatioLimit, seed_ratio_limit, SEED_RATIO_LIMIT)
|
|
|
|
HANDLE_KEY(seedRatioMode, seed_ratio_mode, SEED_RATIO_MODE)
|
|
|
|
HANDLE_KEY(sizeWhenDone, size_when_done, SIZE_WHEN_DONE)
|
|
|
|
HANDLE_KEY(startDate, start_date, START_DATE)
|
|
|
|
HANDLE_KEY(status, status, STATUS)
|
|
|
|
HANDLE_KEY(totalSize, total_size, TOTAL_SIZE)
|
|
|
|
HANDLE_KEY(trackerStats, tracker_stats, TRACKER_STATS)
|
|
|
|
HANDLE_KEY(trackers, tracker_stats, TRACKER_STATS)
|
|
|
|
HANDLE_KEY(uploadLimit, upload_limit, UPLOAD_LIMIT) // KB/s
|
|
|
|
HANDLE_KEY(uploadLimited, upload_limited, UPLOAD_LIMITED)
|
|
|
|
HANDLE_KEY(uploadedEver, uploaded_ever, UPLOADED_EVER)
|
|
|
|
HANDLE_KEY(webseedsSendingToUs, webseeds_sending_to_us, WEBSEEDS_SENDING_TO_US)
|
2020-09-08 03:52:29 +00:00
|
|
|
#undef HANDLE_KEY
|
|
|
|
|
2021-08-15 09:41:48 +00:00
|
|
|
#define HANDLE_KEY(key, field, bit) \
|
|
|
|
case TR_KEY_##key: \
|
|
|
|
field_changed = change(field##_, child); \
|
|
|
|
if (field_changed) \
|
|
|
|
{ \
|
|
|
|
field##_ = trApp->intern(field##_); \
|
|
|
|
} \
|
|
|
|
changed.set(bit, field_changed); \
|
|
|
|
break;
|
2020-09-08 03:52:29 +00:00
|
|
|
|
|
|
|
HANDLE_KEY(comment, comment, COMMENT)
|
|
|
|
HANDLE_KEY(creator, creator, CREATOR)
|
|
|
|
HANDLE_KEY(downloadDir, download_dir, DOWNLOAD_DIR)
|
|
|
|
HANDLE_KEY(errorString, error_string, ERROR_STRING)
|
|
|
|
|
2020-05-19 23:42:17 +00:00
|
|
|
#undef HANDLE_KEY
|
|
|
|
default:
|
|
|
|
break;
|
2017-04-19 12:04:45 +00:00
|
|
|
}
|
2009-04-09 18:55:47 +00:00
|
|
|
|
2020-05-19 23:42:17 +00:00
|
|
|
if (field_changed)
|
2009-04-09 18:55:47 +00:00
|
|
|
{
|
2020-05-19 23:42:17 +00:00
|
|
|
switch (key)
|
2012-12-22 20:35:19 +00:00
|
|
|
{
|
2020-10-13 15:33:56 +00:00
|
|
|
case TR_KEY_file_count:
|
|
|
|
case TR_KEY_primary_mime_type:
|
2017-04-19 12:04:45 +00:00
|
|
|
{
|
2020-09-08 16:51:33 +00:00
|
|
|
icon_ = {};
|
2020-05-19 23:42:17 +00:00
|
|
|
break;
|
2017-04-19 12:04:45 +00:00
|
|
|
}
|
|
|
|
|
2020-05-19 23:42:17 +00:00
|
|
|
case TR_KEY_files:
|
2017-04-19 12:04:45 +00:00
|
|
|
{
|
Qt 6 support (#2069)
* Bump minimum Qt version to 5.6
* Switch from QRegExp to QRegularExpression
While still available, QRegExp has been moved to Qt6::Core5Compat module
and is not part of Qt6::Core.
* Use qIsEffectiveTLD instead of QUrl::topLevelDomain
The latter is not part of Qt6::Core. The former is a private utility in
Qt6::Network; using it for now, until (and if) we switch to something
non-Qt-specific.
* Use QStyle::State_Horizontal state when drawing progress bars
Although available for a long time, this state either didn't apply to
progress bars before Qt 6, or was deduced based on bar size. With Qt 6,
failing to specify it results in bad rendering.
* Don't use QStringRef (and associated methods)
While still available, QStringRef has been moved to Qt6::Core5Compat
module and is not part of Qt6::Core. Related method (e.g.
QString::midRef) have been removed in Qt 6.
* Use Qt::ItemIsAutoTristate instead of Qt::ItemIsTristate
The latter was deprecated and replaced with the former in Qt 5.6.
* Don't use QApplication::globalStrut
This property has been deprecated in Qt 5.15 and removed in Qt 6.
* Use QImage::fromHICON instead of QtWin::fromHICON
WinExtras module (providind the latter helper) has been removed in Qt 6.
* Use QStringDecoder instead of QTextCodec
While still available, QTextCodec has been moved to Qt6::Core5Compat
module and is not part of Qt6::Core.
* Don't forward-declare QStringList
Instead of being a standalone class, its definition has changed to
QList<QString> template specialization in Qt 6.
* Use explicit (since Qt 6) QFileInfo constructor
* Use QDateTime's {to,from}SecsSinceEpoch instead of {to,from}Time_t
The latter was deprecated in Qt 5.8 and removed in Qt 6.
* Don't use QFuture<>'s operator==
It has been removed in Qt 6. Since the original issue this code was
solving was caused by future reuse, just don't reuse futures and create
new finished ones when necessary.
* Use std::vector<> instead of QVector<>
The latter has been changed to a typedef for QList<>, which might not be
what one wants, and which also changed behavior a bit leading to
compilation errors.
* Don't use + for flags, cast to int explicitly
Operator+ for enum values has been deleted in Qt 6, so using operator|
instead. Then, there's no conversion from QFlags<> to QVariant, so need
to cast to int.
* Support Qt 6 in CMake and for MSI packaging
* Remove extra (empty) CMake variable use when constructing Qt target names
* Simplify logic in tr_qt_add_translation CMake helper
Co-authored-by: Charles Kerr <charles@charleskerr.com>
2021-11-03 21:20:11 +00:00
|
|
|
for (size_t i = 0; i < files_.size(); ++i)
|
2019-11-06 21:09:04 +00:00
|
|
|
{
|
2020-05-19 23:42:17 +00:00
|
|
|
files_[i].index = i;
|
2019-11-06 21:09:04 +00:00
|
|
|
}
|
2020-05-19 23:42:17 +00:00
|
|
|
break;
|
2017-04-19 12:04:45 +00:00
|
|
|
}
|
|
|
|
|
2020-05-19 23:42:17 +00:00
|
|
|
case TR_KEY_trackers:
|
2017-04-19 12:04:45 +00:00
|
|
|
{
|
2022-02-12 17:30:27 +00:00
|
|
|
auto tmp = std::set<QString>{};
|
2020-09-08 13:58:14 +00:00
|
|
|
for (auto const& ts : tracker_stats_)
|
|
|
|
{
|
2022-02-12 17:30:27 +00:00
|
|
|
tmp.insert(ts.sitename);
|
2020-09-08 13:58:14 +00:00
|
|
|
}
|
2022-02-12 17:30:27 +00:00
|
|
|
sitenames_ = std::vector<QString>{ std::begin(tmp), std::end(tmp) };
|
2020-05-19 23:42:17 +00:00
|
|
|
break;
|
|
|
|
}
|
2017-04-19 12:04:45 +00:00
|
|
|
}
|
2009-04-09 18:55:47 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2019-11-09 14:44:40 +00:00
|
|
|
return changed;
|
2009-04-09 18:55:47 +00:00
|
|
|
}
|
|
|
|
|
2017-04-19 12:04:45 +00:00
|
|
|
QString Torrent::activityString() const
|
2009-04-09 18:55:47 +00:00
|
|
|
{
|
2017-04-19 12:04:45 +00:00
|
|
|
QString str;
|
2009-04-09 18:55:47 +00:00
|
|
|
|
2017-04-19 12:04:45 +00:00
|
|
|
switch (getActivity())
|
2009-04-09 18:55:47 +00:00
|
|
|
{
|
2017-04-19 12:04:45 +00:00
|
|
|
case TR_STATUS_STOPPED:
|
|
|
|
str = isFinished() ? tr("Finished") : tr("Paused");
|
|
|
|
break;
|
|
|
|
|
|
|
|
case TR_STATUS_CHECK_WAIT:
|
|
|
|
str = tr("Queued for verification");
|
|
|
|
break;
|
|
|
|
|
|
|
|
case TR_STATUS_CHECK:
|
|
|
|
str = tr("Verifying local data");
|
|
|
|
break;
|
|
|
|
|
|
|
|
case TR_STATUS_DOWNLOAD_WAIT:
|
|
|
|
str = tr("Queued for download");
|
|
|
|
break;
|
|
|
|
|
|
|
|
case TR_STATUS_DOWNLOAD:
|
|
|
|
str = tr("Downloading");
|
|
|
|
break;
|
|
|
|
|
|
|
|
case TR_STATUS_SEED_WAIT:
|
|
|
|
str = tr("Queued for seeding");
|
|
|
|
break;
|
|
|
|
|
|
|
|
case TR_STATUS_SEED:
|
|
|
|
str = tr("Seeding");
|
|
|
|
break;
|
2009-04-09 18:55:47 +00:00
|
|
|
}
|
|
|
|
|
2017-04-19 12:04:45 +00:00
|
|
|
return str;
|
2009-04-09 18:55:47 +00:00
|
|
|
}
|
2009-08-05 01:25:36 +00:00
|
|
|
|
2017-04-19 12:04:45 +00:00
|
|
|
QString Torrent::getError() const
|
2009-08-05 01:25:36 +00:00
|
|
|
{
|
2020-05-27 21:53:12 +00:00
|
|
|
auto s = error_string_;
|
2009-08-05 01:25:36 +00:00
|
|
|
|
2020-05-19 23:42:17 +00:00
|
|
|
switch (error_)
|
2009-08-05 01:25:36 +00:00
|
|
|
{
|
2017-04-19 12:04:45 +00:00
|
|
|
case TR_STAT_TRACKER_WARNING:
|
|
|
|
s = tr("Tracker gave a warning: %1").arg(s);
|
|
|
|
break;
|
|
|
|
|
|
|
|
case TR_STAT_TRACKER_ERROR:
|
|
|
|
s = tr("Tracker gave an error: %1").arg(s);
|
|
|
|
break;
|
|
|
|
|
|
|
|
case TR_STAT_LOCAL_ERROR:
|
|
|
|
s = tr("Error: %1").arg(s);
|
|
|
|
break;
|
|
|
|
|
|
|
|
default:
|
|
|
|
s.clear();
|
|
|
|
break;
|
2009-08-05 01:25:36 +00:00
|
|
|
}
|
|
|
|
|
2017-04-19 12:04:45 +00:00
|
|
|
return s;
|
2009-08-05 01:25:36 +00:00
|
|
|
}
|
2010-07-27 19:43:32 +00:00
|
|
|
|
2017-04-19 12:04:45 +00:00
|
|
|
QPixmap TrackerStat::getFavicon() const
|
2010-07-27 19:43:32 +00:00
|
|
|
{
|
2022-02-12 17:30:27 +00:00
|
|
|
return trApp->faviconCache().find(sitename);
|
2010-07-27 19:43:32 +00:00
|
|
|
}
|