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