mirror of
https://github.com/d47081/qBittorrent.git
synced 2025-01-23 04:54:18 +00:00
Add "clear" functionality to search field (closes #59)
This commit is contained in:
parent
c7c627015d
commit
e9d075049b
@ -15,20 +15,7 @@
|
|||||||
</property>
|
</property>
|
||||||
<layout class="QVBoxLayout" name="verticalLayout">
|
<layout class="QVBoxLayout" name="verticalLayout">
|
||||||
<item>
|
<item>
|
||||||
<layout class="QHBoxLayout" name="horizontalLayout">
|
<layout class="QHBoxLayout" name="searchBarLayout">
|
||||||
<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>
|
|
||||||
<item>
|
<item>
|
||||||
<widget class="QComboBox" name="comboCategory"/>
|
<widget class="QComboBox" name="comboCategory"/>
|
||||||
</item>
|
</item>
|
||||||
@ -112,20 +99,8 @@
|
|||||||
</item>
|
</item>
|
||||||
<item>
|
<item>
|
||||||
<layout class="QVBoxLayout">
|
<layout class="QVBoxLayout">
|
||||||
<property name="spacing">
|
|
||||||
<number>6</number>
|
|
||||||
</property>
|
|
||||||
<property name="margin">
|
|
||||||
<number>0</number>
|
|
||||||
</property>
|
|
||||||
<item>
|
<item>
|
||||||
<layout class="QHBoxLayout">
|
<layout class="QHBoxLayout">
|
||||||
<property name="spacing">
|
|
||||||
<number>6</number>
|
|
||||||
</property>
|
|
||||||
<property name="margin">
|
|
||||||
<number>0</number>
|
|
||||||
</property>
|
|
||||||
<item>
|
<item>
|
||||||
<widget class="QPushButton" name="download_button">
|
<widget class="QPushButton" name="download_button">
|
||||||
<property name="enabled">
|
<property name="enabled">
|
||||||
@ -173,22 +148,5 @@
|
|||||||
</layout>
|
</layout>
|
||||||
</widget>
|
</widget>
|
||||||
<resources/>
|
<resources/>
|
||||||
<connections>
|
<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>
|
|
||||||
</ui>
|
</ui>
|
||||||
|
@ -58,12 +58,19 @@
|
|||||||
#include "qinisettings.h"
|
#include "qinisettings.h"
|
||||||
#include "mainwindow.h"
|
#include "mainwindow.h"
|
||||||
#include "iconprovider.h"
|
#include "iconprovider.h"
|
||||||
|
#include "lineedit.h"
|
||||||
|
|
||||||
#define SEARCHHISTORY_MAXSIZE 50
|
#define SEARCHHISTORY_MAXSIZE 50
|
||||||
|
|
||||||
/*SEARCH ENGINE START*/
|
/*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);
|
setupUi(this);
|
||||||
|
searchBarLayout->insertWidget(0, search_pattern);
|
||||||
|
connect(search_pattern, SIGNAL(returnPressed()), search_button, SLOT(click()));
|
||||||
// Icons
|
// Icons
|
||||||
search_button->setIcon(IconProvider::instance()->getIcon("edit-find"));
|
search_button->setIcon(IconProvider::instance()->getIcon("edit-find"));
|
||||||
download_button->setIcon(IconProvider::instance()->getIcon("download"));
|
download_button->setIcon(IconProvider::instance()->getIcon("download"));
|
||||||
@ -98,6 +105,7 @@ SearchEngine::SearchEngine(MainWindow *parent) : QWidget(parent), mp_mainWindow(
|
|||||||
);
|
);
|
||||||
// Fill in category combobox
|
// Fill in category combobox
|
||||||
fillCatCombobox();
|
fillCatCombobox();
|
||||||
|
|
||||||
connect(search_pattern, SIGNAL(customContextMenuRequested(QPoint)), this, SLOT(displayPatternContextMenu(QPoint)));
|
connect(search_pattern, SIGNAL(customContextMenuRequested(QPoint)), this, SLOT(displayPatternContextMenu(QPoint)));
|
||||||
connect(search_pattern, SIGNAL(textEdited(QString)), this, SLOT(searchTextEdited(QString)));
|
connect(search_pattern, SIGNAL(textEdited(QString)), this, SLOT(searchTextEdited(QString)));
|
||||||
}
|
}
|
||||||
@ -189,6 +197,7 @@ SearchEngine::~SearchEngine() {
|
|||||||
downloader->waitForFinished();
|
downloader->waitForFinished();
|
||||||
delete downloader;
|
delete downloader;
|
||||||
}
|
}
|
||||||
|
delete search_pattern;
|
||||||
delete searchTimeout;
|
delete searchTimeout;
|
||||||
delete searchProcess;
|
delete searchProcess;
|
||||||
delete supported_engines;
|
delete supported_engines;
|
||||||
|
@ -44,6 +44,7 @@
|
|||||||
class DownloadThread;
|
class DownloadThread;
|
||||||
class SearchEngine;
|
class SearchEngine;
|
||||||
class MainWindow;
|
class MainWindow;
|
||||||
|
class LineEdit;
|
||||||
|
|
||||||
QT_BEGIN_NAMESPACE
|
QT_BEGIN_NAMESPACE
|
||||||
class QTimer;
|
class QTimer;
|
||||||
@ -122,6 +123,7 @@ private slots:
|
|||||||
|
|
||||||
private:
|
private:
|
||||||
// Search related
|
// Search related
|
||||||
|
LineEdit* search_pattern;
|
||||||
QProcess *searchProcess;
|
QProcess *searchProcess;
|
||||||
QList<QProcess*> downloaders;
|
QList<QProcess*> downloaders;
|
||||||
bool search_stopped;
|
bool search_stopped;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user