Browse Source

Merge pull request #6677 from glassez/fix-create-subfolder

Allow strip root folder using default settings
adaptive-webui-19844
Vladimir Golovnev 8 years ago committed by GitHub
parent
commit
e433cbab97
  1. 14
      src/base/bittorrent/session.cpp
  2. 2
      src/base/bittorrent/session.h
  3. 13
      src/base/bittorrent/torrenthandle.cpp
  4. 4
      src/base/bittorrent/torrenthandle.h
  5. 2
      src/gui/addnewtorrentdialog.cpp

14
src/base/bittorrent/session.cpp

@ -3372,8 +3372,8 @@ void Session::createTorrentHandle(const libt::torrent_handle &nativeHandle)
bool fromMagnetUri = !torrent->hasMetadata(); bool fromMagnetUri = !torrent->hasMetadata();
if (data.resumed) { if (data.resumed) {
if (fromMagnetUri && (data.addPaused != TriStateBool::True)) if (fromMagnetUri && !data.addPaused)
torrent->resume(data.addForced == TriStateBool::True); torrent->resume(data.addForced);
logger->addMessage(tr("'%1' resumed. (fast resume)", "'torrent name' was resumed. (fast resume)") logger->addMessage(tr("'%1' resumed. (fast resume)", "'torrent name' was resumed. (fast resume)")
.arg(torrent->name())); .arg(torrent->name()));
@ -3399,12 +3399,8 @@ void Session::createTorrentHandle(const libt::torrent_handle &nativeHandle)
if (isAddTrackersEnabled() && !torrent->isPrivate()) if (isAddTrackersEnabled() && !torrent->isPrivate())
torrent->addTrackers(m_additionalTrackerList); torrent->addTrackers(m_additionalTrackerList);
bool addPaused = (data.addPaused == TriStateBool::True);
if (data.addPaused == TriStateBool::Undefined)
addPaused = isAddTorrentPaused();
// Start torrent because it was added in paused state // Start torrent because it was added in paused state
if (!addPaused) if (!data.addPaused)
torrent->resume(); torrent->resume();
logger->addMessage(tr("'%1' added to download list.", "'torrent name' was added to download list.") logger->addMessage(tr("'%1' added to download list.", "'torrent name' was added to download list.")
.arg(torrent->name())); .arg(torrent->name()));
@ -3664,8 +3660,8 @@ namespace
torrentData.hasRootFolder = fast.dict_find_int_value("qBt-hasRootFolder"); torrentData.hasRootFolder = fast.dict_find_int_value("qBt-hasRootFolder");
magnetUri = MagnetUri(QString::fromStdString(fast.dict_find_string_value("qBt-magnetUri"))); magnetUri = MagnetUri(QString::fromStdString(fast.dict_find_string_value("qBt-magnetUri")));
torrentData.addPaused = TriStateBool(fast.dict_find_int_value("qBt-paused")); torrentData.addPaused = fast.dict_find_int_value("qBt-paused");
torrentData.addForced = TriStateBool(fast.dict_find_int_value("qBt-forced")); torrentData.addForced = fast.dict_find_int_value("qBt-forced");
prio = fast.dict_find_int_value("qBt-queuePosition"); prio = fast.dict_find_int_value("qBt-queuePosition");

2
src/base/bittorrent/session.h

@ -147,7 +147,7 @@ namespace BitTorrent
QVector<int> filePriorities; // used if TorrentInfo is set QVector<int> filePriorities; // used if TorrentInfo is set
bool ignoreShareRatio = false; bool ignoreShareRatio = false;
bool skipChecking = false; bool skipChecking = false;
bool createSubfolder = true; TriStateBool createSubfolder;
}; };
struct TorrentStatusReport struct TorrentStatusReport

13
src/base/bittorrent/torrenthandle.cpp

@ -76,6 +76,9 @@ AddTorrentData::AddTorrentData()
, sequential(false) , sequential(false)
, hasSeedStatus(false) , hasSeedStatus(false)
, skipChecking(false) , skipChecking(false)
, hasRootFolder(true)
, addForced(false)
, addPaused(false)
, ratioLimit(TorrentHandle::USE_GLOBAL_RATIO) , ratioLimit(TorrentHandle::USE_GLOBAL_RATIO)
{ {
} }
@ -89,9 +92,13 @@ AddTorrentData::AddTorrentData(const AddTorrentParams &params)
, sequential(params.sequential) , sequential(params.sequential)
, hasSeedStatus(params.skipChecking) // do not react on 'torrent_finished_alert' when skipping , hasSeedStatus(params.skipChecking) // do not react on 'torrent_finished_alert' when skipping
, skipChecking(params.skipChecking) , skipChecking(params.skipChecking)
, hasRootFolder(params.createSubfolder) , hasRootFolder(params.createSubfolder == TriStateBool::Undefined
, addForced(params.addForced) ? Session::instance()->isCreateTorrentSubfolder()
, addPaused(params.addPaused) : params.createSubfolder == TriStateBool::True)
, addForced(params.addForced == TriStateBool::True)
, addPaused(params.addPaused == TriStateBool::Undefined
? Session::instance()->isAddTorrentPaused()
: params.addPaused == TriStateBool::True)
, filePriorities(params.filePriorities) , filePriorities(params.filePriorities)
, ratioLimit(params.ignoreShareRatio ? TorrentHandle::NO_RATIO_LIMIT : TorrentHandle::USE_GLOBAL_RATIO) , ratioLimit(params.ignoreShareRatio ? TorrentHandle::NO_RATIO_LIMIT : TorrentHandle::USE_GLOBAL_RATIO)
{ {

4
src/base/bittorrent/torrenthandle.h

@ -99,8 +99,8 @@ namespace BitTorrent
bool hasSeedStatus; bool hasSeedStatus;
bool skipChecking; bool skipChecking;
bool hasRootFolder; bool hasRootFolder;
TriStateBool addForced; bool addForced;
TriStateBool addPaused; bool addPaused;
// for new torrents // for new torrents
QVector<int> filePriorities; QVector<int> filePriorities;
// for resumed torrents // for resumed torrents

2
src/gui/addnewtorrentdialog.cpp

@ -642,7 +642,7 @@ void AddNewTorrentDialog::accept()
params.filePriorities = m_contentModel->model()->getFilePriorities(); params.filePriorities = m_contentModel->model()->getFilePriorities();
params.addPaused = TriStateBool(!ui->startTorrentCheckBox->isChecked()); params.addPaused = TriStateBool(!ui->startTorrentCheckBox->isChecked());
params.createSubfolder = ui->createSubfolderCheckBox->isChecked(); params.createSubfolder = TriStateBool(ui->createSubfolderCheckBox->isChecked());
QString savePath = ui->savePathComboBox->itemData(ui->savePathComboBox->currentIndex()).toString(); QString savePath = ui->savePathComboBox->itemData(ui->savePathComboBox->currentIndex()).toString();
if (ui->comboTTM->currentIndex() != 1) { // 0 is Manual mode and 1 is Automatic mode. Handle all non 1 values as manual mode. if (ui->comboTTM->currentIndex() != 1) { // 0 is Manual mode and 1 is Automatic mode. Handle all non 1 values as manual mode.

Loading…
Cancel
Save