1 /*---------------------------------------------------------------------\
3 | __ __ ____ _____ ____ |
4 | \ \ / /_ _/ ___|_ _|___ \ |
5 | \ V / _` \___ \ | | __) | |
6 | | | (_| |___) || | / __/ |
7 | |_|\__,_|____/ |_| |_____| |
11 \----------------------------------------------------------------------/
13 File: YQPkgRpmGroupTagsFilterView.h
15 Author: Stefan Hundhammer <sh@suse.de>
20 #ifndef YQPkgRpmGroupTagsFilterView_h
21 #define YQPkgRpmGroupTagsFilterView_h
24 #include <q3listview.h>
25 #include <YRpmGroupsTree.h>
30 class YQPkgRpmGroupTag;
34 * @short RPM group tags filter view: Display the RPM group tags tree and emit
35 * signals if any group tag is selected so a package list can be filled or
38 class YQPkgRpmGroupTagsFilterView : public Q3ListView
47 YQPkgRpmGroupTagsFilterView( QWidget * parent );
52 virtual ~YQPkgRpmGroupTagsFilterView();
55 * Returns the currently selected item or 0 if there is none.
57 YQPkgRpmGroupTag * selection() const;
60 * Check if 'pkg' matches the selected RPM group.
61 * Returns true if there is a match, false otherwise.
63 bool check( ZyppSel selectable,
67 * Returns the (untranslated!) currently selected RPM group as string.
68 * Special case: "*" is returned if "zzz_All" is selected.
70 const string & selectedRpmGroup() const { return _selectedRpmGroup; }
76 * Filter according to the view's rules and current selection.
77 * Emits those signals:
79 * filterMatch() for each pkg that matches the filter
85 * Same as filter(), but only if this widget is currently visible.
87 void filterIfVisible();
90 * Select a list entry (if there is any).
91 * Usually this will be the first list entry, but don't rely on that - this
92 * might change without notice. Emits signal selectionChanged().
94 void selectSomething();
97 * Returns the internal RPM groups tree and fills it
98 * if it doesn't exist yet.
100 static YRpmGroupsTree * rpmGroupsTree();
106 * Emitted when the filtering starts. Use this to clear package lists
107 * etc. prior to adding new entries.
112 * Emitted during filtering for each pkg that matches the filter.
114 void filterMatch( ZyppSel selectable,
118 * Emitted when filtering is finished.
120 void filterFinished();
126 * Update _selectedRpmGroup and filter data
128 void slotSelectionChanged( Q3ListViewItem * newSelection );
134 * Fill the internal RPM groups tree with RPM groups of all packages
135 * currently in the pool
137 static void fillRpmGroupsTree();
140 * Recursively clone the RPM group tag tree for the QListView widget:
141 * Make a deep copy of the tree starting at 'parentRpmGroup' and
144 void cloneTree( YStringTreeItem * parentRpmGroup,
145 YQPkgRpmGroupTag * parentClone = 0 );
151 string _selectedRpmGroup;
153 static YRpmGroupsTree * _rpmGroupsTree;
158 class YQPkgRpmGroupTag: public Q3ListViewItem
163 * Constructor for toplevel RPM group tags
165 YQPkgRpmGroupTag( YQPkgRpmGroupTagsFilterView * parentFilterView,
166 YStringTreeItem * rpmGroup );
169 * Constructor for RPM group tags that have a parent
171 YQPkgRpmGroupTag( YQPkgRpmGroupTagsFilterView * parentFilterView,
172 YQPkgRpmGroupTag * parentGroupTag,
173 YStringTreeItem * rpmGroup );
176 * Constructor for toplevel RPM group tags via STL string
177 * ( for special cases like "zzz All" )
179 YQPkgRpmGroupTag( YQPkgRpmGroupTagsFilterView * parentFilterView,
180 const QString & rpmGroupName,
181 YStringTreeItem * rpmGroup );
186 virtual ~YQPkgRpmGroupTag();
190 * Returns the parent filter view
192 YQPkgRpmGroupTagsFilterView * filterView() const { return _filterView; }
195 * Returns the original tree item
197 const YStringTreeItem * rpmGroup() const { return _rpmGroup; }
204 YQPkgRpmGroupTagsFilterView * _filterView;
205 YStringTreeItem * _rpmGroup;
209 #endif // ifndef YQPkgRpmGroupTagsFilterView_h