40 #define YUILogComponent "qt-pkg"
46 #include "YQPkgGenericDetailsView.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;} ";
92 document()->addResource( QTextDocument::StyleSheetResource, QUrl(
"format.css" ), css );
105 if ( _parentTab && _parentTab->widget(newCurrent) == this )
115 _selectable = selectable;
119 if ( _parentTab->currentWidget() == this )
134 return QSize( 0, 0 );
141 return "<html><head>"
142 "<link rel='stylesheet' type='text/css' href='format.css'>"
147 YQPkgGenericDetailsView::htmlEnd()
149 return "</body></html>";
159 ZyppObj zyppObj = selectable->theObj();
164 QString summary = fromUTF8( zyppObj->summary() );
166 QString html =
"<table";
168 if ( ! YQUI::ui()->usingVisionImpairedPalette() )
169 html +=
" class=\"stats\"";
171 html +=
"><tr><td><b>"
172 + fromUTF8( zyppObj->name() )
176 html += QString(
"<b>-" ) + zyppObj->edition().asString().c_str() +
"</b>";
178 if ( ! summary.isEmpty() )
179 html +=
" - " + summary;
181 html +=
"</td></tr></table>";
191 QString html = plainText;
194 html.replace( QRegExp(
"&" ),
"&" );
195 html.replace( QRegExp(
"<" ),
"<" );
196 html.replace( QRegExp(
">" ),
">" );
205 QString html =
"<table";
206 if ( ! YQUI::ui()->usingVisionImpairedPalette() )
207 html +=
" class=\"stats\"";
209 html +=
">" + contents +
"</table>";
218 return "<tr>" + contents +
"</tr>";
226 return "<td>" + contents +
"</td>";
234 html.sprintf(
"<td>%d</td>", contents );
243 return cell( ( (time_t) date == (time_t) 0 ?
"" : date.asString() ) );
250 return cell( fromUTF8( contents ) );
257 return "<td>" + contents +
"</td>";
261 #include "YQPkgGenericDetailsView.moc"
static QString hcell(QString contents)
Returns a string containing a HTML table cell with 'contents' for table headers.
static QString htmlHeading(ZyppSel selectable, bool showVersion=false)
Returns a uniform heading in HTML format for the specified selectable: name and summary or name...
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'.
virtual void showDetails(ZyppSel selectable)=0
Show details for the specified package.
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.
virtual QSize minimumSizeHint() const
Returns the minimum size required for this widget.
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'.
static QString htmlStart()
starts the html tag and set the style
YQPkgGenericDetailsView(QWidget *parent)
Constructor.