|
|
@ -37,16 +37,15 @@ FinishedTorrents::FinishedTorrents(QObject *parent, bittorrent *BTSession) : par |
|
|
|
actionStart->setIcon(QIcon(QString::fromUtf8(":/Icons/skin/play.png"))); |
|
|
|
actionStart->setIcon(QIcon(QString::fromUtf8(":/Icons/skin/play.png"))); |
|
|
|
actionPause->setIcon(QIcon(QString::fromUtf8(":/Icons/skin/pause.png"))); |
|
|
|
actionPause->setIcon(QIcon(QString::fromUtf8(":/Icons/skin/pause.png"))); |
|
|
|
connect(BTSession, SIGNAL(addedTorrent(QString, QTorrentHandle&, bool)), this, SLOT(torrentAdded(QString, QTorrentHandle&, bool))); |
|
|
|
connect(BTSession, SIGNAL(addedTorrent(QString, QTorrentHandle&, bool)), this, SLOT(torrentAdded(QString, QTorrentHandle&, bool))); |
|
|
|
finishedListModel = new QStandardItemModel(0,7); |
|
|
|
finishedListModel = new QStandardItemModel(0,6); |
|
|
|
finishedListModel->setHeaderData(F_NAME, Qt::Horizontal, tr("Name", "i.e: file name")); |
|
|
|
finishedListModel->setHeaderData(F_NAME, Qt::Horizontal, tr("Name", "i.e: file name")); |
|
|
|
finishedListModel->setHeaderData(F_SIZE, Qt::Horizontal, tr("Size", "i.e: file size")); |
|
|
|
finishedListModel->setHeaderData(F_SIZE, Qt::Horizontal, tr("Size", "i.e: file size")); |
|
|
|
finishedListModel->setHeaderData(F_PROGRESS, Qt::Horizontal, tr("Progress", "i.e: % downloaded")); |
|
|
|
|
|
|
|
finishedListModel->setHeaderData(F_UPSPEED, Qt::Horizontal, tr("UP Speed", "i.e: Upload speed")); |
|
|
|
finishedListModel->setHeaderData(F_UPSPEED, Qt::Horizontal, tr("UP Speed", "i.e: Upload speed")); |
|
|
|
finishedListModel->setHeaderData(F_SEEDSLEECH, Qt::Horizontal, tr("Leechers", "i.e: full/partial sources")); |
|
|
|
finishedListModel->setHeaderData(F_LEECH, Qt::Horizontal, tr("Leechers", "i.e: full/partial sources")); |
|
|
|
finishedListModel->setHeaderData(F_RATIO, Qt::Horizontal, tr("Ratio")); |
|
|
|
finishedListModel->setHeaderData(F_RATIO, Qt::Horizontal, tr("Ratio")); |
|
|
|
finishedList->setModel(finishedListModel); |
|
|
|
finishedList->setModel(finishedListModel); |
|
|
|
loadHiddenColumns(); |
|
|
|
loadHiddenColumns(); |
|
|
|
// Hide ETA & hash column
|
|
|
|
// Hide hash column
|
|
|
|
finishedList->hideColumn(F_HASH); |
|
|
|
finishedList->hideColumn(F_HASH); |
|
|
|
// Load last columns width for download list
|
|
|
|
// Load last columns width for download list
|
|
|
|
if(!loadColWidthFinishedList()){ |
|
|
|
if(!loadColWidthFinishedList()){ |
|
|
@ -78,7 +77,6 @@ FinishedTorrents::FinishedTorrents(QObject *parent, bittorrent *BTSession) : par |
|
|
|
|
|
|
|
|
|
|
|
connect(actionHOSColName, SIGNAL(triggered()), this, SLOT(hideOrShowColumnName())); |
|
|
|
connect(actionHOSColName, SIGNAL(triggered()), this, SLOT(hideOrShowColumnName())); |
|
|
|
connect(actionHOSColSize, SIGNAL(triggered()), this, SLOT(hideOrShowColumnSize())); |
|
|
|
connect(actionHOSColSize, SIGNAL(triggered()), this, SLOT(hideOrShowColumnSize())); |
|
|
|
connect(actionHOSColProgress, SIGNAL(triggered()), this, SLOT(hideOrShowColumnProgress())); |
|
|
|
|
|
|
|
connect(actionHOSColUpSpeed, SIGNAL(triggered()), this, SLOT(hideOrShowColumnUpSpeed())); |
|
|
|
connect(actionHOSColUpSpeed, SIGNAL(triggered()), this, SLOT(hideOrShowColumnUpSpeed())); |
|
|
|
connect(actionHOSColLeechers, SIGNAL(triggered()), this, SLOT(hideOrShowColumnLeechers())); |
|
|
|
connect(actionHOSColLeechers, SIGNAL(triggered()), this, SLOT(hideOrShowColumnLeechers())); |
|
|
|
connect(actionHOSColRatio, SIGNAL(triggered()), this, SLOT(hideOrShowColumnRatio())); |
|
|
|
connect(actionHOSColRatio, SIGNAL(triggered()), this, SLOT(hideOrShowColumnRatio())); |
|
|
@ -110,10 +108,9 @@ void FinishedTorrents::addTorrent(QString hash){ |
|
|
|
finishedListModel->setData(finishedListModel->index(row, F_NAME), QVariant(h.name())); |
|
|
|
finishedListModel->setData(finishedListModel->index(row, F_NAME), QVariant(h.name())); |
|
|
|
finishedListModel->setData(finishedListModel->index(row, F_SIZE), QVariant((qlonglong)h.actual_size())); |
|
|
|
finishedListModel->setData(finishedListModel->index(row, F_SIZE), QVariant((qlonglong)h.actual_size())); |
|
|
|
finishedListModel->setData(finishedListModel->index(row, F_UPSPEED), QVariant((double)0.)); |
|
|
|
finishedListModel->setData(finishedListModel->index(row, F_UPSPEED), QVariant((double)0.)); |
|
|
|
finishedListModel->setData(finishedListModel->index(row, F_SEEDSLEECH), QVariant("0")); |
|
|
|
finishedListModel->setData(finishedListModel->index(row, F_LEECH), QVariant("0")); |
|
|
|
finishedListModel->setData(finishedListModel->index(row, F_RATIO), QVariant(QString::fromUtf8(misc::toString(BTSession->getRealRatio(hash)).c_str()))); |
|
|
|
finishedListModel->setData(finishedListModel->index(row, F_RATIO), QVariant(QString::fromUtf8(misc::toString(BTSession->getRealRatio(hash)).c_str()))); |
|
|
|
finishedListModel->setData(finishedListModel->index(row, F_HASH), QVariant(hash)); |
|
|
|
finishedListModel->setData(finishedListModel->index(row, F_HASH), QVariant(hash)); |
|
|
|
finishedListModel->setData(finishedListModel->index(row, F_PROGRESS), QVariant((double)1.)); |
|
|
|
|
|
|
|
if(h.is_paused()) { |
|
|
|
if(h.is_paused()) { |
|
|
|
finishedListModel->setData(finishedListModel->index(row, F_NAME), QIcon(":/Icons/skin/paused.png"), Qt::DecorationRole); |
|
|
|
finishedListModel->setData(finishedListModel->index(row, F_NAME), QIcon(":/Icons/skin/paused.png"), Qt::DecorationRole); |
|
|
|
setRowColor(row, "red"); |
|
|
|
setRowColor(row, "red"); |
|
|
@ -240,9 +237,6 @@ void FinishedTorrents::updateFinishedList(){ |
|
|
|
Q_ASSERT(row != -1); |
|
|
|
Q_ASSERT(row != -1); |
|
|
|
if(h.is_paused()) continue; |
|
|
|
if(h.is_paused()) continue; |
|
|
|
if(BTSession->getTorrentsToPauseAfterChecking().indexOf(hash) != -1) { |
|
|
|
if(BTSession->getTorrentsToPauseAfterChecking().indexOf(hash) != -1) { |
|
|
|
if(!finishedList->isColumnHidden(F_PROGRESS)) { |
|
|
|
|
|
|
|
finishedListModel->setData(finishedListModel->index(row, F_PROGRESS), QVariant((double)h.progress())); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
continue; |
|
|
|
continue; |
|
|
|
} |
|
|
|
} |
|
|
|
if(h.state() == torrent_status::downloading || (h.state() != torrent_status::checking_files && h.state() != torrent_status::queued_for_checking && h.progress() < 1.)) { |
|
|
|
if(h.state() == torrent_status::downloading || (h.state() != torrent_status::checking_files && h.state() != torrent_status::queued_for_checking && h.progress() < 1.)) { |
|
|
@ -256,9 +250,6 @@ void FinishedTorrents::updateFinishedList(){ |
|
|
|
if(h.state() == torrent_status::checking_files){ |
|
|
|
if(h.state() == torrent_status::checking_files){ |
|
|
|
finishedListModel->setData(finishedListModel->index(row, F_NAME), QVariant(QIcon(QString::fromUtf8(":/Icons/time.png"))), Qt::DecorationRole); |
|
|
|
finishedListModel->setData(finishedListModel->index(row, F_NAME), QVariant(QIcon(QString::fromUtf8(":/Icons/time.png"))), Qt::DecorationRole); |
|
|
|
setRowColor(row, QString::fromUtf8("grey")); |
|
|
|
setRowColor(row, QString::fromUtf8("grey")); |
|
|
|
if(!finishedList->isColumnHidden(F_PROGRESS)) { |
|
|
|
|
|
|
|
finishedListModel->setData(finishedListModel->index(row, F_PROGRESS), QVariant((double)h.progress())); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
continue; |
|
|
|
continue; |
|
|
|
} |
|
|
|
} |
|
|
|
setRowColor(row, QString::fromUtf8("orange")); |
|
|
|
setRowColor(row, QString::fromUtf8("orange")); |
|
|
@ -266,15 +257,12 @@ void FinishedTorrents::updateFinishedList(){ |
|
|
|
if(!finishedList->isColumnHidden(F_UPSPEED)) { |
|
|
|
if(!finishedList->isColumnHidden(F_UPSPEED)) { |
|
|
|
finishedListModel->setData(finishedListModel->index(row, F_UPSPEED), QVariant((double)h.upload_payload_rate())); |
|
|
|
finishedListModel->setData(finishedListModel->index(row, F_UPSPEED), QVariant((double)h.upload_payload_rate())); |
|
|
|
} |
|
|
|
} |
|
|
|
if(!finishedList->isColumnHidden(F_SEEDSLEECH)) { |
|
|
|
if(!finishedList->isColumnHidden(F_LEECH)) { |
|
|
|
finishedListModel->setData(finishedListModel->index(row, F_SEEDSLEECH), misc::toQString(h.num_peers() - h.num_seeds(), true)); |
|
|
|
finishedListModel->setData(finishedListModel->index(row, F_LEECH), misc::toQString(h.num_peers() - h.num_seeds(), true)); |
|
|
|
} |
|
|
|
} |
|
|
|
if(!finishedList->isColumnHidden(F_RATIO)) { |
|
|
|
if(!finishedList->isColumnHidden(F_RATIO)) { |
|
|
|
finishedListModel->setData(finishedListModel->index(row, F_RATIO), QVariant(misc::toQString(BTSession->getRealRatio(hash)))); |
|
|
|
finishedListModel->setData(finishedListModel->index(row, F_RATIO), QVariant(misc::toQString(BTSession->getRealRatio(hash)))); |
|
|
|
} |
|
|
|
} |
|
|
|
if(!finishedList->isColumnHidden(F_PROGRESS)) { |
|
|
|
|
|
|
|
finishedListModel->setData(finishedListModel->index(row, F_PROGRESS), QVariant((double)1.)); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
@ -294,7 +282,7 @@ void FinishedTorrents::pauseTorrent(QString hash) { |
|
|
|
Q_ASSERT(row != -1); |
|
|
|
Q_ASSERT(row != -1); |
|
|
|
finishedListModel->setData(finishedListModel->index(row, F_UPSPEED), QVariant((double)0.0)); |
|
|
|
finishedListModel->setData(finishedListModel->index(row, F_UPSPEED), QVariant((double)0.0)); |
|
|
|
finishedListModel->setData(finishedListModel->index(row, F_NAME), QIcon(QString::fromUtf8(":/Icons/skin/paused.png")), Qt::DecorationRole); |
|
|
|
finishedListModel->setData(finishedListModel->index(row, F_NAME), QIcon(QString::fromUtf8(":/Icons/skin/paused.png")), Qt::DecorationRole); |
|
|
|
finishedListModel->setData(finishedListModel->index(row, F_SEEDSLEECH), QVariant(QString::fromUtf8("0"))); |
|
|
|
finishedListModel->setData(finishedListModel->index(row, F_LEECH), QVariant(QString::fromUtf8("0"))); |
|
|
|
setRowColor(row, QString::fromUtf8("red")); |
|
|
|
setRowColor(row, QString::fromUtf8("red")); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
@ -452,16 +440,12 @@ void FinishedTorrents::hideOrShowColumnSize() { |
|
|
|
hideOrShowColumn(F_SIZE); |
|
|
|
hideOrShowColumn(F_SIZE); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
void FinishedTorrents::hideOrShowColumnProgress() { |
|
|
|
|
|
|
|
hideOrShowColumn(F_PROGRESS); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
void FinishedTorrents::hideOrShowColumnUpSpeed() { |
|
|
|
void FinishedTorrents::hideOrShowColumnUpSpeed() { |
|
|
|
hideOrShowColumn(F_UPSPEED); |
|
|
|
hideOrShowColumn(F_UPSPEED); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
void FinishedTorrents::hideOrShowColumnLeechers() { |
|
|
|
void FinishedTorrents::hideOrShowColumnLeechers() { |
|
|
|
hideOrShowColumn(F_SEEDSLEECH); |
|
|
|
hideOrShowColumn(F_LEECH); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
void FinishedTorrents::hideOrShowColumnRatio() { |
|
|
|
void FinishedTorrents::hideOrShowColumnRatio() { |
|
|
@ -516,22 +500,19 @@ QAction* FinishedTorrents::getActionHoSCol(int index) { |
|
|
|
switch(index) { |
|
|
|
switch(index) { |
|
|
|
case F_NAME : |
|
|
|
case F_NAME : |
|
|
|
return actionHOSColName; |
|
|
|
return actionHOSColName; |
|
|
|
break; |
|
|
|
break; |
|
|
|
case F_SIZE : |
|
|
|
case F_SIZE : |
|
|
|
return actionHOSColSize; |
|
|
|
return actionHOSColSize; |
|
|
|
break; |
|
|
|
break; |
|
|
|
case F_PROGRESS : |
|
|
|
|
|
|
|
return actionHOSColProgress; |
|
|
|
|
|
|
|
break; |
|
|
|
|
|
|
|
case F_UPSPEED : |
|
|
|
case F_UPSPEED : |
|
|
|
return actionHOSColUpSpeed; |
|
|
|
return actionHOSColUpSpeed; |
|
|
|
break; |
|
|
|
break; |
|
|
|
case F_SEEDSLEECH : |
|
|
|
case F_LEECH : |
|
|
|
return actionHOSColLeechers; |
|
|
|
return actionHOSColLeechers; |
|
|
|
break; |
|
|
|
break; |
|
|
|
case F_RATIO : |
|
|
|
case F_RATIO : |
|
|
|
return actionHOSColRatio; |
|
|
|
return actionHOSColRatio; |
|
|
|
break; |
|
|
|
break; |
|
|
|
default : |
|
|
|
default : |
|
|
|
return NULL; |
|
|
|
return NULL; |
|
|
|
} |
|
|
|
} |
|
|
@ -555,7 +536,6 @@ void FinishedTorrents::sortFinishedList(int index){ |
|
|
|
switch(index){ |
|
|
|
switch(index){ |
|
|
|
case F_SIZE: |
|
|
|
case F_SIZE: |
|
|
|
case F_UPSPEED: |
|
|
|
case F_UPSPEED: |
|
|
|
case F_PROGRESS: |
|
|
|
|
|
|
|
sortFinishedListFloat(index, sortOrder); |
|
|
|
sortFinishedListFloat(index, sortOrder); |
|
|
|
break; |
|
|
|
break; |
|
|
|
default: |
|
|
|
default: |
|
|
|