libyui-qt-pkg  2.42.5
 All Classes Functions Variables Enumerations
YQPkgConflictDialog.h
1 /**************************************************************************
2 Copyright (C) 2000 - 2010 Novell, Inc.
3 All Rights Reserved.
4 
5 This program is free software; you can redistribute it and/or modify
6 it under the terms of the GNU General Public License as published by
7 the Free Software Foundation; either version 2 of the License, or
8 (at your option) any later version.
9 
10 This program is distributed in the hope that it will be useful,
11 but WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 GNU General Public License for more details.
14 
15 You should have received a copy of the GNU General Public License along
16 with this program; if not, write to the Free Software Foundation, Inc.,
17 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
18 
19 **************************************************************************/
20 
21 
22 /*---------------------------------------------------------------------\
23 | |
24 | __ __ ____ _____ ____ |
25 | \ \ / /_ _/ ___|_ _|___ \ |
26 | \ V / _` \___ \ | | __) | |
27 | | | (_| |___) || | / __/ |
28 | |_|\__,_|____/ |_| |_____| |
29 | |
30 | core system |
31 | (C) SuSE GmbH |
32 \----------------------------------------------------------------------/
33 
34  File: YQPkgConflictDialog.h
35 
36  Author: Stefan Hundhammer <sh@suse.de>
37 
38 /-*/
39 
40 
41 #ifndef YQPkgConflictDialog_h
42 #define YQPkgConflictDialog_h
43 
44 #include <QDialog>
45 #include <QMenu>
46 #include <QLabel>
47 
48 class YQPkgConflictList;
49 class PMManager;
50 class QPushButton;
51 class QMenu;
52 class QLabel;
53 
54 
55 /**
56  * @short Dialog that takes care of dependency checking and resolving
57  * conflicts.
58  **/
59 class YQPkgConflictDialog: public QDialog
60 {
61  Q_OBJECT
62 
63 public:
64 
65  /**
66  * Constructor. Does not pop up a dialog yet.
67  * Use solveAndShowConflicts().
68  **/
69  YQPkgConflictDialog( QWidget * parent );
70 
71  /**
72  * Destructor.
73  **/
74  virtual ~YQPkgConflictDialog();
75 
76  /**
77  * Reimplemented from QWidget:
78  * Reserve a reasonable amount of space.
79  **/
80  virtual QSize sizeHint() const;
81 
82  /**
83  * Returns the average time in seconds used for solving or 0 if solving
84  * hasn't taken place yet.
85  **/
86  double averageSolveTime() const;
87 
88  /**
89  * Returns the total amount of time in seconds used for solving.
90  **/
91  double totalSolveTime() const { return _totalSolveTime; }
92 
93  /**
94  * Returns the times solving has taken place (with this dialog).
95  **/
96  int solveCount() const { return _solveCount; }
97 
98  /**
99  * Reset all previously ignored dependency problems.
100  **/
101  static void resetIgnoredDependencyProblems();
102 
103 
104 public slots:
105 
106  /**
107  * Run the package dependency solver for the current package set and open
108  * the conflict dialog if there are any conflicts.
109  * Returns only when the conflict dialog is closed.
110  *
111  * Returns QDialog::Accepted or QDialog::Rejected.
112  **/
113  int solveAndShowConflicts();
114 
115  /**
116  * Run the package dependency solver for the currently installed system
117  * plus the packages that are marked for installation (or update or...) and
118  * open the conflict dialog if there are any conflicts.
119  * Returns only when the conflict dialog is closed.
120  *
121  * Returns QDialog::Accepted or QDialog::Rejected.
122  **/
123  int verifySystem();
124 
125  /**
126  * Mini-wizard to generate solver test case:
127  *
128  * - Inform user what this is all about
129  * - Tell user where the files will go
130  * - Generate test case
131  * - Ask user if he would like to pack it all into y2logs.tgz
132  * - Prompt user for path for y2logs.tgz
133  * - Save y2logs.tgz
134  **/
136 
137 
138 signals:
139 
140  /**
141  * Update package states - they may have changed.
142  **/
143  void updatePackages();
144 
145 
146 protected:
147 
148  /**
149  * Initialize solving: Post "busy" popup etc.
150  **/
151  void prepareSolving();
152 
153  /**
154  * Process the result of solving: Post conflict dialog, if neccessary.
155  * 'success' is the return value of the preceding solver call.
156  * Returns either QDialog::Accepted or QDialog::Rejected.
157  **/
158  int processSolverResult( bool success );
159 
160  /**
161  * Event handler for keyboard input.
162  * Only very special keys are processed here.
163  *
164  * Inherited from QWidget.
165  **/
166  void keyPressEvent( QKeyEvent * e );
167 
168 
169 
170  //
171  // Data members
172  //
173 
174  YQPkgConflictList * _conflictList;
175  QMenu * _expertMenu;
176  QLabel * _busyPopup;
177 
178  double _totalSolveTime;
179  int _solveCount;
180 };
181 
182 
183 
184 #endif // ifndef YQPkgConflictDialog_h