@ -30,6 +30,7 @@
@@ -30,6 +30,7 @@
# include "addnewtorrentdialog.h"
# include <algorithm>
# include <functional>
# include <QAction>
# include <QDateTime>
@ -59,7 +60,6 @@
@@ -59,7 +60,6 @@
# include "base/utils/misc.h"
# include "lineedit.h"
# include "torrenttagsdialog.h"
# include "uithememanager.h"
# include "ui_addnewtorrentdialog.h"
@ -136,10 +136,11 @@ class AddNewTorrentDialog::TorrentContentAdaptor final
@@ -136,10 +136,11 @@ class AddNewTorrentDialog::TorrentContentAdaptor final
{
public :
TorrentContentAdaptor ( const BitTorrent : : TorrentInfo & torrentInfo , PathList & filePaths
, QVector < BitTorrent : : DownloadPriority > & filePriorities )
, QVector < BitTorrent : : DownloadPriority > & filePriorities , std : : function < void ( ) > onFilePrioritiesChanged )
: m_torrentInfo { torrentInfo }
, m_filePaths { filePaths }
, m_filePriorities { filePriorities }
, m_onFilePrioritiesChanged { std : : move ( onFilePrioritiesChanged ) }
{
Q_ASSERT ( filePaths . isEmpty ( ) | | ( filePaths . size ( ) = = m_torrentInfo . filesCount ( ) ) ) ;
@ -240,6 +241,8 @@ public:
@@ -240,6 +241,8 @@ public:
{
Q_ASSERT ( priorities . size ( ) = = filesCount ( ) ) ;
m_filePriorities = priorities ;
if ( m_onFilePrioritiesChanged )
m_onFilePrioritiesChanged ( ) ;
}
Path actualStorageLocation ( ) const override
@ -260,6 +263,7 @@ private:
@@ -260,6 +263,7 @@ private:
const BitTorrent : : TorrentInfo & m_torrentInfo ;
PathList & m_filePaths ;
QVector < BitTorrent : : DownloadPriority > & m_filePriorities ;
std : : function < void ( ) > m_onFilePrioritiesChanged ;
Path m_originalRootFolder ;
BitTorrent : : TorrentContentLayout m_currentContentLayout ;
} ;
@ -775,7 +779,8 @@ void AddNewTorrentDialog::setupTreeview()
@@ -775,7 +779,8 @@ void AddNewTorrentDialog::setupTreeview()
if ( m_torrentParams . filePaths . isEmpty ( ) )
m_torrentParams . filePaths = torrentInfo . filePaths ( ) ;
m_contentAdaptor = std : : make_unique < TorrentContentAdaptor > ( torrentInfo , m_torrentParams . filePaths , m_torrentParams . filePriorities ) ;
m_contentAdaptor = std : : make_unique < TorrentContentAdaptor > ( torrentInfo , m_torrentParams . filePaths
, m_torrentParams . filePriorities , [ this ] { updateDiskSpaceLabel ( ) ; } ) ;
const auto contentLayout = static_cast < BitTorrent : : TorrentContentLayout > ( m_ui - > contentLayoutComboBox - > currentIndex ( ) ) ;
m_contentAdaptor - > applyContentLayout ( contentLayout ) ;