Browse Source

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

adaptive-webui-19844
Christophe Dumez 15 years ago
parent
commit
3762c37517
  1. 1
      src/GUI.cpp
  2. 4
      src/preferences.h
  3. 9
      src/rss.cpp
  4. 1
      src/rss.h
  5. 4
      src/rss_imp.cpp
  6. 1
      src/rss_imp.h

1
src/GUI.cpp

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

4
src/preferences.h

@ -351,9 +351,9 @@ public:
return settings.value(QString::fromUtf8("Preferences/RSS/RSSEnabled"), false).toBool(); return settings.value(QString::fromUtf8("Preferences/RSS/RSSEnabled"), false).toBool();
} }
static int getRSSRefreshInterval() { static unsigned int getRSSRefreshInterval() {
QSettings settings("qBittorrent", "qBittorrent"); 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() { static int getRSSMaxArticlesPerFeed() {

9
src/rss.cpp

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

1
src/rss.h

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

4
src/rss_imp.cpp

@ -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){ RSSImp::RSSImp(bittorrent *BTSession) : QWidget(), BTSession(BTSession){
setupUi(this); setupUi(this);

1
src/rss_imp.h

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

Loading…
Cancel
Save