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. 52
      src/gui/search/searchwidget.ui

21
src/gui/search/searchwidget.cpp

@ -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)

1
src/gui/search/searchwidget.h

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

52
src/gui/search/searchwidget.ui

@ -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>
@ -54,6 +54,52 @@
</item> </item>
</layout> </layout>
</item> </item>
<item>
<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> <item>
<widget class="QTabWidget" name="tabWidget"> <widget class="QTabWidget" name="tabWidget">
<property name="tabsClosable"> <property name="tabsClosable">
@ -61,6 +107,10 @@
</property> </property>
</widget> </widget>
</item> </item>
</layout>
</widget>
</widget>
</item>
<item> <item>
<layout class="QHBoxLayout" name="layout2"> <layout class="QHBoxLayout" name="layout2">
<item> <item>

Loading…
Cancel
Save