mirror of
https://github.com/d47081/qBittorrent.git
synced 2025-01-22 20:44:15 +00:00
Search engine can now be disabled
This commit is contained in:
parent
54131001b0
commit
39b32bf1cd
31
src/GUI.cpp
31
src/GUI.cpp
@ -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
|
||||
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() {
|
||||
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) {
|
||||
}
|
||||
}
|
||||
|
||||
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() {
|
||||
}
|
||||
|
||||
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() {
|
||||
connect(downloadFromURLDialog, SIGNAL(urlsReadyToBeDownloaded(const QStringList&)), this, SLOT(downloadFromURLList(const QStringList&)));
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -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:
|
||||
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();
|
||||
|
@ -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();
|
||||
|
@ -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 @@
|
||||
<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…
x
Reference in New Issue
Block a user