40 #define YUILogComponent "qt-pkg"
46 #include "YQPkgGenericDetailsView.h"
49 #include "QY2Styler.h"
54 : QTextBrowser( parent )
57 _parentTab = dynamic_cast<QTabWidget *> (parent);
61 connect( _parentTab, &QTabWidget::currentChanged,
67 "{text-align: center;"
68 "font-family: Verdana, Geneva, Arial, Helvetica, sans-serif ;"
69 "font-weight: normal;"
74 "border-collapse: collapse;"
75 "border-spacing: 4px;}"
88 "border-bottom: 2px; solid;"
90 "font-weight: bold;} "
93 "font-style: italic;}";
95 document()->addResource( QTextDocument::StyleSheetResource, QUrl(
"format.css" ), css );
108 if ( _parentTab && _parentTab->widget(newCurrent) == this )
118 _selectable = selectable;
122 if ( _parentTab->currentWidget() == this )
137 return QSize( 0, 0 );
144 return "<html><head>"
145 "<link rel='stylesheet' type='text/css' href='format.css'>"
150 YQPkgGenericDetailsView::htmlEnd()
152 return "</body></html>";
162 ZyppObj zyppObj = selectable->theObj();
167 QString summary = fromUTF8( zyppObj->summary() );
169 QString html =
"<table";
171 if ( ! QY2Styler::styler()->usingAlternateStyleSheet() )
172 html +=
" class=\"stats\"";
174 html +=
"><tr><td><b>"
175 + fromUTF8( zyppObj->name() )
179 html += QString(
"<b>-" ) + zyppObj->edition().asString().c_str() +
"</b>";
181 if ( ! summary.isEmpty() )
182 html +=
" - " + summary;
184 html +=
"</td></tr></table>";
194 QString html = plainText;
197 html.replace( QRegExp(
"&" ),
"&" );
198 html.replace( QRegExp(
"<" ),
"<" );
199 html.replace( QRegExp(
">" ),
">" );
208 QString html =
"<table";
209 if ( ! QY2Styler::styler()->usingAlternateStyleSheet() )
210 html +=
" class=\"stats\"";
212 html +=
">" + contents +
"</table>";
221 return "<tr>" + contents +
"</tr>";
229 return "<td>" + contents +
"</td>";
236 return QString(
"<td>%1</td>" ).arg( contents );
243 return cell( ( (time_t) date == (time_t) 0 ?
"" : date.asString() ) );
250 return cell( fromUTF8( contents ) );
257 return "<td>" + contents +
"</td>";
static QString htmlHeading(ZyppSel selectable, bool showVersion=false)
Returns a uniform heading in HTML format for the specified selectable: name and summary or name,...
static QString htmlStart()
starts the html tag and set the style
virtual QSize minimumSizeHint() const
Returns the minimum size required for this widget.
virtual void showDetails(ZyppSel selectable)=0
Show details for the specified package.
static QString hcell(QString contents)
Returns a string containing a HTML table cell with 'contents' for table headers.
void reloadTab(int newCurrent)
Show data for the last package.
static QString cell(QString contents)
Returns a string containing a HTML table cell with 'contents'.
static QString htmlEscape(const QString &plainText)
Escapes characters special to HTML in a ( plain text ) string, such as: '<' -> '<' '>' -> '>' '&' -> ...
void showDetailsIfVisible(ZyppSel selectable)
Show details for the specified package.
static QString table(const QString &contents)
Returns a string containing a HTML table with 'contents'.
virtual ~YQPkgGenericDetailsView()
Destructor.
static QString row(const QString &contents)
Returns a string containing a HTML table row with 'contents'.
YQPkgGenericDetailsView(QWidget *parent)
Constructor.
- src
- YQPkgGenericDetailsView.cc