mirror of
https://github.com/qbittorrent/qBittorrent.git
synced 2025-12-17 22:18:05 -06:00
Added back support for RSS download rules export
This commit is contained in:
@@ -10,6 +10,7 @@
|
||||
- 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: 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
|
||||
- FEATURE: Added actions to "Move to top/bottom" of priority queue
|
||||
|
||||
@@ -259,3 +259,25 @@ void AutomatedRssDownloader::on_browseSP_clicked()
|
||||
if(!save_path.isEmpty())
|
||||
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_browseSP_clicked();
|
||||
|
||||
void on_exportBtn_clicked();
|
||||
|
||||
void on_importBtn_clicked();
|
||||
|
||||
private:
|
||||
RssDownloadRule getCurrentRule() const;
|
||||
void initLabelCombobox();
|
||||
|
||||
@@ -28,6 +28,8 @@
|
||||
* Contact : chris@qbittorrent.org
|
||||
*/
|
||||
|
||||
#include <QFile>
|
||||
|
||||
#include "rssdownloadrulelist.h"
|
||||
#include "qinisettings.h"
|
||||
|
||||
@@ -168,3 +170,17 @@ RssDownloadRule RssDownloadRuleList::getRule(const QString &name) const
|
||||
{
|
||||
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);
|
||||
RssDownloadRule getRule(const QString &name) const;
|
||||
inline QStringList ruleNames() const { return m_rules.keys(); }
|
||||
inline bool isEmpty() const { return m_rules.isEmpty(); }
|
||||
bool serialize(const QString& path);
|
||||
|
||||
private:
|
||||
void loadRulesFromStorage();
|
||||
|
||||
Reference in New Issue
Block a user