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