Browse Source

FEATURE: Seeds and Peers columns are now sortable

COSMETIC: Added a "torrent status" column to transfer list
COSMETIC: Display Seeds and Peers in two separate columns
adaptive-webui-19844
Christophe Dumez 15 years ago
parent
commit
7578e7404b
  1. 3
      Changelog
  2. 48
      src/TransferListDelegate.h
  3. 115
      src/TransferListWidget.cpp
  4. 2
      src/TransferListWidget.h

3
Changelog

@ -20,10 +20,13 @@
- FEATURE: Speed up qBittorrent startup - FEATURE: Speed up qBittorrent startup
- FEATURE: Display per-torrent peer list - FEATURE: Display per-torrent peer list
- FEATURE: Make sure torrent files are always sorted by name - FEATURE: Make sure torrent files are always sorted by name
- FEATURE: Seeds and Peers columns are now sortable
- COSMETIC: Merged download / upload lists - COSMETIC: Merged download / upload lists
- COSMETIC: Torrents can be filtered based on their status - COSMETIC: Torrents can be filtered based on their status
- COSMETIC: Torrent properties are now displayed in main window - COSMETIC: Torrent properties are now displayed in main window
- COSMETIC: Made program preferences scrollable for usability on small screens (e.g. netbooks) - COSMETIC: Made program preferences scrollable for usability on small screens (e.g. netbooks)
- COSMETIC: Added a "torrent status" column to transfer list
- COSMETIC: Display Seeds and Peers in two separate columns
* Thu Sep 3 2009 - Christophe Dumez <chris@qbittorrent.org> - v1.5.0 * Thu Sep 3 2009 - Christophe Dumez <chris@qbittorrent.org> - v1.5.0
- FEATURE: Added Magnet URI support - FEATURE: Added Magnet URI support

48
src/TransferListDelegate.h

@ -40,7 +40,9 @@
#include "misc.h" #include "misc.h"
// Defines for download list list columns // Defines for download list list columns
enum Column {NAME, SIZE, PROGRESS, DLSPEED, UPSPEED, SEEDSLEECH, RATIO, ETA, PRIORITY, HASH, STATUS}; enum TorrentState {STATE_STALLED, STATE_DOWNLOADING, STATE_SEEDING, STATE_PAUSED, STATE_QUEUED, STATE_CHECKING};
enum Column {NAME, SIZE, PROGRESS, STATUS, SEEDS, PEERS, DLSPEED, UPSPEED, ETA, RATIO, PRIORITY, HASH};
//enum Column {NAME, SIZE, PROGRESS, DLSPEED, UPSPEED, SEEDSLEECH, RATIO, ETA, PRIORITY, HASH, STATUS};
class TransferListDelegate: public QItemDelegate { class TransferListDelegate: public QItemDelegate {
Q_OBJECT Q_OBJECT
@ -53,14 +55,54 @@ public:
void paint(QPainter * painter, const QStyleOptionViewItem & option, const QModelIndex & index) const{ void paint(QPainter * painter, const QStyleOptionViewItem & option, const QModelIndex & index) const{
QStyleOptionViewItemV2 opt = QItemDelegate::setOptions(index, option); QStyleOptionViewItemV2 opt = QItemDelegate::setOptions(index, option);
switch(index.column()){ switch(index.column()){
case SIZE: case SIZE:{
QItemDelegate::drawBackground(painter, opt, index); QItemDelegate::drawBackground(painter, opt, index);
QItemDelegate::drawDisplay(painter, opt, option.rect, misc::friendlyUnit(index.data().toLongLong())); QItemDelegate::drawDisplay(painter, opt, option.rect, misc::friendlyUnit(index.data().toLongLong()));
break; break;
case ETA: }
case ETA:{
QItemDelegate::drawBackground(painter, opt, index); QItemDelegate::drawBackground(painter, opt, index);
QItemDelegate::drawDisplay(painter, opt, option.rect, misc::userFriendlyDuration(index.data().toLongLong())); QItemDelegate::drawDisplay(painter, opt, option.rect, misc::userFriendlyDuration(index.data().toLongLong()));
break; break;
}
case SEEDS:
case PEERS: {
qulonglong tot_val = index.data().toULongLong();
QString display = QString::number((qulonglong)tot_val/100000);
if(tot_val%2 == 0) {
// Scrape was sucessful, we have total values
display += " ("+QString::number((qulonglong)(tot_val%100000)/10)+")";
}
QItemDelegate::drawBackground(painter, opt, index);
QItemDelegate::drawDisplay(painter, opt, opt.rect, display);
break;
}
case STATUS: {
int state = index.data().toInt();
QString display = "";
switch(state) {
case STATE_DOWNLOADING:
display = tr("Downloading");
break;
case STATE_PAUSED:
display = tr("Paused");
break;
case STATE_QUEUED:
display = tr("Queued", "i.e. torrent is queued");
break;
case STATE_SEEDING:
display = tr("Seeding", "Torrent is complete and in upload-only mode");
break;
case STATE_STALLED:
display = tr("Stalled", "Torrent is waiting for download to begin");
break;
case STATE_CHECKING:
display = tr("Checking", "Torrent local data is being checked");
}
QItemDelegate::drawBackground(painter, opt, index);
QItemDelegate::drawDisplay(painter, opt, opt.rect, display);
break;
}
case UPSPEED: case UPSPEED:
case DLSPEED:{ case DLSPEED:{
QItemDelegate::drawBackground(painter, opt, index); QItemDelegate::drawBackground(painter, opt, index);

115
src/TransferListWidget.cpp

@ -56,14 +56,16 @@ TransferListWidget::TransferListWidget(QWidget *parent, bittorrent *_BTSession):
setItemDelegate(listDelegate); setItemDelegate(listDelegate);
// Create transfer list model // Create transfer list model
listModel = new QStandardItemModel(0,11); listModel = new QStandardItemModel(0,12);
listModel->setHeaderData(NAME, Qt::Horizontal, tr("Name", "i.e: file name")); listModel->setHeaderData(NAME, Qt::Horizontal, tr("Name", "i.e: torrent name"));
listModel->setHeaderData(SIZE, Qt::Horizontal, tr("Size", "i.e: file size")); listModel->setHeaderData(SIZE, Qt::Horizontal, tr("Size", "i.e: torrent size"));
listModel->setHeaderData(PROGRESS, Qt::Horizontal, "%"); listModel->setHeaderData(PROGRESS, Qt::Horizontal, tr("Done", "% Done"));
listModel->setHeaderData(STATUS, Qt::Horizontal, tr("Status", "Torrent status (e.g. downloading, seeding, paused)"));
listModel->setHeaderData(SEEDS, Qt::Horizontal, tr("Seeds", "i.e. full sources (often untranslated)"));
listModel->setHeaderData(PEERS, Qt::Horizontal, tr("Peers", "i.e. partial sources (often untranslated)"));
listModel->setHeaderData(DLSPEED, Qt::Horizontal, tr("Down Speed", "i.e: Download speed")); listModel->setHeaderData(DLSPEED, Qt::Horizontal, tr("Down Speed", "i.e: Download speed"));
listModel->setHeaderData(UPSPEED, Qt::Horizontal, tr("Up Speed", "i.e: Upload speed")); listModel->setHeaderData(UPSPEED, Qt::Horizontal, tr("Up Speed", "i.e: Upload speed"));;
listModel->setHeaderData(SEEDSLEECH, Qt::Horizontal, tr("Seeds/Leechers", "i.e: full/partial sources")); listModel->setHeaderData(RATIO, Qt::Horizontal, tr("Ratio", "Share ratio"));
listModel->setHeaderData(RATIO, Qt::Horizontal, tr("Ratio"));
listModel->setHeaderData(ETA, Qt::Horizontal, tr("ETA", "i.e: Estimated Time of Arrival / Time left")); listModel->setHeaderData(ETA, Qt::Horizontal, tr("ETA", "i.e: Estimated Time of Arrival / Time left"));
listModel->setHeaderData(PRIORITY, Qt::Horizontal, "#"); listModel->setHeaderData(PRIORITY, Qt::Horizontal, "#");
@ -85,7 +87,6 @@ TransferListWidget::TransferListWidget(QWidget *parent, bittorrent *_BTSession):
hideColumn(PRIORITY); hideColumn(PRIORITY);
hideColumn(HASH); hideColumn(HASH);
hideColumn(STATUS);
loadHiddenColumns(); loadHiddenColumns();
// Load last columns width for transfer list // Load last columns width for transfer list
if(!loadColWidthList()) { if(!loadColWidthList()) {
@ -131,18 +132,19 @@ void TransferListWidget::addTorrent(QTorrentHandle& h) {
listModel->setData(listModel->index(row, NAME), QVariant(h.name())); listModel->setData(listModel->index(row, NAME), QVariant(h.name()));
listModel->setData(listModel->index(row, SIZE), QVariant((qlonglong)h.actual_size())); listModel->setData(listModel->index(row, SIZE), QVariant((qlonglong)h.actual_size()));
listModel->setData(listModel->index(row, ETA), QVariant((qlonglong)-1)); listModel->setData(listModel->index(row, ETA), QVariant((qlonglong)-1));
listModel->setData(listModel->index(row, SEEDSLEECH), QVariant(QString::fromUtf8("0/0"))); listModel->setData(listModel->index(row, SEEDS), QVariant((double)0.0));
if(BTSession->isQueueingEnabled() && !h.is_seed()) listModel->setData(listModel->index(row, PEERS), QVariant((double)0.0));
if(BTSession->isQueueingEnabled())
listModel->setData(listModel->index(row, PRIORITY), QVariant((int)BTSession->getDlTorrentPriority(h.hash()))); listModel->setData(listModel->index(row, PRIORITY), QVariant((int)BTSession->getDlTorrentPriority(h.hash())));
listModel->setData(listModel->index(row, HASH), QVariant(h.hash())); listModel->setData(listModel->index(row, HASH), QVariant(h.hash()));
// Pause torrent if it is // Pause torrent if it is
if(h.is_paused()) { if(h.is_paused()) {
listModel->setData(listModel->index(row, NAME), QVariant(QIcon(QString::fromUtf8(":/Icons/skin/paused.png"))), Qt::DecorationRole); listModel->setData(listModel->index(row, NAME), QVariant(QIcon(QString::fromUtf8(":/Icons/skin/paused.png"))), Qt::DecorationRole);
listModel->setData(listModel->index(row, STATUS), INACTIVE); listModel->setData(listModel->index(row, STATUS), STATE_PAUSED);
//setRowColor(row, QString::fromUtf8("red")); //setRowColor(row, QString::fromUtf8("red"));
}else{ }else{
listModel->setData(listModel->index(row, NAME), QVariant(QIcon(QString::fromUtf8(":/Icons/skin/stalled.png"))), Qt::DecorationRole); listModel->setData(listModel->index(row, NAME), QVariant(QIcon(QString::fromUtf8(":/Icons/skin/stalled.png"))), Qt::DecorationRole);
listModel->setData(listModel->index(row, STATUS), DOWNLOADING); listModel->setData(listModel->index(row, STATUS), STATE_STALLED);
//setRowColor(row, QString::fromUtf8("grey")); //setRowColor(row, QString::fromUtf8("grey"));
} }
// Select first torrent to be added // Select first torrent to be added
@ -174,8 +176,9 @@ void TransferListWidget::pauseTorrent(int row) {
listModel->setData(listModel->index(row, UPSPEED), QVariant((double)0.0)); listModel->setData(listModel->index(row, UPSPEED), QVariant((double)0.0));
listModel->setData(listModel->index(row, ETA), QVariant((qlonglong)-1)); listModel->setData(listModel->index(row, ETA), QVariant((qlonglong)-1));
listModel->setData(listModel->index(row, NAME), QIcon(QString::fromUtf8(":/Icons/skin/paused.png")), Qt::DecorationRole); listModel->setData(listModel->index(row, NAME), QIcon(QString::fromUtf8(":/Icons/skin/paused.png")), Qt::DecorationRole);
listModel->setData(listModel->index(row, STATUS), INACTIVE); listModel->setData(listModel->index(row, STATUS), STATE_PAUSED);
listModel->setData(listModel->index(row, SEEDSLEECH), QVariant(QString::fromUtf8("0/0"))); listModel->setData(listModel->index(row, SEEDS), QVariant(0.0));
listModel->setData(listModel->index(row, PEERS), QVariant(0.0));
//setRowColor(row, QString::fromUtf8("red")); //setRowColor(row, QString::fromUtf8("red"));
} }
@ -184,7 +187,10 @@ void TransferListWidget::resumeTorrent(int row) {
if(!h.is_valid()) return; if(!h.is_valid()) return;
if(h.is_seed()) { if(h.is_seed()) {
listModel->setData(listModel->index(row, NAME), QVariant(QIcon(":/Icons/skin/seeding.png")), Qt::DecorationRole); listModel->setData(listModel->index(row, NAME), QVariant(QIcon(":/Icons/skin/seeding.png")), Qt::DecorationRole);
listModel->setData(listModel->index(row, STATUS), COMPLETED); listModel->setData(listModel->index(row, STATUS), STATE_SEEDING);
} else {
listModel->setData(listModel->index(row, NAME), QVariant(QIcon(":/Icons/skin/stalled.png")), Qt::DecorationRole);
listModel->setData(listModel->index(row, STATUS), STATE_STALLED);
} }
updateTorrent(row); updateTorrent(row);
} }
@ -215,17 +221,18 @@ void TransferListWidget::updateTorrent(int row) {
if(h.is_queued()) { if(h.is_queued()) {
if(h.state() == torrent_status::checking_files || h.state() == torrent_status::queued_for_checking) { if(h.state() == torrent_status::checking_files || h.state() == torrent_status::queued_for_checking) {
listModel->setData(listModel->index(row, NAME), QVariant(QIcon(QString::fromUtf8(":/Icons/oxygen/run-build.png"))), Qt::DecorationRole); listModel->setData(listModel->index(row, NAME), QVariant(QIcon(QString::fromUtf8(":/Icons/oxygen/run-build.png"))), Qt::DecorationRole);
listModel->setData(listModel->index(row, STATUS), INACTIVE); listModel->setData(listModel->index(row, STATUS), STATE_QUEUED);
listModel->setData(listModel->index(row, PROGRESS), QVariant((double)h.progress())); listModel->setData(listModel->index(row, PROGRESS), QVariant((double)h.progress()));
}else { }else {
listModel->setData(listModel->index(row, NAME), QVariant(QIcon(QString::fromUtf8(":/Icons/oxygen/mail-queue.png"))), Qt::DecorationRole); listModel->setData(listModel->index(row, NAME), QVariant(QIcon(QString::fromUtf8(":/Icons/oxygen/mail-queue.png"))), Qt::DecorationRole);
listModel->setData(listModel->index(row, STATUS), INACTIVE); listModel->setData(listModel->index(row, STATUS), STATE_QUEUED);
listModel->setData(listModel->index(row, ETA), QVariant((qlonglong)-1)); listModel->setData(listModel->index(row, ETA), QVariant((qlonglong)-1));
} }
// Reset speeds and seeds/leech // Reset speeds and seeds/leech
listModel->setData(listModel->index(row, DLSPEED), QVariant((double)0.)); listModel->setData(listModel->index(row, DLSPEED), QVariant((double)0.));
listModel->setData(listModel->index(row, UPSPEED), QVariant((double)0.)); listModel->setData(listModel->index(row, UPSPEED), QVariant((double)0.));
listModel->setData(listModel->index(row, SEEDSLEECH), QVariant("0/0")); listModel->setData(listModel->index(row, SEEDS), QVariant(0.0));
listModel->setData(listModel->index(row, PEERS), QVariant(0.0));
//setRowColor(row, QString::fromUtf8("grey")); //setRowColor(row, QString::fromUtf8("grey"));
return; return;
} }
@ -237,11 +244,13 @@ void TransferListWidget::updateTorrent(int row) {
// Parse download state // Parse download state
switch(h.state()) { switch(h.state()) {
case torrent_status::allocating:
case torrent_status::checking_files: case torrent_status::checking_files:
case torrent_status::queued_for_checking: case torrent_status::queued_for_checking:
case torrent_status::checking_resume_data: case torrent_status::checking_resume_data:
listModel->setData(listModel->index(row, NAME), QVariant(QIcon(QString::fromUtf8(":/Icons/oxygen/run-build.png"))), Qt::DecorationRole); listModel->setData(listModel->index(row, NAME), QVariant(QIcon(QString::fromUtf8(":/Icons/oxygen/run-build.png"))), Qt::DecorationRole);
listModel->setData(listModel->index(row, STATUS), INACTIVE); listModel->setData(listModel->index(row, STATUS), STATE_CHECKING);
listModel->setData(listModel->index(row, ETA), QVariant((qlonglong)-1));
//setRowColor(row, QString::fromUtf8("grey")); //setRowColor(row, QString::fromUtf8("grey"));
break; break;
case torrent_status::downloading: case torrent_status::downloading:
@ -249,31 +258,41 @@ void TransferListWidget::updateTorrent(int row) {
if(h.download_payload_rate() > 0) { if(h.download_payload_rate() > 0) {
listModel->setData(listModel->index(row, NAME), QVariant(QIcon(QString::fromUtf8(":/Icons/skin/downloading.png"))), Qt::DecorationRole); listModel->setData(listModel->index(row, NAME), QVariant(QIcon(QString::fromUtf8(":/Icons/skin/downloading.png"))), Qt::DecorationRole);
listModel->setData(listModel->index(row, ETA), QVariant((qlonglong)BTSession->getETA(hash))); listModel->setData(listModel->index(row, ETA), QVariant((qlonglong)BTSession->getETA(hash)));
listModel->setData(listModel->index(row, STATUS), STATE_DOWNLOADING);
//setRowColor(row, QString::fromUtf8("green")); //setRowColor(row, QString::fromUtf8("green"));
}else{ }else{
listModel->setData(listModel->index(row, NAME), QVariant(QIcon(QString::fromUtf8(":/Icons/skin/stalled.png"))), Qt::DecorationRole); listModel->setData(listModel->index(row, NAME), QVariant(QIcon(QString::fromUtf8(":/Icons/skin/stalled.png"))), Qt::DecorationRole);
listModel->setData(listModel->index(row, ETA), QVariant((qlonglong)-1)); listModel->setData(listModel->index(row, ETA), QVariant((qlonglong)-1));
listModel->setData(listModel->index(row, STATUS), STATE_STALLED);
//setRowColor(row, QApplication::palette().color(QPalette::WindowText)); //setRowColor(row, QApplication::palette().color(QPalette::WindowText));
} }
listModel->setData(listModel->index(row, STATUS), DOWNLOADING);
listModel->setData(listModel->index(row, UPSPEED), QVariant((double)h.upload_payload_rate())); listModel->setData(listModel->index(row, UPSPEED), QVariant((double)h.upload_payload_rate()));
break; break;
default: case torrent_status::finished:
case torrent_status::seeding:
listModel->setData(listModel->index(row, ETA), QVariant((qlonglong)-1)); listModel->setData(listModel->index(row, ETA), QVariant((qlonglong)-1));
listModel->setData(listModel->index(row, UPSPEED), QVariant((double)h.upload_payload_rate()));
listModel->setData(listModel->index(row, STATUS), STATE_SEEDING);
} }
} }
// Common to both downloads and uploads // Common to both downloads and uploads
QString tmp = misc::toQString(h.num_seeds(), true); // Connected_seeds*100000+total_seeds*10 (if total_seeds is available)
if(h.num_complete() >= 0) // Connected_seeds*100000+1 (if total_seeds is unavailable)
tmp.append(QString("(")+misc::toQString(h.num_complete())+QString(")")); qulonglong seeds = h.num_seeds()*100000;
tmp.append(QString("/")+misc::toQString(h.num_peers() - h.num_seeds(), true)); if(h.num_complete() >= h.num_seeds())
if(h.num_incomplete() >= 0) seeds += h.num_complete()*10;
tmp.append(QString("(")+misc::toQString(h.num_incomplete())+QString(")")); else
listModel->setData(listModel->index(row, SEEDSLEECH), QVariant(tmp)); seeds += 1;
listModel->setData(listModel->index(row, RATIO), QVariant(misc::toQString(BTSession->getRealRatio(hash)))); listModel->setData(listModel->index(row, SEEDS), QVariant(seeds));
listModel->setData(listModel->index(row, UPSPEED), QVariant((double)h.upload_payload_rate())); qulonglong peers = (h.num_peers()-h.num_seeds())*100000;
// FIXME: Add all_time_upload column if(h.num_incomplete() >= (h.num_peers()-h.num_seeds()))
peers += h.num_incomplete()*10;
else
peers += 1;
listModel->setData(listModel->index(row, PEERS), QVariant(peers));
// Share ratio
listModel->setData(listModel->index(row, RATIO), QVariant(BTSession->getRealRatio(hash)));
}catch(invalid_handle e) { }catch(invalid_handle e) {
deleteTorrent(row); deleteTorrent(row);
qDebug("Caught Invalid handle exception, lucky us."); qDebug("Caught Invalid handle exception, lucky us.");
@ -287,11 +306,11 @@ void TransferListWidget::setFinished(QTorrentHandle &h) {
if(row >= 0) { if(row >= 0) {
if(h.is_paused()) { if(h.is_paused()) {
listModel->setData(listModel->index(row, NAME), QIcon(":/Icons/skin/paused.png"), Qt::DecorationRole); listModel->setData(listModel->index(row, NAME), QIcon(":/Icons/skin/paused.png"), Qt::DecorationRole);
listModel->setData(listModel->index(row, STATUS), INACTIVE); listModel->setData(listModel->index(row, STATUS), STATE_PAUSED);
//setRowColor(row, "red"); //setRowColor(row, "red");
}else{ }else{
listModel->setData(listModel->index(row, NAME), QVariant(QIcon(":/Icons/skin/seeding.png")), Qt::DecorationRole); listModel->setData(listModel->index(row, NAME), QVariant(QIcon(":/Icons/skin/seeding.png")), Qt::DecorationRole);
listModel->setData(listModel->index(row, STATUS), COMPLETED); listModel->setData(listModel->index(row, STATUS), STATE_SEEDING);
//setRowColor(row, "orange"); //setRowColor(row, "orange");
} }
listModel->setData(listModel->index(row, ETA), QVariant((qlonglong)-1)); listModel->setData(listModel->index(row, ETA), QVariant((qlonglong)-1));
@ -559,7 +578,7 @@ void TransferListWidget::recheckSelectedTorrents() {
void TransferListWidget::saveHiddenColumns() { void TransferListWidget::saveHiddenColumns() {
QSettings settings("qBittorrent", "qBittorrent"); QSettings settings("qBittorrent", "qBittorrent");
QStringList ishidden_list; QStringList ishidden_list;
short nbColumns = listModel->columnCount()-2; short nbColumns = listModel->columnCount()-1;//hash column is hidden
for(short i=0; i<nbColumns; ++i){ for(short i=0; i<nbColumns; ++i){
if(isColumnHidden(i)) { if(isColumnHidden(i)) {
@ -580,7 +599,7 @@ bool TransferListWidget::loadHiddenColumns() {
QStringList ishidden_list; QStringList ishidden_list;
ishidden_list = line.split(' '); ishidden_list = line.split(' ');
unsigned int nbCol = ishidden_list.size(); unsigned int nbCol = ishidden_list.size();
if(nbCol == (unsigned int)listModel->columnCount()-2) { if(nbCol == (unsigned int)listModel->columnCount()-1) {
for(unsigned int i=0; i<nbCol; ++i){ for(unsigned int i=0; i<nbCol; ++i){
if(ishidden_list.at(i) == "0") { if(ishidden_list.at(i) == "0") {
setColumnHidden(i, true); setColumnHidden(i, true);
@ -710,7 +729,7 @@ void TransferListWidget::saveColWidthList() {
QSettings settings(QString::fromUtf8("qBittorrent"), QString::fromUtf8("qBittorrent")); QSettings settings(QString::fromUtf8("qBittorrent"), QString::fromUtf8("qBittorrent"));
QStringList width_list; QStringList width_list;
QStringList new_width_list; QStringList new_width_list;
short nbColumns = listModel->columnCount()-2; short nbColumns = listModel->columnCount()-1; // HASH is hidden
QString line = settings.value("TransferListColsWidth", QString()).toString(); QString line = settings.value("TransferListColsWidth", QString()).toString();
if(!line.isEmpty()) { if(!line.isEmpty()) {
width_list = line.split(' '); width_list = line.split(' ');
@ -745,8 +764,8 @@ bool TransferListWidget::loadColWidthList() {
if(line.isEmpty()) if(line.isEmpty())
return false; return false;
QStringList width_list = line.split(QString::fromUtf8(" ")); QStringList width_list = line.split(QString::fromUtf8(" "));
if(width_list.size() != listModel->columnCount()-2) { if(width_list.size() != listModel->columnCount()-1) {
qDebug("Corrupted values for download list columns sizes"); qDebug("Corrupted values for transfer list columns sizes");
return false; return false;
} }
unsigned int listSize = width_list.size(); unsigned int listSize = width_list.size();
@ -754,8 +773,8 @@ bool TransferListWidget::loadColWidthList() {
header()->resizeSection(i, width_list.at(i).toInt()); header()->resizeSection(i, width_list.at(i).toInt());
} }
QVariantList visualIndexes = settings.value(QString::fromUtf8("TransferListVisualIndexes"), QVariantList()).toList(); QVariantList visualIndexes = settings.value(QString::fromUtf8("TransferListVisualIndexes"), QVariantList()).toList();
if(visualIndexes.size() != listModel->columnCount()-2) { if(visualIndexes.size() != listModel->columnCount()-1) {
qDebug("Corrupted values for download list columns sizes"); qDebug("Corrupted values for transfer list columns indexes");
return false; return false;
} }
bool change = false; bool change = false;
@ -813,17 +832,17 @@ void TransferListWidget::currentChanged(const QModelIndex& current, const QModel
void TransferListWidget::applyFilter(int f) { void TransferListWidget::applyFilter(int f) {
switch(f) { switch(f) {
case DOWNLOADING: case FILTER_DOWNLOADING:
proxyModel->setFilterRegExp(QRegExp(QString::number(DOWNLOADING), Qt::CaseSensitive, QRegExp::FixedString)); proxyModel->setFilterRegExp(QRegExp(QString::number(STATE_DOWNLOADING)+"|"+QString::number(STATE_STALLED), Qt::CaseSensitive));
break; break;
case COMPLETED: case FILTER_COMPLETED:
proxyModel->setFilterRegExp(QRegExp(QString::number(COMPLETED), Qt::CaseSensitive, QRegExp::FixedString)); proxyModel->setFilterRegExp(QRegExp(QString::number(STATE_SEEDING), Qt::CaseSensitive, QRegExp::FixedString));
break; break;
case ACTIVE: case FILTER_ACTIVE:
proxyModel->setFilterRegExp(QRegExp(QString::number(DOWNLOADING)+"|"+QString::number(COMPLETED), Qt::CaseSensitive)); proxyModel->setFilterRegExp(QRegExp(QString::number(STATE_DOWNLOADING)+"|"+QString::number(STATE_SEEDING)+"|"+QString::number(STATE_STALLED), Qt::CaseSensitive));
break; break;
case INACTIVE: case FILTER_INACTIVE:
proxyModel->setFilterRegExp(QRegExp(QString::number(INACTIVE), Qt::CaseSensitive, QRegExp::FixedString)); proxyModel->setFilterRegExp(QRegExp(QString::number(STATE_CHECKING)+"|"+QString::number(STATE_PAUSED)+"|"+QString::number(STATE_QUEUED), Qt::CaseSensitive));
break; break;
default: default:
proxyModel->setFilterRegExp(QRegExp()); proxyModel->setFilterRegExp(QRegExp());

2
src/TransferListWidget.h

@ -40,7 +40,7 @@ class QSortFilterProxyModel;
class bittorrent; class bittorrent;
class QTimer; class QTimer;
enum TorrentFilter {ALL, DOWNLOADING, COMPLETED, ACTIVE, INACTIVE }; enum TorrentFilter {FILTER_ALL, FILTER_DOWNLOADING, FILTER_COMPLETED, FILTER_ACTIVE, FILTER_INACTIVE };
class TransferListWidget: public QTreeView { class TransferListWidget: public QTreeView {
Q_OBJECT Q_OBJECT

Loading…
Cancel
Save