- FEATURE: RSS can now be disabled from program preferences

- COSMETIC: RSS Tab is now hidden as a default
This commit is contained in:
Christophe Dumez 2008-07-11 17:43:57 +00:00
parent 9a321adfb1
commit 4c5f349f49
6 changed files with 191 additions and 126 deletions

View file

@ -1,7 +1,9 @@
* Unknown - Christophe Dumez <chris@qbittorrent.org> - v1.2.0
- FEATURE: DHT is always ON (no longer used as fallback)
- FEATURE: The number of DHT nodes is displayed
- FEATURE: RSS can now be disabled from program preferences
- COSMETIC: Transfer speed, ratio and DHT nodes are displayed in status bar
- COSMETIC: RSS Tab is now hidden as a default
* Unknown - Christophe Dumez <chris@qbittorrent.org> - v1.1.0
- FEATURE: Web interface to control qbittorrent (Ishan Arora)

View file

@ -147,8 +147,14 @@ GUI::GUI(QWidget *parent, QStringList torrentCmdLine) : QMainWindow(parent), dis
tabs->addTab(finishedTorrentTab, tr("Finished") + QString::fromUtf8(" (0/0)"));
tabs->setTabIcon(1, QIcon(QString::fromUtf8(":/Icons/skin/seeding.png")));
connect(finishedTorrentTab, SIGNAL(torrentDoubleClicked(QString, bool)), this, SLOT(torrentDoubleClicked(QString, bool)));
connect(finishedTorrentTab, SIGNAL(finishedTorrentsNumberChanged(unsigned int)), this, SLOT(updateFinishedTorrentNumber(unsigned int)));
// Search engine tab
searchEngine = new SearchEngine(BTSession, myTrayIcon, systrayIntegration);
tabs->addTab(searchEngine, tr("Search"));
tabs->setTabIcon(2, QIcon(QString::fromUtf8(":/Icons/skin/search.png")));
readSettings();
// RSS Tab
rssWidget = 0;
// Smooth torrent switching between tabs Downloading <--> Finished
connect(downloadingTorrentTab, SIGNAL(torrentFinished(QString)), finishedTorrentTab, SLOT(addTorrent(QString)));
connect(finishedTorrentTab, SIGNAL(torrentMovedFromFinishedList(QString)), downloadingTorrentTab, SLOT(addTorrent(QString)));
@ -160,15 +166,6 @@ GUI::GUI(QWidget *parent, QStringList torrentCmdLine) : QMainWindow(parent), dis
configureSession(true);
// Resume unfinished torrents
BTSession->resumeUnfinishedTorrents();
// Search engine tab
searchEngine = new SearchEngine(BTSession, myTrayIcon, systrayIntegration);
tabs->addTab(searchEngine, tr("Search"));
tabs->setTabIcon(2, QIcon(QString::fromUtf8(":/Icons/skin/search.png")));
// RSS tab
rssWidget = new RSSImp();
tabs->addTab(rssWidget, tr("RSS"));
tabs->setTabIcon(3, QIcon(QString::fromUtf8(":/Icons/rss32.png")));
readSettings();
// Add torrent given on command line
processParams(torrentCmdLine);
// Initialize Web UI
@ -241,7 +238,8 @@ GUI::~GUI() {
delete statusSep1;
delete statusSep2;
delete statusSep3;
delete rssWidget;
if(rssWidget != 0)
delete rssWidget;
delete searchEngine;
delete refresher;
delete downloadingTorrentTab;
@ -274,6 +272,20 @@ GUI::~GUI() {
qDebug("5");
}
void GUI::displayRSSTab(bool enable) {
if(enable) {
// RSS tab
rssWidget = new RSSImp();
tabs->addTab(rssWidget, tr("RSS"));
tabs->setTabIcon(3, QIcon(QString::fromUtf8(":/Icons/rss32.png")));
} else {
if(rssWidget != 0) {
delete rssWidget;
rssWidget = 0;
}
}
}
void GUI::updateRatio() {
// Update ratio info
float ratio = 1.;
@ -1092,6 +1104,12 @@ void GUI::configureSession(bool deleteOptions) {
BTSession->disableIPFilter();
downloadingTorrentTab->setBottomTabEnabled(1, false);
}
// RSS
if(options->isRSSEnabled()) {
displayRSSTab(true);
} else {
displayRSSTab(false);
}
// Clean up
if(deleteOptions) {
delete options;

View file

@ -179,6 +179,7 @@ class GUI : public QMainWindow, private Ui::MainWindow{
protected:
void closeEvent(QCloseEvent *);
void hideEvent(QHideEvent *);
void displayRSSTab(bool enable);
public:
// Construct / Destruct

View file

@ -1562,7 +1562,7 @@
<iconset resource="icons.qrc" >
<normaloff>:/Icons/configure.png</normaloff>:/Icons/configure.png</iconset>
</attribute>
<layout class="QVBoxLayout" >
<layout class="QVBoxLayout" name="verticalLayout_7" >
<item>
<widget class="QGroupBox" name="filterBox" >
<property name="enabled" >
@ -1622,117 +1622,136 @@
<property name="title" >
<string>RSS</string>
</property>
<layout class="QVBoxLayout" >
<layout class="QVBoxLayout" name="verticalLayout_6" >
<item>
<layout class="QHBoxLayout" >
<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" >
<item>
<layout class="QHBoxLayout" >
<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" >
<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>50</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>
<widget class="QCheckBox" name="checkEnableRSS" >
<property name="text" >
<string>Enable RSS support</string>
</property>
</widget>
</item>
<item>
<widget class="QGroupBox" name="groupRSSSettings" >
<property name="enabled" >
<bool>false</bool>
</property>
<property name="title" >
<string>RSS settings</string>
</property>
<layout class="QVBoxLayout" name="verticalLayout_5" >
<item>
<layout class="QHBoxLayout" >
<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" >
<item>
<layout class="QHBoxLayout" >
<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" >
<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>50</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>
</layout>
</widget>
</item>
</layout>
</widget>

View file

@ -140,8 +140,9 @@ options_imp::options_imp(QWidget *parent):QDialog(parent){
connect(checkMaxUploadsPerTorrent, SIGNAL(stateChanged(int)), this, SLOT(enableMaxUploadsLimitPerTorrent(int)));
connect(checkRatioLimit, SIGNAL(stateChanged(int)), this, SLOT(enableShareRatio(int)));
connect(checkRatioRemove, SIGNAL(stateChanged(int)), this, SLOT(enableDeleteRatio(int)));
// IP Filter tab
connect(checkIPFilter, SIGNAL(stateChanged(int)), this, SLOT(enableFilter(int)));
// Misc tab
connect(checkIPFilter, SIGNAL(stateChanged(int)), this, SLOT(enableFilter(int)));
connect(checkEnableRSS, SIGNAL(stateChanged(int)), this, SLOT(enableRSS(int)));
// Web UI tab
connect(checkWebUi, SIGNAL(toggled(bool)), this, SLOT(enableWebUi(bool)));
@ -205,6 +206,7 @@ options_imp::options_imp(QWidget *parent):QDialog(parent){
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(stateChanged(int)), this, SLOT(enableApplyButton()));
// Web UI tab
connect(checkWebUi, SIGNAL(toggled(bool)), this, SLOT(enableApplyButton()));
connect(spinWebUiPort, SIGNAL(valueChanged(int)), this, SLOT(enableApplyButton()));
@ -338,8 +340,9 @@ void options_imp::saveOptions(){
}
// End IPFilter preferences
settings.endGroup();
// * RSS
// 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
@ -607,6 +610,12 @@ void options_imp::loadOptions(){
settings.endGroup();
// * RSS
settings.beginGroup("RSS");
checkEnableRSS->setChecked(settings.value(QString::fromUtf8("RSSEnabled"), false).toBool());
if(isRSSEnabled()) {
enableRSS(2); // Enable
} else {
enableRSS(0); // Disable
}
spinRSSRefresh->setValue(settings.value(QString::fromUtf8("RSSRefresh"), 5).toInt());
spinRSSMaxArticlesPerFeed->setValue(settings.value(QString::fromUtf8("RSSMaxArticlesPerFeed"), 50).toInt());
// End RSS preferences
@ -658,6 +667,10 @@ bool options_imp::isDHTEnabled() const{
return checkDHT->isChecked();
}
bool options_imp::isRSSEnabled() const{
return checkEnableRSS->isChecked();
}
bool options_imp::isPeXEnabled() const{
return checkPeX->isChecked();
}
@ -850,7 +863,7 @@ void options_imp::enableMaxUploadsLimitPerTorrent(int checkBoxValue){
}
void options_imp::enableFilter(int checkBoxValue){
if(checkBoxValue!=2){
if(checkBoxValue != 2){
//Disable
lblFilterPath->setEnabled(false);
textFilterPath->setEnabled(false);
@ -863,6 +876,16 @@ void options_imp::enableFilter(int checkBoxValue){
}
}
void options_imp::enableRSS(int checkBoxValue) {
if(checkBoxValue != 2){
//Disable
groupRSSSettings->setEnabled(false);
}else{
//enable
groupRSSSettings->setEnabled(true);
}
}
void options_imp::enableUploadLimit(int checkBoxValue){
if(checkBoxValue != 2){
//Disable

View file

@ -99,6 +99,7 @@ class options_imp : public QDialog, private Ui::Dialog {
bool isDHTEnabled() const;
bool isPeXEnabled() const;
bool isLSDEnabled() const;
bool isRSSEnabled() const;
bool shouldSpoofAzureus() const;
int getEncryptionSetting() const;
float getDesiredRatio() const;
@ -123,6 +124,7 @@ class options_imp : public QDialog, private Ui::Dialog {
void enableShareRatio(int checkBoxValue);
void enableDeleteRatio(int checkBoxValue);
void enableFilter(int checkBoxValue);
void enableRSS(int checkBoxValue);
void setStyle(int style);
void on_buttonBox_accepted();
void closeEvent(QCloseEvent *e);