mirror of
https://github.com/qbittorrent/qBittorrent.git
synced 2024-10-22 10:46:04 +03:00
Update size of selected files when selection is changed
PR #19827. Closes #19818.
This commit is contained in:
parent
ee853d8751
commit
b284d40430
1 changed files with 8 additions and 2 deletions
|
@ -30,6 +30,7 @@
|
||||||
#include "addnewtorrentdialog.h"
|
#include "addnewtorrentdialog.h"
|
||||||
|
|
||||||
#include <algorithm>
|
#include <algorithm>
|
||||||
|
#include <functional>
|
||||||
|
|
||||||
#include <QAction>
|
#include <QAction>
|
||||||
#include <QDateTime>
|
#include <QDateTime>
|
||||||
|
@ -141,10 +142,11 @@ class AddNewTorrentDialog::TorrentContentAdaptor final
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
TorrentContentAdaptor(BitTorrent::TorrentInfo &torrentInfo, PathList &filePaths
|
TorrentContentAdaptor(BitTorrent::TorrentInfo &torrentInfo, PathList &filePaths
|
||||||
, QVector<BitTorrent::DownloadPriority> &filePriorities)
|
, QVector<BitTorrent::DownloadPriority> &filePriorities, std::function<void ()> onFilePrioritiesChanged)
|
||||||
: m_torrentInfo {torrentInfo}
|
: m_torrentInfo {torrentInfo}
|
||||||
, m_filePaths {filePaths}
|
, m_filePaths {filePaths}
|
||||||
, m_filePriorities {filePriorities}
|
, m_filePriorities {filePriorities}
|
||||||
|
, m_onFilePrioritiesChanged {std::move(onFilePrioritiesChanged)}
|
||||||
{
|
{
|
||||||
Q_ASSERT(filePaths.isEmpty() || (filePaths.size() == torrentInfo.filesCount()));
|
Q_ASSERT(filePaths.isEmpty() || (filePaths.size() == torrentInfo.filesCount()));
|
||||||
|
|
||||||
|
@ -255,6 +257,8 @@ public:
|
||||||
{
|
{
|
||||||
Q_ASSERT(priorities.size() == filesCount());
|
Q_ASSERT(priorities.size() == filesCount());
|
||||||
m_filePriorities = priorities;
|
m_filePriorities = priorities;
|
||||||
|
if (m_onFilePrioritiesChanged)
|
||||||
|
m_onFilePrioritiesChanged();
|
||||||
}
|
}
|
||||||
|
|
||||||
Path actualStorageLocation() const override
|
Path actualStorageLocation() const override
|
||||||
|
@ -275,6 +279,7 @@ private:
|
||||||
BitTorrent::TorrentInfo &m_torrentInfo;
|
BitTorrent::TorrentInfo &m_torrentInfo;
|
||||||
PathList &m_filePaths;
|
PathList &m_filePaths;
|
||||||
QVector<BitTorrent::DownloadPriority> &m_filePriorities;
|
QVector<BitTorrent::DownloadPriority> &m_filePriorities;
|
||||||
|
std::function<void ()> m_onFilePrioritiesChanged;
|
||||||
Path m_originalRootFolder;
|
Path m_originalRootFolder;
|
||||||
BitTorrent::TorrentContentLayout m_currentContentLayout;
|
BitTorrent::TorrentContentLayout m_currentContentLayout;
|
||||||
};
|
};
|
||||||
|
@ -992,7 +997,8 @@ void AddNewTorrentDialog::setupTreeview()
|
||||||
if (m_torrentParams.filePaths.isEmpty())
|
if (m_torrentParams.filePaths.isEmpty())
|
||||||
m_torrentParams.filePaths = m_torrentInfo.filePaths();
|
m_torrentParams.filePaths = m_torrentInfo.filePaths();
|
||||||
|
|
||||||
m_contentAdaptor = std::make_unique<TorrentContentAdaptor>(m_torrentInfo, m_torrentParams.filePaths, m_torrentParams.filePriorities);
|
m_contentAdaptor = std::make_unique<TorrentContentAdaptor>(m_torrentInfo, m_torrentParams.filePaths
|
||||||
|
, m_torrentParams.filePriorities, [this] { updateDiskSpaceLabel(); });
|
||||||
|
|
||||||
const auto contentLayout = static_cast<BitTorrent::TorrentContentLayout>(m_ui->contentLayoutComboBox->currentIndex());
|
const auto contentLayout = static_cast<BitTorrent::TorrentContentLayout>(m_ui->contentLayoutComboBox->currentIndex());
|
||||||
m_contentAdaptor->applyContentLayout(contentLayout);
|
m_contentAdaptor->applyContentLayout(contentLayout);
|
||||||
|
|
Loading…
Reference in a new issue