Browse Source

Add "clear" functionality to search field (closes #59)

adaptive-webui-19844
Christophe Dumez 12 years ago
parent
commit
e9d075049b
  1. 46
      src/searchengine/search.ui
  2. 11
      src/searchengine/searchengine.cpp
  3. 2
      src/searchengine/searchengine.h

46
src/searchengine/search.ui

@ -15,20 +15,7 @@ @@ -15,20 +15,7 @@
</property>
<layout class="QVBoxLayout" name="verticalLayout">
<item>
<layout class="QHBoxLayout" name="horizontalLayout">
<item>
<widget class="QLineEdit" name="search_pattern">
<property name="maximumSize">
<size>
<width>16777215</width>
<height>22</height>
</size>
</property>
<property name="contextMenuPolicy">
<enum>Qt::CustomContextMenu</enum>
</property>
</widget>
</item>
<layout class="QHBoxLayout" name="searchBarLayout">
<item>
<widget class="QComboBox" name="comboCategory"/>
</item>
@ -112,20 +99,8 @@ @@ -112,20 +99,8 @@
</item>
<item>
<layout class="QVBoxLayout">
<property name="spacing">
<number>6</number>
</property>
<property name="margin">
<number>0</number>
</property>
<item>
<layout class="QHBoxLayout">
<property name="spacing">
<number>6</number>
</property>
<property name="margin">
<number>0</number>
</property>
<item>
<widget class="QPushButton" name="download_button">
<property name="enabled">
@ -173,22 +148,5 @@ @@ -173,22 +148,5 @@
</layout>
</widget>
<resources/>
<connections>
<connection>
<sender>search_pattern</sender>
<signal>returnPressed()</signal>
<receiver>search_button</receiver>
<slot>click()</slot>
<hints>
<hint type="sourcelabel">
<x>421</x>
<y>37</y>
</hint>
<hint type="destinationlabel">
<x>685</x>
<y>45</y>
</hint>
</hints>
</connection>
</connections>
<connections/>
</ui>

11
src/searchengine/searchengine.cpp

@ -58,12 +58,19 @@ @@ -58,12 +58,19 @@
#include "qinisettings.h"
#include "mainwindow.h"
#include "iconprovider.h"
#include "lineedit.h"
#define SEARCHHISTORY_MAXSIZE 50
/*SEARCH ENGINE START*/
SearchEngine::SearchEngine(MainWindow *parent) : QWidget(parent), mp_mainWindow(parent) {
SearchEngine::SearchEngine(MainWindow* parent)
: QWidget(parent)
, search_pattern(new LineEdit)
, mp_mainWindow(parent)
{
setupUi(this);
searchBarLayout->insertWidget(0, search_pattern);
connect(search_pattern, SIGNAL(returnPressed()), search_button, SLOT(click()));
// Icons
search_button->setIcon(IconProvider::instance()->getIcon("edit-find"));
download_button->setIcon(IconProvider::instance()->getIcon("download"));
@ -98,6 +105,7 @@ SearchEngine::SearchEngine(MainWindow *parent) : QWidget(parent), mp_mainWindow( @@ -98,6 +105,7 @@ SearchEngine::SearchEngine(MainWindow *parent) : QWidget(parent), mp_mainWindow(
);
// Fill in category combobox
fillCatCombobox();
connect(search_pattern, SIGNAL(customContextMenuRequested(QPoint)), this, SLOT(displayPatternContextMenu(QPoint)));
connect(search_pattern, SIGNAL(textEdited(QString)), this, SLOT(searchTextEdited(QString)));
}
@ -189,6 +197,7 @@ SearchEngine::~SearchEngine() { @@ -189,6 +197,7 @@ SearchEngine::~SearchEngine() {
downloader->waitForFinished();
delete downloader;
}
delete search_pattern;
delete searchTimeout;
delete searchProcess;
delete supported_engines;

2
src/searchengine/searchengine.h

@ -44,6 +44,7 @@ @@ -44,6 +44,7 @@
class DownloadThread;
class SearchEngine;
class MainWindow;
class LineEdit;
QT_BEGIN_NAMESPACE
class QTimer;
@ -122,6 +123,7 @@ private slots: @@ -122,6 +123,7 @@ private slots:
private:
// Search related
LineEdit* search_pattern;
QProcess *searchProcess;
QList<QProcess*> downloaders;
bool search_stopped;

Loading…
Cancel
Save