@ -37,16 +37,15 @@ FinishedTorrents::FinishedTorrents(QObject *parent, bittorrent *BTSession) : par
@@ -37,16 +37,15 @@ FinishedTorrents::FinishedTorrents(QObject *parent, bittorrent *BTSession) : par
actionStart - > setIcon ( QIcon ( QString : : fromUtf8 ( " :/Icons/skin/play.png " ) ) ) ;
actionPause - > setIcon ( QIcon ( QString : : fromUtf8 ( " :/Icons/skin/pause.png " ) ) ) ;
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_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_SEEDS LEECH , 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 " ) ) ;
finishedList - > setModel ( finishedListModel ) ;
loadHiddenColumns ( ) ;
// Hide ETA & hash column
// Hide hash column
finishedList - > hideColumn ( F_HASH ) ;
// Load last columns width for download list
if ( ! loadColWidthFinishedList ( ) ) {
@ -78,7 +77,6 @@ FinishedTorrents::FinishedTorrents(QObject *parent, bittorrent *BTSession) : par
@@ -78,7 +77,6 @@ FinishedTorrents::FinishedTorrents(QObject *parent, bittorrent *BTSession) : par
connect ( actionHOSColName , SIGNAL ( triggered ( ) ) , this , SLOT ( hideOrShowColumnName ( ) ) ) ;
connect ( actionHOSColSize , SIGNAL ( triggered ( ) ) , this , SLOT ( hideOrShowColumnSize ( ) ) ) ;
connect ( actionHOSColProgress , SIGNAL ( triggered ( ) ) , this , SLOT ( hideOrShowColumnProgress ( ) ) ) ;
connect ( actionHOSColUpSpeed , SIGNAL ( triggered ( ) ) , this , SLOT ( hideOrShowColumnUpSpeed ( ) ) ) ;
connect ( actionHOSColLeechers , SIGNAL ( triggered ( ) ) , this , SLOT ( hideOrShowColumnLeechers ( ) ) ) ;
connect ( actionHOSColRatio , SIGNAL ( triggered ( ) ) , this , SLOT ( hideOrShowColumnRatio ( ) ) ) ;
@ -110,10 +108,9 @@ void FinishedTorrents::addTorrent(QString hash){
@@ -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_SIZE ) , QVariant ( ( qlonglong ) h . actual_size ( ) ) ) ;
finishedListModel - > setData ( finishedListModel - > index ( row , F_UPSPEED ) , QVariant ( ( double ) 0. ) ) ;
finishedListModel - > setData ( finishedListModel - > index ( row , F_SEEDS LEECH ) , 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_HASH ) , QVariant ( hash ) ) ;
finishedListModel - > setData ( finishedListModel - > index ( row , F_PROGRESS ) , QVariant ( ( double ) 1. ) ) ;
if ( h . is_paused ( ) ) {
finishedListModel - > setData ( finishedListModel - > index ( row , F_NAME ) , QIcon ( " :/Icons/skin/paused.png " ) , Qt : : DecorationRole ) ;
setRowColor ( row , " red " ) ;
@ -240,9 +237,6 @@ void FinishedTorrents::updateFinishedList(){
@@ -240,9 +237,6 @@ void FinishedTorrents::updateFinishedList(){
Q_ASSERT ( row ! = - 1 ) ;
if ( h . is_paused ( ) ) continue ;
if ( BTSession - > getTorrentsToPauseAfterChecking ( ) . indexOf ( hash ) ! = - 1 ) {
if ( ! finishedList - > isColumnHidden ( F_PROGRESS ) ) {
finishedListModel - > setData ( finishedListModel - > index ( row , F_PROGRESS ) , QVariant ( ( double ) h . progress ( ) ) ) ;
}
continue ;
}
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(){
@@ -256,9 +250,6 @@ void FinishedTorrents::updateFinishedList(){
if ( h . state ( ) = = torrent_status : : checking_files ) {
finishedListModel - > setData ( finishedListModel - > index ( row , F_NAME ) , QVariant ( QIcon ( QString : : fromUtf8 ( " :/Icons/time.png " ) ) ) , Qt : : DecorationRole ) ;
setRowColor ( row , QString : : fromUtf8 ( " grey " ) ) ;
if ( ! finishedList - > isColumnHidden ( F_PROGRESS ) ) {
finishedListModel - > setData ( finishedListModel - > index ( row , F_PROGRESS ) , QVariant ( ( double ) h . progress ( ) ) ) ;
}
continue ;
}
setRowColor ( row , QString : : fromUtf8 ( " orange " ) ) ;
@ -266,15 +257,12 @@ void FinishedTorrents::updateFinishedList(){
@@ -266,15 +257,12 @@ void FinishedTorrents::updateFinishedList(){
if ( ! finishedList - > isColumnHidden ( F_UPSPEED ) ) {
finishedListModel - > setData ( finishedListModel - > index ( row , F_UPSPEED ) , QVariant ( ( double ) h . upload_payload_rate ( ) ) ) ;
}
if ( ! finishedList - > isColumnHidden ( F_SEEDS LEECH ) ) {
finishedListModel - > setData ( finishedListModel - > index ( row , F_SEEDS LEECH ) , misc : : toQString ( h . num_peers ( ) - h . num_seeds ( ) , true ) ) ;
if ( ! finishedList - > isColumnHidden ( F_LEECH ) ) {
finishedListModel - > setData ( finishedListModel - > index ( row , F_LEECH ) , misc : : toQString ( h . num_peers ( ) - h . num_seeds ( ) , true ) ) ;
}
if ( ! finishedList - > isColumnHidden ( F_RATIO ) ) {
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) {
@@ -294,7 +282,7 @@ void FinishedTorrents::pauseTorrent(QString hash) {
Q_ASSERT ( row ! = - 1 ) ;
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_SEEDS LEECH ) , QVariant ( QString : : fromUtf8 ( " 0 " ) ) ) ;
finishedListModel - > setData ( finishedListModel - > index ( row , F_LEECH ) , QVariant ( QString : : fromUtf8 ( " 0 " ) ) ) ;
setRowColor ( row , QString : : fromUtf8 ( " red " ) ) ;
}
@ -452,16 +440,12 @@ void FinishedTorrents::hideOrShowColumnSize() {
@@ -452,16 +440,12 @@ void FinishedTorrents::hideOrShowColumnSize() {
hideOrShowColumn ( F_SIZE ) ;
}
void FinishedTorrents : : hideOrShowColumnProgress ( ) {
hideOrShowColumn ( F_PROGRESS ) ;
}
void FinishedTorrents : : hideOrShowColumnUpSpeed ( ) {
hideOrShowColumn ( F_UPSPEED ) ;
}
void FinishedTorrents : : hideOrShowColumnLeechers ( ) {
hideOrShowColumn ( F_SEEDS LEECH ) ;
hideOrShowColumn ( F_LEECH ) ;
}
void FinishedTorrents : : hideOrShowColumnRatio ( ) {
@ -516,22 +500,19 @@ QAction* FinishedTorrents::getActionHoSCol(int index) {
@@ -516,22 +500,19 @@ QAction* FinishedTorrents::getActionHoSCol(int index) {
switch ( index ) {
case F_NAME :
return actionHOSColName ;
break ;
break ;
case F_SIZE :
return actionHOSColSize ;
break ;
case F_PROGRESS :
return actionHOSColProgress ;
break ;
break ;
case F_UPSPEED :
return actionHOSColUpSpeed ;
break ;
case F_SEEDS LEECH :
break ;
case F_LEECH :
return actionHOSColLeechers ;
break ;
break ;
case F_RATIO :
return actionHOSColRatio ;
break ;
break ;
default :
return NULL ;
}
@ -555,7 +536,6 @@ void FinishedTorrents::sortFinishedList(int index){
@@ -555,7 +536,6 @@ void FinishedTorrents::sortFinishedList(int index){
switch ( index ) {
case F_SIZE :
case F_UPSPEED :
case F_PROGRESS :
sortFinishedListFloat ( index , sortOrder ) ;
break ;
default :