]> icculus.org git repositories - duncan/yast2-qt4.git/blob - src/pkg/YQPackageSelector.h
- ported listview and friends. Still does not build
[duncan/yast2-qt4.git] / src / pkg / YQPackageSelector.h
1 /*---------------------------------------------------------------------\
2 |                                                                      |
3 |                      __   __    ____ _____ ____                      |
4 |                      \ \ / /_ _/ ___|_   _|___ \                     |
5 |                       \ V / _` \___ \ | |   __) |                    |
6 |                        | | (_| |___) || |  / __/                     |
7 |                        |_|\__,_|____/ |_| |_____|                    |
8 |                                                                      |
9 |                               core system                            |
10 |                                                        (C) SuSE GmbH |
11 \----------------------------------------------------------------------/
12
13   File:       YQPackageSelector.h
14
15   Author:     Stefan Hundhammer <sh@suse.de>
16
17 /-*/
18
19
20 #ifndef YQPackageSelector_h
21 #define YQPackageSelector_h
22
23 #include <q3vbox.h>
24 #include <qcolor.h>
25 //Added by qt3to4:
26 #include <qlabel.h>
27 #include <q3popupmenu.h>
28 #include <ycp/YCPString.h>
29
30 #include "YQPackageSelectorBase.h"
31 #include "YQPkgObjList.h"
32
33 class QCheckBox;
34 class QComboBox;
35 class QLabel;
36 class Q3ListView;
37 class Q3ProgressBar;
38 class QPushButton;
39 class QSplitter;
40 class QTabWidget;
41 class Q3PopupMenu;
42 class QMenuBar;
43
44 class QY2ComboTabWidget;
45
46 class YQPkgChangeLogView;
47 class YQPkgDependenciesView;
48 class YQPkgDescriptionView;
49 class YQPkgDiskUsageList;
50 class YQPkgFileListView;
51 class YQPkgRepoFilterView;
52 class YQPkgLangList;
53 class YQPkgList;
54 class YQPkgPatternList;
55 class YQPkgRpmGroupTagsFilterView;
56 class YQPkgSearchFilterView;
57 class YQPkgSelList;
58 class YQPkgStatusFilterView;
59 class YQPkgTechnicalDetailsView;
60 class YQPkgUpdateProblemFilterView;
61 class YQPkgVersionsView;
62 class YQPkgPatchFilterView;
63 class YQPkgPatchList;
64
65 class YQPackageSelector : public YQPackageSelectorBase
66 {
67     Q_OBJECT
68
69 public:
70
71     YQPackageSelector( YWidget * parent, long modeFlags = 0 );
72
73     
74 public slots:
75
76     /**
77      * Resolve package dependencies manually.
78      *
79      * Returns QDialog::Accepted or QDialog::Rejected.
80      **/
81      int manualResolvePackageDependencies();
82
83     /**
84      * Automatically resolve package dependencies if desired
85      * (if the "auto check" checkbox is on).
86      **/
87     void autoResolveDependencies();
88
89     /**
90      * Export all current selection/package states
91      **/
92     void pkgExport();
93
94     /**
95      * Import selection/package states
96      **/
97     void pkgImport();
98
99     /**
100      * Install any -devel package for packages that are installed or marked for
101      * installation
102      **/
103     void installDevelPkgs();
104
105     /**
106      * Install any -debuginfo package for packages that are installed or marked
107      * for installation
108      **/
109     void installDebugInfoPkgs();
110
111     /**
112      * Install any subpackage that ends with 'suffix' for packages that are
113      * installed or marked for installation
114      **/
115     void installSubPkgs( const QString suffix );
116
117     /**
118      * Enable or disable the package exclude rules (show or suppress -debuginfo
119      * or -devel packages) according to the current menu settings and apply the
120      * exclude rules.
121      **/
122     void pkgExcludeRulesChanged( int menuItemID );
123
124     /**
125      * Display (generic) online help.
126      **/
127     void help();
128
129     /**
130      * Display online help about symbols (package status icons).
131      **/
132     void symbolHelp();
133
134     /**
135      * Display online help about magic keys.
136      **/
137     void keyboardHelp();
138
139
140 signals:
141
142     /**
143      * Emitted once (!) when the dialog is about to be shown, when all widgets
144      * are created and all signal/slot connections are set up - when it makes
145      * sense to load data.
146      **/
147     void loadData();
148
149     /**
150      * Emitted when the internal data base might have changed and a refresh of
151      * all displayed data might be necessary - e.g., when saved (exported) pkg
152      * states are reimported.
153      **/
154     void refresh();
155
156
157 protected slots:
158
159     /**
160      * Animate the "Check" button when dependency resolving is in progress,
161      * i.e. change its background color
162      **/
163     void animateCheckButton();
164
165     /**
166      * Restore the normal background color of the "Check" button.
167      **/
168     void restoreCheckButton();
169
170     /**
171      * Add the "Patches" filter view, if it is not already there.
172      **/
173     void addPatchFilterView();
174
175     /**
176      * Add the "Patches" filter view upon hotkey (F2).
177      **/
178     void hotkeyInsertPatchFilterView();
179
180     /**
181      * Set the status of all installed packages (all in the pool, not only
182      * those currently displayed in the package list) to "update", if there is
183      * a candidate package that is newer than the installed package.
184      **/
185     void globalUpdatePkg() { globalUpdatePkg( false ); }
186
187     /**
188      * Set the status of all installed packages (all in the pool, not only
189      * those currently displayed in the package list) to "update", even if the
190      * candidate package is not newer than the installed package.
191      **/
192     void globalUpdatePkgForce() { globalUpdatePkg( true ); }
193
194     /**
195      * Show all products in a popup dialog.
196      **/
197     void showProducts();
198
199
200
201 protected:
202
203     // Layout methods - create and layout widgets
204
205     void basicLayout();
206
207     QWidget *   layoutLeftPane          ( QWidget * parent );
208     QWidget *   layoutRightPane         ( QWidget * parent );
209     void        layoutFilters           ( QWidget * parent );
210     void        layoutPkgList           ( QWidget * parent );
211     void        layoutDetailsViews      ( QWidget * parent );
212     void        layoutButtons           ( QWidget * parent );
213     void        layoutMenuBar           ( QWidget * parent );
214
215     /**
216      * Establish Qt signal / slot connections.
217      *
218      * This really needs to be a separate method to make sure all affected
219      * wigets are created at this point.
220      **/
221     void makeConnections();
222
223     /**
224      * Add pulldown menus to the menu bar.
225      *
226      * This really needs to be a separate method to make sure all affected
227      * wigets are created at this point.
228      **/
229     void addMenus();
230
231     /**
232      * Connect a filter view that provides the usual signals with a package
233      * list. By convention, filter views provide the following signals:
234      *    filterStart()
235      *    filterMatch()
236      *    filterFinished()
237      *    updatePackages()  (optional)
238      **/
239     void connectFilter( QWidget *       filter,
240                         QWidget *       pkgList,
241                         bool            hasUpdateSignal = true );
242
243     /**
244      * Connect the patch list. Caution: Possible bootstrap problem!
245      **/
246     void connectPatchList();
247
248     /**
249      * Set the status of all installed packages (all in the pool, not only
250      * those currently displayed in the package list) to "update" and switch to
251      * the "Installation Summary" view afterwards.
252      *
253      * 'force' indicates if this should also be done if the the candidate
254      * package is not newer than the installed package.
255      **/
256     void globalUpdatePkg( bool force );
257
258     /**
259      * Import one selectable: Set its status according to 'isWanted'
260      * based on its old status.
261      * 'kind' is 'package' or 'pattern' (used only for debug logging).
262      **/
263     void importSelectable( ZyppSel      selectable,
264                            bool         isWanted,
265                            const char * kind );
266
267
268
269     /**
270      * Return HTML code describing a symbol (an icon).
271      **/
272     QString symHelp( const QString & imgFileName,
273                      const QString & summary,
274                      const QString & explanation        );
275
276
277     /**
278      * Return HTML code describing a key.
279      **/
280     QString keyHelp( const QString & key,
281                      const QString & summary,
282                      const QString & explanation        );
283
284     /**
285      * Basic HTML formatting: Embed text into <p> ... </p>
286      **/
287     static QString para( const QString & text );
288
289     /**
290      * Basic HTML formatting: Embed text into <li> ... </li>
291      **/
292     static QString listItem( const QString & text );
293
294
295     // Data members
296
297     QCheckBox *                         _autoDependenciesCheckBox;
298     QPushButton *                       _checkDependenciesButton;
299     QTabWidget *                        _detailsViews;
300     QY2ComboTabWidget *                 _filters;
301     YQPkgChangeLogView *                _pkgChangeLogView;
302     YQPkgDependenciesView *             _pkgDependenciesView;
303     YQPkgDescriptionView *              _pkgDescriptionView;
304     YQPkgFileListView *                 _pkgFileListView;
305     YQPkgRepoFilterView *               _repoFilterView;
306     YQPkgLangList *                     _langList;
307     YQPkgList *                         _pkgList;
308     YQPkgPatternList *                  _patternList;
309     YQPkgRpmGroupTagsFilterView *       _rpmGroupTagsFilterView;
310     YQPkgSearchFilterView *             _searchFilterView;
311     YQPkgSelList *                      _selList;
312     YQPkgStatusFilterView *             _statusFilterView;
313     YQPkgTechnicalDetailsView *         _pkgTechnicalDetailsView;
314     YQPkgUpdateProblemFilterView *      _updateProblemFilterView;
315     YQPkgVersionsView *                 _pkgVersionsView;
316     YQPkgPatchFilterView *              _patchFilterView;
317     YQPkgPatchList *                    _patchList;
318
319     QMenuBar *                          _menuBar;
320     Q3PopupMenu *                       _fileMenu;
321     Q3PopupMenu *                       _viewMenu;
322     Q3PopupMenu *                       _pkgMenu;
323     Q3PopupMenu *                       _patchMenu;
324     Q3PopupMenu *                       _extrasMenu;
325     Q3PopupMenu *                       _helpMenu;
326
327     int                                 _viewShowDevelID;
328     int                                 _viewShowDebugInfoID;
329
330     YQPkgObjList::ExcludeRule *         _excludeDevelPkgs;
331     YQPkgObjList::ExcludeRule *         _excludeDebugInfoPkgs;
332
333     QColor                              _normalButtonBackground;
334 };
335
336
337
338 #endif // YQPackageSelector_h