Redesign "Incomplete folder" feature

Change "Incomplete/temp folder" term with "download folder".
Allow to set "download folder" per torrent (in manual mode) and per category (in automatic mode).
This commit is contained in:
Vladimir Golovnev (Glassez)
2021-05-20 10:36:44 +03:00
committed by Vladimir Golovnev (glassez)
parent b0e41abf5a
commit 1c0f8b4289
48 changed files with 1457 additions and 599 deletions

View File

@@ -47,6 +47,7 @@
#include "base/types.h"
#include "addtorrentparams.h"
#include "cachestatus.h"
#include "categoryoptions.h"
#include "sessionstatus.h"
#include "torrentinfo.h"
#include "trackerentry.h"
@@ -211,22 +212,23 @@ namespace BitTorrent
static void freeInstance();
static Session *instance();
QString defaultSavePath() const;
void setDefaultSavePath(QString path);
QString tempPath() const;
void setTempPath(QString path);
bool isTempPathEnabled() const;
void setTempPathEnabled(bool enabled);
QString torrentTempPath(const TorrentInfo &torrentInfo) const;
QString savePath() const;
void setSavePath(const QString &path);
QString downloadPath() const;
void setDownloadPath(const QString &path);
bool isDownloadPathEnabled() const;
void setDownloadPathEnabled(bool enabled);
static bool isValidCategoryName(const QString &name);
// returns category itself and all top level categories
static QStringList expandCategory(const QString &category);
QStringMap categories() const;
QStringList categories() const;
CategoryOptions categoryOptions(const QString &categoryName) const;
QString categorySavePath(const QString &categoryName) const;
bool addCategory(const QString &name, const QString &savePath = "");
bool editCategory(const QString &name, const QString &savePath);
QString categoryDownloadPath(const QString &categoryName) const;
bool addCategory(const QString &name, const CategoryOptions &options = {});
bool editCategory(const QString &name, const CategoryOptions &options);
bool removeCategory(const QString &name);
bool isSubcategoriesEnabled() const;
void setSubcategoriesEnabled(bool value);
@@ -499,7 +501,8 @@ namespace BitTorrent
bool addMoveTorrentStorageJob(TorrentImpl *torrent, const QString &newPath, MoveStorageMode mode);
void findIncompleteFiles(const TorrentInfo &torrentInfo, const QString &savePath, const QStringList &filePaths = {}) const;
void findIncompleteFiles(const TorrentInfo &torrentInfo, const QString &savePath
, const QString &downloadPath, const QStringList &filePaths = {}) const;
signals:
void allTorrentsFinished();
@@ -642,6 +645,10 @@ namespace BitTorrent
void moveTorrentStorage(const MoveStorageJob &job) const;
void handleMoveTorrentStorageJobFinished();
void loadCategories();
void storeCategories() const;
void upgradeCategories();
// BitTorrent
lt::session *m_nativeSession = nullptr;
@@ -729,13 +736,12 @@ namespace BitTorrent
CachedSettingValue<bool> m_isProxyPeerConnectionsEnabled;
CachedSettingValue<ChokingAlgorithm> m_chokingAlgorithm;
CachedSettingValue<SeedChokingAlgorithm> m_seedChokingAlgorithm;
CachedSettingValue<QVariantMap> m_storedCategories;
CachedSettingValue<QStringList> m_storedTags;
CachedSettingValue<int> m_maxRatioAction;
CachedSettingValue<QString> m_defaultSavePath;
CachedSettingValue<QString> m_tempPath;
CachedSettingValue<QString> m_savePath;
CachedSettingValue<QString> m_downloadPath;
CachedSettingValue<bool> m_isSubcategoriesEnabled;
CachedSettingValue<bool> m_isTempPathEnabled;
CachedSettingValue<bool> m_isDownloadPathEnabled;
CachedSettingValue<bool> m_isAutoTMMDisabledByDefault;
CachedSettingValue<bool> m_isDisableAutoTMMWhenCategoryChanged;
CachedSettingValue<bool> m_isDisableAutoTMMWhenDefaultSavePathChanged;
@@ -780,7 +786,7 @@ namespace BitTorrent
QHash<QString, AddTorrentParams> m_downloadedTorrents;
QHash<TorrentID, RemovingTorrentData> m_removingTorrents;
QSet<TorrentID> m_needSaveResumeDataTorrents;
QStringMap m_categories;
QMap<QString, CategoryOptions> m_categories;
QSet<QString> m_tags;
// I/O errored torrents
@@ -800,6 +806,8 @@ namespace BitTorrent
QString m_lastExternalIP;
bool m_needUpgradeDownloadPath = false;
static Session *m_instance;
};
}