Browse Source

Merge pull request #3730 from Gelmir/rss_save

Couple o' fixes to RSS
adaptive-webui-19844
sledgehammer999 9 years ago
parent
commit
57ca831d4d
  1. 7
      src/core/preferences.cpp
  2. 2
      src/core/preferences.h
  3. 4
      src/gui/rss/automatedrssdownloader.cpp
  4. 4
      src/gui/rss/rssdownloadrulelist.cpp
  5. 1
      src/gui/transferlistfilterswidget.cpp
  6. 2
      src/gui/transferlistfilterswidget.h

7
src/core/preferences.cpp

@ -1616,6 +1616,13 @@ void Preferences::setTorrentLabels(const QStringList& labels)
setValue("TransferListFilters/customLabels", labels); setValue("TransferListFilters/customLabels", labels);
} }
void Preferences::addTorrentLabelExternal(const QString &label)
{
addTorrentLabel(label);
QString toEmit = label;
emit externalLabelAdded(toEmit);
}
void Preferences::addTorrentLabel(const QString& label) void Preferences::addTorrentLabel(const QString& label)
{ {
QStringList labels = value("TransferListFilters/customLabels").toStringList(); QStringList labels = value("TransferListFilters/customLabels").toStringList();

2
src/core/preferences.h

@ -112,6 +112,7 @@ private slots:
signals: signals:
void changed(); void changed();
void externalLabelAdded(QString&);
public: public:
static void initInstance(); static void initInstance();
@ -399,6 +400,7 @@ public:
#endif #endif
QStringList getTorrentLabels() const; QStringList getTorrentLabels() const;
void setTorrentLabels(const QStringList& labels); void setTorrentLabels(const QStringList& labels);
void addTorrentLabelExternal(const QString &label);
void addTorrentLabel(const QString& label); void addTorrentLabel(const QString& label);
void removeTorrentLabel(const QString& label); void removeTorrentLabel(const QString& label);
bool recursiveDownloadDisabled() const; bool recursiveDownloadDisabled() const;

4
src/gui/rss/automatedrssdownloader.cpp

@ -248,7 +248,9 @@ void AutomatedRssDownloader::updateRuleDefinitionBox()
ui->lineEFilter->clear(); ui->lineEFilter->clear();
ui->saveDiffDir_check->setChecked(!rule->savePath().isEmpty()); ui->saveDiffDir_check->setChecked(!rule->savePath().isEmpty());
ui->lineSavePath->setText(Utils::Fs::toNativePath(rule->savePath())); ui->lineSavePath->setText(Utils::Fs::toNativePath(rule->savePath()));
ui->checkRegex->blockSignals(true);
ui->checkRegex->setChecked(rule->useRegex()); ui->checkRegex->setChecked(rule->useRegex());
ui->checkRegex->blockSignals(false);
if (rule->label().isEmpty()) { if (rule->label().isEmpty()) {
ui->comboLabel->setCurrentIndex(-1); ui->comboLabel->setCurrentIndex(-1);
ui->comboLabel->clearEditText(); ui->comboLabel->clearEditText();
@ -344,7 +346,7 @@ void AutomatedRssDownloader::saveEditedRule()
rule->setAddPaused(RssDownloadRule::AddPausedState(ui->comboAddPaused->currentIndex())); rule->setAddPaused(RssDownloadRule::AddPausedState(ui->comboAddPaused->currentIndex()));
// Save new label // Save new label
if (!rule->label().isEmpty()) if (!rule->label().isEmpty())
Preferences::instance()->addTorrentLabel(rule->label()); Preferences::instance()->addTorrentLabelExternal(rule->label());
rule->setIgnoreDays(ui->spinIgnorePeriod->value()); rule->setIgnoreDays(ui->spinIgnorePeriod->value());
//rule->setRssFeeds(getSelectedFeeds()); //rule->setRssFeeds(getSelectedFeeds());
// Save it // Save it

4
src/gui/rss/rssdownloadrulelist.cpp

@ -85,8 +85,12 @@ void RssDownloadRuleList::loadRulesFromVariantHash(const QVariantHash &h)
{ {
QVariantHash::ConstIterator it = h.begin(); QVariantHash::ConstIterator it = h.begin();
QVariantHash::ConstIterator itend = h.end(); QVariantHash::ConstIterator itend = h.end();
QStringList labels = Preferences::instance()->getTorrentLabels();
for ( ; it != itend; ++it) { for ( ; it != itend; ++it) {
RssDownloadRulePtr rule = RssDownloadRule::fromVariantHash(it.value().toHash()); RssDownloadRulePtr rule = RssDownloadRule::fromVariantHash(it.value().toHash());
// Hack to readd labels forgotten before fix
if (!labels.contains(rule->label()))
Preferences::instance()->addTorrentLabelExternal(rule->label());
if (rule && !rule->name().isEmpty()) if (rule && !rule->name().isEmpty())
saveRule(rule); saveRule(rule);
} }

1
src/gui/transferlistfilterswidget.cpp

@ -820,6 +820,7 @@ TransferListFiltersWidget::TransferListFiltersWidget(QWidget *parent, TransferLi
connect(statusLabel, SIGNAL(toggled(bool)), pref, SLOT(setStatusFilterState(const bool))); connect(statusLabel, SIGNAL(toggled(bool)), pref, SLOT(setStatusFilterState(const bool)));
connect(labelLabel, SIGNAL(toggled(bool)), labelFilters, SLOT(toggleFilter(bool))); connect(labelLabel, SIGNAL(toggled(bool)), labelFilters, SLOT(toggleFilter(bool)));
connect(labelLabel, SIGNAL(toggled(bool)), pref, SLOT(setLabelFilterState(const bool))); connect(labelLabel, SIGNAL(toggled(bool)), pref, SLOT(setLabelFilterState(const bool)));
connect(pref, SIGNAL(externalLabelAdded(QString&)), labelFilters, SLOT(addItem(QString&)));
connect(trackerLabel, SIGNAL(toggled(bool)), trackerFilters, SLOT(toggleFilter(bool))); connect(trackerLabel, SIGNAL(toggled(bool)), trackerFilters, SLOT(toggleFilter(bool)));
connect(trackerLabel, SIGNAL(toggled(bool)), pref, SLOT(setTrackerFilterState(const bool))); connect(trackerLabel, SIGNAL(toggled(bool)), pref, SLOT(setTrackerFilterState(const bool)));
connect(this, SIGNAL(trackerSuccess(const QString &, const QString &)), trackerFilters, SLOT(trackerSuccess(const QString &, const QString &))); connect(this, SIGNAL(trackerSuccess(const QString &, const QString &)), trackerFilters, SLOT(trackerSuccess(const QString &, const QString &)));

2
src/gui/transferlistfilterswidget.h

@ -101,7 +101,7 @@ public:
private slots: private slots:
// Redefine addItem() to make sure the list stays sorted // Redefine addItem() to make sure the list stays sorted
void addItem(QString &label, bool hasTorrent); void addItem(QString &label, bool hasTorrent = false);
void removeItem(const QString &label); void removeItem(const QString &label);
void removeSelectedLabel(); void removeSelectedLabel();
void removeUnusedLabels(); void removeUnusedLabels();

Loading…
Cancel
Save