mirror of
https://github.com/qbittorrent/qBittorrent.git
synced 2025-12-20 07:27:22 -06:00
Move torrent storages one by one
This commit is contained in:
@@ -96,6 +96,8 @@ namespace BitTorrent
|
||||
class TrackerEntry;
|
||||
struct CreateTorrentParams;
|
||||
|
||||
enum class MoveStorageMode;
|
||||
|
||||
// Using `Q_ENUM_NS()` without a wrapper namespace in our case is not advised
|
||||
// since `Q_NAMESPACE` cannot be used when the same namespace resides at different files.
|
||||
// https://www.kdab.com/new-qt-5-8-meta-object-support-namespaces/#comment-143779
|
||||
@@ -461,6 +463,8 @@ namespace BitTorrent
|
||||
void handleTorrentTrackerWarning(TorrentHandle *const torrent, const QString &trackerUrl);
|
||||
void handleTorrentTrackerError(TorrentHandle *const torrent, const QString &trackerUrl);
|
||||
|
||||
bool addMoveTorrentStorageJob(TorrentHandle *torrent, const QString &newPath, MoveStorageMode mode);
|
||||
|
||||
signals:
|
||||
void addTorrentFailed(const QString &error);
|
||||
void allTorrentsFinished();
|
||||
@@ -514,6 +518,13 @@ namespace BitTorrent
|
||||
void networkConfigurationChange(const QNetworkConfiguration &);
|
||||
|
||||
private:
|
||||
struct MoveStorageJob
|
||||
{
|
||||
TorrentHandle *torrent;
|
||||
QString path;
|
||||
MoveStorageMode mode;
|
||||
};
|
||||
|
||||
struct RemovingTorrentData
|
||||
{
|
||||
QString name;
|
||||
@@ -582,6 +593,8 @@ namespace BitTorrent
|
||||
#if (LIBTORRENT_VERSION_NUM >= 10200)
|
||||
void handleAlertsDroppedAlert(const lt::alerts_dropped_alert *p) const;
|
||||
#endif
|
||||
void handleStorageMovedAlert(const lt::storage_moved_alert *p);
|
||||
void handleStorageMovedFailedAlert(const lt::storage_moved_failed_alert *p);
|
||||
|
||||
void createTorrentHandle(const lt::torrent_handle &nativeHandle);
|
||||
|
||||
@@ -591,6 +604,9 @@ namespace BitTorrent
|
||||
|
||||
std::vector<lt::alert *> getPendingAlerts(lt::time_duration time = lt::time_duration::zero()) const;
|
||||
|
||||
void moveTorrentStorage(const MoveStorageJob &job) const;
|
||||
void handleMoveTorrentStorageJobFinished(const QString &errorMessage = {});
|
||||
|
||||
// BitTorrent
|
||||
lt::session *m_nativeSession = nullptr;
|
||||
|
||||
@@ -731,6 +747,8 @@ namespace BitTorrent
|
||||
|
||||
QNetworkConfigurationManager *m_networkManager = nullptr;
|
||||
|
||||
QList<MoveStorageJob> m_moveStorageQueue;
|
||||
|
||||
static Session *m_instance;
|
||||
};
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user