Browse Source

Move RSS settings to a separate dialog

adaptive-webui-19844
Christophe Dumez 15 years ago
parent
commit
54131001b0
  1. 16
      src/GUI.cpp
  2. 1
      src/GUI.h
  3. 19
      src/options_imp.cpp
  4. 1
      src/options_imp.h
  5. 11
      src/preferences.h
  6. 7
      src/rss_imp.cpp
  7. 17
      src/rss_imp.h
  8. 54
      src/rsssettings.cpp
  9. 56
      src/rsssettings.h
  10. 10
      src/src.pro
  11. 9
      src/ui/mainwindow.ui
  12. 179
      src/ui/options.ui
  13. 7
      src/ui/rss.ui
  14. 158
      src/ui/rsssettings.ui

16
src/GUI.cpp

@ -184,6 +184,9 @@ GUI::GUI(QWidget *parent, QStringList torrentCmdLine) : QMainWindow(parent), dis @@ -184,6 +184,9 @@ GUI::GUI(QWidget *parent, QStringList torrentCmdLine) : QMainWindow(parent), dis
// View settings
actionTop_tool_bar->setChecked(Preferences::isToolbarDisplayed());
actionSpeed_in_title_bar->setChecked(Preferences::speedInTitleBar());
actionRSS_Reader->setChecked(Preferences::isRSSEnabled());
if(actionRSS_Reader->isChecked())
displayRSSTab(true);
show();
@ -812,14 +815,6 @@ void GUI::loadPreferences(bool configure_session) { @@ -812,14 +815,6 @@ void GUI::loadPreferences(bool configure_session) {
}
}
// RSS
if(Preferences::isRSSEnabled()) {
displayRSSTab(true);
rssWidget->updateRefreshInterval(Preferences::getRSSRefreshInterval());
} else {
displayRSSTab(false);
}
// Torrent properties
properties->reloadPreferences();
@ -1012,8 +1007,9 @@ void GUI::on_actionSpeed_in_title_bar_triggered() { @@ -1012,8 +1007,9 @@ void GUI::on_actionSpeed_in_title_bar_triggered() {
setWindowTitle(tr("qBittorrent %1", "e.g: qBittorrent v0.x").arg(QString::fromUtf8(VERSION)));
}
void GUI::on_actionRSS_Reader_triggered() {
displayRSSTab(actionRSS_Reader->isChecked());
}
/*****************************************************
* *

1
src/GUI.h

@ -166,6 +166,7 @@ private: @@ -166,6 +166,7 @@ private:
QPointer<RSSImp> rssWidget;
private slots:
void on_actionRSS_Reader_triggered();
void on_actionSpeed_in_title_bar_triggered();
void on_actionTop_tool_bar_triggered();
};

19
src/options_imp.cpp

@ -248,9 +248,6 @@ options_imp::options_imp(QWidget *parent):QDialog(parent){ @@ -248,9 +248,6 @@ options_imp::options_imp(QWidget *parent):QDialog(parent){
// Misc tab
connect(checkIPFilter, SIGNAL(toggled(bool)), this, SLOT(enableApplyButton()));
connect(textFilterPath, SIGNAL(textChanged(QString)), this, SLOT(enableApplyButton()));
connect(spinRSSRefresh, SIGNAL(valueChanged(QString)), this, SLOT(enableApplyButton()));
connect(spinRSSMaxArticlesPerFeed, SIGNAL(valueChanged(QString)), this, SLOT(enableApplyButton()));
connect(checkEnableRSS, SIGNAL(toggled(bool)), this, SLOT(enableApplyButton()));
connect(checkEnableQueueing, SIGNAL(toggled(bool)), this, SLOT(enableApplyButton()));
connect(spinMaxActiveDownloads, SIGNAL(valueChanged(QString)), this, SLOT(enableApplyButton()));
connect(spinMaxActiveUploads, SIGNAL(valueChanged(QString)), this, SLOT(enableApplyButton()));
@ -484,13 +481,6 @@ options_imp::options_imp(QWidget *parent):QDialog(parent){ @@ -484,13 +481,6 @@ options_imp::options_imp(QWidget *parent):QDialog(parent){
}
// End IPFilter preferences
settings.endGroup();
// RSS
settings.beginGroup("RSS");
settings.setValue(QString::fromUtf8("RSSEnabled"), isRSSEnabled());
settings.setValue(QString::fromUtf8("RSSRefresh"), spinRSSRefresh->value());
settings.setValue(QString::fromUtf8("RSSMaxArticlesPerFeed"), spinRSSMaxArticlesPerFeed->value());
// End RSS preferences
settings.endGroup();
// Queueing system
settings.beginGroup("Queueing");
settings.setValue(QString::fromUtf8("QueueingEnabled"), isQueueingSystemEnabled());
@ -807,11 +797,6 @@ options_imp::options_imp(QWidget *parent):QDialog(parent){ @@ -807,11 +797,6 @@ options_imp::options_imp(QWidget *parent):QDialog(parent){
checkIPFilter->setChecked(Preferences::isFilteringEnabled());
textFilterPath->setText(Preferences::getFilter());
// End IP Filter
// * RSS
checkEnableRSS->setChecked(Preferences::isRSSEnabled());
spinRSSRefresh->setValue(Preferences::getRSSRefreshInterval());
spinRSSMaxArticlesPerFeed->setValue(Preferences::getRSSMaxArticlesPerFeed());
// End RSS preferences
// Queueing system preferences
checkEnableQueueing->setChecked(Preferences::isQueueingSystemEnabled());
spinMaxActiveDownloads->setValue(Preferences::getMaxActiveDownloads());
@ -929,10 +914,6 @@ options_imp::options_imp(QWidget *parent):QDialog(parent){ @@ -929,10 +914,6 @@ options_imp::options_imp(QWidget *parent):QDialog(parent){
return checkDHT->isChecked();
}
bool options_imp::isRSSEnabled() const{
return checkEnableRSS->isChecked();
}
bool options_imp::isLSDEnabled() const{
return checkLSD->isChecked();
}

1
src/options_imp.h

@ -95,7 +95,6 @@ protected: @@ -95,7 +95,6 @@ protected:
bool isDHTPortSameAsBT() const;
int getDHTPort() const;
bool isLSDEnabled() const;
bool isRSSEnabled() const;
int getEncryptionSetting() const;
float getDeleteRatio() const;
// Proxy options

11
src/preferences.h

@ -744,11 +744,22 @@ public: @@ -744,11 +744,22 @@ public:
return settings.value(QString::fromUtf8("Preferences/RSS/RSSRefresh"), 5).toUInt();
}
static void setRSSRefreshInterval(uint interval) {
QSettings settings("qBittorrent", "qBittorrent");
settings.setValue(QString::fromUtf8("Preferences/RSS/RSSRefresh"), interval);
}
static int getRSSMaxArticlesPerFeed() {
QSettings settings("qBittorrent", "qBittorrent");
return settings.value(QString::fromUtf8("Preferences/RSS/RSSMaxArticlesPerFeed"), 50).toInt();
}
static void setRSSMaxArticlesPerFeed(int nb) {
QSettings settings("qBittorrent", "qBittorrent");
settings.setValue(QString::fromUtf8("Preferences/RSS/RSSMaxArticlesPerFeed"), nb);
}
// Queueing system
static bool isQueueingSystemEnabled() {
QSettings settings("qBittorrent", "qBittorrent");

7
src/rss_imp.cpp

@ -43,6 +43,7 @@ @@ -43,6 +43,7 @@
#include "bittorrent.h"
#include "cookiesdlg.h"
#include "preferences.h"
#include "rsssettings.h"
enum NewsCols { NEWS_ICON, NEWS_TITLE_COL, NEWS_URL_COL, NEWS_ID };
@ -640,3 +641,9 @@ RSSImp::~RSSImp(){ @@ -640,3 +641,9 @@ RSSImp::~RSSImp(){
qDebug("RSSImp deleted");
}
void RSSImp::on_settingsButton_clicked() {
RssSettings rssSettingsDlg(this);
if(rssSettingsDlg.exec())
updateRefreshInterval(Preferences::getRefreshInterval());
}

17
src/rss_imp.h

@ -44,11 +44,9 @@ class QTreeWidgetItem; @@ -44,11 +44,9 @@ class QTreeWidgetItem;
class RSSImp : public QWidget, public Ui::RSS{
Q_OBJECT
private:
RssManager *rssmanager;
Bittorrent *BTSession;
FeedList *listStreams;
QTreeWidgetItem* previous_news;
public:
RSSImp(Bittorrent *BTSession);
~RSSImp();
public slots:
void deleteSelectedItems();
@ -80,10 +78,13 @@ protected slots: @@ -80,10 +78,13 @@ protected slots:
void loadFoldersOpenState();
void displayOverwriteError(QString filename);
void on_actionManage_cookies_triggered();
void on_settingsButton_clicked();
public:
RSSImp(Bittorrent *BTSession);
~RSSImp();
private:
RssManager *rssmanager;
Bittorrent *BTSession;
FeedList *listStreams;
QTreeWidgetItem* previous_news;
};

54
src/rsssettings.cpp

@ -0,0 +1,54 @@ @@ -0,0 +1,54 @@
/*
* 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
*/
#include "rsssettings.h"
#include "ui_rsssettings.h"
#include "preferences.h"
RssSettings::RssSettings(QWidget *parent) :
QDialog(parent),
ui(new Ui::RssSettings)
{
ui->setupUi(this);
// Load settings
ui->spinRSSRefresh->setValue(Preferences::getRSSRefreshInterval());
ui->spinRSSMaxArticlesPerFeed->setValue(Preferences::getRSSMaxArticlesPerFeed());
}
RssSettings::~RssSettings()
{
delete ui;
}
void RssSettings::on_buttonBox_accepted() {
// Save settings
Preferences::setRSSRefreshInterval(ui->spinRSSRefresh->value());
Preferences::setRSSMaxArticlesPerFeed(ui->spinRSSMaxArticlesPerFeed->value());
}

56
src/rsssettings.h

@ -0,0 +1,56 @@ @@ -0,0 +1,56 @@
/*
* 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 <QDialog>
namespace Ui {
class RssSettings;
}
class RssSettings : public QDialog
{
Q_OBJECT
public:
explicit RssSettings(QWidget *parent = 0);
~RssSettings();
protected slots:
void on_buttonBox_accepted();
private:
Ui::RssSettings *ui;
};
#endif // RSSSETTINGS_H

10
src/src.pro

@ -328,7 +328,8 @@ contains(DEFINES, DISABLE_GUI) { @@ -328,7 +328,8 @@ contains(DEFINES, DISABLE_GUI) {
trackerlogin.h \
pieceavailabilitybar.h \
advancedsettings.h \
cookiesdlg.h
cookiesdlg.h \
rsssettings.h
macx {
HEADERS += qmacapplication.h
}
@ -360,7 +361,8 @@ contains(DEFINES, DISABLE_GUI) { @@ -360,7 +361,8 @@ contains(DEFINES, DISABLE_GUI) {
ui/propertieswidget.ui \
ui/peer.ui \
ui/confirmdeletiondlg.ui \
ui/cookiesdlg.ui
ui/cookiesdlg.ui \
ui/rsssettings.ui
}
SOURCES += main.cpp \
@ -390,7 +392,8 @@ SOURCES += main.cpp \ @@ -390,7 +392,8 @@ SOURCES += main.cpp \
peerlistwidget.cpp \
cookiesdlg.cpp \
trackerlist.cpp \
torrentadditiondlg.cpp
torrentadditiondlg.cpp \
rsssettings.cpp
macx {
SOURCES += qmacapplication.cpp
@ -398,3 +401,4 @@ SOURCES += main.cpp \ @@ -398,3 +401,4 @@ SOURCES += main.cpp \
}
DESTDIR = .

9
src/ui/mainwindow.ui

@ -79,6 +79,7 @@ @@ -79,6 +79,7 @@
</property>
<addaction name="actionTop_tool_bar"/>
<addaction name="actionSpeed_in_title_bar"/>
<addaction name="actionRSS_Reader"/>
</widget>
<addaction name="menu_File"/>
<addaction name="menu_Edit"/>
@ -301,6 +302,14 @@ @@ -301,6 +302,14 @@
<string>Show transfer speed in title bar</string>
</property>
</action>
<action name="actionRSS_Reader">
<property name="checkable">
<bool>true</bool>
</property>
<property name="text">
<string>RSS Reader</string>
</property>
</action>
</widget>
<resources>
<include location="../icons.qrc"/>

179
src/ui/options.ui

@ -179,21 +179,6 @@ @@ -179,21 +179,6 @@
<set>ItemIsSelectable|ItemIsEnabled</set>
</property>
</item>
<item>
<property name="text">
<string>RSS</string>
</property>
<property name="textAlignment">
<set>AlignHCenter|AlignVCenter|AlignCenter</set>
</property>
<property name="icon">
<iconset resource="../icons.qrc">
<normaloff>:/Icons/rss32.png</normaloff>:/Icons/rss32.png</iconset>
</property>
<property name="flags">
<set>ItemIsSelectable|ItemIsEnabled</set>
</property>
</item>
<item>
<property name="text">
<string>Advanced</string>
@ -225,7 +210,7 @@ @@ -225,7 +210,7 @@
<property name="geometry">
<rect>
<x>0</x>
<y>-24</y>
<y>0</y>
<width>506</width>
<height>430</height>
</rect>
@ -2613,168 +2598,6 @@ QGroupBox { @@ -2613,168 +2598,6 @@ QGroupBox {
</item>
</layout>
</widget>
<widget class="QWidget" name="page">
<layout class="QVBoxLayout" name="verticalLayout_7">
<item>
<widget class="QScrollArea" name="scrollArea_8">
<property name="widgetResizable">
<bool>true</bool>
</property>
<widget class="QWidget" name="scrollAreaWidgetContents_8">
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>524</width>
<height>406</height>
</rect>
</property>
<layout class="QVBoxLayout" name="verticalLayout_24">
<item>
<widget class="QGroupBox" name="checkEnableRSS">
<property name="title">
<string>RSS</string>
</property>
<property name="checkable">
<bool>true</bool>
</property>
<property name="checked">
<bool>false</bool>
</property>
<layout class="QVBoxLayout" name="_12">
<item>
<layout class="QHBoxLayout" name="_14">
<item>
<widget class="QLabel" name="label_4">
<property name="minimumSize">
<size>
<width>48</width>
<height>48</height>
</size>
</property>
<property name="maximumSize">
<size>
<width>48</width>
<height>48</height>
</size>
</property>
<property name="text">
<string/>
</property>
<property name="pixmap">
<pixmap resource="../icons.qrc">:/Icons/rss32.png</pixmap>
</property>
<property name="scaledContents">
<bool>true</bool>
</property>
</widget>
</item>
<item>
<layout class="QVBoxLayout" name="_15">
<item>
<layout class="QHBoxLayout" name="_16">
<item>
<widget class="QLabel" name="label">
<property name="text">
<string>RSS feeds refresh interval:</string>
</property>
</widget>
</item>
<item>
<widget class="QSpinBox" name="spinRSSRefresh">
<property name="minimum">
<number>1</number>
</property>
<property name="maximum">
<number>999999</number>
</property>
<property name="value">
<number>5</number>
</property>
</widget>
</item>
<item>
<widget class="QLabel" name="label_2">
<property name="text">
<string>minutes</string>
</property>
</widget>
</item>
<item>
<spacer>
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>40</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
</layout>
</item>
<item>
<layout class="QHBoxLayout" name="_17">
<item>
<widget class="QLabel" name="label_3">
<property name="text">
<string>Maximum number of articles per feed:</string>
</property>
</widget>
</item>
<item>
<widget class="QSpinBox" name="spinRSSMaxArticlesPerFeed">
<property name="maximum">
<number>9999</number>
</property>
<property name="value">
<number>100</number>
</property>
</widget>
</item>
<item>
<spacer>
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>40</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
</layout>
</item>
</layout>
</item>
</layout>
</item>
<item>
<spacer name="verticalSpacer_3">
<property name="orientation">
<enum>Qt::Vertical</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>20</width>
<height>40</height>
</size>
</property>
</spacer>
</item>
</layout>
</widget>
</item>
</layout>
</widget>
</widget>
</item>
</layout>
</widget>
<widget class="QWidget" name="page_3">
<layout class="QVBoxLayout" name="verticalLayout_35">
<item>

7
src/ui/rss.ui

@ -89,6 +89,13 @@ @@ -89,6 +89,13 @@
</property>
</spacer>
</item>
<item>
<widget class="QPushButton" name="settingsButton">
<property name="text">
<string>Settings...</string>
</property>
</widget>
</item>
</layout>
</item>
<item>

158
src/ui/rsssettings.ui

@ -0,0 +1,158 @@ @@ -0,0 +1,158 @@
<?xml version="1.0" encoding="UTF-8"?>
<ui version="4.0">
<class>RssSettings</class>
<widget class="QDialog" name="RssSettings">
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>468</width>
<height>137</height>
</rect>
</property>
<property name="windowTitle">
<string>RSS Reader Settings</string>
</property>
<layout class="QVBoxLayout" name="verticalLayout">
<item>
<layout class="QGridLayout" name="gridLayout">
<item row="0" column="0" rowspan="2">
<widget class="QLabel" name="label_4">
<property name="minimumSize">
<size>
<width>48</width>
<height>48</height>
</size>
</property>
<property name="maximumSize">
<size>
<width>48</width>
<height>48</height>
</size>
</property>
<property name="text">
<string/>
</property>
<property name="pixmap">
<pixmap resource="../icons.qrc">:/Icons/rss32.png</pixmap>
</property>
<property name="scaledContents">
<bool>true</bool>
</property>
</widget>
</item>
<item row="0" column="2">
<widget class="QLabel" name="label">
<property name="text">
<string>RSS feeds refresh interval:</string>
</property>
<property name="alignment">
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
</property>
</widget>
</item>
<item row="0" column="3">
<widget class="QSpinBox" name="spinRSSRefresh">
<property name="minimum">
<number>1</number>
</property>
<property name="maximum">
<number>999999</number>
</property>
<property name="value">
<number>5</number>
</property>
</widget>
</item>
<item row="0" column="4">
<widget class="QLabel" name="label_2">
<property name="text">
<string>minutes</string>
</property>
</widget>
</item>
<item row="1" column="2">
<widget class="QLabel" name="label_3">
<property name="text">
<string>Maximum number of articles per feed:</string>
</property>
<property name="alignment">
<set>Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter</set>
</property>
</widget>
</item>
<item row="1" column="3">
<widget class="QSpinBox" name="spinRSSMaxArticlesPerFeed">
<property name="maximum">
<number>9999</number>
</property>
<property name="value">
<number>100</number>
</property>
</widget>
</item>
<item row="0" column="1">
<spacer name="horizontalSpacer">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
<width>40</width>
<height>20</height>
</size>
</property>
</spacer>
</item>
</layout>
</item>
<item>
<widget class="QDialogButtonBox" name="buttonBox">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="standardButtons">
<set>QDialogButtonBox::Cancel|QDialogButtonBox::Ok</set>
</property>
</widget>
</item>
</layout>
</widget>
<resources>
<include location="../icons.qrc"/>
</resources>
<connections>
<connection>
<sender>buttonBox</sender>
<signal>accepted()</signal>
<receiver>RssSettings</receiver>
<slot>accept()</slot>
<hints>
<hint type="sourcelabel">
<x>248</x>
<y>254</y>
</hint>
<hint type="destinationlabel">
<x>157</x>
<y>274</y>
</hint>
</hints>
</connection>
<connection>
<sender>buttonBox</sender>
<signal>rejected()</signal>
<receiver>RssSettings</receiver>
<slot>reject()</slot>
<hints>
<hint type="sourcelabel">
<x>316</x>
<y>260</y>
</hint>
<hint type="destinationlabel">
<x>286</x>
<y>274</y>
</hint>
</hints>
</connection>
</connections>
</ui>
Loading…
Cancel
Save