|
|
@ -132,14 +132,21 @@ PropertiesWidget::~PropertiesWidget() { |
|
|
|
delete actionHigh; |
|
|
|
delete actionHigh; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
void PropertiesWidget::showPieceBars(bool show) { |
|
|
|
|
|
|
|
|
|
|
|
void PropertiesWidget::showPiecesAvailability(bool show) { |
|
|
|
avail_pieces_lbl->setVisible(show); |
|
|
|
avail_pieces_lbl->setVisible(show); |
|
|
|
pieces_availability->setVisible(show); |
|
|
|
pieces_availability->setVisible(show); |
|
|
|
|
|
|
|
avail_average_lbl->setVisible(show); |
|
|
|
|
|
|
|
if(show || (!show && !downloaded_pieces->isVisible())) |
|
|
|
|
|
|
|
line_2->setVisible(show); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
void PropertiesWidget::showPiecesDownloaded(bool show) { |
|
|
|
downloaded_pieces_lbl->setVisible(show); |
|
|
|
downloaded_pieces_lbl->setVisible(show); |
|
|
|
downloaded_pieces->setVisible(show); |
|
|
|
downloaded_pieces->setVisible(show); |
|
|
|
progress_lbl->setVisible(show); |
|
|
|
progress_lbl->setVisible(show); |
|
|
|
|
|
|
|
if(show || (!show && !pieces_availability->isVisible())) |
|
|
|
line_2->setVisible(show); |
|
|
|
line_2->setVisible(show); |
|
|
|
avail_average_lbl->setVisible(show); |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
void PropertiesWidget::reduce() { |
|
|
|
void PropertiesWidget::reduce() { |
|
|
@ -191,7 +198,8 @@ void PropertiesWidget::clear() { |
|
|
|
shareRatio->clear(); |
|
|
|
shareRatio->clear(); |
|
|
|
listWebSeeds->clear(); |
|
|
|
listWebSeeds->clear(); |
|
|
|
PropListModel->clear(); |
|
|
|
PropListModel->clear(); |
|
|
|
showPieceBars(false); |
|
|
|
showPiecesAvailability(false); |
|
|
|
|
|
|
|
showPiecesDownloaded(false); |
|
|
|
setEnabled(false); |
|
|
|
setEnabled(false); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
@ -213,10 +221,6 @@ void PropertiesWidget::loadTorrentInfos(QTorrentHandle &_h) { |
|
|
|
setEnabled(true); |
|
|
|
setEnabled(true); |
|
|
|
|
|
|
|
|
|
|
|
try { |
|
|
|
try { |
|
|
|
if(!h.is_seed()) |
|
|
|
|
|
|
|
showPieceBars(true); |
|
|
|
|
|
|
|
else |
|
|
|
|
|
|
|
showPieceBars(false); |
|
|
|
|
|
|
|
// Save path
|
|
|
|
// Save path
|
|
|
|
save_path->setText(TorrentPersistentData::getSavePath(h.hash())); |
|
|
|
save_path->setText(TorrentPersistentData::getSavePath(h.hash())); |
|
|
|
// Creation date
|
|
|
|
// Creation date
|
|
|
@ -327,20 +331,24 @@ void PropertiesWidget::loadDynamicData() { |
|
|
|
else |
|
|
|
else |
|
|
|
shareRatio->setText(QString(QByteArray::number(ratio, 'f', 1))); |
|
|
|
shareRatio->setText(QString(QByteArray::number(ratio, 'f', 1))); |
|
|
|
if(!h.is_seed()) { |
|
|
|
if(!h.is_seed()) { |
|
|
|
showPieceBars(true); |
|
|
|
showPiecesDownloaded(true); |
|
|
|
// Downloaded pieces
|
|
|
|
// Downloaded pieces
|
|
|
|
downloaded_pieces->setProgress(h.pieces()); |
|
|
|
downloaded_pieces->setProgress(h.pieces()); |
|
|
|
// Pieces availability
|
|
|
|
// Pieces availability
|
|
|
|
if(h.has_metadata()) { |
|
|
|
if(h.has_metadata() && !h.is_paused() && !h.is_queued() && !h.is_checking()) { |
|
|
|
|
|
|
|
showPiecesAvailability(true); |
|
|
|
std::vector<int> avail; |
|
|
|
std::vector<int> avail; |
|
|
|
h.piece_availability(avail); |
|
|
|
h.piece_availability(avail); |
|
|
|
double avail_average = pieces_availability->setAvailability(avail); |
|
|
|
double avail_average = pieces_availability->setAvailability(avail); |
|
|
|
avail_average_lbl->setText(QString::number(avail_average, 'f', 1)); |
|
|
|
avail_average_lbl->setText(QString::number(avail_average, 'f', 1)); |
|
|
|
|
|
|
|
} else { |
|
|
|
|
|
|
|
showPiecesAvailability(false); |
|
|
|
} |
|
|
|
} |
|
|
|
// Progress
|
|
|
|
// Progress
|
|
|
|
progress_lbl->setText(QString::number(h.progress()*100., 'f', 1)+"%"); |
|
|
|
progress_lbl->setText(QString::number(h.progress()*100., 'f', 1)+"%"); |
|
|
|
} else { |
|
|
|
} else { |
|
|
|
showPieceBars(false); |
|
|
|
showPiecesAvailability(false); |
|
|
|
|
|
|
|
showPiecesDownloaded(false); |
|
|
|
} |
|
|
|
} |
|
|
|
return; |
|
|
|
return; |
|
|
|
} |
|
|
|
} |
|
|
|