mirror of
https://github.com/d47081/qBittorrent.git
synced 2025-01-22 12:34:19 +00:00
Added back support for RSS download rules export
This commit is contained in:
parent
e824bc8bb1
commit
265ab7bef2
@ -10,6 +10,7 @@
|
|||||||
- FEATURE: Bring up the connection settings when clicking on the connection status icon
|
- FEATURE: Bring up the connection settings when clicking on the connection status icon
|
||||||
- COSMETIC: Replaced message box by on-screen notification for download errors
|
- COSMETIC: Replaced message box by on-screen notification for download errors
|
||||||
- COSMETIC: Improved the torrent creation tool appearance
|
- COSMETIC: Improved the torrent creation tool appearance
|
||||||
|
- OTHERS: Dropped support for Qt <= 4.4
|
||||||
|
|
||||||
* Tue Aug 24 2010 - Christophe Dumez <chris@qbittorrent.org> - v2.4.0
|
* Tue Aug 24 2010 - Christophe Dumez <chris@qbittorrent.org> - v2.4.0
|
||||||
- FEATURE: Added actions to "Move to top/bottom" of priority queue
|
- FEATURE: Added actions to "Move to top/bottom" of priority queue
|
||||||
|
@ -216,7 +216,7 @@ void AutomatedRssDownloader::saveCurrentRule(QListWidgetItem * item)
|
|||||||
rule.setLabel(ui->comboLabel->currentText());
|
rule.setLabel(ui->comboLabel->currentText());
|
||||||
// Save new label
|
// Save new label
|
||||||
if(!rule.label().isEmpty())
|
if(!rule.label().isEmpty())
|
||||||
Preferences::addTorrentLabel(rule.label());
|
Preferences::addTorrentLabel(rule.label());
|
||||||
rule.setRssFeeds(getSelectedFeeds());
|
rule.setRssFeeds(getSelectedFeeds());
|
||||||
// Save it
|
// Save it
|
||||||
m_ruleList->saveRule(rule);
|
m_ruleList->saveRule(rule);
|
||||||
@ -259,3 +259,25 @@ void AutomatedRssDownloader::on_browseSP_clicked()
|
|||||||
if(!save_path.isEmpty())
|
if(!save_path.isEmpty())
|
||||||
ui->lineSavePath->setText(save_path);
|
ui->lineSavePath->setText(save_path);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void AutomatedRssDownloader::on_exportBtn_clicked()
|
||||||
|
{
|
||||||
|
if(m_ruleList->isEmpty()) {
|
||||||
|
QMessageBox::warning(this, tr("Invalid action"), tr("The list is empty, there is nothing to export."));
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
// Ask for a save path
|
||||||
|
QString save_path = QFileDialog::getSaveFileName(this, tr("Where would you like to save the list?"), QDir::homePath(), tr("Rule list (*.rssrules *.filters)"));
|
||||||
|
if(save_path.isEmpty()) return;
|
||||||
|
if(!save_path.endsWith(".rssrules", Qt::CaseInsensitive))
|
||||||
|
save_path += ".rssrules";
|
||||||
|
if(!m_ruleList->serialize(save_path)) {
|
||||||
|
QMessageBox::warning(this, tr("I/O Error"), tr("Failed to create the destination file"));
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void AutomatedRssDownloader::on_importBtn_clicked()
|
||||||
|
{
|
||||||
|
// TODO
|
||||||
|
}
|
||||||
|
@ -64,6 +64,10 @@ private slots:
|
|||||||
void on_removeRuleBtn_clicked();
|
void on_removeRuleBtn_clicked();
|
||||||
void on_browseSP_clicked();
|
void on_browseSP_clicked();
|
||||||
|
|
||||||
|
void on_exportBtn_clicked();
|
||||||
|
|
||||||
|
void on_importBtn_clicked();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
RssDownloadRule getCurrentRule() const;
|
RssDownloadRule getCurrentRule() const;
|
||||||
void initLabelCombobox();
|
void initLabelCombobox();
|
||||||
|
@ -28,6 +28,8 @@
|
|||||||
* Contact : chris@qbittorrent.org
|
* Contact : chris@qbittorrent.org
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
#include <QFile>
|
||||||
|
|
||||||
#include "rssdownloadrulelist.h"
|
#include "rssdownloadrulelist.h"
|
||||||
#include "qinisettings.h"
|
#include "qinisettings.h"
|
||||||
|
|
||||||
@ -135,7 +137,7 @@ void RssDownloadRuleList::removeRule(const QString &name)
|
|||||||
const RssDownloadRule rule = m_rules.take(name);
|
const RssDownloadRule rule = m_rules.take(name);
|
||||||
// Update feedRules hashtable
|
// Update feedRules hashtable
|
||||||
foreach(const QString &feed_url, rule.rssFeeds()) {
|
foreach(const QString &feed_url, rule.rssFeeds()) {
|
||||||
m_feedRules[feed_url].removeOne(rule.name());
|
m_feedRules[feed_url].removeOne(rule.name());
|
||||||
}
|
}
|
||||||
// Save rules
|
// Save rules
|
||||||
saveRulesToStorage();
|
saveRulesToStorage();
|
||||||
@ -158,7 +160,7 @@ void RssDownloadRuleList::renameRule(const QString &old_name, const QString &new
|
|||||||
m_rules.insert(new_name, rule);
|
m_rules.insert(new_name, rule);
|
||||||
// Update feedRules hashtable
|
// Update feedRules hashtable
|
||||||
foreach(const QString &feed_url, rule.rssFeeds()) {
|
foreach(const QString &feed_url, rule.rssFeeds()) {
|
||||||
m_feedRules[feed_url].replace(m_feedRules[feed_url].indexOf(old_name), new_name);
|
m_feedRules[feed_url].replace(m_feedRules[feed_url].indexOf(old_name), new_name);
|
||||||
}
|
}
|
||||||
// Save rules
|
// Save rules
|
||||||
saveRulesToStorage();
|
saveRulesToStorage();
|
||||||
@ -168,3 +170,17 @@ RssDownloadRule RssDownloadRuleList::getRule(const QString &name) const
|
|||||||
{
|
{
|
||||||
return m_rules.value(name);
|
return m_rules.value(name);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool RssDownloadRuleList::serialize(const QString& path)
|
||||||
|
{
|
||||||
|
QFile f(path);
|
||||||
|
if(f.open(QIODevice::WriteOnly)) {
|
||||||
|
QDataStream out(&f);
|
||||||
|
out.setVersion(QDataStream::Qt_4_5);
|
||||||
|
out << toVariantHash();
|
||||||
|
f.close();
|
||||||
|
return true;
|
||||||
|
} else {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
@ -57,6 +57,8 @@ public:
|
|||||||
void renameRule(const QString &old_name, const QString &new_name);
|
void renameRule(const QString &old_name, const QString &new_name);
|
||||||
RssDownloadRule getRule(const QString &name) const;
|
RssDownloadRule getRule(const QString &name) const;
|
||||||
inline QStringList ruleNames() const { return m_rules.keys(); }
|
inline QStringList ruleNames() const { return m_rules.keys(); }
|
||||||
|
inline bool isEmpty() const { return m_rules.isEmpty(); }
|
||||||
|
bool serialize(const QString& path);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
void loadRulesFromStorage();
|
void loadRulesFromStorage();
|
||||||
|
Loading…
x
Reference in New Issue
Block a user