libyui-qt-pkg
 
Loading...
Searching...
No Matches
YQPkgPatternList.h
1/*
2 Copyright (c) 2000 - 2010 Novell, Inc.
3 Copyright (c) 2021 SUSE LLC
4
5 This library is free software; you can redistribute it and/or modify
6 it under the terms of the GNU Lesser General Public License as
7 published by the Free Software Foundation; either version 2.1 of the
8 License, or (at your option) version 3.0 of the License. This library
9 is distributed in the hope that it will be useful, but WITHOUT ANY
10 WARRANTY; without even the implied warranty of MERCHANTABILITY or
11 FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
12 License for more details. You should have received a copy of the GNU
13 Lesser General Public License along with this library; if not, write
14 to the Free Software Foundation, Inc., 51 Franklin Street, Fifth
15 Floor, Boston, MA 02110-1301 USA
16*/
17
18
19/*
20 File: YQPkgPatternList.h
21 Author: Stefan Hundhammer <shundhammer.de>
22*/
23
24
25#ifndef YQPkgPatternList_h
26#define YQPkgPatternList_h
27
28#include "YQPkgObjList.h"
29#include <QMap>
30
31
34
35
40{
41 Q_OBJECT
42
43public:
44
55 YQPkgPatternList( QWidget * parent, bool autoFill = true, bool autoFilter = true );
56
60 virtual ~YQPkgPatternList();
61
65 int orderCol() const { return _orderCol; }
66
71 bool showOrderCol() const { return _orderCol >= 0; }
72
77 bool showInvisiblePatterns() const { return _showInvisiblePatterns; }
78
79
80public slots:
81
89 void filter();
90
94 void filterIfVisible();
95
96
102 void addPatternItem( ZyppSel selectable,
103 ZyppPattern pattern );
104
108 void fillList();
109
116 virtual void pkgObjClicked( int button,
117 QTreeWidgetItem * item,
118 int col,
119 const QPoint & pos );
120
126 virtual void selectSomething();
127
128
129public:
130
135
136
137signals:
138
144
148 void filterMatch( ZyppSel selectable,
149 ZyppPkg pkg );
150
155
156protected:
157
163 YQPkgPatternCategoryItem * category( const QString & categoryName );
164
165
166 //
167 // Data members
168 //
169
170 QMap<QString, YQPkgPatternCategoryItem*> _categories;
171
172 int _orderCol;
173 bool _showInvisiblePatterns;
174};
175
176
177
179{
180public:
181
186 ZyppSel selectable,
187 ZyppPattern zyppPattern );
188
193 YQPkgPatternCategoryItem * parentCategory,
194 ZyppSel selectable,
195 ZyppPattern zyppPattern );
196
200 virtual ~YQPkgPatternListItem();
201
205 ZyppPattern zyppPattern() const { return _zyppPattern; }
206
211 virtual void cycleStatus();
212
216 virtual bool operator< ( const QTreeWidgetItem & other ) const;
217
218 // Columns
219
220 int statusCol() const { return _patternList->statusCol(); }
221 int summaryCol() const { return _patternList->summaryCol(); }
222 int orderCol() const { return _patternList->orderCol(); }
223
224 int totalPackages() const { return _total; }
225 int installedPackages() const { return _installed; }
226
227 // setters for installed and total packages values
228 void setTotalPackages(int v) { _total = v; }
229 void setInstalledPackages(int v) { _installed = v; }
230
234 void resetToolTip();
235
236protected:
237
241 void init();
242
249 virtual void applyChanges();
250
251
252 // Data members
253
254 YQPkgPatternList * _patternList;
255 ZyppPattern _zyppPattern;
256
257
258 // Cached values
259
260 int _total;
261 int _installed;
262};
263
264
265
266class YQPkgPatternCategoryItem: public QY2ListViewItem
267{
268public:
269
274 const QString & category );
275
280
284 ZyppPattern firstPattern() const { return _firstPattern; }
285
289 void addPattern( ZyppPattern pattern );
290
294 virtual bool operator< ( const QTreeWidgetItem & other ) const;
295
296 /*
297 * Open or close this subtree
298 *
299 * Reimplemented from QListViewItem to force categories open at all times
300 **/
301 virtual void setExpanded( bool open );
302
303
304protected:
305
315 void setTreeIcon( void );
316 //
317 // Data members
318 //
319
320 YQPkgPatternList * _patternList;
321 ZyppPattern _firstPattern;
322};
323
324
325#endif // ifndef YQPkgPatternList_h
ZyppSel selectable() const
Definition YQPkgObjList.h:452
YQPkgObjListItem(YQPkgObjList *pkgObjList, ZyppSel selectable, ZyppObj zyppObj=0)
Definition YQPkgObjList.cc:873
YQPkgObjList(QWidget *parent)
Definition YQPkgObjList.cc:59
Definition YQPkgPatternList.h:267
YQPkgPatternCategoryItem(YQPkgPatternList *patternList, const QString &category)
Definition YQPkgPatternList.cc:507
void addPattern(ZyppPattern pattern)
Definition YQPkgPatternList.cc:533
virtual ~YQPkgPatternCategoryItem()
Definition YQPkgPatternList.cc:526
ZyppPattern firstPattern() const
Definition YQPkgPatternList.h:284
virtual bool operator<(const QTreeWidgetItem &other) const
Definition YQPkgPatternList.cc:576
void setTreeIcon(void)
Definition YQPkgPatternList.cc:566
Definition YQPkgPatternList.h:179
virtual bool operator<(const QTreeWidgetItem &other) const
Definition YQPkgPatternList.cc:480
virtual void applyChanges()
Definition YQPkgPatternList.cc:474
virtual void cycleStatus()
Definition YQPkgPatternList.cc:408
void resetToolTip()
Definition YQPkgPatternList.cc:459
ZyppPattern zyppPattern() const
Definition YQPkgPatternList.h:205
YQPkgPatternListItem(YQPkgPatternList *patternList, ZyppSel selectable, ZyppPattern zyppPattern)
Definition YQPkgPatternList.cc:339
void init()
Definition YQPkgPatternList.cc:366
virtual ~YQPkgPatternListItem()
Definition YQPkgPatternList.cc:401
Display a list of zypp::Pattern objects.
Definition YQPkgPatternList.h:40
void filterMatch(ZyppSel selectable, ZyppPkg pkg)
void filter()
Definition YQPkgPatternList.cc:202
void fillList()
Definition YQPkgPatternList.cc:136
virtual ~YQPkgPatternList()
Definition YQPkgPatternList.cc:129
virtual void pkgObjClicked(int button, QTreeWidgetItem *item, int col, const QPoint &pos)
Definition YQPkgPatternList.cc:289
virtual void selectSomething()
Definition YQPkgPatternList.cc:316
void filterIfVisible()
Definition YQPkgPatternList.cc:194
bool showInvisiblePatterns() const
Definition YQPkgPatternList.h:77
YQPkgPatternList(QWidget *parent, bool autoFill=true, bool autoFilter=true)
Definition YQPkgPatternList.cc:54
bool showOrderCol() const
Definition YQPkgPatternList.h:71
void addPatternItem(ZyppSel selectable, ZyppPattern pattern)
Definition YQPkgPatternList.cc:244
int orderCol() const
Definition YQPkgPatternList.h:65
YQPkgPatternCategoryItem * category(const QString &categoryName)
Definition YQPkgPatternList.cc:172
YQPkgPatternListItem * selection() const
Definition YQPkgPatternList.cc:277