Browse Source

Move m_searchPattern widget from code to .ui file

adaptive-webui-19844
Chocobo1 9 years ago
parent
commit
216d98844b
  1. 8
      src/gui/search/searchwidget.cpp
  2. 2
      src/gui/search/searchwidget.h
  3. 10
      src/gui/search/searchwidget.ui

8
src/gui/search/searchwidget.cpp

@ -61,7 +61,6 @@
#include "mainwindow.h" #include "mainwindow.h"
#include "addnewtorrentdialog.h" #include "addnewtorrentdialog.h"
#include "guiiconprovider.h" #include "guiiconprovider.h"
#include "lineedit.h"
#include "pluginselectdlg.h" #include "pluginselectdlg.h"
#include "searchsortmodel.h" #include "searchsortmodel.h"
#include "searchtab.h" #include "searchtab.h"
@ -78,13 +77,8 @@ SearchWidget::SearchWidget(MainWindow *mainWindow)
{ {
setupUi(this); setupUi(this);
m_searchPattern = new LineEdit(this);
searchBarLayout->insertWidget(0, m_searchPattern);
connect(m_searchPattern, SIGNAL(returnPressed()), searchButton, SLOT(click()));
QString searchPatternHint; QString searchPatternHint;
QTextStream stream(&searchPatternHint, QIODevice::WriteOnly); QTextStream stream(&searchPatternHint, QIODevice::WriteOnly);
stream << "<html><head/><body><p>" stream << "<html><head/><body><p>"
<< tr("A phrase to search for.") << "<br>" << tr("A phrase to search for.") << "<br>"
<< tr("Spaces in a search term may be protected by double quotes.") << tr("Spaces in a search term may be protected by double quotes.")
@ -99,7 +93,6 @@ SearchWidget::SearchWidget(MainWindow *mainWindow)
"Search phrase example, illustrates quotes usage, double quoted" "Search phrase example, illustrates quotes usage, double quoted"
"pair of space delimited words, the whole pair is highlighted") "pair of space delimited words, the whole pair is highlighted")
<< "</p></body></html>" << flush; << "</p></body></html>" << flush;
m_searchPattern->setToolTip(searchPatternHint); m_searchPattern->setToolTip(searchPatternHint);
// Icons // Icons
@ -120,6 +113,7 @@ SearchWidget::SearchWidget(MainWindow *mainWindow)
fillCatCombobox(); fillCatCombobox();
fillPluginComboBox(); fillPluginComboBox();
connect(m_searchPattern, SIGNAL(returnPressed()), searchButton, SLOT(click()));
connect(m_searchPattern, SIGNAL(textEdited(QString)), this, SLOT(searchTextEdited(QString))); connect(m_searchPattern, SIGNAL(textEdited(QString)), this, SLOT(searchTextEdited(QString)));
connect(selectPlugin, SIGNAL(currentIndexChanged(int)), this, SLOT(selectMultipleBox(int))); connect(selectPlugin, SIGNAL(currentIndexChanged(int)), this, SLOT(selectMultipleBox(int)));
} }

2
src/gui/search/searchwidget.h

@ -38,7 +38,6 @@
#include "ui_searchwidget.h" #include "ui_searchwidget.h"
class MainWindow; class MainWindow;
class LineEdit;
class SearchEngine; class SearchEngine;
struct SearchResult; struct SearchResult;
class SearchTab; class SearchTab;
@ -82,7 +81,6 @@ private:
QString selectedCategory() const; QString selectedCategory() const;
QString selectedPlugin() const; QString selectedPlugin() const;
LineEdit *m_searchPattern;
SearchEngine *m_searchEngine; SearchEngine *m_searchEngine;
QPointer<SearchTab> m_currentSearchTab; // Selected tab QPointer<SearchTab> m_currentSearchTab; // Selected tab
QPointer<SearchTab> m_activeSearchTab; // Tab with running search QPointer<SearchTab> m_activeSearchTab; // Tab with running search

10
src/gui/search/searchwidget.ui

@ -16,6 +16,9 @@
<layout class="QVBoxLayout" name="verticalLayout_2"> <layout class="QVBoxLayout" name="verticalLayout_2">
<item> <item>
<layout class="QHBoxLayout" name="searchBarLayout"> <layout class="QHBoxLayout" name="searchBarLayout">
<item>
<widget class="LineEdit" name="m_searchPattern"/>
</item>
<item> <item>
<widget class="QComboBox" name="comboCategory"> <widget class="QComboBox" name="comboCategory">
<property name="sizePolicy"> <property name="sizePolicy">
@ -114,6 +117,13 @@
</item> </item>
</layout> </layout>
</widget> </widget>
<customwidgets>
<customwidget>
<class>LineEdit</class>
<extends>QLineEdit</extends>
<header>lineedit.h</header>
</customwidget>
</customwidgets>
<resources/> <resources/>
<connections/> <connections/>
</ui> </ui>

Loading…
Cancel
Save