@ -362,20 +362,6 @@ void PropertiesWidget::loadTorrentInfos(BitTorrent::Torrent *const torrent)
@@ -362,20 +362,6 @@ void PropertiesWidget::loadTorrentInfos(BitTorrent::Torrent *const torrent)
loadUrlSeeds ( ) ;
m_ui - > labelCreatedByVal - > setText ( m_torrent - > creator ( ) ) ;
// List files in torrent
m_propListModel - > model ( ) - > setupModelData ( m_torrent - > info ( ) ) ;
// Expand single-item folders recursively
QModelIndex currentIndex ;
while ( m_propListModel - > rowCount ( currentIndex ) = = 1 )
{
currentIndex = m_propListModel - > index ( 0 , 0 , currentIndex ) ;
m_ui - > filesList - > setExpanded ( currentIndex , true ) ;
}
// Load file priorities
m_propListModel - > model ( ) - > updateFilesPriorities ( m_torrent - > filePriorities ( ) ) ;
}
// Load dynamic data
loadDynamicData ( ) ;
@ -536,12 +522,40 @@ void PropertiesWidget::loadDynamicData()
@@ -536,12 +522,40 @@ void PropertiesWidget::loadDynamicData()
{
qDebug ( " Updating priorities in files tab " ) ;
m_ui - > filesList - > setUpdatesEnabled ( false ) ;
// Load torrent content if not yet done so
const bool isContentInitialized = m_propListModel - > model ( ) - > hasIndex ( 0 , 0 ) ;
if ( ! isContentInitialized )
{
// List files in torrent
m_propListModel - > model ( ) - > setupModelData ( m_torrent - > info ( ) ) ;
// Load file priorities
m_propListModel - > model ( ) - > updateFilesPriorities ( m_torrent - > filePriorities ( ) ) ;
// Update file progress/availability
m_propListModel - > model ( ) - > updateFilesProgress ( m_torrent - > filesProgress ( ) ) ;
m_propListModel - > model ( ) - > updateFilesAvailability ( m_torrent - > availableFileFractions ( ) ) ;
// Expand single-item folders recursively.
// This will trigger sorting and filtering so do it after all relevant data is loaded.
QModelIndex currentIndex ;
while ( m_propListModel - > rowCount ( currentIndex ) = = 1 )
{
currentIndex = m_propListModel - > index ( 0 , 0 , currentIndex ) ;
m_ui - > filesList - > setExpanded ( currentIndex , true ) ;
}
}
else
{
// Torrent content was loaded already, only make some updates
m_propListModel - > model ( ) - > updateFilesProgress ( m_torrent - > filesProgress ( ) ) ;
m_propListModel - > model ( ) - > updateFilesAvailability ( m_torrent - > availableFileFractions ( ) ) ;
// XXX: We don't update file priorities regularly for performance
// reasons. This means that priorities will not be updated if
// set from the Web UI.
// PropListModel->model()->updateFilesPriorities(h.file_priorities());
// m_propListModel->model()->updateFilesPriorities(m_torrent->filePriorities());
}
m_ui - > filesList - > setUpdatesEnabled ( true ) ;
}
break ;