mirror of
https://github.com/qbittorrent/qBittorrent.git
synced 2026-01-01 05:08:05 -06:00
Migrate everything to use the new Preferences class and not access directly the qbittorrent.ini file.
This commit is contained in:
@@ -36,14 +36,13 @@
|
||||
|
||||
#include "automatedrssdownloader.h"
|
||||
#include "ui_automatedrssdownloader.h"
|
||||
#include "rsssettings.h"
|
||||
#include "rssdownloadrulelist.h"
|
||||
#include "preferences.h"
|
||||
#include "qinisettings.h"
|
||||
#include "rssmanager.h"
|
||||
#include "rssfeed.h"
|
||||
#include "iconprovider.h"
|
||||
#include "autoexpandabledialog.h"
|
||||
#include "fs_utils.h"
|
||||
|
||||
AutomatedRssDownloader::AutomatedRssDownloader(const QWeakPointer<RssManager>& manager, QWidget *parent) :
|
||||
QDialog(parent),
|
||||
@@ -119,21 +118,21 @@ AutomatedRssDownloader::~AutomatedRssDownloader()
|
||||
void AutomatedRssDownloader::loadSettings()
|
||||
{
|
||||
// load dialog geometry
|
||||
QIniSettings settings;
|
||||
restoreGeometry(settings.value("RssFeedDownloader/geometry").toByteArray());
|
||||
ui->checkEnableDownloader->setChecked(RssSettings().isRssDownloadingEnabled());
|
||||
ui->hsplitter->restoreState(settings.value("RssFeedDownloader/hsplitterSizes").toByteArray());
|
||||
const Preferences* const pref = Preferences::instance();
|
||||
restoreGeometry(pref->getRssGeometry());
|
||||
ui->checkEnableDownloader->setChecked(pref->isRssDownloadingEnabled());
|
||||
ui->hsplitter->restoreState(pref->getRssHSplitterSizes());
|
||||
// Display download rules
|
||||
loadRulesList();
|
||||
}
|
||||
|
||||
void AutomatedRssDownloader::saveSettings()
|
||||
{
|
||||
RssSettings().setRssDownloadingEnabled(ui->checkEnableDownloader->isChecked());
|
||||
Preferences::instance()->setRssDownloadingEnabled(ui->checkEnableDownloader->isChecked());
|
||||
// Save dialog geometry
|
||||
QIniSettings settings;
|
||||
settings.setValue("RssFeedDownloader/geometry", saveGeometry());
|
||||
settings.setValue("RssFeedDownloader/hsplitterSizes", ui->hsplitter->saveState());
|
||||
Preferences* const pref = Preferences::instance();
|
||||
pref->setRssGeometry(saveGeometry());
|
||||
pref->setRssHSplitterSizes(ui->hsplitter->saveState());
|
||||
}
|
||||
|
||||
void AutomatedRssDownloader::loadRulesList()
|
||||
@@ -157,9 +156,9 @@ void AutomatedRssDownloader::loadRulesList()
|
||||
|
||||
void AutomatedRssDownloader::loadFeedList()
|
||||
{
|
||||
const RssSettings settings;
|
||||
const QStringList feed_aliases = settings.getRssFeedsAliases();
|
||||
const QStringList feed_urls = settings.getRssFeedsUrls();
|
||||
const Preferences* const pref = Preferences::instance();
|
||||
const QStringList feed_aliases = pref->getRssFeedsAliases();
|
||||
const QStringList feed_urls = pref->getRssFeedsUrls();
|
||||
QStringList existing_urls;
|
||||
for (int i=0; i<feed_aliases.size(); ++i) {
|
||||
QString feed_url = feed_urls.at(i);
|
||||
@@ -275,7 +274,7 @@ RssDownloadRulePtr AutomatedRssDownloader::getCurrentRule() const
|
||||
void AutomatedRssDownloader::initLabelCombobox()
|
||||
{
|
||||
// Load custom labels
|
||||
const QStringList customLabels = Preferences().getTorrentLabels();
|
||||
const QStringList customLabels = Preferences::instance()->getTorrentLabels();
|
||||
foreach (const QString& label, customLabels) {
|
||||
ui->comboLabel->addItem(label);
|
||||
}
|
||||
@@ -309,7 +308,7 @@ void AutomatedRssDownloader::saveEditedRule()
|
||||
rule->setLabel(ui->comboLabel->currentText());
|
||||
// Save new label
|
||||
if (!rule->label().isEmpty())
|
||||
Preferences().addTorrentLabel(rule->label());
|
||||
Preferences::instance()->addTorrentLabel(rule->label());
|
||||
//rule->setRssFeeds(getSelectedFeeds());
|
||||
// Save it
|
||||
m_editableRuleList->saveRule(rule);
|
||||
|
||||
@@ -9,7 +9,6 @@ HEADERS += $$PWD/rss_imp.h \
|
||||
$$PWD/rssfile.h \
|
||||
$$PWD/rssarticle.h \
|
||||
$$PWD/automatedrssdownloader.h \
|
||||
$$PWD/rsssettings.h \
|
||||
$$PWD/rssdownloadrule.h \
|
||||
$$PWD/rssdownloadrulelist.h \
|
||||
$$PWD/cookiesdlg.h \
|
||||
|
||||
@@ -35,6 +35,7 @@
|
||||
#include <QString>
|
||||
#include <QClipboard>
|
||||
#include <QDragMoveEvent>
|
||||
#include <QDebug>
|
||||
|
||||
#include "rss_imp.h"
|
||||
#include "feedlistwidget.h"
|
||||
@@ -47,7 +48,6 @@
|
||||
#include "rssarticle.h"
|
||||
#include "rssparser.h"
|
||||
#include "rssfeed.h"
|
||||
#include "rsssettings.h"
|
||||
#include "automatedrssdownloader.h"
|
||||
#include "iconprovider.h"
|
||||
#include "autoexpandabledialog.h"
|
||||
@@ -134,11 +134,11 @@ void RSSImp::on_actionManage_cookies_triggered()
|
||||
qDebug("RSS Feed hostname is: %s", qPrintable(feed_hostname));
|
||||
Q_ASSERT(!feed_hostname.isEmpty());
|
||||
bool ok = false;
|
||||
RssSettings settings;
|
||||
QList<QByteArray> raw_cookies = CookiesDlg::askForCookies(this, settings.getHostNameCookies(feed_hostname), &ok);
|
||||
Preferences* const pref = Preferences::instance();
|
||||
QList<QByteArray> raw_cookies = CookiesDlg::askForCookies(this, pref->getHostNameCookies(feed_hostname), &ok);
|
||||
if (ok) {
|
||||
qDebug() << "Settings cookies for host name: " << feed_hostname;
|
||||
settings.setHostNameCookies(feed_hostname, raw_cookies);
|
||||
pref->setHostNameCookies(feed_hostname, raw_cookies);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -283,10 +283,7 @@ void RSSImp::deleteSelectedItems()
|
||||
|
||||
void RSSImp::loadFoldersOpenState()
|
||||
{
|
||||
QIniSettings settings;
|
||||
settings.beginGroup("Rss");
|
||||
QStringList open_folders = settings.value("open_folders", QStringList()).toStringList();
|
||||
settings.endGroup();
|
||||
QStringList open_folders = Preferences::instance()->getRssOpenFolders();
|
||||
foreach (const QString& var_path, open_folders) {
|
||||
QStringList path = var_path.split("\\");
|
||||
QTreeWidgetItem* parent = 0;
|
||||
@@ -322,10 +319,7 @@ void RSSImp::saveFoldersOpenState()
|
||||
qDebug("saving open folder: %s", qPrintable(path));
|
||||
open_folders << path;
|
||||
}
|
||||
QIniSettings settings;
|
||||
settings.beginGroup("Rss");
|
||||
settings.setValue("open_folders", open_folders);
|
||||
settings.endGroup();
|
||||
Preferences::instance()->setRssOpenFolders(open_folders);
|
||||
}
|
||||
|
||||
// refresh all streams by a button
|
||||
@@ -351,7 +345,7 @@ void RSSImp::downloadSelectedTorrents()
|
||||
// Load possible cookies
|
||||
QString feed_url = m_feedList->getItemID(m_feedList->selectedItems().first());
|
||||
QString feed_hostname = QUrl::fromEncoded(feed_url.toUtf8()).host();
|
||||
QList<QNetworkCookie> cookies = RssSettings().getHostNameQNetworkCookies(feed_hostname);
|
||||
QList<QNetworkCookie> cookies = Preferences::instance()->getHostNameQNetworkCookies(feed_hostname);
|
||||
qDebug("Loaded %d cookies for RSS item\n", cookies.size());
|
||||
QBtSession::instance()->downloadFromUrl(torrentLink, cookies);
|
||||
}
|
||||
@@ -583,20 +577,20 @@ void RSSImp::refreshTextBrowser()
|
||||
void RSSImp::saveSlidersPosition()
|
||||
{
|
||||
// Remember sliders positions
|
||||
QIniSettings settings;
|
||||
settings.setValue("rss/splitter_h", splitter_h->saveState());
|
||||
settings.setValue("rss/splitter_v", splitter_v->saveState());
|
||||
Preferences* const pref = Preferences::instance();
|
||||
pref->setRssHSplitterState(splitter_h->saveState());
|
||||
pref->setRssVSplitterState(splitter_v->saveState());
|
||||
qDebug("Splitters position saved");
|
||||
}
|
||||
|
||||
void RSSImp::restoreSlidersPosition()
|
||||
{
|
||||
QIniSettings settings;
|
||||
QByteArray pos_h = settings.value("rss/splitter_h", QByteArray()).toByteArray();
|
||||
const Preferences* const pref = Preferences::instance();
|
||||
QByteArray pos_h = pref->getRssHSplitterState();
|
||||
if (!pos_h.isNull()) {
|
||||
splitter_h->restoreState(pos_h);
|
||||
}
|
||||
QByteArray pos_v = settings.value("rss/splitter_v", QByteArray()).toByteArray();
|
||||
QByteArray pos_v = pref->getRssVSplitterState();
|
||||
if (!pos_v.isNull()) {
|
||||
splitter_v->restoreState(pos_v);
|
||||
}
|
||||
@@ -756,7 +750,7 @@ void RSSImp::on_settingsButton_clicked()
|
||||
{
|
||||
RssSettingsDlg dlg(this);
|
||||
if (dlg.exec())
|
||||
updateRefreshInterval(RssSettings().getRSSRefreshInterval());
|
||||
updateRefreshInterval(Preferences::instance()->getRSSRefreshInterval());
|
||||
}
|
||||
|
||||
void RSSImp::on_rssDownloaderBtn_clicked()
|
||||
|
||||
@@ -30,12 +30,13 @@
|
||||
|
||||
#include <QRegExp>
|
||||
#include <QDebug>
|
||||
#include <QDir>
|
||||
|
||||
#include "rssdownloadrule.h"
|
||||
#include "preferences.h"
|
||||
#include "qinisettings.h"
|
||||
#include "rssfeed.h"
|
||||
#include "rssarticle.h"
|
||||
#include "fs_utils.h"
|
||||
|
||||
RssDownloadRule::RssDownloadRule(): m_enabled(false), m_useRegex(false)
|
||||
{
|
||||
@@ -112,7 +113,7 @@ bool RssDownloadRule::operator==(const RssDownloadRule &other) const {
|
||||
|
||||
void RssDownloadRule::setSavePath(const QString &save_path)
|
||||
{
|
||||
if (!save_path.isEmpty() && QDir(save_path) != QDir(Preferences().getSavePath()))
|
||||
if (!save_path.isEmpty() && QDir(save_path) != QDir(Preferences::instance()->getSavePath()))
|
||||
m_savePath = fsutils::fromNativePath(save_path);
|
||||
else
|
||||
m_savePath = QString();
|
||||
|
||||
@@ -33,7 +33,7 @@
|
||||
#include <QDebug>
|
||||
|
||||
#include "rssdownloadrulelist.h"
|
||||
#include "rsssettings.h"
|
||||
#include "preferences.h"
|
||||
#include "qinisettings.h"
|
||||
|
||||
RssDownloadRuleList::RssDownloadRuleList()
|
||||
@@ -43,7 +43,7 @@ RssDownloadRuleList::RssDownloadRuleList()
|
||||
|
||||
RssDownloadRulePtr RssDownloadRuleList::findMatchingRule(const QString &feed_url, const QString &article_title) const
|
||||
{
|
||||
Q_ASSERT(RssSettings().isRssDownloadingEnabled());
|
||||
Q_ASSERT(Preferences::instance()->isRssDownloadingEnabled());
|
||||
QStringList rule_names = m_feedRules.value(feed_url);
|
||||
foreach (const QString &rule_name, rule_names) {
|
||||
RssDownloadRulePtr rule = m_rules[rule_name];
|
||||
|
||||
@@ -33,7 +33,8 @@
|
||||
#include "rssmanager.h"
|
||||
#include "qbtsession.h"
|
||||
#include "rssfolder.h"
|
||||
#include "rsssettings.h"
|
||||
#include "preferences.h"
|
||||
#include "qinisettings.h"
|
||||
#include "rssarticle.h"
|
||||
#include "rssparser.h"
|
||||
#include "misc.h"
|
||||
@@ -116,7 +117,7 @@ void RssFeed::loadItemsFromDisk()
|
||||
|
||||
void RssFeed::addArticle(const RssArticlePtr& article) {
|
||||
int lbIndex = -1;
|
||||
int max_articles = RssSettings().getRSSMaxArticlesPerFeed();
|
||||
int max_articles = Preferences::instance()->getRSSMaxArticlesPerFeed();
|
||||
|
||||
if (!m_articles.contains(article->guid())) {
|
||||
markAsDirty();
|
||||
@@ -139,7 +140,7 @@ void RssFeed::addArticle(const RssArticlePtr& article) {
|
||||
}
|
||||
|
||||
// Check if article was inserted at the end of the list and will break max_articles limit
|
||||
if (RssSettings().isRssDownloadingEnabled()) {
|
||||
if (Preferences::instance()->isRssDownloadingEnabled()) {
|
||||
if (lbIndex < max_articles && !article->isRead())
|
||||
downloadArticleTorrentIfMatching(m_manager->downloadRules(), article);
|
||||
}
|
||||
@@ -147,7 +148,7 @@ void RssFeed::addArticle(const RssArticlePtr& article) {
|
||||
else {
|
||||
// m_articles.contains(article->guid())
|
||||
// Try to download skipped articles
|
||||
if (RssSettings().isRssDownloadingEnabled()) {
|
||||
if (Preferences::instance()->isRssDownloadingEnabled()) {
|
||||
RssArticlePtr skipped = m_articles.value(article->guid(), RssArticlePtr());
|
||||
if (skipped) {
|
||||
if (!skipped->isRead())
|
||||
@@ -160,7 +161,7 @@ void RssFeed::addArticle(const RssArticlePtr& article) {
|
||||
QList<QNetworkCookie> RssFeed::feedCookies() const
|
||||
{
|
||||
QString feed_hostname = QUrl::fromEncoded(m_url.toUtf8()).host();
|
||||
return RssSettings().getHostNameQNetworkCookies(feed_hostname);
|
||||
return Preferences::instance()->getHostNameQNetworkCookies(feed_hostname);
|
||||
}
|
||||
|
||||
bool RssFeed::refresh()
|
||||
@@ -347,7 +348,7 @@ void RssFeed::handleFeedTitle(const QString& feedUrl, const QString& title)
|
||||
|
||||
void RssFeed::downloadArticleTorrentIfMatching(RssDownloadRuleList* rules, const RssArticlePtr& article)
|
||||
{
|
||||
Q_ASSERT(RssSettings().isRssDownloadingEnabled());
|
||||
Q_ASSERT(Preferences::instance()->isRssDownloadingEnabled());
|
||||
RssDownloadRulePtr matching_rule = rules->findMatchingRule(m_url, article->title());
|
||||
if (!matching_rule)
|
||||
return;
|
||||
@@ -365,7 +366,7 @@ void RssFeed::downloadArticleTorrentIfMatching(RssDownloadRuleList* rules, const
|
||||
|
||||
void RssFeed::recheckRssItemsForDownload()
|
||||
{
|
||||
Q_ASSERT(RssSettings().isRssDownloadingEnabled());
|
||||
Q_ASSERT(Preferences::instance()->isRssDownloadingEnabled());
|
||||
RssDownloadRuleList* rules = m_manager->downloadRules();
|
||||
foreach (const RssArticlePtr& article, m_articlesByDate) {
|
||||
if (!article->isRead())
|
||||
|
||||
@@ -30,7 +30,7 @@
|
||||
|
||||
#include <QDebug>
|
||||
#include "rssmanager.h"
|
||||
#include "rsssettings.h"
|
||||
#include "preferences.h"
|
||||
#include "qbtsession.h"
|
||||
#include "rssfeed.h"
|
||||
#include "rssarticle.h"
|
||||
@@ -46,7 +46,7 @@ RssManager::RssManager():
|
||||
m_rssParser(new RssParser(this))
|
||||
{
|
||||
connect(&m_refreshTimer, SIGNAL(timeout()), SLOT(refresh()));
|
||||
m_refreshInterval = RssSettings().getRSSRefreshInterval();
|
||||
m_refreshInterval = Preferences::instance()->getRSSRefreshInterval();
|
||||
m_refreshTimer.start(m_refreshInterval * MSECS_PER_MIN);
|
||||
}
|
||||
|
||||
@@ -81,9 +81,9 @@ void RssManager::updateRefreshInterval(uint val)
|
||||
|
||||
void RssManager::loadStreamList()
|
||||
{
|
||||
RssSettings settings;
|
||||
const QStringList streamsUrl = settings.getRssFeedsUrls();
|
||||
const QStringList aliases = settings.getRssFeedsAliases();
|
||||
const Preferences* const pref = Preferences::instance();
|
||||
const QStringList streamsUrl = pref->getRssFeedsUrls();
|
||||
const QStringList aliases = pref->getRssFeedsAliases();
|
||||
if (streamsUrl.size() != aliases.size()) {
|
||||
std::cerr << "Corrupted Rss list, not loading it\n";
|
||||
return;
|
||||
@@ -155,9 +155,9 @@ void RssManager::saveStreamList() const
|
||||
streamsUrl << stream_path;
|
||||
aliases << stream->displayName();
|
||||
}
|
||||
RssSettings settings;
|
||||
settings.setRssFeedsUrls(streamsUrl);
|
||||
settings.setRssFeedsAliases(aliases);
|
||||
Preferences* const pref = Preferences::instance();
|
||||
pref->setRssFeedsUrls(streamsUrl);
|
||||
pref->setRssFeedsAliases(aliases);
|
||||
}
|
||||
|
||||
RssDownloadRuleList* RssManager::downloadRules() const
|
||||
|
||||
@@ -1,124 +0,0 @@
|
||||
/*
|
||||
* Bittorrent Client using Qt4 and libtorrent.
|
||||
* Copyright (C) 2010 Christophe Dumez
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License
|
||||
* as published by the Free Software Foundation; either version 2
|
||||
* of the License, or (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||
*
|
||||
* In addition, as a special exception, the copyright holders give permission to
|
||||
* link this program with the OpenSSL project's "OpenSSL" library (or with
|
||||
* modified versions of it that use the same license as the "OpenSSL" library),
|
||||
* and distribute the linked executables. You must obey the GNU General Public
|
||||
* License in all respects for all of the code used other than "OpenSSL". If you
|
||||
* modify file(s), you may extend this exception to your version of the file(s),
|
||||
* but you are not obligated to do so. If you do not wish to do so, delete this
|
||||
* exception statement from your version.
|
||||
*
|
||||
* Contact : chris@qbittorrent.org
|
||||
*/
|
||||
|
||||
#ifndef RSSSETTINGS_H
|
||||
#define RSSSETTINGS_H
|
||||
|
||||
#include <QStringList>
|
||||
#include <QNetworkCookie>
|
||||
#include "qinisettings.h"
|
||||
|
||||
class RssSettings: public QIniSettings{
|
||||
|
||||
public:
|
||||
RssSettings() : QIniSettings("qBittorrent", "qBittorrent") {}
|
||||
|
||||
bool isRSSEnabled() const {
|
||||
return value(QString::fromUtf8("Preferences/RSS/RSSEnabled"), false).toBool();
|
||||
}
|
||||
|
||||
void setRSSEnabled(bool enabled) {
|
||||
setValue(QString::fromUtf8("Preferences/RSS/RSSEnabled"), enabled);
|
||||
}
|
||||
|
||||
unsigned int getRSSRefreshInterval() const {
|
||||
return value(QString::fromUtf8("Preferences/RSS/RSSRefresh"), 5).toUInt();
|
||||
}
|
||||
|
||||
void setRSSRefreshInterval(uint interval) {
|
||||
setValue(QString::fromUtf8("Preferences/RSS/RSSRefresh"), interval);
|
||||
}
|
||||
|
||||
int getRSSMaxArticlesPerFeed() const {
|
||||
return value(QString::fromUtf8("Preferences/RSS/RSSMaxArticlesPerFeed"), 50).toInt();
|
||||
}
|
||||
|
||||
void setRSSMaxArticlesPerFeed(int nb) {
|
||||
setValue(QString::fromUtf8("Preferences/RSS/RSSMaxArticlesPerFeed"), nb);
|
||||
}
|
||||
|
||||
bool isRssDownloadingEnabled() const {
|
||||
return value("Preferences/RSS/RssDownloading", true).toBool();
|
||||
}
|
||||
|
||||
void setRssDownloadingEnabled(bool b) {
|
||||
setValue("Preferences/RSS/RssDownloading", b);
|
||||
}
|
||||
|
||||
QStringList getRssFeedsUrls() const {
|
||||
return value("Rss/streamList").toStringList();
|
||||
}
|
||||
|
||||
void setRssFeedsUrls(const QStringList &rssFeeds) {
|
||||
setValue("Rss/streamList", rssFeeds);
|
||||
}
|
||||
|
||||
QStringList getRssFeedsAliases() const {
|
||||
return value("Rss/streamAlias").toStringList();
|
||||
}
|
||||
|
||||
void setRssFeedsAliases(const QStringList &rssAliases) {
|
||||
setValue("Rss/streamAlias", rssAliases);
|
||||
}
|
||||
|
||||
QList<QByteArray> getHostNameCookies(const QString &host_name) const {
|
||||
QMap<QString, QVariant> hosts_table = value("Rss/hosts_cookies").toMap();
|
||||
if (!hosts_table.contains(host_name)) return QList<QByteArray>();
|
||||
QByteArray raw_cookies = hosts_table.value(host_name).toByteArray();
|
||||
return raw_cookies.split(':');
|
||||
}
|
||||
|
||||
QList<QNetworkCookie> getHostNameQNetworkCookies(const QString& host_name) const {
|
||||
QList<QNetworkCookie> cookies;
|
||||
const QList<QByteArray> raw_cookies = getHostNameCookies(host_name);
|
||||
foreach (const QByteArray& raw_cookie, raw_cookies) {
|
||||
QList<QByteArray> cookie_parts = raw_cookie.split('=');
|
||||
if (cookie_parts.size() == 2) {
|
||||
qDebug("Loading cookie: %s = %s", cookie_parts.first().constData(), cookie_parts.last().constData());
|
||||
cookies << QNetworkCookie(cookie_parts.first(), cookie_parts.last());
|
||||
}
|
||||
}
|
||||
return cookies;
|
||||
}
|
||||
|
||||
void setHostNameCookies(const QString &host_name, const QList<QByteArray> &cookies) {
|
||||
QMap<QString, QVariant> hosts_table = value("Rss/hosts_cookies").toMap();
|
||||
QByteArray raw_cookies = "";
|
||||
foreach (const QByteArray& cookie, cookies) {
|
||||
raw_cookies += cookie + ":";
|
||||
}
|
||||
if (raw_cookies.endsWith(":"))
|
||||
raw_cookies.chop(1);
|
||||
hosts_table.insert(host_name, raw_cookies);
|
||||
setValue("Rss/hosts_cookies", hosts_table);
|
||||
}
|
||||
};
|
||||
|
||||
#endif // RSSSETTINGS_H
|
||||
@@ -30,7 +30,7 @@
|
||||
|
||||
#include "rsssettingsdlg.h"
|
||||
#include "ui_rsssettingsdlg.h"
|
||||
#include "rsssettings.h"
|
||||
#include "preferences.h"
|
||||
|
||||
RssSettingsDlg::RssSettingsDlg(QWidget *parent) :
|
||||
QDialog(parent),
|
||||
@@ -38,9 +38,9 @@ RssSettingsDlg::RssSettingsDlg(QWidget *parent) :
|
||||
{
|
||||
ui->setupUi(this);
|
||||
// Load settings
|
||||
const RssSettings settings;
|
||||
ui->spinRSSRefresh->setValue(settings.getRSSRefreshInterval());
|
||||
ui->spinRSSMaxArticlesPerFeed->setValue(settings.getRSSMaxArticlesPerFeed());
|
||||
const Preferences* const pref = Preferences::instance();
|
||||
ui->spinRSSRefresh->setValue(pref->getRSSRefreshInterval());
|
||||
ui->spinRSSMaxArticlesPerFeed->setValue(pref->getRSSMaxArticlesPerFeed());
|
||||
}
|
||||
|
||||
RssSettingsDlg::~RssSettingsDlg()
|
||||
@@ -51,7 +51,7 @@ RssSettingsDlg::~RssSettingsDlg()
|
||||
|
||||
void RssSettingsDlg::on_buttonBox_accepted() {
|
||||
// Save settings
|
||||
RssSettings settings;
|
||||
settings.setRSSRefreshInterval(ui->spinRSSRefresh->value());
|
||||
settings.setRSSMaxArticlesPerFeed(ui->spinRSSMaxArticlesPerFeed->value());
|
||||
Preferences* const pref = Preferences::instance();
|
||||
pref->setRSSRefreshInterval(ui->spinRSSRefresh->value());
|
||||
pref->setRSSMaxArticlesPerFeed(ui->spinRSSMaxArticlesPerFeed->value());
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user