libyui-qt-pkg  2.47.5
YQPkgSecondaryFilterView.h
1 /**************************************************************************
2 Copyright (C) 2018 SUSE LLC
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 #ifndef YQPkgSecondaryFilterView_h
23 #define YQPkgSecondaryFilterView_h
24 
25 #include "YQZypp.h"
26 #include <QWidget>
27 
28 class QY2ComboTabWidget;
31 
32 
33 /**
34  * This is a base class for filter views containing a secondary filter
35  */
36 class YQPkgSecondaryFilterView : public QWidget
37 {
38  Q_OBJECT
39 
40 public:
41 
42  /**
43  * Constructor
44  * Because of the circular dependencies you have to call the init()
45  * method later with the new subclassed object.
46  **/
47  YQPkgSecondaryFilterView( QWidget * parent );
48 
49  /**
50  * Destructor
51  **/
52  virtual ~YQPkgSecondaryFilterView();
53 
54  /**
55  * Initialize the primary widget
56  * @param primary_widget the primary widget to which the secondary views
57  * will be added. It should be a subclass of YQPkgSecondaryFilterView.
58  */
59  void init(QWidget * primary_widget);
60 
61 signals:
62 
63  /**
64  * Emitted when the filtering starts. Use this to clear package lists
65  * etc. prior to adding new entries.
66  **/
67  void filterStart();
68 
69  /**
70  * Emitted during filtering for each pkg that matches the filter
71  * and the candidate package comes from the respective repository
72  **/
73  void filterMatch( ZyppSel selectable,
74  ZyppPkg pkg );
75 
76  /**
77  * Emitted during filtering for each pkg that matches the filter
78  * and the candidate package does not come from the respective repository
79  **/
80  void filterNearMatch( ZyppSel selectable,
81  ZyppPkg pkg );
82 
83  /**
84  * Emitted when filtering is finished.
85  **/
86  void filterFinished();
87 
88 public slots:
89 
90  /**
91  * Filter according to the view's rules and current selection.
92  * Emits those signals:
93  * filterStart()
94  * filterMatch() for each pkg that matches the filter
95  * filterFinished()
96  **/
97  void filter();
98 
99  /**
100  * Same as filter(), but only if this widget is currently visible.
101  **/
102  void filterIfVisible();
103 
104 
105 protected slots:
106 
107  /**
108  * Propagate a filter match from the primary filter
109  * and appy any selected secondary filter(s) to it
110  **/
111  void primaryFilterMatch( ZyppSel selectable,
112  ZyppPkg pkg );
113 
114  /**
115  * Propagate a filter near match from the primary filter
116  * and appy any selected secondary filter(s) to it
117  **/
118  void primaryFilterNearMatch( ZyppSel selectable,
119  ZyppPkg pkg );
120 
121 protected:
122 
123  /**
124  * Widget layout for the secondary filters
125  **/
126  QWidget * layoutSecondaryFilters( QWidget * parent, QWidget * primary_widget );
127 
128  /**
129  * Check if pkg matches the the currently selected secondary filter
130  **/
131  bool secondaryFilterMatch( ZyppSel selectable,
132  ZyppPkg pkg );
133 
134  virtual void primaryFilter() {}
135  virtual void primaryFilterIfVisible() {}
136 
137 
138  // Data members
139  QY2ComboTabWidget * _secondaryFilters;
140  QWidget * _allPackages;
141  QWidget *_unmaintainedPackages;
142  YQPkgSearchFilterView * _searchFilterView;
143  YQPkgStatusFilterView * _statusFilterView;
144 };
145 
146 #endif // ifndef YQPkgSecondaryFilterView_h
void filterNearMatch(ZyppSel selectable, ZyppPkg pkg)
Emitted during filtering for each pkg that matches the filter and the candidate package does not come...
void filter()
Filter according to the view&#39;s rules and current selection.
This is a base class for filter views containing a secondary filter.
QWidget * layoutSecondaryFilters(QWidget *parent, QWidget *primary_widget)
Widget layout for the secondary filters.
void primaryFilterNearMatch(ZyppSel selectable, ZyppPkg pkg)
Propagate a filter near match from the primary filter and appy any selected secondary filter(s) to it...
void init(QWidget *primary_widget)
Initialize the primary widget.
void primaryFilterMatch(ZyppSel selectable, ZyppPkg pkg)
Propagate a filter match from the primary filter and appy any selected secondary filter(s) to it...
void filterIfVisible()
Same as filter(), but only if this widget is currently visible.
Filter view for searching within packages.
void filterStart()
Emitted when the filtering starts.
void filterFinished()
Emitted when filtering is finished.
YQPkgSecondaryFilterView(QWidget *parent)
Constructor Because of the circular dependencies you have to call the init() method later with the ne...
Filter view for packages that made problems during update.
void filterMatch(ZyppSel selectable, ZyppPkg pkg)
Emitted during filtering for each pkg that matches the filter and the candidate package comes from th...
bool secondaryFilterMatch(ZyppSel selectable, ZyppPkg pkg)
Check if pkg matches the the currently selected secondary filter.
virtual ~YQPkgSecondaryFilterView()
Destructor.