- Take "RSS refresh interval" into consideration without restarting qBT

This commit is contained in:
Christophe Dumez 2009-11-15 08:53:33 +00:00
parent e97b805365
commit 3762c37517
6 changed files with 17 additions and 3 deletions

View file

@ -825,6 +825,7 @@ void GUI::loadPreferences(bool configure_session) {
// RSS
if(Preferences::isRSSEnabled()) {
displayRSSTab(true);
rssWidget->updateRefreshInterval(Preferences::getRefreshInterval());
} else {
displayRSSTab(false);
}

View file

@ -351,9 +351,9 @@ public:
return settings.value(QString::fromUtf8("Preferences/RSS/RSSEnabled"), false).toBool();
}
static int getRSSRefreshInterval() {
static unsigned int getRSSRefreshInterval() {
QSettings settings("qBittorrent", "qBittorrent");
return settings.value(QString::fromUtf8("Preferences/RSS/RSSRefresh"), 5).toInt();
return settings.value(QString::fromUtf8("Preferences/RSS/RSSRefresh"), 5).toUInt();
}
static int getRSSMaxArticlesPerFeed() {

View file

@ -291,6 +291,13 @@ RssManager::~RssManager(){
qDebug("RSSManager deleted");
}
void RssManager::updateRefreshInterval(unsigned int val){
if(refreshInterval != val) {
refreshInterval = val;
newsRefresher.start(refreshInterval*60000);
}
}
void RssManager::loadStreamList(){
QSettings settings("qBittorrent", "qBittorrent");
QStringList streamsUrl = settings.value("Rss/streamList").toStringList();
@ -611,7 +618,7 @@ short RssStream::readDoc(const QDomDocument& doc) {
void RssStream::resizeList() {
QSettings settings(QString::fromUtf8("qBittorrent"), QString::fromUtf8("qBittorrent"));
unsigned int max_articles = settings.value(QString::fromUtf8("Preferences/RSS/RSSMaxArticlesPerFeed"), 100).toInt();
unsigned int max_articles = settings.value(QString::fromUtf8("Preferences/RSS/RSSMaxArticlesPerFeed"), 50).toInt();
unsigned int nb_articles = this->size();
if(nb_articles > max_articles) {
QList<RssItem*> listItem = RssManager::sortNewsList(this->values());

View file

@ -488,6 +488,7 @@ public slots:
void forwardFeedInfosChanged(QString url, QString aliasOrUrl, unsigned int nbUnread);
void forwardFeedIconChanged(QString url, QString icon_path);
void moveFile(RssFile* file, RssFolder* dest_folder);
void updateRefreshInterval(unsigned int val);
public:
RssManager(bittorrent *BTSession);

View file

@ -561,6 +561,10 @@ void RSSImp::updateFeedInfos(QString url, QString aliasOrUrl, unsigned int nbUnr
}
}
void RSSImp::updateRefreshInterval(unsigned int val) {
rssmanager->updateRefreshInterval(val);
}
RSSImp::RSSImp(bittorrent *BTSession) : QWidget(), BTSession(BTSession){
setupUi(this);

View file

@ -52,6 +52,7 @@ private:
public slots:
void deleteSelectedItems();
void updateRefreshInterval(unsigned int val);
protected slots:
void on_newFeedButton_clicked();