libyui-qt-pkg
YQPkgSearchFilterView.h
1 /**************************************************************************
2 Copyright (C) 2000 - 2010 Novell, Inc.
3 All Rights Reserved.
4 
5 This program is free software; you can redistribute it and/or modify
6 it under the terms of the GNU General Public License as published by
7 the Free Software Foundation; either version 2 of the License, or
8 (at your option) any later version.
9 
10 This program is distributed in the hope that it will be useful,
11 but WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 GNU General Public License for more details.
14 
15 You should have received a copy of the GNU General Public License along
16 with this program; if not, write to the Free Software Foundation, Inc.,
17 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
18 
19 **************************************************************************/
20 
21 
22 /*---------------------------------------------------------------------\
23 | |
24 | __ __ ____ _____ ____ |
25 | \ \ / /_ _/ ___|_ _|___ \ |
26 | \ V / _` \___ \ | | __) | |
27 | | | (_| |___) || | / __/ |
28 | |_|\__,_|____/ |_| |_____| |
29 | |
30 | core system |
31 | (C) SuSE GmbH |
32 \----------------------------------------------------------------------/
33 
34  File: YQPkgSearchFilterView.h
35 
36  Author: Stefan Hundhammer <shundhammer.de>
37 
38 /-*/
39 
40 
41 #ifndef YQPkgSearchFilterView_h
42 #define YQPkgSearchFilterView_h
43 
44 #include "YQZypp.h"
45 #include <QWidget>
46 #include <QRegExp>
47 #include <QEvent>
48 #include <QScrollArea>
49 
50 
51 class QComboBox;
52 class QCheckBox;
53 class QPushButton;
54 class QRadioButton;
55 
56 using std::list;
57 using std::string;
58 
59 
63 class YQPkgSearchFilterView : public QScrollArea
64 {
65  Q_OBJECT
66 
67 public:
68 
72  YQPkgSearchFilterView( QWidget * parent );
73 
77  virtual ~YQPkgSearchFilterView();
78 
83  virtual QSize minimumSizeHint() const;
84 
89  bool check( ZyppSel selectable,
90  ZyppObj zyppObj );
91 
92 
93 public slots:
94 
102  void filter();
103 
107  void filterIfVisible();
108 
112  void setFocus();
113 
114 
115 signals:
116 
121  void filterStart();
122 
126  void filterMatch( ZyppSel selectable,
127  ZyppPkg pkg );
128 
132  void filterFinished();
133 
137  void message( const QString & text );
138 
139 
140 protected:
141 
142  // Caution: Enum order must match corresponding message strings in combo box!
143  enum SearchMode
144  {
145  Contains = 0,
146  BeginsWith,
147  ExactMatch,
148  UseWildcards,
149  UseRegExp
150  };
151 
156  virtual void keyPressEvent( QKeyEvent * event );
157 
158  // THESE SHOULD BE DEPRECATED but still used in secondary
159  // filters
163  bool check( ZyppSel selectable,
164  ZyppObj zyppObj,
165  const QRegExp & regexp );
166 
170  bool check( const string & attribute, const QRegExp & regexp );
171 
177  bool check( const zypp::Capabilities & capSet, const QRegExp & regexp );
178 
179  // Data members
180 
181  QComboBox * _searchText;
182  QPushButton * _searchButton;
183 
184  QCheckBox * _searchInName;
185  QCheckBox * _searchInKeywords;
186  QCheckBox * _searchInSummary;
187  QCheckBox * _searchInDescription;
188  QCheckBox * _searchInRequires;
189  QCheckBox * _searchInProvides;
190  QCheckBox * _searchInFileList;
191 
192  QComboBox * _searchMode;
193  QCheckBox * _caseSensitive;
194 
195  int _matchCount;
196 };
197 
198 
199 
200 #endif // ifndef YQPkgSearchFilterView_h
void filterMatch(ZyppSel selectable, ZyppPkg pkg)
bool check(ZyppSel selectable, ZyppObj zyppObj)
Definition: YQPkgSearchFilterView.cc:376
void filterIfVisible()
Definition: YQPkgSearchFilterView.cc:225
Filter view for searching within packages.
Definition: YQPkgSearchFilterView.h:63
YQPkgSearchFilterView(QWidget *parent)
Definition: YQPkgSearchFilterView.cc:73
virtual QSize minimumSizeHint() const
Definition: YQPkgSearchFilterView.cc:218
void message(const QString &text)
virtual ~YQPkgSearchFilterView()
Definition: YQPkgSearchFilterView.cc:182
virtual void keyPressEvent(QKeyEvent *event)
Definition: YQPkgSearchFilterView.cc:189
void setFocus()
Definition: YQPkgSearchFilterView.cc:211
void filter()
Definition: YQPkgSearchFilterView.cc:233