Allow to add root folder to torrent content

This commit is contained in:
Vladimir Golovnev (Glassez)
2020-12-10 09:54:27 +03:00
parent d4a51979bb
commit 1d5dc283fe
30 changed files with 452 additions and 172 deletions

View File

@@ -275,11 +275,9 @@ void AutomatedRssDownloader::updateRuleDefinitionBox()
index = 2;
m_ui->comboAddPaused->setCurrentIndex(index);
index = 0;
if (m_currentRule.createSubfolder() == TriStateBool::True)
index = 1;
else if (m_currentRule.createSubfolder() == TriStateBool::False)
index = 2;
m_ui->comboCreateSubfolder->setCurrentIndex(index);
if (m_currentRule.torrentContentLayout())
index = static_cast<int>(*m_currentRule.torrentContentLayout()) + 1;
m_ui->comboContentLayout->setCurrentIndex(index);
m_ui->spinIgnorePeriod->setValue(m_currentRule.ignoreDays());
QDateTime dateTime = m_currentRule.lastMatch();
QString lMatch;
@@ -320,8 +318,8 @@ void AutomatedRssDownloader::clearRuleDefinitionBox()
m_ui->spinIgnorePeriod->setValue(0);
m_ui->comboAddPaused->clearEditText();
m_ui->comboAddPaused->setCurrentIndex(-1);
m_ui->comboCreateSubfolder->clearEditText();
m_ui->comboCreateSubfolder->setCurrentIndex(-1);
m_ui->comboContentLayout->clearEditText();
m_ui->comboContentLayout->setCurrentIndex(-1);
updateFieldsToolTips(m_ui->checkRegex->isChecked());
updateMustLineValidity();
updateMustNotLineValidity();
@@ -355,12 +353,12 @@ void AutomatedRssDownloader::updateEditedRule()
else if (m_ui->comboAddPaused->currentIndex() == 2)
addPaused = TriStateBool::False;
m_currentRule.setAddPaused(addPaused);
TriStateBool createSubfolder; // Undefined by default
if (m_ui->comboCreateSubfolder->currentIndex() == 1)
createSubfolder = TriStateBool::True;
else if (m_ui->comboCreateSubfolder->currentIndex() == 2)
createSubfolder = TriStateBool::False;
m_currentRule.setCreateSubfolder(createSubfolder);
boost::optional<BitTorrent::TorrentContentLayout> contentLayout;
if (m_ui->comboContentLayout->currentIndex() > 0)
contentLayout = static_cast<BitTorrent::TorrentContentLayout>(m_ui->comboContentLayout->currentIndex() - 1);
m_currentRule.setTorrentContentLayout(contentLayout);
m_currentRule.setIgnoreDays(m_ui->spinIgnorePeriod->value());
}

View File

@@ -325,7 +325,7 @@ Supports the formats: S01E01, 1x1, 2017.12.31 and 31.12.2017 (Date formats also
<item>
<layout class="QHBoxLayout" name="horizontalLayout_10">
<item>
<widget class="QLabel" name="lblKeepTopLevelFolder">
<widget class="QLabel" name="lblContentLayout">
<property name="sizePolicy">
<sizepolicy hsizetype="Fixed" vsizetype="Preferred">
<horstretch>0</horstretch>
@@ -333,12 +333,12 @@ Supports the formats: S01E01, 1x1, 2017.12.31 and 31.12.2017 (Date formats also
</sizepolicy>
</property>
<property name="text">
<string>Keep top-level folder:</string>
<string>Torrent content layout:</string>
</property>
</widget>
</item>
<item>
<widget class="QComboBox" name="comboCreateSubfolder">
<widget class="QComboBox" name="comboContentLayout">
<item>
<property name="text">
<string>Use global settings</string>
@@ -346,12 +346,17 @@ Supports the formats: S01E01, 1x1, 2017.12.31 and 31.12.2017 (Date formats also
</item>
<item>
<property name="text">
<string>Always</string>
<string>Original</string>
</property>
</item>
<item>
<property name="text">
<string>Never</string>
<string>Create subfolder</string>
</property>
</item>
<item>
<property name="text">
<string>Don't create subfolder</string>
</property>
</item>
</widget>
@@ -471,7 +476,7 @@ Supports the formats: S01E01, 1x1, 2017.12.31 and 31.12.2017 (Date formats also
<tabstop>lineSavePath</tabstop>
<tabstop>spinIgnorePeriod</tabstop>
<tabstop>comboAddPaused</tabstop>
<tabstop>comboCreateSubfolder</tabstop>
<tabstop>comboContentLayout</tabstop>
<tabstop>listFeeds</tabstop>
<tabstop>treeMatchingArticles</tabstop>
<tabstop>importBtn</tabstop>