mirror of
https://github.com/d47081/qBittorrent.git
synced 2025-01-12 07:48:04 +00:00
parent
30c2f9d9f3
commit
a71d7e6557
@ -40,6 +40,9 @@
|
||||
using SHA1Hash = Digest32<160>;
|
||||
using SHA256Hash = Digest32<256>;
|
||||
|
||||
Q_DECLARE_METATYPE(SHA1Hash)
|
||||
Q_DECLARE_METATYPE(SHA256Hash)
|
||||
|
||||
namespace BitTorrent
|
||||
{
|
||||
class InfoHash;
|
||||
|
@ -34,6 +34,7 @@
|
||||
#include <QDebug>
|
||||
#include <QPalette>
|
||||
|
||||
#include "base/bittorrent/infohash.h"
|
||||
#include "base/bittorrent/session.h"
|
||||
#include "base/bittorrent/torrent.h"
|
||||
#include "base/global.h"
|
||||
@ -224,12 +225,15 @@ QVariant TransferListModel::headerData(const int section, const Qt::Orientation
|
||||
case TR_AMOUNT_LEFT: return tr("Remaining", "Amount of data left to download (e.g. in MB)");
|
||||
case TR_TIME_ELAPSED: return tr("Time Active", "Time (duration) the torrent is active (not paused)");
|
||||
case TR_SAVE_PATH: return tr("Save path", "Torrent save path");
|
||||
case TR_DOWNLOAD_PATH: return tr("Incomplete Save Path", "Torrent incomplete save path");
|
||||
case TR_COMPLETED: return tr("Completed", "Amount of data completed (e.g. in MB)");
|
||||
case TR_RATIO_LIMIT: return tr("Ratio Limit", "Upload share ratio limit");
|
||||
case TR_SEEN_COMPLETE_DATE: return tr("Last Seen Complete", "Indicates the time when the torrent was last seen complete/whole");
|
||||
case TR_LAST_ACTIVITY: return tr("Last Activity", "Time passed since a chunk was downloaded/uploaded");
|
||||
case TR_TOTAL_SIZE: return tr("Total Size", "i.e. Size including unwanted data");
|
||||
case TR_AVAILABILITY: return tr("Availability", "The number of distributed copies of the torrent");
|
||||
case TR_INFOHASH_V1: return tr("Info Hash v1", "i.e: torrent info hash v1");
|
||||
case TR_INFOHASH_V2: return tr("Info Hash v2", "i.e: torrent info hash v2");
|
||||
default: return {};
|
||||
}
|
||||
}
|
||||
@ -424,6 +428,8 @@ QString TransferListModel::displayValue(const BitTorrent::Torrent *torrent, cons
|
||||
return timeElapsedString(torrent->activeTime(), torrent->finishedTime());
|
||||
case TR_SAVE_PATH:
|
||||
return torrent->savePath().toString();
|
||||
case TR_DOWNLOAD_PATH:
|
||||
return torrent->downloadPath().toString();
|
||||
case TR_COMPLETED:
|
||||
return unitString(torrent->completedSize());
|
||||
case TR_SEEN_COMPLETE_DATE:
|
||||
@ -434,6 +440,10 @@ QString TransferListModel::displayValue(const BitTorrent::Torrent *torrent, cons
|
||||
return availabilityString(torrent->distributedCopies());
|
||||
case TR_TOTAL_SIZE:
|
||||
return unitString(torrent->totalSize());
|
||||
case TR_INFOHASH_V1:
|
||||
return torrent->infoHash().v1().toString();
|
||||
case TR_INFOHASH_V2:
|
||||
return torrent->infoHash().v2().toString();
|
||||
}
|
||||
|
||||
return {};
|
||||
@ -491,6 +501,8 @@ QVariant TransferListModel::internalValue(const BitTorrent::Torrent *torrent, co
|
||||
return torrent->remainingSize();
|
||||
case TR_TIME_ELAPSED:
|
||||
return !alt ? torrent->activeTime() : torrent->finishedTime();
|
||||
case TR_DOWNLOAD_PATH:
|
||||
return torrent->downloadPath().data();
|
||||
case TR_SAVE_PATH:
|
||||
return torrent->savePath().toString();
|
||||
case TR_COMPLETED:
|
||||
@ -505,6 +517,10 @@ QVariant TransferListModel::internalValue(const BitTorrent::Torrent *torrent, co
|
||||
return torrent->distributedCopies();
|
||||
case TR_TOTAL_SIZE:
|
||||
return torrent->totalSize();
|
||||
case TR_INFOHASH_V1:
|
||||
return QVariant::fromValue(torrent->infoHash().v1());
|
||||
case TR_INFOHASH_V2:
|
||||
return QVariant::fromValue(torrent->infoHash().v2());
|
||||
}
|
||||
|
||||
return {};
|
||||
@ -540,6 +556,9 @@ QVariant TransferListModel::data(const QModelIndex &index, const int role) const
|
||||
case TR_TAGS:
|
||||
case TR_TRACKER:
|
||||
case TR_SAVE_PATH:
|
||||
case TR_DOWNLOAD_PATH:
|
||||
case TR_INFOHASH_V1:
|
||||
case TR_INFOHASH_V2:
|
||||
return displayValue(torrent, index.column());
|
||||
}
|
||||
break;
|
||||
|
@ -81,6 +81,9 @@ public:
|
||||
TR_SEEN_COMPLETE_DATE,
|
||||
TR_LAST_ACTIVITY,
|
||||
TR_AVAILABILITY,
|
||||
TR_DOWNLOAD_PATH,
|
||||
TR_INFOHASH_V1,
|
||||
TR_INFOHASH_V2,
|
||||
|
||||
NB_COLUMNS
|
||||
};
|
||||
|
@ -163,11 +163,18 @@ int TransferListSortModel::compare(const QModelIndex &left, const QModelIndex &r
|
||||
switch (compareColumn)
|
||||
{
|
||||
case TransferListModel::TR_CATEGORY:
|
||||
case TransferListModel::TR_DOWNLOAD_PATH:
|
||||
case TransferListModel::TR_NAME:
|
||||
case TransferListModel::TR_SAVE_PATH:
|
||||
case TransferListModel::TR_TRACKER:
|
||||
return m_naturalCompare(leftValue.toString(), rightValue.toString());
|
||||
|
||||
case TransferListModel::TR_INFOHASH_V1:
|
||||
return threeWayCompare(leftValue.value<SHA1Hash>(), rightValue.value<SHA1Hash>());
|
||||
|
||||
case TransferListModel::TR_INFOHASH_V2:
|
||||
return threeWayCompare(leftValue.value<SHA256Hash>(), rightValue.value<SHA256Hash>());
|
||||
|
||||
case TransferListModel::TR_TAGS:
|
||||
return customCompare(leftValue.value<TagSet>(), rightValue.value<TagSet>(), m_naturalCompare);
|
||||
|
||||
|
@ -171,6 +171,9 @@ TransferListWidget::TransferListWidget(QWidget *parent, MainWindow *mainWindow)
|
||||
setColumnHidden(TransferListModel::TR_AMOUNT_LEFT, true);
|
||||
setColumnHidden(TransferListModel::TR_TIME_ELAPSED, true);
|
||||
setColumnHidden(TransferListModel::TR_SAVE_PATH, true);
|
||||
setColumnHidden(TransferListModel::TR_DOWNLOAD_PATH, true);
|
||||
setColumnHidden(TransferListModel::TR_INFOHASH_V1, true);
|
||||
setColumnHidden(TransferListModel::TR_INFOHASH_V2, true);
|
||||
setColumnHidden(TransferListModel::TR_COMPLETED, true);
|
||||
setColumnHidden(TransferListModel::TR_RATIO_LIMIT, true);
|
||||
setColumnHidden(TransferListModel::TR_SEEN_COMPLETE_DATE, true);
|
||||
|
Loading…
Reference in New Issue
Block a user