]> icculus.org git repositories - duncan/yast2-qt4.git/blob - src/pkg/YQPkgLangList.h
don't create QObjects in ycp thread - make timeouts work
[duncan/yast2-qt4.git] / src / pkg / YQPkgLangList.h
1 /*---------------------------------------------------------------------\
2 |                                                                      |
3 |                      __   __    ____ _____ ____                      |
4 |                      \ \ / /_ _/ ___|_   _|___ \                     |
5 |                       \ V / _` \___ \ | |   __) |                    |
6 |                        | | (_| |___) || |  / __/                     |
7 |                        |_|\__,_|____/ |_| |_____|                    |
8 |                                                                      |
9 |                               core system                            |
10 |                                                        (C) SuSE GmbH |
11 \----------------------------------------------------------------------/
12
13   File:       YQPkgLangList.h
14
15   Author:     Stefan Hundhammer <sh@suse.de>
16
17 /-*/
18
19
20 #ifndef YQPkgLangList_h
21 #define YQPkgLangList_h
22
23 #include <YQPkgObjList.h>
24
25
26 class YQPkgLangListItem;
27
28
29 /**
30  * @short Display a list of zypp::Selection objects.
31  **/
32 class YQPkgLangList : public YQPkgObjList
33 {
34     Q_OBJECT
35
36 public:
37
38     /**
39      * Constructor
40      **/
41     YQPkgLangList( QWidget * parent );
42
43     /**
44      * Destructor
45      **/
46     virtual ~YQPkgLangList();
47
48
49 public slots:
50
51     /**
52      * Filter according to the view's rules and current selection.
53      * Emits those signals:
54      *    filterStart()
55      *    filterMatch() for each pkg that matches the filter
56      *    filterFinished()
57      **/
58     void filter();
59
60     /**
61      * Same as filter(), but only if this widget is currently visible.
62      **/
63     void filterIfVisible();
64
65
66     /**
67      * Add a selection to the list. Connect a filter's filterMatch() signal to
68      * this slot. Remember to connect filterStart() to clear() (inherited from
69      * QListView).
70      **/
71     void addLangItem( ZyppSel           selectable,
72                       ZyppLang  lang );
73
74     
75 public:
76
77     /**
78      * Returns the currently selected item or 0 if there is none.
79      **/
80     YQPkgLangListItem * selection() const;
81
82
83 signals:
84
85     /**
86      * Emitted when the filtering starts. Use this to clear package lists
87      * etc. prior to adding new entries.
88      **/
89     void filterStart();
90
91     /**
92      * Emitted during filtering for each pkg that matches the filter.
93      **/
94     void filterMatch( ZyppSel   selectable,
95                       ZyppPkg   pkg );
96
97     /**
98      * Emitted when filtering is finished.
99      **/
100     void filterFinished();
101
102
103 protected slots:
104
105     /**
106      * Fill the language list.
107      **/
108     void fillList();
109 };
110
111
112
113 class YQPkgLangListItem: public YQPkgObjListItem
114 {
115 public:
116
117     /**
118      * Constructor. Creates a YQPkgLangList item that corresponds to the package
119      * manager object that 'pkg' refers to.
120      **/
121     YQPkgLangListItem( YQPkgLangList *  pkgSelList,
122                        ZyppSel          selectable,
123                        ZyppLang         lang            );
124
125     /**
126      * Destructor
127      **/
128     virtual ~YQPkgLangListItem();
129
130     /**
131      * Returns the original object within the package manager backend.
132      **/
133     ZyppLang zyppLang() const   { return _zyppLang; }
134
135
136     // Columns
137
138     int statusCol()     const   { return _langList->statusCol(); }
139
140
141 protected:
142
143     /**
144      * Propagate status changes in this list to other lists:
145      * Have the solver transact all languages.
146      *
147      * Reimplemented from YQPkgObjListItem.
148      **/
149     virtual void applyChanges();
150
151
152     // Data members
153
154     YQPkgLangList *     _langList;
155     ZyppLang            _zyppLang;
156 };
157
158
159 #endif // ifndef YQPkgLangList_h