@ -89,6 +89,7 @@ AddTorrentData::AddTorrentData(const AddTorrentParams ¶ms)
, sequential ( params . sequential )
, sequential ( params . sequential )
, hasSeedStatus ( params . skipChecking ) // do not react on 'torrent_finished_alert' when skipping
, hasSeedStatus ( params . skipChecking ) // do not react on 'torrent_finished_alert' when skipping
, skipChecking ( params . skipChecking )
, skipChecking ( params . skipChecking )
, hasRootFolder ( params . createSubfolder )
, addForced ( params . addForced )
, addForced ( params . addForced )
, addPaused ( params . addPaused )
, addPaused ( params . addPaused )
, filePriorities ( params . filePriorities )
, filePriorities ( params . filePriorities )
@ -152,7 +153,6 @@ TorrentState::operator int() const
return m_value ;
return m_value ;
}
}
, createSubfolder ( in . createSubfolder )
// TorrentHandle
// TorrentHandle
const qreal TorrentHandle : : USE_GLOBAL_RATIO = - 2. ;
const qreal TorrentHandle : : USE_GLOBAL_RATIO = - 2. ;
@ -200,6 +200,7 @@ TorrentHandle::TorrentHandle(Session *session, const libtorrent::torrent_handle
, m_ratioLimit ( data . ratioLimit )
, m_ratioLimit ( data . ratioLimit )
, m_tempPathDisabled ( data . disableTempPath )
, m_tempPathDisabled ( data . disableTempPath )
, m_hasMissingFiles ( false )
, m_hasMissingFiles ( false )
, m_hasRootFolder ( data . hasRootFolder )
, m_pauseAfterRecheck ( false )
, m_pauseAfterRecheck ( false )
, m_needSaveResumeData ( false )
, m_needSaveResumeData ( false )
{
{
@ -209,8 +210,13 @@ TorrentHandle::TorrentHandle(Session *session, const libtorrent::torrent_handle
updateStatus ( ) ;
updateStatus ( ) ;
m_hash = InfoHash ( m_nativeStatus . info_hash ) ;
m_hash = InfoHash ( m_nativeStatus . info_hash ) ;
if ( ! data . resumed )
if ( ! data . resumed ) {
setSequentialDownload ( data . sequential ) ;
setSequentialDownload ( data . sequential ) ;
if ( hasMetadata ( ) ) {
if ( filesCount ( ) = = 1 )
m_hasRootFolder = false ;
}
}
}
}
TorrentHandle : : ~ TorrentHandle ( ) { }
TorrentHandle : : ~ TorrentHandle ( ) { }
@ -231,8 +237,8 @@ QString TorrentHandle::name() const
if ( name . isEmpty ( ) )
if ( name . isEmpty ( ) )
name = QString : : fromStdString ( m_nativeStatus . name ) ;
name = QString : : fromStdString ( m_nativeStatus . name ) ;
if ( name . isEmpty ( ) )
if ( name . isEmpty ( ) & & hasMetadata ( ) )
name = QString : : fromStdString ( m_torrentInfo . origF iles( ) . name ( ) ) ;
name = QString : : fromStdString ( m_torrentInfo . nativeInfo ( ) - > orig_f iles( ) . name ( ) ) ;
if ( name . isEmpty ( ) )
if ( name . isEmpty ( ) )
name = m_hash ;
name = m_hash ;
@ -338,6 +344,11 @@ void TorrentHandle::setAutoTMMEnabled(bool enabled)
move_impl ( m_session - > categorySavePath ( m_category ) ) ;
move_impl ( m_session - > categorySavePath ( m_category ) ) ;
}
}
bool TorrentHandle : : hasRootFolder ( ) const
{
return m_hasRootFolder ;
}
QString TorrentHandle : : nativeActualSavePath ( ) const
QString TorrentHandle : : nativeActualSavePath ( ) const
{
{
return QString : : fromStdString ( m_nativeStatus . save_path ) ;
return QString : : fromStdString ( m_nativeStatus . save_path ) ;
@ -1493,6 +1504,7 @@ void TorrentHandle::handleSaveResumeDataAlert(libtorrent::save_resume_data_alert
resumeData [ " qBt-seedStatus " ] = m_hasSeedStatus ;
resumeData [ " qBt-seedStatus " ] = m_hasSeedStatus ;
resumeData [ " qBt-tempPathDisabled " ] = m_tempPathDisabled ;
resumeData [ " qBt-tempPathDisabled " ] = m_tempPathDisabled ;
resumeData [ " qBt-queuePosition " ] = queuePosition ( ) ;
resumeData [ " qBt-queuePosition " ] = queuePosition ( ) ;
resumeData [ " qBt-hasRootFolder " ] = m_hasRootFolder ;
m_session - > handleTorrentResumeDataReady ( this , resumeData ) ;
m_session - > handleTorrentResumeDataReady ( this , resumeData ) ;
}
}
@ -1594,6 +1606,10 @@ void TorrentHandle::handleMetadataReceivedAlert(libt::metadata_received_alert *p
updateStatus ( ) ;
updateStatus ( ) ;
if ( m_session - > isAppendExtensionEnabled ( ) )
if ( m_session - > isAppendExtensionEnabled ( ) )
manageIncompleteFiles ( ) ;
manageIncompleteFiles ( ) ;
if ( ! m_hasRootFolder )
m_torrentInfo . stripRootFolder ( ) ;
if ( filesCount ( ) = = 1 )
m_hasRootFolder = false ;
m_session - > handleTorrentMetadataReceived ( this ) ;
m_session - > handleTorrentMetadataReceived ( this ) ;
if ( isPaused ( ) ) {
if ( isPaused ( ) ) {