Browse Source

Display instructions when no search plugin is installed.

adaptive-webui-19844
sledgehammer999 8 years ago
parent
commit
fc543b9db6
No known key found for this signature in database
GPG Key ID: 6E4A2D025B7CC9A2
  1. 21
      src/gui/search/searchwidget.cpp
  2. 1
      src/gui/search/searchwidget.h
  3. 58
      src/gui/search/searchwidget.ui

21
src/gui/search/searchwidget.cpp

@ -118,6 +118,8 @@ SearchWidget::SearchWidget(MainWindow *mainWindow) @@ -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 @@ -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() @@ -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)

1
src/gui/search/searchwidget.h

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

58
src/gui/search/searchwidget.ui

@ -13,7 +13,7 @@ @@ -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 @@ @@ -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>

Loading…
Cancel
Save