Browse Source

- Performance improvement, property tabs are updated only when displayed

adaptive-webui-19844
Christophe Dumez 15 years ago
parent
commit
d9cb73634d
  1. 13
      src/propertieswidget.cpp

13
src/propertieswidget.cpp

@ -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,6 +275,7 @@ void PropertiesWidget::loadDynamicData() {
if(!h.is_valid()) return; if(!h.is_valid()) return;
try { try {
// Transfer infos // Transfer infos
if(stackedProperties->currentIndex() == MAIN_TAB) {
wasted->setText(misc::friendlyUnit(h.total_failed_bytes()+h.total_redundant_bytes())); wasted->setText(misc::friendlyUnit(h.total_failed_bytes()+h.total_redundant_bytes()));
upTotal->setText(misc::friendlyUnit(h.all_time_upload()) + " ("+misc::friendlyUnit(h.total_payload_upload())+" "+tr("this session")+")"); upTotal->setText(misc::friendlyUnit(h.all_time_upload()) + " ("+misc::friendlyUnit(h.total_payload_upload())+" "+tr("this session")+")");
dlTotal->setText(misc::friendlyUnit(h.all_time_download()) + " ("+misc::friendlyUnit(h.total_payload_download())+" "+tr("this session")+")"); dlTotal->setText(misc::friendlyUnit(h.all_time_download()) + " ("+misc::friendlyUnit(h.total_payload_download())+" "+tr("this session")+")");
@ -285,8 +287,6 @@ void PropertiesWidget::loadDynamicData() {
} }
lbl_elapsed->setText(elapsed_txt); 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_connections->setText(QString::number(h.num_connections())+" ("+tr("%1 max", "e.g. 10 max").arg(QString::number(h.connections_limit()))+")");
// Load peers
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){
@ -306,10 +306,19 @@ void PropertiesWidget::loadDynamicData() {
progressBarUpdater->refresh(); progressBarUpdater->refresh();
// Progress // Progress
progress_lbl->setText(QString::number(h.progress()*100., 'f', 1)+"%"); 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 // Files progress
std::vector<size_type> fp; std::vector<size_type> fp;
h.file_progress(fp); h.file_progress(fp);
PropListModel->updateFilesProgress(fp); PropListModel->updateFilesProgress(fp);
}
} catch(invalid_handle e) {} } catch(invalid_handle e) {}
} }

Loading…
Cancel
Save