mirror of
https://github.com/qbittorrent/qBittorrent.git
synced 2025-12-31 20:58:07 -06:00
Allow to add root folder to torrent content
This commit is contained in:
@@ -56,6 +56,7 @@
|
||||
#include "base/utils/misc.h"
|
||||
#include "base/utils/net.h"
|
||||
#include "base/utils/password.h"
|
||||
#include "base/utils/string.h"
|
||||
#include "../webapplication.h"
|
||||
|
||||
void AppController::webapiVersionAction()
|
||||
@@ -100,7 +101,7 @@ void AppController::preferencesAction()
|
||||
|
||||
// Downloads
|
||||
// When adding a torrent
|
||||
data["create_subfolder_enabled"] = session->isKeepTorrentTopLevelFolder();
|
||||
data["torrent_content_layout"] = Utils::String::fromEnum(session->torrentContentLayout());
|
||||
data["start_paused_enabled"] = session->isAddTorrentPaused();
|
||||
data["auto_delete_mode"] = static_cast<int>(TorrentFileGuard::autoDeleteMode());
|
||||
data["preallocate_all"] = session->isPreallocationEnabled();
|
||||
@@ -355,8 +356,8 @@ void AppController::setPreferencesAction()
|
||||
|
||||
// Downloads
|
||||
// When adding a torrent
|
||||
if (hasKey("create_subfolder_enabled"))
|
||||
session->setKeepTorrentTopLevelFolder(it.value().toBool());
|
||||
if (hasKey("torrent_content_layout"))
|
||||
session->setTorrentContentLayout(Utils::String::toEnum(it.value().toString(), BitTorrent::TorrentContentLayout::Original));
|
||||
if (hasKey("start_paused_enabled"))
|
||||
session->setAddTorrentPaused(it.value().toBool());
|
||||
if (hasKey("auto_delete_mode"))
|
||||
|
||||
@@ -568,7 +568,6 @@ void TorrentsController::addAction()
|
||||
const bool seqDownload = parseBool(params()["sequentialDownload"], false);
|
||||
const bool firstLastPiece = parseBool(params()["firstLastPiecePrio"], false);
|
||||
const TriStateBool addPaused = parseTriStateBool(params()["paused"]);
|
||||
const TriStateBool rootFolder = parseTriStateBool(params()["root_folder"]);
|
||||
const QString savepath = params()["savepath"].trimmed();
|
||||
const QString category = params()["category"];
|
||||
const QSet<QString> tags = List::toSet(params()["tags"].split(',', QString::SkipEmptyParts));
|
||||
@@ -578,6 +577,11 @@ void TorrentsController::addAction()
|
||||
const int dlLimit = params()["dlLimit"].toInt();
|
||||
const TriStateBool autoTMM = parseTriStateBool(params()["autoTMM"]);
|
||||
|
||||
const QString contentLayoutParam = params()["contentLayout"];
|
||||
const boost::optional<BitTorrent::TorrentContentLayout> contentLayout = (!contentLayoutParam.isEmpty()
|
||||
? Utils::String::toEnum(contentLayoutParam, BitTorrent::TorrentContentLayout::Original)
|
||||
: boost::optional<BitTorrent::TorrentContentLayout> {});
|
||||
|
||||
QList<QNetworkCookie> cookies;
|
||||
if (!cookie.isEmpty())
|
||||
{
|
||||
@@ -601,7 +605,7 @@ void TorrentsController::addAction()
|
||||
params.sequential = seqDownload;
|
||||
params.firstLastPiecePriority = firstLastPiece;
|
||||
params.addPaused = addPaused;
|
||||
params.createSubfolder = rootFolder;
|
||||
params.contentLayout = contentLayout;
|
||||
params.savePath = savepath;
|
||||
params.category = category;
|
||||
params.tags = tags;
|
||||
|
||||
Reference in New Issue
Block a user