1
0
mirror of https://github.com/d47081/qBittorrent.git synced 2025-01-27 06:54:20 +00:00

Display instructions when no search plugin is installed.

This commit is contained in:
sledgehammer999 2017-06-02 01:30:21 +03:00
parent 793ed7148f
commit fc543b9db6
No known key found for this signature in database
GPG Key ID: 6E4A2D025B7CC9A2
3 changed files with 76 additions and 4 deletions

View File

@ -118,6 +118,8 @@ SearchWidget::SearchWidget(MainWindow *mainWindow)
fillCatCombobox();
fillPluginComboBox();
selectActivePage();
connect(m_ui->m_searchPattern, SIGNAL(returnPressed()), m_ui->searchButton, SLOT(click()));
connect(m_ui->m_searchPattern, SIGNAL(textEdited(QString)), this, SLOT(searchTextEdited(QString)));
connect(m_ui->selectPlugin, SIGNAL(currentIndexChanged(int)), this, SLOT(selectMultipleBox(int)));
@ -169,6 +171,24 @@ QString SearchWidget::selectedPlugin() const
return m_ui->selectPlugin->itemData(m_ui->selectPlugin->currentIndex()).toString();
}
void SearchWidget::selectActivePage()
{
if (m_searchEngine->allPlugins().isEmpty()) {
m_ui->stackedPages->setCurrentWidget(m_ui->emptyPage);
m_ui->m_searchPattern->setEnabled(false);
m_ui->comboCategory->setEnabled(false);
m_ui->selectPlugin->setEnabled(false);
m_ui->searchButton->setEnabled(false);
}
else {
m_ui->stackedPages->setCurrentWidget(m_ui->searchPage);
m_ui->m_searchPattern->setEnabled(true);
m_ui->comboCategory->setEnabled(true);
m_ui->selectPlugin->setEnabled(true);
m_ui->searchButton->setEnabled(true);
}
}
SearchWidget::~SearchWidget()
{
qDebug("Search destruction");
@ -224,6 +244,7 @@ void SearchWidget::on_pluginsButton_clicked()
PluginSelectDlg *dlg = new PluginSelectDlg(m_searchEngine, this);
connect(dlg, SIGNAL(pluginsChanged()), this, SLOT(fillCatCombobox()));
connect(dlg, SIGNAL(pluginsChanged()), this, SLOT(fillPluginComboBox()));
connect(dlg, &PluginSelectDlg::pluginsChanged, this, &SearchWidget::selectActivePage);
}
void SearchWidget::searchTextEdited(QString)

View File

@ -82,6 +82,7 @@ private slots:
void fillCatCombobox();
void fillPluginComboBox();
void selectActivePage();
void searchTextEdited(QString);
private:

View File

@ -13,7 +13,7 @@
<property name="windowTitle">
<string>Search</string>
</property>
<layout class="QVBoxLayout" name="verticalLayout_2">
<layout class="QVBoxLayout" name="verticalLayout_3">
<item>
<layout class="QHBoxLayout" name="searchBarLayout">
<item>
@ -55,10 +55,60 @@
</layout>
</item>
<item>
<widget class="QTabWidget" name="tabWidget">
<property name="tabsClosable">
<bool>true</bool>
<widget class="QStackedWidget" name="stackedPages">
<property name="currentIndex">
<number>1</number>
</property>
<widget class="QWidget" name="emptyPage">
<layout class="QVBoxLayout" name="verticalLayout">
<property name="leftMargin">
<number>0</number>
</property>
<property name="topMargin">
<number>0</number>
</property>
<property name="rightMargin">
<number>0</number>
</property>
<property name="bottomMargin">
<number>0</number>
</property>
<item>
<widget class="QLabel" name="label">
<property name="text">
<string>There aren't any search plugins installed.
Click the &quot;Search plugins...&quot; button at the bottom right of the window to install some.</string>
</property>
<property name="alignment">
<set>Qt::AlignCenter</set>
</property>
</widget>
</item>
</layout>
</widget>
<widget class="QWidget" name="searchPage">
<layout class="QVBoxLayout" name="verticalLayout_2">
<property name="leftMargin">
<number>0</number>
</property>
<property name="topMargin">
<number>0</number>
</property>
<property name="rightMargin">
<number>0</number>
</property>
<property name="bottomMargin">
<number>0</number>
</property>
<item>
<widget class="QTabWidget" name="tabWidget">
<property name="tabsClosable">
<bool>true</bool>
</property>
</widget>
</item>
</layout>
</widget>
</widget>
</item>
<item>