restart qt4 porting
[duncan/yast2-qt4.git] / src / pkg / YQPkgConflictDialog.h
1 /*---------------------------------------------------------------------\
2 |                                                                      |
3 |                      __   __    ____ _____ ____                      |
4 |                      \ \ / /_ _/ ___|_   _|___ \                     |
5 |                       \ V / _` \___ \ | |   __) |                    |
6 |                        | | (_| |___) || |  / __/                     |
7 |                        |_|\__,_|____/ |_| |_____|                    |
8 |                                                                      |
9 |                               core system                            |
10 |                                                        (C) SuSE GmbH |
11 \----------------------------------------------------------------------/
12
13   File:       YQPkgConflictDialog.h
14
15   Author:     Stefan Hundhammer <sh@suse.de>
16
17 /-*/
18
19
20 #ifndef YQPkgConflictDialog_h
21 #define YQPkgConflictDialog_h
22
23 #include <qdialog.h>
24
25 class YQPkgConflictList;
26 class PMManager;
27 class QPushButton;
28 class QPopupMenu;
29 class QLabel;
30
31
32 /**
33  * @short Dialog that takes care of dependency checking and resolving
34  * conflicts.
35  **/
36 class YQPkgConflictDialog: public QDialog
37 {
38     Q_OBJECT
39
40 public:
41
42     /**
43      * Constructor. Does not pop up a dialog yet.
44      * Use solveAndShowConflicts().
45      **/
46     YQPkgConflictDialog( QWidget * parent );
47
48     /**
49      * Destructor.
50      **/
51     virtual ~YQPkgConflictDialog();
52
53     /**
54      * Reimplemented from QWidget:
55      * Reserve a reasonable amount of space.
56      **/
57     virtual QSize sizeHint() const;
58
59     /**
60      * Returns the average time in seconds used for solving or 0 if solving
61      * hasn't taken place yet.
62      **/
63     double averageSolveTime() const;
64
65     /**
66      * Returns the total amount of time in seconds used for solving.
67      **/
68     double totalSolveTime() const { return _totalSolveTime; }
69
70     /**
71      * Returns the times solving has taken place (with this dialog).
72      **/
73     int solveCount() const { return _solveCount; }
74
75     /**
76      * Reset all previously ignored dependency problems.
77      **/
78     static void resetIgnoredDependencyProblems();
79
80
81 public slots:
82
83     /**
84      * Run the package dependency solver for the current package set and open
85      * the conflict dialog if there are any conflicts.
86      * Returns only when the conflict dialog is closed.
87      *
88      * Returns QDialog::Accepted or QDialog::Rejected.
89      **/
90     int solveAndShowConflicts();
91
92     /**
93      * Run the package dependency solver for the currently installed system
94      * plus the packages that are marked for installation (or update or...) and
95      * open the conflict dialog if there are any conflicts.
96      * Returns only when the conflict dialog is closed.
97      *
98      * Returns QDialog::Accepted or QDialog::Rejected.
99      **/
100     int verifySystem();
101
102     /**
103      * Mini-wizard to generate solver test case:
104      *
105      *   - Inform user what this is all about
106      *   - Tell user where the files will go
107      *   - Generate test case
108      *   - Ask user if he would like to pack it all into y2logs.tgz
109      *   - Prompt user for path for y2logs.tgz
110      *   - Save y2logs.tgz
111      **/
112     void askCreateSolverTestCase();
113
114     
115 signals:
116
117     /**
118      * Update package states - they may have changed.
119      **/
120     void updatePackages();
121
122
123 protected:
124
125     /**
126      * Initialize solving: Post "busy" popup etc.
127      **/ 
128     void prepareSolving();
129
130     /**
131      * Process the result of solving: Post conflict dialog, if neccessary.
132      * 'success' is the return value of the preceding solver call.
133      * Returns either QDialog::Accepted or QDialog::Rejected.
134      **/
135     int  processSolverResult( bool success );
136     
137     /**
138      * Event handler for keyboard input.
139      * Only very special keys are processed here.
140      *
141      * Inherited from QWidget.
142      **/
143     void keyPressEvent( QKeyEvent * e );
144
145
146
147     //
148     // Data members
149     //
150
151     YQPkgConflictList * _conflictList;
152     QPopupMenu *        _expertMenu;
153     QLabel *            _busyPopup;
154
155     double              _totalSolveTime;
156     int                 _solveCount;
157 };
158
159
160
161 #endif // ifndef YQPkgConflictDialog_h