picking up branches/tmp/sh/qt4-port/, merging it with trunk
[duncan/yast2-qt4.git] / src / pkg / YQPkgRepoFilterView.h
1 /*---------------------------------------------------------------------\
2 |                                                                      |
3 |                      __   __    ____ _____ ____                      |
4 |                      \ \ / /_ _/ ___|_   _|___ \                     |
5 |                       \ V / _` \___ \ | |   __) |                    |
6 |                        | | (_| |___) || |  / __/                     |
7 |                        |_|\__,_|____/ |_| |_____|                    |
8 |                                                                      |
9 |                               core system                            |
10 |                                                        (C) SuSE GmbH |
11 \----------------------------------------------------------------------/
12
13   File:       YQPkgRepoFilterView.h
14
15   Author:     Stefan Hundhammer <sh@suse.de>
16
17 /-*/
18
19
20 #ifndef YQPkgRepoFilterView_h
21 #define YQPkgRepoFilterView_h
22
23 #include "YQZypp.h"
24 #include <q3vbox.h>
25
26
27 class YQPkgRepoList;
28 class QY2ComboTabWidget;
29 class YQPkgRpmGroupTagsFilterView;
30 class YQPkgSearchFilterView;
31 class YQPkgStatusFilterView;
32
33
34 class YQPkgRepoFilterView : public Q3VBox
35 {
36     Q_OBJECT
37
38 public:
39
40     /**
41      * Constructor
42      **/
43     YQPkgRepoFilterView( QWidget * parent );
44
45     /**
46      * Destructor
47      **/
48     virtual ~YQPkgRepoFilterView();
49
50     
51 signals:
52
53     /**
54      * Emitted when the filtering starts. Use this to clear package lists
55      * etc. prior to adding new entries.
56      **/
57     void filterStart();
58
59     /**
60      * Emitted during filtering for each pkg that matches the filter
61      * and the candidate package comes from the respective repository
62      **/
63     void filterMatch( ZyppSel   selectable,
64                       ZyppPkg   pkg );
65
66     /**
67      * Emitted during filtering for each pkg that matches the filter
68      * and the candidate package does not come from the respective repository
69      **/
70     void filterNearMatch( ZyppSel       selectable,
71                           ZyppPkg       pkg );
72
73     /**
74      * Emitted when filtering is finished.
75      **/
76     void filterFinished();
77
78     
79 public slots:
80
81     /**
82      * Filter according to the view's rules and current selection.
83      * Emits those signals:
84      *    filterStart()
85      *    filterMatch() for each pkg that matches the filter
86      *    filterFinished()
87      **/
88     void filter();
89
90     /**
91      * Same as filter(), but only if this widget is currently visible.
92      **/
93     void filterIfVisible();
94
95     
96 protected slots:
97
98     /**
99      * Propagate a filter match from the primary filter
100      * and appy any selected secondary filter(s) to it
101      **/
102     void primaryFilterMatch( ZyppSel    selectable,
103                              ZyppPkg    pkg );
104     
105     /**
106      * Propagate a filter near match from the primary filter
107      * and appy any selected secondary filter(s) to it
108      **/
109     void primaryFilterNearMatch( ZyppSel        selectable,
110                                  ZyppPkg        pkg );
111
112
113 protected:
114
115     /**
116      * Widget layout for the secondary filters
117      **/
118     QWidget * layoutSecondaryFilters( QWidget * parent );
119
120     /**
121      * Check if pkg matches the the currently selected secondary filter
122      **/
123     bool secondaryFilterMatch( ZyppSel  selectable,
124                                ZyppPkg          pkg );
125
126
127     // Data members
128
129     YQPkgRepoList *             _repoList;
130     QY2ComboTabWidget *         _secondaryFilters;
131     QWidget *                       _allPackages;
132     YQPkgRpmGroupTagsFilterView *   _rpmGroupTagsFilterView;
133     YQPkgSearchFilterView *         _searchFilterView;
134     YQPkgStatusFilterView *         _statusFilterView;
135 };
136
137
138
139 #endif // ifndef YQPkgRepoFilterView_h