1 /*---------------------------------------------------------------------\
3 | __ __ ____ _____ ____ |
4 | \ \ / /_ _/ ___|_ _|___ \ |
5 | \ V / _` \___ \ | | __) | |
6 | | | (_| |___) || | / __/ |
7 | |_|\__,_|____/ |_| |_____| |
11 \----------------------------------------------------------------------/
13 File: YQPkgGenericDetailsView.h
15 Author: Stefan Hundhammer <sh@suse.de>
20 #ifndef YQPkgGenericDetailsView_h
21 #define YQPkgGenericDetailsView_h
23 #include <q3textbrowser.h>
25 #include <zypp/Date.h>
33 * @short Abstract base class for details views. Handles generic stuff like
34 * HTML formatting, Qt slots and display only if this view is visible at all
35 * ( it may be hidden if it's part of a QTabWidget ).
37 class YQPkgGenericDetailsView : public Q3TextBrowser
46 YQPkgGenericDetailsView( QWidget * parent );
51 virtual ~YQPkgGenericDetailsView();
57 * Returns the minimum size required for this widget.
58 * Inherited from QWidget.
60 virtual QSize minimumSizeHint() const;
63 * Returns a uniform heading in HTML format for the specified selectable:
65 * or name, version and summary, if 'showVersion' is 'true'
67 static QString htmlHeading( ZyppSel selectable, bool showVersion = false );
70 * Escapes characters special to HTML in a ( plain text ) string, such as:
75 * Returns the escaped string.
77 static QString htmlEscape( const QString & plainText );
80 * Returns a string containing a HTML table with 'contents'.
82 static QString table( const QString & contents );
85 * Returns a string containing a HTML table row with 'contents'.
87 static QString row( const QString & contents );
90 * Returns a string containing a HTML table cell with 'contents'.
92 static QString cell( QString contents );
93 static QString cell( int contents );
94 static QString cell( const string & contents );
95 static QString cell( const zypp::Date & date );
98 * Returns a string containing a HTML table cell with 'contents'
101 static QString hcell( QString contents );
107 * Show details for the specified package.
108 * Delayed ( optimized ) display if this is embedded into a QTabWidget
109 * parent: In this case, wait until this page becomes visible.
111 void showDetailsIfVisible( ZyppSel selectable );
113 // slot clear() inherited from QTextEdit
116 * Show details for the specified package.
117 * Reimplement this in derived classes.
119 virtual void showDetails( ZyppSel selectable ) = 0;
125 * Show data for the last package.
127 void reload( QWidget * newCurrent );
128 virtual void reload() { Q3TextBrowser::reload(); }
135 QTabWidget * _parentTab;
140 #endif // ifndef YQPkgGenericDetailsView_h