libyui-qt-pkg
YQPkgConflictList.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: YQPkgConflictList.h
35 
36  Author: Stefan Hundhammer <shundhammer.de>
37 
38 /-*/
39 
40 
41 #ifndef YQPkgConflictList_h
42 #define YQPkgConflictList_h
43 
44 
45 #include <stdio.h>
46 #include <QMap>
47 #include <QFile>
48 #include <QScrollArea>
49 
50 #include <zypp/Resolver.h>
51 #include <zypp/ResolverProblem.h>
52 #include <zypp/ProblemSolution.h>
53 
54 class QVBoxLayout;
55 class QRadioButton;
56 class QAction;
57 class YQPkgConflict;
58 class YQPkgConflictResolution;
60 
61 
66 class YQPkgConflictList : public QScrollArea
67 {
68  Q_OBJECT
69 
70 public:
74  YQPkgConflictList( QWidget * parent );
75 
79  virtual ~YQPkgConflictList();
80 
84  void fill( zypp::ResolverProblemList problemList );
85 
89  bool isEmpty() const { return count() == 0; }
90 
94  int count() const { return _conflicts.count(); }
95 
96 
97 public slots:
98 
102  void applyResolutions();
103 
107  void askSaveToFile() const;
108 
109  void clear();
110 
111  void relayout();
112 
113 public:
114 
123  void saveToFile( const QString filename, bool interactive ) const;
124 
125 protected:
126 
127  QList<YQPkgConflict*> _conflicts;
128  QVBoxLayout *_layout;
129 
130 signals:
131 
135  void updatePackages();
136 
137 };
138 
139 
140 
144 class YQPkgConflict: public QFrame
145 {
146  Q_OBJECT
147 
148 public:
149 
153  YQPkgConflict( QWidget * parent,
154  zypp::ResolverProblem_Ptr problem );
155 
159  virtual ~YQPkgConflict() {}
160 
164  zypp::ResolverProblem_Ptr problem() const { return _problem; }
165 
170  zypp::ProblemSolution_Ptr userSelectedResolution();
171 
175  void saveToFile( QFile &file ) const;
176 
177 
178 protected slots:
179 
180  void detailsExpanded();
181 
182 signals:
183 
184  void expanded();
185 
186 protected:
187 
191  void formatHeading();
192 
196  void addSolutions();
197 
198  //
199  // Data members
200  //
201 
202  zypp::ResolverProblem_Ptr _problem;
203  QLabel * _resolutionsHeader;
204  QList<zypp::ProblemSolution_Ptr> _resolutions;
205  QMap<QRadioButton *, zypp::ProblemSolution_Ptr> _solutions;
206  QMap<QLabel *, zypp::ProblemSolution_Ptr> _details;
207  QVBoxLayout * _layout;
208 };
209 
210 #endif // ifndef YQPkgConflictList_h
void saveToFile(const QString filename, bool interactive) const
Definition: YQPkgConflictList.cc:190
YQPkgConflictList(QWidget *parent)
Definition: YQPkgConflictList.cc:86
void applyResolutions()
Definition: YQPkgConflictList.cc:160
bool isEmpty() const
Definition: YQPkgConflictList.h:89
Display package dependency conflicts in a tree list and let the user choose how to resolve each confl...
Definition: YQPkgConflictList.h:66
zypp::ResolverProblem_Ptr problem() const
Definition: YQPkgConflictList.h:164
virtual ~YQPkgConflict()
Definition: YQPkgConflictList.h:159
void askSaveToFile() const
Definition: YQPkgConflictList.cc:179
int count() const
Definition: YQPkgConflictList.h:94
zypp::ProblemSolution_Ptr userSelectedResolution()
Definition: YQPkgConflictList.cc:369
void saveToFile(QFile &file) const
Definition: YQPkgConflictList.cc:390
void formatHeading()
Definition: YQPkgConflictList.cc:269
virtual ~YQPkgConflictList()
Definition: YQPkgConflictList.cc:98
void fill(zypp::ResolverProblemList problemList)
Definition: YQPkgConflictList.cc:120
YQPkgConflict(QWidget *parent, zypp::ResolverProblem_Ptr problem)
Definition: YQPkgConflictList.cc:246
Root item for each individual conflict.
Definition: YQPkgConflictList.h:144
Dialog that takes care of dependency checking and resolving conflicts.
Definition: YQPkgConflictDialog.h:59
void addSolutions()
Definition: YQPkgConflictList.cc:293