libyui-qt-pkg
YQPkgGenericDetailsView.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: YQPkgGenericDetailsView.h
35 
36  Author: Stefan Hundhammer <shundhammer.de>
37 
38 /-*/
39 
40 
41 #ifndef YQPkgGenericDetailsView_h
42 #define YQPkgGenericDetailsView_h
43 
44 #include <QTextBrowser>
45 #include <zypp/Date.h>
46 #include "YQZypp.h"
47 
48 
49 class QTabWidget;
50 using std::string;
51 
52 
58 class YQPkgGenericDetailsView : public QTextBrowser
59 {
60  Q_OBJECT
61 
62 protected:
63 
67  YQPkgGenericDetailsView( QWidget * parent );
68 
72  virtual ~YQPkgGenericDetailsView();
73 
74 
75 public:
76 
81  virtual QSize minimumSizeHint() const;
82 
86  static QString htmlStart();
87  static QString htmlEnd();
88 
94  static QString htmlHeading( ZyppSel selectable, bool showVersion = false );
95 
104  static QString htmlEscape( const QString & plainText );
105 
109  static QString table( const QString & contents );
110 
114  static QString row( const QString & contents );
115 
119  static QString cell( QString contents );
120  static QString cell( int contents );
121  static QString cell( const string & contents );
122  static QString cell( const zypp::Date & date );
123 
128  static QString hcell( QString contents );
129 
130 
131 public slots:
132 
138  void showDetailsIfVisible( ZyppSel selectable );
139 
140  // slot clear() inherited from QTextEdit
141 
146  virtual void showDetails( ZyppSel selectable ) = 0;
147 
148 
149 
150 protected slots:
151 
155  void reloadTab( int newCurrent );
156  virtual void reload() { QTextBrowser::reload(); }
157 
158 
159 protected:
160 
161  // Data members
162 
163  QTabWidget * _parentTab;
164  ZyppSel _selectable;
165 };
166 
167 
168 #endif // ifndef YQPkgGenericDetailsView_h
static QString hcell(QString contents)
Definition: YQPkgGenericDetailsView.cc:260
virtual QSize minimumSizeHint() const
Definition: YQPkgGenericDetailsView.cc:140
static QString htmlHeading(ZyppSel selectable, bool showVersion=false)
Definition: YQPkgGenericDetailsView.cc:162
Abstract base class for details views. Handles generic stuff like HTML formatting, Qt slots and display only if this view is visible at all ( it may be hidden if it&#39;s part of a QTabWidget ).
Definition: YQPkgGenericDetailsView.h:58
void reloadTab(int newCurrent)
Definition: YQPkgGenericDetailsView.cc:111
static QString cell(QString contents)
Definition: YQPkgGenericDetailsView.cc:231
virtual void showDetails(ZyppSel selectable)=0
static QString htmlEscape(const QString &plainText)
Definition: YQPkgGenericDetailsView.cc:197
void showDetailsIfVisible(ZyppSel selectable)
Definition: YQPkgGenericDetailsView.cc:121
static QString table(const QString &contents)
Definition: YQPkgGenericDetailsView.cc:211
virtual ~YQPkgGenericDetailsView()
Definition: YQPkgGenericDetailsView.cc:104
static QString row(const QString &contents)
Definition: YQPkgGenericDetailsView.cc:224
static QString htmlStart()
Definition: YQPkgGenericDetailsView.cc:147
YQPkgGenericDetailsView(QWidget *parent)
Definition: YQPkgGenericDetailsView.cc:58