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