QString QTorrentItemDelegat::GetStatusString(const Torrent& tor) const { QString upSpeed(tor.GetUploadSpeed()); QString downSpeed(tor.GetDwonloadSpeed()); QString status(tor.GetStatusString()); bool hasError(tor.hasError()); if(hasError) { return tor.GetErrorMessage(); } if(tor.isPaused()) { return tr("STR_PAUSED"); } if(tor.isDownloading()) { return QString("%1: %2 %3 - %4 %5").arg(status).arg(QChar(0x2193)).arg(downSpeed).arg(QChar(0x2191)).arg(upSpeed); } if(tor.isSeeding()) { if(!upSpeed.isEmpty()) { return QString("%2 %3 - %1").arg(status).arg(QChar(0x2191)).arg(upSpeed); } } return status; }
QString QTorrentItemDelegat::GetProgressString(const Torrent& tor) const { if(tor.isDownloading()) { return tr("%1 STR_DOWNLOADED %2 STR_FROM %3").arg(tor.GetProgresString()).arg(tor.GetTotalDownloaded()).arg(tor.GetTotalSize()); } if(tor.isSeeding()) { return tr("%1 - %3 STR_UPLOADED %2").arg(tor.GetProgresString()).arg(tor.GetTotalUploaded()).arg(tor.GetTotalSize()); } return tor.GetProgresString(); }