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