Browse Source

Search engine can now be disabled

adaptive-webui-19844
Christophe Dumez 15 years ago
parent
commit
39b32bf1cd
  1. 31
      src/GUI.cpp
  2. 4
      src/GUI.h
  3. 16
      src/preferences.h
  4. 12
      src/ui/mainwindow.ui

31
src/GUI.cpp

@ -155,10 +155,6 @@ GUI::GUI(QWidget *parent, QStringList torrentCmdLine) : QMainWindow(parent), dis @@ -155,10 +155,6 @@ GUI::GUI(QWidget *parent, QStringList torrentCmdLine) : QMainWindow(parent), dis
connect(actionIncreasePriority, SIGNAL(triggered()), transferList, SLOT(increasePrioSelectedTorrents()));
connect(actionDecreasePriority, SIGNAL(triggered()), transferList, SLOT(decreasePrioSelectedTorrents()));
// Search engine tab
searchEngine = new SearchEngine(this, BTSession);
tabs->addTab(searchEngine, QIcon(QString::fromUtf8(":/Icons/oxygen/edit-find.png")), tr("Search"));
// Configure BT session according to options
loadPreferences(false);
// Resume unfinished torrents
@ -185,6 +181,9 @@ GUI::GUI(QWidget *parent, QStringList torrentCmdLine) : QMainWindow(parent), dis @@ -185,6 +181,9 @@ GUI::GUI(QWidget *parent, QStringList torrentCmdLine) : QMainWindow(parent), dis
actionTop_tool_bar->setChecked(Preferences::isToolbarDisplayed());
actionSpeed_in_title_bar->setChecked(Preferences::speedInTitleBar());
actionRSS_Reader->setChecked(Preferences::isRSSEnabled());
actionSearch_engine->setChecked(Preferences::isSearchEnabled());
if(actionSearch_engine->isChecked())
displaySearchTab(true);
if(actionRSS_Reader->isChecked())
displayRSSTab(true);
@ -254,7 +253,8 @@ GUI::~GUI() { @@ -254,7 +253,8 @@ GUI::~GUI() {
delete downloadFromURLDialog;
if(rssWidget)
delete rssWidget;
delete searchEngine;
if(searchEngine)
delete searchEngine;
delete transferListFilters;
delete properties;
delete hSplitter;
@ -304,6 +304,20 @@ void GUI::displayRSSTab(bool enable) { @@ -304,6 +304,20 @@ void GUI::displayRSSTab(bool enable) {
}
}
void GUI::displaySearchTab(bool enable) {
if(enable) {
// RSS tab
if(!searchEngine) {
searchEngine = new SearchEngine(this, BTSession);
tabs->insertTab(1, searchEngine, QIcon(QString::fromUtf8(":/Icons/oxygen/edit-find.png")), tr("Search"));
}
} else {
if(searchEngine) {
delete searchEngine;
}
}
}
void GUI::updateNbTorrents(unsigned int nb_downloading, unsigned int nb_seeding, unsigned int nb_active, unsigned int nb_inactive, unsigned int nb_paused) {
Q_UNUSED(nb_downloading);
Q_UNUSED(nb_seeding);
@ -1008,9 +1022,15 @@ void GUI::on_actionSpeed_in_title_bar_triggered() { @@ -1008,9 +1022,15 @@ void GUI::on_actionSpeed_in_title_bar_triggered() {
}
void GUI::on_actionRSS_Reader_triggered() {
Preferences::setRSSEnabled(actionRSS_Reader->isChecked());
displayRSSTab(actionRSS_Reader->isChecked());
}
void GUI::on_actionSearch_engine_triggered() {
Preferences::setSearchEnabled(actionSearch_engine->isChecked());
displaySearchTab(actionSearch_engine->isChecked());
}
/*****************************************************
* *
* HTTP Downloader *
@ -1025,3 +1045,4 @@ void GUI::on_actionDownload_from_URL_triggered() { @@ -1025,3 +1045,4 @@ void GUI::on_actionDownload_from_URL_triggered() {
connect(downloadFromURLDialog, SIGNAL(urlsReadyToBeDownloaded(const QStringList&)), this, SLOT(downloadFromURLList(const QStringList&)));
}
}

4
src/GUI.h

@ -128,6 +128,7 @@ protected: @@ -128,6 +128,7 @@ protected:
void showEvent(QShowEvent *);
bool event(QEvent * event);
void displayRSSTab(bool enable);
void displaySearchTab(bool enable);
private:
// Bittorrent
@ -161,11 +162,12 @@ private: @@ -161,11 +162,12 @@ private:
QSplitter *hSplitter;
QSplitter *vSplitter;
// Search
SearchEngine *searchEngine;
QPointer<SearchEngine> searchEngine;
// RSS
QPointer<RSSImp> rssWidget;
private slots:
void on_actionSearch_engine_triggered();
void on_actionRSS_Reader_triggered();
void on_actionSpeed_in_title_bar_triggered();
void on_actionTop_tool_bar_triggered();

16
src/preferences.h

@ -733,12 +733,28 @@ public: @@ -733,12 +733,28 @@ public:
return settings.value(QString::fromUtf8("Preferences/IPFilter/BannedIPs"), QStringList()).toStringList();
}
// Search
static bool isSearchEnabled() {
QSettings settings("qBittorrent", "qBittorrent");
return settings.value(QString::fromUtf8("Preferences/Search/SearchEnabled"), true).toBool();
}
static void setSearchEnabled(bool enabled) {
QSettings settings("qBittorrent", "qBittorrent");
settings.setValue(QString::fromUtf8("Preferences/Search/SearchEnabled"), enabled);
}
// RSS
static bool isRSSEnabled() {
QSettings settings("qBittorrent", "qBittorrent");
return settings.value(QString::fromUtf8("Preferences/RSS/RSSEnabled"), false).toBool();
}
static void setRSSEnabled(bool enabled) {
QSettings settings("qBittorrent", "qBittorrent");
settings.setValue(QString::fromUtf8("Preferences/RSS/RSSEnabled"), enabled);
}
static unsigned int getRSSRefreshInterval() {
QSettings settings("qBittorrent", "qBittorrent");
return settings.value(QString::fromUtf8("Preferences/RSS/RSSRefresh"), 5).toUInt();

12
src/ui/mainwindow.ui

@ -79,6 +79,8 @@ @@ -79,6 +79,8 @@
</property>
<addaction name="actionTop_tool_bar"/>
<addaction name="actionSpeed_in_title_bar"/>
<addaction name="separator"/>
<addaction name="actionSearch_engine"/>
<addaction name="actionRSS_Reader"/>
</widget>
<addaction name="menu_File"/>
@ -307,7 +309,15 @@ @@ -307,7 +309,15 @@
<bool>true</bool>
</property>
<property name="text">
<string>RSS Reader</string>
<string>RSS reader</string>
</property>
</action>
<action name="actionSearch_engine">
<property name="checkable">
<bool>true</bool>
</property>
<property name="text">
<string>Search engine</string>
</property>
</action>
</widget>

Loading…
Cancel
Save