mirror of
https://github.com/d47081/qBittorrent.git
synced 2025-02-05 11:24:15 +00:00
Display instructions when no search plugin is installed.
This commit is contained in:
parent
793ed7148f
commit
fc543b9db6
@ -118,6 +118,8 @@ SearchWidget::SearchWidget(MainWindow *mainWindow)
|
|||||||
fillCatCombobox();
|
fillCatCombobox();
|
||||||
fillPluginComboBox();
|
fillPluginComboBox();
|
||||||
|
|
||||||
|
selectActivePage();
|
||||||
|
|
||||||
connect(m_ui->m_searchPattern, SIGNAL(returnPressed()), m_ui->searchButton, SLOT(click()));
|
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->m_searchPattern, SIGNAL(textEdited(QString)), this, SLOT(searchTextEdited(QString)));
|
||||||
connect(m_ui->selectPlugin, SIGNAL(currentIndexChanged(int)), this, SLOT(selectMultipleBox(int)));
|
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();
|
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()
|
SearchWidget::~SearchWidget()
|
||||||
{
|
{
|
||||||
qDebug("Search destruction");
|
qDebug("Search destruction");
|
||||||
@ -224,6 +244,7 @@ void SearchWidget::on_pluginsButton_clicked()
|
|||||||
PluginSelectDlg *dlg = new PluginSelectDlg(m_searchEngine, this);
|
PluginSelectDlg *dlg = new PluginSelectDlg(m_searchEngine, this);
|
||||||
connect(dlg, SIGNAL(pluginsChanged()), this, SLOT(fillCatCombobox()));
|
connect(dlg, SIGNAL(pluginsChanged()), this, SLOT(fillCatCombobox()));
|
||||||
connect(dlg, SIGNAL(pluginsChanged()), this, SLOT(fillPluginComboBox()));
|
connect(dlg, SIGNAL(pluginsChanged()), this, SLOT(fillPluginComboBox()));
|
||||||
|
connect(dlg, &PluginSelectDlg::pluginsChanged, this, &SearchWidget::selectActivePage);
|
||||||
}
|
}
|
||||||
|
|
||||||
void SearchWidget::searchTextEdited(QString)
|
void SearchWidget::searchTextEdited(QString)
|
||||||
|
@ -82,6 +82,7 @@ private slots:
|
|||||||
|
|
||||||
void fillCatCombobox();
|
void fillCatCombobox();
|
||||||
void fillPluginComboBox();
|
void fillPluginComboBox();
|
||||||
|
void selectActivePage();
|
||||||
void searchTextEdited(QString);
|
void searchTextEdited(QString);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
@ -13,7 +13,7 @@
|
|||||||
<property name="windowTitle">
|
<property name="windowTitle">
|
||||||
<string>Search</string>
|
<string>Search</string>
|
||||||
</property>
|
</property>
|
||||||
<layout class="QVBoxLayout" name="verticalLayout_2">
|
<layout class="QVBoxLayout" name="verticalLayout_3">
|
||||||
<item>
|
<item>
|
||||||
<layout class="QHBoxLayout" name="searchBarLayout">
|
<layout class="QHBoxLayout" name="searchBarLayout">
|
||||||
<item>
|
<item>
|
||||||
@ -55,10 +55,60 @@
|
|||||||
</layout>
|
</layout>
|
||||||
</item>
|
</item>
|
||||||
<item>
|
<item>
|
||||||
<widget class="QTabWidget" name="tabWidget">
|
<widget class="QStackedWidget" name="stackedPages">
|
||||||
<property name="tabsClosable">
|
<property name="currentIndex">
|
||||||
<bool>true</bool>
|
<number>1</number>
|
||||||
</property>
|
</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 "Search plugins..." 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>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
<item>
|
<item>
|
||||||
|
Loading…
x
Reference in New Issue
Block a user