libyui-qt-pkg
YQPkgVersionsView.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: YQPkgVersionsView.h
35 
36  Author: Stefan Hundhammer <shundhammer.de>
37 
38 /-*/
39 
40 
41 #ifndef YQPkgVersionsView_h
42 #define YQPkgVersionsView_h
43 
44 #include <QScrollArea>
45 #include <QRadioButton>
46 #include <QCheckBox>
47 #include <QButtonGroup>
48 #include <QBoxLayout>
49 #include <QLabel>
50 #include <QList>
51 
52 #include "YQZypp.h"
53 
54 
55 class QTabWidget;
56 class YQPkgMultiVersion;
57 class YQPkgVersion;
58 
59 
65 class YQPkgVersionsView: public QScrollArea
66 {
67  Q_OBJECT
68 
69 public:
70 
74  YQPkgVersionsView( QWidget * parent );
75 
79  virtual ~YQPkgVersionsView();
80 
85  virtual QSize minimumSizeHint() const;
86 
92  static bool isMixedMultiVersion( ZyppSel selectable );
93 
97  bool isMixedMultiVersion() const { return _isMixedMultiVersion; }
98 
107  bool handleMixedMultiVersion( YQPkgMultiVersion * newSelected );
108 
112  ZyppSel selectable() const { return _selectable; }
113 
117  static void setRetractedColor( QWidget * widget );
118 
124  static bool installedIsRetracted( ZyppSel selectable, ZyppObj installed );
125 
126 
127 public slots:
128 
134  void showDetailsIfVisible( ZyppSel selectable );
135 
136  // slot clear() inherited from QListView
137 
138 
142  void reload( int newCurrent );
143 
144 
145 signals:
146 
150  void candidateChanged( ZyppObj newCandidate );
151 
155  void statusChanged();
156 
157 
158 protected slots:
159 
164 
165 
166 protected:
167 
171  void showDetails( ZyppSel selectable );
172 
177  bool mixedMultiVersionPopup( bool multiversion ) const;
178 
183  bool anyMultiVersionToInstall( bool multiversion ) const;
184 
189 
190  // Data members
191 
192  QTabWidget * _parentTab;
193  ZyppSel _selectable;
194  bool _isMixedMultiVersion;
195  QButtonGroup * _buttonGroup;
196  QVBoxLayout * _layout;
197 };
198 
199 
200 class YQPkgVersion: public QRadioButton
201 {
202 public:
203 
208  YQPkgVersion( QWidget * parent,
209  ZyppSel selectable,
210  ZyppObj zyppObj );
211 
215  virtual ~YQPkgVersion();
216 
220  ZyppObj zyppObj() const { return _zyppObj; }
221 
225  ZyppSel selectable() const { return _selectable; }
226 
233  virtual QString toolTip( int column );
234 
235 
236 protected:
237 
238  // Data members
239 
240  ZyppSel _selectable;
241  ZyppObj _zyppObj;
242 };
243 
244 
245 
246 class YQPkgMultiVersion: public QCheckBox
247 {
248  Q_OBJECT
249 
250 public:
251 
256  ZyppSel selectable,
257  ZyppPoolItem zyppPoolItem );
258 
262  virtual ~YQPkgMultiVersion();
263 
267  ZyppPoolItem zyppPoolItem() const { return _zyppPoolItem; }
268 
272  ZyppSel selectable() const { return _selectable; }
273 
277  void paintEvent(QPaintEvent *);
278 
279 signals:
280 
284  void statusChanged();
285 
286 
287 protected slots:
288  void slotIconClicked();
289 
290 
291 protected:
292 
296  void cycleStatus();
297 
298  void setStatus( ZyppStatus newStatus );
299  QPixmap statusIcon( ZyppStatus status );
300 
301  //
302  // Data members
303  //
304 
305  YQPkgVersionsView * _parent;
306  ZyppSel _selectable;
307  ZyppPoolItem _zyppPoolItem;
308 };
309 
310 
311 
312 
313 #endif // ifndef YQPkgVersionsView_h
static void setRetractedColor(QWidget *widget)
Definition: YQPkgVersionsView.cc:269
ZyppPoolItem zyppPoolItem() const
Definition: YQPkgVersionsView.h:267
ZyppObj zyppObj() const
Definition: YQPkgVersionsView.h:220
virtual QString toolTip(int column)
Definition: YQPkgVersionsView.cc:605
bool isMixedMultiVersion() const
Definition: YQPkgVersionsView.h:97
YQPkgMultiVersion(YQPkgVersionsView *parent, ZyppSel selectable, ZyppPoolItem zyppPoolItem)
Definition: YQPkgVersionsView.cc:618
Definition: YQPkgVersionsView.h:200
YQPkgVersion(QWidget *parent, ZyppSel selectable, ZyppObj zyppObj)
Definition: YQPkgVersionsView.cc:550
void showDetailsIfVisible(ZyppSel selectable)
Definition: YQPkgVersionsView.cc:100
virtual ~YQPkgVersion()
Definition: YQPkgVersionsView.cc:598
virtual ~YQPkgMultiVersion()
Definition: YQPkgVersionsView.cc:638
Definition: YQPkgVersionsView.h:246
YQPkgVersionsView(QWidget *parent)
Definition: YQPkgVersionsView.cc:68
Package version selector: Display a list of available versions from all the different installation so...
Definition: YQPkgVersionsView.h:65
virtual QSize minimumSizeHint() const
Definition: YQPkgVersionsView.cc:367
ZyppSel selectable() const
Definition: YQPkgVersionsView.h:112
void paintEvent(QPaintEvent *)
Definition: YQPkgVersionsView.cc:721
void checkForChangedCandidate()
Definition: YQPkgVersionsView.cc:301
bool anyMultiVersionToInstall(bool multiversion) const
Definition: YQPkgVersionsView.cc:455
bool mixedMultiVersionPopup(bool multiversion) const
Definition: YQPkgVersionsView.cc:412
void unselectAllMultiVersion()
Definition: YQPkgVersionsView.cc:489
ZyppSel selectable() const
Definition: YQPkgVersionsView.h:272
void candidateChanged(ZyppObj newCandidate)
virtual ~YQPkgVersionsView()
Definition: YQPkgVersionsView.cc:85
bool handleMixedMultiVersion(YQPkgMultiVersion *newSelected)
Definition: YQPkgVersionsView.cc:374
ZyppSel selectable() const
Definition: YQPkgVersionsView.h:225
void cycleStatus()
Definition: YQPkgVersionsView.cc:654
static bool installedIsRetracted(ZyppSel selectable, ZyppObj installed)
Definition: YQPkgVersionsView.cc:277
void reload(int newCurrent)
Definition: YQPkgVersionsView.cc:92
void showDetails(ZyppSel selectable)
Definition: YQPkgVersionsView.cc:118