diff --git a/src/gui/addnewtorrentdialog.cpp b/src/gui/addnewtorrentdialog.cpp index 75140827e..098b8a820 100644 --- a/src/gui/addnewtorrentdialog.cpp +++ b/src/gui/addnewtorrentdialog.cpp @@ -30,6 +30,7 @@ #include "addnewtorrentdialog.h" #include +#include #include #include @@ -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 { public: TorrentContentAdaptor(const BitTorrent::TorrentInfo &torrentInfo, PathList &filePaths - , QVector &filePriorities) + , QVector &filePriorities, std::function 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: { Q_ASSERT(priorities.size() == filesCount()); m_filePriorities = priorities; + if (m_onFilePrioritiesChanged) + m_onFilePrioritiesChanged(); } Path actualStorageLocation() const override @@ -260,6 +263,7 @@ private: const BitTorrent::TorrentInfo &m_torrentInfo; PathList &m_filePaths; QVector &m_filePriorities; + std::function m_onFilePrioritiesChanged; Path m_originalRootFolder; BitTorrent::TorrentContentLayout m_currentContentLayout; }; @@ -775,7 +779,8 @@ void AddNewTorrentDialog::setupTreeview() if (m_torrentParams.filePaths.isEmpty()) m_torrentParams.filePaths = torrentInfo.filePaths(); - m_contentAdaptor = std::make_unique(torrentInfo, m_torrentParams.filePaths, m_torrentParams.filePriorities); + m_contentAdaptor = std::make_unique(torrentInfo, m_torrentParams.filePaths + , m_torrentParams.filePriorities, [this] { updateDiskSpaceLabel(); }); const auto contentLayout = static_cast(m_ui->contentLayoutComboBox->currentIndex()); m_contentAdaptor->applyContentLayout(contentLayout);