|
|
@ -59,7 +59,7 @@ TransferListWidget::TransferListWidget(QWidget *parent, GUI *main_window, Bittor |
|
|
|
setItemDelegate(listDelegate); |
|
|
|
setItemDelegate(listDelegate); |
|
|
|
|
|
|
|
|
|
|
|
// Create transfer list model
|
|
|
|
// Create transfer list model
|
|
|
|
listModel = new QStandardItemModel(0,15); |
|
|
|
listModel = new QStandardItemModel(0,17); |
|
|
|
listModel->setHeaderData(TR_NAME, Qt::Horizontal, tr("Name", "i.e: torrent name")); |
|
|
|
listModel->setHeaderData(TR_NAME, Qt::Horizontal, tr("Name", "i.e: torrent name")); |
|
|
|
listModel->setHeaderData(TR_PRIORITY, Qt::Horizontal, "#"); |
|
|
|
listModel->setHeaderData(TR_PRIORITY, Qt::Horizontal, "#"); |
|
|
|
listModel->horizontalHeaderItem(TR_PRIORITY)->setTextAlignment(Qt::AlignRight); |
|
|
|
listModel->horizontalHeaderItem(TR_PRIORITY)->setTextAlignment(Qt::AlignRight); |
|
|
@ -80,8 +80,12 @@ TransferListWidget::TransferListWidget(QWidget *parent, GUI *main_window, Bittor |
|
|
|
listModel->horizontalHeaderItem(TR_RATIO)->setTextAlignment(Qt::AlignRight); |
|
|
|
listModel->horizontalHeaderItem(TR_RATIO)->setTextAlignment(Qt::AlignRight); |
|
|
|
listModel->setHeaderData(TR_ETA, Qt::Horizontal, tr("ETA", "i.e: Estimated Time of Arrival / Time left")); |
|
|
|
listModel->setHeaderData(TR_ETA, Qt::Horizontal, tr("ETA", "i.e: Estimated Time of Arrival / Time left")); |
|
|
|
listModel->setHeaderData(TR_LABEL, Qt::Horizontal, tr("Label")); |
|
|
|
listModel->setHeaderData(TR_LABEL, Qt::Horizontal, tr("Label")); |
|
|
|
listModel->setHeaderData(TR_ADD_DATE, Qt::Horizontal, tr("Added on", "Torrent was added to transfer list on 01/01/2010 08:00")); |
|
|
|
listModel->setHeaderData(TR_ADD_DATE, Qt::Horizontal, tr("Added On", "Torrent was added to transfer list on 01/01/2010 08:00")); |
|
|
|
listModel->setHeaderData(TR_SEED_DATE, Qt::Horizontal, tr("Completed on", "Torrent was completed on 01/01/2010 08:00")); |
|
|
|
listModel->setHeaderData(TR_SEED_DATE, Qt::Horizontal, tr("Completed On", "Torrent was completed on 01/01/2010 08:00")); |
|
|
|
|
|
|
|
listModel->setHeaderData(TR_DLLIMIT, Qt::Horizontal, tr("Down Limit", "i.e: Download limit")); |
|
|
|
|
|
|
|
listModel->horizontalHeaderItem(TR_DLLIMIT)->setTextAlignment(Qt::AlignRight); |
|
|
|
|
|
|
|
listModel->setHeaderData(TR_UPLIMIT, Qt::Horizontal, tr("Up Limit", "i.e: Upload limit"));; |
|
|
|
|
|
|
|
listModel->horizontalHeaderItem(TR_UPLIMIT)->setTextAlignment(Qt::AlignRight); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// Set Sort/Filter proxy
|
|
|
|
// Set Sort/Filter proxy
|
|
|
@ -168,6 +172,8 @@ void TransferListWidget::addTorrent(QTorrentHandle& h) { |
|
|
|
listModel->setData(listModel->index(row, TR_PEERS), QVariant((double)0.0)); |
|
|
|
listModel->setData(listModel->index(row, TR_PEERS), QVariant((double)0.0)); |
|
|
|
listModel->setData(listModel->index(row, TR_ADD_DATE), QVariant(TorrentPersistentData::getAddedDate(h.hash()))); |
|
|
|
listModel->setData(listModel->index(row, TR_ADD_DATE), QVariant(TorrentPersistentData::getAddedDate(h.hash()))); |
|
|
|
listModel->setData(listModel->index(row, TR_SEED_DATE), QVariant(TorrentPersistentData::getSeedDate(h.hash()))); |
|
|
|
listModel->setData(listModel->index(row, TR_SEED_DATE), QVariant(TorrentPersistentData::getSeedDate(h.hash()))); |
|
|
|
|
|
|
|
listModel->setData(listModel->index(row, TR_UPLIMIT), QVariant(h.upload_limit())); |
|
|
|
|
|
|
|
listModel->setData(listModel->index(row, TR_DLLIMIT), QVariant(h.download_limit())); |
|
|
|
QString label = TorrentPersistentData::getLabel(h.hash()); |
|
|
|
QString label = TorrentPersistentData::getLabel(h.hash()); |
|
|
|
listModel->setData(listModel->index(row, TR_LABEL), QVariant(label)); |
|
|
|
listModel->setData(listModel->index(row, TR_LABEL), QVariant(label)); |
|
|
|
if(BTSession->isQueueingEnabled()) |
|
|
|
if(BTSession->isQueueingEnabled()) |
|
|
@ -298,6 +304,7 @@ int TransferListWidget::updateTorrent(int row) { |
|
|
|
return s; |
|
|
|
return s; |
|
|
|
} |
|
|
|
} |
|
|
|
try { |
|
|
|
try { |
|
|
|
|
|
|
|
if(!isColumnHidden(TR_SEEDS)) { |
|
|
|
// Connected_seeds*100000+total_seeds*10 (if total_seeds is available)
|
|
|
|
// Connected_seeds*100000+total_seeds*10 (if total_seeds is available)
|
|
|
|
// Connected_seeds*100000+1 (if total_seeds is unavailable)
|
|
|
|
// Connected_seeds*100000+1 (if total_seeds is unavailable)
|
|
|
|
qulonglong seeds = h.num_seeds()*1000000; |
|
|
|
qulonglong seeds = h.num_seeds()*1000000; |
|
|
@ -306,15 +313,23 @@ int TransferListWidget::updateTorrent(int row) { |
|
|
|
else |
|
|
|
else |
|
|
|
seeds += 1; |
|
|
|
seeds += 1; |
|
|
|
listModel->setData(listModel->index(row, TR_SEEDS), QVariant(seeds)); |
|
|
|
listModel->setData(listModel->index(row, TR_SEEDS), QVariant(seeds)); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
if(!isColumnHidden(TR_PEERS)) { |
|
|
|
qulonglong peers = (h.num_peers()-h.num_seeds())*1000000; |
|
|
|
qulonglong peers = (h.num_peers()-h.num_seeds())*1000000; |
|
|
|
if(h.num_incomplete() >= (h.num_peers()-h.num_seeds())) |
|
|
|
if(h.num_incomplete() >= (h.num_peers()-h.num_seeds())) |
|
|
|
peers += h.num_incomplete()*10; |
|
|
|
peers += h.num_incomplete()*10; |
|
|
|
else |
|
|
|
else |
|
|
|
peers += 1; |
|
|
|
peers += 1; |
|
|
|
listModel->setData(listModel->index(row, TR_PEERS), QVariant(peers)); |
|
|
|
listModel->setData(listModel->index(row, TR_PEERS), QVariant(peers)); |
|
|
|
|
|
|
|
} |
|
|
|
// Update torrent size. It changes when files are filtered from torrent properties
|
|
|
|
// Update torrent size. It changes when files are filtered from torrent properties
|
|
|
|
// or Web UI
|
|
|
|
// or Web UI
|
|
|
|
listModel->setData(listModel->index(row, TR_SIZE), QVariant((qlonglong)h.actual_size())); |
|
|
|
listModel->setData(listModel->index(row, TR_SIZE), QVariant((qlonglong)h.actual_size())); |
|
|
|
|
|
|
|
// Update Up/Dl limits
|
|
|
|
|
|
|
|
if(!isColumnHidden(TR_UPLIMIT)) |
|
|
|
|
|
|
|
listModel->setData(listModel->index(row, TR_UPLIMIT), QVariant((qlonglong)h.upload_limit())); |
|
|
|
|
|
|
|
if(!isColumnHidden(TR_DLLIMIT)) |
|
|
|
|
|
|
|
listModel->setData(listModel->index(row, TR_DLLIMIT), QVariant((qlonglong)h.download_limit())); |
|
|
|
// Queueing code
|
|
|
|
// Queueing code
|
|
|
|
if(!h.is_seed() && BTSession->isQueueingEnabled()) { |
|
|
|
if(!h.is_seed() && BTSession->isQueueingEnabled()) { |
|
|
|
listModel->setData(listModel->index(row, TR_PRIORITY), QVariant((int)h.queue_position())); |
|
|
|
listModel->setData(listModel->index(row, TR_PRIORITY), QVariant((int)h.queue_position())); |
|
|
@ -343,7 +358,9 @@ int TransferListWidget::updateTorrent(int row) { |
|
|
|
// Reset speeds and seeds/leech
|
|
|
|
// Reset speeds and seeds/leech
|
|
|
|
listModel->setData(listModel->index(row, TR_DLSPEED), QVariant((double)0.)); |
|
|
|
listModel->setData(listModel->index(row, TR_DLSPEED), QVariant((double)0.)); |
|
|
|
listModel->setData(listModel->index(row, TR_UPSPEED), QVariant((double)0.)); |
|
|
|
listModel->setData(listModel->index(row, TR_UPSPEED), QVariant((double)0.)); |
|
|
|
|
|
|
|
if(!isColumnHidden(TR_SEEDS)) |
|
|
|
listModel->setData(listModel->index(row, TR_SEEDS), QVariant(0.0)); |
|
|
|
listModel->setData(listModel->index(row, TR_SEEDS), QVariant(0.0)); |
|
|
|
|
|
|
|
if(!isColumnHidden(TR_PEERS)) |
|
|
|
listModel->setData(listModel->index(row, TR_PEERS), QVariant(0.0)); |
|
|
|
listModel->setData(listModel->index(row, TR_PEERS), QVariant(0.0)); |
|
|
|
setRowColor(row, QString::fromUtf8("grey")); |
|
|
|
setRowColor(row, QString::fromUtf8("grey")); |
|
|
|
return s; |
|
|
|
return s; |
|
|
@ -372,6 +389,7 @@ int TransferListWidget::updateTorrent(int row) { |
|
|
|
listModel->setData(listModel->index(row, TR_NAME), QVariant(QIcon(QString::fromUtf8(":/Icons/skin/checkingDL.png"))), Qt::DecorationRole); |
|
|
|
listModel->setData(listModel->index(row, TR_NAME), QVariant(QIcon(QString::fromUtf8(":/Icons/skin/checkingDL.png"))), Qt::DecorationRole); |
|
|
|
} |
|
|
|
} |
|
|
|
listModel->setData(listModel->index(row, TR_PROGRESS), QVariant((double)h.progress())); |
|
|
|
listModel->setData(listModel->index(row, TR_PROGRESS), QVariant((double)h.progress())); |
|
|
|
|
|
|
|
if(!isColumnHidden(TR_ETA)) |
|
|
|
listModel->setData(listModel->index(row, TR_ETA), QVariant((qlonglong)-1)); |
|
|
|
listModel->setData(listModel->index(row, TR_ETA), QVariant((qlonglong)-1)); |
|
|
|
setRowColor(row, QString::fromUtf8("grey")); |
|
|
|
setRowColor(row, QString::fromUtf8("grey")); |
|
|
|
break; |
|
|
|
break; |
|
|
@ -379,11 +397,13 @@ int TransferListWidget::updateTorrent(int row) { |
|
|
|
case torrent_status::downloading_metadata: |
|
|
|
case torrent_status::downloading_metadata: |
|
|
|
if(h.download_payload_rate() > 0) { |
|
|
|
if(h.download_payload_rate() > 0) { |
|
|
|
listModel->setData(listModel->index(row, TR_NAME), QVariant(QIcon(QString::fromUtf8(":/Icons/skin/downloading.png"))), Qt::DecorationRole); |
|
|
|
listModel->setData(listModel->index(row, TR_NAME), QVariant(QIcon(QString::fromUtf8(":/Icons/skin/downloading.png"))), Qt::DecorationRole); |
|
|
|
|
|
|
|
if(!isColumnHidden(TR_ETA)) |
|
|
|
listModel->setData(listModel->index(row, TR_ETA), QVariant((qlonglong)BTSession->getETA(hash))); |
|
|
|
listModel->setData(listModel->index(row, TR_ETA), QVariant((qlonglong)BTSession->getETA(hash))); |
|
|
|
s = STATE_DOWNLOADING; |
|
|
|
s = STATE_DOWNLOADING; |
|
|
|
setRowColor(row, QString::fromUtf8("green")); |
|
|
|
setRowColor(row, QString::fromUtf8("green")); |
|
|
|
}else{ |
|
|
|
}else{ |
|
|
|
listModel->setData(listModel->index(row, TR_NAME), QVariant(QIcon(QString::fromUtf8(":/Icons/skin/stalledDL.png"))), Qt::DecorationRole); |
|
|
|
listModel->setData(listModel->index(row, TR_NAME), QVariant(QIcon(QString::fromUtf8(":/Icons/skin/stalledDL.png"))), Qt::DecorationRole); |
|
|
|
|
|
|
|
if(!isColumnHidden(TR_ETA)) |
|
|
|
listModel->setData(listModel->index(row, TR_ETA), QVariant((qlonglong)-1)); |
|
|
|
listModel->setData(listModel->index(row, TR_ETA), QVariant((qlonglong)-1)); |
|
|
|
s = STATE_STALLED_DL; |
|
|
|
s = STATE_STALLED_DL; |
|
|
|
setRowColor(row, QApplication::palette().color(QPalette::WindowText)); |
|
|
|
setRowColor(row, QApplication::palette().color(QPalette::WindowText)); |
|
|
@ -407,6 +427,7 @@ int TransferListWidget::updateTorrent(int row) { |
|
|
|
listModel->setData(listModel->index(row, TR_STATUS), s); |
|
|
|
listModel->setData(listModel->index(row, TR_STATUS), s); |
|
|
|
listModel->setData(listModel->index(row, TR_UPSPEED), QVariant((double)h.upload_payload_rate())); |
|
|
|
listModel->setData(listModel->index(row, TR_UPSPEED), QVariant((double)h.upload_payload_rate())); |
|
|
|
// Share ratio
|
|
|
|
// Share ratio
|
|
|
|
|
|
|
|
if(!isColumnHidden(TR_RATIO)) |
|
|
|
listModel->setData(listModel->index(row, TR_RATIO), QVariant(BTSession->getRealRatio(hash))); |
|
|
|
listModel->setData(listModel->index(row, TR_RATIO), QVariant(BTSession->getRealRatio(hash))); |
|
|
|
}catch(invalid_handle e) { |
|
|
|
}catch(invalid_handle e) { |
|
|
|
deleteTorrent(row, false); |
|
|
|
deleteTorrent(row, false); |
|
|
@ -830,10 +851,12 @@ bool TransferListWidget::loadHiddenColumns() { |
|
|
|
} |
|
|
|
} |
|
|
|
loaded = true; |
|
|
|
loaded = true; |
|
|
|
} |
|
|
|
} |
|
|
|
// As a default, hide date columns
|
|
|
|
// As a default, hide less useful columns
|
|
|
|
if(!loaded) { |
|
|
|
if(!loaded) { |
|
|
|
setColumnHidden(TR_ADD_DATE, true); |
|
|
|
setColumnHidden(TR_ADD_DATE, true); |
|
|
|
setColumnHidden(TR_SEED_DATE, true); |
|
|
|
setColumnHidden(TR_SEED_DATE, true); |
|
|
|
|
|
|
|
setColumnHidden(TR_UPLIMIT, true); |
|
|
|
|
|
|
|
setColumnHidden(TR_DLLIMIT, true); |
|
|
|
} |
|
|
|
} |
|
|
|
return loaded; |
|
|
|
return loaded; |
|
|
|
} |
|
|
|
} |
|
|
|