|
|
@ -86,6 +86,7 @@ PropertiesWidget::PropertiesWidget(QWidget *parent, TransferListWidget *transfer |
|
|
|
connect(transferList, SIGNAL(currentTorrentChanged(QTorrentHandle&)), this, SLOT(loadTorrentInfos(QTorrentHandle &))); |
|
|
|
connect(transferList, SIGNAL(currentTorrentChanged(QTorrentHandle&)), this, SLOT(loadTorrentInfos(QTorrentHandle &))); |
|
|
|
connect(incrementalDownload, SIGNAL(stateChanged(int)), this, SLOT(setIncrementalDownload(int))); |
|
|
|
connect(incrementalDownload, SIGNAL(stateChanged(int)), this, SLOT(setIncrementalDownload(int))); |
|
|
|
connect(PropDelegate, SIGNAL(filteredFilesChanged()), this, SLOT(filteredFilesChanged())); |
|
|
|
connect(PropDelegate, SIGNAL(filteredFilesChanged()), this, SLOT(filteredFilesChanged())); |
|
|
|
|
|
|
|
connect(stackedProperties, SIGNAL(currentChanged(int)), this, SLOT(loadDynamicData())); |
|
|
|
|
|
|
|
|
|
|
|
// Downloaded pieces progress bar
|
|
|
|
// Downloaded pieces progress bar
|
|
|
|
progressBar = new RealProgressBar(this); |
|
|
|
progressBar = new RealProgressBar(this); |
|
|
@ -274,42 +275,50 @@ void PropertiesWidget::loadDynamicData() { |
|
|
|
if(!h.is_valid()) return; |
|
|
|
if(!h.is_valid()) return; |
|
|
|
try { |
|
|
|
try { |
|
|
|
// Transfer infos
|
|
|
|
// Transfer infos
|
|
|
|
wasted->setText(misc::friendlyUnit(h.total_failed_bytes()+h.total_redundant_bytes())); |
|
|
|
if(stackedProperties->currentIndex() == MAIN_TAB) { |
|
|
|
upTotal->setText(misc::friendlyUnit(h.all_time_upload()) + " ("+misc::friendlyUnit(h.total_payload_upload())+" "+tr("this session")+")"); |
|
|
|
wasted->setText(misc::friendlyUnit(h.total_failed_bytes()+h.total_redundant_bytes())); |
|
|
|
dlTotal->setText(misc::friendlyUnit(h.all_time_download()) + " ("+misc::friendlyUnit(h.total_payload_download())+" "+tr("this session")+")"); |
|
|
|
upTotal->setText(misc::friendlyUnit(h.all_time_upload()) + " ("+misc::friendlyUnit(h.total_payload_upload())+" "+tr("this session")+")"); |
|
|
|
lbl_uplimit->setText(misc::friendlyUnit(h.upload_limit())); |
|
|
|
dlTotal->setText(misc::friendlyUnit(h.all_time_download()) + " ("+misc::friendlyUnit(h.total_payload_download())+" "+tr("this session")+")"); |
|
|
|
lbl_dllimit->setText(misc::friendlyUnit(h.download_limit())); |
|
|
|
lbl_uplimit->setText(misc::friendlyUnit(h.upload_limit())); |
|
|
|
QString elapsed_txt = misc::userFriendlyDuration(h.active_time()); |
|
|
|
lbl_dllimit->setText(misc::friendlyUnit(h.download_limit())); |
|
|
|
if(h.is_seed()) { |
|
|
|
QString elapsed_txt = misc::userFriendlyDuration(h.active_time()); |
|
|
|
elapsed_txt += " ("+tr("Seeding for %1", "e.g. Seeding for 3m10s").arg(misc::userFriendlyDuration(h.seeding_time()))+")"; |
|
|
|
if(h.is_seed()) { |
|
|
|
} |
|
|
|
elapsed_txt += " ("+tr("Seeding for %1", "e.g. Seeding for 3m10s").arg(misc::userFriendlyDuration(h.seeding_time()))+")"; |
|
|
|
lbl_elapsed->setText(elapsed_txt); |
|
|
|
} |
|
|
|
lbl_connections->setText(QString::number(h.num_connections())+" ("+tr("%1 max", "e.g. 10 max").arg(QString::number(h.connections_limit()))+")"); |
|
|
|
lbl_elapsed->setText(elapsed_txt); |
|
|
|
// Load peers
|
|
|
|
lbl_connections->setText(QString::number(h.num_connections())+" ("+tr("%1 max", "e.g. 10 max").arg(QString::number(h.connections_limit()))+")"); |
|
|
|
peersList->loadPeers(h); |
|
|
|
// Update ratio info
|
|
|
|
// Update ratio info
|
|
|
|
float ratio; |
|
|
|
float ratio; |
|
|
|
if(h.total_payload_download() == 0){ |
|
|
|
if(h.total_payload_download() == 0){ |
|
|
|
if(h.total_payload_upload() == 0) |
|
|
|
if(h.total_payload_upload() == 0) |
|
|
|
ratio = 1.; |
|
|
|
ratio = 1.; |
|
|
|
else |
|
|
|
else |
|
|
|
ratio = 10.; // Max ratio
|
|
|
|
ratio = 10.; // Max ratio
|
|
|
|
}else{ |
|
|
|
}else{ |
|
|
|
ratio = (double)h.total_payload_upload()/(double)h.total_payload_download(); |
|
|
|
ratio = (double)h.total_payload_upload()/(double)h.total_payload_download(); |
|
|
|
if(ratio > 10.){ |
|
|
|
if(ratio > 10.){ |
|
|
|
ratio = 10.; |
|
|
|
ratio = 10.; |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
shareRatio->setText(QString(QByteArray::number(ratio, 'f', 1))); |
|
|
|
|
|
|
|
// Downloaded pieces
|
|
|
|
|
|
|
|
if(progressBarUpdater) |
|
|
|
|
|
|
|
progressBarUpdater->refresh(); |
|
|
|
|
|
|
|
// Progress
|
|
|
|
|
|
|
|
progress_lbl->setText(QString::number(h.progress()*100., 'f', 1)+"%"); |
|
|
|
|
|
|
|
return; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
if(stackedProperties->currentIndex() == PEERS_TAB) { |
|
|
|
|
|
|
|
// Load peers
|
|
|
|
|
|
|
|
peersList->loadPeers(h); |
|
|
|
|
|
|
|
return; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
if(stackedProperties->currentIndex() == FILES_TAB) { |
|
|
|
|
|
|
|
// Files progress
|
|
|
|
|
|
|
|
std::vector<size_type> fp; |
|
|
|
|
|
|
|
h.file_progress(fp); |
|
|
|
|
|
|
|
PropListModel->updateFilesProgress(fp); |
|
|
|
} |
|
|
|
} |
|
|
|
shareRatio->setText(QString(QByteArray::number(ratio, 'f', 1))); |
|
|
|
|
|
|
|
// Downloaded pieces
|
|
|
|
|
|
|
|
if(progressBarUpdater) |
|
|
|
|
|
|
|
progressBarUpdater->refresh(); |
|
|
|
|
|
|
|
// Progress
|
|
|
|
|
|
|
|
progress_lbl->setText(QString::number(h.progress()*100., 'f', 1)+"%"); |
|
|
|
|
|
|
|
// Files progress
|
|
|
|
|
|
|
|
std::vector<size_type> fp; |
|
|
|
|
|
|
|
h.file_progress(fp); |
|
|
|
|
|
|
|
PropListModel->updateFilesProgress(fp); |
|
|
|
|
|
|
|
} catch(invalid_handle e) {} |
|
|
|
} catch(invalid_handle e) {} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|