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